diff options
Diffstat (limited to 'Assets/AmplifyShaderEditor/Plugins')
1731 files changed, 0 insertions, 155378 deletions
diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor.meta b/Assets/AmplifyShaderEditor/Plugins/Editor.meta deleted file mode 100644 index e7035616..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 4a66239afbf6d2c4eb99238642c8d40f -folderAsset: yes -timeCreated: 1481126943 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Actions.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Actions.meta deleted file mode 100644 index 060fde10..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Actions.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: a2ba8588f45692f4ea2fa5afa9faf434 -folderAsset: yes -timeCreated: 1481126944 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Actions/ActionData.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Actions/ActionData.cs deleted file mode 100644 index 67572b46..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Actions/ActionData.cs +++ /dev/null @@ -1,336 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - - -using System; -using UnityEngine; - -namespace AmplifyShaderEditor -{ - public class ActionData - { - public virtual void ExecuteForward() { } - public virtual void ExecuteReverse() { } - } - - // NODES - // Create node - public class CreateNodeActionData : ActionData - { - private int m_nodeId; - private System.Type m_nodeType; - private Vector2 m_nodePos; - - public CreateNodeActionData( ParentNode node ) - { - m_nodeId = node.UniqueId; - m_nodePos = node.Vec2Position; - m_nodeType = node.GetType(); - } - - - public CreateNodeActionData( int nodeId, System.Type nodeType, Vector2 nodePos ) - { - m_nodeId = nodeId; - m_nodePos = nodePos; - m_nodeType = nodeType; - } - - public override void ExecuteForward() - { - UIUtils.CreateNode( m_nodeType, false, m_nodePos, m_nodeId ); - } - - public override void ExecuteReverse() - { - UIUtils.DestroyNode( m_nodeId ); - } - - public override string ToString() - { - return "Create Node - Type: " + m_nodeType + " Node: " + m_nodeId + " Position: " + m_nodePos; - } - } - - // Destroy node - public class DestroyNodeActionData : ActionData - { - private int m_nodeId; - private System.Type m_nodeType; - private Vector2 m_nodePos; - - public DestroyNodeActionData( ParentNode node ) - { - m_nodeId = node.UniqueId; - m_nodePos = node.Vec2Position; - m_nodeType = node.GetType(); - } - - public DestroyNodeActionData( int nodeId, System.Type nodeType, Vector2 nodePos ) - { - m_nodeId = nodeId; - m_nodePos = nodePos; - m_nodeType = nodeType; - } - - public override void ExecuteForward() - { - UIUtils.DestroyNode( m_nodeId ); - } - - public override void ExecuteReverse() - { - UIUtils.CreateNode( m_nodeType, false, m_nodePos, m_nodeId ); - } - - public override string ToString() - { - return "Destroy Node - Type: " + m_nodeType + " Node: " + m_nodeId + " Position: " + m_nodePos; - } - } - - // Move node - public class MoveNodeActionData : ActionData - { - private int m_nodeId; - private Vector2 m_nodeInitalPos; - private Vector2 m_nodeFinalPos; - - public MoveNodeActionData( int nodeId, Vector2 nodeInitialPos, Vector2 nodeFinalPos ) - { - m_nodeId = nodeId; - m_nodeInitalPos = nodeInitialPos; - m_nodeFinalPos = nodeFinalPos; - } - - public override void ExecuteForward() - { - ParentNode node = UIUtils.GetNode( m_nodeId ); - if ( node != null ) - node.Vec2Position = m_nodeFinalPos; - } - - public override void ExecuteReverse() - { - ParentNode node = UIUtils.GetNode( m_nodeId ); - if ( node != null ) - node.Vec2Position = m_nodeInitalPos; - } - - public override string ToString() - { - return "Move Node - Node: " + m_nodeId + " Initial Position: " + m_nodeInitalPos + " Final Position: " + m_nodeFinalPos; - } - } - - // CONNECTIONS - // Create connection - public class CreateConnectionActionData : ActionData - { - private int m_inputNodeId; - private int m_inputPortId; - - private int m_outputNodeId; - private int m_outputPortId; - - public CreateConnectionActionData( int inputNodeId, int inputPortId, int outputNodeId, int outputPortId ) - { - m_inputNodeId = inputNodeId; - m_inputPortId = inputPortId; - m_outputNodeId = outputNodeId; - m_outputPortId = outputPortId; - } - - public override void ExecuteForward() - { - UIUtils.ConnectInputToOutput( m_inputNodeId, m_inputPortId, m_outputNodeId, m_outputPortId ); - } - - public override void ExecuteReverse() - { - UIUtils.DeleteConnection( true, m_inputNodeId, m_inputPortId, false, true ); - } - - public override string ToString() - { - return "Create Connection Node - Input Node: " + m_inputNodeId + " Input Port: " + m_inputPortId + " Output Node: " + m_outputNodeId + " Output Port: " + m_outputPortId; - } - } - - // Destroy connection - public class DestroyConnectionActionData : ActionData - { - private int m_inputNodeId; - private int m_inputPortId; - - private int m_outputNodeId; - private int m_outputPortId; - - public DestroyConnectionActionData( int inputNodeId, int inputPortId, int outputNodeId, int outputPortId ) - { - m_inputNodeId = inputNodeId; - m_inputPortId = inputPortId; - m_outputNodeId = outputNodeId; - m_outputPortId = outputPortId; - } - - public override void ExecuteForward() - { - UIUtils.DeleteConnection( true, m_inputNodeId, m_inputPortId, false, true ); - } - - public override void ExecuteReverse() - { - UIUtils.ConnectInputToOutput( m_inputNodeId, m_inputPortId, m_outputNodeId, m_outputPortId ); - } - - public override string ToString() - { - return "Destroy Connection Node - Input Node: " + m_inputNodeId + " Input Port: " + m_inputPortId + " Output Node: " + m_outputNodeId + " Output Port: " + m_outputPortId; - } - } - - // Move connection - public class MoveInputConnectionActionData : ActionData - { - private int m_oldInputNodeId; - private int m_oldInputNodePortId; - - private int m_newInputNodeId; - private int m_newInputNodePortId; - - private int m_outputNodeId; - private int m_outputPortId; - - public MoveInputConnectionActionData( int oldInputNodeId, int oldInputPortId, int newInputNodeId, int newInputPortId, int outputNodeId, int outputPortId ) - { - m_oldInputNodeId = oldInputNodeId; - m_oldInputNodePortId = oldInputPortId; - - m_newInputNodeId = newInputNodeId; - m_newInputNodePortId = newInputPortId; - - m_outputNodeId = outputNodeId; - m_outputPortId = outputPortId; - } - - public override void ExecuteForward() - { - UIUtils.DeleteConnection( true, m_oldInputNodeId, m_oldInputNodePortId, false, true ); - UIUtils.ConnectInputToOutput( m_newInputNodeId, m_newInputNodePortId, m_outputNodeId, m_outputPortId ); - } - - public override void ExecuteReverse() - { - base.ExecuteReverse(); - UIUtils.DeleteConnection( true, m_newInputNodeId, m_newInputNodePortId, false, true ); - UIUtils.ConnectInputToOutput( m_oldInputNodeId, m_oldInputNodePortId, m_outputNodeId, m_outputPortId ); - } - - public override string ToString() - { - return "Move Input Connection Node - Old Input Node: " + m_oldInputNodeId + " Old Input Port: " + m_oldInputNodePortId + " New Input Node: " + m_newInputNodeId + " New Input Port: " + m_newInputNodePortId + " Output Node: " + m_outputNodeId + " Output Port: " + m_outputPortId; - } - } - - public class MoveOutputConnectionActionData : ActionData - { - private int m_inputNodeId; - private int m_inputPortId; - - private int m_newOutputNodeId; - private int m_newOutputPortId; - - private int m_oldOutputNodeId; - private int m_oldOutputPortId; - - public MoveOutputConnectionActionData( int inputNodeId, int inputPortId, int newOutputNodeId, int newOutputPortId, int oldOutputNodeId, int oldOutputPortId ) - { - m_inputNodeId = inputNodeId; - m_inputPortId = inputPortId; - - m_newOutputNodeId = newOutputNodeId; - m_newOutputPortId = newOutputPortId; - - m_oldOutputNodeId = oldOutputNodeId; - m_oldOutputPortId = oldOutputPortId; - } - - public override void ExecuteForward() - { - UIUtils.DeleteConnection( false, m_oldOutputNodeId, m_oldOutputNodeId, false, true ); - UIUtils.ConnectInputToOutput( m_inputNodeId, m_inputPortId, m_newOutputNodeId, m_newOutputPortId ); - } - - public override void ExecuteReverse() - { - base.ExecuteReverse(); - UIUtils.DeleteConnection( false, m_newOutputNodeId, m_newOutputPortId, false, true ); - UIUtils.ConnectInputToOutput( m_inputNodeId, m_inputPortId, m_oldOutputNodeId, m_oldOutputPortId ); - } - - public override string ToString() - { - return "Move Input Connection Node - Input Node: " + m_inputNodeId + " Input Port: " + m_inputPortId + " Old Output Node: " + m_oldOutputNodeId + " Old Output Port: " + m_oldOutputPortId + " New Output Node: " + m_newOutputNodeId + " New Output Port: " + m_newOutputPortId; - } - } - - public class CreateNewGraphActionData : ActionData - { - private string m_name; - - public CreateNewGraphActionData( string name ) - { - m_name = name; - } - - public override void ExecuteForward() - { - UIUtils.CreateNewGraph( m_name ); - } - } - - public class ChangeNodePropertiesActionData : ActionData - { - private string m_originalProperties; - private string m_newProperties; - private int m_nodeId; - - public ChangeNodePropertiesActionData( ParentNode node, string originalProperties ) - { - m_nodeId = node.UniqueId; - m_originalProperties = originalProperties; - - m_newProperties = string.Empty; - string trash = string.Empty; - node.WriteToString( ref m_newProperties, ref trash ); - } - - public ChangeNodePropertiesActionData( int nodeId, string originalProperties ) - { - m_nodeId = nodeId; - m_originalProperties = originalProperties; - - m_newProperties = string.Empty; - string trash = string.Empty; - UIUtils.GetNode( nodeId ).WriteToString( ref m_newProperties, ref trash ); - } - - public override void ExecuteForward() - { - string[] properties = m_newProperties.Split( IOUtils.FIELD_SEPARATOR ); - UIUtils.GetNode( m_nodeId ).ReadFromString( ref properties ); - } - - public override void ExecuteReverse() - { - string[] properties = m_originalProperties.Split( IOUtils.FIELD_SEPARATOR ); - UIUtils.GetNode( m_nodeId ).ReadFromString( ref properties ); - } - - public override string ToString() - { - return "Change Node Propertie - Node: " + m_nodeId + "\nOriginal Properties:\n" + m_originalProperties + "\nNew Properties:\n" + m_newProperties; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Actions/ActionData.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Actions/ActionData.cs.meta deleted file mode 100644 index 0c1b5d43..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Actions/ActionData.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 29204f353101f46439a93f1c503d3197 -timeCreated: 1481126954 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Actions/ActionLog.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Actions/ActionLog.cs deleted file mode 100644 index 666c9020..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Actions/ActionLog.cs +++ /dev/null @@ -1,58 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System.Collections.Generic; - -namespace AmplifyShaderEditor -{ - public class ActionLog - { - private int m_maxCount; - private int m_index; - private List<ActionData> m_sequence; - - public ActionLog(int maxCount) - { - m_maxCount = maxCount; - m_index = 0; - m_sequence = new List<ActionData>(); - } - - public void AddToLog(ActionData actionData) - { - if (m_sequence.Count > m_maxCount) - { - m_sequence.RemoveAt(0); - } - - m_sequence.Add(actionData); - m_index = m_sequence.Count - 1; - } - - - public void UndoLastAction() - { - if ( m_index > -1 && m_index < m_sequence.Count ) - m_sequence[m_index--].ExecuteReverse(); - } - - public void RedoLastAction() - { - if (m_index < (m_sequence.Count - 1)) - m_sequence[++m_index].ExecuteForward(); - - } - - public void ClearLog() - { - m_sequence.Clear(); - m_index = 0; - } - - public void Destroy() - { - m_sequence.Clear(); - m_sequence = null; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Actions/ActionLog.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Actions/ActionLog.cs.meta deleted file mode 100644 index 4547013c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Actions/ActionLog.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: bc089a69595d8994cb89946a919517c2 -timeCreated: 1481126958 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Actions/ActionSequence.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Actions/ActionSequence.cs deleted file mode 100644 index c60480e0..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Actions/ActionSequence.cs +++ /dev/null @@ -1,39 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System.Collections.Generic; -namespace AmplifyShaderEditor -{ - public class ActionSequence - { - private string m_name; - private List<ActionData> m_sequence; - - public ActionSequence( string name ) - { - m_name = name; - m_sequence = new List<ActionData>(); - } - - public void AddToSequence( ActionData actionData ) - { - m_sequence.Add( actionData ); - } - - public void Execute() - { - for ( int i = 0; i < m_sequence.Count; i++ ) - { - m_sequence[ i ].ExecuteForward(); - } - } - - public void Destroy() - { - m_sequence.Clear(); - m_sequence = null; - } - - public string Name { get { return m_name; } } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Actions/ActionSequence.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Actions/ActionSequence.cs.meta deleted file mode 100644 index 58a732bb..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Actions/ActionSequence.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 43bd963fa46ee9c4680dacff1d8dc0b9 -timeCreated: 1481126955 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Constants.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Constants.cs deleted file mode 100644 index e8ffa67d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Constants.cs +++ /dev/null @@ -1,550 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEngine; -using System.Collections.Generic; - -namespace AmplifyShaderEditor -{ - - public struct Constants - { - public readonly static string[] CustomASEStandardArgsMacros = - { - "#if defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC)//ASE Args Macros", - "#define ASE_TEXTURE2D_ARGS(textureName) Texture2D textureName, SamplerState sampler##textureName", - "#define ASE_TEXTURE3D_ARGS(textureName) Texture3D textureName, SamplerState sampler##textureName", - "#define ASE_TEXTURECUBE_ARGS(textureName) TextureCube textureName, SamplerState sampler##textureName", - "#define ASE_TEXTURE2D_PARAMS(textureName) textureName, sampler##textureName", - "#define ASE_TEXTURE3D_PARAMS(textureName) textureName, sampler##textureName", - "#define ASE_TEXTURECUBE_PARAMS(textureName) textureName, sampler##textureName", - "#define ASE_TEXTURE2D_ARRAY_PARAMS(textureName) textureName, sampler##textureName", - "#else//ASE Args Macros", - "#define ASE_TEXTURE2D_ARGS(textureName) sampler2D textureName", - "#define ASE_TEXTURE3D_ARGS(textureName) sampler3D textureName", - "#define ASE_TEXTURECUBE_ARGS(textureName) samplerCUBE textureName", - "#define ASE_TEXTURE2D_PARAMS(textureName) textureName", - "#define ASE_TEXTURE3D_PARAMS(textureName) textureName", - "#define ASE_TEXTURECUBE_PARAMS(textureName) textureName", - "#define ASE_TEXTURE2D_ARRAY_PARAMS(textureName) textureName", - "#endif//ASE Args Macros\n" - }; - - public readonly static string[] CustomASEDeclararionMacros = - { - "#define ASE_TEXTURE2D(textureName) {0}2D(textureName)", - "#define ASE_TEXTURE2D_ARRAY(textureName) {0}2D_ARRAY(textureName)", - "#define ASE_TEXTURE3D(textureName) {0}3D(textureName)", - "#define ASE_TEXTURECUBE(textureName) {0}CUBE(textureName)\n" - }; - - public readonly static string[] CustomASEStandarSamplingMacrosHelper = - { - "#if defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC)//ASE Sampling Macros", - "#else//ASE Sampling Macros", - "#endif//ASE Sampling Macros\n" - }; - - public readonly static string[] CustomASESamplingMacros = - { - "#define ASE_SAMPLE_TEXTURE2D(textureName,{0}coords) {1}2D{2}(textureName,{0}coords)", - "#define ASE_SAMPLE_TEXTURE2D_LOD(textureName, {0}coord2, lod) {1}2D{2}_LOD(textureName, {0}coord2, lod)", - "#define ASE_SAMPLE_TEXTURE2D_BIAS(textureName,{0}coord2, bias) {1}2D{2}_BIAS(textureName,{0}coord2, bias)", - "#define ASE_SAMPLE_TEXTURE2D_GRAD(textureName,{0}coord2, dpdx, dpdy) {1}2D{2}_GRAD(textureName,{0}coord2, dpdx, dpdy)", - - "#define ASE_SAMPLE_TEXTURE3D(textureName,{0}coord3) {1}3D{2}(textureName,{0}coord3)", - "#define ASE_SAMPLE_TEXTURE3D_LOD(textureName,{0}coord3, lod) {1}3D{2}_LOD(textureName,{0}coord3, lod)", - "#define ASE_SAMPLE_TEXTURE3D_BIAS(textureName,{0}coord3, bias) {1}3D{2}_BIAS(textureName,{0}coord3, bias)", - "#define ASE_SAMPLE_TEXTURE3D_GRAD(textureName,{0}coord3, dpdx, dpdy) {1}3D{2}_GRAD(textureName,{0}coord3, dpdx, dpdy)", - - "#define ASE_SAMPLE_TEXTURECUBE(textureName,{0}coord3) {1}CUBE{2}(textureName,{0}coord3)", - "#define ASE_SAMPLE_TEXTURECUBE_LOD(textureName,{0}coord3, lod) {1}CUBE{2}_LOD(textureName,{0}coord3, lod)", - "#define ASE_SAMPLE_TEXTURECUBE_BIAS(textureName,{0}coord3, bias) {1}CUBE{2}_BIAS(textureName,{0}coord3, bias)\n" - }; - - // SRP - public readonly static string[] CustomASESRPArgsMacros = - { - "#define ASE_TEXTURE2D_ARGS(textureName) TEXTURE2D(textureName), SAMPLER(textureName)", - "#define ASE_TEXTURE3D_ARGS(textureName) TEXTURE3D(textureName), SAMPLER(textureName)", - "#define ASE_TEXTURECUBE_ARGS(textureName) TEXTURECUBE(textureName), SAMPLER(textureName)", - "#define ASE_TEXTURE2D_PARAMS(textureName) textureName, sampler##textureName", - "#define ASE_TEXTURE3D_PARAMS(textureName) textureName, sampler##textureName", - "#define ASE_TEXTURECUBE_PARAMS(textureName) textureName, sampler##textureName", - "#define ASE_TEXTURE2D_ARRAY_PARAMS(textureName) textureName, sampler##textureName\n" - }; - - public readonly static string CustomASEStandardSamplerParams = "#define ASE_TEXTURE_PARAMS(textureName) textureName\n"; - public readonly static string[] CustomASESRPTextureArrayMacros = - { - "#define ASE_TEXTURE2D_ARRAY_ARGS(textureName) TEXTURE2D_ARRAY_ARGS(textureName,sampler##textureName)\n" , - "#define ASE_TEXTURE2D_ARRAY_PARAM(textureName) TEXTURE2D_ARRAY_PARAM(textureName,sampler##textureName)\n" , - "#define ASE_SAMPLE_TEXTURE2D_ARRAY(textureName, coord3) textureName.Sample(sampler##textureName, coord3)", - "#define ASE_SAMPLE_TEXTURE2D_ARRAY_LOD(textureName, coord3, lod) textureName.SampleLevel(sampler##textureName, coord3, lod)" - }; - public readonly static string CustomASESRPSamplerParams = "#define ASE_TEXTURE_PARAMS(textureName) textureName, sampler##textureName\n"; - - public readonly static string[] CustomSRPSamplingMacros = - { - "#define SAMPLE_TEXTURE3D_GRAD(textureName, samplerName, coord3, dpdx, dpdy) textureName.SampleGrad(samplerName, coord3, dpdx, dpdy)", - "#define SAMPLE_TEXTURE3D_BIAS(textureName, samplerName, coord3, bias) textureName.SampleBias(samplerName, coord3, bias)\n" - }; - - public readonly static Dictionary<TextureType, string> TexDeclarationSRPMacros = new Dictionary<TextureType, string> - { - { TextureType.Texture2D,"TEXTURE2D({0}); SAMPLER(sampler{0});"}, - { TextureType.Texture3D,"TEXTURE3D({0}); SAMPLER(sampler{0});"}, - { TextureType.Cube,"TEXTURECUBE({0}); SAMPLER(sampler{0});"}, - { TextureType.Texture2DArray,"TEXTURE2D_ARRAY({0}); SAMPLER(sampler{0});"}, - }; - - public readonly static Dictionary<TextureType, string> SamplerDeclarationSRPMacros = new Dictionary<TextureType, string> - { - { TextureType.Texture2D,"SAMPLER(sampler{0});"}, - { TextureType.Texture3D,"SAMPLER(sampler{0});"}, - { TextureType.Cube,"SAMPLER(sampler{0});"}, - { TextureType.Texture2DArray,"SAMPLER(sampler{0});"}, - }; - - public readonly static Dictionary<TextureType, string> TexDeclarationNoSamplerSRPMacros = new Dictionary<TextureType, string> - { - { TextureType.Texture2D,"TEXTURE2D({0});"}, - { TextureType.Texture3D,"TEXTURE3D({0});"}, - { TextureType.Cube,"TEXTURECUBE({0});"}, - { TextureType.Texture2DArray,"TEXTURE2D_ARRAY({0});"}, - }; - - public readonly static Dictionary<TextureType, string> TexSampleSRPMacros = new Dictionary<TextureType, string> - { - { TextureType.Texture2D,"SAMPLE_TEXTURE2D{0}({1},sampler{2},{3})"}, - { TextureType.Texture3D,"SAMPLE_TEXTURE3D{0}({1},sampler{2},{3})"}, - { TextureType.Cube,"SAMPLE_TEXTURECUBE{0}({1},sampler{2},{3})"}, - { TextureType.Texture2DArray,"SAMPLE_TEXTURE2D_ARRAY{0}({1},sampler{2},{3})"}, - }; - - public readonly static Dictionary<TextureType, string> TexParams = new Dictionary<TextureType, string> - { - { TextureType.Texture2D,"ASE_TEXTURE2D_PARAMS({0})"}, - { TextureType.Texture3D,"ASE_TEXTURE3D_PARAMS({0})"}, - { TextureType.Cube,"ASE_TEXTURECUBE_PARAMS({0})"}, - { TextureType.Texture2DArray,"ASE_TEXTURE2D_ARRAY_PARAMS({0})"}, - }; - - // STANDARD - - public readonly static string[] CustomStandardSamplingMacros = - { - "#if defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC)//ASE Sampler Macros", - "#define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex.SampleLevel (sampler##tex,coord, lod)", - "#define UNITY_SAMPLE_TEX2D_BIAS(tex,coord,bias) tex.SampleBias(sampler##tex,coord,bias)", - "#define UNITY_SAMPLE_TEX2D_GRAD(tex,coord,ddx,ddy) tex.SampleGrad(sampler##tex,coord,ddx,ddy)", - "#define UNITY_SAMPLE_TEX3D_BIAS(tex,coord,bias) tex.SampleBias(sampler##tex,coord,bias)", - "#define UNITY_SAMPLE_TEX3D_GRAD(tex,coord,ddx,ddy) tex.SampleGrad(sampler##tex,coord,ddx,ddy)", - "#define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplerTex,coord,lod) tex.SampleLevel (samplerTex,coord, lod)", - "#define UNITY_SAMPLE_TEX2D_SAMPLER_BIAS(tex,samplerTex,coord,bias) tex.SampleBias(samplerTex,coord,bias)", - "#define UNITY_SAMPLE_TEX2D_SAMPLER_GRAD(tex,samplerTex,coord,ddx,ddy) tex.SampleGrad(samplerTex,coord,ddx,ddy)", - "#define UNITY_SAMPLE_TEX3D_SAMPLER_BIAS(tex,samplerTex,coord,bias) tex.SampleBias(samplerTex,coord,bias)", - "#define UNITY_SAMPLE_TEX3D_SAMPLER_GRAD(tex,samplerTex,coord,ddx,ddy) tex.SampleGrad(samplerTex,coord,ddx,ddy)", - "#else//ASE Sampler Macros", - "#define UNITY_SAMPLE_TEX2D_LOD(tex,coord,lod) tex2Dlod(tex,float4(coord,0,lod))", - "#define UNITY_SAMPLE_TEX2D_BIAS(tex,coord,bias) tex2Dbias(tex,float4(coord,0,bias))", - "#define UNITY_SAMPLE_TEX2D_GRAD(tex,coord,ddx,ddy) tex2D(tex,coord,ddx,ddy)", - "#define UNITY_SAMPLE_TEX3D_BIAS(tex,coord,bias) tex3Dbias(tex,float4(coord,bias))", - "#define UNITY_SAMPLE_TEX3D_GRAD(tex,coord,ddx,ddy) tex3D(tex,coord,ddx,ddy)", - "#define UNITY_SAMPLE_TEX2D_SAMPLER_LOD(tex,samplerTex,coord,lod) tex2Dlod(tex,float4(coord,0,lod))", - "#define UNITY_SAMPLE_TEX2D_SAMPLER_BIAS(tex,samplerTex,coord,bias) tex2Dbias(tex,float4(coord,0,bias))", - "#define UNITY_SAMPLE_TEX2D_SAMPLER_GRAD(tex,samplerTex,coord,ddx,ddy) tex2D(tex,coord,ddx,ddy)", - "#define UNITY_SAMPLE_TEX3D_SAMPLER_BIAS(tex,samplerTex,coord,bias) tex3Dbias(tex,float4(coord,bias))", - "#define UNITY_SAMPLE_TEX3D_SAMPLER_GRAD(tex,samplerTex,coord,ddx,ddy) tex3D(tex,coord,ddx,ddy)", - "#endif//ASE Sampler Macros\n" - }; - - public readonly static string[] CustomArraySamplingMacros = - { - "#if defined(UNITY_COMPILER_HLSL2GLSL) || defined(SHADER_TARGET_SURFACE_ANALYSIS)//ASE Array Sampler Macros", - "#define ASE_SAMPLE_TEX2DARRAY_GRAD(tex,coord,dx,dy) UNITY_SAMPLE_TEX2DARRAY (tex,coord)", - "#else//ASE Array Sampler Macros", - "#define ASE_SAMPLE_TEX2DARRAY_GRAD(tex,coord,dx,dy) tex.SampleGrad (sampler##tex,coord,dx,dy)", - "#endif//ASE Array Sampler Macros\n" - }; - - public readonly static Dictionary<TextureType, string> TexDeclarationStandardMacros = new Dictionary<TextureType, string> - { - { TextureType.Texture2D,"UNITY_DECLARE_TEX2D({0});"}, - { TextureType.Texture3D,"UNITY_DECLARE_TEX3D({0});"}, - { TextureType.Cube,"UNITY_DECLARE_TEXCUBE({0});"}, - { TextureType.Texture2DArray,"UNITY_DECLARE_TEX2DARRAY({0});"} - }; - - - public readonly static Dictionary<TextureType, string> TexDeclarationNoSamplerStandardMacros = new Dictionary<TextureType, string> - { - { TextureType.Texture2D,"UNITY_DECLARE_TEX2D({0});"}, - { TextureType.Texture3D,"UNITY_DECLARE_TEX3D({0});"}, - { TextureType.Cube,"UNITY_DECLARE_TEXCUBE({0});"}, - { TextureType.Texture2DArray,"UNITY_DECLARE_TEX2DARRAY({0});"} - }; - - public readonly static Dictionary<TextureType, string> TexSampleStandardMacros = new Dictionary<TextureType, string> - { - { TextureType.Texture2D,"UNITY_SAMPLE_TEX2D{0}({1},{2})"}, - { TextureType.Texture3D,"UNITY_SAMPLE_TEX3D{0}({1},{2})"}, - { TextureType.Cube,"UNITY_SAMPLE_TEXCUBE{0}({1},{2})"}, - { TextureType.Texture2DArray,"UNITY_SAMPLE_TEX2DARRAY{0}({1},{2})"} - }; - - - public readonly static char SemiColonSeparator = '@'; - public readonly static string AppDataFullName = "appdata_full"; - public readonly static string CustomAppDataFullName = "appdata_full_custom"; - public readonly static string CustomAppDataFullBody = - "\n\t\tstruct appdata_full_custom\n" + - "\t\t{\n" + - "\t\t\tfloat4 vertex : POSITION;\n" + - "\t\t\tfloat4 tangent : TANGENT;\n" + - "\t\t\tfloat3 normal : NORMAL;\n" + - "\t\t\tfloat4 texcoord : TEXCOORD0;\n" + - "\t\t\tfloat4 texcoord1 : TEXCOORD1;\n" + - "\t\t\tfloat4 texcoord2 : TEXCOORD2;\n" + - "\t\t\tfloat4 texcoord3 : TEXCOORD3;\n" + - "\t\t\tfixed4 color : COLOR;\n" + - "\t\t\tUNITY_VERTEX_INPUT_INSTANCE_ID\n"; - - public readonly static string IncludeFormat = "#include \"{0}\""; - public readonly static string PragmaFormat = "#pragma {0}"; - public readonly static string DefineFormat = "#define {0}"; - - public readonly static string RenderTypeHelperStr = "RenderType"; - public readonly static string RenderQueueHelperStr = "Queue"; - - public readonly static string DefaultShaderName = "New Amplify Shader"; - - public readonly static string UndoReplaceMasterNodeId = "Replacing Master Node"; - public readonly static string UnityLightingLib = "Lighting.cginc"; - public readonly static string UnityAutoLightLib = "AutoLight.cginc"; - public readonly static string UnityBRDFLib = "UnityStandardBRDF.cginc"; - public readonly static string LocalValueDecWithoutIdent = "{0} {1} = {2};"; - public readonly static string CustomTypeLocalValueDecWithoutIdent = "{0} {1} =({0}){2};"; - public readonly static string LocalValueDefWithoutIdent = "{0} {1} {2};"; - public readonly static string TilingOffsetFormat = "{0} * {1} + {2}"; - public static string InvalidPostProcessDatapath = "__DELETED_GUID_Trash"; - //TEMPLATES - - public static float PlusMinusButtonLayoutWidth = 15; - - public static float NodeButtonSizeX = 16; - public static float NodeButtonSizeY = 16; - public static float NodeButtonDeltaX = 5; - public static float NodeButtonDeltaY = 11; - - public readonly static string ReservedPropertyNameStr = "Property name '{0}' is reserved and cannot be used"; - public readonly static string NumericPropertyNameStr = "Property name '{0}' is numeric thus cannot be used"; - public readonly static string DeprecatedMessageStr = "Node '{0}' is deprecated. Use node '{1}' instead."; - public readonly static string DeprecatedNoAlternativeMessageStr = "Node '{0}' is deprecated and should be removed."; - public readonly static string UndoChangePropertyTypeNodesId = "Changing Property Types"; - public readonly static string UndoChangeTypeNodesId = "Changing Nodes Types"; - public readonly static string UndoMoveNodesId = "Moving Nodes"; - public readonly static string UndoRegisterFullGrapId = "Register Graph"; - public readonly static string UndoAddNodeToCommentaryId = "Add node to Commentary"; - public readonly static string UndoRemoveNodeFromCommentaryId = "Remove node from Commentary"; - public readonly static string UndoCreateDynamicPortId = "Create Dynamic Port"; - public readonly static string UndoDeleteDynamicPortId = "Destroy Dynamic Port"; - public readonly static string UndoRegisterNodeId = "Register Object"; - public readonly static string UndoUnregisterNodeId = "Unregister Object"; - public readonly static string UndoCreateNodeId = "Create Object"; - public readonly static string UndoPasteNodeId = "Paste Object"; - public readonly static string UndoDeleteNodeId = "Destroy Object"; - public readonly static string UndoDeleteConnectionId = "Destroy Connection"; - public readonly static string UndoCreateConnectionId = "Create Connection"; - - public readonly static float MenuDragSpeed = -0.5f; - public readonly static string DefaultCustomInspector = "ASEMaterialInspector"; - public readonly static string ReferenceTypeStr = "Mode"; - public readonly static string AvailableReferenceStr = "Reference"; - public readonly static string InstancePostfixStr = " (Reference) "; - - public readonly static string ASEMenuName = "Amplify Shader"; - - public readonly static string LodCrossFadeOption2017 = "dithercrossfade"; - - public readonly static string UnityShaderVariables = "UnityShaderVariables.cginc"; - public readonly static string UnityCgLibFuncs = "UnityCG.cginc"; - public readonly static string UnityStandardUtilsLibFuncs = "UnityStandardUtils.cginc"; - public readonly static string UnityPBSLightingLib = "UnityPBSLighting.cginc"; - public readonly static string UnityDeferredLightLib = "UnityDeferredLibrary.cginc"; - public readonly static string ATSharedLibGUID = "ba242738c4be3324aa88d126f7cc19f9"; -#if UNITY_5_6_OR_NEWER - public readonly static string CameraDepthTextureValue = "UNITY_DECLARE_DEPTH_TEXTURE( _CameraDepthTexture );"; - -#else - public readonly static string CameraDepthTextureValue = "uniform sampler2D _CameraDepthTexture;"; -#endif - //public readonly static string CameraDepthTextureSRPVar = "TEXTURE2D(_CameraDepthTexture);"; - //public readonly static string CameraDepthTextureSRPSampler = "SAMPLER(sampler_CameraDepthTexture);"; - public readonly static string CameraDepthTextureLWEnabler = "REQUIRE_DEPTH_TEXTURE 1"; - - public readonly static string CameraDepthTextureTexelSize = "uniform float4 _CameraDepthTexture_TexelSize;"; - public readonly static string InstanceIdMacro = "UNITY_VERTEX_INPUT_INSTANCE_ID"; - public readonly static string InstanceIdVariable = "UNITY_GET_INSTANCE_ID({0})"; - - - public readonly static string HelpURL = "http://wiki.amplify.pt/index.php?title=Unity_Products:Amplify_Shader_Editor"; - //public readonly static string NodeCommonUrl = "http://wiki.amplify.pt/index.php?title=Unity_Products:Amplify_Shader_Editor/Nodes#"; - //public readonly static string CommunityNodeCommonUrl = "http://wiki.amplify.pt/index.php?title=Unity_Products:Amplify_Shader_Editor/Community_Nodes#"; - public readonly static string NodeCommonUrl = "http://wiki.amplify.pt/index.php?title=Unity_Products:Amplify_Shader_Editor/"; - public readonly static string CommunityNodeCommonUrl = "http://wiki.amplify.pt/index.php?title=Unity_Products:Amplify_Shader_Editor/"; - public readonly static Color InfiniteLoopColor = Color.red; - - public readonly static Color DefaultCategoryColor = new Color( 0.26f, 0.35f, 0.44f, 1.0f ); - public readonly static Color NodeBodyColor = new Color( 1f, 1f, 1f, 1.0f ); - - public readonly static Color ModeTextColor = new Color( 1f, 1f, 1f, 0.25f ); - public readonly static Color ModeIconColor = new Color( 1f, 1f, 1f, 0.75f ); - - public readonly static Color PortTextColor = new Color( 1f, 1f, 1f, 0.5f ); - public readonly static Color PortLockedTextColor = new Color( 1f, 1f, 1f, 0.35f ); - public readonly static Color BoxSelectionColor = new Color( 0.5f, 0.75f, 1f, 0.33f ); - public readonly static Color SpecialRegisterLocalVarSelectionColor = new Color( 0.27f, 0.52f, 1.0f, 1f ); - public readonly static Color SpecialGetLocalVarSelectionColor = new Color( 0.2f, 0.8f, 0.4f, 1f ); - public readonly static Color NodeSelectedColor = new Color( 0.85f, 0.56f, 0f, 1f ); - public readonly static Color NodeDefaultColor = new Color( 1f, 1f, 1f, 1f ); - public readonly static Color NodeConnectedColor = new Color( 1.0f, 1f, 0.0f, 1f ); - public readonly static Color NodeErrorColor = new Color( 1f, 0.5f, 0.5f, 1f ); - public readonly static string NoSpecifiedCategoryStr = "<None>"; - - public readonly static int MINIMIZE_WINDOW_LOCK_SIZE = 630; - - public readonly static int FoldoutMouseId = 0; // Left Mouse Button - - public readonly static float SNAP_SQR_DIST = 200f; - public readonly static int INVALID_NODE_ID = -1; - public readonly static float WIRE_WIDTH = 7f; - public readonly static float WIRE_CONTROL_POINT_DIST = 0.7f; - public readonly static float WIRE_CONTROL_POINT_DIST_INV = 1.7f; - - public readonly static float IconsLeftRightMargin = 5f; - public readonly static float PropertyPickerWidth = 16f; - public readonly static float PropertyPickerHeight = 16f; - public readonly static float PreviewExpanderWidth = 16f; - public readonly static float PreviewExpanderHeight = 16f; - public readonly static float TextFieldFontSize = 11f; - public readonly static float DefaultFontSize = 15f; - public readonly static float DefaultTitleFontSize = 13f; - public readonly static float PropertiesTitleFontSize = 11f; - public readonly static float MessageFontSize = 40f; - public readonly static float SelectedObjectFontSize = 30f; - - public readonly static float PORT_X_ADJUST = 10; - public readonly static float PORT_INITIAL_X = 10; - - public readonly static float PORT_INITIAL_Y = 40; - public readonly static float INPUT_PORT_DELTA_Y = 5; - public readonly static float PORT_TO_LABEL_SPACE_X = 5; - - public readonly static float NODE_HEADER_HEIGHT = 32; - public readonly static float NODE_HEADER_EXTRA_HEIGHT = 5; - public readonly static float NODE_HEADER_LEFTRIGHT_MARGIN = 10; - - public readonly static float MULTIPLE_SELECION_BOX_ALPHA = 0.5f; - public readonly static float RMB_CLICK_DELTA_TIME = 0.1f; - public readonly static float RMB_SCREEN_DIST = 10f; - - public readonly static float CAMERA_MAX_ZOOM = 2f; - public readonly static float CAMERA_MIN_ZOOM = 1f; - public readonly static float CAMERA_ZOOM_SPEED = 0.1f; - public readonly static float ALT_CAMERA_ZOOM_SPEED = -0.05f; - - public readonly static object INVALID_VALUE = null; - - public readonly static float HORIZONTAL_TANGENT_SIZE = 100f; - public readonly static float OUTSIDE_WIRE_MARGIN = 5f; - - public readonly static string SubTitleNameFormatStr = "Name( {0} )"; - public readonly static string SubTitleSpaceFormatStr = "Space( {0} )"; - public readonly static string SubTitleTypeFormatStr = "Type( {0} )"; - public readonly static string SubTitleValueFormatStr = "Value( {0} )"; - public readonly static string SubTitleConstFormatStr = "Const( {0} )"; - public readonly static string SubTitleVarNameFormatStr = "Var( {0} )"; - public readonly static string SubTitleRefNameFormatStr = "Ref( {0} )"; - - public readonly static string CodeWrapper = "( {0} )"; - - public readonly static string NodesDumpFormat = "{0}:,{1},{2}\n"; - public readonly static string TagFormat = " \"{0}\" = \"{1}\""; - - public readonly static string LocalVarIdentation = "\t\t\t"; - public readonly static string SimpleLocalValueDec = LocalVarIdentation + "{0} {1};\n"; - - public readonly static string LocalValueDec = LocalVarIdentation + LocalValueDecWithoutIdent + '\n'; - public readonly static string LocalValueDef = LocalVarIdentation + "{0} = {1};\n"; - public readonly static string CastHelper = "({0}).{1}"; - public readonly static string PropertyLocalVarDec = "{0} {1} = {0}({2});"; - public readonly static string[] UniformDec = { "uniform {0} {1};", "{0} {1};" }; - - public readonly static string PropertyValueLabel = "Value( {0} )"; - public readonly static string ConstantsValueLabel = "Const( {0} )"; - - public readonly static string PropertyFloatFormatLabel = "0.###"; - public readonly static string PropertyBigFloatFormatLabel = "0.###e+0"; - - public readonly static string PropertyIntFormatLabel = "0"; - public readonly static string PropertyBigIntFormatLabel = "0e+0"; - - - public readonly static string PropertyVectorFormatLabel = "0.##"; - public readonly static string PropertyBigVectorFormatLabel = "0.##e+0"; - - - public readonly static string PropertyMatrixFormatLabel = "0.#"; - public readonly static string PropertyBigMatrixFormatLabel = "0.#e+0"; - - public readonly static string NoPropertiesLabel = "No assigned properties"; - - public readonly static string ValueLabel = "Value"; - public readonly static string DefaultValueLabel = "Default Value"; - public readonly static string MaterialValueLabel = "Material Value"; - public readonly static GUIContent DefaultValueLabelContent = new GUIContent( "Default Value" ); - public readonly static GUIContent MaterialValueLabelContent = new GUIContent( "Material Value" ); - - public readonly static string InputVarStr = "i";//"input"; - public readonly static string OutputVarStr = "o";//"output"; - - public readonly static string CustomLightOutputVarStr = "s"; - public readonly static string CustomLightStructStr = "Custom"; - - public readonly static string VertexShaderOutputStr = "o"; - public readonly static string VertexShaderInputStr = "v";//"vertexData"; - public readonly static string VertexDataFunc = "vertexDataFunc"; - - public readonly static string VirtualCoordNameStr = "vcoord"; - - public readonly static string VertexVecNameStr = "vertexVec"; - public readonly static string VertexVecDecStr = "float3 " + VertexVecNameStr; - public readonly static string VertexVecVertStr = VertexShaderOutputStr + "." + VertexVecNameStr; - - public readonly static string NormalVecNameStr = "normalVec"; - public readonly static string NormalVecDecStr = "float3 " + NormalVecNameStr; - public readonly static string NormalVecFragStr = InputVarStr + "." + NormalVecNameStr; - public readonly static string NormalVecVertStr = VertexShaderOutputStr + "." + NormalVecNameStr; - - - public readonly static string IncidentVecNameStr = "incidentVec"; - public readonly static string IncidentVecDecStr = "float3 " + IncidentVecNameStr; - public readonly static string IncidentVecDefStr = VertexShaderOutputStr + "." + IncidentVecNameStr + " = normalize( " + VertexVecNameStr + " - _WorldSpaceCameraPos.xyz)"; - public readonly static string IncidentVecFragStr = InputVarStr + "." + IncidentVecNameStr; - public readonly static string IncidentVecVertStr = VertexShaderOutputStr + "." + IncidentVecNameStr; - public readonly static string WorldNormalLocalDecStr = "WorldNormalVector( " + Constants.InputVarStr + " , {0}( 0,0,1 ))"; - - public readonly static string VFaceVariable = "ASEVFace"; - public readonly static string VFaceInput = "half ASEVFace : VFACE"; - - public readonly static string ColorVariable = "vertexColor"; - public readonly static string ColorInput = "float4 vertexColor : COLOR"; - - public readonly static string NoStringValue = "None"; - public readonly static string EmptyPortValue = " "; - - public readonly static string[] OverallInvalidChars = { "\r", "\n", "\\", " ", ".", ">", ",", "<", "\'", "\"", ";", ":", "[", "{", "]", "}", "=", "+", "`", "~", "/", "?", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "-" }; - public readonly static string[] ShaderInvalidChars = { "\r", "\n", "\\", "\'", "\"", }; - public readonly static string[] EnumInvalidChars = { "\r", "\n", "\\", ".", ">", ",", "<", "\'", "\"", ";", ":", "[", "{", "]", "}", "=", "+", "`", "~", "/", "?", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "-" }; - public readonly static string[] AttrInvalidChars = { "\r", "\n", "\\", ">", "<", "\'", "\"", ";", ":", "[", "{", "]", "}", "=", "+", "`", "~", "/", "?", "!", "@", "#", "$", "%", "^", "&", "*" }; - - public readonly static string[] WikiInvalidChars = { "#", "<", ">", "[", "]", "|", "{", "}", "%", "+", "?", "\\", "/", ",", ";", "." }; - - public readonly static string[,] UrlReplacementStringValues = - { - { " = ", "Equals" }, - { " == ", "Equals" }, - { " != ", "NotEqual" }, - { " \u2260 ", "NotEqual" }, - { " > ", "Greater" }, - { " \u2265 " , "GreaterOrEqual" }, - { " >= ", "GreaterOrEqual" }, - { " < ", "Less" }, - { " \u2264 ", "LessOrEqual" }, - { " <= ", "LessOrEqual" }, - { " ", "_" }, - { "[", string.Empty }, - { "]", string.Empty } - }; - - public readonly static int UrlReplacementStringValuesLen = UrlReplacementStringValues.Length / 2; - - public readonly static string[,] ReplacementStringValues = - { - { " = ", "Equals" }, - { " == ", "Equals" }, - { " != ", "NotEqual" }, - { " \u2260 ", "NotEqual" }, - { " > ", "Greater" }, - { " \u2265 ", "GreaterOrEqual" }, - { " >= ", "GreaterOrEqual" }, - { " < ", "Less" }, - { " \u2264 ", "LessOrEqual" }, - { " <= ", "LessOrEqual" } - }; - public readonly static int ReplacementStringValuesLen = ReplacementStringValues.Length / 2; - - public readonly static string InternalData = "INTERNAL_DATA"; - - - - public readonly static string NoMaterialStr = "None"; - - public readonly static string OptionalParametersSep = " "; - - public readonly static string NodeUndoId = "NODE_UNDO_ID"; - public readonly static string NodeCreateUndoId = "NODE_CREATE_UNDO_ID"; - public readonly static string NodeDestroyUndoId = "NODE_DESTROY_UNDO_ID"; - - // Custom node tags - //[InPortBegin:Id:Type:Name:InPortEnd] - public readonly static string CNIP = "#IP"; - - public readonly static float FLOAT_DRAW_HEIGHT_FIELD_SIZE = 16f; - public readonly static float FLOAT_DRAW_WIDTH_FIELD_SIZE = 45f; - public readonly static float FLOAT_WIDTH_SPACING = 3f; - - public readonly static Color LockedPortColor = new Color( 0.3f, 0.3f, 0.3f, 0.5f ); - -#if UNITY_2018_2_OR_NEWER - public readonly static int[] AvailableUVChannels = { 0, 1, 2, 3, 4, 5, 6, 7 }; - public readonly static string[] AvailableUVChannelsStr = { "0", "1", "2", "3", "4", "5", "6", "7"}; - public readonly static string AvailableUVChannelLabel = "UV Channel"; - - public readonly static int[] AvailableUVSets = { 0, 1, 2, 3, 4, 5, 6, 7 }; - public readonly static string[] AvailableUVSetsStr = { "1", "2", "3", "4","5", "6", "7", "8" }; - public readonly static string AvailableUVSetsLabel = "UV Set"; -#else - public readonly static int[] AvailableUVChannels = { 0, 1, 2, 3 }; - public readonly static string[] AvailableUVChannelsStr = { "0", "1", "2", "3" }; - public readonly static string AvailableUVChannelLabel = "UV Channel"; - - public readonly static int[] AvailableUVSets = { 0, 1, 2, 3 }; - public readonly static string[] AvailableUVSetsStr = { "1", "2", "3", "4" }; - public readonly static string AvailableUVSetsLabel = "UV Set"; -#endif - - public readonly static int[] AvailableUVSizes = { 2, 3, 4 }; - public readonly static string[] AvailableUVSizesStr = { "Float 2", "Float 3", "Float 4" }; - public readonly static string AvailableUVSizesLabel = "Coord Size"; - - - public readonly static string LineSeparator = "________________________________"; - - public readonly static Vector2 CopyPasteDeltaPos = new Vector2( 40, 40 ); - - public readonly static string[] VectorSuffixes = { ".x", ".y", ".z", ".w" }; - public readonly static string[] ColorSuffixes = { ".r", ".g", ".b", ".a" }; - - - public const string InternalDataLabelStr = "Internal Data"; - public const string AttributesLaberStr = "Attributes"; - public const string ParameterLabelStr = "Parameters"; - - public static readonly string[] ReferenceArrayLabels = { "Object", "Reference" }; - - public static readonly string[] ChannelNamesVector = { "X", "Y", "Z", "W" }; - public static readonly string[] ChannelNamesColor = { "R", "G", "B", "A" }; - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Constants.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Constants.cs.meta deleted file mode 100644 index 59d7bad5..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Constants.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: d833dd0968f913f449477da6bcd56b48 -timeCreated: 1481126959 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/CustomDrawers.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/CustomDrawers.meta deleted file mode 100644 index a2177293..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/CustomDrawers.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 2206c4bd7f3d18643a6a3452b0c070d1 -folderAsset: yes -timeCreated: 1522769470 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/EditableIf.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/EditableIf.cs deleted file mode 100644 index e94e02ed..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/EditableIf.cs +++ /dev/null @@ -1,294 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> -// -// Donated by BinaryCats -// https://forum.unity.com/threads/best-tool-asset-store-award-amplify-shader-editor-node-based-shader-creation-tool.430959/page-60#post-3414465 -////////////////////// -// README / HOW TO USE -////////////////////// -// Examples: -// -// Floats: -// -// x Equals value -// EditableIf( _float1, Equalto, 1) -// This will allow the value to be edited, if the property _float1 is equal to 1. (_float1==1) -// Note: NotEqualTo is also a valid argument which will do the opposite of this example.EditableIf(_float1, NotEqualTo, 1) (NotEqualTo != 1) -// -// x Greater than value -// EditableIf(_Float1,GreaterThan,1) -// This will allow the value to be edited if the property _float1 is Greater than 1. (_float1>1) -// -// x Greater Than Or Equal to value -// EditableIf(_Float1,GreaterThanOrEqualTo,1) -// This will allow the value to be edited if the property _float1 is Greater than or equal to 1. (_float1>=1) -// -// -// x Less Than value -// EditableIf(_Float1,LessThan,1) -// This will allow the value to be edited if the property _float1 is Less than 1. (_float1<1) -// -// x Less Than Or Equal to value -// EditableIf(_Float1,LessThanOrEqualTo,1) -// This will allow the value to be edited if the property _float1 is Less than or equal to 1. (_float1<=1) -// -// -// Colour: -// -// x Equals r,g,b,a -// EditableIf(_Color0,EqualTo,255,255,255,255) -// This will allow the value to be edited, if the property _Color0 R,G,B and A value all Equal 255. (_Color0.R==255 && _Color0.G==255 & _Color0.B == 255 && _Color0.A == 255) -// -// x Equals alpha -// EditableIf(_Color0,EqualTo,null,null,null,255) -// This will allow the value to be edited, if the property _Color0 Alpha value is Equal to 255. (_Color0.A == 255) -// -// a Greater than blue -// EditableIf(_Color0,GreaterThan,null,null,125) -// This will allow the value to be edited, if the property _Color0 Blue value is Greater Than 125. (_Color0.B > 125) -// Note: as I do not want to check the Red or Green Values, i have entered "null" for the parameter -// Note: I have not inputted a value to check for Alpha, as i do not want to check it. Simularly, if I wanted to Only check the Red Value I could have used EditableIf(_Color0,GreaterThan,125) -// -// Like wise with floats GreaterThanOrEqualTo, LessThan, LessThanOrEqualTo -// -// Vector: -// Vector Checks work the same as colour checks -// -// Texture: -// x Does Not have a Texture -// EditableIf(_TextureSample0,Equals,null) -// This will allow the value to be edited, if the property _TextureSample0 does NOT have a texture -// -// x Does have a Texture -// EditableIf(_TextureSample0,NotEqualTo,null) -// This will allow the value to be edited, if the property _TextureSample0 does have a texture - -using UnityEngine; -using UnityEditor; -using System; - -public enum ComparisonOperators -{ - EqualTo, NotEqualTo, GreaterThan, LessThan, EqualsOrGreaterThan, EqualsOrLessThan, ContainsFlags, - DoesNotContainsFlags -} - -public class EditableIf : MaterialPropertyDrawer -{ - ComparisonOperators op; - string FieldName = ""; - object ExpectedValue; - bool InputError; - public EditableIf() - { - InputError = true; - } - public EditableIf( object fieldname, object comparison, object expectedvalue ) - { - if( expectedvalue.ToString().ToLower() == "true" ) - { - expectedvalue = (System.Single)1; - } - else if( expectedvalue.ToString().ToLower() == "false" ) - { - expectedvalue = (System.Single)0; - - } - Init( fieldname, comparison, expectedvalue ); - - } - public EditableIf( object fieldname, object comparison, object expectedvaluex, object expectedvaluey ) - { - float? x = expectedvaluex as float?; - float? y = expectedvaluey as float?; - float? z = float.NegativeInfinity; - float? w = float.NegativeInfinity; - x = GetVectorValue( x ); - y = GetVectorValue( y ); - - Init( fieldname, comparison, new Vector4( x.Value, y.Value, z.Value, w.Value ) ); - } - public EditableIf( object fieldname, object comparison, object expectedvaluex, object expectedvaluey, object expectedvaluez ) - { - float? x = expectedvaluex as float?; - float? y = expectedvaluey as float?; - float? z = expectedvaluez as float?; - float? w = float.NegativeInfinity; - x = GetVectorValue( x ); - y = GetVectorValue( y ); - z = GetVectorValue( z ); - - Init( fieldname, comparison, new Vector4( x.Value, y.Value, z.Value, w.Value ) ); - - } - public EditableIf( object fieldname, object comparison, object expectedvaluex, object expectedvaluey, object expectedvaluez, object expectedvaluew ) - { - var x = expectedvaluex as float?; - var y = expectedvaluey as float?; - var z = expectedvaluez as float?; - var w = expectedvaluew as float?; - x = GetVectorValue( x ); - y = GetVectorValue( y ); - z = GetVectorValue( z ); - w = GetVectorValue( w ); - - Init( fieldname, comparison, new Vector4( x.Value, y.Value, z.Value, w.Value ) ); - - } - - private void Init( object fieldname, object comparison, object expectedvalue ) - { - FieldName = fieldname.ToString(); - var names = Enum.GetNames( typeof( ComparisonOperators ) ); - var name = comparison.ToString().ToLower().Replace( " ", "" ); - - for( int i = 0; i < names.Length; i++ ) - { - if( names[ i ].ToLower() == name ) - { - op = (ComparisonOperators)i; - break; - } - } - - ExpectedValue = expectedvalue; - } - - private static float? GetVectorValue( float? x ) - { - if( x.HasValue == false ) - { - x = float.NegativeInfinity; - } - - return x; - } - - // Draw the property inside the given rect - public override void OnGUI( Rect position, MaterialProperty prop, String label, MaterialEditor editor ) - { - if( InputError ) - { - EditorGUI.LabelField( position, "EditableIf Attribute Error: Input parameters are invalid!" ); - return; - } - var LHSprop = MaterialEditor.GetMaterialProperty( prop.targets, FieldName ); - if( string.IsNullOrEmpty( LHSprop.name ) ) - { - LHSprop = MaterialEditor.GetMaterialProperty( prop.targets, "_" + FieldName.Replace( " ", "" ) ); - if( string.IsNullOrEmpty( LHSprop.name ) ) - { - EditorGUI.LabelField( position, "EditableIf Attribute Error: " + FieldName + " Does not exist!" ); - return; - } - } - object LHSVal = null; - - bool test = false; - switch( LHSprop.type ) - { - case MaterialProperty.PropType.Color: - case MaterialProperty.PropType.Vector: - LHSVal = LHSprop.type == MaterialProperty.PropType.Color ? (Vector4)LHSprop.colorValue : LHSprop.vectorValue; - var v4 = ExpectedValue as Vector4?; - v4 = v4.HasValue ? v4 : new Vector4( (System.Single)ExpectedValue, float.NegativeInfinity, float.NegativeInfinity, float.NegativeInfinity ); - - if( LHSprop.type == MaterialProperty.PropType.Color ) - { - test = VectorCheck( (Vector4)LHSVal, op, v4 / 255 ); - - } - else - test = VectorCheck( (Vector4)LHSVal, op, v4 ); - break; - case MaterialProperty.PropType.Range: - case MaterialProperty.PropType.Float: - LHSVal = LHSprop.floatValue; - test = ( Check( LHSVal, op, ExpectedValue ) ); - break; - case MaterialProperty.PropType.Texture: - LHSVal = LHSprop.textureValue; - test = ( CheckObject( LHSVal, op, ExpectedValue ) ); - break; - } - - GUI.enabled = test; - editor.DefaultShaderProperty( position, prop, label ); - GUI.enabled = true; - } - - private bool VectorCheck( Vector4 LHS, ComparisonOperators op, object expectedValue ) - { - var RHS = (Vector4)expectedValue; - if( RHS.x != float.NegativeInfinity ) - { - if( !Check( LHS.x, op, RHS.x ) ) - return false; - } - if( RHS.y != float.NegativeInfinity ) - { - if( !Check( LHS.y, op, RHS.y ) ) - return false; - } - if( RHS.z != float.NegativeInfinity ) - { - if( !Check( LHS.z, op, RHS.z ) ) - return false; - } - if( RHS.w != float.NegativeInfinity ) - { - if( !Check( LHS.w, op, RHS.w ) ) - return false; - } - - return true; - } - - protected bool Check( object LHS, ComparisonOperators op, object RHS ) - { - if( !( LHS is IComparable ) || !( RHS is IComparable ) ) - throw new Exception( "Check using non basic type" ); - - switch( op ) - { - case ComparisonOperators.EqualTo: - return ( (IComparable)LHS ).CompareTo( RHS ) == 0; - - case ComparisonOperators.NotEqualTo: - return ( (IComparable)LHS ).CompareTo( RHS ) != 0; - - case ComparisonOperators.EqualsOrGreaterThan: - return ( (IComparable)LHS ).CompareTo( RHS ) >= 0; - - case ComparisonOperators.EqualsOrLessThan: - return ( (IComparable)LHS ).CompareTo( RHS ) <= 0; - - case ComparisonOperators.GreaterThan: - return ( (IComparable)LHS ).CompareTo( RHS ) > 0; - - case ComparisonOperators.LessThan: - return ( (IComparable)LHS ).CompareTo( RHS ) < 0; - case ComparisonOperators.ContainsFlags: - return ( (int)LHS & (int)RHS ) != 0; // Dont trust LHS values, it has been casted to a char and then to an int again, first bit will be the sign - case ComparisonOperators.DoesNotContainsFlags: - return ( ( (int)LHS & (int)RHS ) == (int)LHS ); // Dont trust LHS values, it has been casted to a char and then to an int again, first bit will be the sign - - default: - break; - } - return false; - } - private bool CheckObject( object LHS, ComparisonOperators comparasonOperator, object RHS ) - { - switch( comparasonOperator ) - { - case ComparisonOperators.EqualTo: - return ( LHS == null ); - - case ComparisonOperators.NotEqualTo: - return ( LHS != null ); - } - return true; - } - -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/EditableIf.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/EditableIf.cs.meta deleted file mode 100644 index 363e2ad3..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/EditableIf.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 7a5504a2b7d04a846978416748dc6e0a -timeCreated: 1520330108 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/RemapSliders.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/RemapSliders.cs deleted file mode 100644 index 1000b2e1..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/RemapSliders.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEngine; -using UnityEditor; -using System; - -public class RemapSliders : MaterialPropertyDrawer -{ - public override void OnGUI( Rect position, MaterialProperty prop, String label, MaterialEditor editor ) - { - EditorGUI.BeginChangeCheck(); - Vector4 value = prop.vectorValue; - - EditorGUI.showMixedValue = prop.hasMixedValue; - - var cacheLabel = EditorGUIUtility.labelWidth; - var cacheField = EditorGUIUtility.fieldWidth; - if( cacheField <= 64 ) - { - float total = position.width; - EditorGUIUtility.labelWidth = Mathf.Ceil( 0.45f * total ) - 30; - EditorGUIUtility.fieldWidth = Mathf.Ceil( 0.55f * total ) + 30; - } - - EditorGUILayout.MinMaxSlider( label, ref value.x, ref value.y, 0, 1 ); - - EditorGUIUtility.labelWidth = cacheLabel; - EditorGUIUtility.fieldWidth = cacheField; - EditorGUI.showMixedValue = false; - if( EditorGUI.EndChangeCheck() ) - { - prop.vectorValue = value; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/RemapSliders.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/RemapSliders.cs.meta deleted file mode 100644 index 4c45d1a7..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/RemapSliders.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 314af1bcecbba6c4d92cbb5843c221ba -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/SingleLineTexture.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/SingleLineTexture.cs deleted file mode 100644 index b2d6754e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/SingleLineTexture.cs +++ /dev/null @@ -1,23 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEngine; -using UnityEditor; -using System; - -public class SingleLineTexture : MaterialPropertyDrawer -{ - public override void OnGUI( Rect position, MaterialProperty prop, String label, MaterialEditor editor ) - { - EditorGUI.BeginChangeCheck(); - EditorGUI.showMixedValue = prop.hasMixedValue; - - Texture value = editor.TexturePropertyMiniThumbnail( position, prop, label, string.Empty ); - - EditorGUI.showMixedValue = false; - if( EditorGUI.EndChangeCheck() ) - { - prop.textureValue = value; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/SingleLineTexture.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/SingleLineTexture.cs.meta deleted file mode 100644 index 33bacf15..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/CustomDrawers/SingleLineTexture.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 85da32683d237ac4f8665251e2ac38dc -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/DoCreateFunction.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/DoCreateFunction.cs deleted file mode 100644 index 791b7588..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/DoCreateFunction.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEditor; -using UnityEditor.ProjectWindowCallback; -namespace AmplifyShaderEditor -{ - public class DoCreateFunction : EndNameEditAction - { - public override void Action( int instanceId, string pathName, string resourceFile ) - { - UnityEngine.Object obj = EditorUtility.InstanceIDToObject( instanceId ); - AssetDatabase.CreateAsset( obj, AssetDatabase.GenerateUniqueAssetPath( pathName ) ); - AmplifyShaderEditorWindow.LoadShaderFunctionToASE( (AmplifyShaderFunction)obj, false ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/DoCreateFunction.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/DoCreateFunction.cs.meta deleted file mode 100644 index 3db405de..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/DoCreateFunction.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 3f2c950b0ed192943b7484f6b551965f -timeCreated: 1493906087 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/DoCreateShader.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/DoCreateShader.cs deleted file mode 100644 index 5fa1424f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/DoCreateShader.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEngine; -using UnityEditor; -using UnityEditor.ProjectWindowCallback; -using System.IO; -namespace AmplifyShaderEditor -{ - public class DoCreateStandardShader : EndNameEditAction - { - public override void Action( int instanceId, string pathName, string resourceFile ) - { - string uniquePath = AssetDatabase.GenerateUniqueAssetPath( pathName ); - string shaderName = Path.GetFileName( uniquePath ); - - if( IOUtils.AllOpenedWindows.Count > 0 ) - { - EditorWindow openedWindow = AmplifyShaderEditorWindow.GetWindow<AmplifyShaderEditorWindow>(); - AmplifyShaderEditorWindow currentWindow = AmplifyShaderEditorWindow.CreateTab(); - WindowHelper.AddTab( openedWindow, currentWindow ); - UIUtils.CurrentWindow = currentWindow; - } - else - { - AmplifyShaderEditorWindow currentWindow = AmplifyShaderEditorWindow.OpenWindow( shaderName, UIUtils.ShaderIcon ); - UIUtils.CurrentWindow = currentWindow; - } - - Shader shader = UIUtils.CreateNewEmpty( uniquePath, shaderName ); - ProjectWindowUtil.ShowCreatedAsset( shader ); - } - } - - public class DoCreateTemplateShader : EndNameEditAction - { - public override void Action( int instanceId, string pathName, string resourceFile ) - { - string uniquePath = AssetDatabase.GenerateUniqueAssetPath( pathName ); - string shaderName = Path.GetFileName( uniquePath ); - if( !string.IsNullOrEmpty( UIUtils.NewTemplateGUID ) ) - { - Shader shader = AmplifyShaderEditorWindow.CreateNewTemplateShader( UIUtils.NewTemplateGUID, uniquePath, shaderName ); - ProjectWindowUtil.ShowCreatedAsset( shader ); - } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/DoCreateShader.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/DoCreateShader.cs.meta deleted file mode 100644 index f2573fbb..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/DoCreateShader.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 2cfa7290f61ad684f99f8d81328ad52c -timeCreated: 1573664425 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/EditorOptions.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/EditorOptions.cs deleted file mode 100644 index 89cc8ed6..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/EditorOptions.cs +++ /dev/null @@ -1,67 +0,0 @@ -using UnityEditor; - -namespace AmplifyShaderEditor -{ - [System.Serializable] - public class OptionsWindow - { - private AmplifyShaderEditorWindow m_parentWindow = null; - - private bool m_coloredPorts = true; - private bool m_multiLinePorts = true; - private const string MultiLineId = "MultiLinePortsDefault"; - private const string ColorPortId = "ColoredPortsDefault"; - public OptionsWindow( AmplifyShaderEditorWindow parentWindow ) - { - m_parentWindow = parentWindow; - //Load (); - } - - public void Init() - { - Load(); - } - - public void Destroy() - { - Save(); - } - - public void Save() - { - EditorPrefs.SetBool( ColorPortId, ColoredPorts ); - EditorPrefs.SetBool( MultiLineId, m_multiLinePorts ); - } - - public void Load() - { - ColoredPorts = EditorPrefs.GetBool( ColorPortId, true ); - m_multiLinePorts = EditorPrefs.GetBool( MultiLineId, true ); - } - - public bool ColoredPorts - { - get { return m_coloredPorts; } - set - { - if ( m_coloredPorts != value ) - EditorPrefs.SetBool( ColorPortId, value ); - - m_coloredPorts = value; - } - } - - public bool MultiLinePorts - { - get { return m_multiLinePorts; } - set - { - if ( m_multiLinePorts != value ) - EditorPrefs.SetBool( MultiLineId, value ); - - m_multiLinePorts = value; - } - } - public AmplifyShaderEditorWindow ParentWindow { get { return m_parentWindow; } set { m_parentWindow = value; } } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/EditorOptions.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/EditorOptions.cs.meta deleted file mode 100644 index 18f01932..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/EditorOptions.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 44cb06bc7bfe6e84aa8b5e8b702eb2dd -timeCreated: 1481126955 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Graphs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Graphs.meta deleted file mode 100644 index e542e0f4..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Graphs.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 52f451731ec183e43ab18f0896f7172a -folderAsset: yes -timeCreated: 1481126944 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Graphs/NodeGrid.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Graphs/NodeGrid.cs deleted file mode 100644 index 748d28ba..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Graphs/NodeGrid.cs +++ /dev/null @@ -1,283 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System.Collections.Generic; -using UnityEngine; -using UnityEditor; - -namespace AmplifyShaderEditor -{ - public class NodeGrid - { - private bool m_debugGrid = false; - private const float GRID_SIZE_X = 100; - private const float GRID_SIZE_Y = 100; - - private const float GRID_AREA_X = 1000; - private const float GRID_AREA_Y = 1000; - - private Dictionary<int, Dictionary<int, List<ParentNode>>> m_grid; - - private int m_xMin = int.MaxValue; - private int m_yMin = int.MaxValue; - - private int m_xMax = int.MinValue; - private int m_yMax = int.MinValue; - - public NodeGrid() - { - m_grid = new Dictionary<int, Dictionary<int, List<ParentNode>>>(); - } - - public void AddNodeToGrid( ParentNode node ) - { - Rect pos = node.Position; - if ( Mathf.Abs( pos.width ) < 0.001f || Mathf.Abs( pos.height ) < 0.001f ) - { - return; - } - - float initialXf = pos.x / GRID_SIZE_X; - float initialYf = pos.y / GRID_SIZE_Y; - - int endX = Mathf.CeilToInt( initialXf + pos.width / GRID_SIZE_X ); - int endY = Mathf.CeilToInt( initialYf + pos.height / GRID_SIZE_Y ); - - int initialX = Mathf.FloorToInt( initialXf ); - int initialY = Mathf.FloorToInt( initialYf ); - - - if ( initialX < m_xMin ) - { - m_xMin = initialX; - } - - if ( initialY < m_yMin ) - { - m_yMin = initialY; - } - - if ( endX > m_xMax ) - { - m_xMax = endX; - } - - if ( endY > m_yMax ) - { - m_yMax = endY; - } - - for ( int x = initialX; x < endX; x += 1 ) - { - for ( int y = initialY; y < endY; y += 1 ) - { - if ( !m_grid.ContainsKey( x ) ) - { - m_grid.Add( x, new Dictionary<int, List<ParentNode>>() ); - - } - - if ( !m_grid[ x ].ContainsKey( y ) ) - { - m_grid[ x ].Add( y, new List<ParentNode>() ); - } - - m_grid[ x ][ y ].Add( node ); - } - } - node.IsOnGrid = true; - //DebugLimits(); - } - - public void RemoveNodeFromGrid( ParentNode node, bool useCachedPos ) - { - Rect pos = useCachedPos ? node.CachedPos : node.Position; - if ( Mathf.Abs( pos.width ) < 0.001f || Mathf.Abs( pos.height ) < 0.001f ) - { - return; - } - - float initialXf = pos.x / GRID_SIZE_X; - float initialYf = pos.y / GRID_SIZE_Y; - - int endX = Mathf.CeilToInt( initialXf + pos.width / GRID_SIZE_X ); - int endY = Mathf.CeilToInt( initialYf + pos.height / GRID_SIZE_Y ); - - int initialX = Mathf.FloorToInt( initialXf ); - int initialY = Mathf.FloorToInt( initialYf ); - bool testLimits = false; - - int xMinCount = 0; - int xMaxCount = 0; - - int yMinCount = 0; - int yMaxCount = 0; - - - for ( int x = initialX; x < endX; x += 1 ) - { - for ( int y = initialY; y < endY; y += 1 ) - { - if ( m_grid.ContainsKey( x ) ) - { - if ( m_grid[ x ].ContainsKey( y ) ) - { - m_grid[ x ][ y ].Remove( node ); - node.IsOnGrid = false; - - if ( initialX == m_xMin && x == initialX ) - { - testLimits = true; - if ( m_grid[ x ][ y ].Count != 0 ) - { - xMinCount += 1; - } - } - - if ( endX == m_xMax && x == endX ) - { - testLimits = true; - if ( m_grid[ x ][ y ].Count != 0 ) - { - xMaxCount += 1; - } - } - - if ( initialY == m_yMin && y == initialY ) - { - testLimits = true; - if ( m_grid[ x ][ y ].Count != 0 ) - { - yMinCount += 1; - } - } - - if ( endY == m_yMax && y == endY ) - { - testLimits = true; - if ( m_grid[ x ][ y ].Count != 0 ) - { - yMaxCount += 1; - } - } - } - } - } - } - - - if ( testLimits ) - { - if ( xMinCount == 0 || xMaxCount == 0 || yMinCount == 0 || yMaxCount == 0 ) - { - m_xMin = int.MaxValue; - m_yMin = int.MaxValue; - - m_xMax = int.MinValue; - m_yMax = int.MinValue; - foreach ( KeyValuePair<int, Dictionary<int, List<ParentNode>>> entryX in m_grid ) - { - foreach ( KeyValuePair<int, List<ParentNode>> entryY in entryX.Value ) - { - if ( entryY.Value.Count > 0 ) - { - if ( entryX.Key < m_xMin ) - { - m_xMin = entryX.Key; - } - - if ( entryY.Key < m_yMin ) - { - m_yMin = entryY.Key; - } - - if ( entryX.Key > m_xMax ) - { - m_xMax = entryX.Key; - } - - if ( entryY.Key > m_yMax ) - { - m_yMax = entryY.Key; - } - } - } - } - // The += 1 is to maintain consistence with AddNodeToGrid() ceil op on max values - m_xMax += 1; - m_yMax += 1; - } - } - //DebugLimits(); - } - - public void DebugLimits() - { - Debug.Log( "[ " + m_xMin + " , " + m_yMin + " ] " + "[ " + m_xMax + " , " + m_yMax + " ] " ); - } - - //pos must be the transformed mouse position to local canvas coordinates - public List<ParentNode> GetNodesOn( Vector2 pos ) - { - int x = Mathf.FloorToInt( pos.x / GRID_SIZE_X ); - int y = Mathf.FloorToInt( pos.y / GRID_SIZE_Y ); - - if ( m_grid.ContainsKey( x ) ) - { - if ( m_grid[ x ].ContainsKey( y ) ) - { - return m_grid[ x ][ y ]; - } - } - - return null; - } - - public List<ParentNode> GetNodesOn( int x, int y ) - { - if ( m_grid.ContainsKey( x ) ) - { - if ( m_grid[ x ].ContainsKey( y ) ) - { - return m_grid[ x ][ y ]; - } - } - return null; - } - - public void DrawGrid( DrawInfo drawInfo ) - { - if ( m_debugGrid ) - { - Handles.CircleHandleCap( 0, drawInfo.InvertedZoom * ( new Vector3( drawInfo.CameraOffset.x, drawInfo.CameraOffset.y, 0f ) ), Quaternion.identity, 5,EventType.Layout ); - for ( int x = -( int ) GRID_AREA_X; x < GRID_AREA_X; x += ( int ) GRID_SIZE_X ) - { - Handles.DrawLine( drawInfo.InvertedZoom * ( new Vector3( x + drawInfo.CameraOffset.x, drawInfo.CameraOffset.y - GRID_AREA_Y, 0 ) ), drawInfo.InvertedZoom * ( new Vector3( drawInfo.CameraOffset.x + x, drawInfo.CameraOffset.y + GRID_AREA_Y, 0 ) ) ); - } - - for ( int y = -( int ) GRID_AREA_Y; y < GRID_AREA_X; y += ( int ) GRID_SIZE_Y ) - { - Handles.DrawLine( drawInfo.InvertedZoom * ( new Vector3( drawInfo.CameraOffset.x - GRID_AREA_X, drawInfo.CameraOffset.y + y, 0 ) ), drawInfo.InvertedZoom * ( new Vector3( drawInfo.CameraOffset.x + GRID_AREA_X, drawInfo.CameraOffset.y + y, 0 ) ) ); - } - } - } - - public void Destroy() - { - foreach ( KeyValuePair<int, Dictionary<int, List<ParentNode>>> entryX in m_grid ) - { - foreach ( KeyValuePair<int, List<ParentNode>> entryY in entryX.Value ) - { - entryY.Value.Clear(); - } - entryX.Value.Clear(); - } - m_grid.Clear(); - } - - public float MaxNodeDist - { - get { return Mathf.Max( ( m_xMax - m_xMin )*GRID_SIZE_X, ( m_yMax - m_yMin )*GRID_SIZE_Y ); } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Graphs/NodeGrid.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Graphs/NodeGrid.cs.meta deleted file mode 100644 index 46d9f0f9..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Graphs/NodeGrid.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 6344917ce0eed6b43840632b98a2ed57 -timeCreated: 1481126956 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Graphs/ParentGraph.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Graphs/ParentGraph.cs deleted file mode 100644 index 32889936..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Graphs/ParentGraph.cs +++ /dev/null @@ -1,3996 +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.Collections.Generic; - -namespace AmplifyShaderEditor -{ - [Serializable] - public class ParentGraph : ScriptableObject, ISerializationCallbackReceiver - { - private const int MasterNodeLODIncrement = 100; - private const int MaxLodAmount = 9; - - public enum NodeLOD - { - LOD0, - LOD1, - LOD2, - LOD3, - LOD4, - LOD5 - } - - private static bool m_samplingThroughMacros = false; - - private NodeLOD m_lodLevel = NodeLOD.LOD0; - private GUIStyle nodeStyleOff; - private GUIStyle nodeStyleOn; - private GUIStyle nodeTitle; - private GUIStyle commentaryBackground; - - public delegate void LODMasterNodesAdded( int lod ); - public event LODMasterNodesAdded OnLODMasterNodesAddedEvent; - - public delegate void EmptyGraphDetected( ParentGraph graph ); - public event EmptyGraphDetected OnEmptyGraphDetectedEvt; - - public delegate void NodeEvent( ParentNode node ); - public event NodeEvent OnNodeEvent = null; - public event NodeEvent OnNodeRemovedEvent; - - public delegate void DuplicateEvent(); - public event DuplicateEvent OnDuplicateEvent; - - public event MasterNode.OnMaterialUpdated OnMaterialUpdatedEvent; - public event MasterNode.OnMaterialUpdated OnShaderUpdatedEvent; - - private bool m_afterDeserializeFlag = true; - private bool m_lateOptionsRefresh = false; - private bool m_foundDuplicates = false; - - //[SerializeField] - private AmplifyShaderEditorWindow m_parentWindow = null; - - [SerializeField] - private int m_validNodeId; - - [SerializeField] - private List<ParentNode> m_nodes = new List<ParentNode>(); - - // Sampler Nodes registry - [SerializeField] - private UsageListSamplerNodes m_samplerNodes = new UsageListSamplerNodes(); - - [SerializeField] - private UsageListFloatIntNodes m_floatNodes = new UsageListFloatIntNodes(); - - [SerializeField] - private UsageListTexturePropertyNodes m_texturePropertyNodes = new UsageListTexturePropertyNodes(); - - [SerializeField] - private UsageListTextureArrayNodes m_textureArrayNodes = new UsageListTextureArrayNodes(); - - [SerializeField] - private UsageListPropertyNodes m_propertyNodes = new UsageListPropertyNodes(); - - [SerializeField] - private UsageListPropertyNodes m_rawPropertyNodes = new UsageListPropertyNodes(); - - [SerializeField] - private UsageListScreenColorNodes m_screenColorNodes = new UsageListScreenColorNodes(); - - [SerializeField] - private UsageListRegisterLocalVarNodes m_localVarNodes = new UsageListRegisterLocalVarNodes(); - - [SerializeField] - private UsageListGlobalArrayNodes m_globalArrayNodes = new UsageListGlobalArrayNodes(); - - [SerializeField] - private UsageListFunctionInputNodes m_functionInputNodes = new UsageListFunctionInputNodes(); - - [SerializeField] - private UsageListFunctionNodes m_functionNodes = new UsageListFunctionNodes(); - - [SerializeField] - private UsageListFunctionOutputNodes m_functionOutputNodes = new UsageListFunctionOutputNodes(); - - [SerializeField] - private UsageListFunctionSwitchNodes m_functionSwitchNodes = new UsageListFunctionSwitchNodes(); - - [SerializeField] - private UsageListFunctionSwitchCopyNodes m_functionSwitchCopyNodes = new UsageListFunctionSwitchCopyNodes(); - - [SerializeField] - private UsageListTemplateMultiPassMasterNodes m_multiPassMasterNodes = new UsageListTemplateMultiPassMasterNodes(); - - [SerializeField] - private List<UsageListTemplateMultiPassMasterNodes> m_lodMultiPassMasterNodes; - - [SerializeField] - private UsageListCustomExpressionsOnFunctionMode m_customExpressionsOnFunctionMode = new UsageListCustomExpressionsOnFunctionMode(); - - [SerializeField] - private UsageListStaticSwitchNodes m_staticSwitchNodes = new UsageListStaticSwitchNodes(); - - [SerializeField] - private int m_masterNodeId = Constants.INVALID_NODE_ID; - - [SerializeField] - private bool m_isDirty; - - [SerializeField] - private bool m_saveIsDirty = false; - - [SerializeField] - private int m_nodeClicked; - - [SerializeField] - private int m_loadedShaderVersion; - - [SerializeField] - private int m_instancePropertyCount = 0; - - [SerializeField] - private int m_virtualTextureCount = 0; - - [SerializeField] - private int m_graphId = 0; - - [SerializeField] - private PrecisionType m_currentPrecision = PrecisionType.Float; - - [SerializeField] - private NodeAvailability m_currentCanvasMode = NodeAvailability.SurfaceShader; - - [SerializeField] - private TemplateSRPType m_currentSRPType = TemplateSRPType.BuiltIn; - - //private List<ParentNode> m_visibleNodes = new List<ParentNode>(); - - private List<ParentNode> m_nodePreviewList = new List<ParentNode>(); - - private Dictionary<int, ParentNode> m_nodesDict = new Dictionary<int, ParentNode>(); - - [NonSerialized] - private List<ParentNode> m_selectedNodes = new List<ParentNode>(); - - [NonSerialized] - private List<ParentNode> m_markedForDeletion = new List<ParentNode>(); - - [SerializeField] - private List<WireReference> m_highlightedWires = new List<WireReference>(); - private System.Type m_masterNodeDefaultType; - - [SerializeField] - private List<PropertyNode> m_internalTemplateNodesList = new List<PropertyNode>(); - private Dictionary<int, PropertyNode> m_internalTemplateNodesDict = new Dictionary<int, PropertyNode>(); - - private NodeGrid m_nodeGrid; - - private bool m_markedToDeSelect = false; - private int m_markToSelect = -1; - private bool m_markToReOrder = false; - - private bool m_hasUnConnectedNodes = false; - - private bool m_checkSelectedWireHighlights = false; - - // Bezier info - [SerializeField] - private List<WireBezierReference> m_bezierReferences; - private const int MaxBezierReferences = 50; - private int m_wireBezierCount = 0; - - protected int m_normalDependentCount = 0; - private bool m_forceCategoryRefresh = false; - - [SerializeField] - private bool m_forceRepositionCheck = false; - - private bool m_isLoading = false; - private bool m_isDuplicating = false; - - private bool m_changedLightingModel = false; - - public void ResetEvents() - { - OnNodeEvent = null; - OnMaterialUpdatedEvent = null; - OnShaderUpdatedEvent = null; - OnEmptyGraphDetectedEvt = null; - OnNodeRemovedEvent = null; - } - - public void Init() - { - Undo.undoRedoPerformed += OnUndoRedoCallback; - m_normalDependentCount = 0; - m_nodes = new List<ParentNode>(); - m_samplerNodes = new UsageListSamplerNodes(); - m_samplerNodes.ContainerGraph = this; - m_samplerNodes.ReorderOnChange = true; - m_floatNodes = new UsageListFloatIntNodes(); - m_floatNodes.ContainerGraph = this; - m_texturePropertyNodes = new UsageListTexturePropertyNodes(); - m_texturePropertyNodes.ContainerGraph = this; - m_textureArrayNodes = new UsageListTextureArrayNodes(); - m_textureArrayNodes.ContainerGraph = this; - m_textureArrayNodes.ReorderOnChange = true; - m_propertyNodes = new UsageListPropertyNodes(); - m_propertyNodes.ContainerGraph = this; - m_rawPropertyNodes = new UsageListPropertyNodes(); - m_rawPropertyNodes.ContainerGraph = this; - m_customExpressionsOnFunctionMode = new UsageListCustomExpressionsOnFunctionMode(); - m_customExpressionsOnFunctionMode.ContainerGraph = this; - m_staticSwitchNodes = new UsageListStaticSwitchNodes(); - m_staticSwitchNodes.ContainerGraph = this; - m_staticSwitchNodes.ReorderOnChange = true; - m_screenColorNodes = new UsageListScreenColorNodes(); - m_screenColorNodes.ContainerGraph = this; - m_screenColorNodes.ReorderOnChange = true; - m_localVarNodes = new UsageListRegisterLocalVarNodes(); - m_localVarNodes.ContainerGraph = this; - m_localVarNodes.ReorderOnChange = true; - m_globalArrayNodes = new UsageListGlobalArrayNodes(); - m_globalArrayNodes.ContainerGraph = this; - m_functionInputNodes = new UsageListFunctionInputNodes(); - m_functionInputNodes.ContainerGraph = this; - m_functionNodes = new UsageListFunctionNodes(); - m_functionNodes.ContainerGraph = this; - m_functionOutputNodes = new UsageListFunctionOutputNodes(); - m_functionOutputNodes.ContainerGraph = this; - m_functionSwitchNodes = new UsageListFunctionSwitchNodes(); - m_functionSwitchNodes.ContainerGraph = this; - m_functionSwitchCopyNodes = new UsageListFunctionSwitchCopyNodes(); - m_functionSwitchCopyNodes.ContainerGraph = this; - m_multiPassMasterNodes = new UsageListTemplateMultiPassMasterNodes(); - m_multiPassMasterNodes.ContainerGraph = this; - m_lodMultiPassMasterNodes = new List<UsageListTemplateMultiPassMasterNodes>( MaxLodAmount ); - for( int i = 0; i < MaxLodAmount; i++ ) - { - m_lodMultiPassMasterNodes.Add( new UsageListTemplateMultiPassMasterNodes() ); - } - m_selectedNodes = new List<ParentNode>(); - m_markedForDeletion = new List<ParentNode>(); - m_highlightedWires = new List<WireReference>(); - m_validNodeId = 0; - IsDirty = false; - SaveIsDirty = false; - m_masterNodeDefaultType = typeof( StandardSurfaceOutputNode ); - - m_bezierReferences = new List<WireBezierReference>( MaxBezierReferences ); - for( int i = 0; i < MaxBezierReferences; i++ ) - { - m_bezierReferences.Add( new WireBezierReference() ); - } - - m_samplingThroughMacros = Preferences.GlobalUseMacros; - } - - private void OnUndoRedoCallback() - { - DeSelectAll(); - } - - private void OnEnable() - { - hideFlags = HideFlags.HideAndDontSave; - m_nodeGrid = new NodeGrid(); - m_internalTemplateNodesDict = new Dictionary<int, PropertyNode>(); - m_nodesDict = new Dictionary<int, ParentNode>(); - nodeStyleOff = UIUtils.GetCustomStyle( CustomStyle.NodeWindowOff ); - nodeStyleOn = UIUtils.GetCustomStyle( CustomStyle.NodeWindowOn ); - nodeTitle = UIUtils.GetCustomStyle( CustomStyle.NodeHeader ); - commentaryBackground = UIUtils.GetCustomStyle( CustomStyle.CommentaryBackground ); - } - - public void UpdateRegisters() - { - m_samplerNodes.UpdateNodeArr(); - m_propertyNodes.UpdateNodeArr(); - m_rawPropertyNodes.UpdateNodeArr(); - m_customExpressionsOnFunctionMode.UpdateNodeArr(); - m_staticSwitchNodes.UpdateNodeArr(); - m_functionInputNodes.UpdateNodeArr(); - m_functionNodes.UpdateNodeArr(); - m_functionOutputNodes.UpdateNodeArr(); - m_functionSwitchNodes.UpdateNodeArr(); - m_functionSwitchCopyNodes.UpdateNodeArr(); - m_multiPassMasterNodes.UpdateNodeArr(); - for( int i = 0; i < m_lodMultiPassMasterNodes.Count; i++ ) - { - m_lodMultiPassMasterNodes[ i ].UpdateNodeArr(); - } - m_texturePropertyNodes.UpdateNodeArr(); - m_textureArrayNodes.UpdateNodeArr(); - m_screenColorNodes.UpdateNodeArr(); - m_localVarNodes.UpdateNodeArr(); - m_globalArrayNodes.UpdateNodeArr(); - } - - public int GetValidId() - { - return m_validNodeId++; - } - - void UpdateIdFromNode( ParentNode node ) - { - if( node.UniqueId >= m_validNodeId ) - { - m_validNodeId = node.UniqueId + 1; - } - } - - public void ResetNodeConnStatus() - { - for( int i = 0; i < m_nodes.Count; i++ ) - { - if( m_nodes[ i ].ConnStatus == NodeConnectionStatus.Connected ) - { - m_nodes[ i ].ConnStatus = NodeConnectionStatus.Not_Connected; - } - } - } - - public void CleanUnusedNodes() - { - List<ParentNode> unusedNodes = new List<ParentNode>(); - for( int i = 0; i < m_nodes.Count; i++ ) - { - if( m_nodes[ i ].ConnStatus == NodeConnectionStatus.Not_Connected ) - { - unusedNodes.Add( m_nodes[ i ] ); - } - } - - for( int i = 0; i < unusedNodes.Count; i++ ) - { - DestroyNode( unusedNodes[ i ] ); - } - unusedNodes.Clear(); - unusedNodes = null; - - IsDirty = true; - } - - // Destroy all nodes excluding Master Node - public void ClearGraph() - { - List<ParentNode> list = new List<ParentNode>(); - int count = m_nodes.Count; - for( int i = 0; i < count; i++ ) - { - if( m_nodes[ i ].UniqueId != m_masterNodeId ) - { - list.Add( m_nodes[ i ] ); - } - } - - while( list.Count > 0 ) - { - DestroyNode( list[ 0 ] ); - list.RemoveAt( 0 ); - } - } - - public void CleanNodes() - { - for( int i = 0; i < m_nodes.Count; i++ ) - { - if( m_nodes[ i ] != null ) - { - Undo.ClearUndo( m_nodes[ i ] ); - m_nodes[ i ].Destroy(); - GameObject.DestroyImmediate( m_nodes[ i ] ); - } - } - ClearInternalTemplateNodes(); - - m_masterNodeId = Constants.INVALID_NODE_ID; - m_validNodeId = 0; - m_instancePropertyCount = 0; - m_virtualTextureCount = 0; - - m_nodesDict.Clear(); - m_nodes.Clear(); - m_samplerNodes.Clear(); - m_propertyNodes.Clear(); - m_rawPropertyNodes.Clear(); - m_customExpressionsOnFunctionMode.Clear(); - m_staticSwitchNodes.Clear(); - m_functionInputNodes.Clear(); - m_functionNodes.Clear(); - m_functionOutputNodes.Clear(); - m_functionSwitchNodes.Clear(); - m_functionSwitchCopyNodes.Clear(); - m_multiPassMasterNodes.Clear(); - for( int i = 0; i < m_lodMultiPassMasterNodes.Count; i++ ) - { - m_lodMultiPassMasterNodes[ i ].Clear(); - } - - m_texturePropertyNodes.Clear(); - m_textureArrayNodes.Clear(); - m_screenColorNodes.Clear(); - m_localVarNodes.Clear(); - m_globalArrayNodes.Clear(); - m_selectedNodes.Clear(); - m_markedForDeletion.Clear(); - } - - public void ResetHighlightedWires() - { - for( int i = 0; i < m_highlightedWires.Count; i++ ) - { - m_highlightedWires[ i ].WireStatus = WireStatus.Default; - } - m_highlightedWires.Clear(); - } - - public void HighlightWiresStartingNode( ParentNode node ) - { - for( int outputIdx = 0; outputIdx < node.OutputPorts.Count; outputIdx++ ) - { - for( int extIdx = 0; extIdx < node.OutputPorts[ outputIdx ].ExternalReferences.Count; extIdx++ ) - { - WireReference wireRef = node.OutputPorts[ outputIdx ].ExternalReferences[ extIdx ]; - ParentNode nextNode = GetNode( wireRef.NodeId ); - if( nextNode && nextNode.ConnStatus == NodeConnectionStatus.Connected ) - { - InputPort port = nextNode.GetInputPortByUniqueId( wireRef.PortId ); - if( port.ExternalReferences.Count == 0 || port.ExternalReferences[ 0 ].WireStatus == WireStatus.Highlighted ) - { - // if even one wire is already highlighted then this tells us that this node was already been analysed - return; - } - - port.ExternalReferences[ 0 ].WireStatus = WireStatus.Highlighted; - m_highlightedWires.Add( port.ExternalReferences[ 0 ] ); - HighlightWiresStartingNode( nextNode ); - } - } - } - - RegisterLocalVarNode regNode = node as RegisterLocalVarNode; - if( (object)regNode != null ) - { - int count = regNode.NodeReferences.Count; - for( int i = 0; i < count; i++ ) - { - HighlightWiresStartingNode( regNode.NodeReferences[ i ] ); - } - } - } - - void PropagateHighlightDeselection( ParentNode node, int portId = -1 ) - { - if( portId > -1 ) - { - InputPort port = node.GetInputPortByUniqueId( portId ); - port.ExternalReferences[ 0 ].WireStatus = WireStatus.Default; - } - - if( node.Selected ) - return; - - for( int i = 0; i < node.InputPorts.Count; i++ ) - { - if( node.InputPorts[ i ].ExternalReferences.Count > 0 && node.InputPorts[ i ].ExternalReferences[ 0 ].WireStatus == WireStatus.Highlighted ) - { - // even though node is deselected, it receives wire highlight from a previous one - return; - } - } - - for( int outputIdx = 0; outputIdx < node.OutputPorts.Count; outputIdx++ ) - { - for( int extIdx = 0; extIdx < node.OutputPorts[ outputIdx ].ExternalReferences.Count; extIdx++ ) - { - WireReference wireRef = node.OutputPorts[ outputIdx ].ExternalReferences[ extIdx ]; - ParentNode nextNode = GetNode( wireRef.NodeId ); - PropagateHighlightDeselection( nextNode, wireRef.PortId ); - } - } - - RegisterLocalVarNode regNode = node as RegisterLocalVarNode; - if( (object)regNode != null ) - { - int count = regNode.NodeReferences.Count; - for( int i = 0; i < count; i++ ) - { - PropagateHighlightDeselection( regNode.NodeReferences[ i ], -1 ); - } - } - } - - - public void ResetNodesData() - { - int count = m_nodes.Count; - for( int i = 0; i < count; i++ ) - { - m_nodes[ i ].ResetNodeData(); - } - } - - public void FullCleanUndoStack() - { - Undo.ClearUndo( this ); - int count = m_nodes.Count; - for( int i = 0; i < count; i++ ) - { - if( m_nodes[ i ] != null ) - { - Undo.ClearUndo( m_nodes[ i ] ); - } - } - } - - public void FullRegisterOnUndoStack() - { - Undo.RegisterCompleteObjectUndo( this, Constants.UndoRegisterFullGrapId ); - int count = m_nodes.Count; - for( int i = 0; i < count; i++ ) - { - if( m_nodes[ i ] != null ) - { - Undo.RegisterCompleteObjectUndo( m_nodes[ i ], Constants.UndoRegisterFullGrapId ); - } - } - } - - public void CheckPropertiesAutoRegister( ref MasterNodeDataCollector dataCollector ) - { - List<PropertyNode> propertyNodesList = m_rawPropertyNodes.NodesList; - int propertyCount = propertyNodesList.Count; - for( int i = 0; i < propertyCount; i++ ) - { - propertyNodesList[ i ].CheckIfAutoRegister( ref dataCollector ); - } - propertyNodesList = null; - - List<GlobalArrayNode> globalArrayNodeList = m_globalArrayNodes.NodesList; - int globalArrayCount = globalArrayNodeList.Count; - for( int i = 0; i < globalArrayCount; i++ ) - { - globalArrayNodeList[ i ].CheckIfAutoRegister( ref dataCollector ); - } - globalArrayNodeList = null; - - //List<PropertyNode> propertyNodesList = m_propertyNodes.NodesList; - //int propertyCount = propertyNodesList.Count; - //for( int i = 0; i < propertyCount; i++ ) - //{ - // propertyNodesList[ i ].CheckIfAutoRegister( ref dataCollector ); - //} - //propertyNodesList = null; - - //List<ScreenColorNode> screenColorNodes = m_screenColorNodes.NodesList; - //int screenColorNodesCount = screenColorNodes.Count; - //for( int i = 0; i < screenColorNodesCount; i++ ) - //{ - // screenColorNodes[ i ].CheckIfAutoRegister( ref dataCollector ); - //} - //screenColorNodes = null; - } - - public void SoftDestroy() - { - OnNodeRemovedEvent = null; - - m_masterNodeId = Constants.INVALID_NODE_ID; - m_validNodeId = 0; - - m_nodeGrid.Destroy(); - //m_nodeGrid = null; - - ClearInternalTemplateNodes(); - - for( int i = 0; i < m_nodes.Count; i++ ) - { - if( m_nodes[ i ] != null ) - { - m_nodes[ i ].Destroy(); - GameObject.DestroyImmediate( m_nodes[ i ] ); - } - } - - m_instancePropertyCount = 0; - - m_nodes.Clear(); - //m_nodes = null; - - m_nodesDict.Clear(); - //m_nodesDict = null; - - m_samplerNodes.Clear(); - //m_samplerNodes = null; - - m_propertyNodes.Clear(); - m_rawPropertyNodes.Clear(); - //m_propertyNodes = null; - - m_customExpressionsOnFunctionMode.Clear(); - - m_staticSwitchNodes.Clear(); - - m_functionInputNodes.Clear(); - //m_functionInputNodes = null; - - m_functionNodes.Clear(); - //m_functionNodes = null; - - m_functionOutputNodes.Clear(); - //m_functionOutputNodes = null; - - m_functionSwitchNodes.Clear(); - //m_functionSwitchNodes = null; - - m_functionSwitchCopyNodes.Clear(); - //m_functionSwitchCopyNodes = null; - - m_texturePropertyNodes.Clear(); - //m_texturePropertyNodes = null; - - m_textureArrayNodes.Clear(); - //m_textureArrayNodes = null; - - m_screenColorNodes.Clear(); - //m_screenColorNodes = null; - - m_localVarNodes.Clear(); - //m_localVarNodes = null; - - m_globalArrayNodes.Clear(); - - m_selectedNodes.Clear(); - //m_selectedNodes = null; - - m_markedForDeletion.Clear(); - //m_markedForDeletion = null; - - m_nodePreviewList.Clear(); - //m_nodePreviewList = null; - - IsDirty = true; - - OnNodeEvent = null; - OnDuplicateEvent = null; - //m_currentShaderFunction = null; - - OnMaterialUpdatedEvent = null; - OnShaderUpdatedEvent = null; - OnEmptyGraphDetectedEvt = null; - - nodeStyleOff = null; - nodeStyleOn = null; - nodeTitle = null; - commentaryBackground = null; - OnLODMasterNodesAddedEvent = null; - } - - - - - public void Destroy() - { - Undo.undoRedoPerformed -= OnUndoRedoCallback; - for( int i = 0; i < m_nodes.Count; i++ ) - { - if( m_nodes[ i ] != null ) - { - Undo.ClearUndo( m_nodes[ i ] ); - m_nodes[ i ].Destroy(); - GameObject.DestroyImmediate( m_nodes[ i ] ); - } - } - - //Must be before m_propertyNodes.Destroy(); - ClearInternalTemplateNodes(); - m_internalTemplateNodesDict = null; - m_internalTemplateNodesList = null; - - OnNodeRemovedEvent = null; - - m_masterNodeId = Constants.INVALID_NODE_ID; - m_validNodeId = 0; - m_instancePropertyCount = 0; - - m_nodeGrid.Destroy(); - m_nodeGrid = null; - - m_nodes.Clear(); - m_nodes = null; - - m_samplerNodes.Destroy(); - m_samplerNodes = null; - - m_propertyNodes.Destroy(); - m_propertyNodes = null; - - m_rawPropertyNodes.Destroy(); - m_rawPropertyNodes = null; - - m_customExpressionsOnFunctionMode.Destroy(); - m_customExpressionsOnFunctionMode = null; - - m_staticSwitchNodes.Destroy(); - m_staticSwitchNodes = null; - - m_functionInputNodes.Destroy(); - m_functionInputNodes = null; - - m_functionNodes.Destroy(); - m_functionNodes = null; - - m_functionOutputNodes.Destroy(); - m_functionOutputNodes = null; - - m_functionSwitchNodes.Destroy(); - m_functionSwitchNodes = null; - - m_functionSwitchCopyNodes.Destroy(); - m_functionSwitchCopyNodes = null; - - m_multiPassMasterNodes.Destroy(); - m_multiPassMasterNodes = null; - - for( int i = 0; i < m_lodMultiPassMasterNodes.Count; i++ ) - { - m_lodMultiPassMasterNodes[ i ].Destroy(); - m_lodMultiPassMasterNodes[ i ] = null; - } - m_lodMultiPassMasterNodes.Clear(); - m_lodMultiPassMasterNodes = null; - - m_texturePropertyNodes.Destroy(); - m_texturePropertyNodes = null; - - m_textureArrayNodes.Destroy(); - m_textureArrayNodes = null; - - m_screenColorNodes.Destroy(); - m_screenColorNodes = null; - - m_localVarNodes.Destroy(); - m_localVarNodes = null; - - m_globalArrayNodes.Destroy(); - m_globalArrayNodes = null; - - m_selectedNodes.Clear(); - m_selectedNodes = null; - - m_markedForDeletion.Clear(); - m_markedForDeletion = null; - - - m_nodesDict.Clear(); - m_nodesDict = null; - - m_nodePreviewList.Clear(); - m_nodePreviewList = null; - - IsDirty = true; - - OnNodeEvent = null; - OnDuplicateEvent = null; - //m_currentShaderFunction = null; - - OnMaterialUpdatedEvent = null; - OnShaderUpdatedEvent = null; - OnEmptyGraphDetectedEvt = null; - - nodeStyleOff = null; - nodeStyleOn = null; - nodeTitle = null; - commentaryBackground = null; - - OnLODMasterNodesAddedEvent = null; - } - - void OnNodeChangeSizeEvent( ParentNode node ) - { - m_nodeGrid.RemoveNodeFromGrid( node, true ); - m_nodeGrid.AddNodeToGrid( node ); - } - - public void OnNodeFinishMoving( ParentNode node, bool testOnlySelected, InteractionMode interactionMode ) - { - if( OnNodeEvent != null ) - { - OnNodeEvent( node ); - SaveIsDirty = true; - } - - m_nodeGrid.RemoveNodeFromGrid( node, true ); - m_nodeGrid.AddNodeToGrid( node ); - - //if( testOnlySelected ) - //{ - // for( int i = m_visibleNodes.Count - 1; i > -1; i-- ) - // { - // if( node.UniqueId != m_visibleNodes[ i ].UniqueId ) - // { - // switch( interactionMode ) - // { - // case InteractionMode.Target: - // { - // node.OnNodeInteraction( m_visibleNodes[ i ] ); - // } - // break; - // case InteractionMode.Other: - // { - // m_visibleNodes[ i ].OnNodeInteraction( node ); - // } - // break; - // case InteractionMode.Both: - // { - // node.OnNodeInteraction( m_visibleNodes[ i ] ); - // m_visibleNodes[ i ].OnNodeInteraction( node ); - // } - // break; - // } - // } - // } - //} - //else - { - for( int i = m_nodes.Count - 1; i > -1; i-- ) - { - if( node.UniqueId != m_nodes[ i ].UniqueId ) - { - switch( interactionMode ) - { - case InteractionMode.Target: - { - node.OnNodeInteraction( m_nodes[ i ] ); - } - break; - case InteractionMode.Other: - { - m_nodes[ i ].OnNodeInteraction( node ); - } - break; - case InteractionMode.Both: - { - node.OnNodeInteraction( m_nodes[ i ] ); - m_nodes[ i ].OnNodeInteraction( node ); - } - break; - } - } - } - } - } - - - public void OnNodeReOrderEvent( ParentNode node, int index ) - { - if( node.Depth < index ) - { - Debug.LogWarning( "Reorder canceled: This is a specific method for when reordering needs to be done and a its original index is higher than the new one" ); - } - else - { - m_nodes.Remove( node ); - m_nodes.Insert( index, node ); - m_markToReOrder = true; - } - } - - public void AddNode( ParentNode node, bool updateId = false, bool addLast = true, bool registerUndo = true, bool fetchMaterialValues = true ) - { - if( registerUndo ) - { - UIUtils.MarkUndoAction(); - Undo.RegisterCompleteObjectUndo( ParentWindow, Constants.UndoCreateNodeId ); - Undo.RegisterCompleteObjectUndo( this, Constants.UndoCreateNodeId ); - Undo.RegisterCreatedObjectUndo( node, Constants.UndoCreateNodeId ); - } - - if( OnNodeEvent != null ) - { - OnNodeEvent( node ); - } - if( updateId ) - { - node.UniqueId = GetValidId(); - } - else - { - UpdateIdFromNode( node ); - } - - - - if( addLast ) - { - m_nodes.Add( node ); - node.Depth = m_nodes.Count; - } - else - { - m_nodes.Insert( 0, node ); - node.Depth = 0; - } - - if( m_nodesDict.ContainsKey( node.UniqueId ) ) - { - //m_nodesDict[ node.UniqueId ] = node; - m_foundDuplicates = true; - } - else - { - m_nodesDict.Add( node.UniqueId, node ); - node.SetMaterialMode( CurrentMaterial, fetchMaterialValues ); - } - - m_nodeGrid.AddNodeToGrid( node ); - node.OnNodeChangeSizeEvent += OnNodeChangeSizeEvent; - node.OnNodeReOrderEvent += OnNodeReOrderEvent; - IsDirty = true; - } - - public void CheckForDuplicates() - { - if( m_foundDuplicates ) - { - Debug.LogWarning( "Found duplicates:" ); - m_foundDuplicates = false; - m_nodesDict.Clear(); - int count = m_nodes.Count; - for( int i = 0; i < count; i++ ) - { - if( m_nodesDict.ContainsKey( m_nodes[ i ].UniqueId ) ) - { - m_nodes[ i ].UniqueId = GetValidId(); - m_nodesDict.Add( m_nodes[ i ].UniqueId, m_nodes[ i ] ); - Debug.LogWarning( "Assigning new ID to " + m_nodes[ i ].TypeName ); - } - else - { - m_nodesDict.Add( m_nodes[ i ].UniqueId, m_nodes[ i ] ); - } - } - } - } - - public ParentNode GetClickedNode() - { - if( m_nodeClicked < 0 ) - return null; - return GetNode( m_nodeClicked ); - } - - public PropertyNode GetInternalTemplateNode( int nodeId ) - { - if( m_internalTemplateNodesDict.Count != m_internalTemplateNodesList.Count ) - { - m_internalTemplateNodesDict.Clear(); - int count = m_internalTemplateNodesList.Count; - for( int i = 0; i < m_internalTemplateNodesList.Count; i++ ) - { - if( m_internalTemplateNodesList[ i ] != null ) - m_internalTemplateNodesDict.Add( m_internalTemplateNodesList[ i ].UniqueId, m_internalTemplateNodesList[ i ] ); - } - } - - if( m_internalTemplateNodesDict.ContainsKey( nodeId ) ) - return m_internalTemplateNodesDict[ nodeId ]; - - return null; - } - - public PropertyNode GetInternalTemplateNode( string propertyName ) - { - return m_internalTemplateNodesList.Find( ( x ) => x.PropertyName.Equals( propertyName ) ); - } - - public void AddInternalTemplateNode( TemplateShaderPropertyData data ) - { - PropertyNode propertyNode = null; - switch( data.PropertyDataType ) - { - case WirePortDataType.FLOAT: - propertyNode = CreateInstance<RangedFloatNode>(); break; - case WirePortDataType.FLOAT4: - propertyNode = CreateInstance<Vector4Node>(); - break; - case WirePortDataType.COLOR: - propertyNode = CreateInstance<ColorNode>(); - break; - case WirePortDataType.INT: - propertyNode = CreateInstance<IntNode>(); break; - case WirePortDataType.SAMPLER1D: - case WirePortDataType.SAMPLER2D: - case WirePortDataType.SAMPLER3D: - case WirePortDataType.SAMPLERCUBE: - propertyNode = CreateInstance<SamplerNode>(); - break; - default: return; - } - - propertyNode.PropertyNameFromTemplate( data ); - - // Create a negative unique Id to separate it from - // the regular ids on the main nodes list - // Its begins at -2 since -1 is used to detect invalid values - int uniqueId = -( m_internalTemplateNodesList.Count + 2 ); - propertyNode.SetBaseUniqueId( uniqueId ); - - //Register into Float/Int Nodes list to be available inline - // Unique Id must be already set at this point to properly - // create array - if( data.PropertyDataType == WirePortDataType.FLOAT || - data.PropertyDataType == WirePortDataType.INT ) - m_floatNodes.AddNode( propertyNode ); - - m_internalTemplateNodesList.Add( propertyNode ); - m_internalTemplateNodesDict.Add( uniqueId, propertyNode ); - } - - public void ClearInternalTemplateNodes() - { - if( m_internalTemplateNodesList != null ) - { - int count = m_internalTemplateNodesList.Count; - for( int i = 0; i < count; i++ ) - { - m_internalTemplateNodesList[ i ].Destroy(); - GameObject.DestroyImmediate( m_internalTemplateNodesList[ i ] ); - } - - m_internalTemplateNodesList.Clear(); - m_internalTemplateNodesDict.Clear(); - } - } - - public ParentNode GetNode( int nodeId ) - { - if( m_nodesDict.Count != m_nodes.Count ) - { - m_nodesDict.Clear(); - int count = m_nodes.Count; - for( int i = 0; i < count; i++ ) - { - if( m_nodes[ i ] != null && !m_nodesDict.ContainsKey( m_nodes[ i ].UniqueId ) ) - m_nodesDict.Add( m_nodes[ i ].UniqueId, m_nodes[ i ] ); - } - } - - if( m_nodesDict.ContainsKey( nodeId ) ) - return m_nodesDict[ nodeId ]; - - return null; - } - - public void ForceReOrder() - { - m_nodes.Sort( ( x, y ) => x.Depth.CompareTo( y.Depth ) ); - } - - public bool Draw( DrawInfo drawInfo ) - { - MasterNode masterNode = GetNode( m_masterNodeId ) as MasterNode; - if( m_forceCategoryRefresh && masterNode != null ) - { - masterNode.RefreshAvailableCategories(); - m_forceCategoryRefresh = false; - } - - SaveIsDirty = false; - if( m_afterDeserializeFlag ) - { - // this is now done after logic update... templates needs it this way - //m_afterDeserializeFlag = false; - - CleanCorruptedNodes(); - if( m_nodes.Count == 0 ) - { - //TODO: remove this temp from here - NodeAvailability cachedCanvas = CurrentCanvasMode; - ParentWindow.CreateNewGraph( "Empty" ); - CurrentCanvasMode = cachedCanvas; - if( OnEmptyGraphDetectedEvt != null ) - { - OnEmptyGraphDetectedEvt( this ); - SaveIsDirty = false; - } - else - { - SaveIsDirty = true; - } - } - - //for( int i = 0; i < m_nodes.Count; i++ ) - //{ - // m_nodes[ i ].SetContainerGraph( this ); - //} - } - - if( drawInfo.CurrentEventType == EventType.Repaint ) - { - if( m_markedToDeSelect ) - DeSelectAll(); - - if( m_markToSelect > -1 ) - { - AddToSelectedNodes( GetNode( m_markToSelect ) ); - m_markToSelect = -1; - } - - if( m_markToReOrder ) - { - m_markToReOrder = false; - int nodesCount = m_nodes.Count; - for( int i = 0; i < nodesCount; i++ ) - { - m_nodes[ i ].Depth = i; - } - } - } - - if( drawInfo.CurrentEventType == EventType.Repaint ) - { - // Resizing Nods per LOD level - NodeLOD newLevel = NodeLOD.LOD0; - float referenceValue; - if( drawInfo.InvertedZoom > 0.5f ) - { - newLevel = NodeLOD.LOD0; - referenceValue = 4; - } - else if( drawInfo.InvertedZoom > 0.25f ) - { - newLevel = NodeLOD.LOD1; - referenceValue = 2; - } - else if( drawInfo.InvertedZoom > 0.15f ) - { - newLevel = NodeLOD.LOD2; - referenceValue = 1; - } - else if( drawInfo.InvertedZoom > 0.1f ) - { - newLevel = NodeLOD.LOD3; - referenceValue = 0; - } - else if( drawInfo.InvertedZoom > 0.07f ) - { - newLevel = NodeLOD.LOD4; - referenceValue = 0; - } - else - { - newLevel = NodeLOD.LOD5; - referenceValue = 0; - } - - // Just a sanity check - nodeStyleOff = UIUtils.GetCustomStyle( CustomStyle.NodeWindowOff ); - nodeStyleOn = UIUtils.GetCustomStyle( CustomStyle.NodeWindowOn );//= UIUtils.GetCustomStyle( CustomStyle.NodeWindowOn ); - nodeTitle = UIUtils.GetCustomStyle( CustomStyle.NodeHeader ); - commentaryBackground = UIUtils.GetCustomStyle( CustomStyle.CommentaryBackground ); - - if( newLevel != m_lodLevel || ( UIUtils.MainSkin != null && UIUtils.MainSkin.textField.border.left != referenceValue ) ) - { - m_lodLevel = newLevel; - switch( m_lodLevel ) - { - default: - case NodeLOD.LOD0: - { - UIUtils.MainSkin.textField.border = UIUtils.RectOffsetFour; - nodeStyleOff.border = UIUtils.RectOffsetSix; - UIUtils.NodeWindowOffSquare.border = UIUtils.RectOffsetFour; - - nodeStyleOn.border = UIUtils.RectOffsetSix; - UIUtils.NodeWindowOnSquare.border = UIUtils.RectOffsetSix; - - nodeTitle.border.left = 6; - nodeTitle.border.right = 6; - nodeTitle.border.top = 6; - nodeTitle.border.bottom = 4; - - UIUtils.NodeHeaderSquare.border = UIUtils.RectOffsetFour; - commentaryBackground.border = UIUtils.RectOffsetSix; - } - break; - case NodeLOD.LOD1: - { - UIUtils.MainSkin.textField.border = UIUtils.RectOffsetTwo; - nodeStyleOff.border = UIUtils.RectOffsetFive; - UIUtils.NodeWindowOffSquare.border = UIUtils.RectOffsetFive; - - nodeStyleOn.border = UIUtils.RectOffsetFive; - UIUtils.NodeWindowOnSquare.border = UIUtils.RectOffsetFour; - - nodeTitle.border.left = 5; - nodeTitle.border.right = 5; - nodeTitle.border.top = 5; - nodeTitle.border.bottom = 2; - - UIUtils.NodeHeaderSquare.border = UIUtils.RectOffsetThree; - commentaryBackground.border = UIUtils.RectOffsetFive; - } - break; - case NodeLOD.LOD2: - { - UIUtils.MainSkin.textField.border = UIUtils.RectOffsetOne; - - nodeStyleOff.border.left = 2; - nodeStyleOff.border.right = 2; - nodeStyleOff.border.top = 2; - nodeStyleOff.border.bottom = 3; - - UIUtils.NodeWindowOffSquare.border = UIUtils.RectOffsetThree; - - nodeStyleOn.border.left = 4; - nodeStyleOn.border.right = 4; - nodeStyleOn.border.top = 4; - nodeStyleOn.border.bottom = 3; - - UIUtils.NodeWindowOnSquare.border = UIUtils.RectOffsetThree; - - nodeTitle.border = UIUtils.RectOffsetTwo; - UIUtils.NodeHeaderSquare.border = UIUtils.RectOffsetTwo; - - commentaryBackground.border.left = 2; - commentaryBackground.border.right = 2; - commentaryBackground.border.top = 2; - commentaryBackground.border.bottom = 3; - } - break; - case NodeLOD.LOD3: - case NodeLOD.LOD4: - case NodeLOD.LOD5: - { - UIUtils.MainSkin.textField.border = UIUtils.RectOffsetZero; - - nodeStyleOff.border.left = 1; - nodeStyleOff.border.right = 1; - nodeStyleOff.border.top = 1; - nodeStyleOff.border.bottom = 2; - - UIUtils.NodeWindowOffSquare.border = UIUtils.RectOffsetTwo; - - nodeStyleOn.border = UIUtils.RectOffsetTwo; - UIUtils.NodeWindowOnSquare.border = UIUtils.RectOffsetTwo; - - nodeTitle.border = UIUtils.RectOffsetOne; - UIUtils.NodeHeaderSquare.border = UIUtils.RectOffsetOne; - - commentaryBackground.border.left = 1; - commentaryBackground.border.right = 1; - commentaryBackground.border.top = 1; - commentaryBackground.border.bottom = 2; - } - break; - } - } - } - - //m_visibleNodes.Clear(); - //int nullCount = 0; - m_hasUnConnectedNodes = false; - bool repaint = false; - Material currentMaterial = masterNode != null ? masterNode.CurrentMaterial : null; - EditorGUI.BeginChangeCheck(); - bool repaintMaterialInspector = false; - - int nodeCount = m_nodes.Count; - for( int i = 0; i < nodeCount; i++ ) - { - m_nodes[ i ].OnNodeLogicUpdate( drawInfo ); - } - - if( m_afterDeserializeFlag || m_lateOptionsRefresh ) - { - m_afterDeserializeFlag = false; - m_lateOptionsRefresh = false; - if( CurrentCanvasMode == NodeAvailability.TemplateShader ) - { - RefreshLinkedMasterNodes( true ); - OnRefreshLinkedPortsComplete(); - //If clipboard has cached nodes then a master node replacement will take place - //We need to re-cache master nodes to ensure applied options are correctly cached - //As first cache happens before that - if( m_parentWindow.ClipboardInstance.HasCachedMasterNodes ) - { - m_parentWindow.ClipboardInstance.AddMultiPassNodesToClipboard( MultiPassMasterNodes.NodesList ); - } - //RepositionTemplateNodes( CurrentMasterNode ); - } - } - - if( m_forceRepositionCheck ) - { - RepositionTemplateNodes( CurrentMasterNode ); - } - - //for( int i = 0; i < m_functionNodes.NodesList.Count; i++ ) - //{ - // m_functionNodes.NodesList[ i ].LogicGraph(); - //} - - //for( int i = 0; i < UIUtils.FunctionSwitchCopyList().Count; i++ ) - //{ - // UIUtils.FunctionSwitchCopyList()[ i ].CheckReference(); - //} - - - - // Dont use nodeCount variable because node count can change in this loop??? - nodeCount = m_nodes.Count; - ParentNode node = null; - for( int i = 0; i < nodeCount; i++ ) - { - node = m_nodes[ i ]; - if( !node.IsOnGrid ) - { - m_nodeGrid.AddNodeToGrid( node ); - } - - node.MovingInFrame = false; - - if( drawInfo.CurrentEventType == EventType.Repaint ) - node.OnNodeLayout( drawInfo ); - - m_hasUnConnectedNodes = m_hasUnConnectedNodes || - ( node.ConnStatus != NodeConnectionStatus.Connected && node.ConnStatus != NodeConnectionStatus.Island ); - - if( node.RequireMaterialUpdate && currentMaterial != null ) - { - node.UpdateMaterial( currentMaterial ); - repaintMaterialInspector = true; - } - - //if( node.IsVisible ) - // m_visibleNodes.Add( node ); - - IsDirty = ( m_isDirty || node.IsDirty ); - SaveIsDirty = ( m_saveIsDirty || node.SaveIsDirty ); - } - - // Handles GUI controls - nodeCount = m_nodes.Count; - for( int i = nodeCount - 1; i >= 0; i-- ) - //for ( int i = 0; i < nodeCount; i++ ) - { - node = m_nodes[ i ]; - bool restoreMouse = false; - if( drawInfo.CurrentEventType == EventType.MouseDown && m_nodeClicked > -1 && node.UniqueId != m_nodeClicked ) - { - restoreMouse = true; - drawInfo.CurrentEventType = EventType.Ignore; - } - - node.DrawGUIControls( drawInfo ); - - if( restoreMouse ) - { - drawInfo.CurrentEventType = EventType.MouseDown; - } - } - - // Draw connection wires - if( drawInfo.CurrentEventType == EventType.Repaint ) - DrawWires( ParentWindow.WireTexture, drawInfo, ParentWindow.WindowContextPallete.IsActive, ParentWindow.WindowContextPallete.CurrentPosition ); - - // Master Draw - nodeCount = m_nodes.Count; - for( int i = 0; i < nodeCount; i++ ) - { - node = m_nodes[ i ]; - bool restoreMouse = false; - if( drawInfo.CurrentEventType == EventType.MouseDown && m_nodeClicked > -1 && node.UniqueId != m_nodeClicked ) - { - restoreMouse = true; - drawInfo.CurrentEventType = EventType.Ignore; - } - - node.Draw( drawInfo ); - - if( restoreMouse ) - { - drawInfo.CurrentEventType = EventType.MouseDown; - } - } - - // Draw Tooltip - if( drawInfo.CurrentEventType == EventType.Repaint || drawInfo.CurrentEventType == EventType.MouseDown ) - { - nodeCount = m_nodes.Count; - for( int i = nodeCount - 1; i >= 0; i-- ) - { - node = m_nodes[ i ]; - if( node.IsVisible && !node.IsMoving ) - { - bool showing = node.ShowTooltip( drawInfo ); - if( showing ) - break; - } - } - } - - if( repaintMaterialInspector ) - { - if( ASEMaterialInspector.Instance != null ) - { - ASEMaterialInspector.Instance.Repaint(); - } - } - - if( m_checkSelectedWireHighlights ) - { - m_checkSelectedWireHighlights = false; - ResetHighlightedWires(); - for( int i = 0; i < m_selectedNodes.Count; i++ ) - { - HighlightWiresStartingNode( m_selectedNodes[ i ] ); - } - } - - if( EditorGUI.EndChangeCheck() ) - { - SaveIsDirty = true; - repaint = true; - } - - if( drawInfo.CurrentEventType == EventType.Repaint ) - { - // Revert LOD changes to LOD0 (only if it's different) - if( UIUtils.MainSkin.textField.border.left != 4 ) - { - UIUtils.MainSkin.textField.border = UIUtils.RectOffsetFour; - nodeStyleOff.border = UIUtils.RectOffsetSix; - UIUtils.NodeWindowOffSquare.border = UIUtils.RectOffsetFour; - - nodeStyleOn.border = UIUtils.RectOffsetSix; - UIUtils.NodeWindowOnSquare.border = UIUtils.RectOffsetSix; - - nodeTitle.border.left = 6; - nodeTitle.border.right = 6; - nodeTitle.border.top = 6; - nodeTitle.border.bottom = 4; - - UIUtils.NodeHeaderSquare.border = UIUtils.RectOffsetFour; - commentaryBackground.border = UIUtils.RectOffsetSix; - } - } - - //if ( nullCount == m_nodes.Count ) - // m_nodes.Clear(); - - ChangedLightingModel = false; - - return repaint; - } - - public bool UpdateMarkForDeletion() - { - if( m_markedForDeletion.Count != 0 ) - { - DeleteMarkedForDeletionNodes(); - return true; - } - return false; - } - - public void DrawWires( Texture2D wireTex, DrawInfo drawInfo, bool contextPaletteActive, Vector3 contextPalettePos ) - { - //Handles.BeginGUI(); - //Debug.Log(GUI.depth); - // Draw connected node wires - m_wireBezierCount = 0; - for( int nodeIdx = 0; nodeIdx < m_nodes.Count; nodeIdx++ ) - { - ParentNode node = m_nodes[ nodeIdx ]; - if( (object)node == null ) - return; - - for( int inputPortIdx = 0; inputPortIdx < node.InputPorts.Count; inputPortIdx++ ) - { - InputPort inputPort = node.InputPorts[ inputPortIdx ]; - if( inputPort.ExternalReferences.Count > 0 && inputPort.Visible ) - { - bool cleanInvalidConnections = false; - for( int wireIdx = 0; wireIdx < inputPort.ExternalReferences.Count; wireIdx++ ) - { - WireReference reference = inputPort.ExternalReferences[ wireIdx ]; - if( reference.NodeId != -1 && reference.PortId != -1 ) - { - ParentNode outputNode = GetNode( reference.NodeId ); - if( outputNode != null ) - { - OutputPort outputPort = outputNode.GetOutputPortByUniqueId( reference.PortId ); - Vector3 endPos = new Vector3( inputPort.Position.x, inputPort.Position.y ); - Vector3 startPos = new Vector3( outputPort.Position.x, outputPort.Position.y ); - float x = ( startPos.x < endPos.x ) ? startPos.x : endPos.x; - float y = ( startPos.y < endPos.y ) ? startPos.y : endPos.y; - float width = Mathf.Abs( startPos.x - endPos.x ) + outputPort.Position.width; - float height = Mathf.Abs( startPos.y - endPos.y ) + outputPort.Position.height; - Rect portsBoundingBox = new Rect( x, y, width, height ); - - bool isVisible = node.IsVisible || outputNode.IsVisible; - if( !isVisible ) - { - isVisible = drawInfo.TransformedCameraArea.Overlaps( portsBoundingBox ); - } - - if( isVisible ) - { - - Rect bezierBB = DrawBezier( drawInfo.InvertedZoom, startPos, endPos, inputPort.DataType, outputPort.DataType, node.GetInputPortVisualDataTypeByArrayIdx( inputPortIdx ), outputNode.GetOutputPortVisualDataTypeById( reference.PortId ), reference.WireStatus, wireTex, node, outputNode ); - bezierBB.x -= Constants.OUTSIDE_WIRE_MARGIN; - bezierBB.y -= Constants.OUTSIDE_WIRE_MARGIN; - - bezierBB.width += Constants.OUTSIDE_WIRE_MARGIN * 2; - bezierBB.height += Constants.OUTSIDE_WIRE_MARGIN * 2; - - if( m_wireBezierCount < m_bezierReferences.Count ) - { - m_bezierReferences[ m_wireBezierCount ].UpdateInfo( ref bezierBB, inputPort.NodeId, inputPort.PortId, outputPort.NodeId, outputPort.PortId ); - } - else - { - m_bezierReferences.Add( new WireBezierReference( ref bezierBB, inputPort.NodeId, inputPort.PortId, outputPort.NodeId, outputPort.PortId ) ); - } - m_wireBezierCount++; - - } - } - else - { - if( DebugConsoleWindow.DeveloperMode ) - UIUtils.ShowMessage( "Detected Invalid connection from node " + node.UniqueId + " port " + inputPortIdx + " to Node " + reference.NodeId + " port " + reference.PortId, MessageSeverity.Error ); - cleanInvalidConnections = true; - inputPort.ExternalReferences[ wireIdx ].Invalidate(); - } - } - } - - if( cleanInvalidConnections ) - { - inputPort.RemoveInvalidConnections(); - } - } - } - } - - //Draw selected wire - if( m_parentWindow.WireReferenceUtils.ValidReferences() ) - { - if( m_parentWindow.WireReferenceUtils.InputPortReference.IsValid ) - { - InputPort inputPort = GetNode( m_parentWindow.WireReferenceUtils.InputPortReference.NodeId ).GetInputPortByUniqueId( m_parentWindow.WireReferenceUtils.InputPortReference.PortId ); - Vector3 endPos = Vector3.zero; - if( m_parentWindow.WireReferenceUtils.SnapEnabled ) - { - Vector2 pos = ( m_parentWindow.WireReferenceUtils.SnapPosition + drawInfo.CameraOffset ) * drawInfo.InvertedZoom; - endPos = new Vector3( pos.x, pos.y ) + UIUtils.ScaledPortsDelta; - } - else - { - endPos = contextPaletteActive ? contextPalettePos : new Vector3( Event.current.mousePosition.x, Event.current.mousePosition.y ); - } - - Vector3 startPos = new Vector3( inputPort.Position.x, inputPort.Position.y ); - DrawBezier( drawInfo.InvertedZoom, endPos, startPos, inputPort.DataType, inputPort.DataType, inputPort.DataType, inputPort.DataType, WireStatus.Default, wireTex ); - } - - if( m_parentWindow.WireReferenceUtils.OutputPortReference.IsValid ) - { - OutputPort outputPort = GetNode( m_parentWindow.WireReferenceUtils.OutputPortReference.NodeId ).GetOutputPortByUniqueId( m_parentWindow.WireReferenceUtils.OutputPortReference.PortId ); - Vector3 endPos = Vector3.zero; - if( m_parentWindow.WireReferenceUtils.SnapEnabled ) - { - Vector2 pos = ( m_parentWindow.WireReferenceUtils.SnapPosition + drawInfo.CameraOffset ) * drawInfo.InvertedZoom; - endPos = new Vector3( pos.x, pos.y ) + UIUtils.ScaledPortsDelta; - } - else - { - endPos = contextPaletteActive ? contextPalettePos : new Vector3( Event.current.mousePosition.x, Event.current.mousePosition.y ); - } - Vector3 startPos = new Vector3( outputPort.Position.x, outputPort.Position.y ); - DrawBezier( drawInfo.InvertedZoom, startPos, endPos, outputPort.DataType, outputPort.DataType, outputPort.DataType, outputPort.DataType, WireStatus.Default, wireTex ); - } - } - //Handles.EndGUI(); - } - - Rect DrawBezier( float invertedZoom, Vector3 startPos, Vector3 endPos, WirePortDataType inputDataType, WirePortDataType outputDataType, WirePortDataType inputVisualDataType, WirePortDataType outputVisualDataType, WireStatus wireStatus, Texture2D wireTex, ParentNode inputNode = null, ParentNode outputNode = null ) - { - startPos += UIUtils.ScaledPortsDelta; - endPos += UIUtils.ScaledPortsDelta; - - // Calculate the 4 points for bezier taking into account wire nodes and their automatic tangents - float mag = ( endPos - startPos ).magnitude; - float resizedMag = Mathf.Min( mag * 0.66f, Constants.HORIZONTAL_TANGENT_SIZE * invertedZoom ); - - Vector3 startTangent = new Vector3( startPos.x + resizedMag, startPos.y ); - Vector3 endTangent = new Vector3( endPos.x - resizedMag, endPos.y ); - - if( (object)inputNode != null && inputNode.GetType() == typeof( WireNode ) ) - endTangent = endPos + ( ( inputNode as WireNode ).TangentDirection ) * mag * 0.33f; - - if( (object)outputNode != null && outputNode.GetType() == typeof( WireNode ) ) - startTangent = startPos - ( ( outputNode as WireNode ).TangentDirection ) * mag * 0.33f; - - ///////////////Draw tangents - //Rect box1 = new Rect( new Vector2( startTangent.x, startTangent.y ), new Vector2( 10, 10 ) ); - //box1.x -= box1.width * 0.5f; - //box1.y -= box1.height * 0.5f; - //GUI.Label( box1, string.Empty, UIUtils.Box ); - - //Rect box2 = new Rect( new Vector2( endTangent.x, endTangent.y ), new Vector2( 10, 10 ) ); - //box2.x -= box2.width * 0.5f; - //box2.y -= box2.height * 0.5f; - //GUI.Label( box2, string.Empty, UIUtils.Box ); - - //m_auxRect.Set( 0, 0, UIUtils.CurrentWindow.position.width, UIUtils.CurrentWindow.position.height ); - //GLDraw.BeginGroup( m_auxRect ); - - int ty = 1; - float wireThickness = 0; - - - if( ParentWindow.Options.MultiLinePorts ) - { - GLDraw.MultiLine = true; - Shader.SetGlobalFloat( "_InvertedZoom", invertedZoom ); - - WirePortDataType smallest = ( (int)outputDataType < (int)inputDataType ? outputDataType : inputDataType ); - smallest = ( (int)smallest < (int)outputVisualDataType ? smallest : outputVisualDataType ); - smallest = ( (int)smallest < (int)inputVisualDataType ? smallest : inputVisualDataType ); - - switch( smallest ) - { - case WirePortDataType.FLOAT2: ty = 2; break; - case WirePortDataType.FLOAT3: ty = 3; break; - case WirePortDataType.FLOAT4: - case WirePortDataType.COLOR: - { - ty = 4; - } - break; - default: ty = 1; break; - } - wireThickness = Mathf.Lerp( Constants.WIRE_WIDTH * ( ty * invertedZoom * -0.05f + 0.15f ), Constants.WIRE_WIDTH * ( ty * invertedZoom * 0.175f + 0.3f ), invertedZoom + 0.4f ); - } - else - { - GLDraw.MultiLine = false; - wireThickness = Mathf.Lerp( Constants.WIRE_WIDTH * ( invertedZoom * -0.05f + 0.15f ), Constants.WIRE_WIDTH * ( invertedZoom * 0.175f + 0.3f ), invertedZoom + 0.4f ); - } - - Rect boundBox = new Rect(); - int segments = 11; - if( LodLevel <= ParentGraph.NodeLOD.LOD4 ) - segments = Mathf.Clamp( Mathf.FloorToInt( mag * 0.2f * invertedZoom ), 11, 35 ); - else - segments = (int)( invertedZoom * 14.28f * 11 ); - - if( ParentWindow.Options.ColoredPorts && wireStatus != WireStatus.Highlighted ) - boundBox = GLDraw.DrawBezier( startPos, startTangent, endPos, endTangent, UIUtils.GetColorForDataType( outputVisualDataType, false, false ), UIUtils.GetColorForDataType( inputVisualDataType, false, false ), wireThickness, segments, ty ); - else - boundBox = GLDraw.DrawBezier( startPos, startTangent, endPos, endTangent, UIUtils.GetColorFromWireStatus( wireStatus ), wireThickness, segments, ty ); - //GLDraw.EndGroup(); - - //GUI.Box( m_auxRect, string.Empty, UIUtils.CurrentWindow.CustomStylesInstance.Box ); - //GUI.Box( boundBox, string.Empty, UIUtils.CurrentWindow.CustomStylesInstance.Box ); - //if ( UIUtils.CurrentWindow.Options.ColoredPorts && wireStatus != WireStatus.Highlighted ) - // Handles.DrawBezier( startPos, endPos, startTangent, endTangent, UIUtils.GetColorForDataType( outputDataType, false, false ), wireTex, wiresTickness ); - //else - // Handles.DrawBezier( startPos, endPos, startTangent, endTangent, UIUtils.GetColorFromWireStatus( wireStatus ), wireTex, wiresTickness ); - - //Handles.DrawLine( startPos, startTangent ); - //Handles.DrawLine( endPos, endTangent ); - - float extraBound = 30 * invertedZoom; - boundBox.xMin -= extraBound; - boundBox.xMax += extraBound; - boundBox.yMin -= extraBound; - boundBox.yMax += extraBound; - - return boundBox; - } - - public void DrawBezierBoundingBox() - { - for( int i = 0; i < m_wireBezierCount; i++ ) - { - m_bezierReferences[ i ].DebugDraw(); - } - } - - public WireBezierReference GetWireBezierInPos( Vector2 position ) - { - for( int i = 0; i < m_wireBezierCount; i++ ) - { - if( m_bezierReferences[ i ].Contains( position ) ) - return m_bezierReferences[ i ]; - } - return null; - } - - - public List<WireBezierReference> GetWireBezierListInPos( Vector2 position ) - { - List<WireBezierReference> list = new List<WireBezierReference>(); - for( int i = 0; i < m_wireBezierCount; i++ ) - { - if( m_bezierReferences[ i ].Contains( position ) ) - list.Add( m_bezierReferences[ i ] ); - } - - return list; - } - - - public void MoveSelectedNodes( Vector2 delta, bool snap = false ) - { - //bool validMovement = delta.magnitude > 0.001f; - //if ( validMovement ) - //{ - // Undo.RegisterCompleteObjectUndo( ParentWindow, Constants.UndoMoveNodesId ); - // for ( int i = 0; i < m_selectedNodes.Count; i++ ) - // { - // if ( !m_selectedNodes[ i ].MovingInFrame ) - // { - // Undo.RecordObject( m_selectedNodes[ i ], Constants.UndoMoveNodesId ); - // m_selectedNodes[ i ].Move( delta, snap ); - // } - // } - // IsDirty = true; - //} - - bool performUndo = delta.magnitude > 0.01f; - if( performUndo ) - { - Undo.RegisterCompleteObjectUndo( ParentWindow, Constants.UndoMoveNodesId ); - Undo.RegisterCompleteObjectUndo( this, Constants.UndoMoveNodesId ); - } - - for( int i = 0; i < m_selectedNodes.Count; i++ ) - { - if( !m_selectedNodes[ i ].MovingInFrame ) - { - if( performUndo ) - m_selectedNodes[ i ].RecordObject( Constants.UndoMoveNodesId ); - m_selectedNodes[ i ].Move( delta, snap ); - } - } - - IsDirty = true; - } - - public void SetConnection( int InNodeId, int InPortId, int OutNodeId, int OutPortId ) - { - ParentNode inNode = GetNode( InNodeId ); - ParentNode outNode = GetNode( OutNodeId ); - InputPort inputPort = null; - OutputPort outputPort = null; - if( inNode != null && outNode != null ) - { - inputPort = inNode.GetInputPortByUniqueId( InPortId ); - outputPort = outNode.GetOutputPortByUniqueId( OutPortId ); - if( inputPort != null && outputPort != null ) - { - if( inputPort.IsConnectedTo( OutNodeId, OutPortId ) || outputPort.IsConnectedTo( InNodeId, InPortId ) ) - { - if( DebugConsoleWindow.DeveloperMode ) - UIUtils.ShowMessage( "Node/Port already connected " + InNodeId, MessageSeverity.Error ); - return; - } - - if( !inputPort.CheckValidType( outputPort.DataType ) ) - { - if( DebugConsoleWindow.DeveloperMode ) - UIUtils.ShowIncompatiblePortMessage( true, inNode, inputPort, outNode, outputPort ); - return; - } - - if( !outputPort.CheckValidType( inputPort.DataType ) ) - { - - if( DebugConsoleWindow.DeveloperMode ) - UIUtils.ShowIncompatiblePortMessage( false, outNode, outputPort, inNode, inputPort ); - return; - } - if( !inputPort.Available || !outputPort.Available ) - { - if( DebugConsoleWindow.DeveloperMode ) - UIUtils.ShowMessage( "Ports not available to connection", MessageSeverity.Warning ); - - return; - } - - if( inputPort.ConnectTo( OutNodeId, OutPortId, outputPort.DataType, false ) ) - { - inNode.OnInputPortConnected( InPortId, OutNodeId, OutPortId ); - } - - - if( outputPort.ConnectTo( InNodeId, InPortId, inputPort.DataType, inputPort.TypeLocked ) ) - { - outNode.OnOutputPortConnected( OutPortId, InNodeId, InPortId ); - } - } - else if( (object)inputPort == null ) - { - if( DebugConsoleWindow.DeveloperMode ) - UIUtils.ShowMessage( "Input Port " + InPortId + " doesn't exist on node " + InNodeId, MessageSeverity.Error ); - } - else - { - if( DebugConsoleWindow.DeveloperMode ) - UIUtils.ShowMessage( "Output Port " + OutPortId + " doesn't exist on node " + OutNodeId, MessageSeverity.Error ); - } - } - else if( (object)inNode == null ) - { - if( DebugConsoleWindow.DeveloperMode ) - UIUtils.ShowMessage( "Input node " + InNodeId + " doesn't exist", MessageSeverity.Error ); - } - else - { - if( DebugConsoleWindow.DeveloperMode ) - UIUtils.ShowMessage( "Output node " + OutNodeId + " doesn't exist", MessageSeverity.Error ); - } - } - - public void CreateConnection( int inNodeId, int inPortId, int outNodeId, int outPortId, bool registerUndo = true ) - { - ParentNode outputNode = GetNode( outNodeId ); - if( outputNode != null ) - { - OutputPort outputPort = outputNode.GetOutputPortByUniqueId( outPortId ); - if( outputPort != null ) - { - ParentNode inputNode = GetNode( inNodeId ); - InputPort inputPort = inputNode.GetInputPortByUniqueId( inPortId ); - - if( !inputPort.CheckValidType( outputPort.DataType ) ) - { - UIUtils.ShowIncompatiblePortMessage( true, inputNode, inputPort, outputNode, outputPort ); - return; - } - - if( !outputPort.CheckValidType( inputPort.DataType ) ) - { - UIUtils.ShowIncompatiblePortMessage( false, outputNode, outputPort, inputNode, inputPort ); - return; - } - - inputPort.DummyAdd( outputPort.NodeId, outputPort.PortId ); - outputPort.DummyAdd( inNodeId, inPortId ); - - if( UIUtils.DetectNodeLoopsFrom( inputNode, new Dictionary<int, int>() ) ) - { - inputPort.DummyRemove(); - outputPort.DummyRemove(); - m_parentWindow.WireReferenceUtils.InvalidateReferences(); - UIUtils.ShowMessage( "Infinite Loop detected" ); - Event.current.Use(); - return; - } - - inputPort.DummyRemove(); - outputPort.DummyRemove(); - - if( inputPort.IsConnected ) - { - DeleteConnection( true, inNodeId, inPortId, true, false, registerUndo ); - } - - //link output to input - if( outputPort.ConnectTo( inNodeId, inPortId, inputPort.DataType, inputPort.TypeLocked ) ) - outputNode.OnOutputPortConnected( outputPort.PortId, inNodeId, inPortId ); - - //link input to output - if( inputPort.ConnectTo( outputPort.NodeId, outputPort.PortId, outputPort.DataType, inputPort.TypeLocked ) ) - inputNode.OnInputPortConnected( inPortId, outputNode.UniqueId, outputPort.PortId ); - - MarkWireHighlights(); - } - SaveIsDirty = true; - //ParentWindow.ShaderIsModified = true; - } - } - - public void DeleteInvalidConnections() - { - int count = m_nodes.Count; - for( int nodeIdx = 0; nodeIdx < count; nodeIdx++ ) - { - { - int inputCount = m_nodes[ nodeIdx ].InputPorts.Count; - for( int inputIdx = 0; inputIdx < inputCount; inputIdx++ ) - { - if( !m_nodes[ nodeIdx ].InputPorts[ inputIdx ].Visible && - m_nodes[ nodeIdx ].InputPorts[ inputIdx ].IsConnected && - !m_nodes[ nodeIdx ].InputPorts[ inputIdx ].IsDummy ) - { - DeleteConnection( true, m_nodes[ nodeIdx ].UniqueId, m_nodes[ nodeIdx ].InputPorts[ inputIdx ].PortId, true, true ); - } - } - } - { - int outputCount = m_nodes[ nodeIdx ].OutputPorts.Count; - for( int outputIdx = 0; outputIdx < outputCount; outputIdx++ ) - { - if( !m_nodes[ nodeIdx ].OutputPorts[ outputIdx ].Visible && m_nodes[ nodeIdx ].OutputPorts[ outputIdx ].IsConnected ) - { - DeleteConnection( false, m_nodes[ nodeIdx ].UniqueId, m_nodes[ nodeIdx ].OutputPorts[ outputIdx ].PortId, true, true ); - } - } - } - } - } - - public void DeleteAllConnectionFromNode( int nodeId, bool registerOnLog, bool propagateCallback, bool registerUndo ) - { - ParentNode node = GetNode( nodeId ); - if( (object)node == null ) - return; - DeleteAllConnectionFromNode( node, registerOnLog, propagateCallback, registerUndo ); - } - - public void DeleteAllConnectionFromNode( ParentNode node, bool registerOnLog, bool propagateCallback, bool registerUndo ) - { - - for( int i = 0; i < node.InputPorts.Count; i++ ) - { - if( node.InputPorts[ i ].IsConnected ) - DeleteConnection( true, node.UniqueId, node.InputPorts[ i ].PortId, registerOnLog, propagateCallback, registerUndo ); - } - - for( int i = 0; i < node.OutputPorts.Count; i++ ) - { - if( node.OutputPorts[ i ].IsConnected ) - DeleteConnection( false, node.UniqueId, node.OutputPorts[ i ].PortId, registerOnLog, propagateCallback, registerUndo ); - } - } - - public void DeleteConnection( bool isInput, int nodeId, int portId, bool registerOnLog, bool propagateCallback, bool registerUndo = true ) - { - ParentNode node = GetNode( nodeId ); - if( (object)node == null ) - return; - - if( registerUndo ) - { - UIUtils.MarkUndoAction(); - Undo.RegisterCompleteObjectUndo( ParentWindow, Constants.UndoDeleteConnectionId ); - Undo.RegisterCompleteObjectUndo( this, Constants.UndoDeleteConnectionId ); - node.RecordObject( Constants.UndoDeleteConnectionId ); - } - - if( isInput ) - { - InputPort inputPort = node.GetInputPortByUniqueId( portId ); - if( inputPort != null && inputPort.IsConnected ) - { - - if( node.ConnStatus == NodeConnectionStatus.Connected ) - { - node.DeactivateInputPortNode( portId, false ); - //inputPort.GetOutputNode().DeactivateNode( portId, false ); - m_checkSelectedWireHighlights = true; - } - - for( int i = 0; i < inputPort.ExternalReferences.Count; i++ ) - { - WireReference inputReference = inputPort.ExternalReferences[ i ]; - ParentNode outputNode = GetNode( inputReference.NodeId ); - if( registerUndo ) - outputNode.RecordObject( Constants.UndoDeleteConnectionId ); - outputNode.GetOutputPortByUniqueId( inputReference.PortId ).InvalidateConnection( inputPort.NodeId, inputPort.PortId ); - if( propagateCallback ) - outputNode.OnOutputPortDisconnected( inputReference.PortId ); - } - inputPort.InvalidateAllConnections(); - if( propagateCallback ) - node.OnInputPortDisconnected( portId ); - } - } - else - { - OutputPort outputPort = node.GetOutputPortByUniqueId( portId ); - if( outputPort != null && outputPort.IsConnected ) - { - if( propagateCallback ) - node.OnOutputPortDisconnected( portId ); - - for( int i = 0; i < outputPort.ExternalReferences.Count; i++ ) - { - WireReference outputReference = outputPort.ExternalReferences[ i ]; - ParentNode inputNode = GetNode( outputReference.NodeId ); - if( registerUndo ) - inputNode.RecordObject( Constants.UndoDeleteConnectionId ); - if( inputNode.ConnStatus == NodeConnectionStatus.Connected ) - { - node.DeactivateNode( portId, false ); - m_checkSelectedWireHighlights = true; - } - inputNode.GetInputPortByUniqueId( outputReference.PortId ).InvalidateConnection( outputPort.NodeId, outputPort.PortId ); - if( propagateCallback ) - { - // Removing WireNodes fires this after the rewiring ( and the OnInputPortConnected callback ) which causes incorrect behaviors - // If is connected is true then we're on that case so we don't fire the OnInputPortDisconnected - if( !inputNode.GetInputPortByUniqueId( outputReference.PortId ).IsConnected ) - inputNode.OnInputPortDisconnected( outputReference.PortId ); - } - } - outputPort.InvalidateAllConnections(); - } - } - IsDirty = true; - SaveIsDirty = true; - } - - //public void DeleteSelectedNodes() - //{ - // bool invalidateMasterNode = false; - // int count = m_selectedNodes.Count; - // for( int nodeIdx = 0; nodeIdx < count; nodeIdx++ ) - // { - // ParentNode node = m_selectedNodes[ nodeIdx ]; - // if( node.UniqueId == m_masterNodeId ) - // { - // invalidateMasterNode = true; - // } - // else - // { - // DestroyNode( node ); - // } - // } - - // if( invalidateMasterNode ) - // { - // CurrentOutputNode.Selected = false; - // } - // //Clear all references - // m_selectedNodes.Clear(); - // IsDirty = true; - //} - - public void DeleteNodesOnArray( ref ParentNode[] nodeArray ) - { - bool invalidateMasterNode = false; - for( int nodeIdx = 0; nodeIdx < nodeArray.Length; nodeIdx++ ) - { - ParentNode node = nodeArray[ nodeIdx ]; - if( node.UniqueId == m_masterNodeId ) - { - FunctionOutput fout = node as FunctionOutput; - if( fout != null ) - { - for( int i = 0; i < m_nodes.Count; i++ ) - { - FunctionOutput secondfout = m_nodes[ i ] as FunctionOutput; - if( secondfout != null && secondfout != fout ) - { - secondfout.Function = fout.Function; - AssignMasterNode( secondfout, false ); - - DeselectNode( fout ); - DestroyNode( fout ); - break; - } - } - } - invalidateMasterNode = true; - } - else - { - DeselectNode( node ); - DestroyNode( node ); - } - nodeArray[ nodeIdx ] = null; - } - - if( invalidateMasterNode && CurrentMasterNode != null ) - { - CurrentMasterNode.Selected = false; - } - - //Clear all references - nodeArray = null; - IsDirty = true; - } - - public void MarkWireNodeSequence( WireNode node, bool isInput ) - { - if( node == null ) - { - return; - } - - if( m_markedForDeletion.Contains( node ) ) - return; - - m_markedForDeletion.Add( node ); - - if( isInput && node.InputPorts[ 0 ].IsConnected ) - { - MarkWireNodeSequence( GetNode( node.InputPorts[ 0 ].ExternalReferences[ 0 ].NodeId ) as WireNode, isInput ); - } - else if( !isInput && node.OutputPorts[ 0 ].IsConnected ) - { - MarkWireNodeSequence( GetNode( node.OutputPorts[ 0 ].ExternalReferences[ 0 ].NodeId ) as WireNode, isInput ); - } - } - - public void UndoableDeleteSelectedNodes( List<ParentNode> nodeList ) - { - if( nodeList.Count == 0 ) - return; - - List<ParentNode> validNode = new List<ParentNode>(); - - for( int i = 0; i < nodeList.Count; i++ ) - { - if( nodeList[ i ] != null && nodeList[ i ].UniqueId != m_masterNodeId ) - { - validNode.Add( nodeList[ i ] ); - } - } - UIUtils.ClearUndoHelper(); - ParentNode[] selectedNodes = new ParentNode[ validNode.Count ]; - for( int i = 0; i < selectedNodes.Length; i++ ) - { - if( validNode[ i ] != null ) - { - selectedNodes[ i ] = validNode[ i ]; - UIUtils.CheckUndoNode( selectedNodes[ i ] ); - } - } - - //Check nodes connected to deleted nodes to preserve connections on undo - List<ParentNode> extraNodes = new List<ParentNode>(); - for( int selectedNodeIdx = 0; selectedNodeIdx < selectedNodes.Length; selectedNodeIdx++ ) - { - // Check inputs - if( selectedNodes[ selectedNodeIdx ] != null ) - { - int inputIdxCount = selectedNodes[ selectedNodeIdx ].InputPorts.Count; - if( inputIdxCount > 0 ) - { - for( int inputIdx = 0; inputIdx < inputIdxCount; inputIdx++ ) - { - if( selectedNodes[ selectedNodeIdx ].InputPorts[ inputIdx ].IsConnected ) - { - int nodeIdx = selectedNodes[ selectedNodeIdx ].InputPorts[ inputIdx ].ExternalReferences[ 0 ].NodeId; - if( nodeIdx > -1 ) - { - ParentNode node = GetNode( nodeIdx ); - if( node != null && UIUtils.CheckUndoNode( node ) ) - { - extraNodes.Add( node ); - } - } - } - } - } - } - - // Check outputs - if( selectedNodes[ selectedNodeIdx ] != null ) - { - int outputIdxCount = selectedNodes[ selectedNodeIdx ].OutputPorts.Count; - if( outputIdxCount > 0 ) - { - for( int outputIdx = 0; outputIdx < outputIdxCount; outputIdx++ ) - { - int inputIdxCount = selectedNodes[ selectedNodeIdx ].OutputPorts[ outputIdx ].ExternalReferences.Count; - if( inputIdxCount > 0 ) - { - for( int inputIdx = 0; inputIdx < inputIdxCount; inputIdx++ ) - { - int nodeIdx = selectedNodes[ selectedNodeIdx ].OutputPorts[ outputIdx ].ExternalReferences[ inputIdx ].NodeId; - if( nodeIdx > -1 ) - { - ParentNode node = GetNode( nodeIdx ); - if( UIUtils.CheckUndoNode( node ) ) - { - extraNodes.Add( node ); - } - } - } - } - } - } - - } - } - - UIUtils.ClearUndoHelper(); - //Record deleted nodes - UIUtils.MarkUndoAction(); - Undo.RegisterCompleteObjectUndo( ParentWindow, Constants.UndoDeleteNodeId ); - Undo.RegisterCompleteObjectUndo( this, Constants.UndoDeleteNodeId ); - Undo.RecordObjects( selectedNodes, Constants.UndoDeleteNodeId ); - Undo.RecordObjects( extraNodes.ToArray(), Constants.UndoDeleteNodeId ); - - //Record deleting connections - for( int i = 0; i < selectedNodes.Length; i++ ) - { - CurrentOutputNode.Selected = false; - selectedNodes[ i ].Alive = false; - DeleteAllConnectionFromNode( selectedNodes[ i ], false, true, true ); - } - //Delete - DeleteNodesOnArray( ref selectedNodes ); - - extraNodes.Clear(); - extraNodes = null; - - EditorUtility.SetDirty( ParentWindow ); - - ParentWindow.ForceRepaint(); - } - - public void DeleteMarkedForDeletionNodes() - { - UndoableDeleteSelectedNodes( m_markedForDeletion ); - m_markedForDeletion.Clear(); - IsDirty = true; - - //bool invalidateMasterNode = false; - //int count = m_markedForDeletion.Count; - //for ( int nodeIdx = 0; nodeIdx < count; nodeIdx++ ) - //{ - // ParentNode node = m_markedForDeletion[ nodeIdx ]; - // if ( node.UniqueId == m_masterNodeId ) - // { - // invalidateMasterNode = true; - // } - // else - // { - // if ( node.Selected ) - // { - // m_selectedNodes.Remove( node ); - // node.Selected = false; - // } - // DestroyNode( node ); - // } - //} - - //if ( invalidateMasterNode ) - //{ - // CurrentMasterNode.Selected = false; - //} - ////Clear all references - //m_markedForDeletion.Clear(); - //IsDirty = true; - } - - public void DestroyNode( int nodeId ) - { - ParentNode node = GetNode( nodeId ); - DestroyNode( node ); - } - - public void DestroyNode( ParentNode node, bool registerUndo = true, bool destroyMasterNode = false ) - { - if( node == null ) - { - UIUtils.ShowMessage( "Attempting to destroying a inexistant node ", MessageSeverity.Warning ); - return; - } - - if( node.ConnStatus == NodeConnectionStatus.Connected && !m_checkSelectedWireHighlights ) - { - ResetHighlightedWires(); - m_checkSelectedWireHighlights = true; - } - - //TODO: check better placement of this code (reconnects wires from wire nodes) - //if ( node.GetType() == typeof( WireNode ) ) - //{ - // if ( node.InputPorts[ 0 ].ExternalReferences != null && node.InputPorts[ 0 ].ExternalReferences.Count > 0 ) - // { - // WireReference backPort = node.InputPorts[ 0 ].ExternalReferences[ 0 ]; - // for ( int i = 0; i < node.OutputPorts[ 0 ].ExternalReferences.Count; i++ ) - // { - // UIUtils.CurrentWindow.ConnectInputToOutput( node.OutputPorts[ 0 ].ExternalReferences[ i ].NodeId, node.OutputPorts[ 0 ].ExternalReferences[ i ].PortId, backPort.NodeId, backPort.PortId ); - // } - // } - //} - if( destroyMasterNode || ( node.UniqueId != m_masterNodeId && !( node is TemplateMultiPassMasterNode )/*!m_multiPassMasterNodes.HasNode( node.UniqueId )*/ ) ) - { - m_nodeGrid.RemoveNodeFromGrid( node, false ); - //Send Deactivation signal if active - if( node.ConnStatus == NodeConnectionStatus.Connected ) - { - node.DeactivateNode( -1, true ); - } - - //Invalidate references - //Invalidate input references - for( int inputPortIdx = 0; inputPortIdx < node.InputPorts.Count; inputPortIdx++ ) - { - InputPort inputPort = node.InputPorts[ inputPortIdx ]; - if( inputPort.IsConnected ) - { - for( int wireIdx = 0; wireIdx < inputPort.ExternalReferences.Count; wireIdx++ ) - { - WireReference inputReference = inputPort.ExternalReferences[ wireIdx ]; - ParentNode outputNode = GetNode( inputReference.NodeId ); - outputNode.GetOutputPortByUniqueId( inputReference.PortId ).InvalidateConnection( inputPort.NodeId, inputPort.PortId ); - outputNode.OnOutputPortDisconnected( inputReference.PortId ); - } - inputPort.InvalidateAllConnections(); - } - } - - //Invalidate output reference - for( int outputPortIdx = 0; outputPortIdx < node.OutputPorts.Count; outputPortIdx++ ) - { - OutputPort outputPort = node.OutputPorts[ outputPortIdx ]; - if( outputPort.IsConnected ) - { - for( int wireIdx = 0; wireIdx < outputPort.ExternalReferences.Count; wireIdx++ ) - { - WireReference outputReference = outputPort.ExternalReferences[ wireIdx ]; - ParentNode outnode = GetNode( outputReference.NodeId ); - if( outnode != null ) - { - outnode.GetInputPortByUniqueId( outputReference.PortId ).InvalidateConnection( outputPort.NodeId, outputPort.PortId ); - outnode.OnInputPortDisconnected( outputReference.PortId ); - } - } - outputPort.InvalidateAllConnections(); - } - } - - //Remove node from main list - //Undo.RecordObject( node, "Destroying node " + ( node.Attributes != null? node.Attributes.Name: node.GetType().ToString() ) ); - if( registerUndo ) - { - UIUtils.MarkUndoAction(); - Undo.RegisterCompleteObjectUndo( ParentWindow, Constants.UndoDeleteNodeId ); - Undo.RegisterCompleteObjectUndo( this, Constants.UndoDeleteNodeId ); - node.RecordObjectOnDestroy( Constants.UndoDeleteNodeId ); - } - - if( OnNodeRemovedEvent != null ) - OnNodeRemovedEvent( node ); - - m_nodes.Remove( node ); - m_nodesDict.Remove( node.UniqueId ); - node.Destroy(); - if( registerUndo ) - Undo.DestroyObjectImmediate( node ); - else - DestroyImmediate( node ); - IsDirty = true; - m_markToReOrder = true; - } - //else if( node.UniqueId == m_masterNodeId && node.GetType() == typeof(FunctionOutput) ) - //{ - // Debug.Log( "Attempting to destroy a output node" ); - // DeselectNode( node ); - // UIUtils.ShowMessage( "Attempting to destroy a output node" ); - //} - else - { - TemplateMultiPassMasterNode templateMasterNode = node as TemplateMultiPassMasterNode; - if( templateMasterNode != null && templateMasterNode.InvalidNode ) - { - DestroyNode( node, false, true ); - return; - } - - DeselectNode( node ); - UIUtils.ShowMessage( "Attempting to destroy a master node" ); - } - } - - void AddToSelectedNodes( ParentNode node ) - { - node.Selected = true; - m_selectedNodes.Add( node ); - node.OnNodeStoppedMovingEvent += OnNodeFinishMoving; - if( node.ConnStatus == NodeConnectionStatus.Connected ) - { - HighlightWiresStartingNode( node ); - } - } - - void RemoveFromSelectedNodes( ParentNode node ) - { - node.Selected = false; - m_selectedNodes.Remove( node ); - node.OnNodeStoppedMovingEvent -= OnNodeFinishMoving; - } - - public void SelectNode( ParentNode node, bool append, bool reorder ) - { - if( node == null ) - return; - - if( append ) - { - if( !m_selectedNodes.Contains( node ) ) - { - AddToSelectedNodes( node ); - } - } - else - { - DeSelectAll(); - AddToSelectedNodes( node ); - } - if( reorder && !node.ReorderLocked ) - { - m_nodes.Remove( node ); - m_nodes.Add( node ); - m_markToReOrder = true; - } - } - - public void MultipleSelection( Rect selectionArea, bool appendSelection = true ) - { - if( !appendSelection ) - { - for( int i = 0; i < m_nodes.Count; i++ ) - { - if( selectionArea.Overlaps( m_nodes[ i ].Position, true ) ) - { - RemoveFromSelectedNodes( m_nodes[ i ] ); - } - } - - m_markedToDeSelect = false; - ResetHighlightedWires(); - } - else - { - for( int i = 0; i < m_nodes.Count; i++ ) - { - if( !m_nodes[ i ].Selected && selectionArea.Overlaps( m_nodes[ i ].Position, true ) ) - { - AddToSelectedNodes( m_nodes[ i ] ); - } - } - } - - // reorder nodes and highlight them - for( int i = 0; i < m_selectedNodes.Count; i++ ) - { - if( !m_selectedNodes[ i ].ReorderLocked ) - { - m_nodes.Remove( m_selectedNodes[ i ] ); - m_nodes.Add( m_selectedNodes[ i ] ); - m_markToReOrder = true; - if( m_selectedNodes[ i ].ConnStatus == NodeConnectionStatus.Connected ) - { - HighlightWiresStartingNode( m_selectedNodes[ i ] ); - } - } - } - } - - public void SelectAll() - { - for( int i = 0; i < m_nodes.Count; i++ ) - { - if( !m_nodes[ i ].Selected ) - AddToSelectedNodes( m_nodes[ i ] ); - } - } - - public void SelectMasterNode() - { - if( m_masterNodeId != Constants.INVALID_NODE_ID ) - { - SelectNode( CurrentMasterNode, false, false ); - } - } - - public void SelectOutputNode() - { - if( m_masterNodeId != Constants.INVALID_NODE_ID ) - { - SelectNode( CurrentOutputNode, false, false ); - } - } - - public void DeselectNode( int nodeId ) - { - ParentNode node = GetNode( nodeId ); - if( node ) - { - m_selectedNodes.Remove( node ); - node.Selected = false; - } - } - - public void DeselectNode( ParentNode node ) - { - m_selectedNodes.Remove( node ); - node.Selected = false; - PropagateHighlightDeselection( node ); - } - - - - public void DeSelectAll() - { - m_markedToDeSelect = false; - for( int i = 0; i < m_selectedNodes.Count; i++ ) - { - m_selectedNodes[ i ].Selected = false; - m_selectedNodes[ i ].OnNodeStoppedMovingEvent -= OnNodeFinishMoving; - } - m_selectedNodes.Clear(); - ResetHighlightedWires(); - } - - public void AssignMasterNode() - { - if( m_selectedNodes.Count == 1 ) - { - OutputNode newOutputNode = m_selectedNodes[ 0 ] as OutputNode; - MasterNode newMasterNode = newOutputNode as MasterNode; - if( newOutputNode != null ) - { - if( m_masterNodeId != Constants.INVALID_NODE_ID && m_masterNodeId != newOutputNode.UniqueId ) - { - OutputNode oldOutputNode = GetNode( m_masterNodeId ) as OutputNode; - MasterNode oldMasterNode = oldOutputNode as MasterNode; - if( oldOutputNode != null ) - { - oldOutputNode.IsMainOutputNode = false; - if( oldMasterNode != null ) - { - oldMasterNode.ClearUpdateEvents(); - } - } - } - m_masterNodeId = newOutputNode.UniqueId; - newOutputNode.IsMainOutputNode = true; - if( newMasterNode != null ) - { - newMasterNode.OnMaterialUpdatedEvent += OnMaterialUpdatedEvent; - newMasterNode.OnShaderUpdatedEvent += OnShaderUpdatedEvent; - } - } - } - - IsDirty = true; - } - - public void AssignMasterNode( OutputNode node, bool onlyUpdateGraphId ) - { - AssignMasterNode( node.UniqueId, onlyUpdateGraphId ); - MasterNode masterNode = node as MasterNode; - if( masterNode != null ) - { - masterNode.OnMaterialUpdatedEvent += OnMaterialUpdatedEvent; - masterNode.OnShaderUpdatedEvent += OnShaderUpdatedEvent; - } - } - - public void AssignMasterNode( int nodeId, bool onlyUpdateGraphId ) - { - if( nodeId < 0 || m_masterNodeId == nodeId ) - return; - - if( m_masterNodeId > Constants.INVALID_NODE_ID ) - { - OutputNode oldOutputNode = ( GetNode( nodeId ) as OutputNode ); - MasterNode oldMasterNode = oldOutputNode as MasterNode; - if( oldOutputNode != null ) - { - oldOutputNode.IsMainOutputNode = false; - if( oldMasterNode != null ) - { - oldMasterNode.ClearUpdateEvents(); - } - } - } - - if( onlyUpdateGraphId ) - { - m_masterNodeId = nodeId; - } - else - { - OutputNode outputNode = ( GetNode( nodeId ) as OutputNode ); - if( outputNode != null ) - { - outputNode.IsMainOutputNode = true; - m_masterNodeId = nodeId; - } - } - - IsDirty = true; - } - - public void RefreshOnUndo() - { - if( m_nodes != null ) - { - int count = m_nodes.Count; - for( int i = 0; i < count; i++ ) - { - if( m_nodes[ i ] != null ) - { - m_nodes[ i ].RefreshOnUndo(); - } - } - } - } - - public void DrawGrid( DrawInfo drawInfo ) - { - m_nodeGrid.DrawGrid( drawInfo ); - } - - public float MaxNodeDist - { - get { return m_nodeGrid.MaxNodeDist; } - } - - public List<ParentNode> GetNodesInGrid( Vector2 transformedMousePos ) - { - return m_nodeGrid.GetNodesOn( transformedMousePos ); - } - - public void FireMasterNode( Shader selectedShader ) - { - ( GetNode( m_masterNodeId ) as MasterNode ).Execute( selectedShader ); - } - - public Shader FireMasterNode( string pathname, bool isFullPath ) - { - return ( GetNode( m_masterNodeId ) as MasterNode ).Execute( pathname, isFullPath ); - } - - private void ForceSignalPropagationOnMasterNodeInternal( UsageListTemplateMultiPassMasterNodes masterNodes ) - { - int mpCount = masterNodes.Count; - for( int i = 0; i < mpCount; i++ ) - { - masterNodes.NodesList[ i ].GenerateSignalPropagation(); - } - } - - public void ForceSignalPropagationOnMasterNode() - { - if( m_multiPassMasterNodes.Count > 0 ) - { - ForceSignalPropagationOnMasterNodeInternal( m_multiPassMasterNodes ); - for( int i = 0; i < m_lodMultiPassMasterNodes.Count; i++ ) - { - ForceSignalPropagationOnMasterNodeInternal( m_lodMultiPassMasterNodes[ i ] ); - } - } - else if( CurrentOutputNode != null ) - CurrentOutputNode.GenerateSignalPropagation(); - - List<FunctionOutput> allOutputs = m_functionOutputNodes.NodesList; - for( int i = 0; i < allOutputs.Count; i++ ) - { - allOutputs[ i ].GenerateSignalPropagation(); - } - - //List<RegisterLocalVarNode> localVarNodes = m_localVarNodes.NodesList; - //int count = localVarNodes.Count; - //for( int i = 0; i < count; i++ ) - //{ - // localVarNodes[ i ].GenerateSignalPropagation(); - //} - } - - public void UpdateShaderOnMasterNode( Shader newShader ) - { - MasterNode mainMasterNode = ( GetNode( m_masterNodeId ) as MasterNode ); - if( mainMasterNode == null ) - { - Debug.LogError( "No Master Node was detected. Aborting update!" ); - return; - } - mainMasterNode.UpdateFromShader( newShader ); - - if( HasLODs ) - { - int passIdx = ( (TemplateMultiPassMasterNode)mainMasterNode ).PassIdx; - for( int i = 0; i < m_lodMultiPassMasterNodes.Count; i++ ) - { - if( m_lodMultiPassMasterNodes.Count != 0 && m_lodMultiPassMasterNodes[ i ].NodesList.Count > 0 ) - { - if( m_lodMultiPassMasterNodes[ i ].NodesList[ passIdx ] != null ) - { - m_lodMultiPassMasterNodes[ i ].NodesList[ passIdx ].UpdateFromShader( newShader ); - } - else - { - Debug.LogError( "Null master node detected. Aborting update!" ); - return; - } - } - else break; - } - } - } - - public void CopyValuesFromMaterial( Material material ) - { - Material currMaterial = CurrentMaterial; - if( currMaterial == material ) - { - for( int i = 0; i < m_nodes.Count; i++ ) - { - m_nodes[ i ].ForceUpdateFromMaterial( material ); - } - } - } - - public void UpdateMaterialOnMasterNode( Material material ) - { - MasterNode mainMasterNode = ( GetNode( m_masterNodeId ) as MasterNode ); - mainMasterNode.UpdateMasterNodeMaterial( material ); - if( HasLODs ) - { - int passIdx = ( (TemplateMultiPassMasterNode)mainMasterNode ).PassIdx; - for( int i = 0; i < m_lodMultiPassMasterNodes.Count; i++ ) - { - if( m_lodMultiPassMasterNodes.Count != 0 && m_lodMultiPassMasterNodes[ i ].NodesList.Count > 0 ) - { - m_lodMultiPassMasterNodes[ i ].NodesList[ passIdx ].UpdateMasterNodeMaterial( material ); - } - else break; - } - } - } - - public void UpdateMaterialOnPropertyNodes( Material material ) - { - int propertyCount = m_propertyNodes.Count; - for(int i = 0;i< propertyCount;i++ ) - { - m_propertyNodes.NodesList[i].UpdateMaterial( material ); - } - } - - public void SetMaterialModeOnGraph( Material mat, bool fetchMaterialValues = true ) - { - for( int i = 0; i < m_nodes.Count; i++ ) - { - m_nodes[ i ].SetMaterialMode( mat, fetchMaterialValues ); - } - } - - public ParentNode CheckNodeAt( Vector3 pos, bool checkForRMBIgnore = false ) - { - ParentNode selectedNode = null; - - // this is checked on the inverse order to give priority to nodes that are drawn on top ( last on the list ) - for( int i = m_nodes.Count - 1; i > -1; i-- ) - { - if( m_nodes[ i ].Contains( pos ) ) - { - if( checkForRMBIgnore ) - { - if( !m_nodes[ i ].RMBIgnore ) - { - selectedNode = m_nodes[ i ]; - break; - } - } - else - { - selectedNode = m_nodes[ i ]; - break; - } - } - } - return selectedNode; - } - - public void ResetNodesLocalVariables() - { - for( int i = 0; i < m_nodes.Count; i++ ) - { - m_nodes[ i ].Reset(); - m_nodes[ i ].ResetOutputLocals(); - - FunctionNode fnode = m_nodes[ i ] as FunctionNode; - if( fnode != null ) - { - if( fnode.Function != null ) - fnode.FunctionGraph.ResetNodesLocalVariables(); - } - } - } - - public void ResetNodesLocalVariablesIfNot( MasterNodePortCategory category ) - { - for( int i = 0; i < m_nodes.Count; i++ ) - { - m_nodes[ i ].Reset(); - m_nodes[ i ].ResetOutputLocalsIfNot( category ); - - FunctionNode fnode = m_nodes[ i ] as FunctionNode; - if( fnode != null ) - { - if( fnode.Function != null ) - fnode.FunctionGraph.ResetNodesLocalVariablesIfNot( category ); - } - } - } - - public void ResetNodesLocalVariables( ParentNode node ) - { - if( node is GetLocalVarNode ) - { - GetLocalVarNode localVarNode = node as GetLocalVarNode; - if( localVarNode.CurrentSelected != null ) - { - node = localVarNode.CurrentSelected; - } - } - - node.Reset(); - node.ResetOutputLocals(); - int count = node.InputPorts.Count; - for( int i = 0; i < count; i++ ) - { - if( node.InputPorts[ i ].IsConnected ) - { - ResetNodesLocalVariables( m_nodesDict[ node.InputPorts[ i ].GetConnection().NodeId ] ); - } - } - } - - public void ResetNodesLocalVariablesIfNot( ParentNode node, MasterNodePortCategory category ) - { - if( node is GetLocalVarNode ) - { - GetLocalVarNode localVarNode = node as GetLocalVarNode; - if( localVarNode.CurrentSelected != null ) - { - node = localVarNode.CurrentSelected; - } - } - - node.Reset(); - node.ResetOutputLocalsIfNot( category ); - int count = node.InputPorts.Count; - for( int i = 0; i < count; i++ ) - { - if( node.InputPorts[ i ].IsConnected ) - { - ResetNodesLocalVariablesIfNot( m_nodesDict[ node.InputPorts[ i ].GetConnection().NodeId ], category ); - } - } - } - - - public override string ToString() - { - string dump = ( "Parent Graph \n" ); - for( int i = 0; i < m_nodes.Count; i++ ) - { - dump += ( m_nodes[ i ] + "\n" ); - } - return dump; - } - - public void OrderNodesByGraphDepth() - { - if( CurrentMasterNode != null ) - { - //CurrentMasterNode.SetupNodeCategories(); - int count = m_nodes.Count; - for( int i = 0; i < count; i++ ) - { - if( m_nodes[ i ].ConnStatus == NodeConnectionStatus.Island ) - { - m_nodes[ i ].CalculateCustomGraphDepth(); - } - } - } - else - { - //TODO: remove this dynamic list - List<OutputNode> allOutputs = new List<OutputNode>(); - for( int i = 0; i < AllNodes.Count; i++ ) - { - OutputNode temp = AllNodes[ i ] as OutputNode; - if( temp != null ) - allOutputs.Add( temp ); - } - - for( int j = 0; j < allOutputs.Count; j++ ) - { - allOutputs[ j ].SetupNodeCategories(); - int count = m_nodes.Count; - for( int i = 0; i < count; i++ ) - { - if( m_nodes[ i ].ConnStatus == NodeConnectionStatus.Island ) - { - m_nodes[ i ].CalculateCustomGraphDepth(); - } - } - } - } - - m_nodes.Sort( ( x, y ) => { return y.GraphDepth.CompareTo( x.GraphDepth ); } ); - } - - public void WriteToString( ref string nodesInfo, ref string connectionsInfo ) - { - for( int i = 0; i < m_nodes.Count; i++ ) - { - m_nodes[ i ].FullWriteToString( ref nodesInfo, ref connectionsInfo ); - IOUtils.AddLineTerminator( ref nodesInfo ); - } - } - - public void Reset() - { - SaveIsDirty = false; - IsDirty = false; - } - - public void OnBeforeSerialize() - { - //DeSelectAll(); - } - - public void OnAfterDeserialize() - { - m_afterDeserializeFlag = true; - } - - public void CleanCorruptedNodes() - { - for( int i = 0; i < m_nodes.Count; i++ ) - { - if( (object)m_nodes[ i ] == null ) - { - m_nodes.RemoveAt( i ); - CleanCorruptedNodes(); - } - } - } - - public void OnDuplicateEventWrapper() - { - if( OnDuplicateEvent != null ) - { - AmplifyShaderEditorWindow temp = UIUtils.CurrentWindow; - UIUtils.CurrentWindow = ParentWindow; - OnDuplicateEvent(); - UIUtils.CurrentWindow = temp; - } - } - - public ParentNode CreateNode( AmplifyShaderFunction shaderFunction, bool registerUndo, int nodeId = -1, bool addLast = true ) - { - FunctionNode newNode = ScriptableObject.CreateInstance<FunctionNode>(); - if( newNode ) - { - newNode.ContainerGraph = this; - newNode.CommonInit( shaderFunction, nodeId ); - newNode.UniqueId = nodeId; - AddNode( newNode, nodeId < 0, addLast, registerUndo ); - } - return newNode; - } - - public ParentNode CreateNode( AmplifyShaderFunction shaderFunction, bool registerUndo, Vector2 pos, int nodeId = -1, bool addLast = true ) - { - ParentNode newNode = CreateNode( shaderFunction, registerUndo, nodeId, addLast ); - if( newNode ) - { - newNode.Vec2Position = pos; - } - return newNode; - } - - public ParentNode CreateNode( System.Type type, bool registerUndo, int nodeId = -1, bool addLast = true ) - { - ParentNode newNode = ScriptableObject.CreateInstance( type ) as ParentNode; - if( newNode ) - { - newNode.ContainerGraph = this; - newNode.UniqueId = nodeId; - AddNode( newNode, nodeId < 0, addLast, registerUndo ); - } - return newNode; - } - - public ParentNode CreateNode( System.Type type, bool registerUndo, Vector2 pos, int nodeId = -1, bool addLast = true ) - { - ParentNode newNode = CreateNode( type, registerUndo, nodeId, addLast ); - if( newNode ) - { - newNode.Vec2Position = pos; - } - return newNode; - } - - public void FireMasterNodeReplacedEvent() - { - MasterNode masterNode = CurrentMasterNode; - int count = m_nodes.Count; - for( int i = 0; i < count; i++ ) - { - if( m_nodes[ i ].UniqueId != m_masterNodeId ) - { - m_nodes[ i ].OnMasterNodeReplaced( masterNode ); - } - } - } - - //Used over shader functions to propagate signal into their graphs - public void FireMasterNodeReplacedEvent( MasterNode masterNode ) - { - int count = m_nodes.Count; - for( int i = 0; i < count; i++ ) - { - if( m_nodes[ i ].UniqueId != masterNode.UniqueId ) - { - m_nodes[ i ].OnMasterNodeReplaced( masterNode ); - } - } - } - - - public void CrossCheckTemplateNodes( TemplateDataParent templateData ) - { - /*Paulo*/ - DeSelectAll(); - TemplateMultiPassMasterNode newMasterNode = null; - Dictionary<string, TemplateReplaceHelper> nodesDict = new Dictionary<string, TemplateReplaceHelper>(); - int mpNodeCount = m_multiPassMasterNodes.NodesList.Count; - for( int i = 0; i < mpNodeCount; i++ ) - { - nodesDict.Add( m_multiPassMasterNodes.NodesList[ i ].OriginalPassName, new TemplateReplaceHelper( m_multiPassMasterNodes.NodesList[ i ] ) ); - } - - TemplateMultiPassMasterNode currMasterNode = GetNode( m_masterNodeId ) as TemplateMultiPassMasterNode; - - TemplateMultiPass multipassData = templateData as TemplateMultiPass; - m_currentSRPType = multipassData.SubShaders[ 0 ].Modules.SRPType; - - bool sortTemplatesNodes = false; - Vector2 currentPosition = currMasterNode.Vec2Position; - for( int subShaderIdx = 0; subShaderIdx < multipassData.SubShaders.Count; subShaderIdx++ ) - { - for( int passIdx = 0; passIdx < multipassData.SubShaders[ subShaderIdx ].Passes.Count; passIdx++ ) - { - string currPassName = multipassData.SubShaders[ subShaderIdx ].Passes[ passIdx ].PassNameContainer.Data; - if( nodesDict.ContainsKey( currPassName ) ) - { - bool wasMainNode = nodesDict[ currPassName ].MasterNode.IsMainOutputNode; - - currentPosition.y += nodesDict[ currPassName ].MasterNode.Position.height + 10; - nodesDict[ currPassName ].Used = true; - nodesDict[ currPassName ].MasterNode.SetTemplate( multipassData, false, false, subShaderIdx, passIdx, SetTemplateSource.NewShader ); - if( wasMainNode && !nodesDict[ currPassName ].MasterNode.IsMainOutputNode ) - { - nodesDict[ currPassName ].MasterNode.ReleaseResources(); - } - else if( !wasMainNode && nodesDict[ currPassName ].MasterNode.IsMainOutputNode ) - { - newMasterNode = nodesDict[ currPassName ].MasterNode; - } - } - else - { - sortTemplatesNodes = true; - TemplateMultiPassMasterNode masterNode = CreateNode( typeof( TemplateMultiPassMasterNode ), false ) as TemplateMultiPassMasterNode; - if( multipassData.SubShaders[ subShaderIdx ].Passes[ passIdx ].IsMainPass ) - { - newMasterNode = masterNode; - currMasterNode.ReleaseResources(); - } - masterNode.Vec2Position = currentPosition; - masterNode.SetTemplate( multipassData, true, true, subShaderIdx, passIdx, SetTemplateSource.NewShader ); - //currentPosition.y += masterNode.HeightEstimate + 10; - } - } - } - - foreach( KeyValuePair<string, TemplateReplaceHelper> kvp in nodesDict ) - { - if( !kvp.Value.Used ) - DestroyNode( kvp.Value.MasterNode, false, true ); - } - nodesDict.Clear(); - - if( newMasterNode != null ) - { - m_masterNodeId = newMasterNode.UniqueId; - newMasterNode.OnMaterialUpdatedEvent += OnMaterialUpdatedEvent; - newMasterNode.OnShaderUpdatedEvent += OnShaderUpdatedEvent; - newMasterNode.IsMainOutputNode = true; - } - - if( sortTemplatesNodes ) - { - m_multiPassMasterNodes.NodesList.Sort( ( x, y ) => ( x.PassIdx.CompareTo( y.PassIdx ) ) ); - } - } - - public void OnRefreshLinkedPortsComplete() - { - OnRefreshLinkedPortsCompleteInternal( m_multiPassMasterNodes ); - for( int i = 0; i < m_lodMultiPassMasterNodes.Count; i++ ) - { - OnRefreshLinkedPortsCompleteInternal( m_lodMultiPassMasterNodes[ i ] ); - } - } - - private void OnRefreshLinkedPortsCompleteInternal( UsageListTemplateMultiPassMasterNodes masterNodes ) - { - int mpCount = masterNodes.Count; - for( int i = 0; i < mpCount; i++ ) - { - masterNodes.NodesList[ i ].OnRefreshLinkedPortsComplete(); - } - } - - public void RefreshLinkedMasterNodes( bool optionsUpdate = false ) - { - if( DebugConsoleWindow.DeveloperMode ) - Debug.Log( "Refresh linked master nodes" ); - - RefreshLinkedMasterNodesInternal( m_multiPassMasterNodes, optionsUpdate ); - for( int i = 0; i < m_lodMultiPassMasterNodes.Count; i++ ) - { - RefreshLinkedMasterNodesInternal( m_lodMultiPassMasterNodes[i], optionsUpdate ); - } - } - - private void RefreshLinkedMasterNodesInternal( UsageListTemplateMultiPassMasterNodes masterNodes, bool optionsUpdate ) - { - int mpCount = masterNodes.Count; - if( mpCount > 1 ) - { - Dictionary<string, List<InputPort>> registeredLinks = new Dictionary<string, List<InputPort>>(); - for( int i = 0; i < mpCount; i++ ) - { - CheckLinkedPorts( ref registeredLinks, masterNodes.NodesList[ mpCount - 1 - i ] ); - } - - foreach( KeyValuePair<string, List<InputPort>> kvp in registeredLinks ) - { - int linkCount = kvp.Value.Count; - if( linkCount == 1 ) - { - kvp.Value[ 0 ].Visible = true; - } - else - { - kvp.Value[ 0 ].Visible = true; - for( int i = 1; i < linkCount; i++ ) - { - kvp.Value[ i ].SetExternalLink( kvp.Value[ 0 ].NodeId, kvp.Value[ 0 ].PortId ); - kvp.Value[ i ].Visible = false; - } - } - kvp.Value.Clear(); - } - registeredLinks.Clear(); - registeredLinks = null; - } - - masterNodes.NodesList.Sort( ( x, y ) => ( x.SubShaderIdx * 1000 + x.PassIdx ).CompareTo( y.SubShaderIdx * 1000 + y.PassIdx ) ); - masterNodes.UpdateNodeArr(); - - m_parentWindow.TemplatesManagerInstance.ResetOptionsSetupData(); - for( int i = 0; i < mpCount; i++ ) - { - int visiblePorts = 0; - for( int j = 0; j < masterNodes.NodesList[ i ].InputPorts.Count; j++ ) - { - if( masterNodes.NodesList[ i ].InputPorts[ j ].Visible ) - { - visiblePorts++; - } - } - - if( masterNodes.NodesList[ i ].VisiblePorts != visiblePorts ) - { - masterNodes.NodesList[ i ].VisiblePorts = visiblePorts; - ForceRepositionCheck = true; - } - - masterNodes.NodesList[ i ].Docking = visiblePorts <= 0; - if( optionsUpdate ) - { - masterNodes.NodesList[ i ].ForceOptionsRefresh(); - } - } - } - - void CheckLinkedPorts( ref Dictionary<string, List<InputPort>> registeredLinks, TemplateMultiPassMasterNode masterNode ) - { - if( masterNode.HasLinkPorts ) - { - int inputCount = masterNode.InputPorts.Count; - for( int i = 0; i < inputCount; i++ ) - { - if( !string.IsNullOrEmpty( masterNode.InputPorts[ i ].ExternalLinkId ) ) - { - string linkId = masterNode.InputPorts[ i ].ExternalLinkId; - if( !registeredLinks.ContainsKey( masterNode.InputPorts[ i ].ExternalLinkId ) ) - { - registeredLinks.Add( linkId, new List<InputPort>() ); - } - - if( masterNode.IsMainOutputNode ) - { - registeredLinks[ linkId ].Insert( 0, masterNode.InputPorts[ i ] ); - } - else - { - registeredLinks[ linkId ].Add( masterNode.InputPorts[ i ] ); - } - } - else - { - masterNode.InputPorts[ i ].Visible = true; - } - } - } - else - { - int inputCount = masterNode.InputPorts.Count; - for( int i = 0; i < inputCount; i++ ) - { - masterNode.InputPorts[ i ].Visible = true; - } - } - - } - - public MasterNode ReplaceMasterNode( AvailableShaderTypes newType, bool writeDefaultData = false, TemplateDataParent templateData = null ) - { - DeSelectAll(); - ResetNodeConnStatus(); - MasterNode newMasterNode = null; - List<TemplateMultiPassMasterNode> nodesToDelete = null; - int mpNodeCount = m_multiPassMasterNodes.NodesList.Count; - if( mpNodeCount > 0 ) - { - nodesToDelete = new List<TemplateMultiPassMasterNode>(); - for( int i = 0; i < mpNodeCount; i++ ) - { - if( m_multiPassMasterNodes.NodesList[ i ].UniqueId != m_masterNodeId ) - { - nodesToDelete.Add( m_multiPassMasterNodes.NodesList[ i ] ); - } - } - - for( int lod = 0; lod < m_lodMultiPassMasterNodes.Count; lod++ ) - { - int lodNodeCount = m_lodMultiPassMasterNodes[ lod ].Count; - for( int i = 0; i < lodNodeCount; i++ ) - { - nodesToDelete.Add( m_lodMultiPassMasterNodes[ lod ].NodesList[ i ] ); - } - } - } - - MasterNode currMasterNode = GetNode( m_masterNodeId ) as MasterNode; - if( currMasterNode != null ) - { - currMasterNode.ReleaseResources(); - } - - bool refreshLinkedMasterNodes = false; - switch( newType ) - { - default: - case AvailableShaderTypes.SurfaceShader: - { - CurrentCanvasMode = NodeAvailability.SurfaceShader; - m_currentSRPType = TemplateSRPType.BuiltIn; - newMasterNode = CreateNode( typeof( StandardSurfaceOutputNode ), false ) as MasterNode; - } - break; - case AvailableShaderTypes.Template: - { - CurrentCanvasMode = NodeAvailability.TemplateShader; - if( templateData.TemplateType == TemplateDataType.LegacySinglePass ) - { - newMasterNode = CreateNode( typeof( TemplateMasterNode ), false ) as MasterNode; - ( newMasterNode as TemplateMasterNode ).SetTemplate( templateData as TemplateData, writeDefaultData, false ); - m_currentSRPType = TemplateSRPType.BuiltIn; - } - else - { - /*Paulo*/ - TemplateMultiPass multipassData = templateData as TemplateMultiPass; - m_currentSRPType = multipassData.SubShaders[ 0 ].Modules.SRPType; - - Vector2 currentPosition = currMasterNode.Vec2Position; - - for( int subShaderIdx = 0; subShaderIdx < multipassData.SubShaders.Count; subShaderIdx++ ) - { - for( int passIdx = 0; passIdx < multipassData.SubShaders[ subShaderIdx ].Passes.Count; passIdx++ ) - { - TemplateMultiPassMasterNode masterNode = CreateNode( typeof( TemplateMultiPassMasterNode ), false ) as TemplateMultiPassMasterNode; - if( multipassData.SubShaders[ subShaderIdx ].Passes[ passIdx ].IsMainPass ) - { - newMasterNode = masterNode; - ParentWindow.IsShaderFunctionWindow = false; - CurrentCanvasMode = NodeAvailability.TemplateShader; - } - masterNode.Vec2Position = currentPosition; - masterNode.SetTemplate( multipassData, true, true, subShaderIdx, passIdx, SetTemplateSource.NewShader ); - //currentPosition.y += masterNode.HeightEstimate + 10; - } - } - refreshLinkedMasterNodes = true; - //RefreshLinkedMasterNodes(); - } - } - break; - } - - if( currMasterNode != null ) - { - newMasterNode.CopyFrom( currMasterNode ); - m_masterNodeId = -1; - DestroyNode( currMasterNode, false, true ); - } - - if( nodesToDelete != null ) - { - for( int i = 0; i < nodesToDelete.Count; i++ ) - { - DestroyNode( nodesToDelete[ i ], false, true ); - } - nodesToDelete.Clear(); - } - - if( refreshLinkedMasterNodes ) - RefreshLinkedMasterNodes( true ); - - m_masterNodeId = newMasterNode.UniqueId; - newMasterNode.OnMaterialUpdatedEvent += OnMaterialUpdatedEvent; - newMasterNode.OnShaderUpdatedEvent += OnShaderUpdatedEvent; - newMasterNode.IsMainOutputNode = true; - OnRefreshLinkedPortsComplete(); - FullCleanUndoStack(); - return newMasterNode; - } - - private void RepositionTemplateNodes( MasterNode newMasterNode ) - { - m_forceRepositionCheck = false; - - int dockedElementsBefore = 0; - int dockedElementsAfter = 0; - int masterIndex = 0; - bool foundMaster = false; - for( int i = 0; i < MultiPassMasterNodes.Count; i++ ) - { - if( MultiPassMasterNodes.NodesList[ i ].UniqueId == m_masterNodeId ) - { - foundMaster = true; - masterIndex = i; - } - - if( !MultiPassMasterNodes.NodesList[ i ].IsInvisible && MultiPassMasterNodes.NodesList[ i ].Docking ) - { - if( foundMaster ) - dockedElementsAfter++; - else - dockedElementsBefore++; - } - } - - if( dockedElementsBefore > 0 ) - { - newMasterNode.UseSquareNodeTitle = true; - } - - for( int i = masterIndex - 1; i >= 0; i-- ) - { - float forwardTracking = 0; - for( int j = i + 1; j <= masterIndex; j++ ) - { - if( !MultiPassMasterNodes.NodesList[ i ].IsInvisible && !MultiPassMasterNodes.NodesList[ j ].Docking ) - { - forwardTracking += MultiPassMasterNodes.NodesList[ j ].HeightEstimate + 10; - } - } - MasterNode node = MultiPassMasterNodes.NodesList[ i ]; - node.Vec2Position = new Vector2( node.Vec2Position.x, newMasterNode.Position.y - forwardTracking - 33 * ( dockedElementsBefore ) ); - } - - for( int i = masterIndex + 1; i < MultiPassMasterNodes.Count; i++ ) - { - if( MultiPassMasterNodes.NodesList[ i ].UniqueId == newMasterNode.UniqueId || MultiPassMasterNodes.NodesList[ i ].Docking ) - continue; - - float backTracking = 0; - for( int j = i - 1; j >= masterIndex; j-- ) - { - if( !MultiPassMasterNodes.NodesList[ i ].IsInvisible && !MultiPassMasterNodes.NodesList[ j ].Docking ) - { - backTracking += MultiPassMasterNodes.NodesList[ j ].HeightEstimate + 10; - } - } - MasterNode node = MultiPassMasterNodes.NodesList[ i ]; - node.Vec2Position = new Vector2( node.Vec2Position.x, newMasterNode.Position.y + backTracking + 33 * ( dockedElementsAfter ) ); - } - } - - public void CreateNewEmpty( string name ) - { - CleanNodes(); - if( m_masterNodeDefaultType == null ) - m_masterNodeDefaultType = typeof( StandardSurfaceOutputNode ); - - MasterNode newMasterNode = CreateNode( m_masterNodeDefaultType, false ) as MasterNode; - newMasterNode.SetName( name ); - m_masterNodeId = newMasterNode.UniqueId; - - ParentWindow.IsShaderFunctionWindow = false; - CurrentCanvasMode = NodeAvailability.SurfaceShader; - - newMasterNode.OnMaterialUpdatedEvent += OnMaterialUpdatedEvent; - newMasterNode.OnShaderUpdatedEvent += OnShaderUpdatedEvent; - newMasterNode.IsMainOutputNode = true; - LoadedShaderVersion = VersionInfo.FullNumber; - } - - public void CreateNewEmptyTemplate( string templateGUID ) - { - CleanNodes(); - TemplateDataParent templateData = m_parentWindow.TemplatesManagerInstance.GetTemplate( templateGUID ); - if( templateData.TemplateType == TemplateDataType.LegacySinglePass ) - { - TemplateMasterNode newMasterNode = CreateNode( typeof( TemplateMasterNode ), false ) as TemplateMasterNode; - m_masterNodeId = newMasterNode.UniqueId; - - ParentWindow.IsShaderFunctionWindow = false; - CurrentCanvasMode = NodeAvailability.TemplateShader; - m_currentSRPType = TemplateSRPType.BuiltIn; - newMasterNode.OnMaterialUpdatedEvent += OnMaterialUpdatedEvent; - newMasterNode.OnShaderUpdatedEvent += OnShaderUpdatedEvent; - newMasterNode.IsMainOutputNode = true; - - newMasterNode.SetTemplate( templateData as TemplateData, true, true ); - } - else - { - /*Paulo*/ - TemplateMultiPass multipassData = templateData as TemplateMultiPass; - m_currentSRPType = multipassData.SubShaders[ 0 ].Modules.SRPType; - - Vector2 currentPosition = Vector2.zero; - for( int subShaderIdx = 0; subShaderIdx < multipassData.SubShaders.Count; subShaderIdx++ ) - { - for( int passIdx = 0; passIdx < multipassData.SubShaders[ subShaderIdx ].Passes.Count; passIdx++ ) - { - TemplateMultiPassMasterNode newMasterNode = CreateNode( typeof( TemplateMultiPassMasterNode ), false ) as TemplateMultiPassMasterNode; - if( multipassData.SubShaders[ subShaderIdx ].Passes[ passIdx ].IsMainPass ) - { - m_masterNodeId = newMasterNode.UniqueId; - - ParentWindow.IsShaderFunctionWindow = false; - CurrentCanvasMode = NodeAvailability.TemplateShader; - - newMasterNode.OnMaterialUpdatedEvent += OnMaterialUpdatedEvent; - newMasterNode.OnShaderUpdatedEvent += OnShaderUpdatedEvent; - newMasterNode.IsMainOutputNode = true; - } - newMasterNode.Vec2Position = currentPosition; - newMasterNode.SetTemplate( multipassData, true, true, subShaderIdx, passIdx, SetTemplateSource.NewShader ); - - //currentPosition.y += newMasterNode.HeightEstimate + 10; - } - } - - RefreshLinkedMasterNodes( false ); - OnRefreshLinkedPortsComplete(); - } - - LoadedShaderVersion = VersionInfo.FullNumber; - } - - public void CreateNewEmptyFunction( AmplifyShaderFunction shaderFunction ) - { - CleanNodes(); - FunctionOutput newOutputNode = CreateNode( typeof( FunctionOutput ), false ) as FunctionOutput; - m_masterNodeId = newOutputNode.UniqueId; - - ParentWindow.IsShaderFunctionWindow = true; - CurrentCanvasMode = NodeAvailability.ShaderFunction; - - newOutputNode.IsMainOutputNode = true; - } - - public void ForceCategoryRefresh() { m_forceCategoryRefresh = true; } - public void RefreshExternalReferences() - { - int count = m_nodes.Count; - for( int i = 0; i < count; i++ ) - { - m_nodes[ i ].RefreshExternalReferences(); - } - } - - public Vector2 SelectedNodesCentroid - { - get - { - if( m_selectedNodes.Count == 0 ) - return Vector2.zero; - Vector2 pos = new Vector2( 0, 0 ); - for( int i = 0; i < m_selectedNodes.Count; i++ ) - { - pos += m_selectedNodes[ i ].Vec2Position; - } - - pos /= m_selectedNodes.Count; - return pos; - } - } - - public void AddVirtualTextureCount() - { - m_virtualTextureCount += 1; - } - - public void RemoveVirtualTextureCount() - { - m_virtualTextureCount -= 1; - if( m_virtualTextureCount < 0 ) - { - Debug.LogWarning( "Invalid virtual texture count" ); - } - } - - public bool HasVirtualTexture { get { return m_virtualTextureCount > 0; } } - - public void AddInstancePropertyCount() - { - m_instancePropertyCount += 1; -// Debug.Log( "AddInstancePropertyCount "+this.GetInstanceID() + " " + m_instancePropertyCount ); - } - - public void RemoveInstancePropertyCount() - { - m_instancePropertyCount -= 1; - // Debug.Log( "RemoveInstancePropertyCount " + this.GetInstanceID() + " " + m_instancePropertyCount ); - - if( m_instancePropertyCount < 0 ) - { - Debug.LogWarning( "Invalid property instance count" ); - } - } - - public int InstancePropertyCount { get { return m_instancePropertyCount; } set { m_instancePropertyCount = value; } } - - public bool IsInstancedShader { get { return m_instancePropertyCount > 0; } } - - public void AddNormalDependentCount() { m_normalDependentCount += 1; } - - public void RemoveNormalDependentCount() - { - m_normalDependentCount -= 1; - if( m_normalDependentCount < 0 ) - { - Debug.LogWarning( "Invalid normal dependentCount count" ); - } - } - - public void SetModeFromMasterNode() - { - MasterNode masterNode = CurrentMasterNode; - if( masterNode != null ) - { - switch( masterNode.CurrentMasterNodeCategory ) - { - default: - case AvailableShaderTypes.SurfaceShader: - { - if( masterNode is StandardSurfaceOutputNode ) - CurrentCanvasMode = ParentWindow.CurrentNodeAvailability; - else - CurrentCanvasMode = NodeAvailability.SurfaceShader; - } - break; - case AvailableShaderTypes.Template: - { - CurrentCanvasMode = NodeAvailability.TemplateShader; - } - break; - } - } - else - { - - CurrentCanvasMode = NodeAvailability.SurfaceShader; - } - } - - public void MarkToDelete( ParentNode node ) - { - m_markedForDeletion.Add( node ); - } - public bool IsMasterNode( ParentNode node ) - { - return ( node.UniqueId == m_masterNodeId ) || - m_multiPassMasterNodes.HasNode( node.UniqueId ); - } - - public TemplateMultiPassMasterNode GetMainMasterNodeOfLOD( int lod ) - { - if( lod == -1 ) - return CurrentMasterNode as TemplateMultiPassMasterNode; - - return m_lodMultiPassMasterNodes[ lod ].NodesList.Find( x => x.IsMainOutputNode ); - } - - public TemplateMultiPassMasterNode GetMasterNodeOfPass( string passName, int lod ) - { - if( lod == -1 ) - return m_multiPassMasterNodes.NodesList.Find( x => x.PassName.Equals( passName ) ); - - return m_lodMultiPassMasterNodes[lod].NodesList.Find( x => x.PassName.Equals( passName ) ); - } - - public void ForceMultiPassMasterNodesRefresh() - { - int mainOutputId = 0; - int count = m_multiPassMasterNodes.Count; - for( int i = 0; i < count; i++ ) - { - m_multiPassMasterNodes.NodesList[ i ].ForceTemplateRefresh(); - if( m_multiPassMasterNodes.NodesList[ i ].IsMainOutputNode ) - mainOutputId = i; - } - - int lodCount = m_lodMultiPassMasterNodes.Count; - for( int i = 0; i < lodCount; i++ ) - { - if( m_lodMultiPassMasterNodes[ i ] != null ) - { - count = m_lodMultiPassMasterNodes[ i ].Count; - for( int j = 0; j < count; j++ ) - { - m_lodMultiPassMasterNodes[ i ].NodesList[ j ].ForceTemplateRefresh(); - } - } - } - - m_multiPassMasterNodes.NodesList[ mainOutputId ].CheckTemplateChanges(); - } - - public void SetLateOptionsRefresh() - { - m_lateOptionsRefresh = true; - } - - public void CreateLodMasterNodes( TemplateMultiPass templateMultiPass,int index, Vector2 initialPosition ) - { - for( int lod = 0; lod < m_lodMultiPassMasterNodes.Count; lod++ ) - { - if( m_lodMultiPassMasterNodes[ lod ].Count == 0 ) - { - TemplateMultiPassMasterNode reference = CurrentMasterNode as TemplateMultiPassMasterNode; - - int shaderLod = -1; - if( lod == 0 ) - { - shaderLod = reference.ShaderLOD - MasterNodeLODIncrement; - } - else - { - //index == -2 is when user clicks on +/- buttons over the foldout UI - if( index == -2 ) - { - shaderLod = m_lodMultiPassMasterNodes[ lod - 1 ].NodesList[ reference.PassIdx ].ShaderLOD - MasterNodeLODIncrement; - } - //index == -1 is when user clicks on + button over the main lod master node - else if( index == -1 ) - { - int mainShaderLOD = m_lodMultiPassMasterNodes[ 0 ].NodesList[ reference.PassIdx ].ShaderLOD; - shaderLod = ( reference.ShaderLOD + mainShaderLOD )/2; - } - else - { - if( m_lodMultiPassMasterNodes[ index ].Count > 0 ) - { - if( m_lodMultiPassMasterNodes[ index + 1 ].Count > 0 ) - { - shaderLod = (m_lodMultiPassMasterNodes[ index ].NodesList[ reference.PassIdx ].ShaderLOD + - m_lodMultiPassMasterNodes[ index + 1 ].NodesList[ reference.PassIdx ].ShaderLOD )/2; - } - else - { - shaderLod = m_lodMultiPassMasterNodes[ index ].NodesList[ reference.PassIdx ].ShaderLOD - MasterNodeLODIncrement; - } - } - } - } - - int nodeId = 0; - TemplateMultiPassMasterNode mainMasterNode = null; - for( int subShaderIdx = 0; subShaderIdx < templateMultiPass.SubShaders.Count; subShaderIdx++ ) - { - for( int passIdx = 0; passIdx < templateMultiPass.SubShaders[ subShaderIdx ].Passes.Count; passIdx++ ) - { - TemplateMultiPassMasterNode masterNode = ScriptableObject.CreateInstance( typeof( TemplateMultiPassMasterNode ) ) as TemplateMultiPassMasterNode; - masterNode.LODIndex = lod; - masterNode.ContainerGraph = this; - masterNode.Vec2Position = initialPosition; - AddNode( masterNode, true ); - masterNode.SetTemplate( templateMultiPass, true, true, subShaderIdx, passIdx, SetTemplateSource.NewShader ); - masterNode.CopyOptionsFrom( m_multiPassMasterNodes.NodesList[ nodeId++ ] ); - if( masterNode.IsMainOutputNode || ( subShaderIdx == 0 && passIdx == 0 ) ) - { - masterNode.SetShaderLODValueAndLabel( shaderLod ); - mainMasterNode = masterNode; - } - } - } - - mainMasterNode.ForceOptionsRefresh(); - SortLODMasterNodes(); - if( OnLODMasterNodesAddedEvent != null ) - { - OnLODMasterNodesAddedEvent( lod ); - } - - TemplateMultiPassMasterNode lodMainMasterNode = CurrentMasterNode as TemplateMultiPassMasterNode; - lodMainMasterNode.SetShaderLODValueAndLabel( lodMainMasterNode.ShaderLOD ); - return; - } - } - } - - public void DestroyLodMasterNodes( int index ) - { - if( index < 0 ) - { - for( int lod = m_lodMultiPassMasterNodes.Count - 1; lod >= 0; lod-- ) - { - if( m_lodMultiPassMasterNodes[ lod ].Count > 0 ) - { - while( m_lodMultiPassMasterNodes[ lod ].Count > 0 ) - { - DestroyNode( m_lodMultiPassMasterNodes[ lod ].NodesList[ 0 ], false, true ); - } - break; - } - } - } - else - { - while( m_lodMultiPassMasterNodes[ index ].Count > 0 ) - { - DestroyNode( m_lodMultiPassMasterNodes[ index ].NodesList[ 0 ], false, true ); - } - } - SortLODMasterNodes(); - TemplateMultiPassMasterNode lodMainMasterNode = CurrentMasterNode as TemplateMultiPassMasterNode; - lodMainMasterNode.SetShaderLODValueAndLabel( lodMainMasterNode.ShaderLOD ); - } - - public void SortLODMasterNodes() - { - int idx = (CurrentMasterNode as TemplateMultiPassMasterNode).PassIdx; - m_lodMultiPassMasterNodes.Sort( ( x, y ) => - { - if( x.Count > 0 ) - { - if( y.Count > 0 ) - { - return -x.NodesList[ idx ].ShaderLOD.CompareTo( y.NodesList[ idx ].ShaderLOD ); - } - else - { - return -1; - } - } - else - { - if( y.Count > 0 ) - { - return 1; - } - } - return 0; - }); - - for( int lodIdx = 0; lodIdx < m_lodMultiPassMasterNodes.Count; lodIdx++ ) - { - for( int nodeIdx = 0; nodeIdx < m_lodMultiPassMasterNodes[ lodIdx ].Count; nodeIdx++ ) - { - m_lodMultiPassMasterNodes[ lodIdx ].NodesList[ nodeIdx ].LODIndex = lodIdx; - } - } - } - - public List<TemplateMultiPassMasterNode> GetMultiPassMasterNodes( int lod ) - { - if( lod == -1 ) - return m_multiPassMasterNodes.NodesList; - - return m_lodMultiPassMasterNodes[ lod ].NodesList; - } - - public bool IsNormalDependent { get { return m_normalDependentCount > 0; } } - - public void MarkToDeselect() { m_markedToDeSelect = true; } - public void MarkToSelect( int nodeId ) { m_markToSelect = nodeId; } - public void MarkWireHighlights() { m_checkSelectedWireHighlights = true; } - public List<ParentNode> SelectedNodes { get { return m_selectedNodes; } } - public List<ParentNode> MarkedForDeletionNodes { get { return m_markedForDeletion; } } - public int CurrentMasterNodeId { get { return m_masterNodeId; } set { m_masterNodeId = value; } } - - public Shader CurrentShader - { - get - { - MasterNode masterNode = GetNode( m_masterNodeId ) as MasterNode; - if( masterNode != null ) - return masterNode.CurrentShader; - return null; - } - } - - public Material CurrentMaterial - { - get - { - MasterNode masterNode = GetNode( m_masterNodeId ) as MasterNode; - if( masterNode != null ) - return masterNode.CurrentMaterial; - return null; - } - } - - - - public NodeAvailability CurrentCanvasMode { get { return m_currentCanvasMode; } set { m_currentCanvasMode = value; ParentWindow.LateRefreshAvailableNodes(); } } - public OutputNode CurrentOutputNode { get { return GetNode( m_masterNodeId ) as OutputNode; } } - public FunctionOutput CurrentFunctionOutput { get { return GetNode( m_masterNodeId ) as FunctionOutput; } } - public MasterNode CurrentMasterNode { get { return GetNode( m_masterNodeId ) as MasterNode; } } - public StandardSurfaceOutputNode CurrentStandardSurface { get { return GetNode( m_masterNodeId ) as StandardSurfaceOutputNode; } } - public List<ParentNode> AllNodes { get { return m_nodes; } } - public int NodeCount { get { return m_nodes.Count; } } - //public List<ParentNode> VisibleNodes { get { return m_visibleNodes; } } - - public int NodeClicked - { - set { m_nodeClicked = value; } - get { return m_nodeClicked; } - } - - public bool IsDirty - { - set { m_isDirty = value && UIUtils.DirtyMask; } - get - { - bool value = m_isDirty; - m_isDirty = false; - return value; - } - } - - public bool SaveIsDirty - { - set { m_saveIsDirty = value && UIUtils.DirtyMask; } - get { return m_saveIsDirty; } - } - public int LoadedShaderVersion - { - get { return m_loadedShaderVersion; } - set { m_loadedShaderVersion = value; } - } - - public AmplifyShaderFunction CurrentShaderFunction - { - get { if( CurrentFunctionOutput != null ) return CurrentFunctionOutput.Function; else return null; } - set { if( CurrentFunctionOutput != null ) CurrentFunctionOutput.Function = value; } - } - - public bool HasUnConnectedNodes { get { return m_hasUnConnectedNodes; } } - public UsageListSamplerNodes SamplerNodes { get { return m_samplerNodes; } } - public UsageListFloatIntNodes FloatIntNodes { get { return m_floatNodes; } } - public UsageListTexturePropertyNodes TexturePropertyNodes { get { return m_texturePropertyNodes; } } - public UsageListTextureArrayNodes TextureArrayNodes { get { return m_textureArrayNodes; } } - public UsageListPropertyNodes PropertyNodes { get { return m_propertyNodes; } } - public UsageListPropertyNodes RawPropertyNodes { get { return m_rawPropertyNodes; } } - public UsageListCustomExpressionsOnFunctionMode CustomExpressionOnFunctionMode { get { return m_customExpressionsOnFunctionMode; } } - public UsageListStaticSwitchNodes StaticSwitchNodes { get { return m_staticSwitchNodes; } } - public UsageListScreenColorNodes ScreenColorNodes { get { return m_screenColorNodes; } } - public UsageListRegisterLocalVarNodes LocalVarNodes { get { return m_localVarNodes; } } - public UsageListGlobalArrayNodes GlobalArrayNodes { get { return m_globalArrayNodes; } } - public UsageListFunctionInputNodes FunctionInputNodes { get { return m_functionInputNodes; } } - public UsageListFunctionNodes FunctionNodes { get { return m_functionNodes; } } - public UsageListFunctionOutputNodes FunctionOutputNodes { get { return m_functionOutputNodes; } } - public UsageListFunctionSwitchNodes FunctionSwitchNodes { get { return m_functionSwitchNodes; } } - public UsageListFunctionSwitchCopyNodes FunctionSwitchCopyNodes { get { return m_functionSwitchCopyNodes; } } - public UsageListTemplateMultiPassMasterNodes MultiPassMasterNodes { get { return m_multiPassMasterNodes; } set { m_multiPassMasterNodes = value; } } - public List<UsageListTemplateMultiPassMasterNodes> LodMultiPassMasternodes { get { return m_lodMultiPassMasterNodes; } } - - - public PrecisionType CurrentPrecision - { - get { return m_currentPrecision; } - set { m_currentPrecision = value; } - } - - public NodeLOD LodLevel - { - get { return m_lodLevel; } - } - - public List<ParentNode> NodePreviewList { get { return m_nodePreviewList; } set { m_nodePreviewList = value; } } - - public void SetGraphId( int id ) - { - m_graphId = id; - } - - public int GraphId - { - get { return m_graphId; } - } - - public AmplifyShaderEditorWindow ParentWindow - { - get { return m_parentWindow; } - set { m_parentWindow = value; } - } - - - public bool ChangedLightingModel - { - get { return m_changedLightingModel; } - set { m_changedLightingModel = value; } - } - - public bool ForceRepositionCheck - { - get { return m_forceRepositionCheck; } - set { m_forceRepositionCheck = value; } - } - - public bool IsLoading { get { return m_isLoading; } set { m_isLoading = value; } } - public bool IsDuplicating { get { return m_isDuplicating; } set { m_isDuplicating = value; } } - public TemplateSRPType CurrentSRPType { get { return m_currentSRPType; }set { m_currentSRPType = value; } } - public bool IsSRP { get { return m_currentSRPType == TemplateSRPType.Lightweight || m_currentSRPType == TemplateSRPType.HD; } } - public bool IsHDRP { get { return m_currentSRPType == TemplateSRPType.HD; } } - public bool IsLWRP { get { return m_currentSRPType == TemplateSRPType.Lightweight; } } - public bool IsStandardSurface { get { return GetNode( m_masterNodeId ) is StandardSurfaceOutputNode; } } - public bool SamplingThroughMacros { get { return m_samplingThroughMacros && IsSRP; } set { m_samplingThroughMacros = value; } } - public bool HasLODs { get { return m_lodMultiPassMasterNodes[ 0 ].Count > 0; } } - //public bool HasLodMultiPassNodes - //{ - // get - // { - // for( int i = 0; i < m_lodMultiPassMasterNodes.Count; i++ ) - // { - // if( m_lodMultiPassMasterNodes[ i ].Count > 0 ) - // return true; - // } - // return false; - // } - //} - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Graphs/ParentGraph.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Graphs/ParentGraph.cs.meta deleted file mode 100644 index dd5b3087..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Graphs/ParentGraph.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 0b814c2a3cbebc047a566a92ed9d4340 -timeCreated: 1481126953 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu.meta deleted file mode 100644 index a6275782..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 3b28c70161e2aec4787239fba546bd25 -folderAsset: yes -timeCreated: 1481126944 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderEditorWindow.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderEditorWindow.cs deleted file mode 100644 index 8cbfafaf..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderEditorWindow.cs +++ /dev/null @@ -1,5945 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEngine; -using UnityEditor; -using UnityEditor.Callbacks; -using System; -using System.Collections; -using System.Threading; -using System.Globalization; -using System.Collections.Generic; -using UnityEngine.Networking; - -namespace AmplifyShaderEditor -{ - // Disabling Substance Deprecated warning - - public class AmplifyShaderEditorWindow : SearchableEditorWindow, ISerializationCallbackReceiver - { - public const string PreviewSizeGlobalVariable = "_ASEPreviewSize"; - - public const double InactivitySaveTime = 1.0; - - public const string CopyCommand = "Copy"; - public const string PasteCommand = "Paste"; - public const string SelectAll = "SelectAll"; - public const string Duplicate = "Duplicate"; - public const string ObjectSelectorClosed = "ObjectSelectorClosed"; - public const string LiveShaderError = "Live Shader only works with an assigned Master Node on the graph"; - - //public Texture2D MasterNodeOnTexture = null; - //public Texture2D MasterNodeOffTexture = null; - - //public Texture2D GPUInstancedOnTexture = null; - //public Texture2D GPUInstancedOffTexture = null; - - private bool m_initialized = false; - private bool m_checkInvalidConnections = false; - private bool m_afterDeserializeFlag = true; - - - [SerializeField] - private ParentGraph m_customGraph = null; - - // UI - private Rect m_graphArea; - private Texture2D m_graphBgTexture; - private Texture2D m_graphFgTexture; - private GUIStyle m_graphFontStyle; - //private GUIStyle _borderStyle; - private Texture2D m_wireTexture; - - [SerializeField] - TemplatesManager m_templatesManager; - - [SerializeField] - private InnerWindowEditorVariables m_innerEditorVariables; - - [SerializeField] - private string m_lastpath; - - [SerializeField] - private ASESelectionMode m_selectionMode = ASESelectionMode.Shader; - - [SerializeField] - private DuplicatePreventionBuffer m_duplicatePreventionBuffer; - - [SerializeField] - private double m_inactivityTime = 0; - - // Prevent save ops every tick when on live mode - [SerializeField] - private double m_lastTimeSaved = 0; - - [SerializeField] - private bool m_cacheSaveOp = false; - private const double SaveTime = 1; - - private bool m_markedToSave = false; - - // Graph logic - [SerializeField] - private ParentGraph m_mainGraphInstance; - - // Camera control - [SerializeField] - private Vector2 m_cameraOffset; - - private float m_cameraSpeed = 1; - - private Rect m_cameraInfo; - - [SerializeField] - private float m_cameraZoom; - - [SerializeField] - private Vector2 m_minNodePos; - - [SerializeField] - private Vector2 m_maxNodePos; - - [SerializeField] - private bool m_isDirty; - - [SerializeField] - private bool m_saveIsDirty; - - [SerializeField] - private bool m_repaintIsDirty; - - [SerializeField] - private bool m_liveShaderEditing = false; - - [SerializeField] - private bool m_shaderIsModified = false; - - [SerializeField] - private string m_lastOpenedLocation = string.Empty; - - [SerializeField] - private bool m_zoomChanged = true; - - [SerializeField] - private float m_lastWindowWidth = 0; - - [SerializeField] - private int m_graphCount = 0; - - [SerializeField] - private double m_currentInactiveTime = 0; - - private bool m_ctrlSCallback = false; - - private bool m_altBoxSelection = false; - private bool m_altDragStarted = false; - private bool m_altPressDown = false; - private bool m_altAvailable = true; - - // Events - private Vector3 m_currentMousePos; - private Vector2 m_keyEvtMousePos2D; - private Vector2 m_currentMousePos2D; - private Event m_currentEvent; - private string m_currentCommandName = string.Empty; - private bool m_insideEditorWindow; - - private bool m_lostFocus = false; - // Selection box for multiple node selection - private bool m_multipleSelectionActive = false; - private bool m_lmbPressed = false; - private Vector2 m_multipleSelectionStart; - private Rect m_multipleSelectionArea = new Rect( 0, 0, 0, 0 ); - private bool m_autoPanDirActive = false; - private bool m_forceAutoPanDir = false; - private bool m_refreshOnUndo = false; - private bool m_loadShaderOnSelection = false; - private bool m_refreshAvailableNodes = false; - private double m_time; - - //Context Menu - private Vector2 m_rmbStartPos; - private Vector2 m_altKeyStartPos; - private GraphContextMenu m_contextMenu; - private ShortcutsManager m_shortcutManager; - - [SerializeField] - private NodeAvailability m_currentNodeAvailability = NodeAvailability.SurfaceShader; - //Clipboard - private Clipboard m_clipboard; - - //Node Parameters Window - [SerializeField] - private bool m_nodeParametersWindowMaximized = true; - private NodeParametersWindow m_nodeParametersWindow; - - // Tools Window - private ToolsWindow m_toolsWindow; - - private ConsoleLogWindow m_consoleLogWindow; - - //Editor Options - private OptionsWindow m_optionsWindow; - - // Mode Window - private ShaderEditorModeWindow m_modeWindow; - - // Tools Window - private TipsWindow m_tipsWindow; - - //Palette Window - [SerializeField] - private bool m_paletteWindowMaximized = true; - private PaletteWindow m_paletteWindow; - - private ContextPalette m_contextPalette; - private PalettePopUp m_palettePopup; - private System.Type m_paletteChosenType; - private AmplifyShaderFunction m_paletteChosenFunction; - - // In-Editor Message System - GenericMessageUI m_genericMessageUI; - private GUIContent m_genericMessageContent; - - // Drag&Drop Tool - private DragAndDropTool m_dragAndDropTool; - - //Custom Styles - //private CustomStylesContainer m_customStyles; - - private AmplifyShaderFunction m_previousShaderFunction; - - private List<MenuParent> m_registeredMenus; - - private PreMadeShaders m_preMadeShaders; - - private AutoPanData[] m_autoPanArea; - - private DrawInfo m_drawInfo; - private KeyCode m_lastKeyPressed = KeyCode.None; - private System.Type m_commentaryTypeNode; - - private int m_onLoadDone = 0; - - private float m_copyPasteDeltaMul = 0; - private Vector2 m_copyPasteInitialPos = Vector2.zero; - private Vector2 m_copyPasteDeltaPos = Vector2.zero; - - private int m_repaintCount = 0; - private bool m_forceUpdateFromMaterialFlag = false; - - private UnityEngine.Object m_delayedLoadObject = null; - private double m_focusOnSelectionTimestamp; - private double m_focusOnMasterNodeTimestamp; - private double m_wiredDoubleTapTimestamp; - - private bool m_globalPreview = false; - private bool m_globalShowInternalData = true; - - private const double AutoZoomTime = 0.25; - private const double ToggleTime = 0.25; - private const double WiredDoubleTapTime = 0.25; - private const double DoubleClickTime = 0.25; - - private Material m_delayedMaterialSet = null; - - private bool m_mouseDownOnValidArea = false; - - private bool m_removedKeyboardFocus = false; - - private int m_lastHotControl = -1; - - [SerializeField] - private bool m_isShaderFunctionWindow = false; - - private string m_currentTitle = string.Empty; - private bool m_currentTitleMod = false; - - //private Material m_maskingMaterial = null; - //private int m_cachedProjectInLinearId = -1; - private int m_cachedEditorTimeId = -1; - private int m_cachedEditorDeltaTimeId = -1; - //private float m_repaintFrequency = 15; - //private double m_repaintTimestamp = 0; - - // Smooth Zoom - private bool m_smoothZoom = false; - private float m_targetZoom; - private double m_zoomTime; - private Vector2 m_zoomPivot; - private float m_targetZoomIncrement; - private float m_zoomVelocity = 0; - - // Smooth Pan - private bool m_smoothOffset = false; - private double m_offsetTime; - private Vector2 m_targetOffset; - private Vector2 m_camVelocity = Vector2.zero; - - // Auto-Compile samples - private bool m_forcingMaterialUpdateFlag = false; - private bool m_forcingMaterialUpdateOp = false; - private List<Material> m_materialsToUpdate = new List<Material>(); - - private NodeExporterUtils m_nodeExporterUtils; - private bool m_performFullUndoRegister = true; - - [SerializeField] - private AmplifyShaderFunction m_openedShaderFunction; - - [SerializeField] - private bool m_openedAssetFromNode = false; - - private bool m_nodesLoadedCorrectly = false; - private GUIContent NodesExceptionMessage = new GUIContent( "ASE is unable to load correctly due to some faulty other classes/plugin in your project. We advise to review all your imported plugins." ); - - - private bool m_outdatedShaderFromTemplateLoaded = false; - private bool m_replaceMasterNode = false; - private AvailableShaderTypes m_replaceMasterNodeType; - private string m_replaceMasterNodeData; - private bool m_replaceMasterNodeDataFromCache; - private NodeWireReferencesUtils m_wireReferenceUtils = new NodeWireReferencesUtils(); - - private ParentNode m_nodeToFocus = null; - private float m_zoomToFocus = 1.0f; - private bool m_selectNodeToFocus = true; - - [NonSerialized] - public Dictionary<string, bool> VisitedChanged = new Dictionary<string, bool>(); - - [SerializeField] - private List<Toast> m_messages = new List<Toast>(); - - [SerializeField] - private float m_maxMsgWidth = 100; - - [SerializeField] - private bool m_maximizeMessages = false; - - [NonSerialized] - private Dictionary<string, OutputPort> m_savedList = new Dictionary<string, OutputPort>(); - - public int m_frameCounter = 0; - public double m_fpsTime = 0; - public string m_fpsDisplay = string.Empty; - -#if UNITY_EDITOR_WIN - // ScreenShot vars - IntPtr m_aseHandle; - private Rect m_prevWindowRect; - private Vector2 m_prevCameraOffset; - private float m_prevCameraZoom; - private bool m_openSavedFolder = false; - private bool m_takeScreenShot = false; -#endif - public bool CheckFunctions = false; - - // Unity Menu item - [MenuItem( "Window/Amplify Shader Editor/Open Canvas", false, 1000 )] - static void OpenMainShaderGraph() - { - if( IOUtils.AllOpenedWindows.Count > 0 ) - { - AmplifyShaderEditorWindow currentWindow = CreateTab( "Empty", UIUtils.ShaderIcon ); - UIUtils.CurrentWindow = currentWindow; - currentWindow.CreateNewGraph( "Empty" ); - currentWindow.Show(); - } - else - { - AmplifyShaderEditorWindow currentWindow = OpenWindow( "Empty", UIUtils.ShaderIcon ); - currentWindow.CreateNewGraph( "Empty" ); - //currentWindow.Show(); - } - } - - public static string GenerateTabTitle( string original, bool modified = false ) - { - GUIContent content = new GUIContent( original ); - GUIStyle tabStyle = new GUIStyle( (GUIStyle)"dragtabdropwindow" );// GUI.skin.FindStyle( "dragtabdropwindow" ); - string finalTitle = string.Empty; - bool addEllipsis = false; - for( int i = 1; i <= original.Length; i++ ) - { - content.text = original.Substring( 0, i ); - Vector2 titleSize = tabStyle.CalcSize( content ); - int maxSize = modified ? 62 : 69; - if( titleSize.x > maxSize ) - { - addEllipsis = true; - break; - } - else - { - finalTitle = content.text; - } - } - if( addEllipsis ) - finalTitle += ".."; - if( modified ) - finalTitle += "*"; - return finalTitle; - } - - public static void ConvertShaderToASE( Shader shader ) - { - if( UIUtils.IsUnityNativeShader( shader ) ) - { - Debug.LogWarningFormat( "Action not allowed. Attempting to load the native {0} shader into Amplify Shader Editor", shader.name ); - return; - } - - string guid = AssetDatabase.AssetPathToGUID( AssetDatabase.GetAssetPath( shader ) ); - if( IOUtils.AllOpenedWindows.Count > 0 ) - { - AmplifyShaderEditorWindow openedTab = null; - for( int i = 0; i < IOUtils.AllOpenedWindows.Count; i++ ) - { - //if( AssetDatabase.GetAssetPath( shader ).Equals( IOUtils.AllOpenedWindows[ i ].LastOpenedLocation ) ) - if( guid.Equals( IOUtils.AllOpenedWindows[ i ].GUID ) ) - { - openedTab = IOUtils.AllOpenedWindows[ i ]; - break; - } - } - - if( openedTab != null ) - { - openedTab.wantsMouseMove = true; - openedTab.ShowTab(); - UIUtils.CurrentWindow = openedTab; - } - else - { - EditorWindow openedWindow = AmplifyShaderEditorWindow.GetWindow<AmplifyShaderEditorWindow>(); - AmplifyShaderEditorWindow currentWindow = CreateTab(); - WindowHelper.AddTab( openedWindow, currentWindow ); - UIUtils.CurrentWindow = currentWindow; - } - } - else - { - AmplifyShaderEditorWindow currentWindow = OpenWindow( shader.name, UIUtils.ShaderIcon ); - UIUtils.CurrentWindow = currentWindow; - } - - if( IOUtils.IsASEShader( shader ) ) - { - UIUtils.CurrentWindow.LoadProjectSelected( shader ); - } - else - { - UIUtils.CreateEmptyFromInvalid( shader ); - UIUtils.ShowMessage( "Trying to open shader not created on ASE!\nBEWARE, old data will be lost if saving it here!", MessageSeverity.Warning ); - if( UIUtils.CurrentWindow.LiveShaderEditing ) - { - UIUtils.ShowMessage( "Disabling Live Shader Editing. Must manually re-enable it.", MessageSeverity.Warning ); - UIUtils.CurrentWindow.LiveShaderEditing = false; - } - } - } - - public static void LoadMaterialToASE( Material material ) - { - string guid = AssetDatabase.AssetPathToGUID( AssetDatabase.GetAssetPath( material.shader ) ); - - if( IOUtils.AllOpenedWindows.Count > 0 ) - { - AmplifyShaderEditorWindow openedTab = null; - for( int i = 0; i < IOUtils.AllOpenedWindows.Count; i++ ) - { - //if( AssetDatabase.GetAssetPath( material.shader ).Equals( IOUtils.AllOpenedWindows[ i ].LastOpenedLocation ) ) - if( guid.Equals( IOUtils.AllOpenedWindows[ i ].GUID ) ) - { - openedTab = IOUtils.AllOpenedWindows[ i ]; - break; - } - } - - if( openedTab != null ) - { - openedTab.wantsMouseMove = true; - openedTab.ShowTab(); - UIUtils.CurrentWindow = openedTab; - } - else - { - EditorWindow openedWindow = AmplifyShaderEditorWindow.GetWindow<AmplifyShaderEditorWindow>(); - AmplifyShaderEditorWindow currentWindow = CreateTab(); - WindowHelper.AddTab( openedWindow, currentWindow ); - UIUtils.CurrentWindow = currentWindow; - } - } - else - { - AmplifyShaderEditorWindow currentWindow = OpenWindow( material.name, UIUtils.MaterialIcon ); - UIUtils.CurrentWindow = currentWindow; - } - - if( IOUtils.IsASEShader( material.shader ) ) - { - UIUtils.CurrentWindow.LoadProjectSelected( material ); - } - else - { - UIUtils.CreateEmptyFromInvalid( material.shader ); - UIUtils.SetDelayedMaterialMode( material ); - } - } - - public static void LoadShaderFunctionToASE( AmplifyShaderFunction shaderFunction, bool openedAssetFromNode ) - { - string guid = AssetDatabase.AssetPathToGUID( AssetDatabase.GetAssetPath( shaderFunction ) ); - - if( IOUtils.AllOpenedWindows.Count > 0 ) - { - AmplifyShaderEditorWindow openedTab = null; - for( int i = 0; i < IOUtils.AllOpenedWindows.Count; i++ ) - { - //if( AssetDatabase.GetAssetPath( shaderFunction ).Equals( IOUtils.AllOpenedWindows[ i ].LastOpenedLocation ) ) - if( guid.Equals( IOUtils.AllOpenedWindows[ i ].GUID ) ) - { - openedTab = IOUtils.AllOpenedWindows[ i ]; - break; - } - } - - if( openedTab != null ) - { - openedTab.wantsMouseMove = true; - openedTab.ShowTab(); - UIUtils.CurrentWindow = openedTab; - } - else - { - EditorWindow openedWindow = AmplifyShaderEditorWindow.GetWindow<AmplifyShaderEditorWindow>(); - AmplifyShaderEditorWindow currentWindow = CreateTab(); - WindowHelper.AddTab( openedWindow, currentWindow ); - UIUtils.CurrentWindow = currentWindow; - } - } - else - { - AmplifyShaderEditorWindow currentWindow = OpenWindow( shaderFunction.FunctionName, UIUtils.ShaderFunctionIcon ); - UIUtils.CurrentWindow = currentWindow; - } - - UIUtils.CurrentWindow.OpenedAssetFromNode = openedAssetFromNode; - if( IOUtils.IsShaderFunction( shaderFunction.FunctionInfo ) ) - { - UIUtils.CurrentWindow.LoadProjectSelected( shaderFunction ); - } - else - { - UIUtils.CurrentWindow.titleContent.text = GenerateTabTitle( shaderFunction.FunctionName ); - UIUtils.CurrentWindow.titleContent.image = UIUtils.ShaderFunctionIcon; - UIUtils.CreateEmptyFunction( shaderFunction ); - } - } - - public static AmplifyShaderEditorWindow OpenWindow( string title = null, Texture icon = null ) - { - AmplifyShaderEditorWindow currentWindow = (AmplifyShaderEditorWindow)AmplifyShaderEditorWindow.GetWindow( typeof( AmplifyShaderEditorWindow ), false ); - currentWindow.minSize = new Vector2( ( Constants.MINIMIZE_WINDOW_LOCK_SIZE - 150 ), 270 ); - currentWindow.wantsMouseMove = true; - if( title != null ) - currentWindow.titleContent.text = GenerateTabTitle( title ); - if( icon != null ) - currentWindow.titleContent.image = icon; - return currentWindow; - } - - public static AmplifyShaderEditorWindow CreateTab( string title = null, Texture icon = null ) - { - AmplifyShaderEditorWindow currentWindow = EditorWindow.CreateInstance<AmplifyShaderEditorWindow>(); - currentWindow.minSize = new Vector2( ( Constants.MINIMIZE_WINDOW_LOCK_SIZE - 150 ), 270 ); - currentWindow.wantsMouseMove = true; - if( title != null ) - currentWindow.titleContent.text = GenerateTabTitle( title ); - if( icon != null ) - currentWindow.titleContent.image = icon; - return currentWindow; - } - - public double CalculateInactivityTime() - { - double currTime = EditorApplication.timeSinceStartup; - switch( Event.current.type ) - { - case EventType.MouseDown: - case EventType.MouseUp: - //case EventType.MouseMove: - case EventType.MouseDrag: - case EventType.KeyDown: - case EventType.KeyUp: - case EventType.ScrollWheel: - case EventType.DragUpdated: - case EventType.DragPerform: - case EventType.DragExited: - case EventType.ValidateCommand: - case EventType.ExecuteCommand: - { - m_inactivityTime = currTime; - return 0; - } - } - return currTime - m_inactivityTime; - } - - - // Shader Graph window - public override void OnEnable() - { - base.OnEnable(); - - Preferences.LoadDefaults(); - -#if UNITY_2018_3_OR_NEWER - ASEPackageManagerHelper.RequestInfo(); - ASEPackageManagerHelper.Update(); -#endif - - Shader.SetGlobalVector( PreviewSizeGlobalVariable, new Vector4( ParentNode.PreviewWidth, ParentNode.PreviewHeight, 0, 0 ) ); - - if( m_templatesManager == null ) - { - m_templatesManager = IOUtils.FirstValidTemplatesManager; - if( m_templatesManager == null ) - { - m_templatesManager = ScriptableObject.CreateInstance<TemplatesManager>(); - m_templatesManager.Init(); - if( TemplatesManager.ShowDebugMessages ) - Debug.Log( "Creating Manager" ); - } - else - { - if( TemplatesManager.ShowDebugMessages ) - Debug.Log( "Assigning Manager" ); - } - } - else if( !m_templatesManager.Initialized ) - { - if( TemplatesManager.ShowDebugMessages ) - Debug.Log( "Re-Initializing Manager" ); - m_templatesManager.Init(); - } - TemplatePostProcessor.Destroy(); - if( m_innerEditorVariables == null ) - { - m_innerEditorVariables = new InnerWindowEditorVariables(); - m_innerEditorVariables.Initialize(); - } - - if( m_mainGraphInstance == null ) - { - m_mainGraphInstance = CreateInstance<ParentGraph>(); - m_mainGraphInstance.Init(); - m_mainGraphInstance.ParentWindow = this; - m_mainGraphInstance.SetGraphId( 0 ); - } - m_mainGraphInstance.ResetEvents(); - m_mainGraphInstance.OnNodeEvent += OnNodeStoppedMovingEvent; - m_mainGraphInstance.OnMaterialUpdatedEvent += OnMaterialUpdated; - m_mainGraphInstance.OnShaderUpdatedEvent += OnShaderUpdated; - m_mainGraphInstance.OnEmptyGraphDetectedEvt += OnEmptyGraphDetected; - m_mainGraphInstance.OnNodeRemovedEvent += m_toolsWindow.OnNodeRemovedFromGraph; - GraphCount = 1; - - IOUtils.Init(); - IOUtils.AllOpenedWindows.Add( this ); - - // Only runs once for multiple windows - EditorApplication.update -= IOUtils.UpdateIO; - EditorApplication.update += IOUtils.UpdateIO; - - //EditorApplication.update -= UpdateTime; - EditorApplication.update -= UpdateNodePreviewListAndTime; - //EditorApplication.update += UpdateTime; - - EditorApplication.update += UpdateNodePreviewListAndTime; - - - if( CurrentSelection == ASESelectionMode.ShaderFunction ) - { - IsShaderFunctionWindow = true; - } - else - { - IsShaderFunctionWindow = false; - } - - m_optionsWindow = new OptionsWindow( this ); - m_optionsWindow.Init(); - - m_contextMenu = new GraphContextMenu( m_mainGraphInstance ); - m_nodesLoadedCorrectly = m_contextMenu.CorrectlyLoaded; - - m_paletteWindow = new PaletteWindow( this ) - { - Resizable = true - }; - m_paletteWindow.OnPaletteNodeCreateEvt += OnPaletteNodeCreate; - m_registeredMenus.Add( m_paletteWindow ); - - m_contextPalette = new ContextPalette( this ); - m_contextPalette.OnPaletteNodeCreateEvt += OnContextPaletteNodeCreate; - m_registeredMenus.Add( m_contextPalette ); - - m_genericMessageUI = new GenericMessageUI(); - m_genericMessageUI.OnMessageDisplayEvent += ShowMessageImmediately; - - Selection.selectionChanged += OnProjectSelectionChanged; -#if UNITY_2018_1_OR_NEWER - EditorApplication.projectChanged += OnProjectWindowChanged; -#else - EditorApplication.projectWindowChanged += OnProjectWindowChanged; -#endif - m_focusOnSelectionTimestamp = EditorApplication.timeSinceStartup; - m_focusOnMasterNodeTimestamp = EditorApplication.timeSinceStartup; - - m_nodeParametersWindow.IsMaximized = m_innerEditorVariables.NodeParametersMaximized; - if( DebugConsoleWindow.UseShaderPanelsInfo ) - m_nodeParametersWindow.IsMaximized = m_nodeParametersWindowMaximized; - - m_paletteWindow.IsMaximized = m_innerEditorVariables.NodePaletteMaximized; - if( DebugConsoleWindow.UseShaderPanelsInfo ) - m_paletteWindow.IsMaximized = m_paletteWindowMaximized; - - m_shortcutManager = new ShortcutsManager(); - // REGISTER NODE SHORTCUTS - foreach( KeyValuePair<KeyCode, ShortcutKeyData> kvp in m_contextMenu.NodeShortcuts ) - { - m_shortcutManager.RegisterNodesShortcuts( kvp.Key, kvp.Value.Name ); - } - - // REGISTER EDITOR SHORTCUTS - - m_shortcutManager.RegisterEditorShortcut( true, EventModifiers.FunctionKey, KeyCode.F1, "Open Selected Node Wiki page", () => - { - List<ParentNode> selectedNodes = m_mainGraphInstance.SelectedNodes; - if( selectedNodes != null && selectedNodes.Count == 1 ) - { - Application.OpenURL( selectedNodes[ 0 ].Attributes.NodeUrl ); - } - } ); - - - m_shortcutManager.RegisterEditorShortcut( true, KeyCode.C, "Create Commentary", () => - { - // Create commentary - ParentNode[] selectedNodes = m_mainGraphInstance.SelectedNodes.ToArray(); - UIUtils.MarkUndoAction(); - Undo.RegisterCompleteObjectUndo( this, "Adding Commentary Node" ); - CommentaryNode node = m_mainGraphInstance.CreateNode( m_commentaryTypeNode, true, -1, false ) as CommentaryNode; - node.CreateFromSelectedNodes( TranformedMousePos, selectedNodes ); - node.Focus(); - m_mainGraphInstance.DeSelectAll(); - m_mainGraphInstance.SelectNode( node, false, false ); - SetSaveIsDirty(); - ForceRepaint(); - } ); - - - m_shortcutManager.RegisterEditorShortcut( true, KeyCode.F, "Focus On Selection", () => - { - OnToolButtonPressed( ToolButtonType.FocusOnSelection ); - ForceRepaint(); - } ); - - //m_shortcutManager.RegisterEditorShortcut( true, EventModifiers.None, KeyCode.B, "New Master Node", () => - //{ - // OnToolButtonPressed( ToolButtonType.MasterNode ); - // ForceRepaint(); - //} ); - - m_shortcutManager.RegisterEditorShortcut( true, EventModifiers.None, KeyCode.Space, "Open Node Palette", null, () => - { - m_contextPalette.Show( m_currentMousePos2D, m_cameraInfo ); - } ); - - - m_shortcutManager.RegisterEditorShortcut( true, KeyCode.W, "Toggle Colored Line Mode", () => - { - m_optionsWindow.ColoredPorts = !m_optionsWindow.ColoredPorts; - ForceRepaint(); - - } ); - - m_shortcutManager.RegisterEditorShortcut( true, EventModifiers.Control, KeyCode.W, "Toggle Multi-Line Mode", () => - { - m_optionsWindow.MultiLinePorts = !m_optionsWindow.MultiLinePorts; - ForceRepaint(); - } ); - - m_shortcutManager.RegisterEditorShortcut( true, KeyCode.P, "Global Preview", () => - { - GlobalPreview = !GlobalPreview; - EditorPrefs.SetBool( "GlobalPreview", GlobalPreview ); - - ForceRepaint(); - } ); - - GlobalShowInternalData = EditorPrefs.GetBool( "ASEGlobalShowInternalData", true ); - m_shortcutManager.RegisterEditorShortcut( true, KeyCode.I, "Global Show Internal Data", () => - { - GlobalShowInternalData = !GlobalShowInternalData; - EditorPrefs.SetBool( "ASEGlobalShowInternalData", GlobalShowInternalData ); - ForceRepaint(); - } ); - - m_shortcutManager.RegisterEditorShortcut( true, EventModifiers.FunctionKey, KeyCode.Delete, "Delete selected nodes", DeleteSelectedNodeWithRepaint ); - m_shortcutManager.RegisterEditorShortcut( true, EventModifiers.FunctionKey, KeyCode.Backspace, "Delete selected nodes", DeleteSelectedNodeWithRepaint ); - - m_liveShaderEditing = m_innerEditorVariables.LiveMode; - - UpdateLiveUI(); - } - - - public AmplifyShaderEditorWindow() - { - m_minNodePos = new Vector2( float.MaxValue, float.MaxValue ); - m_maxNodePos = new Vector2( float.MinValue, float.MinValue ); - - m_duplicatePreventionBuffer = new DuplicatePreventionBuffer(); - m_commentaryTypeNode = typeof( CommentaryNode ); - titleContent = new GUIContent( "Shader Editor" ); - autoRepaintOnSceneChange = true; - - m_currentMousePos = new Vector3( 0, 0, 0 ); - m_keyEvtMousePos2D = new Vector2( 0, 0 ); - m_multipleSelectionStart = new Vector2( 0, 0 ); - m_initialized = false; - m_graphBgTexture = null; - m_graphFgTexture = null; - - m_cameraOffset = new Vector2( 0, 0 ); - CameraZoom = 1; - - m_registeredMenus = new List<MenuParent>(); - - m_nodeParametersWindow = new NodeParametersWindow( this ) - { - Resizable = true - }; - m_registeredMenus.Add( m_nodeParametersWindow ); - - m_modeWindow = new ShaderEditorModeWindow( this ); - //_registeredMenus.Add( _modeWindow ); - - m_toolsWindow = new ToolsWindow( this ); - m_toolsWindow.ToolButtonPressedEvt += OnToolButtonPressed; - - m_consoleLogWindow = new ConsoleLogWindow( this ); - - m_tipsWindow = new TipsWindow( this ); - - m_registeredMenus.Add( m_toolsWindow ); - //m_registeredMenus.Add( m_consoleLogWindow ); - - m_palettePopup = new PalettePopUp(); - - m_clipboard = new Clipboard(); - - m_genericMessageContent = new GUIContent(); - m_dragAndDropTool = new DragAndDropTool(); - m_dragAndDropTool.OnValidDropObjectEvt += OnValidObjectsDropped; - - //_confirmationWindow = new ConfirmationWindow( 100, 100, 300, 100 ); - - m_saveIsDirty = false; - - m_preMadeShaders = new PreMadeShaders(); - - Undo.undoRedoPerformed += UndoRedoPerformed; - - float autoPanSpeed = 2; - m_autoPanArea = new AutoPanData[ 4 ]; - m_autoPanArea[ 0 ] = new AutoPanData( AutoPanLocation.TOP, 25, autoPanSpeed * Vector2.up ); - m_autoPanArea[ 1 ] = new AutoPanData( AutoPanLocation.BOTTOM, 25, autoPanSpeed * Vector2.down ); - m_autoPanArea[ 2 ] = new AutoPanData( AutoPanLocation.LEFT, 25, autoPanSpeed * Vector2.right ); - m_autoPanArea[ 3 ] = new AutoPanData( AutoPanLocation.RIGHT, 25, autoPanSpeed * Vector2.left ); - - m_drawInfo = new DrawInfo(); - UIUtils.CurrentWindow = this; - - m_nodeExporterUtils = new NodeExporterUtils( this ); - m_repaintIsDirty = false; - m_initialized = false; - } - - public void SetStandardShader() - { - m_mainGraphInstance.ReplaceMasterNode( AvailableShaderTypes.SurfaceShader ); - m_mainGraphInstance.FireMasterNodeReplacedEvent(); - } - - public void SetTemplateShader( string templateName, bool writeDefaultData ) - { - TemplateDataParent templateData = m_templatesManager.GetTemplate( ( string.IsNullOrEmpty( templateName ) ? "6e114a916ca3e4b4bb51972669d463bf" : templateName ) ); - m_mainGraphInstance.ReplaceMasterNode( AvailableShaderTypes.Template, writeDefaultData, templateData ); - } - - public void DeleteSelectedNodeWithRepaint() - { - DeleteSelectedNodes(); - SetSaveIsDirty(); - } - - - void UndoRedoPerformed() - { - m_repaintIsDirty = true; - m_saveIsDirty = true; - m_removedKeyboardFocus = true; - m_refreshOnUndo = true; - } - - void Destroy() - { - Undo.ClearUndo( this ); - - m_initialized = false; - - m_nodeExporterUtils.Destroy(); - m_nodeExporterUtils = null; - - m_delayedMaterialSet = null; - - m_materialsToUpdate.Clear(); - m_materialsToUpdate = null; - - GLDraw.Destroy(); - - UIUtils.Destroy(); - m_preMadeShaders.Destroy(); - m_preMadeShaders = null; - - m_registeredMenus.Clear(); - m_registeredMenus = null; - - m_mainGraphInstance.Destroy(); - ScriptableObject.DestroyImmediate( m_mainGraphInstance ); - m_mainGraphInstance = null; - - Resources.UnloadAsset( m_graphBgTexture ); - m_graphBgTexture = null; - - Resources.UnloadAsset( m_graphFgTexture ); - m_graphFgTexture = null; - - Resources.UnloadAsset( m_wireTexture ); - m_wireTexture = null; - - m_contextMenu.Destroy(); - m_contextMenu = null; - - m_shortcutManager.Destroy(); - m_shortcutManager = null; - - m_nodeParametersWindow.Destroy(); - m_nodeParametersWindow = null; - - - m_modeWindow.Destroy(); - m_modeWindow = null; - - m_toolsWindow.Destroy(); - m_toolsWindow = null; - - m_consoleLogWindow.Destroy(); - m_consoleLogWindow = null; - - m_tipsWindow.Destroy(); - m_tipsWindow = null; - - m_optionsWindow.Destroy(); - m_optionsWindow = null; - - m_paletteWindow.Destroy(); - m_paletteWindow = null; - - m_palettePopup.Destroy(); - m_palettePopup = null; - - m_contextPalette.Destroy(); - m_contextPalette = null; - - m_clipboard.ClearClipboard(); - m_clipboard = null; - - m_genericMessageUI.Destroy(); - m_genericMessageUI = null; - m_genericMessageContent = null; - - m_dragAndDropTool.Destroy(); - m_dragAndDropTool = null; - - m_openedShaderFunction = null; - - UIUtils.CurrentWindow = null; - m_duplicatePreventionBuffer.ReleaseAllData(); - m_duplicatePreventionBuffer = null; -#if UNITY_2018_1_OR_NEWER - EditorApplication.projectChanged -= OnProjectWindowChanged; -#else - EditorApplication.projectWindowChanged -= OnProjectWindowChanged; -#endif - Selection.selectionChanged -= OnProjectSelectionChanged; - - IOUtils.AllOpenedWindows.Remove( this ); - - if( IOUtils.AllOpenedWindows.Count == 0 ) - { - m_templatesManager.Destroy(); - ScriptableObject.DestroyImmediate( m_templatesManager ); - } - m_templatesManager = null; - - IOUtils.Destroy(); - - Resources.UnloadUnusedAssets(); - GC.Collect(); - } - - void Init() - { - // = AssetDatabase.LoadAssetAtPath( Constants.ASEPath + "", typeof( Texture2D ) ) as Texture2D; - m_graphBgTexture = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( IOUtils.GraphBgTextureGUID ), typeof( Texture2D ) ) as Texture2D; - if( m_graphBgTexture != null ) - { - m_graphFgTexture = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( IOUtils.GraphFgTextureGUID ), typeof( Texture2D ) ) as Texture2D; - - //Setup usable area - m_cameraInfo = position; - m_graphArea = new Rect( 0, 0, m_cameraInfo.width, m_cameraInfo.height ); - - // Creating style state to show current selected object - m_graphFontStyle = new GUIStyle() - { - fontSize = 32, - alignment = TextAnchor.MiddleCenter, - fixedWidth = m_cameraInfo.width, - fixedHeight = 50, - stretchWidth = true, - stretchHeight = true - }; - m_graphFontStyle.normal.textColor = Color.white; - - m_wireTexture = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( IOUtils.WireTextureGUID ), typeof( Texture2D ) ) as Texture2D; - - m_initialized = m_graphBgTexture != null && - m_graphFgTexture != null && - m_wireTexture != null; - } - } -#if UNITY_2018_3_OR_NEWER - - -#endif - [OnOpenAssetAttribute()] - static bool OnOpenAsset( int instanceID, int line ) - { - if( line > -1 ) - { - return false; - } - Preferences.LoadDefaults(); -#if UNITY_2018_3_OR_NEWER - ASEPackageManagerHelper.RequestInfo(); - ASEPackageManagerHelper.Update(); - if( ASEPackageManagerHelper.IsProcessing ) - { - Shader selectedShader = Selection.activeObject as Shader; - if( selectedShader != null ) - { - if( IOUtils.IsASEShader( selectedShader ) ) - { - ASEPackageManagerHelper.SetupLateShader( selectedShader ); - return true; - } - } - else - { - Material mat = Selection.activeObject as Material; - if( mat != null ) - { - if( IOUtils.IsASEShader( mat.shader ) ) - { - ASEPackageManagerHelper.SetupLateMaterial( mat ); - return true; - } - } - else - { - AmplifyShaderFunction shaderFunction = Selection.activeObject as AmplifyShaderFunction; - if( shaderFunction != null ) - { - if( IOUtils.IsShaderFunction( shaderFunction.FunctionInfo ) ) - { - ASEPackageManagerHelper.SetupLateShaderFunction( shaderFunction ); - return true; - } - } - } - } - } - else -#endif - { - Shader selectedShader = Selection.activeObject as Shader; - if( selectedShader != null ) - { - if( IOUtils.IsASEShader( selectedShader ) ) - { - ConvertShaderToASE( selectedShader ); - return true; - } - } - else - { - Material mat = Selection.activeObject as Material; - if( mat != null ) - { - if( IOUtils.IsASEShader( mat.shader ) ) - { - LoadMaterialToASE( mat ); - return true; - } - } - else - { - AmplifyShaderFunction shaderFunction = Selection.activeObject as AmplifyShaderFunction; - if( shaderFunction != null ) - { - if( IOUtils.IsShaderFunction( shaderFunction.FunctionInfo ) ) - { - LoadShaderFunctionToASE( shaderFunction, false ); - return true; - } - } - } - } - } - - return false; - } - - [MenuItem( "Assets/Create/Amplify Shader/Surface", false, 84 )] - [MenuItem( "Assets/Create/Shader/Amplify Surface Shader" )] - static void CreateConfirmationStandardShader() - { - string path = AssetDatabase.GetAssetPath( Selection.activeObject ); - if( path == "" ) - { - path = "Assets"; - } - else if( System.IO.Path.GetExtension( path ) != "" ) - { - path = path.Replace( System.IO.Path.GetFileName( AssetDatabase.GetAssetPath( Selection.activeObject ) ), "" ); - } - - string assetPathAndName = AssetDatabase.GenerateUniqueAssetPath( path + "/New Amplify Shader.shader" ); - var endNameEditAction = ScriptableObject.CreateInstance<DoCreateStandardShader>(); - ProjectWindowUtil.StartNameEditingIfProjectWindowExists( 0, endNameEditAction, assetPathAndName, AssetPreview.GetMiniTypeThumbnail( typeof( Shader ) ), null ); - } - //static void CreateNewShader( ) - //{ - // CreateNewShader( null, null ); - //} - - static void CreateNewShader( string customPath , string customShaderName ) - { - - string path = string.Empty; - if( string.IsNullOrEmpty( customPath ) ) - { - if( Selection.activeObject != null ) - { - path = ( IOUtils.dataPath + AssetDatabase.GetAssetPath( Selection.activeObject ) ); - } - else - { - UnityEngine.Object[] selection = Selection.GetFiltered( typeof( UnityEngine.Object ), SelectionMode.DeepAssets ); - if( selection.Length > 0 && selection[ 0 ] != null ) - { - path = ( IOUtils.dataPath + AssetDatabase.GetAssetPath( selection[ 0 ] ) ); - } - else - { - path = Application.dataPath; - } - - } - - if( path.IndexOf( '.' ) > -1 ) - { - path = path.Substring( 0, path.LastIndexOf( '/' ) ); - } - path += "/"; - } - else - { - path = customPath; - } - - if( IOUtils.AllOpenedWindows.Count > 0 ) - { - EditorWindow openedWindow = AmplifyShaderEditorWindow.GetWindow<AmplifyShaderEditorWindow>(); - AmplifyShaderEditorWindow currentWindow = CreateTab(); - WindowHelper.AddTab( openedWindow, currentWindow ); - UIUtils.CurrentWindow = currentWindow; - Shader shader = UIUtils.CreateNewEmpty( path, customShaderName ); - Selection.activeObject = shader; - } - else - { - AmplifyShaderEditorWindow currentWindow = OpenWindow(); - UIUtils.CurrentWindow = currentWindow; - Shader shader = UIUtils.CreateNewEmpty( path, customShaderName ); - Selection.activeObject = shader; - } - //Selection.objects = new UnityEngine.Object[] { shader }; - } - - public static void CreateConfirmationTemplateShader( string templateGuid ) - { - UIUtils.NewTemplateGUID = templateGuid; - string path = AssetDatabase.GetAssetPath( Selection.activeObject ); - if( path == "" ) - { - path = "Assets"; - } - else if( System.IO.Path.GetExtension( path ) != "" ) - { - path = path.Replace( System.IO.Path.GetFileName( AssetDatabase.GetAssetPath( Selection.activeObject ) ), "" ); - } - - string assetPathAndName = AssetDatabase.GenerateUniqueAssetPath( path + "/New Amplify Shader.shader" ); - var endNameEditAction = ScriptableObject.CreateInstance<DoCreateTemplateShader>(); - ProjectWindowUtil.StartNameEditingIfProjectWindowExists( 0, endNameEditAction, assetPathAndName, AssetPreview.GetMiniTypeThumbnail( typeof( Shader ) ), null ); - } - - public static Shader CreateNewTemplateShader( string templateGUID , string customPath = null, string customShaderName = null ) - { - string path = string.Empty; - if( string.IsNullOrEmpty( customPath ) ) - { - path = Selection.activeObject == null ? Application.dataPath : ( IOUtils.dataPath + AssetDatabase.GetAssetPath( Selection.activeObject ) ); - if( path.IndexOf( '.' ) > -1 ) - { - path = path.Substring( 0, path.LastIndexOf( '/' ) ); - } - path += "/"; - } - else - { - path = customPath; - } - Shader shader = null; - if( IOUtils.AllOpenedWindows.Count > 0 ) - { - EditorWindow openedWindow = AmplifyShaderEditorWindow.GetWindow<AmplifyShaderEditorWindow>(); - AmplifyShaderEditorWindow currentWindow = CreateTab(); - WindowHelper.AddTab( openedWindow, currentWindow ); - UIUtils.CurrentWindow = currentWindow; - shader = UIUtils.CreateNewEmptyTemplate( templateGUID, path, customShaderName ); - Selection.activeObject = shader; - } - else - { - AmplifyShaderEditorWindow currentWindow = OpenWindow(); - UIUtils.CurrentWindow = currentWindow; - shader = UIUtils.CreateNewEmptyTemplate( templateGUID, path, customShaderName ); - Selection.activeObject = shader; - } - - //Selection.objects = new UnityEngine.Object[] { shader }; - return shader; - } - - [MenuItem( "Assets/Create/Amplify Shader Function", false, 84 )] - [MenuItem( "Assets/Create/Shader/Amplify Shader Function" )] - static void CreateNewShaderFunction() - { - AmplifyShaderFunction asset = ScriptableObject.CreateInstance<AmplifyShaderFunction>(); - - string path = AssetDatabase.GetAssetPath( Selection.activeObject ); - if( path == "" ) - { - path = "Assets"; - } - else if( System.IO.Path.GetExtension( path ) != "" ) - { - path = path.Replace( System.IO.Path.GetFileName( AssetDatabase.GetAssetPath( Selection.activeObject ) ), "" ); - } - - string assetPathAndName = AssetDatabase.GenerateUniqueAssetPath( path + "/New ShaderFunction.asset" ); - - var endNameEditAction = ScriptableObject.CreateInstance<DoCreateFunction>(); - ProjectWindowUtil.StartNameEditingIfProjectWindowExists( asset.GetInstanceID(), endNameEditAction, assetPathAndName, AssetPreview.GetMiniThumbnail( asset ), null ); - } - - public void UpdateTabTitle( string newTitle, bool modified ) - { - string[] titleArray = newTitle.Split( '/' ); - newTitle = titleArray[ titleArray.Length - 1 ]; - - if( !( m_currentTitle.Equals( newTitle ) && m_currentTitleMod == modified ) ) - { - this.titleContent.text = GenerateTabTitle( newTitle, modified ); - } - m_currentTitle = newTitle; - m_currentTitleMod = modified; - } - - public void OnProjectWindowChanged() - { - Shader selectedShader = Selection.activeObject as Shader; - if( selectedShader != null ) - { - if( m_mainGraphInstance != null && m_mainGraphInstance.CurrentMasterNode != null && selectedShader == m_mainGraphInstance.CurrentMasterNode.CurrentShader ) - { - m_lastOpenedLocation = AssetDatabase.GetAssetPath( selectedShader ); - } - } - } - - public void LoadProjectSelected( UnityEngine.Object selectedObject = null ) - { - bool hasFocus = true; - if( EditorWindow.focusedWindow != this ) - { - hasFocus = false; - } - - if( hasFocus && m_mainGraphInstance != null && m_mainGraphInstance.CurrentMasterNode != null ) - { - LoadObject( selectedObject ?? Selection.activeObject ); - } - else - { - m_delayedLoadObject = selectedObject ?? Selection.activeObject; - } - - if( !hasFocus ) - Focus(); - } - - public void LoadObject( UnityEngine.Object objToLoad ) - { - Shader selectedShader = objToLoad as Shader; - Material selectedMaterial = objToLoad as Material; - AmplifyShaderFunction selectedFunction = objToLoad as AmplifyShaderFunction; - - if( selectedFunction != null ) - { - IsShaderFunctionWindow = true; - m_mainGraphInstance.CurrentCanvasMode = NodeAvailability.ShaderFunction; - } - else - { - IsShaderFunctionWindow = false; - } - - ASESelectionMode selectedFileType = ASESelectionMode.Shader; - if( selectedShader != null ) - { - selectedFileType = ASESelectionMode.Shader; - } - else if( selectedMaterial != null ) - { - selectedFileType = ASESelectionMode.Material; - } - else if( selectedFunction != null ) - { - selectedFileType = ASESelectionMode.ShaderFunction; - } - - - switch( CurrentSelection ) - { - case ASESelectionMode.Shader: - { - if( ShaderIsModified ) - { - Shader currShader = m_mainGraphInstance.CurrentMasterNode.CurrentShader; - bool savePrevious = UIUtils.DisplayDialog( AssetDatabase.GetAssetPath( currShader ) ); - OnSaveShader( savePrevious, currShader, null, null ); - } - } - break; - case ASESelectionMode.Material: - { - if( ShaderIsModified ) - { - Shader currShader = m_mainGraphInstance.CurrentMasterNode.CurrentShader; - bool savePrevious = UIUtils.DisplayDialog( AssetDatabase.GetAssetPath( currShader ) ); - OnSaveShader( savePrevious, currShader, m_mainGraphInstance.CurrentMasterNode.CurrentMaterial, null ); - } - } - break; - case ASESelectionMode.ShaderFunction: - { - if( ShaderIsModified ) - { - bool savePrevious = UIUtils.DisplayDialog( AssetDatabase.GetAssetPath( m_openedShaderFunction ) ); - OnSaveShader( savePrevious, null, null, selectedFunction ); - } - } - break; - } - - switch( selectedFileType ) - { - case ASESelectionMode.Shader: - { - LoadDroppedObject( true, selectedShader, null ); - } - break; - case ASESelectionMode.Material: - { - LoadDroppedObject( true, selectedMaterial.shader, selectedMaterial ); - } - break; - case ASESelectionMode.ShaderFunction: - { - LoadDroppedObject( true, null, null, selectedFunction ); - } - break; - } - - m_openedShaderFunction = m_mainGraphInstance.CurrentShaderFunction; - - //Need to force one graph draw because it wont call OnGui propertly since its focuses somewhere else - // Focus() doesn't fix this since it only changes keyboard focus - m_drawInfo.InvertedZoom = 1 / m_cameraZoom; - m_mainGraphInstance.Draw( m_drawInfo ); - - ShaderIsModified = false; - Focus(); - Repaint(); - } - - public void OnProjectSelectionChanged() - { - if( m_loadShaderOnSelection ) - { - LoadProjectSelected(); - } - } - - ShaderLoadResult OnSaveShader( bool value, Shader shader, Material material, AmplifyShaderFunction function ) - { - if( value ) - { - SaveToDisk( false ); - } - - return value ? ShaderLoadResult.LOADED : ShaderLoadResult.FILE_NOT_FOUND; - } - - public void ResetCameraSettings() - { - m_cameraInfo = position; - m_cameraOffset = new Vector2( m_cameraInfo.width * 0.5f, m_cameraInfo.height * 0.5f ); - CameraZoom = 1; - } - - public void Reset() - { - if( m_mainGraphInstance == null ) - { - m_mainGraphInstance = CreateInstance<ParentGraph>(); - m_mainGraphInstance.Init(); - m_mainGraphInstance.ParentWindow = this; - m_mainGraphInstance.SetGraphId( 0 ); - } - m_mainGraphInstance.ResetEvents(); - m_mainGraphInstance.OnNodeEvent += OnNodeStoppedMovingEvent; - m_mainGraphInstance.OnMaterialUpdatedEvent += OnMaterialUpdated; - m_mainGraphInstance.OnShaderUpdatedEvent += OnShaderUpdated; - m_mainGraphInstance.OnEmptyGraphDetectedEvt += OnEmptyGraphDetected; - m_mainGraphInstance.OnNodeRemovedEvent += m_toolsWindow.OnNodeRemovedFromGraph; - m_outdatedShaderFromTemplateLoaded = false; - GraphCount = 1; - - FullCleanUndoStack(); - m_performFullUndoRegister = true; - m_toolsWindow.BorderStyle = null; - m_selectionMode = ASESelectionMode.Shader; - ResetCameraSettings(); - UIUtils.ResetMainSkin(); - m_duplicatePreventionBuffer.ReleaseAllData(); - if( m_genericMessageUI != null ) - m_genericMessageUI.CleanUpMessageStack(); - } - - - public Shader CreateNewGraph( string name ) - { - Reset(); - UIUtils.DirtyMask = false; - m_mainGraphInstance.CreateNewEmpty( name ); - m_lastOpenedLocation = string.Empty; - UIUtils.DirtyMask = true; - return m_mainGraphInstance.CurrentMasterNode.CurrentShader; - } - - public Shader CreateNewTemplateGraph( string templateGUID ) - { - Reset(); - UIUtils.DirtyMask = false; - m_mainGraphInstance.CreateNewEmptyTemplate( templateGUID ); - m_lastOpenedLocation = string.Empty; - UIUtils.DirtyMask = true; - return m_mainGraphInstance.CurrentMasterNode.CurrentShader; - } - - public Shader CreateNewGraph( Shader shader ) - { - Reset(); - UIUtils.DirtyMask = false; - m_mainGraphInstance.CreateNewEmpty( shader.name ); - m_mainGraphInstance.CurrentMasterNode.CurrentShader = shader; - - m_lastOpenedLocation = string.Empty; - UIUtils.DirtyMask = true; - return m_mainGraphInstance.CurrentMasterNode.CurrentShader; - } - - public void CreateNewFunctionGraph( AmplifyShaderFunction shaderFunction ) - { - Reset(); - UIUtils.DirtyMask = false; - m_mainGraphInstance.CreateNewEmptyFunction( shaderFunction ); - m_mainGraphInstance.CurrentShaderFunction = shaderFunction; - - m_lastOpenedLocation = AssetDatabase.GetAssetPath( shaderFunction ); //string.Empty; - UIUtils.DirtyMask = true; - //return m_mainGraphInstance.CurrentMasterNode.CurrentShader; - } - - public bool SaveToDisk( bool checkTimestamp ) - { - if( checkTimestamp ) - { - if( !m_cacheSaveOp ) - { - m_lastTimeSaved = EditorApplication.timeSinceStartup; - m_cacheSaveOp = true; - } - return false; - } - - - System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture; - - m_customGraph = null; - m_cacheSaveOp = false; - ShaderIsModified = false; - m_mainGraphInstance.LoadedShaderVersion = VersionInfo.FullNumber; - m_lastTimeSaved = EditorApplication.timeSinceStartup; - - if( m_mainGraphInstance.CurrentMasterNodeId == Constants.INVALID_NODE_ID ) - { - Shader currentShader = m_mainGraphInstance.CurrentMasterNode != null ? m_mainGraphInstance.CurrentMasterNode.CurrentShader : null; - string newShader; - if( !String.IsNullOrEmpty( m_lastOpenedLocation ) ) - { - newShader = m_lastOpenedLocation; - } - else if( currentShader != null ) - { - newShader = AssetDatabase.GetAssetPath( currentShader ); - } - else - { - newShader = EditorUtility.SaveFilePanel( "Select Shader to save", Application.dataPath, "MyShader", "shader" ); - } - - if( !String.IsNullOrEmpty( newShader ) ) - { - ShowMessage( "No Master node assigned.\nShader file will only have node info" ); - IOUtils.StartSaveThread( GenerateGraphInfo(), newShader ); - AssetDatabase.Refresh(); - LoadFromDisk( newShader ); - System.Threading.Thread.CurrentThread.CurrentCulture = System.Threading.Thread.CurrentThread.CurrentUICulture; - return true; - } - } - else if( m_mainGraphInstance.CurrentMasterNode != null ) - { - //m_mainGraphInstance.CurrentStandardSurface.ForceReordering(); - Shader currShader = m_mainGraphInstance.CurrentMasterNode.CurrentShader; - if( currShader != null ) - { - m_mainGraphInstance.FireMasterNode( currShader ); - Material material = m_mainGraphInstance.CurrentMaterial; - m_lastpath = ( material != null ) ? AssetDatabase.GetAssetPath( material ) : AssetDatabase.GetAssetPath( currShader ); - EditorPrefs.SetString( IOUtils.LAST_OPENED_OBJ_ID, m_lastpath ); - System.Threading.Thread.CurrentThread.CurrentCulture = System.Threading.Thread.CurrentThread.CurrentUICulture; - if( IOUtils.OnShaderSavedEvent != null ) - { - string info = string.Empty; - if( !m_mainGraphInstance.IsStandardSurface ) - { - TemplateMultiPassMasterNode masterNode = m_mainGraphInstance.GetMainMasterNodeOfLOD( -1 ); - if( masterNode != null ) - { - info = masterNode.CurrentTemplate.GUID; - } - } - IOUtils.OnShaderSavedEvent( currShader, !m_mainGraphInstance.IsStandardSurface, info ); - } - return true; - } - else - { - - string shaderName; - string pathName; - IOUtils.GetShaderName( out shaderName, out pathName, Constants.DefaultShaderName, UIUtils.LatestOpenedFolder ); - if( !String.IsNullOrEmpty( pathName ) ) - { - UIUtils.CurrentWindow.CurrentGraph.CurrentMasterNode.SetName( shaderName ); - m_mainGraphInstance.FireMasterNode( pathName, true ); - m_lastpath = pathName; - EditorPrefs.SetString( IOUtils.LAST_OPENED_OBJ_ID, pathName ); - System.Threading.Thread.CurrentThread.CurrentCulture = System.Threading.Thread.CurrentThread.CurrentUICulture; - return true; - } - } - } - else - { - //m_nodeParametersWindow.ForceReordering(); - m_mainGraphInstance.ResetNodesLocalVariables(); - - List<FunctionInput> functionInputNodes = UIUtils.FunctionInputList(); - functionInputNodes.Sort( ( x, y ) => { return x.OrderIndex.CompareTo( y.OrderIndex ); } ); - for( int i = 0; i < functionInputNodes.Count; i++ ) - { - functionInputNodes[ i ].OrderIndex = i; - } - - List<FunctionOutput> functionOutputNodes = UIUtils.FunctionOutputList(); - functionOutputNodes.Sort( ( x, y ) => { return x.OrderIndex.CompareTo( y.OrderIndex ); } ); - for( int i = 0; i < functionOutputNodes.Count; i++ ) - { - functionOutputNodes[ i ].OrderIndex = i; - } - - m_mainGraphInstance.CurrentShaderFunction.AdditionalDirectives.UpdateSaveItemsFromDirectives(); - m_mainGraphInstance.CurrentShaderFunction.FunctionInfo = GenerateGraphInfo(); - m_mainGraphInstance.CurrentShaderFunction.FunctionInfo = IOUtils.AddAdditionalInfo( m_mainGraphInstance.CurrentShaderFunction.FunctionInfo ); - - if( AssetDatabase.IsMainAsset( m_mainGraphInstance.CurrentShaderFunction ) ) - { - EditorUtility.SetDirty( m_mainGraphInstance.CurrentShaderFunction ); - } - else - { - //Debug.Log( LastOpenedLocation ); - //AssetDatabase.CreateAsset( m_mainGraphInstance.CurrentShaderFunction, LastOpenedLocation ); - } - - AssetDatabase.SaveAssets(); - AssetDatabase.Refresh(); - m_mainGraphInstance.CurrentShaderFunction.AdditionalDirectives.UpdateDirectivesFromSaveItems(); - IOUtils.FunctionNodeChanged = true; - m_lastpath = AssetDatabase.GetAssetPath( m_mainGraphInstance.CurrentShaderFunction ); - System.Threading.Thread.CurrentThread.CurrentCulture = System.Threading.Thread.CurrentThread.CurrentUICulture; - //EditorPrefs.SetString( IOUtils.LAST_OPENED_OBJ_ID, AssetDatabase.GetAssetPath( m_mainGraphInstance.CurrentShaderFunction ) ); - return true; - } - System.Threading.Thread.CurrentThread.CurrentCulture = System.Threading.Thread.CurrentThread.CurrentUICulture; - return false; - } - - public void OnToolButtonPressed( ToolButtonType type ) - { - switch( type ) - { - case ToolButtonType.New: - { - UIUtils.CreateNewEmpty(); - } - break; - case ToolButtonType.Open: - { - UIUtils.OpenFile(); - } - break; - case ToolButtonType.Save: - { - SaveToDisk( false ); - } - break; - case ToolButtonType.Library: - { - ShowShaderLibrary(); - } - break; - case ToolButtonType.Options: { } break; - case ToolButtonType.Update: - { - SaveToDisk( false ); - } - break; - case ToolButtonType.Live: - { - m_liveShaderEditing = !m_liveShaderEditing; - m_innerEditorVariables.LiveMode = m_liveShaderEditing; - // 0 off - // 1 on - // 2 pending - if( m_liveShaderEditing && m_mainGraphInstance.CurrentMasterNode != null && m_mainGraphInstance.CurrentMasterNode.CurrentShader == null ) - { - m_liveShaderEditing = false; - m_innerEditorVariables.LiveMode = false; - } - - UpdateLiveUI(); - - if( m_liveShaderEditing ) - { - SaveToDisk( false ); - } - } - break; - case ToolButtonType.OpenSourceCode: - { - AssetDatabase.OpenAsset( m_mainGraphInstance.CurrentMasterNode.CurrentShader, 1 ); - } - break; - case ToolButtonType.MasterNode: - { - m_mainGraphInstance.AssignMasterNode(); - } - break; - - case ToolButtonType.FocusOnMasterNode: - { - double currTime = EditorApplication.timeSinceStartup; - bool autoZoom = ( currTime - m_focusOnMasterNodeTimestamp ) < AutoZoomTime; - m_focusOnMasterNodeTimestamp = currTime; - FocusOnNode( m_mainGraphInstance.CurrentMasterNode, autoZoom ? 1 : m_cameraZoom, true ); - } - break; - - case ToolButtonType.FocusOnSelection: - { - FocusZoom( false, true, true ); - } - break; - case ToolButtonType.ShowInfoWindow: - { - PortLegendInfo.OpenWindow(); - } - break; - case ToolButtonType.ShowTipsWindow: - { - TipsWindow.ShowWindow( true ); - } - break; - case ToolButtonType.ShowConsole: - { - m_consoleLogWindow.Toggle(); - } - break; - case ToolButtonType.Share: - { - List<ParentNode> selectedNodes = m_mainGraphInstance.SelectedNodes; - if( selectedNodes.Count > 0 ) - { - CopyToClipboard(); - StartPasteRequest(); - } - else - { - ShowMessage( "No nodes selected to share" ); - } - } - break; - case ToolButtonType.TakeScreenshot: - { -#if UNITY_EDITOR_WIN - this.Focus(); - m_aseHandle = WindowsUtil.GetActiveWindow(); - //m_aseHandle = FindASEWindowHandle(); - - bool takeit = EditorUtility.DisplayDialog( "Take Screenshot", "This is a work in progress feature that will undock itself if needed, increase the window outside of your screen resolution to take the shot, if something fails (ie: graph too big) you may need to restart Unity, do you wish to continue?", "Yes", "Cancel" ); - if( !takeit ) - break; - - if( this.IsDocked() ) - { - this.Undock(); - this.Focus(); - m_aseHandle = WindowsUtil.GetActiveWindow(); - } - - int windowLong = WindowsUtil.GetWindowLong( m_aseHandle, WindowsUtil.GWL_STYLE ); - - List<ParentNode> selectedNodes = m_mainGraphInstance.AllNodes; - - Vector2 minPos = new Vector2( float.MaxValue, float.MaxValue ); - Vector2 maxPos = new Vector2( float.MinValue, float.MinValue ); - Vector2 centroid = Vector2.zero; - - for( int i = 0; i < selectedNodes.Count; i++ ) - { - Rect currPos = selectedNodes[ i ].TruePosition; - minPos.x = ( currPos.x < minPos.x ) ? currPos.x : minPos.x; - minPos.y = ( currPos.y < minPos.y ) ? currPos.y : minPos.y; - - maxPos.x = ( ( currPos.x + currPos.width ) > maxPos.x ) ? ( currPos.x + currPos.width ) : maxPos.x; - maxPos.y = ( ( currPos.y + currPos.height ) > maxPos.y ) ? ( currPos.y + currPos.height ) : maxPos.y; - } - - centroid = ( maxPos - minPos ); - - m_prevCameraOffset = m_cameraOffset; - m_prevCameraZoom = CameraZoom; - - WindowsUtil.SetWindowLong( m_aseHandle, WindowsUtil.GWL_STYLE, (int)( windowLong & ~( WindowsUtil.WS_SIZEBOX ) ) ); - var rect = new WindowsUtil.Rect(); - WindowsUtil.GetWindowRect( m_aseHandle, ref rect ); - m_prevWindowRect = new Rect( rect.Left, rect.Top, rect.Width, rect.Height ); - - WindowsUtil.SetWindowPos( m_aseHandle, 0, (int)m_prevWindowRect.xMin, (int)m_prevWindowRect.yMin, (int)centroid.x, (int)centroid.y, 0x0040 ); - WindowsUtil.SetWindowLong( m_aseHandle, WindowsUtil.GWL_STYLE, (int)( windowLong ) ); - - m_takeScreenShot = true; -#else - EditorUtility.DisplayDialog( "Take Screenshot", "This is a work in progress feature that only works in Windows environment", "Ok" ); -#endif - } - break; - case ToolButtonType.CleanUnusedNodes: - { - m_mainGraphInstance.CleanUnusedNodes(); - } - break; - case ToolButtonType.Help: - { - Application.OpenURL( Constants.HelpURL ); - } - break; - } - } - -#if UNITY_EDITOR_WIN - IntPtr FindASEWindowHandle() - { - System.Diagnostics.Process process = System.Diagnostics.Process.GetCurrentProcess(); - - IntPtr[] winPtrs = WindowsUtil.GetProcessWindows( process.Id ); - m_aseHandle = IntPtr.Zero; - bool found = false; - for( int i = 0; i < winPtrs.Length; i++ ) - { - WindowsUtil.EnumChildWindows( winPtrs[ i ], delegate ( System.IntPtr hwnd, System.IntPtr param ) - { - System.Text.StringBuilder Title = new System.Text.StringBuilder( 256 ); - WindowsUtil.GetWindowText( hwnd, Title, Title.Capacity ); - - if( Title.ToString().Contains( "AmplifyShaderEditor.AmplifyShaderEditorWindow" ) ) - { - if( !found ) - { - m_aseHandle = winPtrs[ i ]; - found = true; - } - } - - return true; - }, System.IntPtr.Zero ); - } - - return m_aseHandle; - } - - void OpenSavedFolder() - { - m_openSavedFolder = false; - - var path = System.IO.Path.GetFullPath( Application.dataPath + "\\..\\ScreenshotASE.png" ); - EditorUtility.RevealInFinder( path ); - GUIUtility.ExitGUI(); - } - - void TakeScreenShot() - { - m_takeScreenShot = false; - - var cacher = RenderTexture.active; - RenderTexture.active = null; - - Texture2D m_screenshotTex2D = new Texture2D( (int)position.width, (int)position.height, TextureFormat.RGB24, false ); - m_screenshotTex2D.ReadPixels( new Rect( 0, 0, m_screenshotTex2D.width, m_screenshotTex2D.height ), 0, 0 ); - m_screenshotTex2D.Apply(); - - byte[] bytes = m_screenshotTex2D.EncodeToPNG(); - - var path = System.IO.Path.GetFullPath( Application.dataPath + "\\..\\ScreenshotASE.png" ); - System.IO.File.WriteAllBytes( path, bytes ); - - RenderTexture.active = cacher; - - ShowMessage( "[AmplifyShaderEditor] Screenshot successfully taken and saved at: " + path, consoleLog:true ); - - WindowsUtil.SetWindowPos( m_aseHandle, 0, (int)m_prevWindowRect.xMin, (int)m_prevWindowRect.yMin, (int)m_prevWindowRect.width, (int)m_prevWindowRect.height, 0x0040 ); - m_cameraOffset = m_prevCameraOffset; - CameraZoom = m_prevCameraZoom; - - m_openSavedFolder = true; - } -#endif - - - void UpdateLiveUI() - { - if( m_toolsWindow != null ) - { - m_toolsWindow.SetStateOnButton( ToolButtonType.Live, ( m_liveShaderEditing ) ? 1 : 0 ); - } - } - - void FocusZoom( bool forceAllNodes, bool doubleTap, bool smooth = true ) - { - List<ParentNode> selectedNodes = ( m_mainGraphInstance.SelectedNodes.Count > 0 ) && !forceAllNodes ? m_mainGraphInstance.SelectedNodes : m_mainGraphInstance.AllNodes; - - Vector2 minPos = new Vector2( float.MaxValue, float.MaxValue ); - Vector2 maxPos = new Vector2( float.MinValue, float.MinValue ); - Vector2 centroid = Vector2.zero; - - for( int i = 0; i < selectedNodes.Count; i++ ) - { - Rect currPos = selectedNodes[ i ].TruePosition; - - minPos.x = ( currPos.x < minPos.x ) ? currPos.x : minPos.x; - minPos.y = ( currPos.y < minPos.y ) ? currPos.y : minPos.y; - - maxPos.x = ( ( currPos.x + currPos.width ) > maxPos.x ) ? ( currPos.x + currPos.width ) : maxPos.x; - maxPos.y = ( ( currPos.y + currPos.height ) > maxPos.y ) ? ( currPos.y + currPos.height ) : maxPos.y; - - } - - centroid = ( maxPos - minPos ); - - double currTime = EditorApplication.timeSinceStartup; - bool autoZoom = ( currTime - m_focusOnSelectionTimestamp ) < AutoZoomTime; - if( !doubleTap ) - autoZoom = true; - m_focusOnSelectionTimestamp = currTime; - - float zoom = m_cameraZoom; - if( autoZoom ) - { - zoom = 1f; - float canvasWidth = m_cameraInfo.width; - if( m_nodeParametersWindow.IsMaximized ) - canvasWidth -= m_nodeParametersWindow.RealWidth; - if( m_paletteWindow.IsMaximized ) - canvasWidth -= m_paletteWindow.RealWidth; - canvasWidth -= 40; - //float canvasWidth = AvailableCanvasWidth;// - 20; - float canvasHeight = AvailableCanvasHeight - 60; - if( centroid.x > canvasWidth || - centroid.y > canvasHeight ) - { - float hZoom = float.MinValue; - float vZoom = float.MinValue; - if( centroid.x > canvasWidth ) - { - hZoom = ( centroid.x ) / canvasWidth; - } - - if( centroid.y > canvasHeight ) - { - vZoom = ( centroid.y ) / canvasHeight; - } - zoom = ( hZoom > vZoom ) ? hZoom : vZoom; - } - } - - minPos.y -= 20 * zoom; - if( m_nodeParametersWindow.IsMaximized ) - minPos.x -= m_nodeParametersWindow.RealWidth * 0.5f * zoom; - if( m_paletteWindow.IsMaximized ) - minPos.x += m_paletteWindow.RealWidth * 0.5f * zoom; - - FocusOnPoint( minPos + centroid * 0.5f, zoom, smooth ); - } - - public void FocusOnNode( int nodeId, float zoom, bool selectNode, bool late = false ) - { - ParentNode node = m_mainGraphInstance.GetNode( nodeId ); - if( node != null ) - { - FocusOnNode( node, zoom, selectNode, late ); - } - } - - public void FocusOnNode( ParentNode node, float zoom, bool selectNode, bool late = false ) - { - if( late ) - { - m_nodeToFocus = node; - m_zoomToFocus = zoom; - m_selectNodeToFocus = selectNode; - return; - } - - if( selectNode ) - { - m_mainGraphInstance.SelectNode( node, false, false ); - } - - Vector2 nodePoint = node.CenterPosition; - nodePoint.x = nodePoint.x - ( m_nodeParametersWindow.RealWidth * 0.5f + m_paletteWindow.RealWidth * 0.5f ) * ( zoom > 0.999f ? zoom : CameraZoom ); - FocusOnPoint( nodePoint, zoom ); - } - - public void FocusOnPoint( Vector2 point, float zoom, bool smooth = true ) - { - if( zoom > 0.999f ) - { - if( smooth ) - SmoothZoom( zoom ); - else - CameraZoom = zoom; - } - - if( smooth ) - SmoothCameraOffset( -point + new Vector2( ( m_cameraInfo.width ) * 0.5f, m_cameraInfo.height * 0.5f ) * CameraZoom ); - else - m_cameraOffset = -point + new Vector2( ( m_cameraInfo.width ) * 0.5f, m_cameraInfo.height * 0.5f ) * CameraZoom; - } - - void SmoothZoom( float newZoom ) - { - m_smoothZoom = true; - m_zoomTime = 0; - m_targetZoom = newZoom; - m_zoomPivot = m_graphArea.center; - } - - void SmoothCameraOffset( Vector2 newOffset ) - { - m_smoothOffset = true; - m_offsetTime = 0; - m_targetOffset = newOffset; - } - - void PreTestLeftMouseDown() - { - if( m_currentEvent.type == EventType.MouseDown && m_currentEvent.button == ButtonClickId.LeftMouseButton ) - { - ParentNode node = m_mainGraphInstance.CheckNodeAt( m_currentMousePos ); - if( node != null ) - { - m_mainGraphInstance.NodeClicked = node.UniqueId; - return; - } - } - - m_mainGraphInstance.NodeClicked = -1; - } - - - - void OnLeftMouseDown() - { - Focus(); - - if( m_lastKeyPressed == KeyCode.Q ) - { - m_rmbStartPos = m_currentMousePos2D; - UseCurrentEvent(); - return; - } - - m_mouseDownOnValidArea = true; - m_lmbPressed = true; - if( m_currentEvent.alt ) - { - m_altBoxSelection = true; - } - - UIUtils.ShowContextOnPick = true; - ParentNode node = ( m_mainGraphInstance.NodeClicked < 0 ) ? m_mainGraphInstance.CheckNodeAt( m_currentMousePos ) : m_mainGraphInstance.GetClickedNode(); - if( node != null ) - { - m_mainGraphInstance.NodeClicked = node.UniqueId; - m_altBoxSelection = false; - - if( m_contextMenu.CheckShortcutKey() ) - { - if( node.ConnStatus == NodeConnectionStatus.Island ) - { - if( !m_multipleSelectionActive ) - { - ParentNode newNode = m_contextMenu.CreateNodeFromShortcutKey(); - if( newNode != null ) - { - newNode.ContainerGraph = m_mainGraphInstance; - newNode.Vec2Position = TranformedMousePos; - m_mainGraphInstance.AddNode( newNode, true ); - m_mainGraphInstance.SelectNode( newNode, false, false ); - ForceRepaint(); - } - ( node as CommentaryNode ).AddNodeToCommentary( newNode ); - } - } - } - else - { - if( node.OnClick( m_currentMousePos2D ) ) - { - if( !node.Selected ) - { - m_mainGraphInstance.SelectNode( node, ( m_currentEvent.modifiers == EventModifiers.Shift || m_currentEvent.modifiers == EventModifiers.Control ), true ); - } - else if( m_currentEvent.modifiers == EventModifiers.Shift || m_currentEvent.modifiers == EventModifiers.Control ) - { - m_mainGraphInstance.DeselectNode( node ); - } - - if( m_currentEvent.alt ) - { - int conn = 0; - for( int i = 0; i < node.InputPorts.Count; i++ ) - { - if( node.InputPorts[ i ].IsConnected ) - conn++; - } - - if( node.InputPorts.Count > 0 && node.OutputPorts.Count > 0 && conn > 0 && node.OutputPorts[ 0 ].IsConnected ) - { - m_altDragStarted = true; - } - } - - } - - if( m_currentEvent.alt ) - { - if( node.InputPorts.Count > 0 && node.OutputPorts.Count > 0 && node.InputPorts[ 0 ].IsConnected && node.OutputPorts[ 0 ].IsConnected ) - { - m_altDragStarted = true; - } - } - - return; - } - } - else if( !m_multipleSelectionActive ) - { - ParentNode newNode = m_contextMenu.CreateNodeFromShortcutKey(); - if( newNode != null ) - { - newNode.ContainerGraph = m_mainGraphInstance; - newNode.Vec2Position = TranformedMousePos; - m_mainGraphInstance.AddNode( newNode, true ); - m_mainGraphInstance.SelectNode( newNode, false, false ); - SetSaveIsDirty(); - ForceRepaint(); - } - else - { - List<WireBezierReference> wireRefs = m_mainGraphInstance.GetWireBezierListInPos( m_currentMousePos2D ); - if( wireRefs != null && wireRefs.Count > 0 ) - { - for( int i = 0; i < wireRefs.Count; i++ ) - { - // Place wire code here - ParentNode outNode = m_mainGraphInstance.GetNode( wireRefs[ i ].OutNodeId ); - ParentNode inNode = m_mainGraphInstance.GetNode( wireRefs[ i ].InNodeId ); - - OutputPort outputPort = outNode.GetOutputPortByUniqueId( wireRefs[ i ].OutPortId ); - InputPort inputPort = inNode.GetInputPortByUniqueId( wireRefs[ i ].InPortId ); - - // Calculate the 4 points for bezier taking into account wire nodes and their automatic tangents - Vector3 endPos = new Vector3( inputPort.Position.x, inputPort.Position.y ); - Vector3 startPos = new Vector3( outputPort.Position.x, outputPort.Position.y ); - - float mag = ( endPos - startPos ).magnitude; - float resizedMag = Mathf.Min( mag, Constants.HORIZONTAL_TANGENT_SIZE * m_drawInfo.InvertedZoom ); - - Vector3 startTangent = new Vector3( startPos.x + resizedMag, startPos.y ); - Vector3 endTangent = new Vector3( endPos.x - resizedMag, endPos.y ); - - if( inNode != null && inNode.GetType() == typeof( WireNode ) ) - endTangent = endPos + ( ( inNode as WireNode ).TangentDirection ) * mag * 0.33f; - - if( outNode != null && outNode.GetType() == typeof( WireNode ) ) - startTangent = startPos - ( ( outNode as WireNode ).TangentDirection ) * mag * 0.33f; - - float dist = HandleUtility.DistancePointBezier( m_currentMousePos, startPos, endPos, startTangent, endTangent ); - if( dist < 10 ) - { - double doubleTapTime = EditorApplication.timeSinceStartup; - bool doubleTap = ( doubleTapTime - m_wiredDoubleTapTimestamp ) < WiredDoubleTapTime; - m_wiredDoubleTapTimestamp = doubleTapTime; - - if( doubleTap ) - { - Undo.RegisterCompleteObjectUndo( this, Constants.UndoCreateConnectionId ); - Undo.RegisterCompleteObjectUndo( m_mainGraphInstance, Constants.UndoCreateConnectionId ); - Undo.RecordObject( outNode, Constants.UndoCreateConnectionId ); - Undo.RecordObject( inNode, Constants.UndoCreateConnectionId ); - - ParentNode wireNode = m_mainGraphInstance.CreateNode( typeof( WireNode ), true ); - if( wireNode != null ) - { - wireNode.Vec2Position = TranformedMousePos; - - m_mainGraphInstance.CreateConnection( wireNode.InputPorts[ 0 ].NodeId, wireNode.InputPorts[ 0 ].PortId, outputPort.NodeId, outputPort.PortId ); - m_mainGraphInstance.CreateConnection( inputPort.NodeId, inputPort.PortId, wireNode.OutputPorts[ 0 ].NodeId, wireNode.OutputPorts[ 0 ].PortId ); - - SetSaveIsDirty(); - ForceRepaint(); - Undo.IncrementCurrentGroup(); - } - } - - break; - } - } - } - //Reset focus from any textfield which may be selected at this time - GUIUtility.keyboardControl = 0; - } - } - - if( m_currentEvent.modifiers != EventModifiers.Shift && m_currentEvent.modifiers != EventModifiers.Control && !m_altBoxSelection ) - m_mainGraphInstance.DeSelectAll(); - - if( m_wireReferenceUtils.ValidReferences() ) - { - m_wireReferenceUtils.InvalidateReferences(); - return; - } - - if( !m_contextMenu.CheckShortcutKey() && m_currentEvent.modifiers != EventModifiers.Shift && m_currentEvent.modifiers != EventModifiers.Control || m_altBoxSelection ) - { - // Only activate multiple selection if no node is selected and shift key not pressed - m_multipleSelectionActive = true; - - m_multipleSelectionStart = TranformedMousePos; - m_multipleSelectionArea.position = m_multipleSelectionStart; - m_multipleSelectionArea.size = Vector2.zero; - } - - UseCurrentEvent(); - } - - void OnLeftMouseDrag() - { - if( m_lostFocus ) - { - m_lostFocus = false; - return; - } - - if( m_lastKeyPressed == KeyCode.Q ) - { - if( m_currentEvent.alt ) - { - ModifyZoom( Constants.ALT_CAMERA_ZOOM_SPEED * ( m_currentEvent.delta.x + m_currentEvent.delta.y ), m_altKeyStartPos ); - } - else - { - m_cameraOffset += m_cameraZoom * m_currentEvent.delta; - } - UseCurrentEvent(); - return; - } - - if( m_altDragStarted ) - { - m_altDragStarted = false; - - if( m_currentEvent.modifiers == EventModifiers.Alt && CurrentGraph.SelectedNodes.Count == 1 ) - { - ParentNode node = CurrentGraph.SelectedNodes[ 0 ]; - int lastId = 0; - int conn = 0; - for( int i = 0; i < node.InputPorts.Count; i++ ) - { - if( node.InputPorts[ i ].IsConnected ) - { - conn++; - lastId = i; - } - } - - if( conn > 1 ) - lastId = 0; - - - - OutputPort outputPort = node.InputPorts[ lastId ].GetOutputConnection( 0 ); - ParentNode outputNode = m_mainGraphInstance.GetNode( outputPort.NodeId ); - bool outputIsWireNode = outputNode is WireNode; - - Undo.RegisterCompleteObjectUndo( this, Constants.UndoCreateConnectionId ); - node.RecordObject( Constants.UndoCreateConnectionId ); - outputNode.RecordObject( Constants.UndoCreateConnectionId ); - - List<InputPort> inputPorts = new List<InputPort>(); - for( int i = 0; i < node.OutputPorts[ 0 ].ConnectionCount; i++ ) - { - InputPort inputPort = node.OutputPorts[ 0 ].GetInputConnection( i ); - ParentNode inputNode = m_mainGraphInstance.GetNode( inputPort.NodeId ); - inputNode.RecordObject( Constants.UndoCreateConnectionId ); - inputPorts.Add( inputPort ); - } - - for( int i = 0; i < inputPorts.Count; i++ ) - { - if( outputIsWireNode ) - { - if( i == 0 ) - { - m_mainGraphInstance.CreateConnection( inputPorts[ i ].NodeId, inputPorts[ i ].PortId, outputPort.NodeId, outputPort.PortId ); - } - else - { - UIUtils.DeleteConnection( true, inputPorts[ i ].NodeId, inputPorts[ i ].PortId, false, true ); - } - } - else - { - m_mainGraphInstance.CreateConnection( inputPorts[ i ].NodeId, inputPorts[ i ].PortId, outputPort.NodeId, outputPort.PortId ); - } - } - - UIUtils.DeleteConnection( true, node.UniqueId, node.InputPorts[ lastId ].PortId, false, true ); - - SetSaveIsDirty(); - ForceRepaint(); - } - } - - if( !m_wireReferenceUtils.ValidReferences() && !m_altBoxSelection ) - { - if( m_mouseDownOnValidArea && m_insideEditorWindow ) - { - if( m_currentEvent.control ) - { - m_mainGraphInstance.MoveSelectedNodes( m_cameraZoom * m_currentEvent.delta, true ); - } - else - { - m_mainGraphInstance.MoveSelectedNodes( m_cameraZoom * m_currentEvent.delta ); - } - //m_mainGraphInstance.MoveSelectedNodes( m_cameraZoom * m_currentEvent.delta ); - m_autoPanDirActive = true; - } - } - else - { - List<ParentNode> nodes = m_mainGraphInstance.GetNodesInGrid( m_drawInfo.TransformedMousePos ); - if( nodes != null && nodes.Count > 0 ) - { - Vector2 currentPortPos = new Vector2(); - Vector2 mousePos = TranformedMousePos; - - if( m_wireReferenceUtils.InputPortReference.IsValid ) - { - OutputPort currentPort = null; - float smallestDistance = float.MaxValue; - Vector2 smallestPosition = Vector2.zero; - for( int nodeIdx = 0; nodeIdx < nodes.Count; nodeIdx++ ) - { - List<OutputPort> outputPorts = nodes[ nodeIdx ].OutputPorts; - if( outputPorts != null ) - { - for( int o = 0; o < outputPorts.Count; o++ ) - { - if( outputPorts[ o ].Available ) - { - currentPortPos.x = outputPorts[ o ].Position.x; - currentPortPos.y = outputPorts[ o ].Position.y; - - currentPortPos = currentPortPos * m_cameraZoom - m_cameraOffset; - float dist = ( mousePos - currentPortPos ).sqrMagnitude; - if( dist < smallestDistance ) - { - smallestDistance = dist; - smallestPosition = currentPortPos; - currentPort = outputPorts[ o ]; - } - } - } - } - } - - if( currentPort != null && currentPort.Available && ( smallestDistance < Constants.SNAP_SQR_DIST || currentPort.InsideActiveArea( ( mousePos + m_cameraOffset ) / m_cameraZoom ) ) ) - { - m_wireReferenceUtils.ActivateSnap( smallestPosition, currentPort ); - } - else - { - m_wireReferenceUtils.DeactivateSnap(); - } - } - - if( m_wireReferenceUtils.OutputPortReference.IsValid ) - { - InputPort currentPort = null; - float smallestDistance = float.MaxValue; - Vector2 smallestPosition = Vector2.zero; - for( int nodeIdx = 0; nodeIdx < nodes.Count; nodeIdx++ ) - { - List<InputPort> inputPorts = nodes[ nodeIdx ].InputPorts; - if( inputPorts != null ) - { - for( int i = 0; i < inputPorts.Count; i++ ) - { - if( inputPorts[ i ].Available ) - { - currentPortPos.x = inputPorts[ i ].Position.x; - currentPortPos.y = inputPorts[ i ].Position.y; - - currentPortPos = currentPortPos * m_cameraZoom - m_cameraOffset; - float dist = ( mousePos - currentPortPos ).sqrMagnitude; - if( dist < smallestDistance ) - { - smallestDistance = dist; - smallestPosition = currentPortPos; - currentPort = inputPorts[ i ]; - } - } - } - } - } - if( currentPort != null && currentPort.Available && ( smallestDistance < Constants.SNAP_SQR_DIST || currentPort.InsideActiveArea( ( mousePos + m_cameraOffset ) / m_cameraZoom ) ) ) - { - m_wireReferenceUtils.ActivateSnap( smallestPosition, currentPort ); - } - else - { - m_wireReferenceUtils.DeactivateSnap(); - } - } - } - else if( m_wireReferenceUtils.SnapEnabled ) - { - m_wireReferenceUtils.DeactivateSnap(); - } - } - UseCurrentEvent(); - } - - public void OnLeftMouseUp() - { - m_lmbPressed = false; - if( m_multipleSelectionActive ) - { - //m_multipleSelectionActive = false; - UpdateSelectionArea(); - //m_mainGraphInstance.MultipleSelection( m_multipleSelectionArea, ( m_currentEvent.modifiers == EventModifiers.Shift || m_currentEvent.modifiers == EventModifiers.Control ), true ); - if( m_currentEvent.alt && m_altBoxSelection ) - { - m_mainGraphInstance.MultipleSelection( m_multipleSelectionArea, !m_currentEvent.shift ); - } - else - { - m_mainGraphInstance.DeSelectAll(); - m_mainGraphInstance.MultipleSelection( m_multipleSelectionArea ); - } - } - - if( m_wireReferenceUtils.ValidReferences() ) - { - //Check if there is some kind of port beneath the mouse ... if so connect to it - ParentNode targetNode = m_wireReferenceUtils.SnapEnabled ? m_mainGraphInstance.GetNode( m_wireReferenceUtils.SnapPort.NodeId ) : m_mainGraphInstance.CheckNodeAt( m_currentMousePos ); - if( targetNode != null && targetNode.ConnStatus != NodeConnectionStatus.Island ) - { - if( m_wireReferenceUtils.InputPortReference.IsValid && m_wireReferenceUtils.InputPortReference.NodeId != targetNode.UniqueId ) - { - OutputPort outputPort = m_wireReferenceUtils.SnapEnabled ? targetNode.GetOutputPortByUniqueId( m_wireReferenceUtils.SnapPort.PortId ) : targetNode.CheckOutputPortAt( m_currentMousePos ); - if( outputPort != null && !outputPort.Locked && ( !m_wireReferenceUtils.InputPortReference.TypeLocked || - m_wireReferenceUtils.InputPortReference.DataType == WirePortDataType.OBJECT || - ( m_wireReferenceUtils.InputPortReference.TypeLocked && outputPort.DataType == m_wireReferenceUtils.InputPortReference.DataType ) ) ) - { - - ParentNode originNode = m_mainGraphInstance.GetNode( m_wireReferenceUtils.InputPortReference.NodeId ); - InputPort inputPort = originNode.GetInputPortByUniqueId( m_wireReferenceUtils.InputPortReference.PortId ); - UIUtils.MarkUndoAction(); - Undo.RegisterCompleteObjectUndo( this, Constants.UndoCreateConnectionId ); - originNode.RecordObject( Constants.UndoCreateConnectionId ); - targetNode.RecordObject( Constants.UndoCreateConnectionId ); - - if( !inputPort.CheckValidType( outputPort.DataType ) ) - { - UIUtils.ShowIncompatiblePortMessage( true, originNode, inputPort, targetNode, outputPort ); - m_wireReferenceUtils.InvalidateReferences(); - UseCurrentEvent(); - return; - } - - if( !outputPort.CheckValidType( inputPort.DataType ) ) - { - UIUtils.ShowIncompatiblePortMessage( false, targetNode, outputPort, originNode, inputPort ); - m_wireReferenceUtils.InvalidateReferences(); - UseCurrentEvent(); - return; - } - - inputPort.DummyAdd( outputPort.NodeId, outputPort.PortId ); - outputPort.DummyAdd( m_wireReferenceUtils.InputPortReference.NodeId, m_wireReferenceUtils.InputPortReference.PortId ); - - if( UIUtils.DetectNodeLoopsFrom( originNode, new Dictionary<int, int>() ) ) - { - inputPort.DummyRemove(); - outputPort.DummyRemove(); - m_wireReferenceUtils.InvalidateReferences(); - ShowMessage( "Infinite Loop detected" ); - UseCurrentEvent(); - return; - } - - inputPort.DummyRemove(); - outputPort.DummyRemove(); - - if( inputPort.IsConnected ) - { - DeleteConnection( true, m_wireReferenceUtils.InputPortReference.NodeId, m_wireReferenceUtils.InputPortReference.PortId, true, false ); - } - - //link output to input - if( outputPort.ConnectTo( m_wireReferenceUtils.InputPortReference.NodeId, m_wireReferenceUtils.InputPortReference.PortId, m_wireReferenceUtils.InputPortReference.DataType, m_wireReferenceUtils.InputPortReference.TypeLocked ) ) - targetNode.OnOutputPortConnected( outputPort.PortId, m_wireReferenceUtils.InputPortReference.NodeId, m_wireReferenceUtils.InputPortReference.PortId ); - - //link input to output - if( inputPort.ConnectTo( outputPort.NodeId, outputPort.PortId, outputPort.DataType, m_wireReferenceUtils.InputPortReference.TypeLocked ) ) - originNode.OnInputPortConnected( m_wireReferenceUtils.InputPortReference.PortId, targetNode.UniqueId, outputPort.PortId ); - m_mainGraphInstance.MarkWireHighlights(); - } - else if( outputPort != null && m_wireReferenceUtils.InputPortReference.TypeLocked && m_wireReferenceUtils.InputPortReference.DataType != outputPort.DataType ) - { - ShowMessage( "Attempting to connect a port locked to type " + m_wireReferenceUtils.InputPortReference.DataType + " into a port of type " + outputPort.DataType ); - } - ShaderIsModified = true; - SetSaveIsDirty(); - } - - if( m_wireReferenceUtils.OutputPortReference.IsValid && m_wireReferenceUtils.OutputPortReference.NodeId != targetNode.UniqueId ) - { - InputPort inputPort = m_wireReferenceUtils.SnapEnabled ? targetNode.GetInputPortByUniqueId( m_wireReferenceUtils.SnapPort.PortId ) : targetNode.CheckInputPortAt( m_currentMousePos ); - if( inputPort != null && !inputPort.Locked && ( !inputPort.TypeLocked || - inputPort.DataType == WirePortDataType.OBJECT || - ( inputPort.TypeLocked && inputPort.DataType == m_wireReferenceUtils.OutputPortReference.DataType ) ) ) - { - ParentNode originNode = m_mainGraphInstance.GetNode( m_wireReferenceUtils.OutputPortReference.NodeId ); - OutputPort outputPort = originNode.GetOutputPortByUniqueId( m_wireReferenceUtils.OutputPortReference.PortId ); - - UIUtils.MarkUndoAction(); - Undo.RegisterCompleteObjectUndo( this, Constants.UndoCreateConnectionId ); - originNode.RecordObject( Constants.UndoCreateConnectionId ); - targetNode.RecordObject( Constants.UndoCreateConnectionId ); - - if( !inputPort.CheckValidType( outputPort.DataType ) ) - { - UIUtils.ShowIncompatiblePortMessage( true, targetNode, inputPort, originNode, outputPort ); - m_wireReferenceUtils.InvalidateReferences(); - UseCurrentEvent(); - return; - } - - if( !outputPort.CheckValidType( inputPort.DataType ) ) - { - UIUtils.ShowIncompatiblePortMessage( false, originNode, outputPort, targetNode, inputPort ); - m_wireReferenceUtils.InvalidateReferences(); - UseCurrentEvent(); - return; - } - - inputPort.DummyAdd( m_wireReferenceUtils.OutputPortReference.NodeId, m_wireReferenceUtils.OutputPortReference.PortId ); - outputPort.DummyAdd( inputPort.NodeId, inputPort.PortId ); - if( UIUtils.DetectNodeLoopsFrom( targetNode, new Dictionary<int, int>() ) ) - { - inputPort.DummyRemove(); - outputPort.DummyRemove(); - m_wireReferenceUtils.InvalidateReferences(); - ShowMessage( "Infinite Loop detected" ); - UseCurrentEvent(); - return; - } - - inputPort.DummyRemove(); - outputPort.DummyRemove(); - - if( inputPort.IsConnected ) - { - if( m_currentEvent.control && m_wireReferenceUtils.SwitchPortReference.IsValid ) - { - ParentNode oldOutputNode = UIUtils.GetNode( inputPort.GetConnection( 0 ).NodeId ); - OutputPort oldOutputPort = oldOutputNode.GetOutputPortByUniqueId( inputPort.GetConnection( 0 ).PortId ); - - ParentNode switchNode = UIUtils.GetNode( m_wireReferenceUtils.SwitchPortReference.NodeId ); - InputPort switchPort = switchNode.GetInputPortByUniqueId( m_wireReferenceUtils.SwitchPortReference.PortId ); - - switchPort.DummyAdd( oldOutputPort.NodeId, oldOutputPort.PortId ); - oldOutputPort.DummyAdd( switchPort.NodeId, switchPort.PortId ); - if( UIUtils.DetectNodeLoopsFrom( switchNode, new Dictionary<int, int>() ) ) - { - switchPort.DummyRemove(); - oldOutputPort.DummyRemove(); - m_wireReferenceUtils.InvalidateReferences(); - ShowMessage( "Infinite Loop detected" ); - UseCurrentEvent(); - return; - } - - switchPort.DummyRemove(); - oldOutputPort.DummyRemove(); - - DeleteConnection( true, inputPort.NodeId, inputPort.PortId, true, false ); - ConnectInputToOutput( switchPort.NodeId, switchPort.PortId, oldOutputPort.NodeId, oldOutputPort.PortId ); - } - else - { - DeleteConnection( true, inputPort.NodeId, inputPort.PortId, true, false ); - } - } - inputPort.InvalidateAllConnections(); - - - //link input to output - if( inputPort.ConnectTo( m_wireReferenceUtils.OutputPortReference.NodeId, m_wireReferenceUtils.OutputPortReference.PortId, m_wireReferenceUtils.OutputPortReference.DataType, inputPort.TypeLocked ) ) - targetNode.OnInputPortConnected( inputPort.PortId, m_wireReferenceUtils.OutputPortReference.NodeId, m_wireReferenceUtils.OutputPortReference.PortId ); - //link output to input - - if( outputPort.ConnectTo( inputPort.NodeId, inputPort.PortId, inputPort.DataType, inputPort.TypeLocked ) ) - originNode.OnOutputPortConnected( m_wireReferenceUtils.OutputPortReference.PortId, targetNode.UniqueId, inputPort.PortId ); - m_mainGraphInstance.MarkWireHighlights(); - } - else if( inputPort != null && inputPort.TypeLocked && inputPort.DataType != m_wireReferenceUtils.OutputPortReference.DataType ) - { - ShowMessage( "Attempting to connect a " + m_wireReferenceUtils.OutputPortReference.DataType + " to a port locked to type " + inputPort.DataType ); - } - ShaderIsModified = true; - SetSaveIsDirty(); - } - m_wireReferenceUtils.InvalidateReferences(); - } - else - { - if( UIUtils.ShowContextOnPick ) - m_contextPalette.Show( m_currentMousePos2D, m_cameraInfo ); - else - m_wireReferenceUtils.InvalidateReferences(); - } - } - else if( m_currentEvent.modifiers == EventModifiers.Alt && m_altAvailable && CurrentGraph.SelectedNodes.Count == 1 && !m_altBoxSelection && !m_multipleSelectionActive ) - { - List<WireBezierReference> wireRefs = m_mainGraphInstance.GetWireBezierListInPos( m_currentMousePos2D ); - if( wireRefs != null && wireRefs.Count > 0 ) - { - float closestDist = 50; - int closestId = 0; - - for( int i = 0; i < wireRefs.Count; i++ ) - { - ParentNode outNode = m_mainGraphInstance.GetNode( wireRefs[ i ].OutNodeId ); - ParentNode inNode = m_mainGraphInstance.GetNode( wireRefs[ i ].InNodeId ); - - if( outNode == CurrentGraph.SelectedNodes[ 0 ] || inNode == CurrentGraph.SelectedNodes[ 0 ] ) - continue; - - OutputPort outputPort = outNode.GetOutputPortByUniqueId( wireRefs[ i ].OutPortId ); - InputPort inputPort = inNode.GetInputPortByUniqueId( wireRefs[ i ].InPortId ); - - // Calculate the 4 points for bezier taking into account wire nodes and their automatic tangents - Vector3 endPos = new Vector3( inputPort.Position.x, inputPort.Position.y ); - Vector3 startPos = new Vector3( outputPort.Position.x, outputPort.Position.y ); - - float mag = ( endPos - startPos ).magnitude; - float resizedMag = Mathf.Min( mag, Constants.HORIZONTAL_TANGENT_SIZE * m_drawInfo.InvertedZoom ); - - Vector3 startTangent = new Vector3( startPos.x + resizedMag, startPos.y ); - Vector3 endTangent = new Vector3( endPos.x - resizedMag, endPos.y ); - - if( inNode != null && inNode.GetType() == typeof( WireNode ) ) - endTangent = endPos + ( ( inNode as WireNode ).TangentDirection ) * mag * 0.33f; - - if( outNode != null && outNode.GetType() == typeof( WireNode ) ) - startTangent = startPos - ( ( outNode as WireNode ).TangentDirection ) * mag * 0.33f; - - //Vector2 pos = ( CurrentGraph.SelectedNodes[0].CenterPosition + m_cameraOffset ) / m_cameraZoom; - - float dist = HandleUtility.DistancePointBezier( /*pos*/ m_currentMousePos, startPos, endPos, startTangent, endTangent ); - if( dist < 40 ) - { - if( dist < closestDist ) - { - closestDist = dist; - closestId = i; - } - } - } - - if( closestDist < 40 ) - { - ParentNode outNode = m_mainGraphInstance.GetNode( wireRefs[ closestId ].OutNodeId ); - ParentNode inNode = m_mainGraphInstance.GetNode( wireRefs[ closestId ].InNodeId ); - - OutputPort outputPort = outNode.GetOutputPortByUniqueId( wireRefs[ closestId ].OutPortId ); - InputPort inputPort = inNode.GetInputPortByUniqueId( wireRefs[ closestId ].InPortId ); - - ParentNode selectedNode = CurrentGraph.SelectedNodes[ 0 ]; - if( selectedNode.InputPorts.Count > 0 && selectedNode.OutputPorts.Count > 0 ) - { - Undo.RegisterCompleteObjectUndo( this, Constants.UndoCreateConnectionId ); - selectedNode.RecordObject( Constants.UndoCreateConnectionId ); - inNode.RecordObject( Constants.UndoCreateConnectionId ); - outNode.RecordObject( Constants.UndoCreateConnectionId ); - - m_mainGraphInstance.CreateConnection( selectedNode.UniqueId, selectedNode.InputPorts[ 0 ].PortId, outputPort.NodeId, outputPort.PortId ); - m_mainGraphInstance.CreateConnection( inputPort.NodeId, inputPort.PortId, selectedNode.UniqueId, selectedNode.OutputPorts[ 0 ].PortId ); - } - - SetSaveIsDirty(); - ForceRepaint(); - } - } - } - UIUtils.ShowContextOnPick = true; - m_altBoxSelection = false; - m_multipleSelectionActive = false; - UseCurrentEvent(); - } - - public void ConnectInputToOutput( int inNodeId, int inPortId, int outNodeId, int outPortId, bool registerUndo = true ) - { - ParentNode inNode = m_mainGraphInstance.GetNode( inNodeId ); - ParentNode outNode = m_mainGraphInstance.GetNode( outNodeId ); - if( inNode != null && outNode != null ) - { - InputPort inPort = inNode.GetInputPortByUniqueId( inPortId ); - OutputPort outPort = outNode.GetOutputPortByUniqueId( outPortId ); - if( inPort != null && outPort != null ) - { - if( registerUndo ) - { - Undo.RegisterCompleteObjectUndo( this, Constants.UndoCreateConnectionId ); - inNode.RecordObject( Constants.UndoCreateConnectionId ); - outNode.RecordObject( Constants.UndoCreateConnectionId ); - } - - if( inPort.ConnectTo( outNodeId, outPortId, outPort.DataType, inPort.TypeLocked ) ) - { - inNode.OnInputPortConnected( inPortId, outNodeId, outPortId ); - } - - if( outPort.ConnectTo( inNodeId, inPortId, inPort.DataType, inPort.TypeLocked ) ) - { - outNode.OnOutputPortConnected( outPortId, inNodeId, inPortId ); - } - } - m_mainGraphInstance.MarkWireHighlights(); - ShaderIsModified = true; - } - } - - void OnRightMouseDown() - { - Focus(); - m_rmbStartPos = m_currentMousePos2D; - UseCurrentEvent(); - } - - void OnRightMouseDrag() - { - // We look at the control to detect when user hits a tooltip ( which has a hot control of 0 ) - // This needs to be checked because on this first "frame" of hitting a tooltip because it generates incorrect mouse delta values - if( GUIUtility.hotControl == 0 && m_lastHotControl != 0 ) - { - m_lastHotControl = GUIUtility.hotControl; - return; - } - - m_lastHotControl = GUIUtility.hotControl; - if( m_currentEvent.alt ) - { - ModifyZoom( Constants.ALT_CAMERA_ZOOM_SPEED * ( m_currentEvent.delta.x + m_currentEvent.delta.y ), m_altKeyStartPos ); - } - else - { - m_cameraOffset += m_cameraZoom * m_currentEvent.delta; - } - UseCurrentEvent(); - } - - void OnRightMouseUp() - { - //Resetting the hot control test variable so it can be used again on right mouse drag detection ( if we did not do this then m_lastHotControl could be left with a a value of 0 and wouldn't be able to be correctly used on rthe drag ) - m_lastHotControl = -1; - - if( ( m_rmbStartPos - m_currentMousePos2D ).sqrMagnitude < Constants.RMB_SCREEN_DIST ) - { - ParentNode node = m_mainGraphInstance.CheckNodeAt( m_currentMousePos, true ); - if( node == null ) - { - m_contextPalette.Show( m_currentMousePos2D, m_cameraInfo ); - } - } - UseCurrentEvent(); - } - - void UpdateSelectionArea() - { - m_multipleSelectionArea.size = TranformedMousePos - m_multipleSelectionStart; - } - - public void OnValidObjectsDropped( UnityEngine.Object[] droppedObjs ) - { - bool propagateDraggedObjsToNode = true; - // Only supporting single drag&drop object selection - if( droppedObjs.Length == 1 ) - { - ShaderIsModified = true; - SetSaveIsDirty(); - // Check if its a shader, material or game object and if so load the shader graph code from it - Shader newShader = droppedObjs[ 0 ] as Shader; - Material newMaterial = null; - if( newShader == null ) - { - newMaterial = droppedObjs[ 0 ] as Material; -#if UNITY_2018_1_OR_NEWER - bool isProcedural = ( newMaterial != null ); -#else - // Disabling Substance Deprecated warning -#pragma warning disable 0618 - bool isProcedural = ( newMaterial != null && newMaterial is ProceduralMaterial ); -#pragma warning restore 0618 -#endif - if( newMaterial != null && !isProcedural ) - { - if( UIUtils.IsUnityNativeShader( AssetDatabase.GetAssetPath( newMaterial.shader ) ) ) - { - return; - } - //newShader = newMaterial.shader; - LoadMaterialToASE( newMaterial ); - //m_mainGraphInstance.UpdateMaterialOnMasterNode( newMaterial ); - } - else - { - GameObject go = droppedObjs[ 0 ] as GameObject; - if( go != null ) - { - Renderer renderer = go.GetComponent<Renderer>(); - if( renderer ) - { - newMaterial = renderer.sharedMaterial; - newShader = newMaterial.shader; - } - } - } - } - - if( newShader != null ) - { - ConvertShaderToASE( newShader ); - - propagateDraggedObjsToNode = false; - } - - // if not shader loading then propagate the seletion to whats below the mouse - if( propagateDraggedObjsToNode ) - { - ParentNode node = m_mainGraphInstance.CheckNodeAt( m_currentMousePos ); - if( node != null ) - { - // if there's a node then pass the object into it to see if there's a setup with it - node.OnObjectDropped( droppedObjs[ 0 ] ); - } - else - { - // If not then check if there's a node that can be created through the dropped object - ParentNode newNode = m_contextMenu.CreateNodeFromCastType( droppedObjs[ 0 ].GetType() ); - if( newNode ) - { - newNode.ContainerGraph = m_mainGraphInstance; - newNode.Vec2Position = TranformedMousePos; - m_mainGraphInstance.AddNode( newNode, true ); - newNode.SetupFromCastObject( droppedObjs[ 0 ] ); - m_mainGraphInstance.SelectNode( newNode, false, false ); - ForceRepaint(); - bool find = false; - if( newNode is FunctionNode && CurrentGraph.CurrentShaderFunction != null ) - find = SearchFunctionNodeRecursively( CurrentGraph.CurrentShaderFunction ); - - if( find ) - { - DestroyNode( newNode, false ); - ShowMessage( "Shader Function loop detected, new node was removed to prevent errors." ); - } - } - } - } - } - } - - public bool SearchFunctionNodeRecursively( AmplifyShaderFunction function ) - { - List<FunctionNode> graphList = UIUtils.FunctionList(); - - bool nodeFind = false; - - for( int i = 0; i < graphList.Count; i++ ) - { - ParentGraph temp = CustomGraph; - CustomGraph = graphList[ i ].FunctionGraph; - nodeFind = SearchFunctionNodeRecursively( function ); - CustomGraph = temp; - - //Debug.Log( "tested = " + node.Function.FunctionName + " : " + function.FunctionName ); - - if( graphList[ i ].Function == function ) - return true; - } - - return nodeFind; - } - - public void SetDelayedMaterialMode( Material material ) - { - if( material == null ) - return; - m_delayedMaterialSet = material; - } - - public ShaderLoadResult LoadDroppedObject( bool value, Shader shader, Material material, AmplifyShaderFunction shaderFunction = null ) - { - UIUtils.CurrentWindow = this; - ShaderLoadResult result; - if( shaderFunction != null ) - { - string assetDatapath = AssetDatabase.GetAssetPath( shaderFunction ); - string latestOpenedFolder = Application.dataPath + assetDatapath.Substring( 6 ); - UIUtils.LatestOpenedFolder = latestOpenedFolder.Substring( 0, latestOpenedFolder.LastIndexOf( '/' ) + 1 ); - result = LoadFromDisk( assetDatapath, shaderFunction ); - CurrentSelection = ASESelectionMode.ShaderFunction; - IsShaderFunctionWindow = true; - titleContent.text = GenerateTabTitle( shaderFunction.FunctionName ); - titleContent.image = UIUtils.ShaderFunctionIcon; - m_lastpath = assetDatapath; - m_nodeParametersWindow.OnShaderFunctionLoad(); - //EditorPrefs.SetString( IOUtils.LAST_OPENED_OBJ_ID, assetDatapath ); - } - else if( value && shader != null ) - { - string assetDatapath = AssetDatabase.GetAssetPath( shader ); - string latestOpenedFolder = Application.dataPath + assetDatapath.Substring( 6 ); - UIUtils.LatestOpenedFolder = latestOpenedFolder.Substring( 0, latestOpenedFolder.LastIndexOf( '/' ) + 1 ); - result = LoadFromDisk( assetDatapath ); - switch( result ) - { - case ShaderLoadResult.LOADED: - { - m_mainGraphInstance.UpdateShaderOnMasterNode( shader ); - } - break; - case ShaderLoadResult.ASE_INFO_NOT_FOUND: - { - ShowMessage( "Loaded shader wasn't created with ASE. Saving it will remove previous data." ); - UIUtils.CreateEmptyFromInvalid( shader ); - } - break; - case ShaderLoadResult.FILE_NOT_FOUND: - case ShaderLoadResult.UNITY_NATIVE_PATHS: - { - UIUtils.CreateEmptyFromInvalid( shader ); - } - break; - } - - m_mainGraphInstance.UpdateMaterialOnMasterNode( material ); - m_mainGraphInstance.SetMaterialModeOnGraph( material ); - - if( material != null ) - { - CurrentSelection = ASESelectionMode.Material; - IsShaderFunctionWindow = false; - titleContent.text = GenerateTabTitle( material.name ); - titleContent.image = UIUtils.MaterialIcon; - if( material.HasProperty( IOUtils.DefaultASEDirtyCheckId ) ) - { - material.SetInt( IOUtils.DefaultASEDirtyCheckId, 1 ); - } - m_lastpath = AssetDatabase.GetAssetPath( material ); - EditorPrefs.SetString( IOUtils.LAST_OPENED_OBJ_ID, m_lastpath ); - } - else - { - CurrentSelection = ASESelectionMode.Shader; - IsShaderFunctionWindow = false; - titleContent.text = GenerateTabTitle( shader.name ); - titleContent.image = UIUtils.ShaderIcon; - m_lastpath = AssetDatabase.GetAssetPath( shader ); - EditorPrefs.SetString( IOUtils.LAST_OPENED_OBJ_ID, m_lastpath ); - } - } - else - { - result = ShaderLoadResult.FILE_NOT_FOUND; - } - return result; - } - - bool InsideMenus( Vector2 position ) - { - for( int i = 0; i < m_registeredMenus.Count; i++ ) - { - if( m_registeredMenus[ i ].IsInside( position ) ) - { - return true; - } - } - return false; - } - - void HandleGUIEvents() - { - if( m_currentEvent.type == EventType.KeyDown ) - { - m_contextMenu.UpdateKeyPress( m_currentEvent.keyCode ); - } - else if( m_currentEvent.type == EventType.KeyUp ) - { - m_contextMenu.UpdateKeyReleased( m_currentEvent.keyCode ); - } - - if( InsideMenus( m_currentMousePos2D ) ) - { - if( m_currentEvent.type == EventType.Used ) - m_mouseDownOnValidArea = false; - - if( m_currentEvent.type == EventType.MouseDown ) - { - m_mouseDownOnValidArea = false; - UseCurrentEvent(); - } - return; - } - else if( m_nodeParametersWindow.IsResizing || m_paletteWindow.IsResizing ) - { - m_mouseDownOnValidArea = false; - } - - int controlID = GUIUtility.GetControlID( FocusType.Passive ); - switch( m_currentEvent.GetTypeForControl( controlID ) ) - { - case EventType.MouseDown: - { - GUIUtility.hotControl = controlID; - switch( m_currentEvent.button ) - { - case ButtonClickId.LeftMouseButton: - { - OnLeftMouseDown(); - } - break; - case ButtonClickId.RightMouseButton: - case ButtonClickId.MiddleMouseButton: - { - OnRightMouseDown(); - } - break; - } - } - break; - case EventType.MouseMove: - { - m_keyEvtMousePos2D = m_currentEvent.mousePosition; - } - break; - case EventType.MouseUp: - { - GUIUtility.hotControl = 0; - switch( m_currentEvent.button ) - { - case ButtonClickId.LeftMouseButton: - { - OnLeftMouseUp(); - } - break; - case ButtonClickId.MiddleMouseButton: break; - case ButtonClickId.RightMouseButton: - { - OnRightMouseUp(); - } - break; - } - } - break; - case EventType.MouseDrag: - { - switch( m_currentEvent.button ) - { - case ButtonClickId.LeftMouseButton: - { - OnLeftMouseDrag(); - } - break; - case ButtonClickId.MiddleMouseButton: - case ButtonClickId.RightMouseButton: - { - OnRightMouseDrag(); - } - break; - } - } - break; - case EventType.ScrollWheel: - { - OnScrollWheel(); - } - break; - case EventType.KeyDown: - { - OnKeyboardDown(); - } - break; - case EventType.KeyUp: - { - OnKeyboardUp(); - } - break; - case EventType.ValidateCommand: - { - switch( m_currentEvent.commandName ) - { - case CopyCommand: - case PasteCommand: - case SelectAll: - case Duplicate: - { - m_currentEvent.Use(); - } - break; - case ObjectSelectorClosed: - { - m_mouseDownOnValidArea = false; - } - break; - } - } - break; - case EventType.ExecuteCommand: - { - m_currentEvent.Use(); - switch( m_currentEvent.commandName ) - { - case CopyCommand: - { - CopyToClipboard(); - } - break; - case PasteCommand: - { - PasteFromClipboard( true ); - } - break; - case SelectAll: - { - m_mainGraphInstance.SelectAll(); - ForceRepaint(); - } - break; - case Duplicate: - { - CopyToClipboard(); - PasteFromClipboard( true ); - } - break; - case ObjectSelectorClosed: - { - m_mouseDownOnValidArea = false; - } - break; - } - } - break; - case EventType.Repaint: - { - } - break; - } - - m_dragAndDropTool.TestDragAndDrop( m_graphArea ); - - } - - public void DeleteConnection( bool isInput, int nodeId, int portId, bool registerOnLog, bool propagateCallback ) - { - m_mainGraphInstance.DeleteConnection( isInput, nodeId, portId, registerOnLog, propagateCallback ); - } - - void DeleteSelectedNodes() - { - if( m_mainGraphInstance.SelectedNodes.Count == 0 ) - return; - - UIUtils.ClearUndoHelper(); - ParentNode[] selectedNodes = new ParentNode[ m_mainGraphInstance.SelectedNodes.Count ]; - for( int i = 0; i < selectedNodes.Length; i++ ) - { - selectedNodes[ i ] = m_mainGraphInstance.SelectedNodes[ i ]; - selectedNodes[ i ].Rewire(); - UIUtils.CheckUndoNode( selectedNodes[ i ] ); - } - - //Check nodes connected to deleted nodes to preserve connections on undo - List<ParentNode> extraNodes = new List<ParentNode>(); - for( int selectedNodeIdx = 0; selectedNodeIdx < selectedNodes.Length; selectedNodeIdx++ ) - { - // Check inputs - { - int inputIdxCount = selectedNodes[ selectedNodeIdx ].InputPorts.Count; - if( inputIdxCount > 0 ) - { - for( int inputIdx = 0; inputIdx < inputIdxCount; inputIdx++ ) - { - if( selectedNodes[ selectedNodeIdx ].InputPorts[ inputIdx ].IsConnected ) - { - int nodeIdx = selectedNodes[ selectedNodeIdx ].InputPorts[ inputIdx ].ExternalReferences[ 0 ].NodeId; - if( nodeIdx > -1 ) - { - ParentNode node = m_mainGraphInstance.GetNode( nodeIdx ); - if( node != null && UIUtils.CheckUndoNode( node ) ) - { - extraNodes.Add( node ); - } - } - } - } - } - } - - // Check outputs - int outputIdxCount = selectedNodes[ selectedNodeIdx ].OutputPorts.Count; - if( outputIdxCount > 0 ) - { - for( int outputIdx = 0; outputIdx < outputIdxCount; outputIdx++ ) - { - int inputIdxCount = selectedNodes[ selectedNodeIdx ].OutputPorts[ outputIdx ].ExternalReferences.Count; - if( inputIdxCount > 0 ) - { - for( int inputIdx = 0; inputIdx < inputIdxCount; inputIdx++ ) - { - int nodeIdx = selectedNodes[ selectedNodeIdx ].OutputPorts[ outputIdx ].ExternalReferences[ inputIdx ].NodeId; - if( nodeIdx > -1 ) - { - ParentNode node = m_mainGraphInstance.GetNode( nodeIdx ); - if( UIUtils.CheckUndoNode( node ) ) - { - extraNodes.Add( node ); - } - } - } - } - } - } - } - - UIUtils.ClearUndoHelper(); - //Undo.IncrementCurrentGroup(); - //Record deleted nodes - UIUtils.MarkUndoAction(); - Undo.RegisterCompleteObjectUndo( this, Constants.UndoDeleteNodeId ); - Undo.RegisterCompleteObjectUndo( m_mainGraphInstance, Constants.UndoDeleteNodeId ); - Undo.RecordObjects( selectedNodes, Constants.UndoDeleteNodeId ); - Undo.RecordObjects( extraNodes.ToArray(), Constants.UndoDeleteNodeId ); - - //Record deleting connections - for( int i = 0; i < selectedNodes.Length; i++ ) - { - selectedNodes[ i ].Alive = false; - m_mainGraphInstance.DeleteAllConnectionFromNode( selectedNodes[ i ], false, true, true ); - } - //Delete - m_mainGraphInstance.DeleteNodesOnArray( ref selectedNodes ); - - - //Undo.IncrementCurrentGroup(); - extraNodes.Clear(); - extraNodes = null; - - EditorUtility.SetDirty( this ); - - ForceRepaint(); - } - - void OnKeyboardUp() - { - CheckKeyboardCameraUp(); - - if( m_altPressDown ) - { - m_altPressDown = false; - } - - if( m_shortcutManager.ActivateShortcut( m_currentEvent.modifiers, m_lastKeyPressed, false ) ) - { - ForceRepaint(); - } - m_lastKeyPressed = KeyCode.None; - } - - bool OnKeyboardPress( KeyCode code ) - { - return ( m_currentEvent.keyCode == code && m_lastKeyPressed == KeyCode.None ); - } - - void CheckKeyboardCameraDown() - { - if( m_contextPalette.IsActive ) - return; - if( m_currentEvent.alt ) - { - bool foundKey = false; - float dir = 0; - switch( m_currentEvent.keyCode ) - { - case KeyCode.UpArrow: foundKey = true; dir = 1; break; - case KeyCode.DownArrow: foundKey = true; dir = -1; break; - case KeyCode.LeftArrow: foundKey = true; dir = 1; break; - case KeyCode.RightArrow: foundKey = true; dir = -1; break; - } - if( foundKey ) - { - ModifyZoom( Constants.ALT_CAMERA_ZOOM_SPEED * dir * m_cameraSpeed, new Vector2( m_cameraInfo.width * 0.5f, m_cameraInfo.height * 0.5f ) ); - if( m_cameraSpeed < 15 ) - m_cameraSpeed += 0.2f; - UseCurrentEvent(); - } - - - } - else - { - bool foundKey = false; - Vector2 dir = Vector2.zero; - switch( m_currentEvent.keyCode ) - { - case KeyCode.UpArrow: foundKey = true; dir = Vector2.up; break; - case KeyCode.DownArrow: foundKey = true; dir = Vector2.down; break; - case KeyCode.LeftArrow: foundKey = true; dir = Vector2.right; break; - case KeyCode.RightArrow: foundKey = true; dir = Vector2.left; break; - } - if( foundKey ) - { - m_cameraOffset += m_cameraZoom * m_cameraSpeed * dir; - if( m_cameraSpeed < 15 ) - m_cameraSpeed += 0.2f; - - UseCurrentEvent(); - } - } - } - - void CheckKeyboardCameraUp() - { - switch( m_currentEvent.keyCode ) - { - case KeyCode.UpArrow: - case KeyCode.DownArrow: - case KeyCode.LeftArrow: - case KeyCode.RightArrow: m_cameraSpeed = 1; break; - } - } - - void OnKeyboardDown() - { - //if( DebugConsoleWindow.DeveloperMode ) - //{ - // if( OnKeyboardPress( KeyCode.F8 ) ) - // { - // Shader currShader = CurrentGraph.CurrentShader; - // ShaderUtilEx.OpenCompiledShader( currShader, ShaderInspectorPlatformsPopupEx.GetCurrentMode(), ShaderInspectorPlatformsPopupEx.GetCurrentPlatformMask(), ShaderInspectorPlatformsPopupEx.GetCurrentVariantStripping() == 0 ); - - // string filename = Application.dataPath; - // filename = filename.Replace( "Assets", "Temp/Compiled-" ); - // string shaderFilename = AssetDatabase.GetAssetPath( currShader ); - // int lastIndex = shaderFilename.LastIndexOf( '/' ) + 1; - // filename = filename + shaderFilename.Substring( lastIndex ); - - // string compiledContents = IOUtils.LoadTextFileFromDisk( filename ); - // Debug.Log( compiledContents ); - // } - - // if( OnKeyboardPress( KeyCode.F9 ) ) - // { - // m_nodeExporterUtils.CalculateShaderInstructions( CurrentGraph.CurrentShader ); - // } - //} - - CheckKeyboardCameraDown(); - - if( m_lastKeyPressed == KeyCode.None ) - { - m_shortcutManager.ActivateShortcut( m_currentEvent.modifiers, m_currentEvent.keyCode, true ); - } - - if( m_currentEvent.control && m_currentEvent.shift && m_currentEvent.keyCode == KeyCode.V ) - { - PasteFromClipboard( false ); - } - - if( !m_altPressDown && ( OnKeyboardPress( KeyCode.LeftAlt ) || OnKeyboardPress( KeyCode.RightAlt ) || OnKeyboardPress( KeyCode.AltGr ) ) ) - { - m_altPressDown = true; - m_altAvailable = true; - m_altKeyStartPos = m_currentMousePos2D; - } - - if( m_currentEvent.keyCode != KeyCode.None && m_currentEvent.modifiers == EventModifiers.None ) - { - m_lastKeyPressed = m_currentEvent.keyCode; - } - } - - IEnumerator m_coroutine; - - private void StartPasteRequest() - { - m_coroutine = SendPostCoroutine( "http://paste.amplify.pt/api/create" ); - EditorApplication.update += PasteRequest; - } - - IEnumerator SendPostCoroutine( string url ) - { - WWWForm form = new WWWForm(); - form.AddField( "text", Clipboard.ClipboardId + ";" + EditorPrefs.GetString( Clipboard.ClipboardId, string.Empty ) ); - form.AddField( "title", "ASE Copy" ); - form.AddField( "name", "ASE" ); - form.AddField( "private", "1" ); - form.AddField( "lang", "text" ); - form.AddField( "expire", "0" ); - - UnityWebRequest www = UnityWebRequest.Post( url, form ); -#if UNITY_2017_2_OR_NEWER - www.SendWebRequest(); -#else - www.Send(); -#endif - - yield return www; - } - - public void PasteRequest() - { - UnityWebRequest www = (UnityWebRequest)m_coroutine.Current; - if( !m_coroutine.MoveNext() ) - { - if( !www.isDone ) - { - m_coroutine.MoveNext(); - } - else - { -#if UNITY_2020_1_OR_NEWER - if( www.result == UnityWebRequest.Result.ConnectionError ) -#elif UNITY_2017_2_OR_NEWER - if( www.isNetworkError ) -#else - if( www.isError ) -#endif - { - Debug.Log( "[AmplifyShaderEditor]\n" + www.error ); - } - else - { - // Print Body - string finalURL = www.downloadHandler.text; - - if( finalURL.IndexOf( "paste.amplify.pt/view/" ) > -1 ) - { - System.Text.RegularExpressions.Regex parser = new System.Text.RegularExpressions.Regex( @".*(http:\/\/paste.amplify.pt\/view\/)([0-9a-z]*).*", System.Text.RegularExpressions.RegexOptions.Singleline ); - finalURL = parser.Replace( finalURL, "$1raw/$2" ); - - ShowMessage( "Link copied to clipboard\n"+ finalURL, consoleLog:false ); - Debug.Log( "[AmplifyShaderEditor] Link copied to clipboard\n"+ finalURL+"\n" ); - // Copy Paste to clipboard - EditorGUIUtility.systemCopyBuffer = finalURL; - } - else - { - Debug.Log( "[AmplifyShaderEditor] Failed to generate paste:\n" + finalURL ); - } - } - EditorApplication.update -= PasteRequest; - } - } - } - - void OnScrollWheel() - { - ModifyZoomSmooth( m_currentEvent.delta.y, m_currentMousePos2D ); - UseCurrentEvent(); - } - - void ModifyZoom( float zoomIncrement, Vector2 pivot ) - { - float minCam = Mathf.Min( ( m_cameraInfo.width - ( m_nodeParametersWindow.RealWidth + m_paletteWindow.RealWidth ) ), ( m_cameraInfo.height - ( m_toolsWindow.Height ) ) ); - if( minCam < 1 ) - minCam = 1; - - float dynamicMaxZoom = m_mainGraphInstance.MaxNodeDist / minCam; - - Vector2 canvasPos = TranformPosition( pivot ); - if( zoomIncrement < 0 ) - CameraZoom = Mathf.Max( m_cameraZoom + zoomIncrement * Constants.CAMERA_ZOOM_SPEED, Constants.CAMERA_MIN_ZOOM ); - else if( CameraZoom < Mathf.Max( Constants.CAMERA_MAX_ZOOM, dynamicMaxZoom ) ) - CameraZoom = m_cameraZoom + zoomIncrement * Constants.CAMERA_ZOOM_SPEED;// Mathf.Min( m_cameraZoom + zoomIncrement * Constants.CAMERA_ZOOM_SPEED, Mathf.Max( Constants.CAMERA_MAX_ZOOM, dynamicMaxZoom ) ); - m_cameraOffset.x = pivot.x * m_cameraZoom - canvasPos.x; - m_cameraOffset.y = pivot.y * m_cameraZoom - canvasPos.y; - } - - void ModifyZoomSmooth( float zoomIncrement, Vector2 pivot ) - { - if( m_smoothZoom && Mathf.Sign( m_targetZoomIncrement * zoomIncrement ) >= 0 ) - m_targetZoomIncrement += zoomIncrement; - else - m_targetZoomIncrement = zoomIncrement; - - m_smoothZoom = true; - m_zoomTime = 0; - - float minCam = Mathf.Min( ( m_cameraInfo.width - ( m_nodeParametersWindow.RealWidth + m_paletteWindow.RealWidth ) ), ( m_cameraInfo.height - ( m_toolsWindow.Height ) ) ); - if( minCam < 1 ) - minCam = 1; - - float dynamicMaxZoom = m_mainGraphInstance.MaxNodeDist / minCam; - if( m_targetZoomIncrement < 0 ) - m_targetZoom = Mathf.Max( m_cameraZoom + m_targetZoomIncrement * Constants.CAMERA_ZOOM_SPEED, Constants.CAMERA_MIN_ZOOM ); - else if( CameraZoom < Mathf.Max( Constants.CAMERA_MAX_ZOOM, dynamicMaxZoom ) ) - m_targetZoom = m_cameraZoom + m_targetZoomIncrement * Constants.CAMERA_ZOOM_SPEED;// Mathf.Min( m_cameraZoom + zoomIncrement * Constants.CAMERA_ZOOM_SPEED, Mathf.Max( Constants.CAMERA_MAX_ZOOM, dynamicMaxZoom ) ); - - m_zoomPivot = pivot; - } - - void OnSelectionChange() - { - ForceRepaint(); - } - - private void OnFocus() - { - EditorGUI.FocusTextInControl( null ); -#if UNITY_2019_1_OR_NEWER - m_fixOnFocus = true; -#endif - } - - void OnLostFocus() - { - m_lostFocus = true; - m_multipleSelectionActive = false; - m_wireReferenceUtils.InvalidateReferences(); - if( m_genericMessageUI != null ) - m_genericMessageUI.CleanUpMessageStack(); - m_nodeParametersWindow.OnLostFocus(); - m_paletteWindow.OnLostFocus(); - m_contextMenu.ResetShortcutKeyStates(); - } - - void CopyToClipboard() - { - m_copyPasteDeltaMul = 0; - m_copyPasteDeltaPos = new Vector2( float.MaxValue, float.MaxValue ); - m_clipboard.ClearClipboard(); - m_copyPasteInitialPos = m_mainGraphInstance.SelectedNodesCentroid; - m_clipboard.AddToClipboard( m_mainGraphInstance.SelectedNodes, m_copyPasteInitialPos, m_mainGraphInstance ); - } - - ParentNode CreateNodeFromClipboardData( int clipId ) - { - string[] parameters = m_clipboard.CurrentClipboardStrData[ clipId ].Data.Split( IOUtils.FIELD_SEPARATOR ); - System.Type nodeType = System.Type.GetType( parameters[ IOUtils.NodeTypeId ] ); - NodeAttributes attributes = m_contextMenu.GetNodeAttributesForType( nodeType ); - if( attributes != null && !UIUtils.GetNodeAvailabilityInBitArray( attributes.NodeAvailabilityFlags, m_mainGraphInstance.CurrentCanvasMode ) && !UIUtils.GetNodeAvailabilityInBitArray( attributes.NodeAvailabilityFlags, m_currentNodeAvailability ) ) - return null; - - ParentNode newNode = (ParentNode)ScriptableObject.CreateInstance( nodeType ); - newNode.IsNodeBeingCopied = true; - if( newNode != null ) - { - newNode.ContainerGraph = m_mainGraphInstance; - newNode.ClipboardFullReadFromString( ref parameters ); - m_mainGraphInstance.AddNode( newNode, true, true, true, false ); - newNode.IsNodeBeingCopied = false; - m_clipboard.CurrentClipboardStrData[ clipId ].NewNodeId = newNode.UniqueId; - return newNode; - } - return null; - } - - void CreateConnectionsFromClipboardData( int clipId ) - { - if( String.IsNullOrEmpty( m_clipboard.CurrentClipboardStrData[ clipId ].Connections ) ) - return; - string[] lines = m_clipboard.CurrentClipboardStrData[ clipId ].Connections.Split( IOUtils.LINE_TERMINATOR ); - - for( int lineIdx = 0; lineIdx < lines.Length; lineIdx++ ) - { - string[] parameters = lines[ lineIdx ].Split( IOUtils.FIELD_SEPARATOR ); - - int InNodeId = 0; - int InPortId = 0; - int OutNodeId = 0; - int OutPortId = 0; - - try - { - InNodeId = Convert.ToInt32( parameters[ IOUtils.InNodeId ] ); - InPortId = Convert.ToInt32( parameters[ IOUtils.InPortId ] ); - - OutNodeId = Convert.ToInt32( parameters[ IOUtils.OutNodeId ] ); - OutPortId = Convert.ToInt32( parameters[ IOUtils.OutPortId ] ); - } - catch( Exception e ) - { - Debug.LogException( e ); - } - - - int newInNodeId = m_clipboard.GeNewNodeId( InNodeId ); - int newOutNodeId = m_clipboard.GeNewNodeId( OutNodeId ); - - if( newInNodeId > -1 && newOutNodeId > -1 ) - { - ParentNode inNode = m_mainGraphInstance.GetNode( newInNodeId ); - ParentNode outNode = m_mainGraphInstance.GetNode( newOutNodeId ); - - InputPort inputPort = null; - OutputPort outputPort = null; - - if( inNode != null && outNode != null ) - { - inNode.IsNodeBeingCopied = true; - outNode.IsNodeBeingCopied = true; - inputPort = inNode.GetInputPortByUniqueId( InPortId ); - outputPort = outNode.GetOutputPortByUniqueId( OutPortId ); - if( inputPort != null && outputPort != null ) - { - inputPort.ConnectTo( newOutNodeId, OutPortId, outputPort.DataType, false ); - outputPort.ConnectTo( newInNodeId, InPortId, inputPort.DataType, inputPort.TypeLocked ); - - inNode.OnInputPortConnected( InPortId, newOutNodeId, OutPortId ); - outNode.OnOutputPortConnected( OutPortId, newInNodeId, InPortId ); - } - - inNode.IsNodeBeingCopied = false; - outNode.IsNodeBeingCopied = false; - } - } - } - } - - private void StartGetRequest( string url ) - { - m_coroutine = SendGetCoroutine( url ); - EditorApplication.update += GetRequest; - } - - IEnumerator SendGetCoroutine( string url ) - { - UnityWebRequest www = UnityWebRequest.Get( url ); -#if UNITY_2017_2_OR_NEWER - www.SendWebRequest(); -#else - www.Send(); -#endif - - yield return www; - } - - public void GetRequest() - { - UnityWebRequest www = (UnityWebRequest)m_coroutine.Current; - if( !m_coroutine.MoveNext() ) - { - if( !www.isDone ) - { - m_coroutine.MoveNext(); - } - else - { -#if UNITY_2020_1_OR_NEWER - if( www.result == UnityWebRequest.Result.ConnectionError ) -#elif UNITY_2017_2_OR_NEWER - if( www.isNetworkError ) -#else - if( www.isError ) -#endif - { - Debug.Log( "[AmplifyShaderEditor]\n" + www.error ); - } - else - { - string data = www.downloadHandler.text; - if( data.IndexOf( Clipboard.ClipboardId + ";" ) > -1 ) - { - data = www.downloadHandler.text.Replace( Clipboard.ClipboardId + ";", "" ); - if( data.IndexOf( "<div " ) > -1 ) - { - System.Text.RegularExpressions.Regex parser = new System.Text.RegularExpressions.Regex( @"(.*)<div .*", System.Text.RegularExpressions.RegexOptions.Singleline ); - data = parser.Replace( data, "$1" ); - } - EditorGUIUtility.systemCopyBuffer = string.Empty; - Debug.Log( "[AmplifyShaderEditor] Successfully downloaded snippet!" ); - EditorPrefs.SetString( Clipboard.ClipboardId, data ); - try - { - // send paste event instead to make sure it runs properly - Event e = new Event(); - e.type = EventType.ExecuteCommand; - e.commandName = PasteCommand; - this.SendEvent( e ); - } - catch( Exception ) - { - EditorGUIUtility.systemCopyBuffer = string.Empty; - EditorApplication.update -= GetRequest; - throw; - } - } - else - { - Debug.Log( "[AmplifyShaderEditor] Error downloading, snippet might not exist anymore, clearing clipboard..." ); - EditorGUIUtility.systemCopyBuffer = string.Empty; - } - } - EditorApplication.update -= GetRequest; - } - } - } - - void PasteFromClipboard( bool copyConnections ) - { - string result = EditorGUIUtility.systemCopyBuffer; - if( result.IndexOf( "http://paste.amplify.pt/view/raw/" ) > -1 ) - { - StartGetRequest( result ); - return; - } - - if( result.IndexOf( Clipboard.ClipboardId + ";" ) > -1 ) - { - result = result.Replace( Clipboard.ClipboardId + ";", "" ); - EditorPrefs.SetString( Clipboard.ClipboardId, result ); - } - - m_mainGraphInstance.IsDuplicating = true; - m_copyPasteInitialPos = m_clipboard.GetDataFromEditorPrefs(); - if( m_clipboard.CurrentClipboardStrData.Count == 0 ) - { - return; - } - - Vector2 deltaPos = TranformedKeyEvtMousePos - m_copyPasteInitialPos; - if( ( m_copyPasteDeltaPos - deltaPos ).magnitude > 5.0f ) - { - m_copyPasteDeltaMul = 0; - } - else - { - m_copyPasteDeltaMul += 1; - } - m_copyPasteDeltaPos = deltaPos; - - m_mainGraphInstance.DeSelectAll(); - UIUtils.InhibitMessages = true; - - if( m_clipboard.CurrentClipboardStrData.Count > 0 ) - { - UIUtils.MarkUndoAction(); - Undo.RegisterCompleteObjectUndo( this, Constants.UndoPasteNodeId ); - } - - List<ParentNode> createdNodes = new List<ParentNode>(); - for( int i = 0; i < m_clipboard.CurrentClipboardStrData.Count; i++ ) - { - ParentNode node = CreateNodeFromClipboardData( i ); - if( node != null ) - { - m_clipboard.CurrentClipboardStrData[ i ].NewNodeId = node.UniqueId; - Vector2 pos = node.Vec2Position; - node.Vec2Position = pos + deltaPos + m_copyPasteDeltaMul * Constants.CopyPasteDeltaPos; - //node.RefreshExternalReferences(); - node.AfterDuplication(); - createdNodes.Add( node ); - m_mainGraphInstance.SelectNode( node, true, false ); - } - } - - if( copyConnections ) - { - for( int i = 0; i < m_clipboard.CurrentClipboardStrData.Count; i++ ) - { - CreateConnectionsFromClipboardData( i ); - } - } - - // Refresh external references must always be called after all nodes are created - for( int i = 0; i < createdNodes.Count; i++ ) - { - createdNodes[ i ].RefreshExternalReferences(); - } - createdNodes.Clear(); - createdNodes = null; - //Need to force increment on Undo because if not Undo may incorrectly group consecutive pastes - Undo.IncrementCurrentGroup(); - - UIUtils.InhibitMessages = false; - ShaderIsModified = true; - SetSaveIsDirty(); - ForceRepaint(); - m_mainGraphInstance.IsDuplicating = false; - } - - public string GenerateGraphInfo() - { - string graphInfo = IOUtils.ShaderBodyBegin + '\n'; - string nodesInfo = ""; - string connectionsInfo = ""; - graphInfo += VersionInfo.FullLabel + '\n'; - graphInfo += ( - m_cameraInfo.x.ToString() + IOUtils.FIELD_SEPARATOR + - m_cameraInfo.y.ToString() + IOUtils.FIELD_SEPARATOR + - m_cameraInfo.width.ToString() + IOUtils.FIELD_SEPARATOR + - m_cameraInfo.height.ToString() + IOUtils.FIELD_SEPARATOR + - m_cameraOffset.x.ToString() + IOUtils.FIELD_SEPARATOR + - m_cameraOffset.y.ToString() + IOUtils.FIELD_SEPARATOR + - m_cameraZoom.ToString() + IOUtils.FIELD_SEPARATOR + - m_nodeParametersWindow.IsMaximized + IOUtils.FIELD_SEPARATOR + - m_paletteWindow.IsMaximized + '\n' - ); - m_mainGraphInstance.OrderNodesByGraphDepth(); - m_mainGraphInstance.WriteToString( ref nodesInfo, ref connectionsInfo ); - graphInfo += nodesInfo; - graphInfo += connectionsInfo; - graphInfo += IOUtils.ShaderBodyEnd + '\n'; - - return graphInfo; - } - - // TODO: this need to be fused to the main load function somehow - public static void LoadFromMeta( ref ParentGraph graph, GraphContextMenu contextMenu, string meta ) - { - graph.IsLoading = true; - graph.CleanNodes(); - - int checksumId = meta.IndexOf( IOUtils.CHECKSUM ); - if( checksumId > -1 ) - { - string checkSumStoredValue = meta.Substring( checksumId ); - string trimmedBuffer = meta.Remove( checksumId ); - - string[] typeValuePair = checkSumStoredValue.Split( IOUtils.VALUE_SEPARATOR ); - if( typeValuePair != null && typeValuePair.Length == 2 ) - { - // Check read checksum and compare with the actual shader body to detect external changes - string currentChecksumValue = IOUtils.CreateChecksum( trimmedBuffer ); - if( DebugConsoleWindow.DeveloperMode && !currentChecksumValue.Equals( typeValuePair[ 1 ] ) ) - { - //ShowMessage( "Wrong checksum" ); - } - - trimmedBuffer = trimmedBuffer.Replace( "\r", string.Empty ); - // find node info body - int shaderBodyId = trimmedBuffer.IndexOf( IOUtils.ShaderBodyBegin ); - if( shaderBodyId > -1 ) - { - trimmedBuffer = trimmedBuffer.Substring( shaderBodyId ); - //Find set of instructions - string[] instructions = trimmedBuffer.Split( IOUtils.LINE_TERMINATOR ); - // First line is to be ignored and second line contains version - string[] versionParams = instructions[ 1 ].Split( IOUtils.VALUE_SEPARATOR ); - if( versionParams.Length == 2 ) - { - int version = 0; - try - { - version = Convert.ToInt32( versionParams[ 1 ] ); - } - catch( Exception e ) - { - Debug.LogException( e ); - } - - //if( version > versionInfo.FullNumber ) - //{ - //ShowMessage( "This shader was created on a new ASE version\nPlease install v." + version ); - //} - - if( DebugConsoleWindow.DeveloperMode ) - { - //if( version < versionInfo.FullNumber ) - //{ - //ShowMessage( "This shader was created on a older ASE version\nSaving will update it to the new one." ); - //} - } - - graph.LoadedShaderVersion = version; - } - else - { - //ShowMessage( "Corrupted version" ); - } - - // Dummy values,camera values can only be applied after node loading is complete - Rect dummyCameraInfo = new Rect(); - Vector2 dummyCameraOffset = new Vector2(); - //float dummyCameraZoom = 0; - //bool applyDummy = false; - //bool dummyNodeParametersWindowMaximized = false; - //bool dummyPaletteWindowMaximized = false; - - //Second line contains camera information ( position, size, offset and zoom ) - string[] cameraParams = instructions[ 2 ].Split( IOUtils.FIELD_SEPARATOR ); - if( cameraParams.Length == 9 ) - { - //applyDummy = true; - try - { - dummyCameraInfo.x = Convert.ToSingle( cameraParams[ 0 ] ); - dummyCameraInfo.y = Convert.ToSingle( cameraParams[ 1 ] ); - dummyCameraInfo.width = Convert.ToSingle( cameraParams[ 2 ] ); - dummyCameraInfo.height = Convert.ToSingle( cameraParams[ 3 ] ); - dummyCameraOffset.x = Convert.ToSingle( cameraParams[ 4 ] ); - dummyCameraOffset.y = Convert.ToSingle( cameraParams[ 5 ] ); - - //dummyCameraZoom = Convert.ToSingle( cameraParams[ 6 ] ); - //dummyNodeParametersWindowMaximized = Convert.ToBoolean( cameraParams[ 7 ] ); - //dummyPaletteWindowMaximized = Convert.ToBoolean( cameraParams[ 8 ] ); - } - catch( Exception e ) - { - Debug.LogException( e ); - } - } - else - { - //ShowMessage( "Camera parameters are corrupted" ); - } - - // valid instructions are only between the line after version and the line before the last one ( which contains ShaderBodyEnd ) - for( int instructionIdx = 3; instructionIdx < instructions.Length - 1; instructionIdx++ ) - { - //TODO: After all is working, convert string parameters to ints in order to speed up reading - string[] parameters = instructions[ instructionIdx ].Split( IOUtils.FIELD_SEPARATOR ); - - // All nodes must be created before wiring the connections ... - // Since all nodes on the save op are written before the wires, we can safely create them - // If that order is not maintained the it's because of external editing and its the users responsability - switch( parameters[ 0 ] ) - { - case IOUtils.NodeParam: - { - string typeStr = parameters[ IOUtils.NodeTypeId ]; - //System.Type type = System.Type.GetType( parameters[ IOUtils.NodeTypeId ] ); - System.Type type = System.Type.GetType( IOUtils.NodeTypeReplacer.ContainsKey( typeStr ) ? IOUtils.NodeTypeReplacer[ typeStr ] : typeStr ); - if( type != null ) - { - System.Type oldType = type; - NodeAttributes attribs = contextMenu.GetNodeAttributesForType( type ); - if( attribs == null ) - { - attribs = contextMenu.GetDeprecatedNodeAttributesForType( type ); - if( attribs != null ) - { - if( attribs.Deprecated && attribs.DeprecatedAlternativeType != null ) - { - type = attribs.DeprecatedAlternativeType; - //ShowMessage( string.Format( "Node {0} is deprecated and was replaced by {1} ", attribs.Name, attribs.DeprecatedAlternative ) ); - } - } - } - - ParentNode newNode = (ParentNode)ScriptableObject.CreateInstance( type ); - if( newNode != null ) - { - try - { - newNode.ContainerGraph = graph; - if( oldType != type ) - { - newNode.ParentReadFromString( ref parameters ); - newNode.ReadFromDeprecated( ref parameters, oldType ); - } - else - newNode.ReadFromString( ref parameters ); - - - if( oldType == type ) - { - newNode.ReadInputDataFromString( ref parameters ); - if( UIUtils.CurrentShaderVersion() > 5107 ) - { - newNode.ReadOutputDataFromString( ref parameters ); - } - } - } - catch( Exception e ) - { - Debug.LogException( e, newNode ); - } - graph.AddNode( newNode, false, true, false ); - } - } - else - { - UIUtils.ShowMessage( string.Format( "{0} is not a valid ASE node ", parameters[ IOUtils.NodeTypeId ] ), MessageSeverity.Error ); - } - } - break; - case IOUtils.WireConnectionParam: - { - int InNodeId = 0; - int InPortId = 0; - int OutNodeId = 0; - int OutPortId = 0; - - try - { - InNodeId = Convert.ToInt32( parameters[ IOUtils.InNodeId ] ); - InPortId = Convert.ToInt32( parameters[ IOUtils.InPortId ] ); - OutNodeId = Convert.ToInt32( parameters[ IOUtils.OutNodeId ] ); - OutPortId = Convert.ToInt32( parameters[ IOUtils.OutPortId ] ); - } - catch( Exception e ) - { - Debug.LogException( e ); - } - - ParentNode inNode = graph.GetNode( InNodeId ); - ParentNode outNode = graph.GetNode( OutNodeId ); - - //if ( UIUtils.CurrentShaderVersion() < 5002 ) - //{ - // InPortId = inNode.VersionConvertInputPortId( InPortId ); - // OutPortId = outNode.VersionConvertOutputPortId( OutPortId ); - //} - - InputPort inputPort = null; - OutputPort outputPort = null; - if( inNode != null && outNode != null ) - { - - if( UIUtils.CurrentShaderVersion() < 5002 ) - { - InPortId = inNode.VersionConvertInputPortId( InPortId ); - OutPortId = outNode.VersionConvertOutputPortId( OutPortId ); - - inputPort = inNode.GetInputPortByArrayId( InPortId ); - outputPort = outNode.GetOutputPortByArrayId( OutPortId ); - } - else - { - inputPort = inNode.GetInputPortByUniqueId( InPortId ); - outputPort = outNode.GetOutputPortByUniqueId( OutPortId ); - } - - if( inputPort != null && outputPort != null ) - { - bool inputCompatible = inputPort.CheckValidType( outputPort.DataType ); - bool outputCompatible = outputPort.CheckValidType( inputPort.DataType ); - if( inputCompatible && outputCompatible ) - { - inputPort.ConnectTo( OutNodeId, OutPortId, outputPort.DataType, false ); - outputPort.ConnectTo( InNodeId, InPortId, inputPort.DataType, inputPort.TypeLocked ); - - inNode.OnInputPortConnected( InPortId, OutNodeId, OutPortId, false ); - outNode.OnOutputPortConnected( OutPortId, InNodeId, InPortId ); - } - else if( DebugConsoleWindow.DeveloperMode ) - { - if( !inputCompatible ) - UIUtils.ShowIncompatiblePortMessage( true, inNode, inputPort, outNode, outputPort ); - - if( !outputCompatible ) - UIUtils.ShowIncompatiblePortMessage( true, outNode, outputPort, inNode, inputPort ); - } - } - else if( DebugConsoleWindow.DeveloperMode ) - { - if( inputPort == null ) - { - UIUtils.ShowMessage( "Input Port " + InPortId + " doesn't exist on node " + InNodeId, MessageSeverity.Error ); - } - else - { - UIUtils.ShowMessage( "Output Port " + OutPortId + " doesn't exist on node " + OutNodeId, MessageSeverity.Error ); - } - } - } - else if( DebugConsoleWindow.DeveloperMode ) - { - if( inNode == null ) - { - UIUtils.ShowMessage( "Input node " + InNodeId + " doesn't exist", MessageSeverity.Error ); - } - else - { - UIUtils.ShowMessage( "Output node " + OutNodeId + " doesn't exist", MessageSeverity.Error ); - } - } - } - break; - } - } - } - } - } - - graph.CheckForDuplicates(); - graph.UpdateRegisters(); - graph.RefreshExternalReferences(); - graph.ForceSignalPropagationOnMasterNode(); - graph.LoadedShaderVersion = VersionInfo.FullNumber; - //Reset(); - graph.IsLoading = false; - } - - public ShaderLoadResult LoadFromDisk( string pathname, AmplifyShaderFunction shaderFunction = null ) - { - m_mainGraphInstance.IsLoading = true; - System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture; - - FullCleanUndoStack(); - m_performFullUndoRegister = true; - - UIUtils.DirtyMask = false; - if( UIUtils.IsUnityNativeShader( pathname ) ) - { - ShowMessage( "Cannot edit native unity shaders.\nReplacing by a new one." ); - return ShaderLoadResult.UNITY_NATIVE_PATHS; - } - - m_lastOpenedLocation = pathname; - Lastpath = pathname; - - string buffer = string.Empty; - if( shaderFunction == null ) - buffer = IOUtils.LoadTextFileFromDisk( pathname ); - else - buffer = shaderFunction.FunctionInfo; - - if( String.IsNullOrEmpty( buffer ) ) - { - ShowMessage( "Could not open file " + pathname ); - return ShaderLoadResult.FILE_NOT_FOUND; - } - - if( !IOUtils.HasValidShaderBody( ref buffer ) ) - { - return ShaderLoadResult.ASE_INFO_NOT_FOUND; - } - - m_mainGraphInstance.CleanNodes(); - Reset(); - - Shader shader = null; - ShaderLoadResult loadResult = ShaderLoadResult.LOADED; - // Find checksum value on body - int checksumId = buffer.IndexOf( IOUtils.CHECKSUM ); - if( checksumId > -1 ) - { - string checkSumStoredValue = buffer.Substring( checksumId ); - string trimmedBuffer = buffer.Remove( checksumId ); - - string[] typeValuePair = checkSumStoredValue.Split( IOUtils.VALUE_SEPARATOR ); - if( typeValuePair != null && typeValuePair.Length == 2 ) - { - // Check read checksum and compare with the actual shader body to detect external changes - string currentChecksumValue = IOUtils.CreateChecksum( trimmedBuffer ); - if( DebugConsoleWindow.DeveloperMode && !currentChecksumValue.Equals( typeValuePair[ 1 ] ) ) - { - ShowMessage( "Wrong checksum" ); - } - - trimmedBuffer = trimmedBuffer.Replace( "\r", string.Empty ); - // find node info body - int shaderBodyId = trimmedBuffer.IndexOf( IOUtils.ShaderBodyBegin ); - if( shaderBodyId > -1 ) - { - trimmedBuffer = trimmedBuffer.Substring( shaderBodyId ); - //Find set of instructions - string[] instructions = trimmedBuffer.Split( IOUtils.LINE_TERMINATOR ); - // First line is to be ignored and second line contains version - string[] versionParams = instructions[ 1 ].Split( IOUtils.VALUE_SEPARATOR ); - if( versionParams.Length == 2 ) - { - int version = 0; - try - { - version = Convert.ToInt32( versionParams[ 1 ] ); - } - catch( Exception e ) - { - Debug.LogException( e ); - } - - if( version > VersionInfo.FullNumber ) - { - ShowMessage( "This shader was created on a new ASE version\nPlease install v." + version ); - } - - if( DebugConsoleWindow.DeveloperMode ) - { - if( version < VersionInfo.FullNumber ) - { - ShowMessage( "This shader was created on a older ASE version\nSaving will update it to the new one." ); - } - } - - m_mainGraphInstance.LoadedShaderVersion = version; - } - else - { - ShowMessage( "Corrupted version" ); - } - - // Dummy values,camera values can only be applied after node loading is complete - Rect dummyCameraInfo = new Rect(); - Vector2 dummyCameraOffset = new Vector2(); - float dummyCameraZoom = 0; - bool applyDummy = false; - bool dummyNodeParametersWindowMaximized = false; - bool dummyPaletteWindowMaximized = false; - - //Second line contains camera information ( position, size, offset and zoom ) - string[] cameraParams = instructions[ 2 ].Split( IOUtils.FIELD_SEPARATOR ); - if( cameraParams.Length == 9 ) - { - applyDummy = true; - try - { - dummyCameraInfo.x = Convert.ToSingle( cameraParams[ 0 ] ); - dummyCameraInfo.y = Convert.ToSingle( cameraParams[ 1 ] ); - dummyCameraInfo.width = Convert.ToSingle( cameraParams[ 2 ] ); - dummyCameraInfo.height = Convert.ToSingle( cameraParams[ 3 ] ); - dummyCameraOffset.x = Convert.ToSingle( cameraParams[ 4 ] ); - dummyCameraOffset.y = Convert.ToSingle( cameraParams[ 5 ] ); - dummyCameraZoom = Convert.ToSingle( cameraParams[ 6 ] ); - - float centerWidth = ( this.position.width - dummyCameraInfo.width ) * 0.5f * dummyCameraZoom; - float centerHeight = ( this.position.height - dummyCameraInfo.height ) * 0.5f * dummyCameraZoom; - - dummyCameraInfo.x += centerWidth; - dummyCameraOffset.x += centerWidth; - dummyCameraInfo.y += centerHeight; - dummyCameraOffset.y += centerHeight; - dummyNodeParametersWindowMaximized = Convert.ToBoolean( cameraParams[ 7 ] ); - dummyPaletteWindowMaximized = Convert.ToBoolean( cameraParams[ 8 ] ); - } - catch( Exception e ) - { - Debug.LogException( e ); - } - } - else - { - ShowMessage( "Camera parameters are corrupted" ); - } - - // valid instructions are only between the line after version and the line before the last one ( which contains ShaderBodyEnd ) - for( int instructionIdx = 3; instructionIdx < instructions.Length - 1; instructionIdx++ ) - { - //TODO: After all is working, convert string parameters to ints in order to speed up reading - string[] parameters = instructions[ instructionIdx ].Split( IOUtils.FIELD_SEPARATOR ); - - // All nodes must be created before wiring the connections ... - // Since all nodes on the save op are written before the wires, we can safely create them - // If that order is not maintained the it's because of external editing and its the users responsability - switch( parameters[ 0 ] ) - { - case IOUtils.NodeParam: - { - string typeStr = parameters[ IOUtils.NodeTypeId ]; - System.Type type = System.Type.GetType( IOUtils.NodeTypeReplacer.ContainsKey( typeStr ) ? IOUtils.NodeTypeReplacer[ typeStr ] : typeStr ); - if( type != null ) - { - System.Type oldType = type; - NodeAttributes attribs = m_contextMenu.GetNodeAttributesForType( type ); - if( attribs == null ) - { - attribs = m_contextMenu.GetDeprecatedNodeAttributesForType( type ); - if( attribs != null ) - { - if( attribs.Deprecated ) - { - if( attribs.DeprecatedAlternativeType != null ) - { - type = attribs.DeprecatedAlternativeType; - ShowMessage( string.Format( "Node {0} is deprecated and was replaced by {1} ", attribs.Name, attribs.DeprecatedAlternative ) ); - } - else - { - if( string.IsNullOrEmpty( attribs.DeprecatedAlternative ) ) - ShowMessage( string.Format( Constants.DeprecatedNoAlternativeMessageStr, attribs.Name, attribs.DeprecatedAlternative ), MessageSeverity.Normal, false ); - else - ShowMessage( string.Format( Constants.DeprecatedMessageStr, attribs.Name, attribs.DeprecatedAlternative ), MessageSeverity.Normal, false ); - } - } - } - } - - ParentNode newNode = (ParentNode)ScriptableObject.CreateInstance( type ); - if( newNode != null ) - { - try - { - newNode.ContainerGraph = m_mainGraphInstance; - if( oldType != type ) - { - newNode.ParentReadFromString( ref parameters ); - newNode.ReadFromDeprecated( ref parameters, oldType ); - } - else - newNode.ReadFromString( ref parameters ); - - - if( oldType == type ) - { - newNode.ReadInputDataFromString( ref parameters ); - if( UIUtils.CurrentShaderVersion() > 5107 ) - { - newNode.ReadOutputDataFromString( ref parameters ); - } - } - } - catch( Exception e ) - { - Debug.LogException( e, newNode ); - } - m_mainGraphInstance.AddNode( newNode, false, true, false ); - } - } - else - { - ShowMessage( string.Format( "{0} is not a valid ASE node ", parameters[ IOUtils.NodeTypeId ] ), MessageSeverity.Error ); - } - } - break; - case IOUtils.WireConnectionParam: - { - int InNodeId = 0; - int InPortId = 0; - int OutNodeId = 0; - int OutPortId = 0; - - try - { - InNodeId = Convert.ToInt32( parameters[ IOUtils.InNodeId ] ); - InPortId = Convert.ToInt32( parameters[ IOUtils.InPortId ] ); - OutNodeId = Convert.ToInt32( parameters[ IOUtils.OutNodeId ] ); - OutPortId = Convert.ToInt32( parameters[ IOUtils.OutPortId ] ); - } - catch( Exception e ) - { - Debug.LogException( e ); - } - - ParentNode inNode = m_mainGraphInstance.GetNode( InNodeId ); - ParentNode outNode = m_mainGraphInstance.GetNode( OutNodeId ); - - //if ( UIUtils.CurrentShaderVersion() < 5002 ) - //{ - // InPortId = inNode.VersionConvertInputPortId( InPortId ); - // OutPortId = outNode.VersionConvertOutputPortId( OutPortId ); - //} - - InputPort inputPort = null; - OutputPort outputPort = null; - if( inNode != null && outNode != null ) - { - - if( UIUtils.CurrentShaderVersion() < 5002 ) - { - InPortId = inNode.VersionConvertInputPortId( InPortId ); - OutPortId = outNode.VersionConvertOutputPortId( OutPortId ); - - inputPort = inNode.GetInputPortByArrayId( InPortId ); - outputPort = outNode.GetOutputPortByArrayId( OutPortId ); - } - else - { - inputPort = inNode.GetInputPortByUniqueId( InPortId ); - outputPort = outNode.GetOutputPortByUniqueId( OutPortId ); - } - - if( inputPort != null && outputPort != null ) - { - bool inputCompatible = inputPort.CheckValidType( outputPort.DataType ); - bool outputCompatible = outputPort.CheckValidType( inputPort.DataType ); - if( inputCompatible && outputCompatible ) - { - inputPort.ConnectTo( OutNodeId, OutPortId, outputPort.DataType, false ); - outputPort.ConnectTo( InNodeId, InPortId, inputPort.DataType, inputPort.TypeLocked ); - - inNode.OnInputPortConnected( InPortId, OutNodeId, OutPortId, false ); - outNode.OnOutputPortConnected( OutPortId, InNodeId, InPortId ); - } - else if( DebugConsoleWindow.DeveloperMode ) - { - if( !inputCompatible ) - UIUtils.ShowIncompatiblePortMessage( true, inNode, inputPort, outNode, outputPort ); - - if( !outputCompatible ) - UIUtils.ShowIncompatiblePortMessage( true, outNode, outputPort, inNode, inputPort ); - } - } - else if( DebugConsoleWindow.DeveloperMode ) - { - if( inputPort == null ) - { - UIUtils.ShowMessage( "Input Port " + InPortId + " doesn't exist on node " + InNodeId, MessageSeverity.Error ); - } - else - { - UIUtils.ShowMessage( "Output Port " + OutPortId + " doesn't exist on node " + OutNodeId, MessageSeverity.Error ); - } - } - } - else if( DebugConsoleWindow.DeveloperMode ) - { - if( inNode == null ) - { - UIUtils.ShowMessage( "Input node " + InNodeId + " doesn't exist", MessageSeverity.Error ); - } - else - { - UIUtils.ShowMessage( "Output node " + OutNodeId + " doesn't exist", MessageSeverity.Error ); - } - } - } - break; - } - } - - if( shaderFunction != null ) - { - m_onLoadDone = 2; - if( applyDummy ) - { - m_cameraInfo = dummyCameraInfo; - m_cameraOffset = dummyCameraOffset; - CameraZoom = dummyCameraZoom; - if( DebugConsoleWindow.UseShaderPanelsInfo ) - { - m_nodeParametersWindowMaximized = m_nodeParametersWindow.IsMaximized = dummyNodeParametersWindowMaximized; - m_paletteWindowMaximized = m_paletteWindow.IsMaximized = dummyPaletteWindowMaximized; - } - } - - } - else - { - shader = AssetDatabase.LoadAssetAtPath<Shader>( pathname ); - if( shader ) - { - - m_onLoadDone = 2; - if( applyDummy ) - { - m_cameraInfo = dummyCameraInfo; - m_cameraOffset = dummyCameraOffset; - CameraZoom = dummyCameraZoom; - if( DebugConsoleWindow.UseShaderPanelsInfo ) - { - m_nodeParametersWindowMaximized = m_nodeParametersWindow.IsMaximized = dummyNodeParametersWindowMaximized; - m_paletteWindowMaximized = m_paletteWindow.IsMaximized = dummyPaletteWindowMaximized; - } - } - } - else - { - ShowMessage( "Could not load shader asset" ); - } - } - } - else - { - ShowMessage( "Graph info not found" ); - } - } - else - { - ShowMessage( "Corrupted checksum" ); - } - } - else - { - ShowMessage( "Checksum not found" ); - } - - //m_mainGraphInstance.LoadedShaderVersion = m_versionInfo.FullNumber; - if( UIUtils.CurrentMasterNode() ) - UIUtils.CurrentMasterNode().ForcePortType(); - - UIUtils.DirtyMask = true; - m_checkInvalidConnections = true; - - m_mainGraphInstance.CheckForDuplicates(); - m_mainGraphInstance.UpdateRegisters(); - m_mainGraphInstance.RefreshExternalReferences(); - m_mainGraphInstance.ForceSignalPropagationOnMasterNode(); - - if( shaderFunction != null ) - { - //if( CurrentGraph.CurrentFunctionOutput == null ) - //{ - // //Fix in case a function output node is not marked as main node - // CurrentGraph.AssignMasterNode( UIUtils.FunctionOutputList()[ 0 ], false ); - //} - shaderFunction.ResetDirectivesOrigin(); - CurrentGraph.CurrentShaderFunction = shaderFunction; - } - else - { - if( shader != null ) - { - m_mainGraphInstance.UpdateShaderOnMasterNode( shader ); - if( m_mainGraphInstance.CurrentCanvasMode == NodeAvailability.TemplateShader ) - { - m_mainGraphInstance.RefreshLinkedMasterNodes( false ); - m_mainGraphInstance.OnRefreshLinkedPortsComplete(); - //m_mainGraphInstance.SetLateOptionsRefresh(); - } - } - } - - - m_mainGraphInstance.LoadedShaderVersion = VersionInfo.FullNumber; - - System.Threading.Thread.CurrentThread.CurrentCulture = System.Threading.Thread.CurrentThread.CurrentUICulture; - - m_mainGraphInstance.IsLoading = false; - //Remove focus from UI elements so no UI is incorrectly selected from previous loads - //Shader Name textfield was sometimes incorrectly selected - GUI.FocusControl( null ); - return loadResult; - } - - public void FullCleanUndoStack() - { - Undo.ClearUndo( this ); - m_mainGraphInstance.FullCleanUndoStack(); - } - - public void FullRegisterOnUndoStack() - { - Undo.RegisterCompleteObjectUndo( this, Constants.UndoRegisterFullGrapId ); - m_mainGraphInstance.FullRegisterOnUndoStack(); - } - - public void ShowPortInfo() - { - GetWindow<PortLegendInfo>(); - } - - public void ShowShaderLibrary() - { - GetWindow<ShaderLibrary>(); - } - - public void ShowMessage( string message, MessageSeverity severity = MessageSeverity.Normal, bool registerTimestamp = true, bool consoleLog = false ) - { - ShowMessage( -1, message, severity, registerTimestamp, consoleLog ); - } - - public void ShowMessage( int messageOwner, string message, MessageSeverity severity = MessageSeverity.Normal, bool registerTimestamp = true, bool consoleLog = false ) - { - if( UIUtils.InhibitMessages || m_genericMessageUI == null ) - return; - - m_consoleLogWindow.AddMessage( severity, message , messageOwner); - - MarkToRepaint(); - - if( consoleLog ) - { - switch( severity ) - { - case MessageSeverity.Normal: - { - Debug.Log( message ); - } - break; - case MessageSeverity.Warning: - { - Debug.LogWarning( message ); - } - break; - case MessageSeverity.Error: - { - Debug.LogError( message ); - } - break; - } - } - } - - // NOTE: this can probably be removed safely - public void ShowMessageImmediately( string message, MessageSeverity severity = MessageSeverity.Normal, bool consoleLog = true ) - { - if( UIUtils.InhibitMessages ) - return; - - switch( severity ) - { - case MessageSeverity.Normal: - { - m_genericMessageContent.text = message; - if( consoleLog ) - { - Debug.Log( message ); - } - } - break; - case MessageSeverity.Warning: - { - m_genericMessageContent.text = "Warning!\n" + message; - if( consoleLog ) - { - Debug.LogWarning( message ); - } - } - break; - case MessageSeverity.Error: - { - m_genericMessageContent.text = "Error!!!\n" + message; - if( consoleLog ) - { - Debug.LogError( message ); - } - } - break; - } - - try - { - ShowNotification( m_genericMessageContent ); - } - catch( Exception e ) - { - Debug.LogException( e ); - } - } - - public bool MouseInteracted = false; - -#if UNITY_2019_1_OR_NEWER - private bool m_fixOnFocus = false; - private bool m_fixFocusRepaint = false; -#endif - void OnGUI() - { -#if UNITY_2019_1_OR_NEWER - // hack fix for mouse selecting text fields when window is opening or window not focused? - if( m_fixFocusRepaint && Event.current.type == EventType.Repaint ) - { - // hack over hack: makes texture fields selectable again when window is not focused - if( ( EditorGUIUtility.editingTextField && EditorGUIUtility.hotControl != 0 ) || - !( EditorGUIUtility.editingTextField && EditorGUIUtility.hotControl == EditorGUIUtility.keyboardControl && EditorGUIUtility.keyboardControl != 0 ) - ) - { - EditorGUI.FocusTextInControl( null ); - GUIUtility.keyboardControl = 0; - } - - m_fixOnFocus = false; - m_fixFocusRepaint = false; - } - - if( m_fixOnFocus && ( Event.current.type == EventType.Used || Event.current.type == EventType.MouseDown ) ) - { - m_fixFocusRepaint = true; - } -#endif - - -#if UNITY_2018_3_OR_NEWER - if( ASEPackageManagerHelper.CheckImporter ) - return; -#endif - -#if UNITY_EDITOR_WIN - if( m_openSavedFolder && Event.current.type == EventType.Repaint ) - { - OpenSavedFolder(); - return; - } -#endif - AmplifyShaderEditorWindow cacheWindow = UIUtils.CurrentWindow; - UIUtils.CurrentWindow = this; - - if( !m_initialized || (object)UIUtils.MainSkin == null || !UIUtils.Initialized ) - { - UIUtils.InitMainSkin(); - Init(); - } - - m_currentEvent = Event.current; - if( m_currentEvent.type == EventType.ExecuteCommand || m_currentEvent.type == EventType.ValidateCommand ) - m_currentCommandName = m_currentEvent.commandName; - else - m_currentCommandName = string.Empty; - - System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture; - - MouseInteracted = false; - - if( m_refreshOnUndo ) - { - m_refreshOnUndo = false; - m_mainGraphInstance.RefreshOnUndo(); - } - - if( m_refreshAvailableNodes ) - { - RefreshAvaibleNodes(); - } - - if( m_previousShaderFunction != CurrentGraph.CurrentShaderFunction ) - { - m_nodeParametersWindow.ForceUpdate = true; - m_previousShaderFunction = CurrentGraph.CurrentShaderFunction; - } - - if( m_nodeToFocus != null && m_currentEvent.type == EventType.Layout ) - { - FocusOnNode( m_nodeToFocus, m_zoomToFocus, m_selectNodeToFocus ); - m_nodeToFocus = null; - } - - m_mainGraphInstance.OnDuplicateEventWrapper(); - - m_currentInactiveTime = CalculateInactivityTime(); - - if( m_nodeParametersWindow != null && m_innerEditorVariables.NodeParametersMaximized != m_nodeParametersWindow.IsMaximized ) - m_innerEditorVariables.NodeParametersMaximized = m_nodeParametersWindow.IsMaximized; - if( m_paletteWindow != null && m_innerEditorVariables.NodePaletteMaximized != m_paletteWindow.IsMaximized ) - m_innerEditorVariables.NodePaletteMaximized = m_paletteWindow.IsMaximized; - - if( m_checkInvalidConnections ) - { - m_checkInvalidConnections = false; - m_mainGraphInstance.DeleteInvalidConnections(); - } - - //if ( m_repaintIsDirty ) - //{ - // m_repaintIsDirty = false; - // ForceRepaint(); - //} - - if( m_forcingMaterialUpdateFlag ) - { - Focus(); - if( m_materialsToUpdate.Count > 0 ) - { - float percentage = 100.0f * (float)( UIUtils.TotalExampleMaterials - m_materialsToUpdate.Count ) / (float)UIUtils.TotalExampleMaterials; - if( m_forcingMaterialUpdateOp ) // Read - { - Debug.Log( percentage + "% Recompiling " + m_materialsToUpdate[ 0 ].name ); - LoadDroppedObject( true, m_materialsToUpdate[ 0 ].shader, m_materialsToUpdate[ 0 ] ); - } - else // Write - { - Debug.Log( percentage + "% Saving " + m_materialsToUpdate[ 0 ].name ); - SaveToDisk( false ); - m_materialsToUpdate.RemoveAt( 0 ); - } - m_forcingMaterialUpdateOp = !m_forcingMaterialUpdateOp; - } - else - { - Debug.Log( "100% - All Materials compiled " ); - m_forcingMaterialUpdateFlag = false; - } - } - - - if( m_removedKeyboardFocus ) - { - m_removedKeyboardFocus = false; - GUIUtility.keyboardControl = 0; - } - - - Vector2 pos = m_currentEvent.mousePosition; - pos.x += position.x; - pos.y += position.y; - m_insideEditorWindow = position.Contains( pos ); - - if( m_delayedLoadObject != null && m_mainGraphInstance.CurrentMasterNode != null ) - { - m_mainGraphInstance.SetLateOptionsRefresh(); - LoadObject( m_delayedLoadObject ); - m_delayedLoadObject = null; - } - else if( m_delayedLoadObject != null && m_mainGraphInstance.CurrentOutputNode != null ) - { - m_mainGraphInstance.SetLateOptionsRefresh(); - LoadObject( m_delayedLoadObject ); - m_delayedLoadObject = null; - } - - if( m_delayedMaterialSet != null && m_mainGraphInstance.CurrentMasterNode != null ) - { - m_mainGraphInstance.UpdateMaterialOnMasterNode( m_delayedMaterialSet ); - m_mainGraphInstance.SetMaterialModeOnGraph( m_delayedMaterialSet ); - CurrentSelection = ASESelectionMode.Material; - IsShaderFunctionWindow = false; - m_delayedMaterialSet = null; - } - - Material currentMaterial = m_mainGraphInstance.CurrentMaterial; - if( m_forceUpdateFromMaterialFlag ) - { - Focus(); - m_forceUpdateFromMaterialFlag = false; - if( currentMaterial != null ) - { - m_mainGraphInstance.CopyValuesFromMaterial( currentMaterial ); - m_repaintIsDirty = true; - } - } - - m_repaintCount = 0; - m_cameraInfo = position; - - //if( m_currentEvent.type == EventType.keyDown ) - if( m_currentEvent.type == EventType.Repaint ) - m_keyEvtMousePos2D = m_currentEvent.mousePosition; - - m_currentMousePos2D = m_currentEvent.mousePosition; - m_currentMousePos.x = m_currentMousePos2D.x; - m_currentMousePos.y = m_currentMousePos2D.y; - - m_graphArea.width = m_cameraInfo.width; - m_graphArea.height = m_cameraInfo.height; - - m_autoPanDirActive = m_lmbPressed || m_forceAutoPanDir || m_multipleSelectionActive || m_wireReferenceUtils.ValidReferences(); - - - // Need to use it in order to prevent Mismatched LayoutGroup on ValidateCommand when rendering nodes - //if( Event.current.type == EventType.ValidateCommand ) - //{ - // Event.current.Use(); - //} - - // Nodes Graph background area - //GUILayout.BeginArea( m_graphArea, "Nodes" ); - { - // Camera movement is simulated by grabing the current camera offset, transforming it into texture space and manipulating the tiled texture uv coords - GUI.DrawTextureWithTexCoords( m_graphArea, m_graphBgTexture, - new Rect( ( -m_cameraOffset.x / m_graphBgTexture.width ), - ( m_cameraOffset.y / m_graphBgTexture.height ) - m_cameraZoom * m_cameraInfo.height / m_graphBgTexture.height, - m_cameraZoom * m_cameraInfo.width / m_graphBgTexture.width, - m_cameraZoom * m_cameraInfo.height / m_graphBgTexture.height ) ); - - Color col = GUI.color; - GUI.color = new Color( 1, 1, 1, 0.7f ); - GUI.DrawTexture( m_graphArea, m_graphFgTexture, ScaleMode.StretchToFill, true ); - GUI.color = col; - } - //GUILayout.EndArea(); - - if( DebugConsoleWindow.DeveloperMode && m_currentEvent.type == EventType.Repaint ) - { - GUI.Label( new Rect(Screen.width - 60, 40, 60, 50), m_fpsDisplay ); - } - - bool restoreMouse = false; - if( InsideMenus( m_currentMousePos2D ) /*|| _confirmationWindow.IsActive*/ ) - { - if( Event.current.type == EventType.MouseDown ) - { - restoreMouse = true; - Event.current.type = EventType.Ignore; - } - - // Must guarantee that mouse up ops on menus will reset auto pan if it is set - if( m_currentEvent.type == EventType.MouseUp && m_currentEvent.button == ButtonClickId.LeftMouseButton ) - { - m_lmbPressed = false; - } - - } - // Nodes - //GUILayout.BeginArea( m_graphArea ); - { - m_drawInfo.CameraArea = m_cameraInfo; - m_drawInfo.TransformedCameraArea = m_graphArea; - - m_drawInfo.MousePosition = m_currentMousePos2D; - m_drawInfo.CameraOffset = m_cameraOffset; - m_drawInfo.InvertedZoom = 1 / m_cameraZoom; - m_drawInfo.LeftMouseButtonPressed = m_currentEvent.button == ButtonClickId.LeftMouseButton; - m_drawInfo.CurrentEventType = m_currentEvent.type; - m_drawInfo.ZoomChanged = m_zoomChanged; - - m_drawInfo.TransformedMousePos = m_currentMousePos2D * m_cameraZoom - m_cameraOffset; - - if( m_drawInfo.CurrentEventType == EventType.Repaint ) - UIUtils.UpdateMainSkin( m_drawInfo ); - - // Draw mode indicator - m_modeWindow.Draw( m_graphArea, m_currentMousePos2D, m_mainGraphInstance.CurrentShader, currentMaterial, - 0.5f * ( m_graphArea.width - m_paletteWindow.RealWidth - m_nodeParametersWindow.RealWidth ), - ( m_nodeParametersWindow.IsMaximized ? m_nodeParametersWindow.RealWidth : 0 ), - ( m_paletteWindow.IsMaximized ? m_paletteWindow.RealWidth : 0 )/*, m_openedAssetFromNode*/ ); - - PreTestLeftMouseDown(); - //m_consoleLogWindow.Draw( m_graphArea, m_currentMousePos2D, m_currentEvent.button, false, m_paletteWindow.IsMaximized ? m_paletteWindow.RealWidth : 0 ); - //m_mainGraphInstance.DrawBezierBoundingBox(); - //CheckNodeReplacement(); - - // Main Graph Draw - m_repaintIsDirty = m_mainGraphInstance.Draw( m_drawInfo ) || m_repaintIsDirty; - - m_mainGraphInstance.DrawGrid( m_drawInfo ); - bool hasUnusedConnNodes = m_mainGraphInstance.HasUnConnectedNodes; - m_toolsWindow.SetStateOnButton( ToolButtonType.CleanUnusedNodes, hasUnusedConnNodes ? 1 : 0 ); - - m_zoomChanged = false; - - MasterNode masterNode = m_mainGraphInstance.CurrentMasterNode; - if( masterNode != null ) - { - m_toolsWindow.DrawShaderTitle( m_nodeParametersWindow, m_paletteWindow, AvailableCanvasWidth, m_graphArea.height, masterNode.CroppedShaderName ); - } - else if( m_mainGraphInstance.CurrentOutputNode != null ) - { - string functionName = string.Empty; - - if( m_mainGraphInstance.CurrentShaderFunction != null ) - functionName = m_mainGraphInstance.CurrentShaderFunction.FunctionName; - m_toolsWindow.DrawShaderTitle( m_nodeParametersWindow, m_paletteWindow, AvailableCanvasWidth, m_graphArea.height, functionName ); - } - } - //m_consoleLogWindow.Draw( m_graphArea, m_currentMousePos2D, m_currentEvent.button, false, m_paletteWindow.IsMaximized ? m_paletteWindow.RealWidth : 0 ); - //GUILayout.EndArea(); - - if( restoreMouse ) - { - Event.current.type = EventType.MouseDown; - m_drawInfo.CurrentEventType = EventType.MouseDown; - } - - m_toolsWindow.InitialX = m_nodeParametersWindow.RealWidth; - m_toolsWindow.Width = m_cameraInfo.width - ( m_nodeParametersWindow.RealWidth + m_paletteWindow.RealWidth ); - m_toolsWindow.Draw( m_cameraInfo, m_currentMousePos2D, m_currentEvent.button, false ); - - m_tipsWindow.Draw( m_cameraInfo, m_currentMousePos2D, m_currentEvent.button, false ); - - bool autoMinimize = false; - if( position.width < m_lastWindowWidth && position.width < Constants.MINIMIZE_WINDOW_LOCK_SIZE ) - { - autoMinimize = true; - } - - if( autoMinimize ) - m_nodeParametersWindow.IsMaximized = false; - - ParentNode selectedNode = ( m_mainGraphInstance.SelectedNodes.Count == 1 ) ? m_mainGraphInstance.SelectedNodes[ 0 ] : m_mainGraphInstance.CurrentMasterNode; - m_repaintIsDirty = m_nodeParametersWindow.Draw( m_cameraInfo, selectedNode, m_currentMousePos2D, m_currentEvent.button, false ) || m_repaintIsDirty; //TODO: If multiple nodes from the same type are selected also show a parameters window which modifies all of them - if( m_nodeParametersWindow.IsResizing ) - m_repaintIsDirty = true; - - // Test to ignore mouse on main palette when inside context palette ... IsInside also takes active state into account - bool ignoreMouseForPalette = m_contextPalette.IsInside( m_currentMousePos2D ); - if( ignoreMouseForPalette && Event.current.type == EventType.MouseDown ) - { - Event.current.type = EventType.Ignore; - m_drawInfo.CurrentEventType = EventType.Ignore; - } - if( autoMinimize ) - m_paletteWindow.IsMaximized = false; - - m_paletteWindow.Draw( m_cameraInfo, m_currentMousePos2D, m_currentEvent.button, !m_contextPalette.IsActive ); - if( m_paletteWindow.IsResizing ) - { - m_repaintIsDirty = true; - } - - if( ignoreMouseForPalette ) - { - if( restoreMouse ) - { - Event.current.type = EventType.MouseDown; - m_drawInfo.CurrentEventType = EventType.MouseDown; - } - } - - m_consoleLogWindow.Draw( m_graphArea, m_currentMousePos2D, m_currentEvent.button, false, m_paletteWindow.IsMaximized ? m_paletteWindow.RealWidth : 0 ); - - if( m_contextPalette.IsActive ) - { - m_contextPalette.Draw( m_cameraInfo, m_currentMousePos2D, m_currentEvent.button, m_contextPalette.IsActive ); - } - - if( m_palettePopup.IsActive ) - { - m_palettePopup.Draw( m_currentMousePos2D ); - m_repaintIsDirty = true; - int controlID = GUIUtility.GetControlID( FocusType.Passive ); - if( m_currentEvent.GetTypeForControl( controlID ) == EventType.MouseUp ) - { - if( m_currentEvent.button == ButtonClickId.LeftMouseButton ) - { - m_palettePopup.Deactivate(); - if( !InsideMenus( m_currentMousePos2D ) ) - { - ParentNode newNode = CreateNode( m_paletteChosenType, TranformedMousePos, m_paletteChosenFunction ); - //Debug.Log("created menu"); - m_mainGraphInstance.SelectNode( newNode, false, false ); - - bool find = false; - if( newNode is FunctionNode && CurrentGraph.CurrentShaderFunction != null ) - find = SearchFunctionNodeRecursively( CurrentGraph.CurrentShaderFunction ); - - if( find ) - { - DestroyNode( newNode, false ); - ShowMessage( "Shader Function loop detected, new node was removed to prevent errors." ); - } - else - { - newNode.RefreshExternalReferences(); - } - } - } - } - } - - // Handle all events ( mouse interaction + others ) - if( !MouseInteracted ) - HandleGUIEvents(); - - if( m_currentEvent.type == EventType.Repaint ) - { - m_mainGraphInstance.UpdateMarkForDeletion(); - } - // UI Overlay - // Selection Box - if( m_multipleSelectionActive ) - { - UpdateSelectionArea(); - Rect transformedArea = m_multipleSelectionArea; - transformedArea.position = ( transformedArea.position + m_cameraOffset ) / m_cameraZoom; - transformedArea.size /= m_cameraZoom; - - if( transformedArea.width < 0 ) - { - transformedArea.width = -transformedArea.width; - transformedArea.x -= transformedArea.width; - } - - if( transformedArea.height < 0 ) - { - transformedArea.height = -transformedArea.height; - transformedArea.y -= transformedArea.height; - } - Color original = GUI.color; - GUI.color = Constants.BoxSelectionColor; - GUI.Label( transformedArea, "", UIUtils.Box ); - GUI.color = original; - //GUI.backgroundColor = original; - } - - bool isResizing = m_nodeParametersWindow.IsResizing || m_paletteWindow.IsResizing; - //Test boundaries for auto-pan - if( !isResizing && m_autoPanDirActive ) - { - m_autoPanArea[ (int)AutoPanLocation.LEFT ].AdjustInitialX = m_nodeParametersWindow.IsMaximized ? m_nodeParametersWindow.RealWidth : 0; - m_autoPanArea[ (int)AutoPanLocation.RIGHT ].AdjustInitialX = m_paletteWindow.IsMaximized ? -m_paletteWindow.RealWidth : 0; - Vector2 autoPanDir = Vector2.zero; - for( int i = 0; i < m_autoPanArea.Length; i++ ) - { - if( m_autoPanArea[ i ].CheckArea( m_currentMousePos2D, m_cameraInfo, false ) ) - { - autoPanDir += m_autoPanArea[ i ].Velocity; - } - } - m_cameraOffset += autoPanDir; - if( !m_wireReferenceUtils.ValidReferences() && m_insideEditorWindow && !m_altBoxSelection ) - { - m_mainGraphInstance.MoveSelectedNodes( -autoPanDir ); - } - - m_repaintIsDirty = true; - } - - m_isDirty = m_isDirty || m_mainGraphInstance.IsDirty; - if( m_isDirty ) - { - m_isDirty = false; - //ShaderIsModified = true; - EditorUtility.SetDirty( this ); - } - - m_saveIsDirty = m_saveIsDirty || m_mainGraphInstance.SaveIsDirty; - if( m_liveShaderEditing ) - { - if( m_saveIsDirty ) - { - if( focusedWindow == this && m_currentInactiveTime > InactivitySaveTime ) - { - m_saveIsDirty = false; - if( m_mainGraphInstance.CurrentMasterNodeId != Constants.INVALID_NODE_ID ) - { - SaveToDisk( true ); - } - else - { - ShowMessage( LiveShaderError ); - } - } - } - } - else if( m_saveIsDirty ) - { - ShaderIsModified = true; - m_saveIsDirty = false; - } - - if( m_onLoadDone > 0 ) - { - m_onLoadDone--; - if( m_onLoadDone == 0 ) - { - ShaderIsModified = false; - } - } - - if( m_cacheSaveOp ) - { - if( ( EditorApplication.timeSinceStartup - m_lastTimeSaved ) > SaveTime ) - { - SaveToDisk( false ); - } - } - m_genericMessageUI.CheckForMessages(); - - if( m_ctrlSCallback ) - { - m_ctrlSCallback = false; - OnToolButtonPressed( ToolButtonType.Update ); - } - - m_lastWindowWidth = position.width; - m_nodeExporterUtils.Update(); - - if( m_markedToSave ) - { - m_markedToSave = false; - SaveToDisk( false ); - } - if( m_performFullUndoRegister ) - { - m_performFullUndoRegister = false; - FullRegisterOnUndoStack(); - } - - if( CheckFunctions ) - CheckFunctions = false; - - System.Threading.Thread.CurrentThread.CurrentCulture = System.Threading.Thread.CurrentThread.CurrentUICulture; - - UIUtils.CurrentWindow = cacheWindow; - if( !m_nodesLoadedCorrectly ) - { - try - { - ShowNotification( NodesExceptionMessage ); - } - catch( Exception e ) - { - Debug.LogException( e ); - } - } - - CheckNodeReplacement(); -#if UNITY_EDITOR_WIN - if( m_takeScreenShot ) - FocusZoom( true, false, false ); - - if( m_takeScreenShot && Event.current.type == EventType.Repaint ) - TakeScreenShot(); -#endif - } - - void OnInspectorUpdate() - { - Preferences.LoadDefaults(); -#if UNITY_2018_3_OR_NEWER - ASEPackageManagerHelper.Update(); -#endif - - if( m_afterDeserializeFlag ) - { - m_afterDeserializeFlag = false; - //m_mainGraphInstance.ParentWindow = this; - } - - if( IsShaderFunctionWindow && CurrentGraph.CurrentShaderFunction == null ) - { - Close(); - } - } - - public void SetCtrlSCallback( bool imediate ) - { - //MasterNode node = _mainGraphInstance.CurrentMasterNode; - if( /*node != null && node.CurrentShader != null && */m_shaderIsModified ) - { - if( imediate ) - { - OnToolButtonPressed( ToolButtonType.Update ); - } - else - { - m_ctrlSCallback = true; - } - } - } - - public void SetSaveIsDirty() - { - m_saveIsDirty = true && UIUtils.DirtyMask; - } - - public void OnPaletteNodeCreate( System.Type type, string name, AmplifyShaderFunction function ) - { - m_mainGraphInstance.DeSelectAll(); - m_paletteChosenType = type; - m_paletteChosenFunction = function; - m_palettePopup.Activate( name ); - } - - public void OnContextPaletteNodeCreate( System.Type type, string name, AmplifyShaderFunction function ) - { - m_mainGraphInstance.DeSelectAll(); - ParentNode newNode = CreateNode( type, m_contextPalette.StartDropPosition * m_cameraZoom - m_cameraOffset, function ); - //Debug.Log( "created context" ); - m_mainGraphInstance.SelectNode( newNode, false, false ); - bool find = false; - if( newNode is FunctionNode && CurrentGraph.CurrentShaderFunction != null ) - find = SearchFunctionNodeRecursively( CurrentGraph.CurrentShaderFunction ); - - if( find ) - { - DestroyNode( newNode, false ); - ShowMessage( "Shader Function loop detected, new node was removed to prevent errors." ); - } - else - { - newNode.RefreshExternalReferences(); - } - } - - void OnNodeStoppedMovingEvent( ParentNode node ) - { - CheckZoomBoundaries( node.Vec2Position ); - //ShaderIsModified = true; - } - - void OnRefreshFunctionNodeEvent( FunctionNode node ) - { - Debug.Log( node ); - } - - void OnMaterialUpdated( MasterNode masterNode ) - { - if( masterNode != null ) - { - if( masterNode.CurrentMaterial ) - { - m_toolsWindow.SetStateOnButton( ToolButtonType.Update, ShaderIsModified ? 0 : 2, ShaderIsModified ? "Click to update Shader preview." : "Preview up-to-date." ); - } - else - { - m_toolsWindow.SetStateOnButton( ToolButtonType.Update, 1, "Set an active Material in the Master Node." ); - } - UpdateLiveUI(); - } - else - { - m_toolsWindow.SetStateOnButton( ToolButtonType.Update, 1, "Set an active Material in the Master Node." ); - } - } - - void OnShaderUpdated( MasterNode masterNode ) - { - m_toolsWindow.SetStateOnButton( ToolButtonType.OpenSourceCode, masterNode.CurrentShader != null ? 1 : 0 ); - } - - public void CheckZoomBoundaries( Vector2 newPosition ) - { - if( newPosition.x < m_minNodePos.x ) - { - m_minNodePos.x = newPosition.x; - } - else if( newPosition.x > m_maxNodePos.x ) - { - m_maxNodePos.x = newPosition.x; - } - - if( newPosition.y < m_minNodePos.y ) - { - m_minNodePos.y = newPosition.y; - } - else if( newPosition.y > m_maxNodePos.y ) - { - m_maxNodePos.y = newPosition.y; - } - } - public void DestroyNode( ParentNode node, bool registerUndo = true ) { m_mainGraphInstance.DestroyNode( node, registerUndo ); } - public ParentNode CreateNode( System.Type type, Vector2 position, AmplifyShaderFunction function = null, bool selectNode = true ) - { - ParentNode node; - if( function == null ) - node = m_mainGraphInstance.CreateNode( type, true ); - else - node = m_mainGraphInstance.CreateNode( function, true ); - - Vector2 newPosition = position; - node.Vec2Position = newPosition; - CheckZoomBoundaries( newPosition ); - - // Connect node if a wire is active - if( m_wireReferenceUtils.ValidReferences() ) - { - if( m_wireReferenceUtils.InputPortReference.IsValid ) - { - ParentNode originNode = m_mainGraphInstance.GetNode( m_wireReferenceUtils.InputPortReference.NodeId ); - InputPort originPort = originNode.GetInputPortByUniqueId( m_wireReferenceUtils.InputPortReference.PortId ); - OutputPort outputPort = node.GetFirstOutputPortOfType( m_wireReferenceUtils.InputPortReference.DataType, true ); - if( outputPort != null && originPort.CheckValidType( outputPort.DataType ) && ( !m_wireReferenceUtils.InputPortReference.TypeLocked || - m_wireReferenceUtils.InputPortReference.DataType == WirePortDataType.OBJECT || - ( m_wireReferenceUtils.InputPortReference.TypeLocked && outputPort.DataType == m_wireReferenceUtils.InputPortReference.DataType ) ) ) - { - - //link output to input - if( outputPort.ConnectTo( m_wireReferenceUtils.InputPortReference.NodeId, m_wireReferenceUtils.InputPortReference.PortId, m_wireReferenceUtils.InputPortReference.DataType, m_wireReferenceUtils.InputPortReference.TypeLocked ) ) - node.OnOutputPortConnected( outputPort.PortId, m_wireReferenceUtils.InputPortReference.NodeId, m_wireReferenceUtils.InputPortReference.PortId ); - - //link input to output - if( originPort.ConnectTo( outputPort.NodeId, outputPort.PortId, outputPort.DataType, m_wireReferenceUtils.InputPortReference.TypeLocked ) ) - originNode.OnInputPortConnected( m_wireReferenceUtils.InputPortReference.PortId, node.UniqueId, outputPort.PortId ); - } - } - - if( m_wireReferenceUtils.OutputPortReference.IsValid ) - { - ParentNode originNode = m_mainGraphInstance.GetNode( m_wireReferenceUtils.OutputPortReference.NodeId ); - InputPort inputPort = node.GetFirstInputPortOfType( m_wireReferenceUtils.OutputPortReference.DataType, true ); - - if( inputPort != null && ( !inputPort.TypeLocked || - inputPort.DataType == WirePortDataType.OBJECT || - ( inputPort.TypeLocked && inputPort.DataType == m_wireReferenceUtils.OutputPortReference.DataType ) ) ) - { - - inputPort.InvalidateAllConnections(); - //link input to output - if( inputPort.ConnectTo( m_wireReferenceUtils.OutputPortReference.NodeId, m_wireReferenceUtils.OutputPortReference.PortId, m_wireReferenceUtils.OutputPortReference.DataType, inputPort.TypeLocked ) ) - node.OnInputPortConnected( inputPort.PortId, m_wireReferenceUtils.OutputPortReference.NodeId, m_wireReferenceUtils.OutputPortReference.PortId ); - //link output to input - - if( originNode.GetOutputPortByUniqueId( m_wireReferenceUtils.OutputPortReference.PortId ).ConnectTo( inputPort.NodeId, inputPort.PortId, m_wireReferenceUtils.OutputPortReference.DataType, inputPort.TypeLocked ) ) - originNode.OnOutputPortConnected( m_wireReferenceUtils.OutputPortReference.PortId, node.UniqueId, inputPort.PortId ); - } - } - m_wireReferenceUtils.InvalidateReferences(); - - //for ( int i = 0; i < m_mainGraphInstance.VisibleNodes.Count; i++ ) - //{ - // m_mainGraphInstance.VisibleNodes[ i ].OnNodeInteraction( node ); - //} - } - - if( selectNode ) - m_mainGraphInstance.SelectNode( node, false, false ); - //_repaintIsDirty = true - - SetSaveIsDirty(); - ForceRepaint(); - return node; - } - - public void UpdateNodePreviewListAndTime() - { - if( UIUtils.CurrentWindow != this ) - return; - - double deltaTime = Time.realtimeSinceStartup - m_time; - m_time = Time.realtimeSinceStartup; - - if( DebugConsoleWindow.DeveloperMode ) - { - m_frameCounter++; - if( m_frameCounter >= 60 ) - { - m_fpsDisplay = ( 60 / ( Time.realtimeSinceStartup - m_fpsTime ) ).ToString( "N2" ); - m_fpsTime = Time.realtimeSinceStartup; - m_frameCounter = 0; - } - } - - if( m_smoothZoom ) - { - m_repaintIsDirty = true; - if( Mathf.Abs( m_targetZoom - m_cameraZoom ) < 0.001f ) - { - m_smoothZoom = false; - m_cameraZoom = m_targetZoom; - m_zoomTime = 0; - } - else - { - m_zoomTime += deltaTime; - Vector2 canvasPos = m_zoomPivot * m_cameraZoom; - m_cameraZoom = Mathf.SmoothDamp( m_cameraZoom, m_targetZoom, ref m_zoomVelocity, 0.1f, 10000, (float)deltaTime * 1.5f ); - canvasPos = canvasPos - m_zoomPivot * m_cameraZoom; - m_cameraOffset = m_cameraOffset - canvasPos; - m_targetOffset = m_targetOffset - canvasPos; - } - - } - - if( m_smoothOffset ) - { - m_repaintIsDirty = true; - if( ( m_targetOffset - m_cameraOffset ).SqrMagnitude() < 1f ) - { - m_smoothOffset = false; - m_offsetTime = 0; - } - else - { - m_offsetTime += deltaTime; - m_cameraOffset = Vector2.SmoothDamp( m_cameraOffset, m_targetOffset, ref m_camVelocity, 0.1f, 100000, (float)deltaTime * 1.5f ); - } - } - - if( m_cachedEditorTimeId == -1 ) - m_cachedEditorTimeId = Shader.PropertyToID( "_EditorTime" ); - - if( m_cachedEditorDeltaTimeId == -1 ) - m_cachedEditorDeltaTimeId = Shader.PropertyToID( "_EditorDeltaTime" ); - - //Update Game View? - //Shader.SetGlobalVector( "_Time", new Vector4( Time.realtimeSinceStartup / 20, Time.realtimeSinceStartup, Time.realtimeSinceStartup * 2, Time.realtimeSinceStartup * 3 ) ); - - //System.Type T = System.Type.GetType( "UnityEditor.GameView,UnityEditor" ); - //UnityEngine.Object[] array = Resources.FindObjectsOfTypeAll( T ); - //EditorWindow gameView = ( array.Length <= 0 ) ? null : ( ( EditorWindow ) array[ 0 ] ); - //gameView.Repaint(); - - if( RenderSettings.sun != null ) - { - Vector3 lightdir = -RenderSettings.sun.transform.forward;//.rotation.eulerAngles; - - Shader.SetGlobalVector( "_EditorWorldLightPos", new Vector4( lightdir.x, lightdir.y, lightdir.z, 0 ) ); - Shader.SetGlobalColor( "_EditorLightColor", RenderSettings.sun.color.linear ); - } - Shader.SetGlobalFloat( "_EditorTime", (float)m_time ); - Shader.SetGlobalFloat( "_EditorDeltaTime", (float)deltaTime ); - - /////////// UPDATE PREVIEWS ////////////// - UIUtils.CheckNullMaterials(); - //CurrentGraph.AllNodes.Sort( ( x, y ) => { return x.Depth.CompareTo( y.Depth ); } ); - int nodeCount = CurrentGraph.AllNodes.Count; - for( int i = nodeCount - 1; i >= 0; i-- ) - { - ParentNode node = CurrentGraph.AllNodes[ i ]; - if( node != null && !VisitedChanged.ContainsKey( node.OutputId ) ) - { - bool result = node.RecursivePreviewUpdate(); - if( result ) - m_repaintIsDirty = true; - } - } - - VisitedChanged.Clear(); - if( m_repaintIsDirty ) - { - m_repaintIsDirty = false; - Repaint(); - } - } - - public void ForceRepaint() - { - m_repaintCount += 1; - m_repaintIsDirty = true; - //Repaint(); - } - - public void ForceUpdateFromMaterial() { m_forceUpdateFromMaterialFlag = true; } - void UseCurrentEvent() - { - m_currentEvent.Use(); - } - - - - public void OnBeforeSerialize() - { - //if ( !UIUtils.SerializeFromUndo() ) - //{ - // m_mainGraphInstance.DeSelectAll(); - //} - - if( DebugConsoleWindow.UseShaderPanelsInfo ) - { - if( m_nodeParametersWindow != null ) - m_nodeParametersWindowMaximized = m_nodeParametersWindow.IsMaximized; - - if( m_paletteWindow != null ) - m_paletteWindowMaximized = m_paletteWindow.IsMaximized; - } - } - - public void OnAfterDeserialize() - { - m_afterDeserializeFlag = true; - - //m_customGraph = null; - if( DebugConsoleWindow.UseShaderPanelsInfo ) - { - if( m_nodeParametersWindow != null ) - m_nodeParametersWindow.IsMaximized = m_nodeParametersWindowMaximized; - - if( m_paletteWindow != null ) - m_paletteWindow.IsMaximized = m_paletteWindowMaximized; - } - } - - void OnDestroy() - { - m_ctrlSCallback = false; - Destroy(); - } - - public override void OnDisable() - { - base.OnDisable(); - m_ctrlSCallback = false; - //EditorApplication.update -= UpdateTime; - EditorApplication.update -= UpdateNodePreviewListAndTime; - - EditorApplication.update -= IOUtils.UpdateIO; - - for( int i = 0; i < IOUtils.AllOpenedWindows.Count; i++ ) - { - if( IOUtils.AllOpenedWindows[ i ] != this ) - { - EditorApplication.update += IOUtils.UpdateIO; - break; - } - } - } - - void OnEmptyGraphDetected( ParentGraph graph ) - { - if( m_delayedLoadObject != null ) - { - LoadObject( m_delayedLoadObject ); - m_delayedLoadObject = null; - Repaint(); - } - else - { - if( !string.IsNullOrEmpty( Lastpath ) ) - { - Shader shader = AssetDatabase.LoadAssetAtPath<Shader>( Lastpath ); - if( shader == null ) - { - Material material = AssetDatabase.LoadAssetAtPath<Material>( Lastpath ); - if( material != null ) - { - LoadDroppedObject( true, material.shader, material, null ); - } - else - { - AmplifyShaderFunction function = AssetDatabase.LoadAssetAtPath<AmplifyShaderFunction>( Lastpath ); - if( function != null ) - { - LoadDroppedObject( true, null, null, function ); - } - } - } - else - { - LoadDroppedObject( true, shader, null, null ); - } - Repaint(); - } - } - } - - - public void ForceMaterialsToUpdate( ref Dictionary<string, string> availableMaterials ) - { - m_forcingMaterialUpdateOp = true; - m_forcingMaterialUpdateFlag = true; - m_materialsToUpdate.Clear(); - foreach( KeyValuePair<string, string> kvp in availableMaterials ) - { - Material material = AssetDatabase.LoadAssetAtPath<Material>( AssetDatabase.GUIDToAssetPath( kvp.Value ) ); - if( material != null ) - { - m_materialsToUpdate.Add( material ); - } - } - } - - public void SetOutdatedShaderFromTemplate() - { - m_outdatedShaderFromTemplateLoaded = true; - } - - public void ReplaceMasterNode( MasterNodeCategoriesData data, bool cacheMasterNodes ) - { - // save connection list before switching - m_savedList.Clear(); - int count = m_mainGraphInstance.CurrentMasterNode.InputPorts.Count; - for( int i = 0; i < count; i++ ) - { - if( m_mainGraphInstance.CurrentMasterNode.InputPorts[ i ].IsConnected ) - { - string name = m_mainGraphInstance.CurrentMasterNode.InputPorts[ i ].Name; - OutputPort op = m_mainGraphInstance.CurrentMasterNode.InputPorts[ i ].GetOutputConnection(); - if( !m_savedList.ContainsKey( name ) ) - { - m_savedList.Add( name, op ); - } - } - } - - m_replaceMasterNodeType = data.Category; - m_replaceMasterNode = true; - m_replaceMasterNodeData = data.Name; - m_replaceMasterNodeDataFromCache = cacheMasterNodes; - if( cacheMasterNodes ) - { - m_clipboard.AddMultiPassNodesToClipboard( m_mainGraphInstance.MultiPassMasterNodes.NodesList ); - } - } - - void CheckNodeReplacement() - { - if( m_replaceMasterNode ) - { - m_replaceMasterNode = false; - switch( m_replaceMasterNodeType ) - { - default: - case AvailableShaderTypes.SurfaceShader: - { - SetStandardShader(); - if( IOUtils.OnShaderTypeChangedEvent != null ) - { - IOUtils.OnShaderTypeChangedEvent( m_mainGraphInstance.CurrentShader, false, string.Empty ); - } - } - break; - case AvailableShaderTypes.Template: - { - - TemplateDataParent templateData = m_templatesManager.GetTemplate( m_replaceMasterNodeData ); - if( m_replaceMasterNodeDataFromCache ) - { - m_mainGraphInstance.CrossCheckTemplateNodes( templateData ); - m_clipboard.GetMultiPassNodesFromClipboard( m_mainGraphInstance.MultiPassMasterNodes.NodesList ); - } - else - { - SetTemplateShader( m_replaceMasterNodeData, false ); - } - - if( IOUtils.OnShaderTypeChangedEvent != null ) - { - IOUtils.OnShaderTypeChangedEvent( m_mainGraphInstance.CurrentShader, true, templateData.GUID ); - } - } - break; - } - } - else if( m_outdatedShaderFromTemplateLoaded ) - { - m_outdatedShaderFromTemplateLoaded = false; - TemplateMultiPassMasterNode masterNode = m_mainGraphInstance.CurrentMasterNode as TemplateMultiPassMasterNode; - if( masterNode != null ) - { - ReplaceMasterNode( masterNode.CurrentCategoriesData, true ); - } - } - - // restore possible connections by name - if( m_savedList.Count > 0 ) - { - foreach( var item in m_savedList ) - { - string name = item.Key; - OutputPort op = item.Value; - InputPort ip = m_mainGraphInstance.CurrentMasterNode.InputPorts.Find( x => x.Name == name ); - - if( op != null && ip != null && ip.Visible ) - { - var iNode = UIUtils.GetNode( ip.NodeId ); - var oNode = UIUtils.GetNode( op.NodeId ); - ip.ConnectTo( oNode.UniqueId, op.PortId, op.DataType, false ); - op.ConnectTo( iNode.UniqueId, ip.PortId, ip.DataType, ip.TypeLocked ); - - iNode.OnInputPortConnected( ip.PortId, oNode.UniqueId, op.PortId ); - oNode.OnOutputPortConnected( op.PortId, iNode.UniqueId, ip.PortId ); - } - } - } - m_savedList.Clear(); - } - - public Vector2 TranformPosition( Vector2 pos ) - { - return pos * m_cameraZoom - m_cameraOffset; - } - - public void UpdateTabTitle() - { - if( m_isShaderFunctionWindow ) - { - if( m_openedShaderFunction != null ) - { - this.titleContent.text = GenerateTabTitle( m_openedShaderFunction.FunctionName ); - } - } - else - { - if( m_selectionMode == ASESelectionMode.Material ) - { - this.titleContent.text = GenerateTabTitle( m_mainGraphInstance.CurrentMaterial.name ); - } - else - { - this.titleContent.text = GenerateTabTitle( m_mainGraphInstance.CurrentShader.name ); - } - } - } - - public ParentGraph CustomGraph - { - get { return m_customGraph; } - set { m_customGraph = value; } - } - - public ParentGraph CurrentGraph - { - get - { - if( m_customGraph != null ) - return m_customGraph; - - return m_mainGraphInstance; - } - } - - public void RefreshAvaibleNodes() - { - if( m_contextMenu != null && m_mainGraphInstance != null ) - { - m_contextMenu.RefreshNodes( m_mainGraphInstance ); - m_paletteWindow.ForceUpdate = true; - m_contextPalette.ForceUpdate = true; - m_refreshAvailableNodes = false; - } - } - - public void LateRefreshAvailableNodes() - { - m_refreshAvailableNodes = true; - } - - public ParentGraph OutsideGraph { get { return m_mainGraphInstance; } } - - public bool ShaderIsModified - { - get { return m_shaderIsModified; } - set - { - m_shaderIsModified = value && UIUtils.DirtyMask; - - m_toolsWindow.SetStateOnButton( ToolButtonType.Save, m_shaderIsModified ? 1 : 0 ); - if( !IsShaderFunctionWindow ) - { - MasterNode masterNode = m_mainGraphInstance.CurrentMasterNode; - if( masterNode != null && masterNode.CurrentShader != null ) - { - m_toolsWindow.SetStateOnButton( ToolButtonType.Update, m_shaderIsModified ? 0 : 2 ); - UpdateTabTitle( masterNode.ShaderName, m_shaderIsModified ); - } - else - { - m_toolsWindow.SetStateOnButton( ToolButtonType.Update, 1 ); - } - - //if( m_mainGraphInstance.CurrentStandardSurface != null ) - // UpdateTabTitle( m_mainGraphInstance.CurrentStandardSurface.ShaderName, m_shaderIsModified ); - } - else - { - m_toolsWindow.SetStateOnButton( ToolButtonType.Update, m_shaderIsModified ? 0 : 2 ); - if( m_mainGraphInstance.CurrentShaderFunction != null ) - UpdateTabTitle( m_mainGraphInstance.CurrentShaderFunction.FunctionName, m_shaderIsModified ); - } - - } - } - public void MarkToRepaint() { m_repaintIsDirty = true; } - public void RequestSave() { m_markedToSave = true; } - public void RequestRepaint() { m_repaintIsDirty = true; } - public OptionsWindow Options { get { return m_optionsWindow; } } - public GraphContextMenu ContextMenuInstance { get { return m_contextMenu; } set { m_contextMenu = value; } } - public ShortcutsManager ShortcutManagerInstance { get { return m_shortcutManager; } } - - public bool GlobalPreview - { - get { return m_globalPreview; } - set { m_globalPreview = value; } - } - - public bool GlobalShowInternalData - { - get { return m_globalShowInternalData; } - set { m_globalShowInternalData = value; } - } - - public double EditorTime - { - get { return m_time; } - set { m_time = value; } - } - - public ASESelectionMode CurrentSelection - { - get { return m_selectionMode; } - set - { - m_selectionMode = value; - switch( m_selectionMode ) - { - default: - case ASESelectionMode.Shader: - { - m_toolsWindow.BorderStyle = UIUtils.GetCustomStyle( CustomStyle.ShaderBorder ); - } - break; - case ASESelectionMode.Material: - { - m_toolsWindow.BorderStyle = UIUtils.GetCustomStyle( CustomStyle.MaterialBorder ); - } - break; - case ASESelectionMode.ShaderFunction: - { - m_toolsWindow.BorderStyle = UIUtils.GetCustomStyle( CustomStyle.ShaderFunctionBorder ); - } - break; - } - } - } - - public bool LiveShaderEditing - { - get { return m_liveShaderEditing; } - set - { - m_liveShaderEditing = value; - m_innerEditorVariables.LiveMode = m_liveShaderEditing; - UpdateLiveUI(); - } - } - - public NodeAvailability CurrentNodeAvailability - { - get { return m_currentNodeAvailability; } - set - { - NodeAvailability cache = m_currentNodeAvailability; - m_currentNodeAvailability = value; - - if( cache != value ) - RefreshAvaibleNodes(); - } - } - public string GUID - { - get - { - if( m_isShaderFunctionWindow ) - { - return m_openedShaderFunction != null ? AssetDatabase.AssetPathToGUID( AssetDatabase.GetAssetPath( m_openedShaderFunction ) ) : string.Empty; - } - else - { - return m_mainGraphInstance.CurrentShader != null ? AssetDatabase.AssetPathToGUID( AssetDatabase.GetAssetPath( m_mainGraphInstance.CurrentShader ) ) : string.Empty; - } - } - } - public List<Toast> Messages { get { return m_messages; } set { m_messages = value; } } - public float MaxMsgWidth { get { return m_maxMsgWidth; } set { m_maxMsgWidth = value; } } - public bool MaximizeMessages { get { return m_maximizeMessages; } set { m_maximizeMessages = value; } } - public void InvalidateAlt() { m_altAvailable = false; } - public PaletteWindow CurrentPaletteWindow { get { return m_paletteWindow; } } - public PreMadeShaders PreMadeShadersInstance { get { return m_preMadeShaders; } } - public Rect CameraInfo { get { return m_cameraInfo; } } - public Vector2 TranformedMousePos { get { return m_currentMousePos2D * m_cameraZoom - m_cameraOffset; } } - public Vector2 TranformedKeyEvtMousePos { get { return m_keyEvtMousePos2D * m_cameraZoom - m_cameraOffset; } } - public PalettePopUp PalettePopUpInstance { get { return m_palettePopup; } } - public DuplicatePreventionBuffer DuplicatePrevBufferInstance { get { return m_duplicatePreventionBuffer; } } - public NodeParametersWindow ParametersWindow { get { return m_nodeParametersWindow; } } - public NodeExporterUtils CurrentNodeExporterUtils { get { return m_nodeExporterUtils; } } - public AmplifyShaderFunction OpenedShaderFunction { get { return m_openedShaderFunction; } } - public DrawInfo CameraDrawInfo { get { return m_drawInfo; } } - public string Lastpath { get { return m_lastpath; } set { m_lastpath = value; } } - public string LastOpenedLocation { get { return m_lastOpenedLocation; } set { m_lastOpenedLocation = value; } } - public float AvailableCanvasWidth { get { return ( m_cameraInfo.width - m_paletteWindow.RealWidth - m_nodeParametersWindow.RealWidth ); } } - public float AvailableCanvasHeight { get { return ( m_cameraInfo.height ); } } - public float CameraZoom { get { return m_cameraZoom; } set { m_cameraZoom = value; m_zoomChanged = true; } } - public int GraphCount { get { return m_graphCount; } set { m_graphCount = value; } } - public bool ForceAutoPanDir { get { return m_forceAutoPanDir; } set { m_forceAutoPanDir = value; } } - public bool OpenedAssetFromNode { get { return m_openedAssetFromNode; } set { m_openedAssetFromNode = value; } } - public bool IsShaderFunctionWindow { get { return m_isShaderFunctionWindow; } set { m_isShaderFunctionWindow = value; } } - public bool NodesLoadedCorrectly { get { return m_nodesLoadedCorrectly; } set { m_nodesLoadedCorrectly = value; } } - public double CurrentInactiveTime { get { return m_currentInactiveTime; } } - public string ReplaceMasterNodeData { get { return m_replaceMasterNodeData; } } - public AvailableShaderTypes ReplaceMasterNodeType { get { return m_replaceMasterNodeType; } } - public NodeWireReferencesUtils WireReferenceUtils { get { return m_wireReferenceUtils; } } - public ContextPalette WindowContextPallete { get { return m_contextPalette; } } - // This needs to go to UIUtils - public Texture2D WireTexture { get { return m_wireTexture; } } - public Event CurrentEvent { get { return m_currentEvent; } } - public string CurrentCommandName { get { return m_currentCommandName; } } - public InnerWindowEditorVariables InnerWindowVariables { get { return m_innerEditorVariables; } } - public TemplatesManager TemplatesManagerInstance { get { return m_templatesManager; } } - public Material CurrentMaterial { get { return CurrentGraph.CurrentMaterial; } } - public Clipboard ClipboardInstance { get { return m_clipboard; } } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderEditorWindow.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderEditorWindow.cs.meta deleted file mode 100644 index 6ce8e71f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderEditorWindow.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: c8bcac0d66f920e49803925a85beb0ed -timeCreated: 1481126959 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderFunction.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderFunction.cs deleted file mode 100644 index df83bedb..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderFunction.cs +++ /dev/null @@ -1,189 +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.Collections.Generic; -using AmplifyShaderEditor; - -[Serializable] -public class AmplifyShaderFunction : ScriptableObject -{ - [SerializeField] - private string m_functionInfo = string.Empty; - public string FunctionInfo - { - get { return m_functionInfo; } - set { m_functionInfo = value; } - } - - [SerializeField] - private string m_functionName = string.Empty; - public string FunctionName - { - get { if( m_functionName.Length == 0 ) return name; else return m_functionName; } - set { m_functionName = value; } - } - - [SerializeField] - [TextArea( 5, 15 )] - private string m_description = string.Empty; - public string Description - { - get { return m_description; } - set { m_description = value; } - } - - [SerializeField] - private AdditionalIncludesHelper m_additionalIncludes = new AdditionalIncludesHelper(); - //public AdditionalIncludesHelper AdditionalIncludes - //{ - // get { return m_additionalIncludes; } - // set { m_additionalIncludes = value; } - //} - - [SerializeField] - private AdditionalPragmasHelper m_additionalPragmas = new AdditionalPragmasHelper(); - //public AdditionalPragmasHelper AdditionalPragmas - //{ - // get { return m_additionalPragmas; } - // set { m_additionalPragmas = value; } - //} - - [SerializeField] - private TemplateAdditionalDirectivesHelper m_additionalDirectives = new TemplateAdditionalDirectivesHelper( " Additional Directives" ); - public TemplateAdditionalDirectivesHelper AdditionalDirectives - { - get { return m_additionalDirectives; } - set { m_additionalDirectives = value; } - } - - [SerializeField] - private FunctionNodeCategories m_nodeCategory = FunctionNodeCategories.Functions; - public FunctionNodeCategories NodeCategory - { - get { return m_nodeCategory; } - set { m_nodeCategory = value; } - } - - [SerializeField] - private string m_customNodeCategory = string.Empty; - public string CustomNodeCategory - { - get - { - if( m_nodeCategory == FunctionNodeCategories.Custom ) - { - if( string.IsNullOrEmpty( m_customNodeCategory ) ) - return "Functions"; - else - return m_customNodeCategory; - } - else - { - return UIUtils.CategoryPresets[ (int)m_nodeCategory ]; - //return new SerializedObject( this ).FindProperty( "m_nodeCategory" ).enumDisplayNames[ (int)m_nodeCategory ]; - } - } - } - - [SerializeField] - private PreviewLocation m_previewPosition = PreviewLocation.Auto; - public PreviewLocation PreviewPosition - { - get { return m_previewPosition; } - set { m_previewPosition = value; } - } - - [SerializeField] - private bool m_hidden = false; - public bool Hidden - { - get { return m_hidden; } - set { m_hidden = value; } - } - - public void UpdateDirectivesList() - { - m_additionalDirectives.CleanNullDirectives(); - m_additionalDirectives.UpdateDirectivesFromSaveItems(); - - if( m_additionalIncludes.IncludeList.Count > 0 ) - { - m_additionalDirectives.AddItems( AdditionalLineType.Include, m_additionalIncludes.IncludeList ); - m_additionalIncludes.IncludeList.Clear(); - } - - if( m_additionalPragmas.PragmaList.Count > 0 ) - { - m_additionalDirectives.AddItems( AdditionalLineType.Pragma, m_additionalPragmas.PragmaList ); - m_additionalPragmas.PragmaList.Clear(); - } - } - - public void ResetDirectivesOrigin() - { - //if( UIUtils.CurrentShaderVersion() < 16807 ) - // Although the correct version was 1.6.7 rev 07 this issue was only detected on v1.7.1. rev 00 - // So to avoid potential incorrect saves over shader functions, I decided to broaden up the version range - if( UIUtils.CurrentShaderVersion() < 17101 ) - { - m_additionalDirectives.ResetDirectivesOrigin(); - } - } -} - -public class ShaderFunctionDetector : AssetPostprocessor -{ - static void OnPostprocessAllAssets( string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths ) - { - if( UIUtils.CurrentWindow == null ) - return; - - bool markForRefresh = false; - AmplifyShaderFunction function = null; - for( int i = 0; i < importedAssets.Length; i++ ) - { - function = AssetDatabase.LoadAssetAtPath<AmplifyShaderFunction>( importedAssets[ i ] ); - if( function != null ) - { - markForRefresh = true; - break; - } - } - - if( deletedAssets.Length > 0 ) - markForRefresh = true; - - for( int i = 0; i < movedAssets.Length; i++ ) - { - function = AssetDatabase.LoadAssetAtPath<AmplifyShaderFunction>( movedAssets[ i ] ); - if( function != null ) - { - markForRefresh = true; - break; - } - } - - for( int i = 0; i < movedFromAssetPaths.Length; i++ ) - { - function = AssetDatabase.LoadAssetAtPath<AmplifyShaderFunction>( movedFromAssetPaths[ i ] ); - if( function != null ) - { - markForRefresh = true; - break; - } - } - - if( markForRefresh ) - { - markForRefresh = false; - if( function != null ) - { - IOUtils.UpdateSFandRefreshWindows( function ); - } - UIUtils.CurrentWindow.LateRefreshAvailableNodes(); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderFunction.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderFunction.cs.meta deleted file mode 100644 index 35a93109..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderFunction.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 78b2425a2284af743826c689403a4924 -timeCreated: 1492703397 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {fileID: 2800000, guid: 50be8291f9514914aa55c66c49da67cf, type: 3} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderFunctionEditor.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderFunctionEditor.cs deleted file mode 100644 index b5e3e4d4..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderFunctionEditor.cs +++ /dev/null @@ -1,152 +0,0 @@ -using UnityEngine; -using UnityEditor; -using System; -using System.Text.RegularExpressions; -using System.IO; -using System.Collections.Generic; - -namespace AmplifyShaderEditor -{ - [CustomEditor( typeof( AmplifyShaderFunction ) )] - public class AmplifyShaderFunctionEditor : Editor - { - class FunctionDependency - { - public string AssetName; - public string AssetPath; - public FunctionDependency(string name, string path) - { - AssetName = name; - AssetPath = path; - } - } - - AmplifyShaderFunction m_target; - List<FunctionDependency> m_dependencies = new List<FunctionDependency>(); - - void OnEnable() - { - m_target = ( target as AmplifyShaderFunction ); - } - - public override void OnInspectorGUI() - { - //base.OnInspectorGUI(); - //base.serializedObject.Update(); - if( GUILayout.Button( "Open in Shader Editor" ) ) - { -#if UNITY_2018_3_OR_NEWER - ASEPackageManagerHelper.SetupLateShaderFunction( m_target ); -#else - AmplifyShaderEditorWindow.LoadShaderFunctionToASE( m_target, false ); -#endif - } - //EditorGUILayout.Separator(); - //m_target.FunctionInfo = EditorGUILayout.TextArea( m_target.FunctionInfo ); - - if( m_target.Description.Length > 0 ) - { - EditorGUILayout.HelpBox( m_target.Description, MessageType.Info ); - } - - EditorGUILayout.Space(); - if( GUILayout.Button( "Search Direct Dependencies" ) ) - { - m_dependencies.Clear(); - string guid = AssetDatabase.AssetPathToGUID( AssetDatabase.GetAssetPath( m_target ) ); - - string[] allSFs = AssetDatabase.FindAssets( "t:AmplifyShaderFunction", null ); - foreach( string guid1 in allSFs ) - { - string sfPath = AssetDatabase.GUIDToAssetPath( guid1 ); - bool found = SearchForGUID( guid, sfPath ); - if( found ) - { - //string n = Regex.Replace( sfPath, @"(\.\w+|[\w\d\/]+\/)", "" ); - string n = Regex.Replace( sfPath, @"[\w\d\/]+\/", "" ); - m_dependencies.Add(new FunctionDependency( n, sfPath ) ); - } - } - - string[] allSHs = AssetDatabase.FindAssets( "t:Shader", null ); - foreach( string guid1 in allSHs ) - { - string shPath = AssetDatabase.GUIDToAssetPath( guid1 ); - bool found = SearchForGUID( guid, shPath ); - if( found ) - { - string n = Regex.Replace( shPath, @"[\w\d\/]+\/", "" ); - m_dependencies.Add( new FunctionDependency( n, shPath ) ); - } - } - } - EditorGUILayout.Space(); - for( int i = 0; i < m_dependencies.Count; i++ ) - { - EditorGUILayout.BeginHorizontal(); - if( GUILayout.Button( m_dependencies[ i ].AssetName, "minibuttonleft" ) ) - { - SelectAtPath( m_dependencies[ i ].AssetPath ); - } - if( GUILayout.Button( "edit", "minibuttonright", GUILayout.Width(100) ) ) - { - if( m_dependencies[ i ].AssetName.EndsWith( ".asset" ) ) - { - var obj = AssetDatabase.LoadAssetAtPath<AmplifyShaderFunction>( m_dependencies[ i ].AssetPath ); - AmplifyShaderEditorWindow.LoadShaderFunctionToASE( obj, false ); - } - else - { - var obj = AssetDatabase.LoadAssetAtPath<Shader>( m_dependencies[ i ].AssetPath ); - AmplifyShaderEditorWindow.ConvertShaderToASE( obj ); - } - } - EditorGUILayout.EndHorizontal(); - } - } - - public void SelectAtPath( string path ) - { - var obj = AssetDatabase.LoadAssetAtPath<UnityEngine.Object>( path ); - EditorGUIUtility.PingObject( obj ); - } - - public static bool SearchForGUID( string guid, string pathName ) - { - bool result = false; - int count = 0; - if( !string.IsNullOrEmpty( pathName ) && File.Exists( pathName ) ) - { - StreamReader fileReader = null; - try - { - fileReader = new StreamReader( pathName ); - - string line; - int index = -1; - while( ( line = fileReader.ReadLine() ) != null ) - { - index = line.IndexOf( guid ); - count++; - - if( index > -1 ) - { - result = true; - break; - } - } - } - catch( Exception e ) - { - Debug.LogException( e ); - } - finally - { - if( fileReader != null ) - fileReader.Close(); - } - } - return result; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderFunctionEditor.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderFunctionEditor.cs.meta deleted file mode 100644 index 99b80bb9..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/AmplifyShaderFunctionEditor.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 8b2d6d1320661374db53aeb8057312b2 -timeCreated: 1491909065 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/AutoPanData.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/AutoPanData.cs deleted file mode 100644 index 9f028f3f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/AutoPanData.cs +++ /dev/null @@ -1,94 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEngine; - -namespace AmplifyShaderEditor -{ - public enum AutoPanLocation - { - TOP = 0, - BOTTOM, - LEFT, - RIGHT - } - - public class AutoPanData - { - private Rect m_area; - private float m_size; - private Vector2 m_velocity; - - private GUIStyle m_style; - private Color m_color = new Color( 1f, 0f, 0f, 0.5f ); - - private AutoPanLocation m_location; - private float m_adjustWidth = 0; - private float m_adjustInitialX = 0; - - public AutoPanData( AutoPanLocation location, float size, Vector2 vel ) - { - m_area = new Rect(); - m_size = size; - m_velocity = vel; - m_location = location; - } - - public bool CheckArea( Vector2 mousePosition, Rect window, bool draw ) - { - float totalSize = m_size + m_adjustWidth; - switch ( m_location ) - { - case AutoPanLocation.TOP: - { - m_area.x = m_adjustInitialX; - m_area.y = 0; - m_area.width = window.width; - m_area.height = totalSize; - } - break; - case AutoPanLocation.BOTTOM: - { - m_area.x = m_adjustInitialX; - m_area.y = window.height - totalSize; - m_area.width = window.width; - m_area.height = totalSize; - } - break; - case AutoPanLocation.LEFT: - { - m_area.x = m_adjustInitialX; - m_area.y = 0; - m_area.width = totalSize; - m_area.height = window.height; - } - break; - case AutoPanLocation.RIGHT: - { - m_area.x = m_adjustInitialX + window.width - totalSize; - m_area.y = 0; - m_area.width = totalSize; - m_area.height = window.height; - } - break; - } - - if ( draw ) - { - if ( m_style == null ) - { - m_style = UIUtils.Box; - } - Color bufferedColor = GUI.color; - GUI.color = m_color; - GUI.Label( m_area, string.Empty, m_style ); - GUI.color = bufferedColor; - } - return m_area.Contains( mousePosition ); - } - - public float AdjustWidth { set { m_adjustWidth = value; } } - public float AdjustInitialX { set { m_adjustInitialX = value; } } - public Vector2 Velocity { get { return m_velocity; } } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/AutoPanData.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/AutoPanData.cs.meta deleted file mode 100644 index 17e6b868..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/AutoPanData.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 711db07e8265cb740940568c4bc7345f -timeCreated: 1481126956 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Clipboard.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Clipboard.cs deleted file mode 100644 index 4f2405c4..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Clipboard.cs +++ /dev/null @@ -1,250 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> -using System; -using UnityEngine; -using System.Collections.Generic; -using UnityEditor; - -namespace AmplifyShaderEditor -{ - - public class ClipboardData - { - public string Data = string.Empty; - public string Connections = string.Empty; - public int OldNodeId = -1; - public int NewNodeId = -1; - - public ClipboardData( string data, string connections, int oldNodeId ) - { - Data = data; - Connections = connections; - OldNodeId = oldNodeId; - } - - public override string ToString() - { - return Data + IOUtils.CLIPBOARD_DATA_SEPARATOR + Connections + IOUtils.CLIPBOARD_DATA_SEPARATOR + OldNodeId + IOUtils.CLIPBOARD_DATA_SEPARATOR + NewNodeId; - } - } - - public class Clipboard - { - public const string ClipboardId = "AMPLIFY_CLIPBOARD_ID"; - private readonly string[] ClipboardTagId = { "#CLIP_ITEM#" }; - private List<ClipboardData> m_clipboardStrData; - private Dictionary<int, ClipboardData> m_clipboardAuxData; - private Dictionary<string, ClipboardData> m_multiPassMasterNodeData; - - public Clipboard() - { - m_clipboardStrData = new List<ClipboardData>(); - m_clipboardAuxData = new Dictionary<int, ClipboardData>(); - m_multiPassMasterNodeData = new Dictionary<string, ClipboardData>(); - } - - public void AddMultiPassNodesToClipboard( List<TemplateMultiPassMasterNode> masterNodes ) - { - m_multiPassMasterNodeData.Clear(); - int templatesAmount = masterNodes.Count; - for( int i = 0; i < templatesAmount; i++ ) - { - if( !masterNodes[ i ].InvalidNode ) - { - string data = string.Empty; - string connection = string.Empty; - masterNodes[ i ].FullWriteToString( ref data, ref connection ); - ClipboardData clipboardData = new ClipboardData( data, connection, masterNodes[ i ].UniqueId ); - m_multiPassMasterNodeData.Add( masterNodes[ i ].PassUniqueName, clipboardData ); - } - } - } - - public void GetMultiPassNodesFromClipboard( List<TemplateMultiPassMasterNode> masterNodes ) - { - int templatesAmount = masterNodes.Count; - for( int i = 0; i < templatesAmount; i++ ) - { - if( m_multiPassMasterNodeData.ContainsKey( masterNodes[ i ].PassUniqueName ) ) - { - ClipboardData nodeData = m_multiPassMasterNodeData[ masterNodes[ i ].PassUniqueName ]; - string[] nodeParams = nodeData.Data.Split( IOUtils.FIELD_SEPARATOR ); - masterNodes[ i ].FullReadFromString( ref nodeParams ); - } - } - - for( int i = 0; i < templatesAmount; i++ ) - { - if( m_multiPassMasterNodeData.ContainsKey( masterNodes[ i ].PassUniqueName ) ) - { - masterNodes[ i ].SetReadOptions(); - masterNodes[ i ].ForceOptionsRefresh(); - } - } - - m_multiPassMasterNodeData.Clear(); - } - - public void AddToClipboard( List<ParentNode> selectedNodes , Vector3 initialPosition, ParentGraph graph ) - { - //m_clipboardStrData.Clear(); - //m_clipboardAuxData.Clear(); - - string clipboardData = IOUtils.Vector3ToString( initialPosition ) + ClipboardTagId[ 0 ]; - int masterNodeId = UIUtils.CurrentWindow.CurrentGraph.CurrentMasterNodeId; - int count = selectedNodes.Count; - for ( int i = 0; i < count; i++ ) - { - if ( UIUtils.CurrentWindow.IsShaderFunctionWindow || !graph.IsMasterNode( selectedNodes[ i ] )) - { - string nodeData = string.Empty; - string connections = string.Empty; - selectedNodes[ i ].ClipboardFullWriteToString( ref nodeData, ref connections ); - clipboardData += nodeData; - if ( !string.IsNullOrEmpty( connections ) ) - { - connections = connections.Substring( 0, connections.Length - 1 ); - clipboardData += "\n" + connections; - } - if ( i < count - 1 ) - clipboardData += ClipboardTagId[ 0 ]; - - //ClipboardData data = new ClipboardData( nodeData, connections, selectedNodes[ i ].UniqueId ); - //m_clipboardStrData.Add( data ); - //m_clipboardAuxData.Add( selectedNodes[ i ].UniqueId, data ); - } - } - - if ( !string.IsNullOrEmpty( clipboardData ) ) - { - EditorPrefs.SetString( ClipboardId, clipboardData ); - } - //for ( int i = 0; i < selectedNodes.Count; i++ ) - //{ - // if ( selectedNodes[ i ].UniqueId != masterNodeId ) - // { - // WireNode wireNode = selectedNodes[ i ] as WireNode; - // if ( wireNode != null ) - // { - // if ( !IsNodeChainValid( selectedNodes[ i ], true ) || !IsNodeChainValid( selectedNodes[ i ], false ) ) - // { - // UnityEngine.Debug.Log( "found invalid wire port" ); - // } - // } - // } - //} - } - - public Vector3 GetDataFromEditorPrefs() - { - Vector3 initialPos = Vector3.zero; - m_clipboardStrData.Clear(); - m_clipboardAuxData.Clear(); - string clipboardData = EditorPrefs.GetString( ClipboardId, string.Empty ); - if ( !string.IsNullOrEmpty( clipboardData ) ) - { - string[] clipboardDataArray = clipboardData.Split( ClipboardTagId, StringSplitOptions.None ); - initialPos = IOUtils.StringToVector3( clipboardDataArray[0] ); - for ( int i = 1; i < clipboardDataArray.Length; i++ ) - { - if ( !string.IsNullOrEmpty( clipboardDataArray[ i ] ) ) - { - int wiresIndex = clipboardDataArray[ i ].IndexOf( IOUtils.LINE_TERMINATOR ); - string nodeData = string.Empty; - string connections = string.Empty; - if ( wiresIndex < 0 ) - { - nodeData = clipboardDataArray[ i ]; - } - else - { - nodeData = clipboardDataArray[ i ].Substring( 0, wiresIndex ); - connections = clipboardDataArray[ i ].Substring( wiresIndex + 1 ); - } - string[] nodeDataArr = nodeData.Split( IOUtils.FIELD_SEPARATOR ); - if ( nodeDataArr.Length > 2 ) - { - int nodeId = Convert.ToInt32( nodeDataArr[ 2 ] ); - ClipboardData data = new ClipboardData( nodeData, connections, nodeId ); - m_clipboardStrData.Add( data ); - m_clipboardAuxData.Add( nodeId, data ); - } - - } - } - } - return initialPos; - } - - public bool IsNodeChainValid( ParentNode currentNode, bool forward ) - { - WireNode wireNode = currentNode as WireNode; - if ( wireNode == null ) - { - return m_clipboardAuxData.ContainsKey( currentNode.UniqueId ); - } - - if ( forward ) - { - if ( wireNode.InputPorts[ 0 ].ExternalReferences.Count > 0 ) - { - int nodeId = wireNode.InputPorts[ 0 ].ExternalReferences[ 0 ].NodeId; - if ( m_clipboardAuxData.ContainsKey( nodeId ) ) - { - return IsNodeChainValid( UIUtils.GetNode( nodeId ), forward ); - } - } - } - else - { - int nodeId = wireNode.OutputPorts[ 0 ].ExternalReferences[ 0 ].NodeId; - if ( m_clipboardAuxData.ContainsKey( nodeId ) ) - { - return IsNodeChainValid( UIUtils.GetNode( nodeId ), forward ); - } - } - return false; - } - - public void GenerateFullString() - { - string data = string.Empty; - for ( int i = 0; i < m_clipboardStrData.Count; i++ ) - { - data += m_clipboardStrData[ i ].ToString(); - if ( i < m_clipboardStrData.Count - 1 ) - { - data += IOUtils.LINE_TERMINATOR; - } - } - } - - public void ClearClipboard() - { - m_clipboardStrData.Clear(); - m_clipboardAuxData.Clear(); - m_multiPassMasterNodeData.Clear(); - } - - public ClipboardData GetClipboardData( int oldNodeId ) - { - if ( m_clipboardAuxData.ContainsKey( oldNodeId ) ) - return m_clipboardAuxData[ oldNodeId ]; - return null; - } - - public int GeNewNodeId( int oldNodeId ) - { - if ( m_clipboardAuxData.ContainsKey( oldNodeId ) ) - return m_clipboardAuxData[ oldNodeId ].NewNodeId; - return -1; - } - - public List<ClipboardData> CurrentClipboardStrData - { - get { return m_clipboardStrData; } - } - - public bool HasCachedMasterNodes { get { return m_multiPassMasterNodeData.Count > 0; } } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Clipboard.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Clipboard.cs.meta deleted file mode 100644 index 3e4b657c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Clipboard.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 8850a8c4f3ca99f42bbf602c671ffb7f -timeCreated: 1481126957 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/ConfirmationWindow.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/ConfirmationWindow.cs deleted file mode 100644 index 896c432b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/ConfirmationWindow.cs +++ /dev/null @@ -1,120 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEditor; -using UnityEngine; - -namespace AmplifyShaderEditor -{ - public class ConfirmationWindow - { - public delegate ShaderLoadResult OnConfirmationSelected( bool value, Shader shader, Material material ); - public event OnConfirmationSelected OnConfirmationSelectedEvt; - - private const string m_yesStr = "Yes"; - private const string m_noStr = "No"; - private bool m_isActive = false; - private string m_currentMessage; - - private GUIStyle m_areaStyle; - private GUIContent m_content; - private GUIStyle m_buttonStyle; - private GUIStyle m_labelStyle; - - - private Shader m_shader; - private Material m_material; - private Rect m_area; - private bool m_autoDeactivate = true; - - - public ConfirmationWindow( float x, float y, float width, float height ) - { - m_content = new GUIContent( GUIContent.none ); - m_area = new Rect( x, y, width, height ); - } - - public void Destroy() - { - m_shader = null; - OnConfirmationSelectedEvt = null; - } - - public void ActivateConfirmation( Shader shader, Material material, string message, OnConfirmationSelected evt, bool autoDeactivate = true ) - { - OnConfirmationSelectedEvt = evt; - m_currentMessage = message; - m_shader = shader; - m_material = material; - m_autoDeactivate = autoDeactivate; - m_isActive = true; - } - - public void OnGUI() - { - if ( m_areaStyle == null ) - { - m_areaStyle = new GUIStyle( UIUtils.TextArea ); - m_areaStyle.stretchHeight = true; - m_areaStyle.stretchWidth = true; - m_areaStyle.fontSize = ( int ) Constants.DefaultTitleFontSize; - } - - if ( m_buttonStyle == null ) - { - m_buttonStyle = UIUtils.Button; - } - - if ( m_labelStyle == null ) - { - m_labelStyle = new GUIStyle( UIUtils.Label ); - m_labelStyle.alignment = TextAnchor.MiddleCenter; - m_labelStyle.wordWrap = true; - } - - m_area.x = ( int ) ( 0.5f * UIUtils.CurrentWindow.CameraInfo.width ); - m_area.y = ( int ) ( 0.5f * UIUtils.CurrentWindow.CameraInfo.height ); - - GUILayout.BeginArea( m_area, m_content, m_areaStyle ); - { - EditorGUILayout.BeginVertical(); - { - EditorGUILayout.Separator(); - EditorGUILayout.LabelField( m_currentMessage, m_labelStyle ); - - EditorGUILayout.Separator(); - EditorGUILayout.Separator(); - EditorGUILayout.BeginHorizontal(); - { - if ( GUILayout.Button( m_yesStr, m_buttonStyle ) ) - { - if ( OnConfirmationSelectedEvt != null ) - OnConfirmationSelectedEvt( true, m_shader, m_material ); - - if ( m_autoDeactivate ) - Deactivate(); - } - - if ( GUILayout.Button( m_noStr, m_buttonStyle ) ) - { - if ( OnConfirmationSelectedEvt != null ) - OnConfirmationSelectedEvt( false, m_shader, m_material ); - if ( m_autoDeactivate ) - Deactivate(); - } - } - EditorGUILayout.EndHorizontal(); - } - EditorGUILayout.EndVertical(); - } - GUILayout.EndArea(); - } - - public void Deactivate() - { - m_isActive = false; - OnConfirmationSelectedEvt = null; - } - public bool IsActive { get { return m_isActive; } } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/ConfirmationWindow.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/ConfirmationWindow.cs.meta deleted file mode 100644 index 7770352f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/ConfirmationWindow.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 291cb40a04f835a4d89037cf3053c6a3 -timeCreated: 1481126954 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/ConsoleLogWindow.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/ConsoleLogWindow.cs deleted file mode 100644 index 937ebe21..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/ConsoleLogWindow.cs +++ /dev/null @@ -1,288 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System.Collections.Generic; -using UnityEditor; -using UnityEngine; - -namespace AmplifyShaderEditor -{ - [System.Serializable] - public class Toast - { - public MessageSeverity ItemType; - public string ItemMessage; - public double ItemTime; - public int ItemOwnerId; - public Toast( MessageSeverity itemType, string itemMessage, double itemTime,int itemOwnerId ) - { - ItemType = itemType; - ItemMessage = itemMessage; - ItemTime = itemTime; - ItemOwnerId = itemOwnerId; - } - } - - public class ConsoleLogWindow - { - public const int MAXWIDTH = 400; - public const float FADETIME = 7; - - private readonly GUIContent m_boxToggleContent = new GUIContent( "\u2261", "Toggle Message Box" ); - private readonly GUIContent m_clearContent = new GUIContent( "\u00D7", "Clear Messages" ); - - protected AmplifyShaderEditorWindow m_parentWindow = null; - - // needs to be serialized - private Vector2 m_currentScrollPos; - - int lastCall = -1; - - public ConsoleLogWindow( AmplifyShaderEditorWindow parentWindow ) - { - m_parentWindow = parentWindow; - } - - public void AddMessage( MessageSeverity itemType, string itemMessage , int itemOwnerId ) - { - var toast = new Toast( itemType, itemMessage, Time.realtimeSinceStartup, itemOwnerId ); - m_parentWindow.Messages.Insert( 0, toast ); - m_currentScrollPos.y = Mathf.Infinity; - - if( !m_parentWindow.MaximizeMessages ) - lastCall = Mathf.Max( (int)itemType, lastCall ); - - GUIContent gc = new GUIContent( m_parentWindow.Messages.Count + ": " + itemMessage ); - float maxWidth = m_parentWindow.MaxMsgWidth; - maxWidth = Mathf.Max( GUIStyle.none.CalcSize( gc ).x + 16, maxWidth ); - maxWidth = Mathf.Min( maxWidth, MAXWIDTH ); - m_parentWindow.MaxMsgWidth = maxWidth; - } - - public void Draw( Rect parentPosition, Vector2 mousePosition, int mouseButtonId, bool hasKeyboadFocus, float rightSide ) - { - EventType currentEventType = Event.current.type; - var messages = m_parentWindow.Messages; - var maximize = m_parentWindow.MaximizeMessages; - - Rect button = parentPosition; - button.width = 22; - button.height = 22; - button.x = parentPosition.x + parentPosition.width - button.width - rightSide - 8; - button.y = parentPosition.y + parentPosition.height - button.height - ( m_parentWindow.CurrentSelection == ASESelectionMode.Material ? 52 : 8 ); - - Rect toolbarArea = button; - toolbarArea.y -= 5; - if( maximize ) - { - toolbarArea.xMin -= m_parentWindow.MaxMsgWidth; - toolbarArea.yMin -= 66; - } - toolbarArea.x -= 6; - - bool needsRepaint = false; - if( maximize ) - { - GUIStyle labelStyle = UIUtils.ConsoleLogLabel; - toolbarArea.y -= 16 + 8; - GUILayout.BeginArea( toolbarArea, UIUtils.ConsoleLogMessage ); - EditorGUILayout.BeginVertical(); - m_currentScrollPos = EditorGUILayout.BeginScrollView( m_currentScrollPos ); - { - int count = messages.Count; - for( int i = count - 1; i >= 0; i-- ) - { - switch( messages[ i ].ItemType ) - { - case MessageSeverity.Error: - labelStyle.normal.textColor = Color.red; - break; - case MessageSeverity.Warning: - labelStyle.normal.textColor = Color.yellow; - break; - default: - case MessageSeverity.Normal: - labelStyle.normal.textColor = Color.white; - break; - } - - if( messages[ i ].ItemOwnerId < 0 ) - { - GUILayout.Label( ( count - i ) + ": " + messages[ i ].ItemMessage, labelStyle ); - } - else - { - if( GUILayout.Button( ( count - i ) + ": " + messages[ i ].ItemMessage, labelStyle ) ) - { - UIUtils.CurrentWindow.FocusOnNode( messages[ i ].ItemOwnerId, 1, true ); - } - } - } - } - EditorGUILayout.EndScrollView(); - EditorGUILayout.EndVertical(); - - GUILayout.EndArea(); - } - else - { - // draw toaster - int count = messages.Count; - Rect rect = toolbarArea; - rect.xMin -= 200; - - float startFade = FADETIME - 1; - for( int i = 0; i < count; i++ ) - { - GUIStyle msgstyle = UIUtils.ConsoleLogMessage; - float delta = (float)(Time.realtimeSinceStartup - messages[ i ].ItemTime); - if( delta > FADETIME ) - continue; - - if( delta < 0.1f ) - { - msgstyle.normal.textColor = Color.cyan; - } - else if( delta < startFade ) - { - switch( messages[ i ].ItemType ) - { - case MessageSeverity.Error: - msgstyle.normal.textColor = Color.red; - break; - case MessageSeverity.Warning: - msgstyle.normal.textColor = Color.yellow; - break; - default: - case MessageSeverity.Normal: - msgstyle.normal.textColor = Color.white; - break; - } - } - else - { - switch( messages[ i ].ItemType ) - { - case MessageSeverity.Error: - msgstyle.normal.textColor = new Color( 1, 0, 0, FADETIME - delta ); - break; - case MessageSeverity.Warning: - msgstyle.normal.textColor = new Color( 1, 1, 0, FADETIME - delta ); - break; - default: - case MessageSeverity.Normal: - msgstyle.normal.textColor = new Color( 1, 1, 1, FADETIME - delta ); - break; - } - } - - needsRepaint = true; - - GUIContent gc = new GUIContent( messages[ i ].ItemMessage ); - var sizes = msgstyle.CalcSize( gc ); - rect.xMin -= sizes.x - rect.width; - rect.height = sizes.y; - rect.y -= rect.height + 2; - if( messages[ i ].ItemOwnerId < 0 ) - { - GUI.Label( rect, gc, msgstyle ); - } - else - { - if( GUI.Button( rect, gc, msgstyle )) - { - UIUtils.CurrentWindow.FocusOnNode( messages[ i ].ItemOwnerId, 1, true ); - } - } - } - } - //GUI.color = cached; - - if( needsRepaint ) - m_parentWindow.MarkToRepaint(); - - GUIStyle style = UIUtils.ConsoleLogCircle; - - button.size = Vector2.one * 16; - - switch( lastCall ) - { - case 0: - style.normal.textColor = Color.cyan; - break; - case 1: - style.normal.textColor = Color.yellow; - break; - case 2: - style.normal.textColor = Color.red; - break; - default: - style.normal.textColor = new Color( 1, 1, 1, 0.5f ); - break; - } - - if( GUI.Button( button, m_boxToggleContent, style ) ) - { - maximize = !maximize; - m_parentWindow.MaximizeMessages = maximize; - m_currentScrollPos.y = Mathf.Infinity; - lastCall = -1; - } - - style.normal.textColor = new Color( 1, 1, 1, 0.5f ); - //GUI.color = cached; - button.x -= button.width + 2; - - if( maximize && GUI.Button( button, m_clearContent, style ) ) - { - if( messages.Count == 0 ) - { - maximize = false; - m_parentWindow.MaximizeMessages = maximize; - } - ClearMessages(); - } - - button.width += button.width + 2; - bool mouseOnTop = button.Contains( mousePosition ); - - if( currentEventType == EventType.MouseMove && mouseOnTop ) - m_parentWindow.MarkToRepaint(); - - if( DebugConsoleWindow.DeveloperMode ) - { - if( Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Alpha1 ) - { - UIUtils.ShowMessage( "This is an info message\nwith two lines" ); - } - - if( Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Alpha2 ) - { - UIUtils.ShowMessage( "This is a warning message", MessageSeverity.Warning ); - } - - if( Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Alpha3 ) - { - - UIUtils.ShowMessage( "THIS IS AN ERROR MESSAGE!!", MessageSeverity.Error ); - } - } - } - - public void ClearMessages() - { - m_parentWindow.Messages.Clear(); - m_parentWindow.MaxMsgWidth = 100; - } - - public void Toggle() - { - - } - - public void Destroy() - { - m_parentWindow = null; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/ConsoleLogWindow.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/ConsoleLogWindow.cs.meta deleted file mode 100644 index 617e129d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/ConsoleLogWindow.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: ed706353a579cbb46b300406107108b1 -timeCreated: 1506345180 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/ContextMenuItem.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/ContextMenuItem.cs deleted file mode 100644 index 4834ee1f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/ContextMenuItem.cs +++ /dev/null @@ -1,81 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using UnityEngine; - -namespace AmplifyShaderEditor -{ - public class ContextMenuItem - { - private const string PALETTE_NAME_MOD_STR = " "; - - private string m_paletteName; - private string m_name; - private string m_tags; - private string m_category; - private string m_description; - private System.Type m_type; - private GUIContent m_guiContent; - private string m_nameWithShortcut; - private AmplifyShaderFunction m_function; - private NodeAttributes m_nodeAttributes; - - public ContextMenuItem( NodeAttributes nodeAttributes, System.Type type, string name, string tags, string category, string description, AmplifyShaderFunction function, KeyCode shortcut ) - { - m_nodeAttributes = nodeAttributes; - m_name = name; - m_tags = name + ( string.IsNullOrEmpty( tags ) ? "" : " " + tags ); - m_tags = m_tags.ToLower(); - m_nameWithShortcut = shortcut != KeyCode.None ? ( name + " [ " + UIUtils.KeyCodeToString( shortcut ) + " ]" ) : name; - m_paletteName = PALETTE_NAME_MOD_STR + m_name; - m_type = type; - m_category = category; - m_description = description; - m_function = function; - m_guiContent = new GUIContent( m_nameWithShortcut, m_description ); - } - - public int CompareTo( ContextMenuItem item , bool useWeights ) - { - if ( useWeights && NodeAttributes.SortOrderPriority > -1 && item.NodeAttributes.SortOrderPriority > -1 ) - { - if ( NodeAttributes.SortOrderPriority > item.NodeAttributes.SortOrderPriority ) - { - return 1; - } - else if ( NodeAttributes.SortOrderPriority == item.NodeAttributes.SortOrderPriority ) - { - return m_name.CompareTo( item.Name ); - } - else - { - return -1; - } - } - return m_name.CompareTo( item.Name ); - } - - public string PaletteName { get { return m_paletteName; } } - public string Name { get { return m_name; } } - public string Tags { get { return m_tags; } } - public string NameWithShortcut { get { return m_nameWithShortcut; } } - public string Category { get { return m_category; } } - public string Description { get { return m_description; } } - public AmplifyShaderFunction Function { get { return m_function; } } - public System.Type NodeType { get { return m_type; } } - public GUIContent ItemUIContent { get { return m_guiContent; } } - public NodeAttributes NodeAttributes { get { return m_nodeAttributes; } } - - public override string ToString() - { - return m_name + ":" + m_category + ":" + m_description; - } - - public void Destroy() - { - m_guiContent = null; - m_nodeAttributes = null; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/ContextMenuItem.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/ContextMenuItem.cs.meta deleted file mode 100644 index 7b1fbe8c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/ContextMenuItem.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 417f409230c530b468b8ab67dd6e3b8b -timeCreated: 1481126955 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/CustomStylesContainer.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/CustomStylesContainer.cs deleted file mode 100644 index 0de8b80a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/CustomStylesContainer.cs +++ /dev/null @@ -1,53 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -//using UnityEditor; -//using UnityEngine; -//namespace AmplifyShaderEditor -//{ -// //EditorGUIUtility.GetBuiltinSkin(EditorSkin.Inspector) -// // this might be a bit nonsense since I could use the GetBuiltinSkin directly but this way will bea easier to change to some custom visuals on some near future -// [System.Serializable] -// public class CustomStylesContainer -// { -// public GUIStyle FoldoutStyle -// { -// get { return EditorStyles.foldout; } -// } - -// public GUIStyle Label -// { -// get { return GUI.skin.label; } -// } - -// public GUIStyle Button -// { -// get { return GUI.skin.button; } -// } - -// public GUIStyle TextArea -// { -// get { return GUI.skin.textArea; } -// } - -// public GUIStyle Toggle -// { -// get { return GUI.skin.toggle; } -// } - -// public GUIStyle Window -// { -// get { return GUI.skin.window; } -// } - -// public GUIStyle Textfield -// { -// get { return GUI.skin.textField; } -// } - -// public GUIStyle Box -// { -// get { return GUI.skin.box; } -// } -// } -//} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/CustomStylesContainer.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/CustomStylesContainer.cs.meta deleted file mode 100644 index b677796e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/CustomStylesContainer.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 79d0d783b532b474192b191547bee1c1 -timeCreated: 1481126957 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/DebugConsoleWindow.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/DebugConsoleWindow.cs deleted file mode 100644 index 85f4604a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/DebugConsoleWindow.cs +++ /dev/null @@ -1,203 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -//#define ASE_CONSOLE_WINDOW - -using UnityEngine; -using UnityEditor; -using System.Collections.Generic; - -namespace AmplifyShaderEditor -{ - public sealed class DebugConsoleWindow : EditorWindow - { - private const float WindowSizeX = 250; - private const float WindowSizeY = 250; - private const float WindowPosX = 5; - private const float WindowPosY = 5; - private Rect m_availableArea; - - private bool m_wikiAreaFoldout = true; - private bool m_miscAreaFoldout = true; - private Vector2 m_currentScrollPos; - - private int m_minURLNode = 0; - private int m_maxURLNode = -1; - -#if ASE_CONSOLE_WINDOW - public readonly static bool DeveloperMode = true; - public static bool UseShaderPanelsInfo = true; - [MenuItem( "Window/Amplify Shader Editor/Open Debug Console" )] - static void OpenMainShaderGraph() - { - OpenWindow(); - } - [MenuItem( "Window/Amplify Shader Editor/Create Template Menu Items" )] - public static void CreateTemplateMenuItems() - { - UIUtils.CurrentWindow.TemplatesManagerInstance.CreateTemplateMenuItems(); - } - -#else - public readonly static bool DeveloperMode = false; - public static bool UseShaderPanelsInfo = false; -#endif - - public static DebugConsoleWindow OpenWindow() - { - if ( DeveloperMode ) - { - DebugConsoleWindow currentWindow = ( DebugConsoleWindow ) DebugConsoleWindow.GetWindow( typeof( DebugConsoleWindow ), false, "ASE Debug Console" ); - currentWindow.titleContent.tooltip = "Debug Options for ASE. Intented only for ASE development team"; - currentWindow.minSize = new Vector2( WindowSizeX, WindowSizeY ); - currentWindow.maxSize = new Vector2( WindowSizeX, 2 * WindowSizeY ); ; - currentWindow.wantsMouseMove = true; - return currentWindow; - } - return null; - } - - void OnGUI() - { - m_availableArea = new Rect( WindowPosX, WindowPosY, position.width - 2 * WindowPosX, position.height - 2 * WindowPosY ); - GUILayout.BeginArea( m_availableArea ); - { - m_currentScrollPos = EditorGUILayout.BeginScrollView( m_currentScrollPos, GUILayout.Width( 0 ), GUILayout.Height( 0 ) ); - { - EditorGUILayout.BeginVertical(); - { - AmplifyShaderEditorWindow window = UIUtils.CurrentWindow; - if ( window != null ) - { - EditorGUILayout.Separator(); - - NodeUtils.DrawPropertyGroup( ref m_wikiAreaFoldout, "Wiki Helper", ShowWikiHelperFunctions ); - - EditorGUILayout.Separator(); - - NodeUtils.DrawPropertyGroup( ref m_miscAreaFoldout, "Misc", ShowMiscFuntions ); - - EditorGUILayout.Separator(); - } - else - { - EditorGUILayout.LabelField( "Please open an ASE window to access debug options" ); - } - } - EditorGUILayout.EndVertical(); - } - EditorGUILayout.EndScrollView(); - } - GUILayout.EndArea(); - } - - void ShowWikiHelperFunctions() - { - AmplifyShaderEditorWindow window = UIUtils.CurrentWindow; - EditorGUILayout.Separator(); - - if ( GUILayout.Button( "Nodes Screen Shots" ) ) - { - window.CurrentNodeExporterUtils.ActivateAutoScreenShot( Application.dataPath + "/../NodesInfo/Shots/",0,-1 ); - } - - GUILayout.BeginHorizontal(); - if( GUILayout.Button( "Nodes URLs" ) ) - { - window.CurrentNodeExporterUtils.ActivateNodesURL( m_minURLNode, m_maxURLNode ); - } - m_minURLNode = EditorGUILayout.IntField( m_minURLNode ); - m_maxURLNode = EditorGUILayout.IntField( m_maxURLNode ); - GUILayout.EndHorizontal(); - - EditorGUILayout.Separator(); - - if( GUILayout.Button( "Nodes Undo Test" ) ) - { - window.CurrentNodeExporterUtils.ActivateAutoUndo(); - } - - EditorGUILayout.Separator(); - - if ( GUILayout.Button( "Nodes Info" ) ) - { - window.CurrentPaletteWindow.DumpAvailableNodes( false, Application.dataPath + "/../NodesInfo/" ); - window.CurrentPaletteWindow.DumpAvailableNodes( true, Application.dataPath + "/../NodesInfo/" ); - } - - EditorGUILayout.Separator(); - - if ( GUILayout.Button( "Shortcuts Info" ) ) - { - window.ShortcutManagerInstance.DumpShortcutsToDisk( Application.dataPath + "/../NodesInfo/" ); - } - } - - void ShowMiscFuntions() - { - AmplifyShaderEditorWindow window = UIUtils.CurrentWindow; - if ( GUILayout.Button( "Force Example Shader Compilation" ) ) - { - UIUtils.ForceExampleShaderCompilation(); - } - EditorGUILayout.Separator(); - - if ( GUILayout.Button( "Refresh Available Nodes" ) ) - { - window.RefreshAvaibleNodes(); - } - - EditorGUILayout.Separator(); - - if ( GUILayout.Button( "Dump Uniform Names" ) ) - { - //window.CurrentPaletteWindow.NewList() - window.DuplicatePrevBufferInstance.DumpUniformNames(); - } - - EditorGUILayout.Separator(); - - if ( GUILayout.Button( "Force Palette Update" ) ) - { - Debug.Log( UIUtils.CurrentWindow.IsShaderFunctionWindow ); - window.CurrentPaletteWindow.ForceUpdate = true; - } - - EditorGUILayout.Separator(); - - if( GUILayout.Button( "Detect Infinite Loops" ) ) - { - if( window.IsShaderFunctionWindow ) - { - Debug.Log( "Starting infinite loop detection over shader functions" ); - List<FunctionOutput> nodes = window.OutsideGraph.FunctionOutputNodes.NodesList; - for( int i = 0; i < nodes.Count; i++ ) - { - UIUtils.DetectNodeLoopsFrom( nodes[ i ], new Dictionary<int, int>() ); - } - } - else - { - if( window.OutsideGraph.MultiPassMasterNodes.Count > 0 ) - { - Debug.Log( "Starting infinite loop detection over shader from template" ); - List<TemplateMultiPassMasterNode> nodes = window.OutsideGraph.MultiPassMasterNodes.NodesList; - for( int i = 0; i < nodes.Count; i++ ) - { - UIUtils.DetectNodeLoopsFrom( nodes[ i ], new Dictionary<int, int>() ); - } - } - else - { - Debug.Log( "Starting infinite loop detection over standard shader" ); - UIUtils.DetectNodeLoopsFrom( window.OutsideGraph.CurrentMasterNode, new Dictionary<int, int>() ); - } - } - Debug.Log( "End infinite loop detection" ); - } - } - } -} - - - diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/DebugConsoleWindow.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/DebugConsoleWindow.cs.meta deleted file mode 100644 index a9e53839..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/DebugConsoleWindow.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 52308890136cd7746a5a073c9be8f028 -timeCreated: 1487850100 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/DragAndDropTool.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/DragAndDropTool.cs deleted file mode 100644 index 2da02086..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/DragAndDropTool.cs +++ /dev/null @@ -1,47 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEditor; -using UnityEngine; - -namespace AmplifyShaderEditor -{ - public class DragAndDropTool - { - public delegate void OnValidDropObject(params UnityEngine.Object[] draggedObjs ); - public event OnValidDropObject OnValidDropObjectEvt; - - public void Destroy() - { - OnValidDropObjectEvt = null; - } - - public void TestDragAndDrop( Rect dropArea ) - { - Event currentEvent = Event.current; - EventType currentEventType = currentEvent.type; - - switch (currentEventType) - { - case EventType.DragUpdated: - case EventType.DragPerform: - { - - if (!dropArea.Contains(currentEvent.mousePosition)) - return; - - DragAndDrop.visualMode = DragAndDropVisualMode.Copy; - if (currentEvent.type == EventType.DragPerform) - { - DragAndDrop.AcceptDrag(); - if (OnValidDropObjectEvt != null) - { - OnValidDropObjectEvt(DragAndDrop.objectReferences); - } - } - }break; - case EventType.DragExited:DragAndDrop.PrepareStartDrag();break; - } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/DragAndDropTool.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/DragAndDropTool.cs.meta deleted file mode 100644 index 3ca3a86b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/DragAndDropTool.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 41c9bd09aea1377459c7e62910711c22 -timeCreated: 1481126955 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/DuplicatePreventionBuffer.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/DuplicatePreventionBuffer.cs deleted file mode 100644 index 6f763338..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/DuplicatePreventionBuffer.cs +++ /dev/null @@ -1,375 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace AmplifyShaderEditor -{ - [Serializable] - public class DuplicatePreventionBuffer - { - private const string VectorNameStr = "Vector "; - private const string TextureSampleNameStr = "Texture Sample "; - private const string MatrixNameStr = "Matrix "; - private const string IntNameStr = "Int "; - private const string FloatNameStr = "Float "; - private const string ColorNameStr = "Color "; - - [SerializeField] - private int[] m_availableUVChannelsArray = { -1, -1, -1, -1 }; - private string[] m_availableUVChannelsNamesArray = { "null", - "null", - "null", - "null" }; - - private Dictionary<string, int> m_availablePropertyNames = new Dictionary<string, int>(); - private Dictionary<string, int> m_availableUniformNames = new Dictionary<string, int>(); - private Dictionary<string, int> m_availableLocalVariableNames = new Dictionary<string, int>(); - - public void ReleaseAllUVChannels() - { - for ( int i = 0; i < m_availableUVChannelsArray.Length; i++ ) - { - m_availableUVChannelsArray[ i ] = -1; - } - } - - public bool RegisterUVChannel( int nodeId, int channelId, string name ) - { - if ( channelId < 0 || - channelId > ( m_availableUVChannelsArray.Length - 1 ) || - m_availableUVChannelsArray[ channelId ] >= 0 ) - { - return false; - } - - m_availableUVChannelsArray[ channelId ] = nodeId; - m_availableUVChannelsNamesArray[ channelId ] = name; - return true; - } - - - public bool ReleaseUVChannel( int nodeId, int channelId ) - { - if ( channelId < 0 || - channelId > ( m_availableUVChannelsArray.Length - 1 ) ) - { - return false; - } - - if ( m_availableUVChannelsArray[ channelId ] == nodeId ) - { - m_availableUVChannelsArray[ channelId ] = -1; - return true; - } - return false; - } - - public int RegisterFirstAvailableChannel( int nodeId , string name) - { - for ( int i = 0; i < m_availableUVChannelsArray.Length; i++ ) - { - if ( m_availableUVChannelsArray[ i ] == -1 ) - { - m_availableUVChannelsArray[ i ] = nodeId; - m_availableUVChannelsNamesArray[ i ] = name; - return i; - } - } - return -1; - } - - public bool IsChannelAvailable( int channelId ) - { - if ( channelId < 0 || - channelId > ( m_availableUVChannelsArray.Length - 1 ) ) - { - return false; - } - - return ( m_availableUVChannelsArray[ channelId ] < 0 ); - } - - public int GetFirstOccupiedChannel() - { - for ( int i = 0; i < 4; i++ ) - { - if ( m_availableUVChannelsArray[ i ] > -1 ) - return i; - } - return -1; - } - - public string GetChannelName( int channelId ) - { - if ( channelId < 0 || - channelId > ( m_availableUVChannelsArray.Length - 1 ) ) - { - return string.Empty; - } - - return m_availableUVChannelsNamesArray[ channelId ] ; - } - - public void SetChannelName( int channelId , string name ) - { - if ( channelId < 0 || - channelId > ( m_availableUVChannelsArray.Length - 1 ) ) - { - return; - } - m_availableUVChannelsNamesArray[ channelId ] = name; - } - - public bool RegisterLocalVariableName( int nodeId, string name ) - { - if ( name.Length == 0 ) - return false; - - if ( m_availableLocalVariableNames.ContainsKey( name ) ) - { - if ( m_availableLocalVariableNames[ name ] > -1 ) - { - return false; - } - else - { - m_availableLocalVariableNames[ name ] = nodeId; - return true; - } - } - - m_availableLocalVariableNames.Add( name, nodeId ); - return true; - } - - public int CheckUniformNameOwner( string name ) - { - if ( name.Length == 0 ) - return -1; - - if ( m_availableUniformNames.ContainsKey( name ) ) - { - return m_availableUniformNames[ name ]; - } - - return -1; - } - - public bool RegisterUniformName( int nodeId, string name ) - { - if ( name.Length == 0 ) - return false; - - if ( m_availableUniformNames.ContainsKey( name ) ) - { - if ( m_availableUniformNames[ name ] > -1 ) - { - return false; - } - else - { - m_availableUniformNames[ name ] = nodeId; - return true; - } - } - - m_availableUniformNames.Add( name, nodeId ); - return true; - } - - public void DumpUniformNames() - { - string val = "CONTENTS\n"; - foreach ( KeyValuePair<string, int> kvp in m_availableUniformNames ) - { - val += ( "key " + kvp.Key + " : value " + kvp.Value + "\n" ); - } - } - - public void DumpLocalVariableNames() - { - string val = "CONTENTS\n"; - foreach ( KeyValuePair<string, int> kvp in m_availableLocalVariableNames ) - { - val += ( "key " + kvp.Key + " : value " + kvp.Value + "\n" ); - } - } - - - public bool ReleaseUniformName( int nodeId, string name ) - { - if ( !string.IsNullOrEmpty(name) && name.Length == 0 ) - return false; - - if ( m_availableUniformNames.ContainsKey( name ) ) - { - if ( m_availableUniformNames[ name ] == nodeId ) - { - m_availableUniformNames.Remove( name ); - return true; - } - } - return false; - } - - public bool ReleaseLocalVariableName( int nodeId, string name ) - { - if ( name.Length == 0 ) - return false; - - if ( m_availableLocalVariableNames.ContainsKey( name ) ) - { - if ( m_availableLocalVariableNames[ name ] == nodeId ) - { - m_availableLocalVariableNames.Remove( name ); - return true; - } - } - return false; - } - - public void ReleaseAllUniformNames() - { - m_availableUniformNames.Clear(); - } - - public void ReleaseAllLocalVariableNames() - { - m_availableLocalVariableNames.Clear(); - } - - public void GetFirstAvailableName( int nodeId, WirePortDataType type , out string outProperty , out string outInspector, bool useCustomPrefix = false, string customPrefix = null) - { - string name = string.Empty; - if ( useCustomPrefix && customPrefix != null ) - { - name = customPrefix; - } - else - { - switch ( type ) - { - case WirePortDataType.OBJECT: - case WirePortDataType.FLOAT: - { - name = FloatNameStr; - } - break; - case WirePortDataType.INT: - { - name = IntNameStr; - } - break; - case WirePortDataType.FLOAT2: - case WirePortDataType.FLOAT3: - case WirePortDataType.FLOAT4: - { - name = VectorNameStr; - } - break; - case WirePortDataType.FLOAT3x3: - case WirePortDataType.FLOAT4x4: - { - name = MatrixNameStr; - } - break; - case WirePortDataType.COLOR: - { - name = ColorNameStr; - } - break; - } - } - - int count = 0; - bool foundName = false; - while ( !foundName ) - { - string inspectorName = name + count; - string propertyName = UIUtils.GeneratePropertyName( inspectorName , PropertyType.Property ); - - if ( IsUniformNameAvailable( propertyName ) ) - { - outInspector = inspectorName; - outProperty = propertyName; - RegisterUniformName( nodeId, propertyName ); - return; - } - count += 1; - } - outProperty = string.Empty; - outInspector = string.Empty; - UIUtils.ShowMessage( "Could not find a valid name " + MessageSeverity.Warning ); - } - - public bool IsUniformNameAvailable( string name ) - { - if ( m_availableUniformNames.ContainsKey( name ) && m_availableUniformNames[ name ] > -1 ) - return false; - return true; - } - - public bool IsLocalvariableNameAvailable( string name ) - { - if ( m_availableLocalVariableNames.ContainsKey( name ) && m_availableLocalVariableNames[ name ] > -1 ) - return false; - return true; - } - - public bool GetPropertyName( int nodeId, string name ) - { - if ( m_availablePropertyNames.ContainsKey( name ) ) - { - if ( m_availablePropertyNames[ name ] > -1 ) - { - return false; - } - else - { - m_availablePropertyNames[ name ] = nodeId; - return true; - } - } - - m_availablePropertyNames.Add( name, nodeId ); - return true; - } - - - public bool ReleasePropertyName( int nodeId, string name ) - { - if ( m_availablePropertyNames.ContainsKey( name ) ) - { - if ( m_availablePropertyNames[ name ] == nodeId ) - { - m_availablePropertyNames[ name ] = -1; - return true; - } - } - return false; - } - - public void ReleaseAllPropertyNames() - { - m_availablePropertyNames.Clear(); - } - - public bool IsPropertyNameAvailable( string name ) - { - if ( m_availablePropertyNames.ContainsKey( name ) && m_availablePropertyNames[ name ] > -1 ) - return false; - return true; - } - - public void ReleaseAllData() - { - ReleaseAllUVChannels(); - ReleaseAllUniformNames(); - ReleaseAllPropertyNames(); - ReleaseAllLocalVariableNames(); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/DuplicatePreventionBuffer.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/DuplicatePreventionBuffer.cs.meta deleted file mode 100644 index fd5e6614..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/DuplicatePreventionBuffer.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: a4cfbb4204c63ca4e8f7cec73f6b3ef8 -timeCreated: 1481126958 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/GraphContextMenu.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/GraphContextMenu.cs deleted file mode 100644 index adcbfe4e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/GraphContextMenu.cs +++ /dev/null @@ -1,375 +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.Text; -using System.Linq; -using System.Collections.Generic; -using System.Reflection; - -namespace AmplifyShaderEditor -{ - public class ShortcutKeyData - { - public bool IsPressed; - public System.Type NodeType; - public string Name; - public ShortcutKeyData( System.Type type, string name ) - { - NodeType = type; - Name = name; - IsPressed = false; - } - } - - public class GraphContextMenu - { - private List<ContextMenuItem> m_items; - private List<ContextMenuItem> m_itemFunctions; - private Dictionary<System.Type, NodeAttributes> m_itemsDict; - private Dictionary<System.Type, NodeAttributes> m_deprecatedItemsDict; - private Dictionary<System.Type, System.Type> m_castTypes; - private Dictionary<KeyCode, ShortcutKeyData> m_shortcutTypes; - - private KeyCode m_lastKeyPressed; - private ParentGraph m_currentGraph; - private bool m_correctlyLoaded = false; - - public GraphContextMenu( ParentGraph currentGraph ) - { - m_currentGraph = currentGraph; - m_correctlyLoaded = RefreshNodes( currentGraph ); - } - - private Type[] GetTypesInNamespace( Assembly assembly, string nameSpace ) - { - return assembly.GetTypes().Where( t => String.Equals( t.Namespace, nameSpace, StringComparison.Ordinal ) ).ToArray(); - } - - public bool RefreshNodes( ParentGraph currentGraph ) - { - if( m_items != null ) - { - m_items.Clear(); - m_items = null; - } - - if( m_itemFunctions != null ) - { - m_itemFunctions.Clear(); - m_itemFunctions = null; - } - - m_items = new List<ContextMenuItem>(); - m_itemFunctions = new List<ContextMenuItem>(); - - if( m_itemsDict != null ) - m_itemsDict.Clear(); - - m_itemsDict = new Dictionary<System.Type, NodeAttributes>(); - - if( m_deprecatedItemsDict != null ) - m_deprecatedItemsDict.Clear(); - - m_deprecatedItemsDict = new Dictionary<System.Type, NodeAttributes>(); - - if( m_castTypes != null ) - m_castTypes.Clear(); - - m_castTypes = new Dictionary<System.Type, System.Type>(); - - if( m_shortcutTypes != null ) - m_shortcutTypes.Clear(); - - m_shortcutTypes = new Dictionary<KeyCode, ShortcutKeyData>(); - - m_lastKeyPressed = KeyCode.None; - - // Fetch all available nodes by their attributes - try - { - //IEnumerable<System.Type> availableTypes = AppDomain.CurrentDomain.GetAssemblies().ToList().SelectMany( type => type.GetTypes() ); - Type[] availableTypes = GetTypesInNamespace( Assembly.GetExecutingAssembly(), "AmplifyShaderEditor" ); - foreach( System.Type type in availableTypes ) - { - foreach( NodeAttributes attribute in Attribute.GetCustomAttributes( type ).OfType<NodeAttributes>() ) - { - if( attribute.Available && !attribute.Deprecated ) - { - //if ( !UIUtils.CurrentWindow.IsShaderFunctionWindow && attribute.AvailableInFunctionsOnly ) - // continue; - - if( !UIUtils.HasColorCategory( attribute.Category ) ) - { - if( !String.IsNullOrEmpty( attribute.CustomCategoryColor ) ) - { - try - { - Color color = new Color(); - ColorUtility.TryParseHtmlString( attribute.CustomCategoryColor, out color ); - UIUtils.AddColorCategory( attribute.Category, color ); - } - catch( Exception e ) - { - Debug.LogException( e ); - UIUtils.AddColorCategory( attribute.Category, Constants.DefaultCategoryColor ); - } - } - //else - //{ - // UIUtils.AddColorCategory( attribute.Category, Constants.DefaultCategoryColor ); - //} - } - - if( attribute.CastType != null && attribute.CastType.Length > 0 && type != null ) - { - for( int i = 0; i < attribute.CastType.Length; i++ ) - { - m_castTypes.Add( attribute.CastType[ i ], type ); - } - } - - if( attribute.ShortcutKey != KeyCode.None && type != null ) - m_shortcutTypes.Add( attribute.ShortcutKey, new ShortcutKeyData( type, attribute.Name ) ); - - ContextMenuItem newItem = new ContextMenuItem( attribute, type, attribute.Name, attribute.Tags, attribute.Category, attribute.Description, null, attribute.ShortcutKey ); - if( UIUtils.GetNodeAvailabilityInBitArray( attribute.NodeAvailabilityFlags, NodeAvailability.SurfaceShader ) ) - m_items.Add( newItem ); - else if( UIUtils.GetNodeAvailabilityInBitArray( attribute.NodeAvailabilityFlags, currentGraph.ParentWindow.CurrentNodeAvailability ) ) - m_items.Add( newItem ); - else if( UIUtils.GetNodeAvailabilityInBitArray( attribute.NodeAvailabilityFlags, currentGraph.CurrentCanvasMode ) ) - m_items.Add( newItem ); - - m_itemsDict.Add( type, attribute ); - m_itemFunctions.Add( newItem ); - } - else - { - m_deprecatedItemsDict.Add( type, attribute ); - } - } - } - } - catch( ReflectionTypeLoadException exception ) - { - Debug.LogException( exception ); - return false; - } - - string[] guids = AssetDatabase.FindAssets( "t:AmplifyShaderFunction" ); - List<AmplifyShaderFunction> allFunctions = new List<AmplifyShaderFunction>(); - - for( int i = 0; i < guids.Length; i++ ) - { - allFunctions.Add( AssetDatabase.LoadAssetAtPath<AmplifyShaderFunction>( AssetDatabase.GUIDToAssetPath( guids[ i ] ) ) ); - } - - int functionCount = allFunctions.Count; - if( functionCount > 0 ) - { - m_castTypes.Add( typeof( AmplifyShaderFunction ), typeof( FunctionNode ) ); - } - - for( int i = 0; i < functionCount; i++ ) - { - if( !allFunctions[ i ].Hidden ) - { - NodeAttributes attribute = new NodeAttributes( allFunctions[ i ].FunctionName, allFunctions[ i ].CustomNodeCategory, allFunctions[ i ].Description, KeyCode.None, true, 0, int.MaxValue, typeof( AmplifyShaderFunction ) ); - System.Type type = typeof( FunctionNode ); - - ContextMenuItem newItem = new ContextMenuItem( attribute, type, AddSpacesToSentence( attribute.Name ), attribute.Tags, attribute.Category, attribute.Description, allFunctions[ i ], attribute.ShortcutKey ); - m_items.Add( newItem ); - m_itemFunctions.Add( newItem ); - } - } - - //Sort out the final list by name - m_items.Sort( ( x, y ) => x.Category.CompareTo( y.Category ) ); - m_itemFunctions.Sort( ( x, y ) => x.Category.CompareTo( y.Category ) ); - return true; - } - - public void Destroy() - { - for( int i = 0; i < m_items.Count; i++ ) - { - m_items[ i ].Destroy(); - } - - for( int i = 0; i < m_itemFunctions.Count; i++ ) - { - if( m_itemFunctions[ i ] != null ) - m_itemFunctions[ i ].Destroy(); - } - - m_items.Clear(); - m_items = null; - - m_itemFunctions.Clear(); - m_itemFunctions = null; - - m_itemsDict.Clear(); - m_itemsDict = null; - - m_deprecatedItemsDict.Clear(); - m_deprecatedItemsDict = null; - - m_castTypes.Clear(); - m_castTypes = null; - - m_shortcutTypes.Clear(); - m_shortcutTypes = null; - - } - - public static string AddSpacesToSentence( string text ) - { - if( string.IsNullOrEmpty( text ) ) - return string.Empty; - - bool lastIsUpper = char.IsUpper( text, 0 ); - bool lastIsLetter = char.IsLetter( text, 0 ); - StringBuilder title = new StringBuilder(); - title.Append( text[ 0 ] ); - for( int i = 1; i < text.Length; i++ ) - { - bool currIsUpper = char.IsUpper( text, i ); - bool currIsLetter = char.IsLetter( text, i ); - if( currIsUpper && !lastIsUpper && lastIsLetter ) - { - title.Append( " " ); - } - - // if current is a number and previous is a letter we space it (ie: Rotation2D = Rotation 2D) - if( lastIsLetter && char.IsNumber( text, i ) ) - { - title.Append( " " ); - } - - // if previous is upper, current is upper and the next two following are lower then we space it (ie: UVDistortion = UV Distortion) - if( i < text.Length - 1 ) - { - bool nextIsLower = char.IsLower( text, i + 1 ) && char.IsLetter( text, i + 1 ); - bool lastIsLower = i < text.Length - 2 ? char.IsLower( text, i + 2 ) && char.IsLetter( text, i + 2 ) : false; - if( lastIsUpper && currIsUpper && currIsLetter && nextIsLower && lastIsLower ) - { - title.Append( " " ); - } - } - lastIsUpper = currIsUpper; - lastIsLetter = currIsLetter; - title.Append( text[ i ] ); - } - return title.ToString(); - } - - public NodeAttributes GetNodeAttributesForType( System.Type type ) - { - if( type == null ) - { - Debug.LogError( "Invalid type detected" ); - return null; - } - - if( m_itemsDict.ContainsKey( type ) ) - return m_itemsDict[ type ]; - return null; - } - - public NodeAttributes GetDeprecatedNodeAttributesForType( System.Type type ) - { - if( m_deprecatedItemsDict.ContainsKey( type ) ) - return m_deprecatedItemsDict[ type ]; - return null; - } - - public void UpdateKeyPress( KeyCode key ) - { - if( key == KeyCode.None ) - return; - - m_lastKeyPressed = key; - if( m_shortcutTypes.ContainsKey( key ) ) - { - m_shortcutTypes[ key ].IsPressed = true; - } - } - - public void UpdateKeyReleased( KeyCode key ) - { - if( key == KeyCode.None ) - return; - - if( m_shortcutTypes.ContainsKey( key ) ) - { - m_shortcutTypes[ key ].IsPressed = false; - } - } - - public void ResetShortcutKeyStates() - { - foreach( KeyValuePair<KeyCode, ShortcutKeyData> kvp in m_shortcutTypes ) - { - kvp.Value.IsPressed = false; - } - } - - public ParentNode CreateNodeFromCastType( System.Type type ) - { - if( m_castTypes.ContainsKey( type ) ) - { - ParentNode newNode = (ParentNode)ScriptableObject.CreateInstance( m_castTypes[ type ] ); - return newNode; - } - return null; - } - - - public ParentNode CreateNodeFromShortcutKey() - { - if( m_lastKeyPressed == KeyCode.None ) - return null; - - if( m_shortcutTypes.ContainsKey( m_lastKeyPressed ) && m_shortcutTypes[ m_lastKeyPressed ].IsPressed ) - { - ParentNode newNode = (ParentNode)ScriptableObject.CreateInstance( m_shortcutTypes[ m_lastKeyPressed ].NodeType ); - return newNode; - } - return null; - } - - public bool CheckShortcutKey() - { - if( m_lastKeyPressed == KeyCode.None ) - return false; - - if( m_shortcutTypes.ContainsKey( m_lastKeyPressed ) && m_shortcutTypes[ m_lastKeyPressed ].IsPressed ) - { - return true; - } - return false; - } - - public List<ContextMenuItem> MenuItems - { - get - { - if( m_currentGraph.ParentWindow.IsShaderFunctionWindow ) - return m_itemFunctions; - else - return m_items; - } - } - - public List<ContextMenuItem> ItemFunctions { get { return m_itemFunctions; } } - public KeyCode LastKeyPressed - { - get { return m_lastKeyPressed; } - } - - public Dictionary<KeyCode, ShortcutKeyData> NodeShortcuts { get { return m_shortcutTypes; } } - public bool CorrectlyLoaded { get { return m_correctlyLoaded; } } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/GraphContextMenu.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/GraphContextMenu.cs.meta deleted file mode 100644 index be8ed3c1..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/GraphContextMenu.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 5c34fc95a1ddd7d42bc74151061035f4 -timeCreated: 1481126956 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/MenuParent.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/MenuParent.cs deleted file mode 100644 index 2826d02c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/MenuParent.cs +++ /dev/null @@ -1,445 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEngine; -using UnityEditor; - -namespace AmplifyShaderEditor -{ - public enum MenuAnchor - { - TOP_LEFT = 0, - TOP_CENTER, - TOP_RIGHT, - MIDDLE_LEFT, - MIDDLE_CENTER, - MIDDLE_RIGHT, - BOTTOM_LEFT, - BOTTOM_CENTER, - BOTTOM_RIGHT, - NONE - } - - public enum MenuAutoSize - { - MATCH_VERTICAL = 0, - MATCH_HORIZONTAL, - NONE - } - - public class MenuParent - { - protected AmplifyShaderEditorWindow m_parentWindow = null; - - protected const float MinimizeButtonXSpacing = 5; - protected const float MinimizeButtonYSpacing = 5.5f; - protected const float ResizeAreaWidth = 5; - - protected const float MinimizeCollisionAdjust = 5; - - protected GUIStyle m_style; - protected GUIContent m_content; - protected Rect m_maximizedArea; - protected Rect m_transformedArea; - protected Rect m_resizeArea; - protected MenuAnchor m_anchor; - protected MenuAutoSize m_autoSize; - protected bool m_isActive = true; - protected bool m_isMaximized = true; - - protected bool m_lockOnMinimize = false; - protected bool m_preLockState = false; - - protected Rect m_minimizedArea; - protected Rect m_minimizeButtonPos; - protected float m_realWidth; - protected GUIStyle m_empty = new GUIStyle(); - - protected float m_resizeDelta; - - protected bool m_isResizing = false; - protected bool m_resizable = false; - protected GUIStyle m_resizeAreaStyle; - protected bool m_isMouseInside = false; - protected Vector2 m_currentScrollPos; - public MenuParent( AmplifyShaderEditorWindow parentWindow, float x, float y, float width, float height, string name, MenuAnchor anchor = MenuAnchor.NONE, MenuAutoSize autoSize = MenuAutoSize.NONE ) - { - m_parentWindow = parentWindow; - m_anchor = anchor; - m_autoSize = autoSize; - m_maximizedArea = new Rect( x, y, width, height ); - m_content = new GUIContent( GUIContent.none ); - m_content.text = name; - m_transformedArea = new Rect(); - m_resizeArea = new Rect(); - m_resizeArea.width = ResizeAreaWidth; - m_resizeAreaStyle = GUIStyle.none; - m_currentScrollPos = Vector2.zero; - } - - public void SetMinimizedArea( float x, float y, float width, float height ) - { - m_minimizedArea = new Rect( x, y, width, height ); - } - - protected void InitDraw( Rect parentPosition, Vector2 mousePosition, int mouseButtonId ) - { - if ( m_style == null ) - { - m_style = new GUIStyle( UIUtils.TextArea ); - m_style.stretchHeight = true; - m_style.stretchWidth = true; - m_style.fontSize = ( int ) Constants.DefaultTitleFontSize; - m_style.fontStyle = FontStyle.Normal; - Texture minimizeTex = UIUtils.GetCustomStyle( CustomStyle.MaximizeButton ).normal.background; - m_minimizeButtonPos = new Rect( 0, 0, minimizeTex.width, minimizeTex.height ); - } - - Rect currentArea = m_isMaximized ? m_maximizedArea : m_minimizedArea; - - if ( m_isMaximized ) - { - if ( m_resizable ) - { - if ( m_isResizing ) - { - if ( m_anchor == MenuAnchor.TOP_LEFT ) - m_resizeDelta = ( ParentWindow.CurrentEvent.mousePosition.x - m_maximizedArea.width ); - else if ( m_anchor == MenuAnchor.TOP_RIGHT ) - m_resizeDelta = ParentWindow.CurrentEvent.mousePosition.x - ( parentPosition.width - m_maximizedArea.width); - } - } - - m_realWidth = m_maximizedArea.width; - if ( m_resizable ) - { - if ( m_anchor == MenuAnchor.TOP_LEFT ) - { - currentArea.width += m_resizeDelta; - m_realWidth += m_resizeDelta; - } - else if ( m_anchor == MenuAnchor.TOP_RIGHT ) - { - currentArea.width -= m_resizeDelta; - m_realWidth -= m_resizeDelta; - } - } - } - else - { - if ( currentArea.x < 0 ) - { - m_realWidth = currentArea.width + currentArea.x; - } - else if ( ( currentArea.x + currentArea.width ) > parentPosition.width ) - { - m_realWidth = parentPosition.width - currentArea.x; - } - if ( m_realWidth < 0 ) - m_realWidth = 0; - } - - switch ( m_anchor ) - { - case MenuAnchor.TOP_LEFT: - { - m_transformedArea.x = currentArea.x; - m_transformedArea.y = currentArea.y; - if ( m_isMaximized ) - { - m_minimizeButtonPos.x = m_transformedArea.x + m_transformedArea.width - m_minimizeButtonPos.width - MinimizeButtonXSpacing; - m_minimizeButtonPos.y = m_transformedArea.y + MinimizeButtonYSpacing; - - m_resizeArea.x = m_transformedArea.x + m_transformedArea.width; - m_resizeArea.y = m_minimizeButtonPos.y; - m_resizeArea.height = m_transformedArea.height; - } - else - { - float width = ( m_transformedArea.width - m_transformedArea.x ); - m_minimizeButtonPos.x = m_transformedArea.x + width * 0.5f - m_minimizeButtonPos.width * 0.5f; - m_minimizeButtonPos.y = m_transformedArea.height * 0.5f - m_minimizeButtonPos.height * 0.5f; - } - } - break; - case MenuAnchor.TOP_CENTER: - { - m_transformedArea.x = parentPosition.width * 0.5f + currentArea.x; - m_transformedArea.y = currentArea.y; - } - break; - case MenuAnchor.TOP_RIGHT: - { - m_transformedArea.x = parentPosition.width - currentArea.x - currentArea.width; - m_transformedArea.y = currentArea.y; - if ( m_isMaximized ) - { - m_minimizeButtonPos.x = m_transformedArea.x + MinimizeButtonXSpacing; - m_minimizeButtonPos.y = m_transformedArea.y + MinimizeButtonYSpacing; - - m_resizeArea.x = m_transformedArea.x - ResizeAreaWidth; - m_resizeArea.y = m_minimizeButtonPos.y; - m_resizeArea.height = m_transformedArea.height; - } - else - { - float width = ( parentPosition.width - m_transformedArea.x ); - m_minimizeButtonPos.x = m_transformedArea.x + width * 0.5f - m_minimizeButtonPos.width * 0.5f; - m_minimizeButtonPos.y = m_transformedArea.height * 0.5f - m_minimizeButtonPos.height * 0.5f; - } - } - break; - case MenuAnchor.MIDDLE_LEFT: - { - m_transformedArea.x = currentArea.x; - m_transformedArea.y = parentPosition.height * 0.5f + currentArea.y; - } - break; - case MenuAnchor.MIDDLE_CENTER: - { - m_transformedArea.x = parentPosition.width * 0.5f + currentArea.x; - m_transformedArea.y = parentPosition.height * 0.5f + currentArea.y; - } - break; - case MenuAnchor.MIDDLE_RIGHT: - { - m_transformedArea.x = parentPosition.width - currentArea.x - currentArea.width; - m_transformedArea.y = parentPosition.height * 0.5f + currentArea.y; - } - break; - case MenuAnchor.BOTTOM_LEFT: - { - m_transformedArea.x = currentArea.x; - m_transformedArea.y = parentPosition.height - currentArea.y - currentArea.height; - } - break; - case MenuAnchor.BOTTOM_CENTER: - { - m_transformedArea.x = parentPosition.width * 0.5f + currentArea.x; - m_transformedArea.y = parentPosition.height - currentArea.y - currentArea.height; - } - break; - case MenuAnchor.BOTTOM_RIGHT: - { - m_transformedArea.x = parentPosition.width - currentArea.x - currentArea.width; - m_transformedArea.y = parentPosition.height - currentArea.y - currentArea.height; - } - break; - - case MenuAnchor.NONE: - { - m_transformedArea.x = currentArea.x; - m_transformedArea.y = currentArea.y; - } - break; - } - - switch ( m_autoSize ) - { - case MenuAutoSize.MATCH_HORIZONTAL: - { - m_transformedArea.width = parentPosition.width - m_transformedArea.x; - m_transformedArea.height = currentArea.height; - } - break; - - case MenuAutoSize.MATCH_VERTICAL: - { - m_transformedArea.width = currentArea.width; - m_transformedArea.height = parentPosition.height - m_transformedArea.y; - } - break; - case MenuAutoSize.NONE: - { - m_transformedArea.width = currentArea.width; - m_transformedArea.height = currentArea.height; - } - break; - } - - } - public virtual void Draw( Rect parentPosition, Vector2 mousePosition, int mouseButtonId, bool hasKeyboadFocus ) - { - InitDraw( parentPosition, mousePosition, mouseButtonId ); - if ( ParentWindow.CurrentEvent.type == EventType.MouseDrag && ParentWindow.CurrentEvent.button > 0 /*catches both middle and right mouse button*/ ) - { - m_isMouseInside = IsInside( mousePosition ); - if ( m_isMouseInside ) - { - m_currentScrollPos.x += Constants.MenuDragSpeed * ParentWindow.CurrentEvent.delta.x; - if ( m_currentScrollPos.x < 0 ) - m_currentScrollPos.x = 0; - m_currentScrollPos.y += Constants.MenuDragSpeed * ParentWindow.CurrentEvent.delta.y; - if ( m_currentScrollPos.y < 0 ) - m_currentScrollPos.y = 0; - - } - } - } - - public void PostDraw() - { - if ( !m_isMaximized ) - { - m_transformedArea.height = 35; - GUI.Label( m_transformedArea, m_content, m_style ); - } - - Color colorBuffer = GUI.color; - GUI.color = EditorGUIUtility.isProSkin ? Color.white : Color.black; - bool guiEnabledBuffer = GUI.enabled; - GUI.enabled = !m_lockOnMinimize; - Rect buttonArea = m_minimizeButtonPos; - - buttonArea.x -= MinimizeCollisionAdjust; - buttonArea.width += 2 * MinimizeCollisionAdjust; - - buttonArea.y -= MinimizeCollisionAdjust; - buttonArea.height += 2 * MinimizeCollisionAdjust; - - if ( m_parentWindow.CameraDrawInfo.CurrentEventType == EventType.Repaint ) - GUI.Label( m_minimizeButtonPos, string.Empty, UIUtils.GetCustomStyle( m_isMaximized ? CustomStyle.MinimizeButton : CustomStyle.MaximizeButton ) ); - - if( m_parentWindow.CameraDrawInfo.CurrentEventType == EventType.MouseDown && buttonArea.Contains( m_parentWindow.CameraDrawInfo.MousePosition ) ) - //if ( GUI.Button( buttonArea, string.Empty, m_empty ) ) - { - m_isMaximized = !m_isMaximized; - m_resizeDelta = 0; - } - - if ( m_resizable && m_isMaximized ) - { - EditorGUIUtility.AddCursorRect( m_resizeArea, MouseCursor.ResizeHorizontal ); - if ( !m_isResizing && GUI.RepeatButton( m_resizeArea, string.Empty, m_resizeAreaStyle ) ) - { - m_isResizing = true; - } - else - { - if ( m_isResizing ) - { - if ( ParentWindow.CurrentEvent.isMouse && ParentWindow.CurrentEvent.type != EventType.MouseDrag ) - { - m_isResizing = false; - } - } - } - - if ( m_realWidth < buttonArea.width ) - { - // Auto-minimize - m_isMaximized = false; - m_resizeDelta = 0; - m_isResizing = false; - } - else - { - float halfSizeWindow = 0.5f * ParentWindow.position.width; - if ( m_realWidth > halfSizeWindow ) - { - m_realWidth = 0.5f * ParentWindow.position.width; - if ( m_resizeDelta > 0 ) - { - m_resizeDelta = m_realWidth - m_maximizedArea.width; - } - else - { - m_resizeDelta = m_maximizedArea.width - m_realWidth; - } - } - } - } - - GUI.enabled = guiEnabledBuffer; - GUI.color = colorBuffer; - - } - - public void OnLostFocus() - { - if ( m_isResizing ) - { - m_isResizing = false; - } - } - - virtual public void Destroy() - { - m_empty = null; - m_resizeAreaStyle = null; - } - - public float InitialX - { - get { return m_maximizedArea.x; } - set { m_maximizedArea.x = value; } - } - - public float Width - { - get { return m_maximizedArea.width; } - set { m_maximizedArea.width = value; } - } - - public float RealWidth - { - get { return m_realWidth; } - } - public float Height - { - get { return m_maximizedArea.height; } - set { m_maximizedArea.height = value; } - } - - public Rect Size - { - get { return m_maximizedArea; } - } - - public virtual bool IsInside( Vector2 position ) - { - if ( !m_isActive ) - return false; - - return m_transformedArea.Contains( position ); - } - - public bool IsMaximized - { - get { return m_isMaximized; } - set { m_isMaximized = value; } - } - - public Rect TransformedArea - { - get { return m_transformedArea; } - } - - public bool Resizable { set { m_resizable = value; } } - public bool IsResizing { get { return m_isResizing; } } - public bool LockOnMinimize - { - set - { - if ( m_lockOnMinimize == value ) - return; - - m_lockOnMinimize = value; - if ( value ) - { - m_preLockState = m_isMaximized; - m_isMaximized = false; - } - else - { - m_isMaximized = m_preLockState; - } - } - } - public bool IsActive - { - get { return m_isActive; } - } - public AmplifyShaderEditorWindow ParentWindow { get { return m_parentWindow; } set { m_parentWindow = value; } } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/MenuParent.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/MenuParent.cs.meta deleted file mode 100644 index 2c0ba167..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/MenuParent.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 5d535d3799a3ef547aea607fdc8b947b -timeCreated: 1481126956 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/NodeParametersWindow.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/NodeParametersWindow.cs deleted file mode 100644 index 837b2f48..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/NodeParametersWindow.cs +++ /dev/null @@ -1,555 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEngine; -using UnityEditor; -using System.Collections.Generic; -using UnityEditorInternal; - -namespace AmplifyShaderEditor -{ - public sealed class NodeParametersWindow : MenuParent - { - private int m_lastSelectedNode = -1; - private const string TitleStr = "Node Properties"; - private GUIStyle m_nodePropertiesStyle; - private GUIContent m_dummyContent = new GUIContent(); - private GUIStyle m_propertyAdjustment; - - private ReorderableList m_functionInputsReordableList = null; - private int m_functionInputsLastCount = 0; - - private ReorderableList m_functionSwitchesReordableList = null; - private int m_functionSwitchesLastCount = 0; - - private ReorderableList m_functionOutputsReordableList = null; - private int m_functionOutputsLastCount = 0; - - private ReorderableList m_propertyReordableList = null; - private int m_lastCount = 0; - - private bool m_forceUpdate = false; - - [SerializeField] - private List<PropertyNode> m_propertyReordableNodes = new List<PropertyNode>(); - - // width and height are between [0,1] and represent a percentage of the total screen area - public NodeParametersWindow( AmplifyShaderEditorWindow parentWindow ) : base( parentWindow, 0, 0, 285, 0, string.Empty, MenuAnchor.TOP_LEFT, MenuAutoSize.MATCH_VERTICAL ) - { - SetMinimizedArea( -225, 0, 260, 0 ); - } - - public void OnShaderFunctionLoad() - { - m_functionInputsReordableList = null; - m_functionSwitchesReordableList = null; - m_functionOutputsReordableList = null; - } - - public bool Draw( Rect parentPosition, ParentNode selectedNode, Vector2 mousePosition, int mouseButtonId, bool hasKeyboardFocus ) - { - bool changeCheck = false; - base.Draw( parentPosition, mousePosition, mouseButtonId, hasKeyboardFocus ); - if ( m_nodePropertiesStyle == null ) - { - m_nodePropertiesStyle = UIUtils.GetCustomStyle( CustomStyle.NodePropertiesTitle ); - m_nodePropertiesStyle.normal.textColor = m_nodePropertiesStyle.active.textColor = EditorGUIUtility.isProSkin ? new Color( 1f, 1f, 1f ) : new Color( 0f, 0f, 0f ); - } - - if ( m_isMaximized ) - { - KeyCode key = Event.current.keyCode; - if ( m_isMouseInside || hasKeyboardFocus ) - { - if ( key == ShortcutsManager.ScrollUpKey ) - { - m_currentScrollPos.y -= 10; - if ( m_currentScrollPos.y < 0 ) - { - m_currentScrollPos.y = 0; - } - Event.current.Use(); - } - - if ( key == ShortcutsManager.ScrollDownKey ) - { - m_currentScrollPos.y += 10; - Event.current.Use(); - } - } - - if( m_forceUpdate ) - { - if( m_propertyReordableList != null ) - m_propertyReordableList.ReleaseKeyboardFocus(); - m_propertyReordableList = null; - - if ( m_functionInputsReordableList != null ) - m_functionInputsReordableList.ReleaseKeyboardFocus(); - m_functionInputsReordableList = null; - - if( m_functionSwitchesReordableList != null ) - m_functionSwitchesReordableList.ReleaseKeyboardFocus(); - m_functionSwitchesReordableList = null; - - if ( m_functionOutputsReordableList != null ) - m_functionOutputsReordableList.ReleaseKeyboardFocus(); - m_functionOutputsReordableList = null; - m_forceUpdate = false; - } - - GUILayout.BeginArea( m_transformedArea, m_content, m_style ); - { - //Draw selected node parameters - if ( selectedNode != null ) - { - // this hack is need because without it the several FloatFields/Textfields/... would show wrong values ( different from the ones they were assigned to show ) - if ( m_lastSelectedNode != selectedNode.UniqueId ) - { - m_lastSelectedNode = selectedNode.UniqueId; - GUI.FocusControl( "" ); - } - - EditorGUILayout.BeginVertical(); - { - EditorGUILayout.Separator(); - if ( selectedNode.UniqueId == ParentWindow.CurrentGraph.CurrentMasterNodeId ) - { - m_dummyContent.text = "Output Node"; - } - else - { - if ( selectedNode.Attributes != null ) - { - - m_dummyContent.text = selectedNode.Attributes.Name; - } - else if ( selectedNode is CommentaryNode ) - { - m_dummyContent.text = "Commentary"; - } - else - { - m_dummyContent.text = TitleStr; - } - } - - EditorGUILayout.LabelField( m_dummyContent, m_nodePropertiesStyle ); - - EditorGUILayout.Separator(); - //UIUtils.RecordObject( selectedNode , "Changing properties on node " + selectedNode.UniqueId); - m_currentScrollPos = EditorGUILayout.BeginScrollView( m_currentScrollPos, GUILayout.Width( 0 ), GUILayout.Height( 0 ) ); - float labelWidth = EditorGUIUtility.labelWidth; - if ( selectedNode.TextLabelWidth > 0 ) - EditorGUIUtility.labelWidth = selectedNode.TextLabelWidth; - - changeCheck = selectedNode.SafeDrawProperties(); - EditorGUIUtility.labelWidth = labelWidth; - EditorGUILayout.EndScrollView(); - } - EditorGUILayout.EndVertical(); - - if ( changeCheck ) - { - if ( selectedNode.ConnStatus == NodeConnectionStatus.Connected ) - ParentWindow.SetSaveIsDirty(); - } - } - else - { - //Draw Graph Params - EditorGUILayout.BeginVertical(); - { - EditorGUILayout.Separator(); - EditorGUILayout.LabelField( "Graph Properties", m_nodePropertiesStyle ); - EditorGUILayout.Separator(); - - m_currentScrollPos = EditorGUILayout.BeginScrollView( m_currentScrollPos, GUILayout.Width( 0 ), GUILayout.Height( 0 ) ); - float labelWidth = EditorGUIUtility.labelWidth; - EditorGUIUtility.labelWidth = 90; - - bool generalIsVisible = m_parentWindow.InnerWindowVariables.ExpandedGeneralShaderOptions; - NodeUtils.DrawPropertyGroup( ref generalIsVisible, " General", DrawGeneralFunction ); - m_parentWindow.InnerWindowVariables.ExpandedGeneralShaderOptions = generalIsVisible; - AmplifyShaderFunction function = ParentWindow.CurrentGraph.CurrentShaderFunction; - if( function != null ) - { - //function.AdditionalIncludes.Draw( ParentWindow.CurrentGraph.CurrentOutputNode ); - //function.AdditionalPragmas.Draw( ParentWindow.CurrentGraph.CurrentOutputNode ); - function.AdditionalDirectives.Draw( ParentWindow.CurrentGraph.CurrentOutputNode ); - } - - bool inputIsVisible = m_parentWindow.InnerWindowVariables.ExpandedFunctionInputs; - NodeUtils.DrawPropertyGroup( ref inputIsVisible, " Function Inputs", DrawFunctionInputs ); - m_parentWindow.InnerWindowVariables.ExpandedFunctionInputs = inputIsVisible; - - bool swicthIsVisible = m_parentWindow.InnerWindowVariables.ExpandedFunctionSwitches; - NodeUtils.DrawPropertyGroup( ref swicthIsVisible, " Function Switches", DrawFunctionSwitches ); - m_parentWindow.InnerWindowVariables.ExpandedFunctionSwitches = swicthIsVisible; - - bool outputIsVisible = m_parentWindow.InnerWindowVariables.ExpandedFunctionOutputs; - NodeUtils.DrawPropertyGroup( ref outputIsVisible, " Function Outputs", DrawFunctionOutputs ); - m_parentWindow.InnerWindowVariables.ExpandedFunctionOutputs = outputIsVisible; - - bool properties = ParentWindow.InnerWindowVariables.ExpandedProperties; - NodeUtils.DrawPropertyGroup( ref properties, " Material Properties", DrawFunctionProperties ); - ParentWindow.InnerWindowVariables.ExpandedProperties = properties; - - EditorGUIUtility.labelWidth = labelWidth; - EditorGUILayout.EndScrollView(); - } - EditorGUILayout.EndVertical(); - } - } - // Close window area - GUILayout.EndArea(); - } - - PostDraw(); - return changeCheck; - } - - public void DrawGeneralFunction() - { - AmplifyShaderFunction function = ParentWindow.CurrentGraph.CurrentShaderFunction; - if ( function == null ) - return; - - float cacheWidth = EditorGUIUtility.labelWidth; - EditorGUIUtility.labelWidth = 115; - - SerializedObject serializedObject = new UnityEditor.SerializedObject( function ); - - if ( serializedObject != null ) - { - SerializedProperty temo = serializedObject.FindProperty( "m_description" ); - EditorGUILayout.PropertyField( temo, new GUIContent( " Description" ) ); - - SerializedProperty cat = serializedObject.FindProperty( "m_nodeCategory" ); - SerializedProperty ppos = serializedObject.FindProperty( "m_previewPosition" ); - - EditorGUILayout.PropertyField( ppos, new GUIContent( "Preview Position" ) ); - cat.intValue = ParentWindow.CurrentGraph.CurrentOutputNode.EditorGUILayoutPopup( "Category", cat.intValue, UIUtils.CategoryPresets ); - - if( cat.enumValueIndex == 0 ) - { - SerializedProperty custCat = serializedObject.FindProperty( "m_customNodeCategory" ); - EditorGUILayout.PropertyField( custCat, new GUIContent( "Custom" ) ); - } - SerializedProperty hidden = serializedObject.FindProperty( "m_hidden" ); - EditorGUILayout.PropertyField( hidden, new GUIContent( "Hidden" ) ); - serializedObject.ApplyModifiedProperties(); - } - EditorGUIUtility.labelWidth = cacheWidth; - } - - - public void DrawFunctionInputs() - { - List<FunctionInput> functionInputNodes = UIUtils.FunctionInputList(); - - if ( m_functionInputsReordableList == null || functionInputNodes.Count != m_functionInputsLastCount ) - { - functionInputNodes.Sort( ( x, y ) => { return x.OrderIndex.CompareTo( y.OrderIndex ); } ); - - m_functionInputsReordableList = new ReorderableList( functionInputNodes, typeof( FunctionInput ), true, false, false, false ); - m_functionInputsReordableList.headerHeight = 0; - m_functionInputsReordableList.footerHeight = 0; - m_functionInputsReordableList.showDefaultBackground = false; - - m_functionInputsReordableList.drawElementCallback = ( Rect rect, int index, bool isActive, bool isFocused ) => - { - EditorGUI.LabelField( rect, functionInputNodes[ index ].InputName ); - }; - - m_functionInputsReordableList.onChangedCallback = ( list ) => - { - //for ( int i = 0; i < functionInputNodes.Count; i++ ) - //{ - // functionInputNodes[ i ].OrderIndex = i; - //} - ForceInputReorder( ref functionInputNodes ); - }; - - m_functionInputsLastCount = m_functionInputsReordableList.count; - } - - if ( m_functionInputsReordableList != null ) - { - if ( m_propertyAdjustment == null ) - { - m_propertyAdjustment = new GUIStyle(); - m_propertyAdjustment.padding.left = 17; - } - EditorGUILayout.BeginVertical( m_propertyAdjustment ); - m_functionInputsReordableList.DoLayoutList(); - EditorGUILayout.EndVertical(); - } - } - - public void ForceInputReorder( ref List<FunctionInput> functionInputNodes ) - { - for( int i = 0; i < functionInputNodes.Count; i++ ) - { - functionInputNodes[ i ].OrderIndex = i; - } - } - - public void DrawFunctionSwitches() - { - List<FunctionSwitch> functionSwitchNodes = UIUtils.FunctionSwitchList(); - - if( m_functionSwitchesReordableList == null || functionSwitchNodes.Count != m_functionSwitchesLastCount ) - { - functionSwitchNodes.Sort( ( x, y ) => { return x.OrderIndex.CompareTo( y.OrderIndex ); } ); - - UIUtils.UpdateFunctionSwitchArr(); - - m_functionSwitchesReordableList = new ReorderableList( functionSwitchNodes, typeof( FunctionSwitch ), true, false, false, false ); - m_functionSwitchesReordableList.headerHeight = 0; - m_functionSwitchesReordableList.footerHeight = 0; - m_functionSwitchesReordableList.showDefaultBackground = false; - - m_functionSwitchesReordableList.drawElementCallback = ( Rect rect, int index, bool isActive, bool isFocused ) => - { - EditorGUI.LabelField( rect, functionSwitchNodes[ index ].OptionLabel ); - }; - - m_functionSwitchesReordableList.onChangedCallback = ( list ) => - { - ForceSwitchesReorder(ref functionSwitchNodes ); - }; - - m_functionSwitchesLastCount = m_functionSwitchesReordableList.count; - } - - if( m_functionSwitchesReordableList != null ) - { - if( m_propertyAdjustment == null ) - { - m_propertyAdjustment = new GUIStyle(); - m_propertyAdjustment.padding.left = 17; - } - EditorGUILayout.BeginVertical( m_propertyAdjustment ); - m_functionSwitchesReordableList.DoLayoutList(); - EditorGUILayout.EndVertical(); - } - } - - public void ForceSwitchesReorder( ref List<FunctionSwitch> functionSwitchNodes ) - { - for( int i = 0; i < functionSwitchNodes.Count; i++ ) - { - functionSwitchNodes[ i ].OrderIndex = i; - } - - UIUtils.UpdateFunctionSwitchArr(); - } - - public void DrawFunctionOutputs() - { - List<FunctionOutput> functionOutputNodes = UIUtils.FunctionOutputList(); - - if ( m_functionOutputsReordableList == null || functionOutputNodes.Count != m_functionOutputsLastCount ) - { - functionOutputNodes.Sort( ( x, y ) => { return x.OrderIndex.CompareTo( y.OrderIndex ); } ); - - m_functionOutputsReordableList = new ReorderableList( functionOutputNodes, typeof( FunctionOutput ), true, false, false, false ); - m_functionOutputsReordableList.headerHeight = 0; - m_functionOutputsReordableList.footerHeight = 0; - m_functionOutputsReordableList.showDefaultBackground = false; - - m_functionOutputsReordableList.drawElementCallback = ( Rect rect, int index, bool isActive, bool isFocused ) => - { - EditorGUI.LabelField( rect, functionOutputNodes[ index ].OutputName ); - }; - - m_functionOutputsReordableList.onChangedCallback = ( list ) => - { - for ( int i = 0; i < functionOutputNodes.Count; i++ ) - { - functionOutputNodes[ i ].OrderIndex = i; - } - }; - - m_functionOutputsLastCount = m_functionOutputsReordableList.count; - } - - if ( m_functionOutputsReordableList != null ) - { - if ( m_propertyAdjustment == null ) - { - m_propertyAdjustment = new GUIStyle(); - m_propertyAdjustment.padding.left = 17; - } - EditorGUILayout.BeginVertical( m_propertyAdjustment ); - m_functionOutputsReordableList.DoLayoutList(); - EditorGUILayout.EndVertical(); - } - } - - private void RefreshVisibleList( ref List<PropertyNode> allNodes ) - { - // temp reference for lambda expression - List<PropertyNode> nodes = allNodes; - m_propertyReordableNodes.Clear(); - - for( int i = 0; i < nodes.Count; i++ ) - { - ReordenatorNode rnode = nodes[ i ] as ReordenatorNode; - if( ( rnode == null || !rnode.IsInside ) && ( !m_propertyReordableNodes.Exists( x => x.PropertyName.Equals( nodes[ i ].PropertyName ) ) ) ) - m_propertyReordableNodes.Add( nodes[ i ] ); - } - - m_propertyReordableNodes.Sort( ( x, y ) => { return x.OrderIndex.CompareTo( y.OrderIndex ); } ); - } - - public void DrawFunctionProperties() - { - List<PropertyNode> nodes = UIUtils.PropertyNodesList(); - - if( nodes.Count != m_lastCount ) - { - RefreshVisibleList( ref nodes ); - m_lastCount = nodes.Count; - } - - if( m_propertyReordableList == null ) - { - m_propertyReordableList = new ReorderableList( m_propertyReordableNodes, typeof( PropertyNode ), true, false, false, false ) - { - headerHeight = 0, - footerHeight = 0, - showDefaultBackground = false, - - drawElementCallback = ( Rect rect, int index, bool isActive, bool isFocused ) => - { - var first = rect; - first.width *= 0.60f; - EditorGUI.LabelField( first, m_propertyReordableNodes[ index ].PropertyInspectorName ); - var second = rect; - second.width *= 0.4f; - second.x += first.width; - if( GUI.Button( second, m_propertyReordableNodes[ index ].PropertyName, new GUIStyle( "AssetLabel Partial" ) ) ) - { - UIUtils.FocusOnNode( m_propertyReordableNodes[ index ], 1, false ); - } - }, - - onReorderCallback = ( list ) => - { - ReorderList( ref nodes ); - } - }; - ReorderList( ref nodes ); - } - - if( m_propertyReordableList != null ) - { - if( m_propertyAdjustment == null ) - { - m_propertyAdjustment = new GUIStyle(); - m_propertyAdjustment.padding.left = 17; - } - EditorGUILayout.BeginVertical( m_propertyAdjustment ); - m_propertyReordableList.DoLayoutList(); - EditorGUILayout.EndVertical(); - } - } - - public void ForceReordering() - { - List<PropertyNode> nodes = UIUtils.PropertyNodesList(); - ReorderList( ref nodes ); - - List<FunctionInput> functionInputNodes = UIUtils.FunctionInputList(); - ForceInputReorder( ref functionInputNodes ); - - List<FunctionSwitch> functionSwitchNodes = UIUtils.FunctionSwitchList(); - ForceSwitchesReorder( ref functionSwitchNodes ); - //RecursiveLog(); - } - - private void RecursiveLog() - { - List<PropertyNode> nodes = UIUtils.PropertyNodesList(); - nodes.Sort( ( x, y ) => { return x.OrderIndex.CompareTo( y.OrderIndex ); } ); - for( int i = 0; i < nodes.Count; i++ ) - { - if( ( nodes[ i ] is ReordenatorNode ) ) - ( nodes[ i ] as ReordenatorNode ).RecursiveLog(); - else - Debug.Log( nodes[ i ].OrderIndex + " " + nodes[ i ].PropertyName ); - } - } - - - private void ReorderList( ref List<PropertyNode> nodes ) - { - // clear lock list before reordering because of multiple sf being used - for( int i = 0; i < nodes.Count; i++ ) - { - ReordenatorNode rnode = nodes[ i ] as ReordenatorNode; - if ( rnode != null ) - rnode.RecursiveClear(); - } - - int propoffset = 0; - int count = 0; - for ( int i = 0; i < m_propertyReordableNodes.Count; i++ ) - { - ReordenatorNode renode = m_propertyReordableNodes[ i ] as ReordenatorNode; - if ( renode != null ) - { - if ( !renode.IsInside ) - { - m_propertyReordableNodes[ i ].OrderIndex = count + propoffset; - - if ( renode.PropertyListCount > 0 ) - { - propoffset += renode.RecursiveCount(); - - // the same reordenator can exist multiple times, apply ordering to all of them - for( int j = 0; j < nodes.Count; j++ ) - { - ReordenatorNode pnode = ( nodes[ j ] as ReordenatorNode ); - if ( pnode != null && pnode.PropertyName.Equals( renode.PropertyName ) ) - { - pnode.OrderIndex = renode.RawOrderIndex; - pnode.RecursiveSetOrderOffset( renode.RawOrderIndex, true ); - } - } - } - else - { - count++; - } - } - else - { - m_propertyReordableNodes[ i ].OrderIndex = 0; - } - } - else - { - m_propertyReordableNodes[ i ].OrderIndex = count + propoffset; - count++; - } - } - } - - public override void Destroy() - { - base.Destroy(); - m_functionInputsReordableList = null; - m_functionOutputsReordableList = null; - m_propertyReordableList = null; - } - - public bool ForceUpdate - { - get { return m_forceUpdate; } - set { m_forceUpdate = value; } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/NodeParametersWindow.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/NodeParametersWindow.cs.meta deleted file mode 100644 index c49545cb..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/NodeParametersWindow.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: d09f21096aa7c9f438e91a6e7f2621fb -timeCreated: 1481126959 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/NodeWireReferencesUtils.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/NodeWireReferencesUtils.cs deleted file mode 100644 index f1793a24..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/NodeWireReferencesUtils.cs +++ /dev/null @@ -1,56 +0,0 @@ -using UnityEngine; - -namespace AmplifyShaderEditor -{ - public class NodeWireReferencesUtils - { - public WireReference InputPortReference = new WireReference(); - public WireReference SwitchPortReference = new WireReference(); - public WireReference OutputPortReference = new WireReference(); - - public Vector2 SnapPosition = Vector2.zero; - public bool SnapEnabled = false; - public WireReference SnapPort = new WireReference(); - - public bool ValidReferences() - { - return ( InputPortReference.IsValid || OutputPortReference.IsValid ); - } - - public void InvalidateReferences() - { - InputPortReference.Invalidate(); - OutputPortReference.Invalidate(); - SnapPort.Invalidate(); - SnapEnabled = false; - } - - - public void SetOutputReference( int nodeId, int portId, WirePortDataType dataType, bool typeLocked ) - { - if( InputPortReference.IsValid ) - InputPortReference.Invalidate(); - OutputPortReference.SetReference( nodeId, portId, dataType, typeLocked ); - } - - public void SetInputReference( int nodeId, int portId, WirePortDataType dataType, bool typeLocked ) - { - if( OutputPortReference.IsValid ) - OutputPortReference.Invalidate(); - InputPortReference.SetReference( nodeId, portId, dataType, typeLocked ); - } - - public void ActivateSnap( Vector2 position, WirePort port ) - { - SnapPort.SetReference( port ); - SnapEnabled = true; - SnapPosition = position; - } - - public void DeactivateSnap() - { - SnapEnabled = false; - SnapPort.Invalidate(); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/NodeWireReferencesUtils.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/NodeWireReferencesUtils.cs.meta deleted file mode 100644 index 6cc9bbec..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/NodeWireReferencesUtils.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: bfbc736093c900c418a7668e3003663a -timeCreated: 1500289690 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Palette.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Palette.meta deleted file mode 100644 index 71c42517..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Palette.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: a89b03eb735b82a4da19a8381846935f -folderAsset: yes -timeCreated: 1481126946 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/ContextPalette.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/ContextPalette.cs deleted file mode 100644 index ae870612..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/ContextPalette.cs +++ /dev/null @@ -1,101 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEngine; -using System.Collections.Generic; -using System; - -namespace AmplifyShaderEditor -{ - public sealed class ContextPalette : PaletteParent - { - private Vector3 m_position; - private Vector2 m_startDropPosition; - public ContextPalette( AmplifyShaderEditorWindow parentWindow ) : base( parentWindow, 0, 0, 250, 250, string.Empty, MenuAnchor.NONE, MenuAutoSize.NONE ) - { - m_isActive = false; - OnPaletteNodeCreateEvt += OnOptionSelected; - m_searchFilterControl += "CONTEXTPALETTE"; - } - - public override void OnEnterPressed(int index = 0) - { - if ( m_searchFilter.Length > 0 && m_currentItems.Count > 0 ) - { - FireNodeCreateEvent( m_currentItems[ index ].NodeType, m_currentItems[ index ].Name, m_currentItems[ index ].Function ); - } - else - { - Disable(); - } - } - - public override void OnEscapePressed() - { - Disable(); - if ( m_parentWindow.WireReferenceUtils.ValidReferences() ) - { - m_parentWindow.WireReferenceUtils.InvalidateReferences(); - } - } - - public override void Draw( Rect parentPosition, Vector2 mousePosition, int mouseButtonId, bool hasKeyboadFocus ) - { - //if ( !_isActive ) - // return; - - if ( Event.current.type == EventType.MouseDown && !IsInside( Event.current.mousePosition ) ) - { - Disable(); - return; - } - base.Draw( parentPosition, mousePosition, mouseButtonId, hasKeyboadFocus ); - } - - - public void Show( Vector2 position, Rect cameraInfo ) - { - m_startDropPosition = position; - m_maximizedArea.x = ( position.x + m_maximizedArea.width ) > cameraInfo.width ? ( cameraInfo.width - 1.1f * m_maximizedArea.width ) : position.x; - m_maximizedArea.y = ( position.y + m_maximizedArea.height ) > cameraInfo.height ? ( cameraInfo.height - 1.1f * m_maximizedArea.height ) : position.y; - m_position = new Vector3( m_maximizedArea.x, m_maximizedArea.y, 0f ); - m_isActive = true; - m_focusOnSearch = true; - } - - - // This override is removing focus from our window ... need to figure out a workaround before re-using it - //public override bool CheckButton( GUIContent content, GUIStyle style, int buttonId ) - //{ - // if ( buttonId != m_validButtonId ) - // return false; - - // return GUILayout.Button( content, style ); - //} - - void OnOptionSelected( System.Type type, string name, AmplifyShaderFunction function ) - { - Disable(); - } - - public void Disable() - { - m_isActive = false; - } - - public Vector2 StartDropPosition - { - get { return m_startDropPosition; } - } - - public Vector3 CurrentPosition - { - get { return m_position; } - } - - public Vector2 CurrentPosition2D - { - get { return new Vector2( m_position.x, m_position.y ); } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/ContextPalette.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/ContextPalette.cs.meta deleted file mode 100644 index 59f3f897..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/ContextPalette.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 15597b146a1fc154abd63ac75cffb73f -timeCreated: 1481126953 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/PaletteParent.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/PaletteParent.cs deleted file mode 100644 index 67ce6e14..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/PaletteParent.cs +++ /dev/null @@ -1,573 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEngine; -using System.Collections.Generic; -using UnityEditor; -using System; -using System.Text.RegularExpressions; - -namespace AmplifyShaderEditor -{ - public class PaletteFilterData - { - public bool Visible; - public bool HasCommunityData; - public List<ContextMenuItem> Contents; - public PaletteFilterData( bool visible ) - { - Visible = visible; - Contents = new List<ContextMenuItem>(); - } - } - - public class PaletteParent : MenuParent - { - private const float ItemSize = 18; - public delegate void OnPaletteNodeCreate( System.Type type, string name, AmplifyShaderFunction function ); - public event OnPaletteNodeCreate OnPaletteNodeCreateEvt; - - private string m_searchFilterStr = "Search"; - protected string m_searchFilterControl = "SHADERNAMETEXTFIELDCONTROLNAME"; - protected bool m_focusOnSearch = false; - protected bool m_defaultCategoryVisible = false; - - //protected List<ContextMenuItem> m_allItems; - protected List<ContextMenuItem> m_currentItems; - protected Dictionary<string, PaletteFilterData> m_currentCategories; - private bool m_forceUpdate = true; - - - protected string m_searchFilter = string.Empty; - - private float m_searchLabelSize = -1; - private GUIStyle m_buttonStyle; - private GUIStyle m_foldoutStyle; - - protected bool m_previousWindowIsFunction = false; - - protected int m_validButtonId = 0; - protected int m_initialSeparatorAmount = 1; - - private Vector2 m_currScrollBarDims = new Vector2( 1, 1 ); - - public PaletteParent( AmplifyShaderEditorWindow parentWindow, float x, float y, float width, float height, string name, MenuAnchor anchor = MenuAnchor.NONE, MenuAutoSize autoSize = MenuAutoSize.NONE ) : base( parentWindow, x, y, width, height, name, anchor, autoSize ) - { - m_searchFilter = string.Empty; - m_currentCategories = new Dictionary<string, PaletteFilterData>(); - //m_allItems = items; - m_currentItems = new List<ContextMenuItem>(); - } - - public virtual void OnEnterPressed( int index = 0 ) { } - public virtual void OnEscapePressed() { } - - public void FireNodeCreateEvent( System.Type type, string name, AmplifyShaderFunction function ) - { - OnPaletteNodeCreateEvt( type, name, function ); - } - - public override void Draw( Rect parentPosition, Vector2 mousePosition, int mouseButtonId, bool hasKeyboadFocus ) - { - base.Draw( parentPosition, mousePosition, mouseButtonId, hasKeyboadFocus ); - if( m_previousWindowIsFunction != ParentWindow.IsShaderFunctionWindow ) - { - m_forceUpdate = true; - } - - m_previousWindowIsFunction = ParentWindow.IsShaderFunctionWindow; - - List<ContextMenuItem> allItems = ParentWindow.ContextMenuInstance.MenuItems; - - if( m_searchLabelSize < 0 ) - { - m_searchLabelSize = GUI.skin.label.CalcSize( new GUIContent( m_searchFilterStr ) ).x; - } - - if( m_foldoutStyle == null ) - { - m_foldoutStyle = new GUIStyle( GUI.skin.GetStyle( "foldout" ) ); - m_foldoutStyle.fontStyle = FontStyle.Bold; - } - - if( m_buttonStyle == null ) - { - m_buttonStyle = UIUtils.Label; - } - - Event currenEvent = Event.current; - - GUILayout.BeginArea( m_transformedArea, m_content, m_style ); - { - for( int i = 0; i < m_initialSeparatorAmount; i++ ) - { - EditorGUILayout.Separator(); - } - - if( currenEvent.type == EventType.KeyDown ) - { - KeyCode key = currenEvent.keyCode; - //if ( key == KeyCode.Return || key == KeyCode.KeypadEnter ) - // OnEnterPressed(); - - if( ( currenEvent.keyCode == KeyCode.KeypadEnter || currenEvent.keyCode == KeyCode.Return ) && currenEvent.type == EventType.KeyDown ) - { - int index = m_currentItems.FindIndex( x => GUI.GetNameOfFocusedControl().Equals( x.ItemUIContent.text + m_resizable ) ); - if( index > -1 ) - OnEnterPressed( index ); - else - OnEnterPressed(); - } - - if( key == KeyCode.Escape ) - OnEscapePressed(); - - if( m_isMouseInside || hasKeyboadFocus ) - { - if( key == ShortcutsManager.ScrollUpKey ) - { - m_currentScrollPos.y -= 10; - if( m_currentScrollPos.y < 0 ) - { - m_currentScrollPos.y = 0; - } - currenEvent.Use(); - } - - if( key == ShortcutsManager.ScrollDownKey ) - { - m_currentScrollPos.y += 10; - currenEvent.Use(); - } - } - - } - - float width = EditorGUIUtility.labelWidth; - EditorGUIUtility.labelWidth = m_searchLabelSize; - EditorGUI.BeginChangeCheck(); - { - GUI.SetNextControlName( m_searchFilterControl + m_resizable ); - m_searchFilter = EditorGUILayout.TextField( m_searchFilterStr, m_searchFilter ); - if( m_focusOnSearch ) - { - m_focusOnSearch = false; - EditorGUI.FocusTextInControl( m_searchFilterControl + m_resizable ); - } - } - if( EditorGUI.EndChangeCheck() ) - m_forceUpdate = true; - - EditorGUIUtility.labelWidth = width; - bool usingSearchFilter = ( m_searchFilter.Length == 0 ); - m_currScrollBarDims.x = m_transformedArea.width; - m_currScrollBarDims.y = m_transformedArea.height - 2 - 16 - 2 - 7 * m_initialSeparatorAmount - 2; - m_currentScrollPos = EditorGUILayout.BeginScrollView( m_currentScrollPos/*, GUILayout.Width( 242 ), GUILayout.Height( 250 - 2 - 16 - 2 - 7 - 2) */); - { - if( m_forceUpdate ) - { - m_forceUpdate = false; - - //m_currentItems.Clear(); - m_currentCategories.Clear(); - - if( usingSearchFilter ) - { - for( int i = 0; i < allItems.Count; i++ ) - { - //m_currentItems.Add( allItems[ i ] ); - if( !m_currentCategories.ContainsKey( allItems[ i ].Category ) ) - { - m_currentCategories.Add( allItems[ i ].Category, new PaletteFilterData( m_defaultCategoryVisible ) ); - //m_currentCategories[ allItems[ i ].Category ].HasCommunityData = allItems[ i ].NodeAttributes.FromCommunity || m_currentCategories[ allItems[ i ].Category ].HasCommunityData; - } - m_currentCategories[ allItems[ i ].Category ].Contents.Add( allItems[ i ] ); - } - } - else - { - for( int i = 0; i < allItems.Count; i++ ) - { - var searchList = m_searchFilter.Trim( ' ' ).ToLower().Split(' '); - - int matchesFound = 0; - for( int k = 0; k < searchList.Length; k++ ) - { - MatchCollection wordmatch = Regex.Matches( allItems[ i ].Tags, "\\b"+searchList[ k ] ); - if( wordmatch.Count > 0 ) - matchesFound++; - else - break; - } - - if( searchList.Length == matchesFound ) - { - //m_currentItems.Add( allItems[ i ] ); - if( !m_currentCategories.ContainsKey( allItems[ i ].Category ) ) - { - m_currentCategories.Add( allItems[ i ].Category, new PaletteFilterData( m_defaultCategoryVisible ) ); - //m_currentCategories[ allItems[ i ].Category ].HasCommunityData = allItems[ i ].NodeAttributes.FromCommunity || m_currentCategories[ allItems[ i ].Category ].HasCommunityData; - } - m_currentCategories[ allItems[ i ].Category ].Contents.Add( allItems[ i ] ); - } - } - } - var categoryEnumerator = m_currentCategories.GetEnumerator(); - while( categoryEnumerator.MoveNext() ) - { - categoryEnumerator.Current.Value.Contents.Sort( ( x, y ) => x.CompareTo( y, usingSearchFilter ) ); - } - - //sort current list respecting categories - m_currentItems.Clear(); - foreach( var item in m_currentCategories ) - { - for( int i = 0; i < item.Value.Contents.Count; i++ ) - { - m_currentItems.Add( item.Value.Contents[ i ] ); - } - } - } - - string watching = string.Empty; - - // unselect the main search field so it can focus list elements next - if( ( currenEvent.keyCode == KeyCode.DownArrow || currenEvent.keyCode == KeyCode.UpArrow ) && m_searchFilter.Length > 0 ) - { - if( GUI.GetNameOfFocusedControl().Equals( m_searchFilterControl + m_resizable ) ) - { - EditorGUI.FocusTextInControl( null ); - } - } - - if( currenEvent.keyCode == KeyCode.DownArrow && currenEvent.type == EventType.KeyDown ) - { - currenEvent.Use(); - - int nextIndex = m_currentItems.FindIndex( x => GUI.GetNameOfFocusedControl().Equals( x.ItemUIContent.text + m_resizable ) ) + 1; - if( nextIndex == m_currentItems.Count ) - nextIndex = 0; - - watching = m_currentItems[ nextIndex ].ItemUIContent.text + m_resizable; - GUI.FocusControl( watching ); - - } - - if( currenEvent.keyCode == KeyCode.UpArrow && currenEvent.type == EventType.KeyDown ) - { - currenEvent.Use(); - - int nextIndex = m_currentItems.FindIndex( x => GUI.GetNameOfFocusedControl().Equals( x.ItemUIContent.text + m_resizable ) ) - 1; - if( nextIndex < 0 ) - nextIndex = m_currentItems.Count - 1; - - watching = m_currentItems[ nextIndex ].ItemUIContent.text + m_resizable; - GUI.FocusControl( watching ); - } - - if( currenEvent.keyCode == KeyCode.Tab ) - { - ContextMenuItem item = m_currentItems.Find( x => GUI.GetNameOfFocusedControl().Equals( x.ItemUIContent.text + m_resizable ) ); - if( item != null ) - { - watching = item.ItemUIContent.text + m_resizable; - } - } - - float currPos = 0; - var enumerator = m_currentCategories.GetEnumerator(); - - float cache = EditorGUIUtility.labelWidth; - while( enumerator.MoveNext() ) - { - var current = enumerator.Current; - bool visible = GUILayout.Toggle( current.Value.Visible, current.Key, m_foldoutStyle ); - if( m_validButtonId == mouseButtonId ) - { - current.Value.Visible = visible; - } - - currPos += ItemSize; - if( m_searchFilter.Length > 0 || current.Value.Visible ) - { - for( int i = 0; i < current.Value.Contents.Count; i++ ) - { - //if ( !IsItemVisible( currPos ) ) - //{ - // // Invisible - // GUILayout.Space( ItemSize ); - //} - //else - { - currPos += ItemSize; - // Visible - EditorGUILayout.BeginHorizontal(); - GUILayout.Space( 16 ); - //if ( m_isMouseInside ) - //{ - // //GUI.SetNextControlName( current.Value.Contents[ i ].ItemUIContent.text ); - // if ( CheckButton( current.Value.Contents[ i ].ItemUIContent, m_buttonStyle, mouseButtonId ) ) - // { - // int controlID = GUIUtility.GetControlID( FocusType.Passive ); - // GUIUtility.hotControl = controlID; - // OnPaletteNodeCreateEvt( current.Value.Contents[ i ].NodeType, current.Value.Contents[ i ].Name, current.Value.Contents[ i ].Function ); - // } - //} - //else - { - Rect thisRect = EditorGUILayout.GetControlRect( false, 16f, EditorStyles.label ); - //if ( m_resizable ) - { - if( GUI.RepeatButton( thisRect, string.Empty, EditorStyles.label ) ) - { - int controlID = GUIUtility.GetControlID( FocusType.Passive ); - GUIUtility.hotControl = controlID; - OnPaletteNodeCreateEvt( current.Value.Contents[ i ].NodeType, current.Value.Contents[ i ].Name, current.Value.Contents[ i ].Function ); - //unfocus to make it focus the next text field correctly - GUI.FocusControl( null ); - } - } - GUI.SetNextControlName( current.Value.Contents[ i ].ItemUIContent.text + m_resizable ); - //EditorGUI.SelectableLabel( thisRect, current.Value.Contents[ i ].ItemUIContent.text, EditorStyles.label ); - //float cache = EditorGUIUtility.labelWidth; - EditorGUIUtility.labelWidth = thisRect.width; - EditorGUI.Toggle( thisRect, current.Value.Contents[ i ].ItemUIContent.text, false, EditorStyles.label ); - EditorGUIUtility.labelWidth = cache; - if( watching == current.Value.Contents[ i ].ItemUIContent.text + m_resizable ) - { - bool boundBottom = currPos - m_currentScrollPos.y > m_currScrollBarDims.y; - bool boundTop = currPos - m_currentScrollPos.y - 4 <= 0; - - if( boundBottom ) - m_currentScrollPos.y = currPos - m_currScrollBarDims.y + 2; - else if( boundTop ) - m_currentScrollPos.y = currPos - 18; - //else if ( boundBottom && !downDirection ) - // m_currentScrollPos.y = currPos - m_currScrollBarDims.y + 2; - //else if ( boundTop && downDirection ) - // m_currentScrollPos.y = currPos - 18; - } - } - EditorGUILayout.EndHorizontal(); - } - //currPos += ItemSize; - } - } - } - EditorGUIUtility.labelWidth = cache; - } - EditorGUILayout.EndScrollView(); - } - GUILayout.EndArea(); - - } - public void CheckCommunityNodes() - { - var enumerator = m_currentCategories.GetEnumerator(); - while( enumerator.MoveNext() ) - { - var current = enumerator.Current; - current.Value.HasCommunityData = false; - int count = current.Value.Contents.Count; - for( int i = 0; i < count; i++ ) - { - if( current.Value.Contents[ i ].NodeAttributes.FromCommunity ) - { - current.Value.HasCommunityData = true; - break; - } - } - } - } - - public void DumpAvailableNodes( bool fromCommunity, string pathname ) - { - string noTOCHeader = "__NOTOC__\n"; - string nodesHeader = "== Available Node Categories ==\n"; - string InitialCategoriesFormat = "[[#{0}|{0}]]<br>\n"; - string InitialCategories = string.Empty; - string CurrentCategoryFormat = "\n== {0} ==\n\n"; - //string NodesFootFormat = "[[Unity Products:Amplify Shader Editor/{0} | Learn More]] -\n[[#Top|Back to Categories]]\n"; - string NodesFootFormatSep = "[[#Top|Back to Top]]\n----\n"; - string OverallFoot = "[[Category:Nodes]]"; - - string NodeInfoBeginFormat = "<div class=\"nodecard\">\n"; - string nodeInfoBodyFormat = "{{| id=\"{2}\" class=\"wikitable\" |\n" + - "|- \n" + - "| <div>[[Unity Products:Amplify Shader Editor/{1}|<img class=\"responsive-img\" src=\"http://amplify.pt/Nodes/{0}.jpg\">]]</div>\n" + - "<div>\n" + - "{{| style=\"width: 100%; height: 150px;\"\n" + - "|-\n" + - "| [[Unity Products:Amplify Shader Editor/{1}|'''{2}''']]\n" + - "|- style=\"vertical-align:top; height: 100%;\" |\n" + - "|<p class=\"cardtext\">{3}</p>\n" + - "|- style=\"text-align:right;\" |\n" + - "|{4}[[Unity Products:Amplify Shader Editor/{1} | Learn More]]\n" + - "|}}</div>\n" + - "|}}\n"; - string NodeInfoEndFormat = "</div>\n"; - - //string NodeInfoBeginFormat = "<span style=\"color:#c00;display:block;\">This page is under construction!</span>\n\n"; - //string nodeInfoBodyFormat = "<img style=\"float:left; margin-right:10px;\" src=\"http://amplify.pt/Nodes/{0}.jpg\">\n[[Unity Products:Amplify Shader Editor/{1}|'''{2}''']]\n\n{3}"; - //string NodeInfoEndFormat = "\n\n[[Unity_Products:Amplify_Shader_Editor/Nodes | Back to Node List ]]\n[[Category:Nodes]][[Category:{0}]]\n\n\n"; - - //string NodeInfoBeginFormat = "{| cellpadding=\"10\"\n"; - //string nodeInfoBodyFormat = "|- style=\"vertical-align:top;\"\n| http://amplify.pt/Nodes/{0}.jpg\n| [[Unity Products:Amplify Shader Editor/{1} | <span style=\"font-size: 120%;\"><span id=\"{2}\"></span>'''{2}'''<span> ]] <br> {3}\n"; - //string NodeInfoEndFormat = "|}\n"; - - string nodesInfo = string.Empty; - BuildFullList( true ); - CheckCommunityNodes(); - var enumerator = m_currentCategories.GetEnumerator(); - while( enumerator.MoveNext() ) - { - var current = enumerator.Current; - if( fromCommunity && current.Value.HasCommunityData || !fromCommunity ) - { - InitialCategories += string.Format( InitialCategoriesFormat, current.Key ); - nodesInfo += string.Format( CurrentCategoryFormat, current.Key ); - int count = current.Value.Contents.Count; - for( int i = 0; i < count; i++ ) - { - if( ( fromCommunity && current.Value.Contents[ i ].NodeAttributes.FromCommunity ) - || !fromCommunity - //|| ( !fromCommunity && !current.Value.Contents[ i ].NodeAttributes.FromCommunity ) - ) - { - string nodeFullName = current.Value.Contents[ i ].Name; - string pictureFilename = UIUtils.ReplaceInvalidStrings( nodeFullName ); - - string pageFilename = UIUtils.RemoveWikiInvalidCharacters( pictureFilename ); - - pictureFilename = UIUtils.RemoveInvalidCharacters( pictureFilename ); - - string nodeDescription = current.Value.Contents[ i ].ItemUIContent.tooltip; - string communityText = string.Empty; - if( current.Value.Contents[ i ].NodeAttributes.FromCommunity ) - communityText = "<small class=\"cardauthor\">( originally by "+ current.Value.Contents[ i ].NodeAttributes.Community + " )</small> "; - - string nodeInfoBody = string.Format( nodeInfoBodyFormat, pictureFilename, pageFilename, nodeFullName, nodeDescription, communityText ); - //string nodeInfoFoot = string.Format( NodesFootFormat, pageFilename ); - - nodesInfo += ( NodeInfoBeginFormat + nodeInfoBody + NodeInfoEndFormat ); - //nodesInfo += ( NodeInfoBeginFormat + nodeInfoBody + string.Format( NodeInfoEndFormat, current.Key ) ); - //if ( i != ( count - 1 ) ) - //{ - // nodesInfo += NodesFootFormatSep; - //} - } - } - nodesInfo += NodesFootFormatSep; - } - } - - string finalText = noTOCHeader + nodesHeader + InitialCategories + nodesInfo + OverallFoot; - - if( !System.IO.Directory.Exists( pathname ) ) - { - System.IO.Directory.CreateDirectory( pathname ); - } - // Save file - string nodesPathname = pathname + ( fromCommunity ? "AvailableNodesFromCommunity.txt" : "AvailableNodes.txt" ); - Debug.Log( " Creating nodes file at " + nodesPathname ); - IOUtils.SaveTextfileToDisk( finalText, nodesPathname, false ); - BuildFullList( false ); - } - - public virtual bool CheckButton( GUIContent content, GUIStyle style, int buttonId ) - { - if( buttonId != m_validButtonId ) - { - GUILayout.Label( content, style ); - return false; - } - - return GUILayout.RepeatButton( content, style ); - } - - public void FillList( ref List<ContextMenuItem> list, bool forceAllItems ) - { - List<ContextMenuItem> allList = forceAllItems ? ParentWindow.ContextMenuInstance.ItemFunctions : ParentWindow.ContextMenuInstance.MenuItems; - - list.Clear(); - int count = allList.Count; - for( int i = 0; i < count; i++ ) - { - list.Add( allList[ i ] ); - } - } - - public Dictionary<string, PaletteFilterData> BuildFullList( bool forceAllNodes = false ) - { - //Only need to build if search filter is active and list is set according to it - if( m_searchFilter.Length > 0 || !m_isActive || m_currentCategories.Count == 0 ) - { - m_currentItems.Clear(); - m_currentCategories.Clear(); - - List<ContextMenuItem> allItems = forceAllNodes ? ParentWindow.ContextMenuInstance.ItemFunctions : ParentWindow.ContextMenuInstance.MenuItems; - - for( int i = 0; i < allItems.Count; i++ ) - { - if( allItems[ i ].Name.IndexOf( m_searchFilter, StringComparison.InvariantCultureIgnoreCase ) >= 0 || - allItems[ i ].Category.IndexOf( m_searchFilter, StringComparison.InvariantCultureIgnoreCase ) >= 0 - ) - { - m_currentItems.Add( allItems[ i ] ); - if( !m_currentCategories.ContainsKey( allItems[ i ].Category ) ) - { - m_currentCategories.Add( allItems[ i ].Category, new PaletteFilterData( m_defaultCategoryVisible ) ); - //m_currentCategories[ allItems[ i ].Category ].HasCommunityData = allItems[ i ].NodeAttributes.FromCommunity || m_currentCategories[ allItems[ i ].Category ].HasCommunityData; - } - m_currentCategories[ allItems[ i ].Category ].Contents.Add( allItems[ i ] ); - } - } - - var categoryEnumerator = m_currentCategories.GetEnumerator(); - while( categoryEnumerator.MoveNext() ) - { - categoryEnumerator.Current.Value.Contents.Sort( ( x, y ) => x.CompareTo( y, false ) ); - } - - //mark to force update and take search filter into account - m_forceUpdate = true; - } - return m_currentCategories; - } - - private bool IsItemVisible( float currPos ) - { - if( ( currPos < m_currentScrollPos.y && ( currPos + ItemSize ) < m_currentScrollPos.y ) || - ( currPos > ( m_currentScrollPos.y + m_currScrollBarDims.y ) && - ( currPos + ItemSize ) > ( m_currentScrollPos.y + m_currScrollBarDims.y ) ) ) - { - return false; - } - return true; - } - - public override void Destroy() - { - base.Destroy(); - - //m_allItems = null; - - m_currentItems.Clear(); - m_currentItems = null; - - m_currentCategories.Clear(); - m_currentCategories = null; - - OnPaletteNodeCreateEvt = null; - m_buttonStyle = null; - m_foldoutStyle = null; - } - - //public void Clear() { - // m_allItems.Clear(); - // m_allItems = new List<ContextMenuItem>(); - //} - - public bool ForceUpdate { get { return m_forceUpdate; } set { m_forceUpdate = value; } } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/PaletteParent.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/PaletteParent.cs.meta deleted file mode 100644 index b9d921f2..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/PaletteParent.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: df4c2f840dca60a4cb118325ce2febfa -timeCreated: 1481126959 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/PalettePopUp.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/PalettePopUp.cs deleted file mode 100644 index 84cfbc4a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/PalettePopUp.cs +++ /dev/null @@ -1,73 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEngine; - -namespace AmplifyShaderEditor -{ - public class PalettePopUp - { - private const int DeltaX = 5; - private Rect m_areaSettings; - private Vector2 m_mouseDeltaPos = new Vector2( 10, -10 ); - private bool m_isActive = false; - private GUIContent m_content; - private GUIStyle m_style; - private GUIStyle m_fontStyle; - private GUIContent m_labelContent; - - public PalettePopUp() - { - m_content = new GUIContent( GUIContent.none ); - m_areaSettings = new Rect( 0, 0, 100, 30 ); - m_labelContent = new GUIContent( "Test Label" ); - } - - public void Activate( string label ) - { - m_labelContent.text = label; - m_areaSettings.width = -1; - m_isActive = true; - } - - public void Deactivate() - { - m_isActive = false; - } - - public void Draw( Vector2 mousePos ) - { - if ( m_style == null ) - { - m_style = UIUtils.TextArea; - } - - if ( m_fontStyle == null ) - { - m_fontStyle = new GUIStyle( UIUtils.Label ); - m_fontStyle.fontSize = 15; - } - - if ( m_areaSettings.width < 0 ) - { - m_areaSettings.width = m_fontStyle.CalcSize( m_labelContent ).x + 2 * DeltaX; - } - - m_areaSettings.position = mousePos + m_mouseDeltaPos; - GUI.Label( m_areaSettings, m_content, m_style ); - m_areaSettings.position += new Vector2( DeltaX,DeltaX); - GUI.Label( m_areaSettings, m_labelContent, m_fontStyle ); - } - - public void Destroy() - { - m_content = null; - m_style = null; - } - - public bool IsActive - { - get { return m_isActive; } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/PalettePopUp.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/PalettePopUp.cs.meta deleted file mode 100644 index f0f84d43..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/PalettePopUp.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: bc4f137f15efe1d42b7bcbf984ec1545 -timeCreated: 1481126958 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/PaletteWindow.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/PaletteWindow.cs deleted file mode 100644 index f0b6960f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/PaletteWindow.cs +++ /dev/null @@ -1,33 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System.Collections.Generic; -using UnityEngine; - -namespace AmplifyShaderEditor -{ - public sealed class PaletteWindow : PaletteParent - { - public PaletteWindow( AmplifyShaderEditorWindow parentWindow ) : base( parentWindow, 0, 0, 250, 0, string.Empty, MenuAnchor.TOP_RIGHT, MenuAutoSize.MATCH_VERTICAL ) - { - m_searchFilterControl += "PALETTEWINDOW"; - m_initialSeparatorAmount = 4; - SetMinimizedArea( -225, 0, 260, 0 ); - } - - public override void Draw( Rect parentPosition, Vector2 mousePosition, int mouseButtonId, bool hasKeyboadFocus ) - { - if ( m_isMaximized ) - { - base.Draw( parentPosition, mousePosition, mouseButtonId, hasKeyboadFocus ); - } - else - { - InitDraw( parentPosition, mousePosition, mouseButtonId ); - } - PostDraw(); - } - } -} - - diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/PaletteWindow.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/PaletteWindow.cs.meta deleted file mode 100644 index 521f7761..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Palette/PaletteWindow.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 63408b264ef8cb346a5ce9e559a5ed22 -timeCreated: 1481126956 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/PortLegendInfo.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/PortLegendInfo.cs deleted file mode 100644 index 9f76a512..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/PortLegendInfo.cs +++ /dev/null @@ -1,469 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEditor; -using UnityEngine; -using System.Collections.Generic; - -namespace AmplifyShaderEditor -{ - class NodeDescriptionInfo - { - public bool FoldoutValue; - public string Category; - public string[,] Contents; - } - - public sealed class PortLegendInfo : EditorWindow - { - private const string NoASEWindowWarning = "Please Open the ASE to get access to shortcut info"; - private const float PixelSeparator = 5; - private const string EditorShortcutsTitle = "Editor Shortcuts"; - private const string MenuShortcutsTitle = "Menu Shortcuts"; - private const string NodesShortcutsTitle = "Nodes Shortcuts"; - private const string PortShortcutsTitle = "Port Shortcuts"; - private const string PortLegendTitle = "Port Legend"; - private const string NodesDescTitle = "Node Info"; - private const string CompatibleAssetsTitle = "Compatible Assets"; - - private const string KeyboardUsageTemplate = "[{0}] - {1}"; - private const string m_lockedStr = "Locked Port"; - - private const float WindowSizeX = 350; - private const float WindowSizeY = 300; - private const float WindowPosX = 5; - private const float WindowPosY = 5; - - private int TitleLabelWidth = 150; - private Rect m_availableArea; - - private bool m_portAreaFoldout = true; - private bool m_editorShortcutAreaFoldout = true; - private bool m_menuShortcutAreaFoldout = true; - private bool m_nodesShortcutAreaFoldout = true; - private bool m_nodesDescriptionAreaFoldout = true; - private bool m_compatibleAssetsFoldout = true; - - private Vector2 m_currentScrollPos; - - private GUIStyle m_portStyle; - private GUIStyle m_labelStyleBold; - private GUIStyle m_labelStyle; - - private GUIStyle m_nodeInfoLabelStyleBold; - private GUIStyle m_nodeInfoLabelStyle; - - private GUIStyle m_nodeInfoFoldoutStyle; - - private GUIContent m_content = new GUIContent( "Helper", "Shows helper info for ASE users" ); - private bool m_init = true; - - private List<ShortcutItem> m_editorShortcuts = null; - private List<ShortcutItem> m_nodesShortcuts = null; - private List<NodeDescriptionInfo> m_nodeDescriptionsInfo = null; - private List<string[]> m_compatibleAssetsInfo = null; - - public static PortLegendInfo OpenWindow() - { - PortLegendInfo currentWindow = ( PortLegendInfo ) PortLegendInfo.GetWindow( typeof( PortLegendInfo ), false ); - currentWindow.minSize = new Vector2( WindowSizeX, WindowSizeY ); - currentWindow.maxSize = new Vector2( WindowSizeX * 2, 2 * WindowSizeY ); ; - currentWindow.wantsMouseMove = true; - return currentWindow; - } - - public void Init() - { - m_init = false; - wantsMouseMove = false; - titleContent = m_content; - m_portStyle = new GUIStyle( UIUtils.GetCustomStyle( CustomStyle.PortEmptyIcon ) ); - m_portStyle.alignment = TextAnchor.MiddleLeft; - m_portStyle.imagePosition = ImagePosition.ImageOnly; - m_portStyle.margin = new RectOffset( 5, 0, 5, 0 ); - - m_labelStyleBold = new GUIStyle( UIUtils.InputPortLabel ); - m_labelStyleBold.fontStyle = FontStyle.Bold; - m_labelStyleBold.fontSize = ( int ) ( Constants.TextFieldFontSize ); - - - m_labelStyle = new GUIStyle( UIUtils.InputPortLabel ); - m_labelStyle.clipping = TextClipping.Overflow; - m_labelStyle.imagePosition = ImagePosition.TextOnly; - m_labelStyle.contentOffset = new Vector2( -10, 0 ); - m_labelStyle.fontSize = ( int ) ( Constants.TextFieldFontSize ); - - m_nodeInfoLabelStyleBold = new GUIStyle( UIUtils.InputPortLabel ); - m_nodeInfoLabelStyleBold.fontStyle = FontStyle.Bold; - m_nodeInfoLabelStyleBold.fontSize = ( int ) ( Constants.TextFieldFontSize ); - - m_nodeInfoLabelStyle = new GUIStyle( UIUtils.InputPortLabel ); - m_nodeInfoLabelStyle.clipping = TextClipping.Clip; - m_nodeInfoLabelStyle.imagePosition = ImagePosition.TextOnly; - m_nodeInfoLabelStyle.fontSize = ( int ) ( Constants.TextFieldFontSize ); - - - m_nodeInfoFoldoutStyle = new GUIStyle( ( GUIStyle ) "foldout" ); - m_nodeInfoFoldoutStyle.fontStyle = FontStyle.Bold; - - if ( !EditorGUIUtility.isProSkin ) - { - m_labelStyleBold.normal.textColor = m_labelStyle.normal.textColor = Color.black; - m_nodeInfoLabelStyleBold.normal.textColor = m_labelStyle.normal.textColor = Color.black; - m_nodeInfoLabelStyle.normal.textColor = m_labelStyle.normal.textColor = Color.black; - } - - m_availableArea = new Rect( WindowPosX, WindowPosY, WindowSizeX - 2 * WindowPosX, WindowSizeY - 2 * WindowPosY ); - } - - void DrawPort( WirePortDataType type ) - { - EditorGUILayout.BeginHorizontal(); - { - GUI.color = UIUtils.GetColorForDataType( type, false ); - GUILayout.Box( string.Empty, m_portStyle, GUILayout.Width( UIUtils.PortsSize.x ), GUILayout.Height( UIUtils.PortsSize.y ) ); - GUI.color = Color.white; - EditorGUILayout.LabelField( UIUtils.GetNameForDataType( type ), m_labelStyle ); - } - EditorGUILayout.EndHorizontal(); - EditorGUILayout.Separator(); - } - - void OnGUI() - { - if ( !UIUtils.Initialized || UIUtils.CurrentWindow == null ) - { - EditorGUILayout.LabelField( NoASEWindowWarning ); - return; - } - - if ( m_init ) - { - Init(); - } - - TitleLabelWidth = (int)(this.position.width * 0.42f); - - KeyCode key = Event.current.keyCode; - if ( key == ShortcutsManager.ScrollUpKey ) - { - m_currentScrollPos.y -= 10; - if ( m_currentScrollPos.y < 0 ) - { - m_currentScrollPos.y = 0; - } - Event.current.Use(); - } - - if ( key == ShortcutsManager.ScrollDownKey ) - { - m_currentScrollPos.y += 10; - Event.current.Use(); - } - - if ( Event.current.type == EventType.MouseDrag && Event.current.button > 0 ) - { - m_currentScrollPos.x += Constants.MenuDragSpeed * Event.current.delta.x; - if ( m_currentScrollPos.x < 0 ) - { - m_currentScrollPos.x = 0; - } - - m_currentScrollPos.y += Constants.MenuDragSpeed * Event.current.delta.y; - if ( m_currentScrollPos.y < 0 ) - { - m_currentScrollPos.y = 0; - } - } - - m_availableArea = new Rect( WindowPosX, WindowPosY, position.width - 2 * WindowPosX, position.height - 2 * WindowPosY ); - GUILayout.BeginArea( m_availableArea ); - { - if ( GUILayout.Button( "Wiki Page" ) ) - { - Application.OpenURL( Constants.HelpURL ); - } - - m_currentScrollPos = GUILayout.BeginScrollView( m_currentScrollPos ); - { - EditorGUILayout.BeginVertical(); - { - NodeUtils.DrawPropertyGroup( ref m_portAreaFoldout, PortLegendTitle, DrawPortInfo ); - float currLabelWidth = EditorGUIUtility.labelWidth; - EditorGUIUtility.labelWidth = 1; - NodeUtils.DrawPropertyGroup( ref m_editorShortcutAreaFoldout, EditorShortcutsTitle, DrawEditorShortcuts ); - NodeUtils.DrawPropertyGroup( ref m_menuShortcutAreaFoldout, MenuShortcutsTitle, DrawMenuShortcuts ); - NodeUtils.DrawPropertyGroup( ref m_nodesShortcutAreaFoldout, NodesShortcutsTitle, DrawNodesShortcuts ); - NodeUtils.DrawPropertyGroup( ref m_compatibleAssetsFoldout, CompatibleAssetsTitle, DrawCompatibleAssets ); - NodeUtils.DrawPropertyGroup( ref m_nodesDescriptionAreaFoldout, NodesDescTitle, DrawNodeDescriptions ); - EditorGUIUtility.labelWidth = currLabelWidth; - } - EditorGUILayout.EndVertical(); - } - GUILayout.EndScrollView(); - } - GUILayout.EndArea(); - - } - - void DrawPortInfo() - { - Color originalColor = GUI.color; - - DrawPort( WirePortDataType.OBJECT ); - DrawPort( WirePortDataType.INT ); - DrawPort( WirePortDataType.FLOAT ); - DrawPort( WirePortDataType.FLOAT2 ); - DrawPort( WirePortDataType.FLOAT3 ); - DrawPort( WirePortDataType.FLOAT4 ); - DrawPort( WirePortDataType.COLOR ); - DrawPort( WirePortDataType.SAMPLER2D ); - DrawPort( WirePortDataType.FLOAT3x3 ); - DrawPort( WirePortDataType.FLOAT4x4 ); - - EditorGUILayout.BeginHorizontal(); - { - GUI.color = Constants.LockedPortColor; - GUILayout.Box( string.Empty, m_portStyle, GUILayout.Width( UIUtils.PortsSize.x ), GUILayout.Height( UIUtils.PortsSize.y ) ); - GUI.color = Color.white; - EditorGUILayout.LabelField( m_lockedStr, m_labelStyle ); - } - EditorGUILayout.EndHorizontal(); - - GUI.color = originalColor; - } - - public void DrawEditorShortcuts() - { - AmplifyShaderEditorWindow window = UIUtils.CurrentWindow; - if ( window != null ) - { - if ( m_editorShortcuts == null ) - { - m_editorShortcuts = window.ShortcutManagerInstance.AvailableEditorShortcutsList; - } - - EditorGUI.indentLevel--; - int count = m_editorShortcuts.Count; - for ( int i = 0; i < count; i++ ) - { - DrawItem( m_editorShortcuts[ i ].Name, m_editorShortcuts[ i ].Description ); - } - DrawItem( "Q", "Alternative Pan modifier" ); - DrawItem( "Ctrl + F", "Find nodes" ); - DrawItem( "LMB Drag", "Box selection" ); - DrawItem( "MMB/RMB Drag", "Camera pan" ); - DrawItem( "Alt + MMB/RMB Drag", "Zoom graph" ); - DrawItem( "Shift/Ctrl + Node Select", "Add/Remove from selection" ); - DrawItem( "Shift + Node Drag", "Node move with offset" ); - DrawItem( "Ctrl + Node Drag", "Node move with snap" ); - DrawItem( "MMB/RMB + Drag Panel", "Scroll panel" ); - DrawItem( "Alt + LMB Drag", "Additive box selection" ); - DrawItem( "Alt + Shift + Drag", "Subtractive box selection" ); - DrawItem( "Alt + Node Drag", "Auto-(Dis)Connect node on existing wire connection" ); - EditorGUI.indentLevel++; - - } - else - { - EditorGUILayout.LabelField( NoASEWindowWarning ); - } - } - - public void DrawMenuShortcuts() - { - AmplifyShaderEditorWindow window = UIUtils.CurrentWindow; - if ( window != null ) - { - EditorGUI.indentLevel--; - DrawItem( ShortcutsManager.ScrollUpKey.ToString(), "Scroll Up Menu" ); - DrawItem( ShortcutsManager.ScrollDownKey.ToString(), "Scroll Down Menu" ); - DrawItem( "RMB Drag", "Scroll Menu" ); - EditorGUI.indentLevel++; - } - else - { - EditorGUILayout.LabelField( NoASEWindowWarning ); - } - } - - void DrawItem( string name, string description ) - { - GUILayout.BeginHorizontal(); - GUILayout.Label( name, m_labelStyleBold , GUILayout.Width( TitleLabelWidth ) ); - GUILayout.Label( description, m_labelStyle ); - GUILayout.EndHorizontal(); - GUILayout.Space( PixelSeparator ); - } - - public void DrawNodesShortcuts() - { - AmplifyShaderEditorWindow window = UIUtils.CurrentWindow; - if ( window != null ) - { - if ( m_nodesShortcuts == null || m_nodesShortcuts.Count == 0 ) - { - m_nodesShortcuts = window.ShortcutManagerInstance.AvailableNodesShortcutsList; - } - - EditorGUI.indentLevel--; - int count = m_nodesShortcuts.Count; - for ( int i = 0; i < count; i++ ) - { - DrawItem( m_nodesShortcuts[ i ].Name, m_nodesShortcuts[ i ].Description ); - } - EditorGUI.indentLevel++; - } - else - { - EditorGUILayout.LabelField( NoASEWindowWarning ); - } - } - string CreateCompatibilityString( string source ) - { - string[] split = source.Split( '.' ); - if ( split != null && split.Length > 1 ) - { - return split[ 1 ]; - } - else - { - return source; - } - } - public void DrawCompatibleAssets() - { - AmplifyShaderEditorWindow window = UIUtils.CurrentWindow; - if ( window != null ) - { - if ( m_compatibleAssetsInfo == null ) - { - m_compatibleAssetsInfo = new List<string[]>(); - List<ContextMenuItem> items = window.ContextMenuInstance.MenuItems; - int count = items.Count; - for ( int i = 0; i < count; i++ ) - { - if ( items[ i ].NodeAttributes != null && items[ i ].NodeAttributes.CastType != null ) - { - string types = string.Empty; - if ( items[ i ].NodeAttributes.CastType.Length > 1 ) - { - for ( int j = 0; j < items[ i ].NodeAttributes.CastType.Length; j++ ) - { - types += CreateCompatibilityString( items[ i ].NodeAttributes.CastType[ j ].ToString() ); - - - if ( j < items[ i ].NodeAttributes.CastType.Length - 1 ) - { - types += ", "; - } - } - } - else - { - types = CreateCompatibilityString( items[ i ].NodeAttributes.CastType[ 0 ].ToString() ); - } - m_compatibleAssetsInfo.Add( new string[] { items[ i ].NodeAttributes.Name + ": ", types } ); - } - } - } - EditorGUI.indentLevel--; - int nodeCount = m_compatibleAssetsInfo.Count; - for ( int j = 0; j < nodeCount; j++ ) - { - DrawItem( m_compatibleAssetsInfo[ j ][ 0 ], m_compatibleAssetsInfo[ j ][ 1 ] ); - } - EditorGUI.indentLevel++; - } - else - { - EditorGUILayout.LabelField( NoASEWindowWarning ); - } - } - - public void DrawNodeDescriptions() - { - AmplifyShaderEditorWindow window = UIUtils.CurrentWindow; - if ( window != null ) - { - if ( m_nodeDescriptionsInfo == null ) - { - //fetch node info - m_nodeDescriptionsInfo = new List<NodeDescriptionInfo>(); - Dictionary<string, PaletteFilterData> nodeData = window.CurrentPaletteWindow.BuildFullList(); - var enumerator = nodeData.GetEnumerator(); - while ( enumerator.MoveNext() ) - { - List<ContextMenuItem> nodes = enumerator.Current.Value.Contents; - int count = nodes.Count; - - NodeDescriptionInfo currInfo = new NodeDescriptionInfo(); - currInfo.Contents = new string[ count, 2 ]; - currInfo.Category = enumerator.Current.Key; - - for ( int i = 0; i < count; i++ ) - { - currInfo.Contents[ i, 0 ] = nodes[ i ].Name + ':'; - currInfo.Contents[ i, 1 ] = nodes[ i ].Description; - } - m_nodeDescriptionsInfo.Add( currInfo ); - } - } - - //draw - { - GUILayout.Space( 5 ); - int count = m_nodeDescriptionsInfo.Count; - EditorGUI.indentLevel--; - for ( int i = 0; i < count; i++ ) - { - m_nodeDescriptionsInfo[ i ].FoldoutValue = EditorGUILayout.Foldout( m_nodeDescriptionsInfo[ i ].FoldoutValue, m_nodeDescriptionsInfo[ i ].Category, m_nodeInfoFoldoutStyle ); - if ( m_nodeDescriptionsInfo[ i ].FoldoutValue ) - { - EditorGUI.indentLevel++; - int nodeCount = m_nodeDescriptionsInfo[ i ].Contents.GetLength( 0 ); - for ( int j = 0; j < nodeCount; j++ ) - { - GUILayout.Label( m_nodeDescriptionsInfo[ i ].Contents[ j, 0 ], m_nodeInfoLabelStyleBold ); - GUILayout.Label( m_nodeDescriptionsInfo[ i ].Contents[ j, 1 ], m_nodeInfoLabelStyle ); - GUILayout.Space( PixelSeparator ); - } - EditorGUI.indentLevel--; - } - GUILayout.Space( PixelSeparator ); - } - EditorGUI.indentLevel++; - } - } - else - { - EditorGUILayout.LabelField( NoASEWindowWarning ); - } - } - - private void OnDestroy() - { - m_nodesShortcuts = null; - m_editorShortcuts = null; - m_portStyle = null; - m_labelStyle = null; - m_labelStyleBold = null; - m_nodeInfoLabelStyle = null; - m_nodeInfoLabelStyleBold = null; - m_nodeInfoFoldoutStyle = null; - m_init = false; - - if ( m_nodeDescriptionsInfo != null ) - { - m_nodeDescriptionsInfo.Clear(); - m_nodeDescriptionsInfo = null; - } - - if( m_compatibleAssetsInfo != null ) - { - m_compatibleAssetsInfo.Clear(); - m_compatibleAssetsInfo = null; - } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/PortLegendInfo.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/PortLegendInfo.cs.meta deleted file mode 100644 index 42646fce..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/PortLegendInfo.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 20dad8f4196f0e643a9c56d1202e74dc -timeCreated: 1481126954 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/SceneSaveCallback.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/SceneSaveCallback.cs deleted file mode 100644 index 56e24518..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/SceneSaveCallback.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -namespace AmplifyShaderEditor -{ - // Catch when scene is saved (Ctr+S) and also save ase shader - public class SceneSaveCallback : UnityEditor.AssetModificationProcessor - { - private const string UnityStr = ".unity"; - - static string[] OnWillSaveAssets( string[] paths ) - { - bool canSave = false; - - if ( paths.Length == 0 ) - { - canSave = true; - } - else - { - for ( int i = 0; i < paths.Length; i++ ) - { - // Only save shader when saving scenes - if ( !string.IsNullOrEmpty( paths[ i ] ) && paths[ i ].Contains( UnityStr ) ) - { - canSave = true; - break; - } - } - } - if ( canSave && UIUtils.CurrentWindow ) - UIUtils.CurrentWindow.SetCtrlSCallback( false ); - - return paths; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/SceneSaveCallback.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/SceneSaveCallback.cs.meta deleted file mode 100644 index a91c39b3..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/SceneSaveCallback.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 708e90c98affcb04aa2fcfedf4329a7c -timeCreated: 1481126956 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/ShaderEditorModeWindow.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/ShaderEditorModeWindow.cs deleted file mode 100644 index 6a987d42..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/ShaderEditorModeWindow.cs +++ /dev/null @@ -1,192 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEngine; -using UnityEditor; - -namespace AmplifyShaderEditor -{ - public sealed class ShaderEditorModeWindow : MenuParent - { - private static readonly Color OverallColorOn = new Color( 1f, 1f, 1f, 0.9f ); - private static readonly Color OverallColorOff = new Color( 1f, 1f, 1f, 0.3f ); - private static readonly Color FontColorOff = new Color( 1f, 1f, 1f, 0.4f ); - private const float DeltaY = 15; - private const float DeltaX = 10; - - private const float CollSizeX = 180; - private const float CollSizeY = 70; - - //private static string MatFormat = "<size=20>MATERIAL</size>\n{0}"; - //private static string ShaderFormat = "<size=20>SHADER</size>\n{0}"; - //private const string CurrMatStr = "MATERIAL"; - //private const string CurrShaderStr = "SHADER"; - - private const string NoMaterialStr = "No Material"; - private const string NoShaderStr = "No Shader"; - - private bool m_init = true; - private string m_previousShaderName = string.Empty; - private string m_previousMaterialName = string.Empty; - private string m_previousShaderFunctionName = string.Empty; - - private Vector2 m_auxVector2; - private GUIContent m_leftAuxContent = new GUIContent(); - private GUIContent m_rightAuxContent = new GUIContent(); - private GUIStyle m_leftButtonStyle = null; - private GUIStyle m_rightButtonStyle = null; - private Rect m_leftButtonRect; - private Rect m_rightButtonRect; - - public ShaderEditorModeWindow( AmplifyShaderEditorWindow parentWindow ) : base( parentWindow, 0, 0, 0, 0, "ShaderEditorModeWindow", MenuAnchor.BOTTOM_CENTER, MenuAutoSize.NONE ) { } - - public void ConfigStyle( GUIStyle style ) - { - style.normal.textColor = FontColorOff; - style.hover.textColor = FontColorOff; - style.active.textColor = FontColorOff; - style.focused.textColor = FontColorOff; - - style.onNormal.textColor = FontColorOff; - style.onHover.textColor = FontColorOff; - style.onActive.textColor = FontColorOff; - style.onFocused.textColor = FontColorOff; - } - - - public void Draw( Rect graphArea, Vector2 mousePos, Shader currentShader, Material currentMaterial, float usableArea, float leftPos, float rightPos /*, bool showLastSelection*/ ) - { - EventType currentEventType = Event.current.type; - - if( !( currentEventType == EventType.Repaint || currentEventType == EventType.MouseDown || currentEventType == EventType.MouseMove ) ) - return; - - if ( m_init ) - { - m_init = false; - GUIStyle shaderModeTitle = UIUtils.GetCustomStyle( CustomStyle.ShaderModeTitle ); - GUIStyle shaderModeNoShader = UIUtils.GetCustomStyle( CustomStyle.ShaderModeNoShader ); - GUIStyle materialModeTitle = UIUtils.GetCustomStyle( CustomStyle.MaterialModeTitle ); - GUIStyle shaderNoMaterialModeTitle = UIUtils.GetCustomStyle( CustomStyle.ShaderNoMaterialModeTitle ); - - ConfigStyle( shaderModeTitle ); - ConfigStyle( shaderModeNoShader ); - ConfigStyle( materialModeTitle ); - ConfigStyle( shaderNoMaterialModeTitle ); - } - Color buffereredColor = GUI.color; - - MasterNode currentMasterNode = ParentWindow.CurrentGraph.CurrentMasterNode; - // Shader Mode - if ( currentMasterNode != null ) - { - m_leftButtonStyle = UIUtils.GetCustomStyle( currentShader == null ? CustomStyle.ShaderModeNoShader : CustomStyle.ShaderModeTitle ); - m_leftButtonRect = graphArea; - m_leftButtonRect.x = 10 + leftPos; - m_leftButtonRect.y += m_leftButtonRect.height - 38 - 15; - string shaderName = ( currentShader != null ) ? ( currentShader.name ) : NoShaderStr; - - if ( m_previousShaderName != shaderName ) - { - m_previousShaderName = shaderName; - m_leftAuxContent.text = "<size=20>SHADER</size>\n" + shaderName; - } - - m_auxVector2 = m_leftButtonStyle.CalcSize( m_leftAuxContent ); - m_leftButtonRect.width = m_auxVector2.x + 30 + 4; - m_leftButtonRect.height = 38; - - bool mouseOnTop = m_leftButtonRect.Contains( mousePos ); - GUI.color = mouseOnTop ? OverallColorOn : OverallColorOff; - GUI.Label( m_leftButtonRect, m_leftAuxContent, m_leftButtonStyle ); - - if( currentEventType == EventType.MouseMove && mouseOnTop ) - m_parentWindow.MarkToRepaint(); - - if ( currentEventType == EventType.MouseDown && mouseOnTop && currentShader != null ) - { - Event.current.Use(); - Selection.activeObject = currentShader; - EditorGUIUtility.PingObject( Selection.activeObject ); - } - - // Material Mode - if ( currentMaterial != null ) - { - m_rightButtonStyle = UIUtils.GetCustomStyle( CustomStyle.MaterialModeTitle ); - m_rightButtonRect = graphArea; - string matName = ( currentMaterial != null ) ? ( currentMaterial.name ) : NoMaterialStr; - - if ( m_previousMaterialName != matName ) - { - m_previousMaterialName = matName; - m_rightAuxContent.text = "<size=20>MATERIAL</size>\n" + matName; - } - - m_auxVector2 = m_rightButtonStyle.CalcSize( m_rightAuxContent ); - m_rightButtonRect.width = m_auxVector2.x + 30 + 4; - m_rightButtonRect.height = 38; - - m_rightButtonRect.x = graphArea.xMax - m_rightButtonRect.width - rightPos - 10; - m_rightButtonRect.y = graphArea.yMax - 38 - 15; - - bool mouseOnTopRight = m_rightButtonRect.Contains( mousePos ); - GUI.color = mouseOnTopRight ? OverallColorOn : OverallColorOff; - GUI.Label( m_rightButtonRect, m_rightAuxContent, m_rightButtonStyle ); - - if( currentEventType == EventType.MouseMove && mouseOnTopRight ) - m_parentWindow.MarkToRepaint(); - - if ( currentEventType == EventType.MouseDown && mouseOnTopRight ) - { - Event.current.Use(); - Selection.activeObject = currentMaterial; - EditorGUIUtility.PingObject( Selection.activeObject ); - } - } - } - - // Shader Function - else if ( currentMasterNode == null && ParentWindow.CurrentGraph.CurrentOutputNode != null ) - { - m_leftButtonStyle = UIUtils.GetCustomStyle( CustomStyle.ShaderFunctionMode ); - m_leftButtonRect = graphArea; - m_leftButtonRect.x = 10 + leftPos; - m_leftButtonRect.y += m_leftButtonRect.height - 38 - 15; - string functionName = ( ParentWindow.CurrentGraph.CurrentShaderFunction != null ) ? ( ParentWindow.CurrentGraph.CurrentShaderFunction.name ) : "No Shader Function"; - - if ( m_previousShaderFunctionName != functionName ) - { - m_previousShaderFunctionName = functionName; - m_leftAuxContent.text = "<size=20>SHADER FUNCTION</size>\n" + functionName; - } - - m_auxVector2 = m_leftButtonStyle.CalcSize( m_leftAuxContent ); - m_leftButtonRect.width = m_auxVector2.x + 30 + 4; - m_leftButtonRect.height = 38; - - bool mouseOnTop = m_leftButtonRect.Contains( mousePos ); - GUI.color = mouseOnTop ? OverallColorOn : OverallColorOff; - GUI.Label( m_leftButtonRect, m_leftAuxContent, m_leftButtonStyle ); - - if ( currentEventType == EventType.MouseDown && mouseOnTop && ParentWindow.CurrentGraph.CurrentShaderFunction != null ) - { - Event.current.Use(); - Selection.activeObject = ParentWindow.CurrentGraph.CurrentShaderFunction; - EditorGUIUtility.PingObject( Selection.activeObject ); - } - } - - GUI.color = buffereredColor; - } - - public override void Destroy() - { - base.Destroy(); - m_leftAuxContent = null; - m_rightAuxContent = null; - m_leftButtonStyle = null; - m_rightButtonStyle = null; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/ShaderEditorModeWindow.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/ShaderEditorModeWindow.cs.meta deleted file mode 100644 index 5f0a8f61..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/ShaderEditorModeWindow.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 672d96e3a4f68d44f9456d2fc53d4d73 -timeCreated: 1481126956 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/ShaderLibrary.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/ShaderLibrary.cs deleted file mode 100644 index e405e2e2..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/ShaderLibrary.cs +++ /dev/null @@ -1,91 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEditor; -using System.Collections.Generic; -using System; -using UnityEngine; - -namespace AmplifyShaderEditor -{ - [Serializable] - public class ShaderLibrary : EditorWindow - { - private const string SHADER_LIB_FILE = "/AmplifyShaderEditor/Resources/ShaderLibrary/ShaderLibrary.txt"; - private bool m_init = false; - private Vector2 m_scrollPos = new Vector2(); - [SerializeField] - private List<string> m_shaders = new List<string>(); - void Init() - { - m_init = true; - string list = IOUtils.LoadTextFileFromDisk( Application.dataPath + SHADER_LIB_FILE ); - if ( String.IsNullOrEmpty( list ) ) - return; - - string[] listArr = list.Split( IOUtils.FIELD_SEPARATOR ); - for ( int i = 0; i < listArr.Length; i++ ) - { - m_shaders.Add( listArr[ i ] ); - } - - UIUtils.MainSkin.customStyles[ 10 ].active.background = Texture2D.whiteTexture; - - UIUtils.MainSkin.customStyles[ 6 ].fixedHeight = UIUtils.MainSkin.customStyles[ 6 ].normal.background.height; - UIUtils.MainSkin.customStyles[ 6 ].fixedWidth = UIUtils.MainSkin.customStyles[ 6 ].normal.background.width; - - UIUtils.MainSkin.customStyles[ 7 ].fixedHeight = UIUtils.MainSkin.customStyles[ 7 ].normal.background.height; - UIUtils.MainSkin.customStyles[ 7 ].fixedWidth = UIUtils.MainSkin.customStyles[ 7 ].normal.background.width; - - UIUtils.MainSkin.customStyles[ 8 ].fixedHeight = UIUtils.MainSkin.customStyles[ 8 ].normal.background.height; - UIUtils.MainSkin.customStyles[ 8 ].fixedWidth = UIUtils.MainSkin.customStyles[ 8 ].normal.background.width; - - UIUtils.MainSkin.customStyles[ 9 ].fixedHeight = UIUtils.MainSkin.customStyles[ 9 ].normal.background.height; - UIUtils.MainSkin.customStyles[ 9 ].fixedWidth = UIUtils.MainSkin.customStyles[ 9 ].normal.background.width; - - } - - void OnGUI() - { - if ( !m_init ) - { - Init(); - } - - Rect availableArea = position; - - availableArea.y = 100f; - availableArea.x = 0.05f * availableArea.width; - availableArea.height *= 0.5f; - availableArea.width *= 0.9f; - EditorGUILayout.BeginVertical(); - { - EditorGUILayout.LabelField( "Shader Library", UIUtils.MainSkin.customStyles[ 5 ] ); - GUILayout.Space( 10 ); - EditorGUILayout.BeginHorizontal(); - { - GUILayout.Space( 0.05f * position.width ); - GUILayout.Button( string.Empty, UIUtils.MainSkin.customStyles[ 8 ] ); - GUILayout.Button( string.Empty, UIUtils.MainSkin.customStyles[ 9 ] ); - GUILayout.Space( 0.8f*position.width ); - GUILayout.Button( string.Empty, UIUtils.MainSkin.customStyles[ 7 ] ); - GUILayout.Button( string.Empty, UIUtils.MainSkin.customStyles[ 6 ] ); - } - EditorGUILayout.EndHorizontal(); - - GUILayout.BeginArea( availableArea ); - m_scrollPos = EditorGUILayout.BeginScrollView( m_scrollPos, UIUtils.MainSkin.box ); - { - for ( int i = 0; i < m_shaders.Count; i++ ) - { - GUILayout.Button( m_shaders[ i ], UIUtils.MainSkin.customStyles[ 10 ] ); - } - } - EditorGUILayout.EndScrollView(); - GUILayout.EndArea(); - } - EditorGUILayout.EndVertical(); - - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/ShaderLibrary.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/ShaderLibrary.cs.meta deleted file mode 100644 index 9a6c519a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/ShaderLibrary.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: cbdd03f297692584391b9dc0625a80ed -timeCreated: 1481126959 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Tools.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Tools.meta deleted file mode 100644 index 4f191887..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Tools.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 3857a2f02c659104fa6f0fe94cfe00dd -folderAsset: yes -timeCreated: 1481126945 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsMenuButton.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsMenuButton.cs deleted file mode 100644 index a1994638..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsMenuButton.cs +++ /dev/null @@ -1,249 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEngine; -using UnityEditor; -using System.Collections.Generic; - -namespace AmplifyShaderEditor -{ - public sealed class ToolsMenuButton : ToolsMenuButtonParent - { - public delegate void ToolButtonPressed( ToolButtonType type ); - public event ToolButtonPressed ToolButtonPressedEvt; - - private Rect m_buttonArea; - private List<Texture2D> m_buttonTexture; - private string m_buttonTexturePath; - private ToolButtonType m_buttonType; - private GUIStyle m_style; - private bool m_enabled = true; - private bool m_drawOnFunction = true; - - private List<string> m_cachedStates; - private int m_bufferedState = -1; - private string m_bufferedTooltip = string.Empty; - - public ToolsMenuButton( AmplifyShaderEditorWindow parentWindow, ToolButtonType type, float x, float y, float width, float height, string texturePath, string text, string tooltip, float buttonSpacing = -1, bool drawOnFunction = true ) : base( parentWindow, text, tooltip, buttonSpacing ) - { - m_buttonArea = new Rect( x, y, width, height ); - m_buttonType = type; - - m_buttonTexturePath = texturePath; - m_cachedStates = new List<string>(); - m_drawOnFunction = drawOnFunction; - } - - public void AddState( string state ) - { - m_cachedStates.Add( state ); - } - - public override void Destroy() - { - ToolButtonPressedEvt = null; - if ( m_buttonTexture != null ) - { - for ( int i = 0; i < m_buttonTexture.Count; i++ ) - { - Resources.UnloadAsset( m_buttonTexture[ i ] ); - } - m_buttonTexture.Clear(); - } - m_buttonTexture = null; - } - protected override void Init() - { - base.Init(); - if ( m_buttonTexture == null ) - { - m_buttonTexturePath = AssetDatabase.GUIDToAssetPath( m_buttonTexturePath ); - m_buttonTexture = new List<Texture2D>(); - m_buttonTexture.Add( AssetDatabase.LoadAssetAtPath( m_buttonTexturePath, typeof( Texture2D ) ) as Texture2D ); - } - - if ( m_cachedStates.Count > 0 ) - { - for ( int i = 0; i < m_cachedStates.Count; i++ ) - { - m_cachedStates[ i ] = AssetDatabase.GUIDToAssetPath( m_cachedStates[ i ] ); - m_buttonTexture.Add( AssetDatabase.LoadAssetAtPath( m_cachedStates[ i ], typeof( Texture2D ) ) as Texture2D ); - } - m_cachedStates.Clear(); - } - - if ( m_style == null ) - { - m_style = new GUIStyle( /*UIUtils.Button*/ GUIStyle.none ); - m_style.normal.background = m_buttonTexture[ 0 ]; - - m_style.hover.background = m_buttonTexture[ 0 ]; - m_style.hover.textColor = m_style.normal.textColor; - - m_style.active.background = m_buttonTexture[ 0 ]; - m_style.active.textColor = m_style.normal.textColor; - - m_style.onNormal.background = m_buttonTexture[ 0 ]; - m_style.onNormal.textColor = m_style.normal.textColor; - - m_style.onHover.background = m_buttonTexture[ 0 ]; - m_style.onHover.textColor = m_style.normal.textColor; - - m_style.onActive.background = m_buttonTexture[ 0 ]; - m_style.onActive.textColor = m_style.normal.textColor; - - m_style.clipping = TextClipping.Overflow; - m_style.fontStyle = FontStyle.Bold; - m_style.alignment = TextAnchor.LowerCenter; - m_style.contentOffset = new Vector2( 0, 15 ); - m_style.fontSize = 10; - bool resizeFromTexture = false; - if ( m_buttonArea.width > 0 ) - { - m_style.fixedWidth = m_buttonArea.width; - } - else - { - resizeFromTexture = true; - } - - if ( m_buttonArea.height > 0 ) - { - m_style.fixedHeight = m_buttonArea.height; - } - else - { - resizeFromTexture = true; - } - - if ( resizeFromTexture ) - { - m_buttonArea.width = m_style.fixedWidth = m_buttonTexture[ 0 ].width; - m_buttonArea.height = m_style.fixedHeight = m_buttonTexture[ 0 ].height; - } - } - - } - public override void Draw() - { - base.Draw(); - bool guiEnabledBuffer = GUI.enabled; - GUI.enabled = m_enabled; - - if ( GUILayout.Button( m_content, m_style ) && ToolButtonPressedEvt != null ) - { - ToolButtonPressedEvt( m_buttonType ); - } - GUI.enabled = guiEnabledBuffer; - } - - public override void Draw( float x, float y ) - { - if ( !(m_parentWindow.CameraDrawInfo.CurrentEventType == EventType.MouseDown || m_parentWindow.CameraDrawInfo.CurrentEventType == EventType.Repaint ) ) - return; - - if ( m_parentWindow.CurrentGraph.CurrentMasterNode == null && !m_drawOnFunction) - return; - - - base.Draw( x, y ); - - if ( m_bufferedState > -1 ) - { - if ( string.IsNullOrEmpty( m_bufferedTooltip ) ) - { - SetStateOnButton( m_bufferedState ); - } - else - { - SetStateOnButton( m_bufferedState, m_bufferedTooltip ); - } - - m_bufferedState = -1; - m_bufferedTooltip = string.Empty; - } - - - m_buttonArea.x = x; - m_buttonArea.y = y; - - if ( m_parentWindow.CameraDrawInfo.CurrentEventType == EventType.MouseDown && m_buttonArea.Contains( m_parentWindow.CameraDrawInfo.MousePosition ) && ToolButtonPressedEvt != null ) - { - ToolButtonPressedEvt( m_buttonType ); - Event.current.Use(); - m_parentWindow.CameraDrawInfo.CurrentEventType = EventType.Used; - } - else if ( m_parentWindow.CameraDrawInfo.CurrentEventType == EventType.Repaint ) - { - GUI.Label( m_buttonArea, m_content, m_style ); - } - - //if ( GUI.Button( m_buttonArea, m_content, m_style ) && ToolButtonPressedEvt != null ) - //{ - // ToolButtonPressedEvt( m_buttonType ); - //} - } - - public override void Draw( Vector2 pos ) - { - Draw( pos.x, pos.y ); - } - - public override void SetStateOnButton( int state, string tooltip ) - { - - if ( m_buttonTexture == null || m_style == null ) - { - m_bufferedState = state; - m_bufferedTooltip = tooltip; - return; - } - - - if ( state < 0 || state >= m_buttonTexture.Count ) - { - return; - } - - base.SetStateOnButton( state, tooltip ); - m_style.normal.background = m_buttonTexture[ state ]; - m_style.hover.background = m_buttonTexture[ state ]; - m_style.active.background = m_buttonTexture[ state ]; - m_style.onNormal.background = m_buttonTexture[ state ]; - m_style.onHover.background = m_buttonTexture[ state ]; - m_style.onActive.background = m_buttonTexture[ state ]; - } - - public override void SetStateOnButton( int state ) - { - if ( m_buttonTexture == null || m_style == null ) - { - m_bufferedState = state; - return; - } - - if ( state < 0 || state >= m_buttonTexture.Count ) - { - return; - } - base.SetStateOnButton( state ); - m_style.normal.background = m_buttonTexture[ state ]; - m_style.hover.background = m_buttonTexture[ state ]; - m_style.active.background = m_buttonTexture[ state ]; - m_style.onNormal.background = m_buttonTexture[ state ]; - m_style.onHover.background = m_buttonTexture[ state ]; - m_style.onActive.background = m_buttonTexture[ state ]; - } - - public bool IsInside( Vector2 pos ) - { - return m_buttonArea.Contains( pos ); - } - - public bool Enabled - { - get { return m_enabled; } - set { m_enabled = value; } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsMenuButton.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsMenuButton.cs.meta deleted file mode 100644 index 11180c87..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsMenuButton.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 890f4ed5c9f62af43bda6584705fa0be -timeCreated: 1481126957 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsMenuButtonParent.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsMenuButtonParent.cs deleted file mode 100644 index b3136b4c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsMenuButtonParent.cs +++ /dev/null @@ -1,75 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEngine; - -namespace AmplifyShaderEditor -{ - public class ToolsMenuButtonParent - { - protected AmplifyShaderEditorWindow m_parentWindow = null; - private float m_buttonSpacing = 10; - private int m_currentState = 0; - private bool m_isInitialized = false; - protected GUIContent m_content; - public ToolsMenuButtonParent( AmplifyShaderEditorWindow parentWindow, string text, string tooltip, float buttonSpacing ) - { - m_parentWindow = parentWindow; - m_content = new GUIContent( text, tooltip ); - - if ( buttonSpacing > 0 ) - m_buttonSpacing = buttonSpacing; - } - - public virtual void Draw() - { - if ( !m_isInitialized ) - { - Init(); - } - - //GUILayout.Space( m_buttonSpacing ); - } - - public virtual void Draw( Vector2 pos ) - { - Draw( pos.x, pos.y ); - } - - public virtual void Draw( float x ,float y ) - { - if ( !m_isInitialized ) - { - Init(); - } - } - - protected virtual void Init() - { - m_isInitialized = false; - } - - public virtual void SetStateOnButton( int state, string tooltip ) - { - m_currentState = state; - m_content.tooltip = tooltip; - } - - public virtual void SetStateOnButton( int state ) - { - m_currentState = state; - } - - public virtual void Destroy() { } - - public float ButtonSpacing - { - get { return m_buttonSpacing; } - } - - public int CurrentState - { - get { return m_currentState; } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsMenuButtonParent.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsMenuButtonParent.cs.meta deleted file mode 100644 index b14de18d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsMenuButtonParent.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: a3bf3644c2c2fbb4fa0dd8b86effc6e1 -timeCreated: 1481126958 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsMenuButtonSep.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsMenuButtonSep.cs deleted file mode 100644 index 69d11eb1..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsMenuButtonSep.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEngine; -using UnityEditor; - -namespace AmplifyShaderEditor -{ - public sealed class ToolsMenuButtonSep : ToolsMenuButtonParent - { - private Color m_splitterColor = EditorGUIUtility.isProSkin ? new Color( 0.157f, 0.157f, 0.157f ) : new Color( 0.5f, 0.5f, 0.5f ); - [SerializeField] - private GUIStyle m_sepStyle; - public ToolsMenuButtonSep( AmplifyShaderEditorWindow parentWindow = null, string text = null, string tooltip = null, float buttonSpacing = -1 ) : base( parentWindow, text, tooltip, buttonSpacing ) { } - - public override void Draw() - { - base.Draw(); - if ( m_sepStyle == null ) - { - m_sepStyle = new GUIStyle(); - m_sepStyle.normal.background = Texture2D.whiteTexture; - m_sepStyle.hover.background = Texture2D.whiteTexture; - m_sepStyle.active.background = Texture2D.whiteTexture; - m_sepStyle.onNormal.background = Texture2D.whiteTexture; - m_sepStyle.onHover.background = Texture2D.whiteTexture; - m_sepStyle.onActive.background = Texture2D.whiteTexture; - m_sepStyle.stretchHeight = true; - } - Color originalColor = GUI.color; - GUI.color = m_splitterColor; - GUILayout.Box( string.Empty, m_sepStyle, GUILayout.MaxWidth( 2 ), GUILayout.ExpandHeight( true ) ); - GUI.color = originalColor; - } - - public override void Destroy() - { - m_sepStyle = null; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsMenuButtonSep.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsMenuButtonSep.cs.meta deleted file mode 100644 index 55672938..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsMenuButtonSep.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: b4c65a9d96791c34eb587cea9662161f -timeCreated: 1481126958 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsWindow.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsWindow.cs deleted file mode 100644 index ccb0f4b0..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsWindow.cs +++ /dev/null @@ -1,632 +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.Collections.Generic; - -namespace AmplifyShaderEditor -{ - public enum ToolButtonType - { - Update = 0, - Live, - OpenSourceCode, - CleanUnusedNodes, - //SelectShader, - New, - Open, - Save, - Library, - Options, - Help, - MasterNode, - FocusOnMasterNode, - FocusOnSelection, - ShowInfoWindow, - ShowTipsWindow, - ShowConsole, - TakeScreenshot, - Share - } - - public enum ToolbarType - { - File, - Help - } - - public class ToolbarMenuTab - { - private Rect m_tabArea; - private GenericMenu m_tabMenu; - public ToolbarMenuTab( float x, float y, float width, float height ) - { - m_tabMenu = new GenericMenu(); - m_tabArea = new Rect( x, y, width, height ); - } - - public void ShowMenu() - { - m_tabMenu.DropDown( m_tabArea ); - } - - public void AddItem( string itemName, GenericMenu.MenuFunction callback ) - { - m_tabMenu.AddItem( new GUIContent( itemName ), false, callback ); - } - } - - [Serializable] - public sealed class ToolsWindow : MenuParent - { - private static readonly Color RightIconsColorOff = new Color( 1f, 1f, 1f, 0.8f ); - private static readonly Color LeftIconsColorOff = new Color( 1f, 1f, 1f, 0.5f ); - - private static readonly Color RightIconsColorOn = new Color( 1f, 1f, 1f, 1.0f ); - private static readonly Color LeftIconsColorOn = new Color( 1f, 1f, 1f, 0.8f ); - - private const float TabY = 9; - private const float TabX = 5; - private const string ShaderFileTitleStr = "Current Shader"; - private const string FileToolbarStr = "File"; - private const string HelpToolbarStr = "Help"; - private const string LiveShaderStr = "Live Shader"; - private const string LoadOnSelectionStr = "Load on selection"; - private const string CurrentObjectStr = "Current Object: "; - - - public ToolsMenuButton.ToolButtonPressed ToolButtonPressedEvt; - //private GUIStyle m_toolbarButtonStyle; - private GUIStyle m_toggleStyle; - private GUIStyle m_borderStyle; - - // left - private ToolsMenuButton m_updateButton; - private ToolsMenuButton m_liveButton; - private ToolsMenuButton m_openSourceCodeButton; - - //middle right - private ToolsMenuButton m_cleanUnusedNodesButton; - private ToolsMenuButton m_focusOnMasterNodeButton; - private ToolsMenuButton m_focusOnSelectionButton; - - // right - private ToolsMenuButton m_shareButton; - private ToolsMenuButton m_takeScreenshotButton; - private ToolsMenuButton m_showInfoWindowButton; - - // hidden - private ToolsMenuButton m_showTipsWindowButton; - private ToolsMenuButton m_showConsoleWindowButton; - - //Used for collision detection to invalidate inputs on graph area - private Rect m_areaLeft = new Rect( 0, 0, 140, 40 ); - private Rect m_areaRight = new Rect( 0, 0, 75, 40 ); - private Rect m_boxRect; - private Rect m_borderRect; - - public const double InactivityRefreshTime = 0.25; - private int m_currentSelected = 0; - - //Search Bar - private const string SearchBarId = "ASE_SEARCH_BAR"; - private bool m_searchBarVisible = false; - private bool m_selectSearchBarTextfield = false; - private bool m_refreshSearchResultList = false; - - private Rect m_searchBarSize; - private string m_searchBarValue = string.Empty; - private List<ParentNode> m_searchResultNodes = new List<ParentNode>(); - - // width and height are between [0,1] and represent a percentage of the total screen area - public ToolsWindow( AmplifyShaderEditorWindow parentWindow ) : base( parentWindow, 0, 0, 0, 64, "Tools", MenuAnchor.TOP_LEFT, MenuAutoSize.NONE ) - { - m_updateButton = new ToolsMenuButton( m_parentWindow, ToolButtonType.Update, 0, 0, -1, -1, IOUtils.UpdateOutdatedGUID, string.Empty, "Create and apply shader to material.", 5 ); - m_updateButton.ToolButtonPressedEvt += OnButtonPressedEvent; - m_updateButton.AddState( IOUtils.UpdateOFFGUID ); - m_updateButton.AddState( IOUtils.UpdateUpToDatedGUID ); - - m_liveButton = new ToolsMenuButton( m_parentWindow, ToolButtonType.Live, 0, 0, -1, -1, IOUtils.LiveOffGUID, string.Empty, "Automatically saves shader when canvas is changed.", 50 ); - m_liveButton.ToolButtonPressedEvt += OnButtonPressedEvent; - m_liveButton.AddState( IOUtils.LiveOnGUID ); - m_liveButton.AddState( IOUtils.LivePendingGUID ); - - //ToolsMenuButton cleanUnusedNodesButton = new ToolsMenuButton( m_parentWindow, ToolButtonType.CleanUnusedNodes, 0, 0, -1, -1, IOUtils.CleanupOFFGUID, string.Empty, "Remove all nodes not connected to the master node.", 77 ); - //cleanUnusedNodesButton.ToolButtonPressedEvt += OnButtonPressedEvent; - //cleanUnusedNodesButton.AddState( IOUtils.CleanUpOnGUID ); - //m_list[ ( int ) ToolButtonType.CleanUnusedNodes ] = cleanUnusedNodesButton; - - m_openSourceCodeButton = new ToolsMenuButton( m_parentWindow, ToolButtonType.OpenSourceCode, 0, 0, -1, -1, IOUtils.OpenSourceCodeOFFGUID, string.Empty, "Open shader file in your default shader editor.", 80, false ); - m_openSourceCodeButton.ToolButtonPressedEvt += OnButtonPressedEvent; - m_openSourceCodeButton.AddState( IOUtils.OpenSourceCodeONGUID ); - - - // middle right - m_cleanUnusedNodesButton = new ToolsMenuButton( m_parentWindow, ToolButtonType.CleanUnusedNodes, 0, 0, -1, -1, IOUtils.CleanupOFFGUID, string.Empty, "Remove all nodes not connected to the master node.", 77 ); - m_cleanUnusedNodesButton.ToolButtonPressedEvt += OnButtonPressedEvent; - m_cleanUnusedNodesButton.AddState( IOUtils.CleanUpOnGUID ); - - m_focusOnMasterNodeButton = new ToolsMenuButton( m_parentWindow, ToolButtonType.FocusOnMasterNode, 0, 0, -1, -1, IOUtils.FocusNodeGUID, string.Empty, "Focus on active master node.", -1, false ); - m_focusOnMasterNodeButton.ToolButtonPressedEvt += OnButtonPressedEvent; - - m_focusOnSelectionButton = new ToolsMenuButton( m_parentWindow, ToolButtonType.FocusOnSelection, 0, 0, -1, -1, IOUtils.FitViewGUID, string.Empty, "Focus on selection or fit to screen if none selected." ); - m_focusOnSelectionButton.ToolButtonPressedEvt += OnButtonPressedEvent; - - - // right - m_shareButton = new ToolsMenuButton( m_parentWindow, ToolButtonType.Share, 0, 0, -1, -1, IOUtils.ShareOFFGUID, string.Empty, "Share selection", 100 ); - m_shareButton.ToolButtonPressedEvt += OnButtonPressedEvent; - m_shareButton.AddState( IOUtils.ShareONGUID ); - - m_takeScreenshotButton = new ToolsMenuButton( m_parentWindow, ToolButtonType.TakeScreenshot, 0, 0, -1, -1, IOUtils.TakeScreenshotOFFGUID, string.Empty, "Take ScreenShot (WINDOWS ONLY).", 100 ); - m_takeScreenshotButton.ToolButtonPressedEvt += OnButtonPressedEvent; - m_takeScreenshotButton.AddState( IOUtils.TakeScreenshotONGUID ); - - m_showInfoWindowButton = new ToolsMenuButton( m_parentWindow, ToolButtonType.ShowInfoWindow, 0, 0, -1, -1, IOUtils.ShowInfoWindowGUID, string.Empty, "Open Helper Window." ); - m_showInfoWindowButton.ToolButtonPressedEvt += OnButtonPressedEvent; - - - // hidden - m_showTipsWindowButton = new ToolsMenuButton( m_parentWindow, ToolButtonType.ShowTipsWindow, 0, 0, -1, -1, IOUtils.ShowTipsWindowGUID, string.Empty, "Open Quick Tips!" ); - m_showTipsWindowButton.ToolButtonPressedEvt += OnButtonPressedEvent; - - m_showConsoleWindowButton = new ToolsMenuButton( m_parentWindow, ToolButtonType.ShowConsole, 0, 0, -1, -1, IOUtils.ShowConsoleWindowGUID, string.Empty, "Show internal console", 74 ); - m_showConsoleWindowButton.ToolButtonPressedEvt += OnButtonPressedEvent; - m_showConsoleWindowButton.AddState( IOUtils.ShowConsoleWindowGUID ); - - m_searchBarSize = new Rect( 0, TabY + 4, 110, 60 ); - } - - void OnShowPortLegend() - { - ParentWindow.ShowPortInfo(); - } - - override public void Destroy() - { - base.Destroy(); - //for ( int i = 0; i < m_list.Length; i++ ) - //{ - // m_list[ i ].Destroy(); - //} - //m_list = null; - - m_searchResultNodes.Clear(); - m_searchResultNodes = null; - - m_updateButton.Destroy(); - m_updateButton = null; - - m_liveButton.Destroy(); - m_liveButton = null; - - m_openSourceCodeButton.Destroy(); - m_openSourceCodeButton = null; - - m_focusOnMasterNodeButton.Destroy(); - m_focusOnMasterNodeButton = null; - - m_focusOnSelectionButton.Destroy(); - m_focusOnSelectionButton = null; - - m_showInfoWindowButton.Destroy(); - m_showInfoWindowButton = null; - - m_takeScreenshotButton.Destroy(); - m_takeScreenshotButton = null; - - m_shareButton.Destroy(); - m_shareButton = null; - - m_showTipsWindowButton.Destroy(); - m_showTipsWindowButton = null; - - m_cleanUnusedNodesButton.Destroy(); - m_cleanUnusedNodesButton = null; - - m_showConsoleWindowButton.Destroy(); - m_showConsoleWindowButton = null; - } - - void OnButtonPressedEvent( ToolButtonType type ) - { - if ( ToolButtonPressedEvt != null ) - ToolButtonPressedEvt( type ); - } - - public override void Draw( Rect parentPosition, Vector2 mousePosition, int mouseButtonId, bool hasKeyboadFocus ) - { - base.Draw( parentPosition, mousePosition, mouseButtonId, hasKeyboadFocus ); - - Color bufferedColor = GUI.color; - m_areaLeft.x = m_transformedArea.x + TabX; - m_areaRight.x = m_transformedArea.x + m_transformedArea.width - 75 - TabX; - - //if ( m_toolbarButtonStyle == null ) - //{ - // m_toolbarButtonStyle = new GUIStyle( UIUtils.Button ); - // m_toolbarButtonStyle.fixedWidth = 100; - //} - - if ( m_toggleStyle == null ) - { - m_toggleStyle = UIUtils.Toggle; - } - - //for ( int i = 0; i < m_list.Length; i++ ) - //{ - // GUI.color = m_list[ i ].IsInside( mousePosition ) ? LeftIconsColorOn : LeftIconsColorOff; - // m_list[ i ].Draw( TabX + m_transformedArea.x + m_list[ i ].ButtonSpacing, TabY ); - //} - GUI.color = m_updateButton.IsInside( mousePosition ) ? LeftIconsColorOn : LeftIconsColorOff; - m_updateButton.Draw( TabX + m_transformedArea.x + m_updateButton.ButtonSpacing, TabY ); - - GUI.color = m_liveButton.IsInside( mousePosition ) ? LeftIconsColorOn : LeftIconsColorOff; - m_liveButton.Draw( TabX + m_transformedArea.x + m_liveButton.ButtonSpacing, TabY ); - - GUI.color = m_openSourceCodeButton.IsInside( mousePosition ) ? LeftIconsColorOn : LeftIconsColorOff; - m_openSourceCodeButton.Draw( TabX + m_transformedArea.x + m_openSourceCodeButton.ButtonSpacing, TabY ); - - if ( m_searchBarVisible ) - { - m_searchBarSize.x = m_transformedArea.x + m_transformedArea.width - 320 - TabX; - string currentFocus = GUI.GetNameOfFocusedControl(); - - if ( Event.current.type == EventType.KeyDown ) - { - KeyCode keyCode = Event.current.keyCode; - if ( Event.current.shift ) - { - if ( keyCode == KeyCode.F3 || - ( ( keyCode == KeyCode.KeypadEnter || keyCode == KeyCode.Return ) && - ( currentFocus.Equals( SearchBarId ) || string.IsNullOrEmpty( currentFocus ) ) ) ) - SelectPrevious(); - } - else - { - if ( keyCode == KeyCode.F3 || - ( ( keyCode == KeyCode.KeypadEnter || keyCode == KeyCode.Return ) && - ( currentFocus.Equals( SearchBarId ) || string.IsNullOrEmpty( currentFocus ) ) ) ) - SelectNext(); - } - } - - if( currentFocus.Equals( SearchBarId ) || ( m_parentWindow.CameraDrawInfo.CurrentEventType == EventType.MouseDown && m_searchBarSize.Contains( m_parentWindow.CameraDrawInfo.MousePosition ) ) || m_selectSearchBarTextfield ) - { - EditorGUI.BeginChangeCheck(); - { - GUI.SetNextControlName( SearchBarId ); - m_searchBarValue = EditorGUI.TextField( m_searchBarSize, m_searchBarValue, UIUtils.ToolbarSearchTextfield ); - } - if ( EditorGUI.EndChangeCheck() ) - { - m_refreshSearchResultList = true; - } - } else - { - GUI.Label( m_searchBarSize, m_searchBarValue, UIUtils.ToolbarSearchTextfield ); - } - - m_searchBarSize.x += m_searchBarSize.width; - if ( m_parentWindow.CameraDrawInfo.CurrentEventType == EventType.MouseDown && m_searchBarSize.Contains( m_parentWindow.CameraDrawInfo.MousePosition ) ) - { - if ( string.IsNullOrEmpty( m_searchBarValue ) ) - { - m_searchBarVisible = false; - m_refreshSearchResultList = false; - } - else - { - m_searchBarValue = string.Empty; - m_searchResultNodes.Clear(); - m_currentSelected = -1; - } - } - - GUI.Label( m_searchBarSize, string.Empty, UIUtils.ToolbarSearchCancelButton ); - - - - if ( Event.current.isKey && Event.current.keyCode == KeyCode.Escape ) - { - m_searchBarVisible = false; - m_refreshSearchResultList = false; - GUI.FocusControl( null ); - m_selectSearchBarTextfield = false; - } - - if ( m_refreshSearchResultList && ( m_parentWindow.CurrentInactiveTime > InactivityRefreshTime ) ) - { - RefreshList(); - } - } - - if ( m_selectSearchBarTextfield ) - { - m_selectSearchBarTextfield = false; - EditorGUI.FocusTextInControl( SearchBarId ); - //GUI.FocusControl( SearchBarId ); - } - - //if ( Event.current.control && Event.current.isKey && Event.current.keyCode == KeyCode.F && Event.current.type == EventType.KeyDown ) - if( m_parentWindow.CurrentCommandName.Equals("Find") ) - { - if ( !m_searchBarVisible ) - { - m_searchBarVisible = true; - m_refreshSearchResultList = false; - } - m_selectSearchBarTextfield = true; - } - - GUI.color = m_shareButton.IsInside( mousePosition ) ? RightIconsColorOn : RightIconsColorOff; - m_shareButton.Draw( m_transformedArea.x + m_transformedArea.width - 195 - TabX, TabY ); - - GUI.color = m_takeScreenshotButton.IsInside( mousePosition ) ? RightIconsColorOn : RightIconsColorOff; - m_takeScreenshotButton.Draw( m_transformedArea.x + m_transformedArea.width - 165 - TabX, TabY ); - - - - GUI.color = m_focusOnSelectionButton.IsInside( mousePosition ) ? RightIconsColorOn : RightIconsColorOff; - m_focusOnSelectionButton.Draw( m_transformedArea.x + m_transformedArea.width - 120 - TabX, TabY ); - - GUI.color = m_focusOnMasterNodeButton.IsInside( mousePosition ) ? RightIconsColorOn : RightIconsColorOff; - m_focusOnMasterNodeButton.Draw( m_transformedArea.x + m_transformedArea.width - 85 - TabX, TabY ); - - GUI.color = m_cleanUnusedNodesButton.IsInside( mousePosition ) ? RightIconsColorOn : RightIconsColorOff; - m_cleanUnusedNodesButton.Draw( m_transformedArea.x + m_transformedArea.width - 50 - TabX, TabY ); - - GUI.color = m_showInfoWindowButton.IsInside( mousePosition ) ? RightIconsColorOn : RightIconsColorOff; - m_showInfoWindowButton.Draw( m_transformedArea.x + m_transformedArea.width - 25 - TabX, TabY ); - - - //GUI.color = m_showTipsWindowButton.IsInside( mousePosition ) ? RightIconsColorOn : RightIconsColorOff; - //m_showTipsWindowButton.Draw( m_transformedArea.x + m_transformedArea.width - 190 - TabX, TabY ); - - //GUI.color = m_showConsoleWindowButton.IsInside( mousePosition ) ? RightIconsColorOn : RightIconsColorOff; - //m_showConsoleWindowButton.Draw( m_transformedArea.x + m_transformedArea.width - 195 - TabX, TabY ); - - GUI.color = bufferedColor; - - } - - public void OnNodeRemovedFromGraph( ParentNode node ) - { - m_searchResultNodes.Remove( node ); - } - - int m_previousNodeCount = 0; - - void RefreshList() - { - m_refreshSearchResultList = false; - m_currentSelected = -1; - m_searchResultNodes.Clear(); - if ( !string.IsNullOrEmpty( m_searchBarValue ) ) - { - List<ParentNode> nodes = m_parentWindow.CurrentGraph.AllNodes; - int count = nodes.Count; - m_previousNodeCount = count; - for ( int i = 0; i < count; i++ ) - { - if ( nodes[ i ].CheckFindText( m_searchBarValue ) ) - { - m_searchResultNodes.Add( nodes[ i ] ); - } - } - } - } - - void SelectNext() - { - if ( m_refreshSearchResultList || m_parentWindow.CurrentGraph.AllNodes.Count != m_previousNodeCount ) - { - RefreshList(); - } - - if ( m_searchResultNodes.Count > 0 ) - { - m_currentSelected = ( m_currentSelected + 1 ) % m_searchResultNodes.Count; - m_parentWindow.FocusOnNode( m_searchResultNodes[ m_currentSelected ], 1, true ,true); - } - } - - void SelectPrevious() - { - if ( m_refreshSearchResultList || m_parentWindow.CurrentGraph.AllNodes.Count != m_previousNodeCount ) - { - RefreshList(); - } - - if ( m_searchResultNodes.Count > 0 ) - { - m_currentSelected = ( m_currentSelected > 1 ) ? ( m_currentSelected - 1 ) : ( m_searchResultNodes.Count - 1 ); - m_parentWindow.FocusOnNode( m_searchResultNodes[ m_currentSelected ], 1, true ); - } - } - - - public void SetStateOnButton( ToolButtonType button, int state, string tooltip ) - { - switch ( button ) - { - case ToolButtonType.New: - case ToolButtonType.Open: - case ToolButtonType.Save: - case ToolButtonType.Library: - case ToolButtonType.Options: - case ToolButtonType.Help: - case ToolButtonType.MasterNode: break; - case ToolButtonType.OpenSourceCode: - { - m_openSourceCodeButton.SetStateOnButton( state, tooltip ); - } - break; - case ToolButtonType.Update: - { - m_updateButton.SetStateOnButton( state, tooltip ); - } - break; - case ToolButtonType.Live: - { - m_liveButton.SetStateOnButton( state, tooltip ); - } - break; - case ToolButtonType.TakeScreenshot: - { - m_takeScreenshotButton.SetStateOnButton( state, tooltip ); - } - break; - case ToolButtonType.CleanUnusedNodes: - //case eToolButtonType.SelectShader: - { - m_cleanUnusedNodesButton.SetStateOnButton( state, tooltip ); - } - break; - case ToolButtonType.FocusOnMasterNode: - { - m_focusOnMasterNodeButton.SetStateOnButton( state, tooltip ); - } - break; - case ToolButtonType.FocusOnSelection: - { - m_focusOnSelectionButton.SetStateOnButton( state, tooltip ); - } - break; - case ToolButtonType.Share: - { - m_shareButton.SetStateOnButton( state, tooltip ); - } - break; - case ToolButtonType.ShowInfoWindow: - { - m_showInfoWindowButton.SetStateOnButton( state, tooltip ); - } - break; - case ToolButtonType.ShowTipsWindow: - { - m_showTipsWindowButton.SetStateOnButton( state, tooltip ); - } - break; - case ToolButtonType.ShowConsole: - { - m_showConsoleWindowButton.SetStateOnButton( state, tooltip ); - } - break; - } - } - - public void SetStateOnButton( ToolButtonType button, int state ) - { - switch ( button ) - { - case ToolButtonType.New: - case ToolButtonType.Open: - case ToolButtonType.Save: - case ToolButtonType.Library: - case ToolButtonType.Options: - case ToolButtonType.Help: - case ToolButtonType.MasterNode: break; - case ToolButtonType.OpenSourceCode: - { - m_openSourceCodeButton.SetStateOnButton( state ); - } - break; - case ToolButtonType.Update: - { - m_updateButton.SetStateOnButton( state ); - } - break; - case ToolButtonType.Live: - { - m_liveButton.SetStateOnButton( state ); - } - break; - case ToolButtonType.TakeScreenshot: - { - m_takeScreenshotButton.SetStateOnButton( state ); - } - break; - case ToolButtonType.CleanUnusedNodes: - //case eToolButtonType.SelectShader: - { - m_cleanUnusedNodesButton.SetStateOnButton( state ); - } - break; - case ToolButtonType.FocusOnMasterNode: - { - m_focusOnMasterNodeButton.SetStateOnButton( state ); - } - break; - case ToolButtonType.FocusOnSelection: - { - m_focusOnSelectionButton.SetStateOnButton( state ); - } - break; - case ToolButtonType.Share: - { - m_shareButton.SetStateOnButton( state ); - } - break; - case ToolButtonType.ShowInfoWindow: - { - m_showInfoWindowButton.SetStateOnButton( state ); - } - break; - case ToolButtonType.ShowTipsWindow: - { - m_showTipsWindowButton.SetStateOnButton( state ); - }break; - case ToolButtonType.ShowConsole: - { - m_showConsoleWindowButton.SetStateOnButton( state ); - } - break; - } - } - - public void DrawShaderTitle( MenuParent nodeParametersWindow, MenuParent paletteWindow, float availableCanvasWidth, float graphAreaHeight, string shaderName ) - { - float leftAdjust = nodeParametersWindow.IsMaximized ? nodeParametersWindow.RealWidth : 0; - float rightAdjust = paletteWindow.IsMaximized ? 0 : paletteWindow.RealWidth; - - m_boxRect = new Rect( leftAdjust + rightAdjust, 0, availableCanvasWidth, 35 ); - m_boxRect.x += paletteWindow.IsMaximized ? 0 : -paletteWindow.RealWidth; - m_boxRect.width += nodeParametersWindow.IsMaximized ? 0 : nodeParametersWindow.RealWidth; - m_boxRect.width += paletteWindow.IsMaximized ? 0 : paletteWindow.RealWidth; - m_borderRect = new Rect( m_boxRect ); - m_borderRect.height = graphAreaHeight; - - int extra = m_searchBarVisible ? (int)m_searchBarSize.width + 20: 0; - //m_boxRect.xMax -= ( paletteWindow.IsMaximized ? 195 : 230 ) + extra; - //m_boxRect.xMin += nodeParametersWindow.IsMaximized ? 95 : 145; - - UIUtils.ToolbarMainTitle.padding.right = ( paletteWindow.IsMaximized ? 195 : 230 ) + extra; - UIUtils.ToolbarMainTitle.padding.left = nodeParametersWindow.IsMaximized ? 110 : 145; - - if ( m_borderStyle == null ) - { - m_borderStyle = ( ParentWindow.CurrentGraph.CurrentMasterNode == null ) ? UIUtils.GetCustomStyle( CustomStyle.ShaderFunctionBorder ) : UIUtils.GetCustomStyle( CustomStyle.ShaderBorder ); - } - - GUI.Label( m_borderRect, shaderName, m_borderStyle ); - GUI.Label( m_boxRect, shaderName, UIUtils.ToolbarMainTitle ); - } - - public override bool IsInside( Vector2 position ) - { - if ( !m_isActive ) - return false; - - return m_boxRect.Contains( position ) || m_areaLeft.Contains( position ) || m_areaRight.Contains( position ); - } - - public GUIStyle BorderStyle - { - get { return m_borderStyle; } - set { m_borderStyle = value; } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsWindow.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsWindow.cs.meta deleted file mode 100644 index 3bd8f546..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Menu/Tools/ToolsWindow.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: b1c1f3bedf849cb41a1648bf895bc0f7 -timeCreated: 1481126958 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Native.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Native.meta deleted file mode 100644 index c3ec23a0..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Native.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 08d94054f82fc06498060596f83da0ba -folderAsset: yes -timeCreated: 1481126943 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackColor.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackColor.cs deleted file mode 100644 index aeafb2a3..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackColor.cs +++ /dev/null @@ -1,55 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using UnityEngine; - -namespace AmplifyShaderEditor -{ - [Serializable] - public class FallbackColor : IFallbackVars - { - [SerializeField] - private Color m_current; - [SerializeField] - private Color m_previous; - - public FallbackColor() - { - m_current = new Color(0, 0, 0, 0); - m_previous = new Color(0, 0, 0, 0); - } - - public FallbackColor(Color data) - { - m_current = data; - m_previous = data; - } - - public void Revert() - { - Color aux = m_current; - m_current = m_previous; - m_previous = aux; - } - - public Color Current - { - get - { - return m_current; - } - - set - { - m_previous = m_current; - m_current = value; - } - } - - public override string ToString() - { - return m_current.ToString(); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackColor.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackColor.cs.meta deleted file mode 100644 index 004e9aef..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackColor.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 8c6dccc523e2ad440a82edd582b84a45 -timeCreated: 1481126957 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackFloat.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackFloat.cs deleted file mode 100644 index 69d6f39b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackFloat.cs +++ /dev/null @@ -1,56 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using UnityEngine; - -namespace AmplifyShaderEditor -{ - [Serializable] - public class FallbackFloat : IFallbackVars - { - [SerializeField] - private float m_current; - [SerializeField] - private float m_previous; - - public FallbackFloat() - { - m_current = 0; - m_previous = 0; - } - - public FallbackFloat( float data ) - { - m_current = data; - m_previous = data; - } - - public void Revert() - { - float aux = m_current; - m_current = m_previous; - m_previous = aux; - } - - - public float Current - { - get - { - return m_current; - } - - set - { - m_previous = m_current; - m_current = value; - } - } - - public override string ToString() - { - return m_current.ToString(); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackFloat.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackFloat.cs.meta deleted file mode 100644 index c7f6c881..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackFloat.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: a957e66c7a41d6848966d526c9687347 -timeCreated: 1481126958 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackInt.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackInt.cs deleted file mode 100644 index bd9b8a7d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackInt.cs +++ /dev/null @@ -1,56 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using UnityEngine; - -namespace AmplifyShaderEditor -{ - [Serializable] - public class FallbackInt : IFallbackVars - { - [SerializeField] - private int m_current; - [SerializeField] - private int m_previous; - - public FallbackInt() - { - m_current = 0; - m_previous = 0; - } - - public FallbackInt( int data ) - { - m_current = data; - m_previous = data; - } - - public void Revert() - { - int aux = m_current; - m_current = m_previous; - m_previous = aux; - } - - - public int Current - { - get - { - return m_current; - } - - set - { - m_previous = m_current; - m_current = value; - } - } - - public override string ToString() - { - return m_current.ToString(); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackInt.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackInt.cs.meta deleted file mode 100644 index d75cf8df..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackInt.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 09c28ab321caf3b47839606e37d3cdd2 -timeCreated: 1481126953 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackMatrix4x4.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackMatrix4x4.cs deleted file mode 100644 index 8405790d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackMatrix4x4.cs +++ /dev/null @@ -1,55 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using UnityEngine; - -namespace AmplifyShaderEditor -{ - [Serializable] - public class FallbackMatrix4x4 : IFallbackVars - { - [SerializeField] - private Matrix4x4 m_current; - [SerializeField] - private Matrix4x4 m_previous; - - public FallbackMatrix4x4() - { - m_current = new Matrix4x4(); - m_previous = new Matrix4x4(); - } - - public FallbackMatrix4x4( Matrix4x4 data ) - { - m_current = data; - m_previous = data; - } - - public void Revert() - { - Matrix4x4 aux = m_current; - m_current = m_previous; - m_previous = aux; - } - - public Matrix4x4 Current - { - get - { - return m_current; - } - - set - { - m_previous = m_current; - m_current = value; - } - } - - public override string ToString() - { - return m_current.ToString(); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackMatrix4x4.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackMatrix4x4.cs.meta deleted file mode 100644 index e6208e24..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackMatrix4x4.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 48af68670bdba9147b4ed55138e4edf6 -timeCreated: 1481126955 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackString.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackString.cs deleted file mode 100644 index e33e096b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackString.cs +++ /dev/null @@ -1,56 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using UnityEngine; - -namespace AmplifyShaderEditor -{ - [Serializable] - public class FallbackString : IFallbackVars - { - [SerializeField] - private string m_current; - [SerializeField] - private string m_previous; - - public FallbackString() - { - m_current = string.Empty; - m_previous = string.Empty; - } - - public FallbackString( string data ) - { - m_current = data; - m_previous = data; - } - - public void Revert() - { - string aux = m_current; - m_current = m_previous; - m_previous = aux; - } - - - public string Current - { - get - { - return m_current; - } - - set - { - m_previous = m_current; - m_current = value; - } - } - - public override string ToString() - { - return m_current; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackString.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackString.cs.meta deleted file mode 100644 index 82d80d55..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackString.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: cc2e25b7c55e9284699ccad75e79a075 -timeCreated: 1481126959 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackTexture.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackTexture.cs deleted file mode 100644 index afee1e74..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackTexture.cs +++ /dev/null @@ -1,55 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using UnityEngine; - -namespace AmplifyShaderEditor -{ - [Serializable] - public class FallbackTexture : IFallbackVars - { - [SerializeField] - private Texture m_current; - [SerializeField] - private Texture m_previous; - - public FallbackTexture() - { - m_current = null; - m_previous = null; - } - - public FallbackTexture( Texture data ) - { - m_current = data; - m_previous = data; - } - - public void Revert() - { - Texture aux = m_current; - m_current = m_previous; - m_previous = aux; - } - - public Texture Current - { - get - { - return m_current; - } - - set - { - m_previous = m_current; - m_current = value; - } - } - - public override string ToString() - { - return m_current.ToString(); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackTexture.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackTexture.cs.meta deleted file mode 100644 index 21258f26..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackTexture.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 309e413cfa89510429c67fa82c557da7 -timeCreated: 1481126954 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVariable.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVariable.cs deleted file mode 100644 index c6d3eaf2..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVariable.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEngine; -using System; - -namespace AmplifyShaderEditor -{ - //GENERICS DON'T WORK WITH HOT CODE RELOAD - [Serializable] - public class FallbackVariable<T> - { - [SerializeField] - private T m_current; - [SerializeField] - private T m_last; - - public void Revert() - { - m_current = m_last; - } - - public T Current - { - get - { - return m_current; - } - set - { - m_last = m_current; - m_current = value; - } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVariable.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVariable.cs.meta deleted file mode 100644 index 2af70abd..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVariable.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: ec850a4093c249d449f22e0483040b9c -timeCreated: 1481126960 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVector2.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVector2.cs deleted file mode 100644 index adad9d05..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVector2.cs +++ /dev/null @@ -1,56 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using UnityEngine; - -namespace AmplifyShaderEditor -{ - [Serializable] - public class FallbackVector2 : IFallbackVars - { - [SerializeField] - private Vector2 m_current; - [SerializeField] - private Vector2 m_previous; - - public FallbackVector2() - { - m_current = new Vector2( 0, 0 ); - m_previous = new Vector2( 0, 0 ); - } - - public FallbackVector2( Vector2 data ) - { - m_current = data; - m_previous = data; - } - - public void Revert() - { - Vector2 aux = m_current; - m_current = m_previous; - m_previous = aux; - } - - - public Vector2 Current - { - get - { - return m_current; - } - - set - { - m_previous = m_current; - m_current = value; - } - } - - public override string ToString() - { - return m_current.ToString(); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVector2.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVector2.cs.meta deleted file mode 100644 index c04cca14..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVector2.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: ab3a976b3cb79ad41986d2f7d4439642 -timeCreated: 1481126958 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVector3.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVector3.cs deleted file mode 100644 index f2fe1325..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVector3.cs +++ /dev/null @@ -1,56 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using UnityEngine; - -namespace AmplifyShaderEditor -{ - [Serializable] - public class FallbackVector3 : IFallbackVars - { - [SerializeField] - private Vector3 m_current; - [SerializeField] - private Vector3 m_previous; - - public FallbackVector3() - { - m_current = new Vector3( 0, 0, 0 ); - m_previous = new Vector3( 0, 0, 0 ); - } - - public FallbackVector3( Vector3 data ) - { - m_current = data; - m_previous = data; - } - - public void Revert() - { - Vector3 aux = m_current; - m_current = m_previous; - m_previous = aux; - } - - - public Vector3 Current - { - get - { - return m_current; - } - - set - { - m_previous = m_current; - m_current = value; - } - } - - public override string ToString() - { - return m_current.ToString(); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVector3.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVector3.cs.meta deleted file mode 100644 index d22ae5bf..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVector3.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 0e681455d27d2264fbc2683a1510df2c -timeCreated: 1481126953 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVector4.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVector4.cs deleted file mode 100644 index 63be6588..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVector4.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using UnityEngine; - -namespace AmplifyShaderEditor -{ - [Serializable] - public class FallbackVector4 : IFallbackVars - { - [SerializeField] - private Vector4 m_current; - [SerializeField] - private Vector4 m_previous; - - public FallbackVector4() - { - m_current = new Vector4( 0, 0, 0, 0 ); - m_previous = new Vector4( 0, 0, 0, 0 ); - } - - public FallbackVector4( Vector4 data ) - { - m_current = data; - m_previous = data; - } - - public void Revert() - { - Vector4 aux = m_current; - m_current = m_previous; - m_previous = aux; - } - - public Vector4 Current - { - get { return m_current; } - set - { - m_previous = m_current; - m_current = value; - } - } - - public override string ToString() { return m_current.ToString(); } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVector4.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVector4.cs.meta deleted file mode 100644 index 704deb79..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Native/FallbackVector4.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 4e23c25f035ba604ea999f214c0a7833 -timeCreated: 1481126955 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Native/IFallbackVars.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Native/IFallbackVars.cs deleted file mode 100644 index 17f7fcf0..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Native/IFallbackVars.cs +++ /dev/null @@ -1,10 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -namespace AmplifyShaderEditor -{ - interface IFallbackVars - { - void Revert(); - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Native/IFallbackVars.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Native/IFallbackVars.cs.meta deleted file mode 100644 index f558f542..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Native/IFallbackVars.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 8b0dda023474c6e41a39c36e48af72b2 -timeCreated: 1481126957 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes.meta deleted file mode 100644 index 1847e2b4..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: dd2ad7a1ab86e9344b83b2a88cc030cf -folderAsset: yes -timeCreated: 1481126944 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/CommentaryNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/CommentaryNode.cs deleted file mode 100644 index 141fea0d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/CommentaryNode.cs +++ /dev/null @@ -1,692 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using UnityEngine; -using System.Collections.Generic; -using UnityEditor; - -namespace AmplifyShaderEditor -{ - public enum eResizeAxis - { - X_AXIS, - Y_AXIS, - ALL - } - - [Serializable] - public sealed class CommentaryNode : ParentNode, ISerializationCallbackReceiver - { - private const string InfoText = "Press Alt + Left Mouse Click/Drag to make all Comment node area interactable.\nDouble click on the Comment at the node body to modify it directly from there."; - - private const string CommentaryTitle = "Comment"; - private const float BORDER_SIZE_X = 50; - private const float BORDER_SIZE_Y = 50; - private const float MIN_SIZE_X = 100; - private const float MIN_SIZE_Y = 100; - private const float COMMENTARY_BOX_HEIGHT = 30; - - private readonly Vector2 ResizeButtonPos = new Vector2( 1, 1 ); - - [SerializeField] - private string m_commentText = "Comment"; - - [SerializeField] - private string m_titleText = string.Empty; - - [SerializeField] - private eResizeAxis m_resizeAxis = eResizeAxis.ALL; - - [SerializeField] - private List<ParentNode> m_nodesOnCommentary = new List<ParentNode>(); - private Dictionary<int, ParentNode> m_nodesOnCommentaryDict = new Dictionary<int, ParentNode>(); - private bool m_reRegisterNodes = false; - - [SerializeField] - private Rect m_resizeLeftIconCoords; - - [SerializeField] - private Rect m_resizeRightIconCoords; - - [SerializeField] - private Rect m_auxHeaderPos; - - [SerializeField] - private Rect m_commentArea; - - private Texture2D m_resizeIconTex; - - private bool m_isResizingRight = false; - private bool m_isResizingLeft = false; - - private Vector2 m_resizeStartPoint = Vector2.zero; - - private string m_focusName = "CommentaryNode"; - private bool m_focusOnTitle = false; - private bool m_graphDepthAnalized = false; - - private bool m_checkCommentText = true; - private bool m_checkTitleText = true; - - public Color m_frameColor = Color.white; - - private List<int> m_nodesIds = new List<int>(); - private bool m_checkContents = false; - - private bool m_isEditing; - private bool m_stopEditing; - private bool m_startEditing; - private double m_clickTime; - private double m_doubleClickTime = 0.3; - - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_reorderLocked = true; - m_rmbIgnore = true; - m_defaultInteractionMode = InteractionMode.Both; - m_headerColor = UIUtils.GetColorFromCategory( "Commentary" ); - m_connStatus = NodeConnectionStatus.Island; - m_textLabelWidth = 90; - } - - protected override void OnUniqueIDAssigned() - { - base.OnUniqueIDAssigned(); - m_focusName = CommentaryTitle + OutputId; - } - - public void CreateFromSelectedNodes( Vector2 mousePosOnCanvasCoords, ParentNode[] selectedNodes ) - { - if ( selectedNodes.Length == 0 ) - { - m_position = new Rect( mousePosOnCanvasCoords, new Vector2( 100, 100 ) ); - return; - } - - Vector2 minPos = new Vector2( float.MaxValue, float.MaxValue ); - Vector2 maxPos = new Vector2( float.MinValue, float.MinValue ); - - for ( int i = 0; i < selectedNodes.Length; i++ ) - { - //Check min - if ( selectedNodes[ i ].Position.x < minPos.x ) - minPos.x = selectedNodes[ i ].Position.x; - - if ( selectedNodes[ i ].Position.y < minPos.y ) - minPos.y = selectedNodes[ i ].Position.y; - - //check max - float nodeXMax = selectedNodes[ i ].Position.x + selectedNodes[ i ].Position.width; - if ( nodeXMax > maxPos.x ) - { - maxPos.x = nodeXMax; - } - - float nodeYMax = selectedNodes[ i ].Position.y + selectedNodes[ i ].Position.height; - if ( nodeYMax > maxPos.y ) - { - maxPos.y = nodeYMax; - } - - //_nodesOnCommentary.Add( selectedNodes[ i ] ); - //selectedNodes[ i ].OnNodeStoppedMovingEvent += NodeStoppedMoving; - AddNodeToCommentary( selectedNodes[ i ] ); - } - - Vector2 dims = maxPos - minPos + new Vector2( 2 * BORDER_SIZE_X, 2 * BORDER_SIZE_Y ); - m_position = new Rect( minPos.x - BORDER_SIZE_X, minPos.y - BORDER_SIZE_Y, dims.x, dims.y ); - } - - public override void Move( Vector2 delta, bool snap ) - { - if ( m_isResizingRight || m_isResizingLeft ) - return; - - base.Move( delta, snap ); - for ( int i = 0; i < m_nodesOnCommentary.Count; i++ ) - { - if ( !m_nodesOnCommentary[ i ].Selected ) - { - m_nodesOnCommentary[ i ].RecordObject( Constants.UndoMoveNodesId ); - m_nodesOnCommentary[ i ].Move( delta, snap ); - } - } - } - - public void NodeStoppedMoving( ParentNode node, bool testOnlySelected, InteractionMode useTargetInteraction ) - { - if ( !m_position.Contains( node.Vec2Position ) && !m_position.Contains( node.Corner ) ) - { - RemoveNode( node ); - } - } - - public void NodeDestroyed( ParentNode node ) - { - RemoveNode( node ); - } - - public void RemoveNode( ParentNode node ) - { - if ( m_nodesOnCommentaryDict.ContainsKey( node.UniqueId ) ) - { - UIUtils.MarkUndoAction(); - RecordObject( Constants.UndoRemoveNodeFromCommentaryId ); - node.RecordObject( Constants.UndoRemoveNodeFromCommentaryId ); - m_nodesOnCommentary.Remove( node ); - m_nodesOnCommentaryDict.Remove( node.UniqueId ); - node.OnNodeStoppedMovingEvent -= NodeStoppedMoving; - node.OnNodeDestroyedEvent -= NodeDestroyed; - node.CommentaryParent = -1; - } - } - - public void RemoveAllNodes() - { - UIUtils.MarkUndoAction(); - for ( int i = 0; i < m_nodesOnCommentary.Count; i++ ) - { - RecordObject( Constants.UndoRemoveNodeFromCommentaryId ); - m_nodesOnCommentary[ i ].RecordObject( Constants.UndoRemoveNodeFromCommentaryId ); - m_nodesOnCommentary[ i ].OnNodeStoppedMovingEvent -= NodeStoppedMoving; - m_nodesOnCommentary[ i ].OnNodeDestroyedEvent -= NodeDestroyed; - m_nodesOnCommentary[ i ].CommentaryParent = -1; - } - m_nodesOnCommentary.Clear(); - m_nodesOnCommentaryDict.Clear(); - } - - public override void Destroy() - { - base.Destroy(); - RemoveAllNodes(); - } - - public void AddNodeToCommentary( ParentNode node ) - { - if( node.UniqueId == UniqueId ) - return; - - if ( !m_nodesOnCommentaryDict.ContainsKey( node.UniqueId ) ) - { - bool addToNode = false; - - if ( node.CommentaryParent < 0 ) - { - addToNode = true; - if ( node.Depth <= m_depth ) - { - ActivateNodeReordering( node.Depth ); - } - } - else - { - CommentaryNode other = UIUtils.GetNode( node.CommentaryParent ) as CommentaryNode; - if ( other != null ) - { - if ( other.Depth < Depth ) - { - other.RemoveNode( node ); - addToNode = true; - } - - } - } - - if ( addToNode ) - { - UIUtils.MarkUndoAction(); - RecordObject( Constants.UndoAddNodeToCommentaryId ); - node.RecordObject( Constants.UndoAddNodeToCommentaryId ); - - m_nodesOnCommentary.Add( node ); - m_nodesOnCommentaryDict.Add( node.UniqueId, node ); - node.OnNodeStoppedMovingEvent += NodeStoppedMoving; - node.OnNodeDestroyedEvent += NodeDestroyed; - node.CommentaryParent = UniqueId; - } - } - } - - public override void DrawProperties() - { - base.DrawProperties(); - NodeUtils.DrawPropertyGroup( ref m_propertiesFoldout, Constants.ParameterLabelStr,()=> - { - EditorGUI.BeginChangeCheck(); - m_titleText = EditorGUILayoutTextField( "Frame Title", m_titleText ); - if ( EditorGUI.EndChangeCheck() ) - { - m_checkTitleText = true; - } - EditorGUI.BeginChangeCheck(); - m_commentText = EditorGUILayoutTextField( CommentaryTitle, m_commentText ); - if ( EditorGUI.EndChangeCheck() ) - { - m_checkCommentText = true; - } - - m_frameColor = EditorGUILayoutColorField( "Frame Color", m_frameColor ); - } ); - EditorGUILayout.HelpBox( InfoText, MessageType.Info ); - } - - public override void OnNodeLayout( DrawInfo drawInfo ) - { - if ( m_nodesIds.Count > 0 ) - { - for ( int i = 0; i < m_nodesIds.Count; i++ ) - { - ParentNode node = ContainerGraph.GetNode( m_nodesIds[ i ] ); - if ( node ) - { - AddNodeToCommentary( node ); - } - } - m_nodesIds.Clear(); - } - - if ( m_reRegisterNodes ) - { - m_reRegisterNodes = false; - m_nodesOnCommentaryDict.Clear(); - for ( int i = 0; i < m_nodesOnCommentary.Count; i++ ) - { - if ( m_nodesOnCommentary[ i ] != null ) - { - m_nodesOnCommentary[ i ].OnNodeStoppedMovingEvent += NodeStoppedMoving; - m_nodesOnCommentary[ i ].OnNodeDestroyedEvent += NodeDestroyed; - m_nodesOnCommentaryDict.Add( m_nodesOnCommentary[ i ].UniqueId, m_nodesOnCommentary[ i ] ); - } - } - } - - //base.OnLayout( drawInfo ); - CalculatePositionAndVisibility( drawInfo ); - - m_headerPosition = m_globalPosition; - m_headerPosition.height = UIUtils.CurrentHeaderHeight; - - m_auxHeaderPos = m_position; - m_auxHeaderPos.height = UIUtils.HeaderMaxHeight; - - m_commentArea = m_globalPosition; - m_commentArea.height = COMMENTARY_BOX_HEIGHT * drawInfo.InvertedZoom; - m_commentArea.xMin += 10 * drawInfo.InvertedZoom; - m_commentArea.xMax -= 10 * drawInfo.InvertedZoom; - - if ( m_resizeIconTex == null ) - { - m_resizeIconTex = UIUtils.GetCustomStyle( CustomStyle.CommentaryResizeButton ).normal.background; - } - - // LEFT RESIZE BUTTON - m_resizeLeftIconCoords = m_globalPosition; - m_resizeLeftIconCoords.x = m_globalPosition.x + 2; - m_resizeLeftIconCoords.y = m_globalPosition.y + m_globalPosition.height - 2 - ( m_resizeIconTex.height + ResizeButtonPos.y ) * drawInfo.InvertedZoom; - m_resizeLeftIconCoords.width = m_resizeIconTex.width * drawInfo.InvertedZoom; - m_resizeLeftIconCoords.height = m_resizeIconTex.height * drawInfo.InvertedZoom; - - // RIGHT RESIZE BUTTON - m_resizeRightIconCoords = m_globalPosition; - m_resizeRightIconCoords.x = m_globalPosition.x + m_globalPosition.width - 1 - ( m_resizeIconTex.width + ResizeButtonPos.x ) * drawInfo.InvertedZoom; - m_resizeRightIconCoords.y = m_globalPosition.y + m_globalPosition.height - 2 - ( m_resizeIconTex.height + ResizeButtonPos.y ) * drawInfo.InvertedZoom; - m_resizeRightIconCoords.width = m_resizeIconTex.width * drawInfo.InvertedZoom; - m_resizeRightIconCoords.height = m_resizeIconTex.height * drawInfo.InvertedZoom; - } - - public override void OnNodeRepaint( DrawInfo drawInfo ) - { - if ( !m_isVisible ) - return; - - m_colorBuffer = GUI.color; - // Background - GUI.color = Constants.NodeBodyColor * m_frameColor; - GUI.Label( m_globalPosition, string.Empty, UIUtils.GetCustomStyle( CustomStyle.CommentaryBackground ) ); - - // Header - GUI.color = m_headerColor * m_headerColorModifier * m_frameColor; - GUI.Label( m_headerPosition, string.Empty, UIUtils.GetCustomStyle( CustomStyle.NodeHeader ) ); - GUI.color = m_colorBuffer; - - // Fixed Title ( only renders when not editing ) - if ( !m_isEditing && !m_startEditing && ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD3 ) - { - GUI.Label( m_commentArea, m_commentText, UIUtils.CommentaryTitle ); - } - - // Buttons - GUI.Label( m_resizeLeftIconCoords, string.Empty, UIUtils.GetCustomStyle( CustomStyle.CommentaryResizeButtonInv ) ); - GUI.Label( m_resizeRightIconCoords, string.Empty, UIUtils.GetCustomStyle( CustomStyle.CommentaryResizeButton ) ); - - // Selection Box - if ( m_selected ) - { - GUI.color = Constants.NodeSelectedColor; - RectOffset cache = UIUtils.GetCustomStyle( CustomStyle.NodeWindowOn ).border; - UIUtils.GetCustomStyle( CustomStyle.NodeWindowOn ).border = UIUtils.RectOffsetSix; - GUI.Label( m_globalPosition, string.Empty, UIUtils.GetCustomStyle( CustomStyle.NodeWindowOn ) ); - UIUtils.GetCustomStyle( CustomStyle.NodeWindowOn ).border = cache; - GUI.color = m_colorBuffer; - } - - if ( !string.IsNullOrEmpty( m_titleText ) ) - { - Rect titleRect = m_globalPosition; - titleRect.y -= 24; - titleRect.height = 24; - GUI.Label( titleRect, m_titleText, UIUtils.GetCustomStyle( CustomStyle.CommentarySuperTitle ) ); - } - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - - // Custom Editable Title - if ( ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD3 ) - { - if ( !m_isEditing && ( ( !ContainerGraph.ParentWindow.MouseInteracted && drawInfo.CurrentEventType == EventType.MouseDown && m_commentArea.Contains( drawInfo.MousePosition ) ) ) ) - { - if ( ( EditorApplication.timeSinceStartup - m_clickTime ) < m_doubleClickTime ) - m_startEditing = true; - else - GUI.FocusControl( null ); - m_clickTime = EditorApplication.timeSinceStartup; - } - else if ( m_isEditing && ( ( drawInfo.CurrentEventType == EventType.MouseDown && !m_commentArea.Contains( drawInfo.MousePosition ) ) || !EditorGUIUtility.editingTextField ) ) - { - m_stopEditing = true; - } - - if ( m_isEditing || m_startEditing ) - { - EditorGUI.BeginChangeCheck(); - GUI.SetNextControlName( m_focusName ); - m_commentText = EditorGUITextField( m_commentArea, string.Empty, m_commentText, UIUtils.CommentaryTitle ); - if ( EditorGUI.EndChangeCheck() ) - { - m_checkCommentText = true; - } - - if ( m_startEditing ) - EditorGUI.FocusTextInControl( m_focusName ); - } - - if ( drawInfo.CurrentEventType == EventType.Repaint ) - { - if ( m_startEditing ) - { - m_startEditing = false; - m_isEditing = true; - } - - if ( m_stopEditing ) - { - m_stopEditing = false; - m_isEditing = false; - GUI.FocusControl( null ); - } - } - } - - if ( drawInfo.CurrentEventType == EventType.MouseDown && drawInfo.LeftMouseButtonPressed ) - { - // Left Button - if( m_resizeLeftIconCoords.Contains( drawInfo.MousePosition ) && ContainerGraph.ParentWindow.CurrentEvent.modifiers != EventModifiers.Shift ) - { - if ( !m_isResizingLeft ) - { - m_isResizingLeft = true; - ContainerGraph.ParentWindow.ForceAutoPanDir = true; - m_resizeStartPoint = drawInfo.TransformedMousePos; - } - } - - // Right Button - if ( m_resizeRightIconCoords.Contains( drawInfo.MousePosition ) && ContainerGraph.ParentWindow.CurrentEvent.modifiers != EventModifiers.Shift ) - { - if ( !m_isResizingRight ) - { - m_isResizingRight = true; - ContainerGraph.ParentWindow.ForceAutoPanDir = true; - m_resizeStartPoint = drawInfo.TransformedMousePos; - } - } - } - - if ( drawInfo.CurrentEventType == EventType.Repaint || drawInfo.CurrentEventType == EventType.MouseUp ) - { - // Left Button - EditorGUIUtility.AddCursorRect( m_resizeLeftIconCoords, MouseCursor.ResizeUpRight ); - if ( m_isResizingLeft ) - { - if ( drawInfo.CurrentEventType == EventType.MouseUp ) - { - m_isResizingLeft = false; - ContainerGraph.ParentWindow.ForceAutoPanDir = false; - RemoveAllNodes(); - FireStoppedMovingEvent( false, InteractionMode.Target ); - } - else - { - Vector2 currSize = ( drawInfo.TransformedMousePos - m_resizeStartPoint ) /*/ drawInfo.InvertedZoom*/; - m_resizeStartPoint = drawInfo.TransformedMousePos; - if ( m_resizeAxis != eResizeAxis.Y_AXIS ) - { - m_position.x += currSize.x; - m_position.width -= currSize.x; - if ( m_position.width < MIN_SIZE_X ) - { - m_position.x -= ( MIN_SIZE_X - m_position.width ); - m_position.width = MIN_SIZE_X; - } - } - - if ( m_resizeAxis != eResizeAxis.X_AXIS ) - { - m_position.height += currSize.y; - if ( m_position.height < MIN_SIZE_Y ) - { - m_position.height = MIN_SIZE_Y; - } - } - } - } - - // Right Button - EditorGUIUtility.AddCursorRect( m_resizeRightIconCoords, MouseCursor.ResizeUpLeft ); - if ( m_isResizingRight ) - { - if ( drawInfo.CurrentEventType == EventType.MouseUp ) - { - m_isResizingRight = false; - ContainerGraph.ParentWindow.ForceAutoPanDir = false; - RemoveAllNodes(); - FireStoppedMovingEvent( false, InteractionMode.Target ); - } - else - { - Vector2 currSize = ( drawInfo.TransformedMousePos - m_resizeStartPoint ) /*/ drawInfo.InvertedZoom*/; - m_resizeStartPoint = drawInfo.TransformedMousePos; - if ( m_resizeAxis != eResizeAxis.Y_AXIS ) - { - m_position.width += currSize.x; - if ( m_position.width < MIN_SIZE_X ) - { - m_position.width = MIN_SIZE_X; - } - } - - if ( m_resizeAxis != eResizeAxis.X_AXIS ) - { - m_position.height += currSize.y; - if ( m_position.height < MIN_SIZE_Y ) - { - m_position.height = MIN_SIZE_Y; - } - } - } - } - } - - if ( m_checkCommentText ) - { - m_checkCommentText = false; - m_commentText = m_commentText.Replace( IOUtils.FIELD_SEPARATOR, ' ' ); - } - - if ( m_checkTitleText ) - { - m_checkTitleText = false; - m_titleText = m_titleText.Replace( IOUtils.FIELD_SEPARATOR, ' ' ); - } - - if ( m_focusOnTitle && drawInfo.CurrentEventType == EventType.KeyUp ) - { - m_focusOnTitle = false; - m_startEditing = true; - } - } - - public void Focus() - { - m_focusOnTitle = true; - } - - public override void OnAfterDeserialize() - { - base.OnAfterDeserialize(); - m_reRegisterNodes = true; - } - - public override bool OnNodeInteraction( ParentNode node ) - { - if ( node == null || UniqueId == node.UniqueId ) - return false; - - for( int i = 0; i < m_nodesOnCommentary.Count; i++ ) - { - if( m_nodesOnCommentary[ i ] && m_nodesOnCommentary[ i ] != this && m_nodesOnCommentary[ i ].OnNodeInteraction( node ) ) - { - return false; - } - } - - if( m_position.Contains( node.Vec2Position ) && m_position.Contains( node.Corner ) ) - { - AddNodeToCommentary( node ); - return true; - } - return false; - } - - public override void OnSelfStoppedMovingEvent() - { - FireStoppedMovingEvent( false, InteractionMode.Both ); - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - m_position.width = Convert.ToSingle( GetCurrentParam( ref nodeParams ) ); - m_position.height = Convert.ToSingle( GetCurrentParam( ref nodeParams ) ); - m_commentText = GetCurrentParam( ref nodeParams ); - int count = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - for ( int i = 0; i < count; i++ ) - { - m_nodesIds.Add( Convert.ToInt32( GetCurrentParam( ref nodeParams ) ) ); - } - - if ( UIUtils.CurrentShaderVersion() > 5004 ) - m_titleText = GetCurrentParam( ref nodeParams ); - - if ( UIUtils.CurrentShaderVersion() > 12002 ) - { - string[] colorChannels = GetCurrentParam( ref nodeParams ).Split( IOUtils.VECTOR_SEPARATOR ); - if ( colorChannels.Length == 4 ) - { - m_frameColor.r = Convert.ToSingle( colorChannels[ 0 ] ); - m_frameColor.g = Convert.ToSingle( colorChannels[ 1 ] ); - m_frameColor.b = Convert.ToSingle( colorChannels[ 2 ] ); - m_frameColor.a = Convert.ToSingle( colorChannels[ 3 ] ); - } - else - { - UIUtils.ShowMessage( UniqueId, "Incorrect number of color values", MessageSeverity.Error ); - } - } - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_position.width ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_position.height ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_commentText ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_nodesOnCommentary.Count ); - for ( int i = 0; i < m_nodesOnCommentary.Count; i++ ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_nodesOnCommentary[ i ].UniqueId ); - } - - IOUtils.AddFieldValueToString( ref nodeInfo, m_titleText ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_frameColor.r.ToString() + IOUtils.VECTOR_SEPARATOR + m_frameColor.g.ToString() + IOUtils.VECTOR_SEPARATOR + m_frameColor.b.ToString() + IOUtils.VECTOR_SEPARATOR + m_frameColor.a.ToString() ); - } - - public override void ResetNodeData() - { - base.ResetNodeData(); - m_graphDepthAnalized = false; - } - - public override void ReadAdditionalClipboardData( ref string[] nodeParams ) - { - base.ReadAdditionalClipboardData( ref nodeParams ); - m_nodesIds.Clear(); - m_checkContents = true; - } - - public override void RefreshExternalReferences() - { - base.RefreshExternalReferences(); - if( m_checkContents ) - { - m_checkContents = false; - OnSelfStoppedMovingEvent(); - } - } - - public override void CalculateCustomGraphDepth() - { - if ( m_graphDepthAnalized ) - return; - - m_graphDepth = int.MinValue; - int count = m_nodesOnCommentary.Count; - for ( int i = 0; i < count; i++ ) - { - if ( m_nodesOnCommentary[ i ].ConnStatus == NodeConnectionStatus.Island ) - { - m_nodesOnCommentary[ i ].CalculateCustomGraphDepth(); - } - - if ( m_nodesOnCommentary[ i ].GraphDepth >= m_graphDepth ) - { - m_graphDepth = m_nodesOnCommentary[ i ].GraphDepth + 1; - } - } - m_graphDepthAnalized = true; - } - - public override Rect Position { get { return Event.current.alt ? m_position : m_auxHeaderPos; } } - public override bool Contains( Vector3 pos ) - { - return Event.current.alt ? m_globalPosition.Contains( pos ) : ( m_headerPosition.Contains( pos ) || m_resizeRightIconCoords.Contains( pos ) || m_resizeLeftIconCoords.Contains( pos ) ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/CommentaryNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/CommentaryNode.cs.meta deleted file mode 100644 index 34eb425b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/CommentaryNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 08f1d9c1d8cbe5841a6429d565096eab -timeCreated: 1481126953 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants.meta deleted file mode 100644 index 8706d1a2..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: e7354e1a2beece044944bc1cba85aebc -folderAsset: yes -timeCreated: 1481126946 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ColorNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ColorNode.cs deleted file mode 100644 index 4321bc10..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ColorNode.cs +++ /dev/null @@ -1,506 +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( "Color", "Constants And Properties", "Color property", null, KeyCode.Alpha5 )] - public sealed class ColorNode : PropertyNode - { - private const string ColorSpaceStr = "Color Space"; - - [SerializeField] -#if UNITY_2018_1_OR_NEWER - [ColorUsage( true, true )] -#else - [ColorUsage( true, true, float.MinValue, float.MinValue, float.MinValue, float.MaxValue )] -#endif - private Color m_defaultValue = new Color( 0, 0, 0, 0 ); - - [SerializeField] -#if UNITY_2018_1_OR_NEWER - [ColorUsage( true, true )] -#else - [ColorUsage( true, true, float.MinValue, float.MinValue, float.MinValue, float.MaxValue )] -#endif - private Color m_materialValue = new Color( 0, 0, 0, 0 ); - - [SerializeField] - private bool m_isHDR = false; - - //[SerializeField] - //private ASEColorSpace m_colorSpace = ASEColorSpace.Auto; -#if !UNITY_2018_1_OR_NEWER - private ColorPickerHDRConfig m_hdrConfig = new ColorPickerHDRConfig( 0, float.MaxValue, 0, float.MaxValue ); -#endif - private GUIContent m_dummyContent; - - private int m_cachedPropertyId = -1; - - private bool m_isEditingFields; - - [SerializeField] - private bool m_autoGammaToLinearConversion = true; - - private const string AutoGammaToLinearConversion = "IsGammaSpace() ? {0} : {1}"; - private const string AutoGammaToLinearStr = "Auto Gamma To Linear"; - - public ColorNode() : base() { } - public ColorNode( int uniqueId, float x, float y, float width, float height ) : base( uniqueId, x, y, width, height ) { } - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - GlobalTypeWarningText = string.Format( GlobalTypeWarningText, "Color" ); - m_insideSize.Set( 100, 50 ); - m_dummyContent = new GUIContent(); - AddOutputColorPorts( "RGBA" ); - m_drawPreview = false; - m_drawPreviewExpander = false; - m_canExpand = false; - m_showHybridInstancedUI = true; - m_selectedLocation = PreviewLocation.BottomCenter; - m_previewShaderGUID = "6cf365ccc7ae776488ae8960d6d134c3"; - m_srpBatcherCompatible = true; - } - - public override void SetPreviewInputs() - { - base.SetPreviewInputs(); - - if( m_cachedPropertyId == -1 ) - m_cachedPropertyId = Shader.PropertyToID( "_InputColor" ); - - if( m_materialMode && m_currentParameterType != PropertyType.Constant ) - PreviewMaterial.SetColor( m_cachedPropertyId, m_materialValue ); - else - PreviewMaterial.SetColor( m_cachedPropertyId, m_defaultValue ); - } - - public override void CopyDefaultsToMaterial() - { - m_materialValue = m_defaultValue; - } - - public override void DrawSubProperties() - { - m_textLabelWidth = ( m_currentParameterType == PropertyType.Constant ) ? 152 : 105; - -#if UNITY_2018_1_OR_NEWER - m_defaultValue = EditorGUILayoutColorField( Constants.DefaultValueLabelContent, m_defaultValue, false, true, m_isHDR ); -#else - m_defaultValue = EditorGUILayoutColorField( Constants.DefaultValueLabelContent, m_defaultValue, false, true, m_isHDR, m_hdrConfig ); -#endif - if( m_currentParameterType == PropertyType.Constant ) - { - - m_autoGammaToLinearConversion = EditorGUILayoutToggle( AutoGammaToLinearStr, m_autoGammaToLinearConversion ); - } - } - - //public override void DrawMainPropertyBlock() - //{ - // EditorGUILayout.BeginVertical(); - // { - - // PropertyType parameterType = (PropertyType)EditorGUILayoutEnumPopup( ParameterTypeStr, m_currentParameterType ); - // if( parameterType != m_currentParameterType ) - // { - // ChangeParameterType( parameterType ); - // BeginPropertyFromInspectorCheck(); - // } - - // switch( m_currentParameterType ) - // { - // case PropertyType.Property: - // case PropertyType.InstancedProperty: - // { - // ShowPropertyInspectorNameGUI(); - // ShowPropertyNameGUI( true ); - // ShowVariableMode(); - // ShowPrecision(); - // ShowToolbar(); - // } - // break; - // case PropertyType.Global: - // { - // ShowPropertyInspectorNameGUI(); - // ShowPropertyNameGUI( false ); - // ShowVariableMode(); - // ShowPrecision(); - // ShowDefaults(); - // } - // break; - // case PropertyType.Constant: - // { - // ShowPropertyInspectorNameGUI(); - // ShowPrecision(); - // m_colorSpace = (ASEColorSpace)EditorGUILayoutEnumPopup( ColorSpaceStr, m_colorSpace ); - // ShowDefaults(); - // } - // break; - // } - // } - // EditorGUILayout.EndVertical(); - //} - - public override void DrawMaterialProperties() - { - if( m_materialMode ) - EditorGUI.BeginChangeCheck(); -#if UNITY_2018_1_OR_NEWER - m_materialValue = EditorGUILayoutColorField( Constants.MaterialValueLabelContent, m_materialValue, false, true, m_isHDR ); -#else - m_materialValue = EditorGUILayoutColorField( Constants.MaterialValueLabelContent, m_materialValue, false, true, m_isHDR, m_hdrConfig ); -#endif - if( m_materialMode && EditorGUI.EndChangeCheck() ) - m_requireMaterialUpdate = true; - } - - public override void OnNodeLayout( DrawInfo drawInfo ) - { - base.OnNodeLayout( drawInfo ); - - m_propertyDrawPos = m_globalPosition; - m_propertyDrawPos.x = m_remainingBox.x; - m_propertyDrawPos.y = m_remainingBox.y; - m_propertyDrawPos.width = 80 * drawInfo.InvertedZoom; - m_propertyDrawPos.height = m_remainingBox.height; - } - - public override void DrawGUIControls( DrawInfo drawInfo ) - { - base.DrawGUIControls( drawInfo ); - - if( drawInfo.CurrentEventType != EventType.MouseDown ) - return; - - Rect hitBox = m_remainingBox; - //hitBox.xMin -= LabelWidth * drawInfo.InvertedZoom; - bool insideBox = hitBox.Contains( drawInfo.MousePosition ); - - if( insideBox ) - { - m_isEditingFields = true; - } - else if( m_isEditingFields && !insideBox ) - { - GUI.FocusControl( null ); - m_isEditingFields = false; - } - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - - if( !m_isVisible ) - return; - - if( m_isEditingFields && m_currentParameterType != PropertyType.Global ) - { - if( m_materialMode && m_currentParameterType != PropertyType.Constant ) - { - EditorGUI.BeginChangeCheck(); -#if UNITY_2018_1_OR_NEWER - m_materialValue = EditorGUIColorField( m_propertyDrawPos, m_dummyContent, m_materialValue, false, true, m_isHDR ); -#else - m_materialValue = EditorGUIColorField( m_propertyDrawPos, m_dummyContent, m_materialValue, false, true, m_isHDR, m_hdrConfig ); -#endif - if( EditorGUI.EndChangeCheck() ) - { - PreviewIsDirty = true; - m_requireMaterialUpdate = true; - if( m_currentParameterType != PropertyType.Constant ) - { - BeginDelayedDirtyProperty(); - } - } - } - else - { - EditorGUI.BeginChangeCheck(); -#if UNITY_2018_1_OR_NEWER - m_defaultValue = EditorGUIColorField( m_propertyDrawPos, m_dummyContent, m_defaultValue, false, true, m_isHDR ); -#else - m_defaultValue = EditorGUIColorField( m_propertyDrawPos, m_dummyContent, m_defaultValue, false, true, m_isHDR, m_hdrConfig ); -#endif - if( EditorGUI.EndChangeCheck() ) - { - PreviewIsDirty = true; - BeginDelayedDirtyProperty(); - } - } - } - else if( drawInfo.CurrentEventType == EventType.Repaint ) - { - if( m_materialMode && m_currentParameterType != PropertyType.Constant ) - EditorGUIUtility.DrawColorSwatch( m_propertyDrawPos, m_materialValue ); - else - EditorGUIUtility.DrawColorSwatch( m_propertyDrawPos, m_defaultValue ); - - GUI.Label( m_propertyDrawPos, string.Empty, UIUtils.GetCustomStyle( CustomStyle.SamplerFrame ) ); - } - } - - public override void ConfigureLocalVariable( ref MasterNodeDataCollector dataCollector ) - { - Color color = m_defaultValue; - //switch( m_colorSpace ) - //{ - // default: - // case ASEColorSpace.Auto: color = m_defaultValue; break; - // case ASEColorSpace.Gamma: color = m_defaultValue.gamma; break; - // case ASEColorSpace.Linear: color = m_defaultValue.linear; break; - //} - - dataCollector.AddLocalVariable( UniqueId, CreateLocalVarDec( color.r + "," + color.g + "," + color.b + "," + color.a ) ); - - m_outputPorts[ 0 ].SetLocalValue( m_propertyName , dataCollector.PortCategory); - m_outputPorts[ 1 ].SetLocalValue( m_propertyName + ".r", dataCollector.PortCategory ); - m_outputPorts[ 2 ].SetLocalValue( m_propertyName + ".g", dataCollector.PortCategory ); - m_outputPorts[ 3 ].SetLocalValue( m_propertyName + ".b", dataCollector.PortCategory ); - m_outputPorts[ 4 ].SetLocalValue( m_propertyName + ".a", dataCollector.PortCategory ); - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); - m_precisionString = UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, m_outputPorts[ 0 ].DataType ); - - if( m_currentParameterType != PropertyType.Constant ) - return GetOutputVectorItem( 0, outputId, PropertyData( dataCollector.PortCategory ) ); - - // Constant Only Code - - if( m_outputPorts[ outputId ].IsLocalValue(dataCollector.PortCategory) ) - { - return m_outputPorts[ outputId ].LocalValue( dataCollector.PortCategory ); - } - if( m_autoGammaToLinearConversion ) - { - if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) - return GetOutputColorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue(dataCollector.PortCategory) ); - - Color linear = m_defaultValue.linear; - - string colorGamma = m_precisionString + "(" + m_defaultValue.r + "," + m_defaultValue.g + "," + m_defaultValue.b + "," + m_defaultValue.a + ")"; - string colorLinear = m_precisionString + "(" + linear.r + "," + linear.g + "," + linear.b + "," + m_defaultValue.a + ")"; - - string result = string.Format( AutoGammaToLinearConversion, colorGamma, colorLinear ); - RegisterLocalVariable( 0, result, ref dataCollector, "color" + OutputId ); - return GetOutputColorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); - } - else - { - if( CheckLocalVariable( ref dataCollector ) ) - { - return m_outputPorts[ outputId ].LocalValue( dataCollector.PortCategory ); - } - - Color color = m_defaultValue; - //switch( m_colorSpace ) - //{ - // default: - // case ASEColorSpace.Auto: color = m_defaultValue; break; - // case ASEColorSpace.Gamma: color = m_defaultValue.gamma; break; - // case ASEColorSpace.Linear: color = m_defaultValue.linear; break; - //} - string result = string.Empty; - - switch( outputId ) - { - case 0: - { - result = m_precisionString + "(" + color.r + "," + color.g + "," + color.b + "," + color.a + ")"; - } - break; - - case 1: - { - result = color.r.ToString(); - } - break; - case 2: - { - result = color.g.ToString(); - } - break; - case 3: - { - result = color.b.ToString(); - } - break; - case 4: - { - result = color.a.ToString(); - } - break; - } - return result; - } - } - - protected override void OnAtrributesChanged() - { - CheckIfHDR(); - } - - public override void RefreshExternalReferences() - { - base.RefreshExternalReferences(); - CheckIfHDR(); - } - - void CheckIfHDR() - { - int count = m_selectedAttribs.Count; - bool hdrBuffer = m_isHDR; - m_isHDR = false; - for( int i = 0; i < count; i++ ) - { - if( m_selectedAttribs[ i ] == 1 /*HDR Property ID*/) - { - m_isHDR = true; - break; - } - } - - if( hdrBuffer && !m_isHDR ) - { - bool fireDirtyProperty = false; - - if( m_defaultValue.r > 1 || m_defaultValue.g > 1 || m_defaultValue.b > 1 ) - { - float defaultColorLength = Mathf.Sqrt( m_defaultValue.r * m_defaultValue.r + m_defaultValue.g * m_defaultValue.g + m_defaultValue.b * m_defaultValue.b ); - m_defaultValue.r /= defaultColorLength; - m_defaultValue.g /= defaultColorLength; - m_defaultValue.b /= defaultColorLength; - fireDirtyProperty = true; - } - - if( m_materialValue.r > 1 || m_materialValue.g > 1 || m_materialValue.b > 1 ) - { - float materialColorLength = Mathf.Sqrt( m_materialValue.r * m_materialValue.r + m_materialValue.g * m_materialValue.g + m_materialValue.b * m_materialValue.b ); - m_materialValue.r /= materialColorLength; - m_materialValue.g /= materialColorLength; - m_materialValue.b /= materialColorLength; - fireDirtyProperty = true; - } - - if( fireDirtyProperty ) - BeginDelayedDirtyProperty(); - } - } - - public override string GetPropertyValue() - { - return PropertyAttributes + m_propertyName + "(\"" + m_propertyInspectorName + "\", Color) = (" + m_defaultValue.r + "," + m_defaultValue.g + "," + m_defaultValue.b + "," + m_defaultValue.a + ")"; - } - - public override void UpdateMaterial( Material mat ) - { - base.UpdateMaterial( mat ); - - if( UIUtils.IsProperty( m_currentParameterType ) && !InsideShaderFunction ) - { - mat.SetColor( m_propertyName, m_materialValue ); - } - } - - public override void SetMaterialMode( Material mat, bool fetchMaterialValues ) - { - base.SetMaterialMode( mat, fetchMaterialValues ); - if( m_materialMode && fetchMaterialValues ) - { - if( UIUtils.IsProperty( m_currentParameterType ) && mat.HasProperty( m_propertyName ) ) - MaterialValue = mat.GetColor( m_propertyName ); - } - } - - public override void ForceUpdateFromMaterial( Material material ) - { - if( UIUtils.IsProperty( m_currentParameterType ) && material.HasProperty( m_propertyName ) ) - { - MaterialValue = material.GetColor( m_propertyName ); - PreviewIsDirty = true; - } - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - m_defaultValue = IOUtils.StringToColor( GetCurrentParam( ref nodeParams ) ); - if( UIUtils.CurrentShaderVersion() > 14101 ) - { - m_materialValue = IOUtils.StringToColor( GetCurrentParam( ref nodeParams ) ); - } - - if( UIUtils.CurrentShaderVersion() > 15900 ) - { - m_autoGammaToLinearConversion = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - } - else - { - m_autoGammaToLinearConversion = false; - } - //if( UIUtils.CurrentShaderVersion() > 14202 ) - //{ - // m_colorSpace = (ASEColorSpace)Enum.Parse( typeof( ASEColorSpace ), GetCurrentParam( ref nodeParams ) ); - //} - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, IOUtils.ColorToString( m_defaultValue ) ); - IOUtils.AddFieldValueToString( ref nodeInfo, IOUtils.ColorToString( m_materialValue ) ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_autoGammaToLinearConversion ); - //IOUtils.AddFieldValueToString( ref nodeInfo, m_colorSpace ); - } - - public override void SetGlobalValue() { Shader.SetGlobalColor( m_propertyName, m_defaultValue ); } - public override void FetchGlobalValue() { m_materialValue = Shader.GetGlobalColor( m_propertyName ); } - - public override string GetPropertyValStr() - { - return ( m_materialMode && m_currentParameterType != PropertyType.Constant ) ? m_materialValue.r.ToString( Constants.PropertyVectorFormatLabel ) + IOUtils.VECTOR_SEPARATOR + - m_materialValue.g.ToString( Constants.PropertyVectorFormatLabel ) + IOUtils.VECTOR_SEPARATOR + - m_materialValue.b.ToString( Constants.PropertyVectorFormatLabel ) + IOUtils.VECTOR_SEPARATOR + - m_materialValue.a.ToString( Constants.PropertyVectorFormatLabel ) : - m_defaultValue.r.ToString( Constants.PropertyVectorFormatLabel ) + IOUtils.VECTOR_SEPARATOR + - m_defaultValue.g.ToString( Constants.PropertyVectorFormatLabel ) + IOUtils.VECTOR_SEPARATOR + - m_defaultValue.b.ToString( Constants.PropertyVectorFormatLabel ) + IOUtils.VECTOR_SEPARATOR + - m_defaultValue.a.ToString( Constants.PropertyVectorFormatLabel ); - } - - private Color MaterialValue - { - set - { - if( !m_isHDR && ( value.r > 1 || value.g > 1 || value.r > 1 ) ) - { - float materialColorLength = Mathf.Sqrt( value.r * value.r + value.g * value.g + value.b * value.b ); - m_materialValue.r = value.r / materialColorLength; - m_materialValue.g = value.g / materialColorLength; - m_materialValue.b = value.b / materialColorLength; - m_materialValue.a = value.a; - } - else - { - m_materialValue = value; - } - } - } - - public Color Value - { - get { return m_defaultValue; } - set { m_defaultValue = value; } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ColorNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ColorNode.cs.meta deleted file mode 100644 index 1a21bb5c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ColorNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 4b99bcf4cd965c648bbbc1de0d1b152a -timeCreated: 1481126955 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/GlobalArrayNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/GlobalArrayNode.cs deleted file mode 100644 index d224465f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/GlobalArrayNode.cs +++ /dev/null @@ -1,486 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> -// -// Custom Node Global Array -// Donated by Johann van Berkel - -using System; -using UnityEngine; -using UnityEditor; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Global Array", "Constants And Properties", "The node returns a value from a global array, which you can configure by entering the name of the array in the node's settings.", null, KeyCode.None, true, false, null, null, "Johann van Berkel" )] - public sealed class GlobalArrayNode : ParentNode - { - private const string DefaultArrayName = "MyGlobalArray"; - private const string TypeStr = "Type"; - private const string AutoRangeCheckStr = "Range Check"; - private const string ArrayFormatStr = "{0}[{1}]"; - private const string JaggedArrayFormatStr = "{0}[{1}][{2}]"; - private const string IsJaggedStr = "Is Jagged"; - private const string AutoRegisterStr = "Auto-Register"; - - private readonly string[] AvailableTypesLabel = { "Float", "Color", "Vector4", "Matrix4" }; - private readonly WirePortDataType[] AvailableTypesValues = { WirePortDataType.FLOAT, WirePortDataType.COLOR, WirePortDataType.FLOAT4, WirePortDataType.FLOAT4x4 }; - - [SerializeField] - private string m_name = DefaultArrayName; - - [SerializeField] - private int m_indexX = 0; - - [SerializeField] - private int m_indexY = 0; - - [SerializeField] - private int m_arrayLengthX = 1; - - [SerializeField] - private int m_arrayLengthY = 1; - - [SerializeField] - private int m_type = 0; - - [SerializeField] - private bool m_autoRangeCheck = false; - - [SerializeField] - private bool m_isJagged = false; - - [SerializeField] - private bool m_autoRegister = false; - - ////////////////////////////////////////////////////////////////// - private readonly Color ReferenceHeaderColor = new Color( 0.6f, 3.0f, 1.25f, 1.0f ); - - [SerializeField] - private TexReferenceType m_referenceType = TexReferenceType.Object; - - [SerializeField] - private int m_referenceArrayId = -1; - - [SerializeField] - private int m_referenceNodeId = -1; - - private GlobalArrayNode m_referenceNode = null; - - private bool m_updated = false; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - - AddInputPort( WirePortDataType.INT, false, "Index", -1, MasterNodePortCategory.Fragment, 0 ); - AddInputPort( WirePortDataType.INT, false, "Index Y", -1, MasterNodePortCategory.Fragment, 2 ); - AddInputPort( WirePortDataType.INT, false, "Array Length", -1, MasterNodePortCategory.Fragment, 1 ); - AddInputPort( WirePortDataType.INT, false, "Array Length Y", -1, MasterNodePortCategory.Fragment, 3 ); - - AddOutputPort( WirePortDataType.FLOAT, "Out" ); - - m_textLabelWidth = 95; - SetAdditonalTitleText( string.Format( Constants.SubTitleValueFormatStr, m_name ) ); - UpdatePorts(); - } - - protected override void OnUniqueIDAssigned() - { - base.OnUniqueIDAssigned(); - UIUtils.CurrentWindow.OutsideGraph.GlobalArrayNodes.AddNode( this ); - } - - public override void Destroy() - { - base.Destroy(); - UIUtils.CurrentWindow.OutsideGraph.GlobalArrayNodes.RemoveNode( this ); - } - - void UpdatePorts() - { - InputPort indexXPort = GetInputPortByUniqueId( 0 ); - InputPort arrayLengthPortX = GetInputPortByUniqueId( 1 ); - InputPort indexYPort = GetInputPortByUniqueId( 2 ); - InputPort arrayLengthPortY = GetInputPortByUniqueId( 3 ); - if( m_referenceType == TexReferenceType.Object ) - { - m_headerColorModifier = Color.white; - SetAdditonalTitleText( string.Format( Constants.SubTitleValueFormatStr, m_name ) ); - arrayLengthPortX.Visible = true; - if( m_isJagged ) - { - indexXPort.Name = "Index X"; - arrayLengthPortX.Name = "Array Length X"; - indexYPort.Visible = true; - arrayLengthPortY.Visible = true; - } - else - { - indexXPort.Name = "Index"; - arrayLengthPortX.Name = "Array Length"; - indexYPort.Visible = false; - arrayLengthPortY.Visible = false; - } - } - else if( m_referenceNodeId > -1 ) - { - m_headerColorModifier = ReferenceHeaderColor; - if( m_referenceNode == null ) - m_referenceNode = UIUtils.GetNode( m_referenceNodeId ) as GlobalArrayNode; - - if( m_referenceNode != null ) - { - SetAdditonalTitleText( string.Format( Constants.SubTitleValueFormatStr, m_referenceNode.DataToArray ) ); - arrayLengthPortX.Visible = false; - arrayLengthPortY.Visible = false; - if( m_referenceNode.IsJagged ) - { - indexXPort.Name = "Index X"; - indexYPort.Visible = true; - } - else - { - indexXPort.Name = "Index"; - indexYPort.Visible = false; - } - } - } - m_sizeIsDirty = true; - } - - void DrawObjectProperties() - { - EditorGUI.BeginChangeCheck(); - m_name = EditorGUILayoutStringField( "Name", m_name ); - if( EditorGUI.EndChangeCheck() ) - { - m_updated = true; - m_name = UIUtils.RemoveInvalidCharacters( m_name ); - if( string.IsNullOrEmpty( m_name ) ) - m_name = DefaultArrayName; - UIUtils.UpdateGlobalArrayDataNode( UniqueId, m_name ); - SetAdditonalTitleText( string.Format( Constants.SubTitleValueFormatStr, m_name ) ); - } - - - m_autoRegister = EditorGUILayoutToggle( AutoRegisterStr, m_autoRegister ); - - EditorGUI.BeginChangeCheck(); - m_isJagged = EditorGUILayoutToggle( IsJaggedStr, m_isJagged ); - if( EditorGUI.EndChangeCheck() ) - { - m_updated = true; - UpdatePorts(); - } - - InputPort indexXPort = GetInputPortByUniqueId( 0 ); - if( !indexXPort.IsConnected ) - { - EditorGUI.BeginChangeCheck(); - m_indexX = EditorGUILayoutIntField( indexXPort.Name, m_indexX ); - if( EditorGUI.EndChangeCheck() ) - { - m_indexX = Mathf.Clamp( m_indexX, 0, ( m_arrayLengthX - 1 ) ); - } - } - - if( m_isJagged ) - { - InputPort indexYPort = GetInputPortByUniqueId( 2 ); - if( !indexYPort.IsConnected ) - { - EditorGUI.BeginChangeCheck(); - m_indexY = EditorGUILayoutIntField( indexYPort.Name, m_indexY ); - if( EditorGUI.EndChangeCheck() ) - { - m_indexY = Mathf.Clamp( m_indexY, 0, ( m_arrayLengthY - 1 ) ); - } - } - } - - InputPort arrayLengthXPort = GetInputPortByUniqueId( 1 ); - if( !arrayLengthXPort.IsConnected ) - { - EditorGUI.BeginChangeCheck(); - m_arrayLengthX = EditorGUILayoutIntField( arrayLengthXPort.Name, m_arrayLengthX ); - if( EditorGUI.EndChangeCheck() ) - { - m_arrayLengthX = Mathf.Max( 1, m_arrayLengthX ); - } - } - - if( m_isJagged ) - { - InputPort arrayLengthYPort = GetInputPortByUniqueId( 3 ); - if( !arrayLengthYPort.IsConnected ) - { - EditorGUI.BeginChangeCheck(); - m_arrayLengthY = EditorGUILayoutIntField( arrayLengthYPort.Name, m_arrayLengthY ); - if( EditorGUI.EndChangeCheck() ) - { - m_arrayLengthY = Mathf.Max( 1, m_arrayLengthY ); - } - } - } - - EditorGUI.BeginChangeCheck(); - m_type = EditorGUILayoutPopup( TypeStr, m_type, AvailableTypesLabel ); - if( EditorGUI.EndChangeCheck() ) - { - m_outputPorts[ 0 ].ChangeType( (WirePortDataType)AvailableTypesValues[ m_type ], false ); - } - - m_autoRangeCheck = EditorGUILayoutToggle( AutoRangeCheckStr, m_autoRangeCheck ); - } - - public override void OnNodeLayout( DrawInfo drawInfo ) - { - base.OnNodeLayout( drawInfo ); - m_updated = false; - if( m_referenceType == TexReferenceType.Instance ) - { - if( m_referenceNodeId > -1 && m_referenceNode == null ) - { - m_referenceNode = UIUtils.GetNode( m_referenceNodeId ) as GlobalArrayNode; - if( m_referenceNode == null ) - { - m_referenceNodeId = -1; - } - } - if( m_referenceNode != null && m_referenceNode.Updated) - { - UpdatePorts(); - } - } - } - - void DrawInstancedProperties() - { - string[] arr = UIUtils.GlobalArrayNodeArr(); - bool guiEnabledBuffer = GUI.enabled; - if( arr != null && arr.Length > 0 ) - { - GUI.enabled = true; - } - else - { - m_referenceArrayId = -1; - m_referenceNodeId = -1; - m_referenceNode = null; - GUI.enabled = false; - } - EditorGUI.BeginChangeCheck(); - m_referenceArrayId = EditorGUILayoutPopup( Constants.AvailableReferenceStr, m_referenceArrayId, arr ); - if( EditorGUI.EndChangeCheck() ) - { - m_referenceNode = UIUtils.GetGlobalArrayNode( m_referenceArrayId ); - if( m_referenceNode != null ) - { - m_referenceNodeId = m_referenceNode.UniqueId; - } - UpdatePorts(); - } - - GUI.enabled = guiEnabledBuffer; - - InputPort indexXPort = GetInputPortByUniqueId( 0 ); - if( !indexXPort.IsConnected ) - { - EditorGUI.BeginChangeCheck(); - m_indexX = EditorGUILayoutIntField( indexXPort.Name, m_indexX ); - if( EditorGUI.EndChangeCheck() ) - { - m_indexX = Mathf.Clamp( m_indexX, 0, ( m_arrayLengthX - 1 ) ); - } - } - - if( m_isJagged ) - { - InputPort indexYPort = GetInputPortByUniqueId( 2 ); - if( !indexYPort.IsConnected ) - { - EditorGUI.BeginChangeCheck(); - m_indexY = EditorGUILayoutIntField( indexYPort.Name, m_indexY ); - if( EditorGUI.EndChangeCheck() ) - { - m_indexY = Mathf.Clamp( m_indexY, 0, ( m_arrayLengthY - 1 ) ); - } - } - } - } - - public override void DrawProperties() - { - EditorGUI.BeginChangeCheck(); - m_referenceType = (TexReferenceType)EditorGUILayoutPopup( Constants.ReferenceTypeStr, (int)m_referenceType, Constants.ReferenceArrayLabels ); - if( EditorGUI.EndChangeCheck() ) - { - UpdatePorts(); - } - - if( m_referenceType == TexReferenceType.Object ) - DrawObjectProperties(); - else - DrawInstancedProperties(); - } - - public string GetArrayValue( string indexX, string indexY = null ) - { - if( m_isJagged ) - return string.Format( JaggedArrayFormatStr, m_name, indexX, indexY ); - - return string.Format( ArrayFormatStr, m_name, indexX ); - } - - public string GenerateInstancedShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - string result = string.Empty; - if( m_referenceNode != null ) - { - InputPort indexXPort = GetInputPortByUniqueId( 0 ); - if( m_referenceNode.IsJagged ) - { - InputPort indexYPort = GetInputPortByUniqueId( 2 ); - string arrayIndexX = indexXPort.IsConnected ? indexXPort.GeneratePortInstructions( ref dataCollector ) : m_indexX.ToString(); - string arrayIndexY = indexYPort.IsConnected ? indexYPort.GeneratePortInstructions( ref dataCollector ) : m_indexY.ToString(); - result = m_referenceNode.GetArrayValue( arrayIndexX, arrayIndexY ); - } - else - { - string arrayIndexX = indexXPort.IsConnected ? indexXPort.GeneratePortInstructions( ref dataCollector ) : m_indexX.ToString(); - result = m_referenceNode.GetArrayValue( arrayIndexX ); - } - } - m_outputPorts[ 0 ].SetLocalValue( result, dataCollector.PortCategory ); - return result; - } - - 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 ); - - if( m_referenceType == TexReferenceType.Instance ) - return GenerateInstancedShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); - - string dataType = UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, AvailableTypesValues[ m_type ] ); - - InputPort indexXPort = GetInputPortByUniqueId( 0 ); - InputPort arrayLengthXPort = GetInputPortByUniqueId( 1 ); - string result = string.Empty; - - if( m_isJagged ) - { - InputPort indexYPort = GetInputPortByUniqueId( 2 ); - InputPort arrayLengthYPort = GetInputPortByUniqueId( 3 ); - - string arrayIndexX = indexXPort.IsConnected ? indexXPort.GeneratePortInstructions( ref dataCollector ) : m_indexX.ToString(); - string arrayLengthX = arrayLengthXPort.IsConnected ? arrayLengthXPort.GeneratePortInstructions( ref dataCollector ) : m_arrayLengthX.ToString(); - - string arrayIndexY = indexYPort.IsConnected ? indexYPort.GeneratePortInstructions( ref dataCollector ) : m_indexY.ToString(); - string arrayLengthY = arrayLengthYPort.IsConnected ? arrayLengthYPort.GeneratePortInstructions( ref dataCollector ) : m_arrayLengthY.ToString(); - - dataCollector.AddToUniforms( UniqueId, dataType, string.Format( JaggedArrayFormatStr, m_name, arrayLengthX, arrayLengthY ) ); - if( m_autoRangeCheck ) - { - arrayIndexX = string.Format( "clamp({0},0,({1} - 1))", arrayIndexX, arrayLengthX ); - arrayIndexY = string.Format( "clamp({0},0,({1} - 1))", arrayIndexY, arrayLengthY ); - } - result = string.Format( JaggedArrayFormatStr, m_name, arrayIndexX, arrayIndexY ); - } - else - { - - string arrayIndex = indexXPort.IsConnected ? indexXPort.GeneratePortInstructions( ref dataCollector ) : m_indexX.ToString(); - string arrayLength = arrayLengthXPort.IsConnected ? arrayLengthXPort.GeneratePortInstructions( ref dataCollector ) : m_arrayLengthX.ToString(); - - - dataCollector.AddToUniforms( UniqueId, dataType, string.Format( ArrayFormatStr, m_name, arrayLength ) ); - - if( m_autoRangeCheck ) - arrayIndex = string.Format( "clamp({0},0,({1} - 1))", arrayIndex, arrayLength ); - - result = string.Format( ArrayFormatStr, m_name, arrayIndex ); - } - - m_outputPorts[ 0 ].SetLocalValue( result, dataCollector.PortCategory ); - return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); - } - - public void CheckIfAutoRegister( ref MasterNodeDataCollector dataCollector ) - { - if( m_referenceType == TexReferenceType.Object && m_autoRegister && m_connStatus != NodeConnectionStatus.Connected ) - { - string dataType = UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, AvailableTypesValues[ m_type ] ); - if( m_isJagged ) - { - dataCollector.AddToUniforms( UniqueId, dataType, string.Format( JaggedArrayFormatStr, m_name, m_arrayLengthX, m_arrayLengthY ) ); - } - else - { - dataCollector.AddToUniforms( UniqueId, dataType, string.Format( ArrayFormatStr, m_name, m_arrayLengthX ) ); - } - } - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_name ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_indexX ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_arrayLengthX ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_type ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_autoRangeCheck ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_isJagged ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_indexY ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_arrayLengthY ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_autoRegister ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_referenceType ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_referenceNodeId ); - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - m_name = GetCurrentParam( ref nodeParams ); - m_indexX = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - m_arrayLengthX = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - m_type = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - m_autoRangeCheck = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - if( UIUtils.CurrentShaderVersion() > 15801 ) - { - m_isJagged = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - m_indexY = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - m_arrayLengthY = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - m_autoRegister = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - m_referenceType = (TexReferenceType)Enum.Parse( typeof( TexReferenceType ), GetCurrentParam( ref nodeParams ) ); - m_referenceNodeId = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - } - SetAdditonalTitleText( string.Format( Constants.SubTitleValueFormatStr, m_name ) ); - UpdatePorts(); - } - - public override void RefreshExternalReferences() - { - base.RefreshExternalReferences(); - if( m_referenceType == TexReferenceType.Instance && m_referenceNodeId > -1 ) - { - m_referenceNode = UIUtils.GetNode( m_referenceNodeId ) as GlobalArrayNode; - if( m_referenceNode != null ) - { - m_referenceArrayId = UIUtils.GetGlobalArrayNodeRegisterId( m_referenceNodeId ); - UpdatePorts(); - } - else - { - m_referenceNodeId = -1; - } - } - } - - public bool AutoRegister { get { return m_autoRegister; } } - public bool IsJagged { get { return m_isJagged; } } - public bool Updated { get { return m_updated; } } - public override string DataToArray { get { return m_name; } } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/GlobalArrayNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/GlobalArrayNode.cs.meta deleted file mode 100644 index c0171212..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/GlobalArrayNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 833b18e1479dbd24c80c5b990e16e2bb -timeCreated: 1499769855 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/GradientNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/GradientNode.cs deleted file mode 100644 index b8f9437a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/GradientNode.cs +++ /dev/null @@ -1,191 +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( "Gradient", "Constants And Properties", "Gradient property" )] - public sealed class GradientNode : ParentNode - { - [SerializeField] - private Gradient m_gradient = new Gradient(); - - private string m_functionHeader = "NewGradient( {0}, {1}, {2}," + - " {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}," + - " {11}, {12}, {13}, {14}, {15}, {16}, {17}, {18} )"; - private string m_functionBody = string.Empty; - - private string m_functionHeaderStruct = "Gradient( {0} )"; - private string m_functionBodyStruct = string.Empty; - - public Gradient Gradient { get { return m_gradient; } } - - public GradientNode() : base() { } - public GradientNode( int uniqueId, float x, float y, float width, float height ) : base( uniqueId, x, y, width, height ) { } - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_insideSize.Set( 128, m_insideSize.y ); - AddOutputPort( WirePortDataType.OBJECT, Constants.EmptyPortValue ); - m_autoWrapProperties = true; - m_textLabelWidth = 100; - } - - public override void DrawProperties() - { - base.DrawProperties(); - m_gradient = EditorGUILayoutEx.GradientField( "Gradient", m_gradient ); - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - - if( !m_isVisible ) - return; - - m_gradient = EditorGUIEx.GradientField( m_remainingBox, m_gradient ); - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - m_functionBodyStruct = string.Empty; - m_functionBody = string.Empty; - if( !dataCollector.IsSRP ) - { - GenerateGradientStruct( ref m_functionBodyStruct ); - dataCollector.AddFunctions( m_functionHeaderStruct, m_functionBodyStruct, "0" ); - GenerateGradient( ref m_functionBody ); - } - else - { - dataCollector.AddToIncludes( UniqueId, "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" ); - } - - string[] colors = new string[ 8 ]; - for( int i = 0; i < 8; i++ ) - { - if( i < m_gradient.colorKeys.Length ) - { - colors[ i ] = "float4( "+ m_gradient.colorKeys[ i ].color.r + ", "+ m_gradient.colorKeys[ i ].color.g + ", "+ m_gradient.colorKeys[ i ].color.b + ", "+ m_gradient.colorKeys[ i ].time + " )"; - } - else - { - colors[ i ] = "0"; - } - } - - string[] alphas = new string[ 8 ]; - for( int i = 0; i < 8; i++ ) - { - if( i < m_gradient.alphaKeys.Length ) - { - alphas[ i ] = "float2( " + m_gradient.alphaKeys[ i ].alpha + ", " + m_gradient.alphaKeys[ i ].time + " )"; - } - else - { - alphas[ i ] = "0"; - } - } - - string functionResult = dataCollector.AddFunctions( m_functionHeader, m_functionBody, (int)m_gradient.mode, m_gradient.colorKeys.Length, m_gradient.alphaKeys.Length - , colors[ 0 ], colors[ 1 ], colors[ 2 ], colors[ 3 ], colors[ 4 ], colors[ 5 ], colors[ 6 ], colors[ 7 ] - , alphas[ 0 ], alphas[ 1 ], alphas[ 2 ], alphas[ 3 ], alphas[ 4 ], alphas[ 5 ], alphas[ 6 ], alphas[ 7 ] ); - - dataCollector.AddLocalVariable( UniqueId, "Gradient gradient" + UniqueId + " = " + functionResult + ";" ); - - return "gradient" + UniqueId; - } - - public static void GenerateGradientStruct( ref string body ) - { - body = string.Empty; - IOUtils.AddFunctionHeader( ref body, "struct Gradient" ); - IOUtils.AddFunctionLine( ref body, "int type;" ); - IOUtils.AddFunctionLine( ref body, "int colorsLength;" ); - IOUtils.AddFunctionLine( ref body, "int alphasLength;" ); - IOUtils.AddFunctionLine( ref body, "float4 colors[8];" ); - IOUtils.AddFunctionLine( ref body, "float2 alphas[8];" ); - IOUtils.AddSingleLineFunction( ref body, "};\n" ); - } - - public static void GenerateGradient( ref string body ) - { - body = string.Empty; - IOUtils.AddFunctionHeader( ref body, "Gradient NewGradient(int type, int colorsLength, int alphasLength, \n\t\tfloat4 colors0, float4 colors1, float4 colors2, float4 colors3, float4 colors4, float4 colors5, float4 colors6, float4 colors7,\n\t\tfloat2 alphas0, float2 alphas1, float2 alphas2, float2 alphas3, float2 alphas4, float2 alphas5, float2 alphas6, float2 alphas7)" ); - IOUtils.AddFunctionLine( ref body, "Gradient g;" ); - IOUtils.AddFunctionLine( ref body, "g.type = type;" ); - IOUtils.AddFunctionLine( ref body, "g.colorsLength = colorsLength;" ); - IOUtils.AddFunctionLine( ref body, "g.alphasLength = alphasLength;" ); - IOUtils.AddFunctionLine( ref body, "g.colors[ 0 ] = colors0;" ); - IOUtils.AddFunctionLine( ref body, "g.colors[ 1 ] = colors1;" ); - IOUtils.AddFunctionLine( ref body, "g.colors[ 2 ] = colors2;" ); - IOUtils.AddFunctionLine( ref body, "g.colors[ 3 ] = colors3;" ); - IOUtils.AddFunctionLine( ref body, "g.colors[ 4 ] = colors4;" ); - IOUtils.AddFunctionLine( ref body, "g.colors[ 5 ] = colors5;" ); - IOUtils.AddFunctionLine( ref body, "g.colors[ 6 ] = colors6;" ); - IOUtils.AddFunctionLine( ref body, "g.colors[ 7 ] = colors7;" ); - IOUtils.AddFunctionLine( ref body, "g.alphas[ 0 ] = alphas0;" ); - IOUtils.AddFunctionLine( ref body, "g.alphas[ 1 ] = alphas1;" ); - IOUtils.AddFunctionLine( ref body, "g.alphas[ 2 ] = alphas2;" ); - IOUtils.AddFunctionLine( ref body, "g.alphas[ 3 ] = alphas3;" ); - IOUtils.AddFunctionLine( ref body, "g.alphas[ 4 ] = alphas4;" ); - IOUtils.AddFunctionLine( ref body, "g.alphas[ 5 ] = alphas5;" ); - IOUtils.AddFunctionLine( ref body, "g.alphas[ 6 ] = alphas6;" ); - IOUtils.AddFunctionLine( ref body, "g.alphas[ 7 ] = alphas7;" ); - IOUtils.AddFunctionLine( ref body, "return g;" ); - IOUtils.CloseFunctionBody( ref body ); - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - m_gradient.mode = (GradientMode)Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - int colorCount = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - int alphaCount = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - - var colorKeys = new GradientColorKey[ colorCount ]; - for( int i = 0; i < colorCount; i++ ) - { - Vector4 colorKey = IOUtils.StringToVector4( GetCurrentParam( ref nodeParams ) ); - colorKeys[ i ].color = colorKey; - colorKeys[ i ].time = colorKey.w; - } - m_gradient.colorKeys = colorKeys; - - var alphaKeys = new GradientAlphaKey[ alphaCount ]; - for( int i = 0; i < alphaCount; i++ ) - { - Vector2 alphaKey = IOUtils.StringToVector2( GetCurrentParam( ref nodeParams ) ); - alphaKeys[ i ].alpha = alphaKey.x; - alphaKeys[ i ].time = alphaKey.y; - } - m_gradient.alphaKeys = alphaKeys; - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, (int)m_gradient.mode ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_gradient.colorKeys.Length ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_gradient.alphaKeys.Length ); - - for( int i = 0; i < m_gradient.colorKeys.Length; i++ ) - { - Vector4 colorKey = new Vector4( m_gradient.colorKeys[ i ].color.r, m_gradient.colorKeys[ i ].color.g, m_gradient.colorKeys[ i ].color.b, m_gradient.colorKeys[ i ].time) ; - IOUtils.AddFieldValueToString( ref nodeInfo, IOUtils.Vector4ToString( colorKey ) ); - } - - for( int i = 0; i < m_gradient.alphaKeys.Length; i++ ) - { - Vector2 alphaKey = new Vector4( m_gradient.alphaKeys[ i ].alpha, m_gradient.alphaKeys[ i ].time ); - IOUtils.AddFieldValueToString( ref nodeInfo, IOUtils.Vector2ToString( alphaKey ) ); - } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/GradientNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/GradientNode.cs.meta deleted file mode 100644 index cb9b560a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/GradientNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 98100a8a545b8ce42bc5657fd40a24a5 -timeCreated: 1481126955 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/IntNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/IntNode.cs deleted file mode 100644 index 3368c05d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/IntNode.cs +++ /dev/null @@ -1,281 +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( "Int", "Constants And Properties", "Int property", null, KeyCode.Alpha0 )] - public sealed class IntNode : PropertyNode - { - [SerializeField] - private int m_defaultValue; - - [SerializeField] - private int m_materialValue; - - private const float LabelWidth = 8; - - private int m_cachedPropertyId = -1; - - private bool m_isEditingFields; - private int m_previousValue; - private string m_fieldText = "0"; - - public IntNode() : base() { } - public IntNode( int uniqueId, float x, float y, float width, float height ) : base( uniqueId, x, y, width, height ) { } - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - GlobalTypeWarningText = string.Format( GlobalTypeWarningText, "Int" ); - AddOutputPort( WirePortDataType.INT, Constants.EmptyPortValue ); - m_insideSize.Set( 50, 10 ); - m_selectedLocation = PreviewLocation.BottomCenter; - m_drawPrecisionUI = false; - m_showHybridInstancedUI = true; - m_availableAttribs.Add( new PropertyAttributes( "Enum", "[Enum]" ) ); - m_previewShaderGUID = "0f64d695b6ffacc469f2dd31432a232a"; - m_srpBatcherCompatible = true; - } - - protected override void OnUniqueIDAssigned() - { - base.OnUniqueIDAssigned(); - UIUtils.RegisterFloatIntNode( this ); - } - - public override void Destroy() - { - base.Destroy(); - UIUtils.UnregisterFloatIntNode( this ); - } - - public override void OnDirtyProperty() - { - UIUtils.UpdateFloatIntDataNode( UniqueId, PropertyInspectorName ); - } - - public override void RefreshExternalReferences() - { - base.RefreshExternalReferences(); - OnPropertyNameChanged(); - OnDirtyProperty(); - } - - public override void SetPreviewInputs() - { - base.SetPreviewInputs(); - - if( m_cachedPropertyId == -1 ) - m_cachedPropertyId = Shader.PropertyToID( "_InputInt" ); - - if( m_materialMode && m_currentParameterType != PropertyType.Constant ) - PreviewMaterial.SetInt( m_cachedPropertyId, m_materialValue ); - else - PreviewMaterial.SetInt( m_cachedPropertyId, m_defaultValue ); - } - - - public override void CopyDefaultsToMaterial() - { - m_materialValue = m_defaultValue; - } - - public override void DrawSubProperties() - { - m_defaultValue = EditorGUILayoutIntField( Constants.DefaultValueLabel, m_defaultValue ); - } - - public override void DrawMaterialProperties() - { - if( m_materialMode ) - EditorGUI.BeginChangeCheck(); - - m_materialValue = EditorGUILayoutIntField( Constants.MaterialValueLabel, m_materialValue ); - - if( m_materialMode && EditorGUI.EndChangeCheck() ) - { - m_requireMaterialUpdate = true; - } - } - - public override void OnNodeLayout( DrawInfo drawInfo ) - { - base.OnNodeLayout( drawInfo ); - - m_propertyDrawPos = m_remainingBox; - m_propertyDrawPos.x = m_remainingBox.x - LabelWidth * drawInfo.InvertedZoom; - m_propertyDrawPos.width = drawInfo.InvertedZoom * Constants.FLOAT_DRAW_WIDTH_FIELD_SIZE; - m_propertyDrawPos.height = drawInfo.InvertedZoom * Constants.FLOAT_DRAW_HEIGHT_FIELD_SIZE; - } - - public override void DrawGUIControls( DrawInfo drawInfo ) - { - base.DrawGUIControls( drawInfo ); - - if( drawInfo.CurrentEventType != EventType.MouseDown ) - return; - - Rect hitBox = m_remainingBox; - hitBox.xMin -= LabelWidth * drawInfo.InvertedZoom; - bool insideBox = hitBox.Contains( drawInfo.MousePosition ); - - if( insideBox ) - { - GUI.FocusControl( null ); - m_isEditingFields = true; - } - else if( m_isEditingFields && !insideBox ) - { - GUI.FocusControl( null ); - m_isEditingFields = false; - } - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - - if( !m_isVisible ) - return; - - if( m_isEditingFields && m_currentParameterType != PropertyType.Global ) - { - float labelWidth = EditorGUIUtility.labelWidth; - EditorGUIUtility.labelWidth = LabelWidth * drawInfo.InvertedZoom; - - if( m_materialMode && m_currentParameterType != PropertyType.Constant ) - { - EditorGUI.BeginChangeCheck(); - m_materialValue = EditorGUIIntField( m_propertyDrawPos, " ", m_materialValue, UIUtils.MainSkin.textField ); - if( EditorGUI.EndChangeCheck() ) - { - PreviewIsDirty = true; - m_requireMaterialUpdate = true; - if( m_currentParameterType != PropertyType.Constant ) - BeginDelayedDirtyProperty(); - } - } - else - { - EditorGUI.BeginChangeCheck(); - - m_defaultValue = EditorGUIIntField( m_propertyDrawPos, " ", m_defaultValue, UIUtils.MainSkin.textField ); - - if( EditorGUI.EndChangeCheck() ) - { - PreviewIsDirty = true; - BeginDelayedDirtyProperty(); - } - } - EditorGUIUtility.labelWidth = labelWidth; - } - else if( drawInfo.CurrentEventType == EventType.Repaint ) - { - bool guiEnabled = GUI.enabled; - GUI.enabled = m_currentParameterType != PropertyType.Global; - Rect fakeField = m_propertyDrawPos; - fakeField.xMin += LabelWidth * drawInfo.InvertedZoom; - if( GUI.enabled ) - { - Rect fakeLabel = m_propertyDrawPos; - fakeLabel.xMax = fakeField.xMin; - EditorGUIUtility.AddCursorRect( fakeLabel, MouseCursor.SlideArrow ); - EditorGUIUtility.AddCursorRect( fakeField, MouseCursor.Text ); - } - bool currMode = m_materialMode && m_currentParameterType != PropertyType.Constant; - int value = currMode ? m_materialValue : m_defaultValue; - - if( m_previousValue != value ) - { - m_previousValue = value; - m_fieldText = value.ToString(); - } - - GUI.Label( fakeField, m_fieldText, UIUtils.MainSkin.textField ); - GUI.enabled = guiEnabled; - } - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); - - if( m_currentParameterType != PropertyType.Constant ) - return PropertyData( dataCollector.PortCategory ); - - return m_defaultValue.ToString(); - } - - public override string GetPropertyValue() - { - return PropertyAttributes + m_propertyName + "(\"" + m_propertyInspectorName + "\", Int) = " + m_defaultValue; - } - - public override void UpdateMaterial( Material mat ) - { - base.UpdateMaterial( mat ); - if( UIUtils.IsProperty( m_currentParameterType ) && !InsideShaderFunction ) - { - mat.SetInt( m_propertyName, m_materialValue ); - } - } - - public override void SetMaterialMode( Material mat, bool fetchMaterialValues ) - { - base.SetMaterialMode( mat, fetchMaterialValues ); - if( fetchMaterialValues && m_materialMode && UIUtils.IsProperty( m_currentParameterType ) && mat.HasProperty( m_propertyName ) ) - { - m_materialValue = mat.GetInt( m_propertyName ); - } - } - - public override void ForceUpdateFromMaterial( Material material ) - { - if( UIUtils.IsProperty( m_currentParameterType ) && material.HasProperty( m_propertyName ) ) - { - m_materialValue = material.GetInt( m_propertyName ); - PreviewIsDirty = true; - } - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - m_defaultValue = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - if( UIUtils.CurrentShaderVersion() > 14101 ) - m_materialValue = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_defaultValue ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_materialValue ); - } - - public override string GetPropertyValStr() - { - return ( m_materialMode && m_currentParameterType != PropertyType.Constant ) ? - m_materialValue.ToString( Mathf.Abs( m_materialValue ) > 1000 ? Constants.PropertyBigIntFormatLabel : Constants.PropertyIntFormatLabel ) : - m_defaultValue.ToString( Mathf.Abs( m_defaultValue ) > 1000 ? Constants.PropertyBigIntFormatLabel : Constants.PropertyIntFormatLabel ); - } - - public override void SetGlobalValue() { Shader.SetGlobalInt( m_propertyName, m_defaultValue ); } - public override void FetchGlobalValue() { m_materialValue = Shader.GetGlobalInt( m_propertyName ); } - public int Value - { - get { return m_defaultValue; } - set { m_defaultValue = value; } - } - - public void SetMaterialValueFromInline( int val ) - { - m_materialValue = val; - m_requireMaterialUpdate = true; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/IntNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/IntNode.cs.meta deleted file mode 100644 index 0bbac6ff..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/IntNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 86df2da3da3b1eb4493b968b47030b17 -timeCreated: 1481126957 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Matrix3X3Node.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Matrix3X3Node.cs deleted file mode 100644 index 02266c8b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Matrix3X3Node.cs +++ /dev/null @@ -1,261 +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( "Matrix3X3", "Constants And Properties", "Matrix3X3 property" )] - public sealed class Matrix3X3Node : MatrixParentNode - { - private string[,] m_fieldText = new string[ 3, 3 ] { { "0", "0", "0" }, { "0", "0", "0" }, { "0", "0", "0" } }; - public Matrix3X3Node() : base() { } - public Matrix3X3Node( int uniqueId, float x, float y, float width, float height ) : base( uniqueId, x, y, width, height ) { } - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - GlobalTypeWarningText = string.Format( GlobalTypeWarningText, "Matrix" ); - AddOutputPort( WirePortDataType.FLOAT3x3, Constants.EmptyPortValue ); - m_insideSize.Set( Constants.FLOAT_DRAW_WIDTH_FIELD_SIZE * 3 + Constants.FLOAT_WIDTH_SPACING * 2, Constants.FLOAT_DRAW_HEIGHT_FIELD_SIZE * 3 + Constants.FLOAT_WIDTH_SPACING * 2 + Constants.OUTSIDE_WIRE_MARGIN ); - //m_defaultValue = new Matrix4x4(); - //m_materialValue = new Matrix4x4(); - m_drawPreview = false; - } - - public override void CopyDefaultsToMaterial() - { - m_materialValue = m_defaultValue; - } - - public override void DrawSubProperties() - { - EditorGUILayout.LabelField( Constants.DefaultValueLabel ); - for( int row = 0; row < 3; row++ ) - { - EditorGUILayout.BeginHorizontal(); - for( int column = 0; column < 3; column++ ) - { - m_defaultValue[ row, column ] = EditorGUILayoutFloatField( string.Empty, m_defaultValue[ row, column ], GUILayout.MaxWidth( 76 ) ); - } - EditorGUILayout.EndHorizontal(); - } - } - - public override void DrawMaterialProperties() - { - if( m_materialMode ) - EditorGUI.BeginChangeCheck(); - - EditorGUILayout.LabelField( Constants.MaterialValueLabel ); - for( int row = 0; row < 3; row++ ) - { - EditorGUILayout.BeginHorizontal(); - for( int column = 0; column < 3; column++ ) - { - m_materialValue[ row, column ] = EditorGUILayoutFloatField( string.Empty, m_materialValue[ row, column ], GUILayout.MaxWidth( 76 ) ); - } - EditorGUILayout.EndHorizontal(); - } - - if( m_materialMode && EditorGUI.EndChangeCheck() ) - m_requireMaterialUpdate = true; - } - - public override void OnNodeLayout( DrawInfo drawInfo ) - { - base.OnNodeLayout( drawInfo ); - - m_propertyDrawPos.position = m_remainingBox.position; - m_propertyDrawPos.width = drawInfo.InvertedZoom * Constants.FLOAT_DRAW_WIDTH_FIELD_SIZE; - m_propertyDrawPos.height = drawInfo.InvertedZoom * Constants.FLOAT_DRAW_HEIGHT_FIELD_SIZE; - } - - public override void DrawGUIControls( DrawInfo drawInfo ) - { - base.DrawGUIControls( drawInfo ); - - if( drawInfo.CurrentEventType != EventType.MouseDown ) - return; - - Rect hitBox = m_remainingBox; - hitBox.height = m_insideSize.y * drawInfo.InvertedZoom; - bool insideBox = hitBox.Contains( drawInfo.MousePosition ); - - if( insideBox ) - { - GUI.FocusControl( null ); - m_isEditingFields = true; - } - else if( m_isEditingFields && !insideBox ) - { - GUI.FocusControl( null ); - m_isEditingFields = false; - } - } - - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - - if( !m_isVisible ) - return; - - if( m_isEditingFields && m_currentParameterType != PropertyType.Global ) - { - bool currMode = m_materialMode && m_currentParameterType != PropertyType.Constant; - Matrix4x4 value = currMode ? m_materialValue : m_defaultValue; - - EditorGUI.BeginChangeCheck(); - for( int row = 0; row < 3; row++ ) - { - for( int column = 0; column < 3; column++ ) - { - m_propertyDrawPos.position = m_remainingBox.position + Vector2.Scale( m_propertyDrawPos.size, new Vector2( column, row ) ) + new Vector2( Constants.FLOAT_WIDTH_SPACING * drawInfo.InvertedZoom * column, Constants.FLOAT_WIDTH_SPACING * drawInfo.InvertedZoom * row ); - value[ row, column ] = EditorGUIFloatField( m_propertyDrawPos, string.Empty, value[ row, column ], UIUtils.MainSkin.textField ); - } - } - - if( currMode ) - { - m_materialValue = value; - } - else - { - m_defaultValue = value; - } - - if( EditorGUI.EndChangeCheck() ) - { - m_requireMaterialUpdate = m_materialMode; - BeginDelayedDirtyProperty(); - } - } - else if( drawInfo.CurrentEventType == EventType.Repaint ) - { - bool guiEnabled = GUI.enabled; - GUI.enabled = m_currentParameterType != PropertyType.Global; - - bool currMode = m_materialMode && m_currentParameterType != PropertyType.Constant; - Matrix4x4 value = currMode ? m_materialValue : m_defaultValue; - for( int row = 0; row < 3; row++ ) - { - for( int column = 0; column < 3; column++ ) - { - Rect fakeField = m_propertyDrawPos; - fakeField.position = m_remainingBox.position + Vector2.Scale( m_propertyDrawPos.size, new Vector2( column, row ) ) + new Vector2( Constants.FLOAT_WIDTH_SPACING * drawInfo.InvertedZoom * column, Constants.FLOAT_WIDTH_SPACING * drawInfo.InvertedZoom * row ); - if( GUI.enabled ) - EditorGUIUtility.AddCursorRect( fakeField, MouseCursor.Text ); - - if( m_previousValue[ row, column ] != value[ row, column ] ) - { - m_previousValue[ row, column ] = value[ row, column ]; - m_fieldText[ row, column ] = value[ row, column ].ToString(); - } - - GUI.Label( fakeField, m_fieldText[ row, column ], UIUtils.MainSkin.textField ); - } - } - GUI.enabled = guiEnabled; - } - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); - m_precisionString = UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, m_outputPorts[ 0 ].DataType ); - if( m_currentParameterType != PropertyType.Constant ) - { - if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) - return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); - string localVarName = PropertyData( dataCollector.PortCategory ) + "Local3x3"; - string localVarValue = string.Format( "float3x3({0}._m00,{0}._m01,{0}._m02,{0}._m10,{0}._m11,{0}._m12,{0}._m20,{0}._m21,{0}._m22 )", PropertyData( dataCollector.PortCategory ) ); - RegisterLocalVariable( 0, localVarValue, ref dataCollector, localVarName ); - return localVarName; - } - - Matrix4x4 value = m_defaultValue; - - return m_precisionString + "(" + value[ 0, 0 ] + "," + value[ 0, 1 ] + "," + value[ 0, 2 ] + "," + - +value[ 1, 0 ] + "," + value[ 1, 1 ] + "," + value[ 1, 2 ] + "," + - +value[ 2, 0 ] + "," + value[ 2, 1 ] + "," + value[ 2, 2 ] + ")"; - - } - - - public override void UpdateMaterial( Material mat ) - { - base.UpdateMaterial( mat ); - if( UIUtils.IsProperty( m_currentParameterType ) && !InsideShaderFunction ) - { - Shader.SetGlobalMatrix( m_propertyName, m_materialValue ); - //mat.SetMatrix( m_propertyName, m_materialValue ); - } - } - - public override bool GetUniformData( out string dataType, out string dataName, ref bool fullValue ) - { - dataType = UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, WirePortDataType.FLOAT4x4 ); - dataName = m_propertyName; - return true; - } - - public override void SetMaterialMode( Material mat, bool fetchMaterialValues ) - { - base.SetMaterialMode( mat, fetchMaterialValues ); - if( fetchMaterialValues && m_materialMode && UIUtils.IsProperty( m_currentParameterType ) && mat.HasProperty( m_propertyName ) ) - { - m_materialValue = mat.GetMatrix( m_propertyName ); - } - } - - public override void ForceUpdateFromMaterial( Material material ) - { - if( UIUtils.IsProperty( m_currentParameterType ) && material.HasProperty( m_propertyName ) ) - { - m_materialValue = material.GetMatrix( m_propertyName ); - PreviewIsDirty = true; - } - } - - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - m_defaultValue = IOUtils.StringToMatrix3x3( GetCurrentParam( ref nodeParams ) ); - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, IOUtils.Matrix3x3ToString( m_defaultValue ) ); - } - - public override void ReadAdditionalClipboardData( ref string[] nodeParams ) - { - base.ReadAdditionalClipboardData( ref nodeParams ); - m_materialValue = IOUtils.StringToMatrix3x3( GetCurrentParam( ref nodeParams ) ); - } - - public override void WriteAdditionalClipboardData( ref string nodeInfo ) - { - base.WriteAdditionalClipboardData( ref nodeInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, IOUtils.Matrix3x3ToString( m_materialValue ) ); - } - - public override string GetPropertyValStr() - { - return ( m_materialMode && m_currentParameterType != PropertyType.Constant ) ? m_materialValue[ 0, 0 ].ToString( Mathf.Abs( m_materialValue[ 0, 0 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_materialValue[ 0, 1 ].ToString( Mathf.Abs( m_materialValue[ 0, 1 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_materialValue[ 0, 2 ].ToString( Mathf.Abs( m_materialValue[ 0, 2 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.MATRIX_DATA_SEPARATOR + - m_materialValue[ 1, 0 ].ToString( Mathf.Abs( m_materialValue[ 1, 0 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_materialValue[ 1, 1 ].ToString( Mathf.Abs( m_materialValue[ 1, 1 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_materialValue[ 1, 2 ].ToString( Mathf.Abs( m_materialValue[ 1, 2 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.MATRIX_DATA_SEPARATOR + - m_materialValue[ 2, 0 ].ToString( Mathf.Abs( m_materialValue[ 2, 0 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_materialValue[ 2, 1 ].ToString( Mathf.Abs( m_materialValue[ 2, 1 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_materialValue[ 2, 2 ].ToString( Mathf.Abs( m_materialValue[ 2, 2 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) : - - m_defaultValue[ 0, 0 ].ToString( Mathf.Abs( m_defaultValue[ 0, 0 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_defaultValue[ 0, 1 ].ToString( Mathf.Abs( m_defaultValue[ 0, 1 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_defaultValue[ 0, 2 ].ToString( Mathf.Abs( m_defaultValue[ 0, 2 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.MATRIX_DATA_SEPARATOR + - m_defaultValue[ 1, 0 ].ToString( Mathf.Abs( m_defaultValue[ 1, 0 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_defaultValue[ 1, 1 ].ToString( Mathf.Abs( m_defaultValue[ 1, 1 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_defaultValue[ 1, 2 ].ToString( Mathf.Abs( m_defaultValue[ 1, 2 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.MATRIX_DATA_SEPARATOR + - m_defaultValue[ 2, 0 ].ToString( Mathf.Abs( m_defaultValue[ 2, 0 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_defaultValue[ 2, 1 ].ToString( Mathf.Abs( m_defaultValue[ 2, 1 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_defaultValue[ 2, 2 ].ToString( Mathf.Abs( m_defaultValue[ 2, 2 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ); - } - - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Matrix3X3Node.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Matrix3X3Node.cs.meta deleted file mode 100644 index 4c852d9d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Matrix3X3Node.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 01e5a5829caac674fa819ed229de31b6 -timeCreated: 1481126953 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Matrix4X4Node.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Matrix4X4Node.cs deleted file mode 100644 index 44b99702..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Matrix4X4Node.cs +++ /dev/null @@ -1,248 +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( "Matrix4X4", "Constants And Properties", "Matrix4X4 property" )] - public sealed class Matrix4X4Node : MatrixParentNode - { - private string[,] m_fieldText = new string[ 4, 4 ] { { "0", "0", "0", "0" }, { "0", "0", "0", "0" }, { "0", "0", "0", "0" }, { "0", "0", "0", "0" } }; - public Matrix4X4Node() : base() { } - public Matrix4X4Node( int uniqueId, float x, float y, float width, float height ) : base( uniqueId, x, y, width, height ) { } - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - GlobalTypeWarningText = string.Format( GlobalTypeWarningText, "Matrix" ); - AddOutputPort( WirePortDataType.FLOAT4x4, Constants.EmptyPortValue ); - m_insideSize.Set( Constants.FLOAT_DRAW_WIDTH_FIELD_SIZE * 4 + Constants.FLOAT_WIDTH_SPACING * 3, Constants.FLOAT_DRAW_HEIGHT_FIELD_SIZE * 4 + Constants.FLOAT_WIDTH_SPACING * 3 + Constants.OUTSIDE_WIRE_MARGIN ); - //m_defaultValue = new Matrix4x4(); - //m_materialValue = new Matrix4x4(); - m_drawPreview = false; - } - - public override void CopyDefaultsToMaterial() - { - m_materialValue = m_defaultValue; - } - - public override void DrawSubProperties() - { - EditorGUILayout.LabelField( Constants.DefaultValueLabel ); - for ( int row = 0; row < 4; row++ ) - { - EditorGUILayout.BeginHorizontal(); - for ( int column = 0; column < 4; column++ ) - { - m_defaultValue[ row, column ] = EditorGUILayoutFloatField( string.Empty, m_defaultValue[ row, column ], GUILayout.MaxWidth( 55 ) ); - } - EditorGUILayout.EndHorizontal(); - } - } - - public override void DrawMaterialProperties() - { - if ( m_materialMode ) - EditorGUI.BeginChangeCheck(); - - EditorGUILayout.LabelField( Constants.MaterialValueLabel ); - for ( int row = 0; row < 4; row++ ) - { - EditorGUILayout.BeginHorizontal(); - for ( int column = 0; column < 4; column++ ) - { - m_materialValue[ row, column ] = EditorGUILayoutFloatField( string.Empty, m_materialValue[ row, column ], GUILayout.MaxWidth( 55 ) ); - } - EditorGUILayout.EndHorizontal(); - } - - if ( m_materialMode && EditorGUI.EndChangeCheck() ) - m_requireMaterialUpdate = true; - } - - public override void OnNodeLayout( DrawInfo drawInfo ) - { - base.OnNodeLayout( drawInfo ); - - m_propertyDrawPos.position = m_remainingBox.position; - m_propertyDrawPos.width = drawInfo.InvertedZoom * Constants.FLOAT_DRAW_WIDTH_FIELD_SIZE; - m_propertyDrawPos.height = drawInfo.InvertedZoom * Constants.FLOAT_DRAW_HEIGHT_FIELD_SIZE; - } - - public override void DrawGUIControls( DrawInfo drawInfo ) - { - base.DrawGUIControls( drawInfo ); - - if ( drawInfo.CurrentEventType != EventType.MouseDown ) - return; - - Rect hitBox = m_remainingBox; - hitBox.height = m_insideSize.y * drawInfo.InvertedZoom; - bool insideBox = hitBox.Contains( drawInfo.MousePosition ); - - if ( insideBox ) - { - GUI.FocusControl( null ); - m_isEditingFields = true; - } - else if ( m_isEditingFields && !insideBox ) - { - GUI.FocusControl( null ); - m_isEditingFields = false; - } - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - - if ( !m_isVisible ) - return; - - if ( m_isEditingFields && m_currentParameterType != PropertyType.Global ) - { - bool currMode = m_materialMode && m_currentParameterType != PropertyType.Constant; - Matrix4x4 value = currMode ? m_materialValue : m_defaultValue; - - EditorGUI.BeginChangeCheck(); - for ( int row = 0; row < 4; row++ ) - { - for ( int column = 0; column < 4; column++ ) - { - m_propertyDrawPos.position = m_remainingBox.position + Vector2.Scale( m_propertyDrawPos.size, new Vector2( column, row ) ) + new Vector2( Constants.FLOAT_WIDTH_SPACING * drawInfo.InvertedZoom * column, Constants.FLOAT_WIDTH_SPACING * drawInfo.InvertedZoom * row ); - value[ row, column ] = EditorGUIFloatField( m_propertyDrawPos, string.Empty, value[ row, column ], UIUtils.MainSkin.textField ); - } - } - - if ( currMode ) - { - m_materialValue = value; - } - else - { - m_defaultValue = value; - } - - if ( EditorGUI.EndChangeCheck() ) - { - m_requireMaterialUpdate = m_materialMode; - BeginDelayedDirtyProperty(); - } - } - else if ( drawInfo.CurrentEventType == EventType.Repaint ) - { - bool guiEnabled = GUI.enabled; - GUI.enabled = m_currentParameterType != PropertyType.Global; - - bool currMode = m_materialMode && m_currentParameterType != PropertyType.Constant; - Matrix4x4 value = currMode ? m_materialValue : m_defaultValue; - for ( int row = 0; row < 4; row++ ) - { - for ( int column = 0; column < 4; column++ ) - { - Rect fakeField = m_propertyDrawPos; - fakeField.position = m_remainingBox.position + Vector2.Scale( m_propertyDrawPos.size, new Vector2( column, row ) ) + new Vector2( Constants.FLOAT_WIDTH_SPACING * drawInfo.InvertedZoom * column, Constants.FLOAT_WIDTH_SPACING * drawInfo.InvertedZoom * row ); - if( GUI.enabled ) - EditorGUIUtility.AddCursorRect( fakeField, MouseCursor.Text ); - - if ( m_previousValue[ row, column ] != value[ row, column ] ) - { - m_previousValue[ row, column ] = value[ row, column ]; - m_fieldText[ row, column ] = value[ row, column ].ToString(); - } - - GUI.Label( fakeField, m_fieldText[ row, column ], UIUtils.MainSkin.textField ); - } - } - GUI.enabled = guiEnabled; - } - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); - m_precisionString = UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, m_outputPorts[ 0 ].DataType ); - if ( m_currentParameterType != PropertyType.Constant ) - return PropertyData( dataCollector.PortCategory ); - - Matrix4x4 value = m_defaultValue; - - return m_precisionString+"(" + value[ 0, 0 ] + "," + value[ 0, 1 ] + "," + value[ 0, 2 ] + "," + value[ 0, 3 ] + "," + - +value[ 1, 0 ] + "," + value[ 1, 1 ] + "," + value[ 1, 2 ] + "," + value[ 1, 3 ] + "," + - +value[ 2, 0 ] + "," + value[ 2, 1 ] + "," + value[ 2, 2 ] + "," + value[ 2, 3 ] + "," + - +value[ 3, 0 ] + "," + value[ 3, 1 ] + "," + value[ 3, 2 ] + "," + value[ 3, 3 ] + ")"; - - } - - - public override void UpdateMaterial( Material mat ) - { - base.UpdateMaterial( mat ); - if ( UIUtils.IsProperty( m_currentParameterType ) && !InsideShaderFunction ) - { - mat.SetMatrix( m_propertyName, m_materialValue ); - } - } - - public override void SetMaterialMode( Material mat , bool fetchMaterialValues ) - { - base.SetMaterialMode( mat , fetchMaterialValues ); - if ( fetchMaterialValues && m_materialMode && UIUtils.IsProperty( m_currentParameterType ) && mat.HasProperty( m_propertyName ) ) - { - m_materialValue = mat.GetMatrix( m_propertyName ); - } - } - - public override void ForceUpdateFromMaterial( Material material ) - { - if( UIUtils.IsProperty( m_currentParameterType ) && material.HasProperty( m_propertyName ) ) - { - m_materialValue = material.GetMatrix( m_propertyName ); - PreviewIsDirty = true; - } - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - m_defaultValue = IOUtils.StringToMatrix4x4( GetCurrentParam( ref nodeParams ) ); - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, IOUtils.Matrix4x4ToString( m_defaultValue ) ); - } - - public override void ReadAdditionalClipboardData( ref string[] nodeParams ) - { - base.ReadAdditionalClipboardData( ref nodeParams ); - m_materialValue = IOUtils.StringToMatrix4x4( GetCurrentParam( ref nodeParams ) ); - } - - public override void WriteAdditionalClipboardData( ref string nodeInfo ) - { - base.WriteAdditionalClipboardData( ref nodeInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, IOUtils.Matrix4x4ToString( m_materialValue ) ); - } - - - public override string GetPropertyValStr() - { - return ( m_materialMode && m_currentParameterType != PropertyType.Constant ) ? m_materialValue[ 0, 0 ].ToString( Mathf.Abs( m_materialValue[ 0, 0 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_materialValue[ 0, 1 ].ToString( Mathf.Abs( m_materialValue[ 0, 1 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_materialValue[ 0, 2 ].ToString( Mathf.Abs( m_materialValue[ 0, 2 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_materialValue[ 0, 3 ].ToString( Mathf.Abs( m_materialValue[ 0, 3 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.MATRIX_DATA_SEPARATOR + - m_materialValue[ 1, 0 ].ToString( Mathf.Abs( m_materialValue[ 1, 0 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_materialValue[ 1, 1 ].ToString( Mathf.Abs( m_materialValue[ 1, 1 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_materialValue[ 1, 2 ].ToString( Mathf.Abs( m_materialValue[ 1, 2 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_materialValue[ 1, 3 ].ToString( Mathf.Abs( m_materialValue[ 1, 3 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.MATRIX_DATA_SEPARATOR + - m_materialValue[ 2, 0 ].ToString( Mathf.Abs( m_materialValue[ 2, 0 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_materialValue[ 2, 1 ].ToString( Mathf.Abs( m_materialValue[ 2, 1 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_materialValue[ 2, 2 ].ToString( Mathf.Abs( m_materialValue[ 2, 2 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_materialValue[ 2, 3 ].ToString( Mathf.Abs( m_materialValue[ 2, 3 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.MATRIX_DATA_SEPARATOR + - m_materialValue[ 3, 0 ].ToString( Mathf.Abs( m_materialValue[ 3, 0 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_materialValue[ 3, 1 ].ToString( Mathf.Abs( m_materialValue[ 3, 1 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_materialValue[ 3, 2 ].ToString( Mathf.Abs( m_materialValue[ 3, 2 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_materialValue[ 3, 3 ].ToString( Mathf.Abs( m_materialValue[ 3, 3 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) : - - m_defaultValue[ 0, 0 ].ToString( Mathf.Abs( m_defaultValue[ 0, 0 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_defaultValue[ 0, 1 ].ToString( Mathf.Abs( m_defaultValue[ 0, 1 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_defaultValue[ 0, 2 ].ToString( Mathf.Abs( m_defaultValue[ 0, 2 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_defaultValue[ 0, 3 ].ToString( Mathf.Abs( m_defaultValue[ 0, 3 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.MATRIX_DATA_SEPARATOR + - m_defaultValue[ 1, 0 ].ToString( Mathf.Abs( m_defaultValue[ 1, 0 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_defaultValue[ 1, 1 ].ToString( Mathf.Abs( m_defaultValue[ 1, 1 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_defaultValue[ 1, 2 ].ToString( Mathf.Abs( m_defaultValue[ 1, 2 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_defaultValue[ 1, 3 ].ToString( Mathf.Abs( m_defaultValue[ 1, 3 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.MATRIX_DATA_SEPARATOR + - m_defaultValue[ 2, 0 ].ToString( Mathf.Abs( m_defaultValue[ 2, 0 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_defaultValue[ 2, 1 ].ToString( Mathf.Abs( m_defaultValue[ 2, 1 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_defaultValue[ 2, 2 ].ToString( Mathf.Abs( m_defaultValue[ 2, 2 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_defaultValue[ 2, 3 ].ToString( Mathf.Abs( m_defaultValue[ 2, 3 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.MATRIX_DATA_SEPARATOR + - m_defaultValue[ 3, 0 ].ToString( Mathf.Abs( m_defaultValue[ 3, 0 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_defaultValue[ 3, 1 ].ToString( Mathf.Abs( m_defaultValue[ 3, 1 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_defaultValue[ 3, 2 ].ToString( Mathf.Abs( m_defaultValue[ 3, 2 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ) + IOUtils.VECTOR_SEPARATOR + m_defaultValue[ 3, 3 ].ToString( Mathf.Abs( m_defaultValue[ 3, 3 ] ) > 1000 ? Constants.PropertyBigMatrixFormatLabel : Constants.PropertyMatrixFormatLabel ); - } - - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Matrix4X4Node.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Matrix4X4Node.cs.meta deleted file mode 100644 index 10ec1a2f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Matrix4X4Node.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 4fa5db614b9379b4da27edafa0a8f4e9 -timeCreated: 1481126955 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/MatrixParentNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/MatrixParentNode.cs deleted file mode 100644 index 85e0504d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/MatrixParentNode.cs +++ /dev/null @@ -1,86 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> -using System; -using UnityEngine; - -namespace AmplifyShaderEditor -{ - [Serializable] - public class MatrixParentNode : PropertyNode - { - private readonly string[] AvailablePropertyTypeLabels = { PropertyType.Constant.ToString(), PropertyType.Global.ToString(), "Instanced" }; - private readonly int[] AvailablePropertyTypeValues = { (int)PropertyType.Constant, (int)PropertyType.Global , (int)PropertyType.InstancedProperty }; - - protected bool m_isEditingFields; - - [SerializeField] - protected Matrix4x4 m_defaultValue = Matrix4x4.identity; - - [SerializeField] - protected Matrix4x4 m_materialValue = Matrix4x4.identity; - - [NonSerialized] - protected Matrix4x4 m_previousValue; - - private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper(); - - public MatrixParentNode() : base() { } - public MatrixParentNode( int uniqueId, float x, float y, float width, float height ) : base( uniqueId, x, y, width, height ) { } - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_freeType = false; - m_showVariableMode = true; - } - - public override void AfterCommonInit() - { - base.AfterCommonInit(); - m_hasLeftDropdown = true; - m_drawAttributes = false; - m_availableAttribs.Clear(); - - if( PaddingTitleLeft == 0 ) - { - PaddingTitleLeft = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; - if( PaddingTitleRight == 0 ) - PaddingTitleRight = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; - } - } - - protected void DrawParameterType() - { - PropertyType parameterType = (PropertyType)EditorGUILayoutIntPopup( ParameterTypeStr, (int)m_currentParameterType, AvailablePropertyTypeLabels, AvailablePropertyTypeValues ); - if( parameterType != m_currentParameterType ) - { - ChangeParameterType( parameterType ); - } - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - PropertyType parameterType = (PropertyType)m_upperLeftWidget.DrawWidget( this, (int)m_currentParameterType, AvailablePropertyTypeLabels, AvailablePropertyTypeValues ); - if( parameterType != m_currentParameterType ) - { - ChangeParameterType( parameterType ); - } - } - - public override void DrawMainPropertyBlock() - { - DrawParameterType(); - base.DrawMainPropertyBlock(); - } - - public override void Destroy() - { - base.Destroy(); - m_upperLeftWidget = null; - } - - public override void SetGlobalValue() { Shader.SetGlobalMatrix( m_propertyName, m_defaultValue ); } - public override void FetchGlobalValue() { m_materialValue = Shader.GetGlobalMatrix( m_propertyName ); } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/MatrixParentNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/MatrixParentNode.cs.meta deleted file mode 100644 index ed87f49f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/MatrixParentNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: d31dc25864c509a4f967e32079a27d6f -timeCreated: 1507902748 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/PiNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/PiNode.cs deleted file mode 100644 index 659a128c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/PiNode.cs +++ /dev/null @@ -1,63 +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( "PI", "Constants And Properties", "PI constant : 3.14159265359" )] - public sealed class PiNode : ParentNode - { - public PiNode() : base() { } - public PiNode( int uniqueId, float x, float y, float width, float height ) : base( uniqueId, x, y, width, height ) { } - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT, true, "Multiplier" ); - AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); - m_textLabelWidth = 70; - InputPorts[ 0 ].FloatInternalData = 1; - m_useInternalPortData = true; - m_previewShaderGUID = "bf4a65726dab3d445a69fb1d0945c33e"; - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); - string finalValue = string.Empty; - string piString = dataCollector.IsSRP ? "PI" : "UNITY_PI"; - if( !InputPorts[ 0 ].IsConnected && InputPorts[ 0 ].FloatInternalData == 1 ) - { - finalValue = piString; - } else - { - string multiplier = InputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - finalValue = "( " + multiplier + " * " + piString + " )"; - } - - - if ( finalValue.Equals( string.Empty ) ) - { - UIUtils.ShowMessage( UniqueId, "PINode generating empty code", MessageSeverity.Warning ); - } - return finalValue; - } - - //public override void ReadFromString( ref string[] nodeParams ) - //{ - // base.ReadFromString( ref nodeParams ); - - // Removed on version 5004 - //m_value = Convert.ToSingle( GetCurrentParam( ref nodeParams ) ); - //} - - //public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - //{ - // base.WriteToString( ref nodeInfo, ref connectionsInfo ); - //} - - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/PiNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/PiNode.cs.meta deleted file mode 100644 index 64327b84..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/PiNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 7a8a03953b97a594b81b2fb71d4a57ec -timeCreated: 1481126957 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/PropertyNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/PropertyNode.cs deleted file mode 100644 index 68709954..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/PropertyNode.cs +++ /dev/null @@ -1,1767 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using System.Collections.Generic; -using UnityEngine; -using UnityEditor; - -namespace AmplifyShaderEditor -{ - public enum PropertyType - { - Constant = 0, - Property, - InstancedProperty, - Global - } - - public enum VariableMode - { - Create = 0, - Fetch - } - - [Serializable] - public class PropertyAttributes - { - public string Name; - public string Attribute; - public PropertyAttributes( string name, string attribute ) - { - Name = name; - Attribute = attribute; - } - } - - [Serializable] - public class PropertyNode : ParentNode - { - private const string LongNameEnder = "... )"; - protected int m_longNameSize = 200; - //private const string InstancedPropertyWarning = "Instanced Property option shouldn't be used on official SRP templates as all property variables are already declared as instanced inside a CBuffer.\nPlease consider changing to Property option."; - private string TooltipFormatter = "{0}\n\nName: {1}\nValue: {2}"; - protected string GlobalTypeWarningText = "Global variables must be set via a C# script using the Shader.SetGlobal{0}(...) method.\nPlease note that setting a global variable will affect all shaders which are using it."; - private const string HybridInstancedStr = "Hybrid Instanced"; - private const string AutoRegisterStr = "Auto-Register"; - private const string IgnoreVarDeclarationStr = "Variable Mode"; - private const string IsPropertyStr = "Is Property"; - private const string PropertyNameStr = "Property Name"; - private const string PropertyInspectorStr = "Name"; - protected const string EnumsStr = "Enums"; - protected const string CustomAttrStr = "Custom Attributes"; - protected const string ParameterTypeStr = "Type"; - private const string PropertyTextfieldControlName = "PropertyName"; - private const string PropertyInspTextfieldControlName = "PropertyInspectorName"; - private const string OrderIndexStr = "Order Index"; - protected const double MaxTimestamp = 2; - private const double MaxPropertyTimestamp = 2; - private const double MaxGlobalFetchTimestamp = 2; - protected readonly string[] LabelToolbarTitle = { "Material", "Default" }; - protected readonly string[] EnumModesStr = { "Create Enums", "Use Engine Enum Class" }; - protected readonly int[] EnumModeIntValues = { 0, 1 }; - private const string FetchToCreateDuplicatesMsg = "Reverting property name from '{0}' to '{1}' as it is registered to another property node."; - private const string FetchToCreateOnDuplicateNodeMsg = "Setting new property name '{0}' as '{1}' is registered to another property node."; - [SerializeField] - protected PropertyType m_currentParameterType; - - [SerializeField] - private PropertyType m_lastParameterType; - - [SerializeField] - protected string m_propertyName = string.Empty; - - [SerializeField] - protected string m_propertyInspectorName = string.Empty; - - [SerializeField] - protected string m_precisionString; - protected bool m_drawPrecisionUI = true; - - [SerializeField] - private int m_orderIndex = -1; - - [SerializeField] - protected VariableMode m_variableMode = VariableMode.Create; - - [SerializeField] - protected bool m_autoGlobalName = true; - - [SerializeField] - protected bool m_hybridInstanced = false; - - [SerializeField] - protected bool m_autoRegister = false; - - [SerializeField] - protected bool m_registerPropertyOnInstancing = true; - - [SerializeField] - private List<string> m_enumNames = new List<string>(); - - [SerializeField] - private List<int> m_enumValues = new List<int>(); - - [SerializeField] - private int m_enumCount = 0; - - [SerializeField] - private int m_enumModeInt = 0; - - [SerializeField] - private int m_customAttrCount = 0; - - [SerializeField] - private List<string> m_customAttr = new List<string>(); - - [SerializeField] - private string m_enumClassName = string.Empty; - - private bool m_hasEnum = false; - - protected bool m_showTitleWhenNotEditing = true; - - private int m_orderIndexOffset = 0; - - protected bool m_drawAttributes = true; - - protected bool m_underscoredGlobal = false; - protected bool m_globalDefaultBehavior = true; - - protected bool m_freeName; - protected bool m_freeType; - protected bool m_showVariableMode = false; - protected bool m_propertyNameIsDirty; - - protected bool m_showAutoRegisterUI = true; - - protected bool m_showHybridInstancedUI = false; - - protected bool m_useVarSubtitle = false; - - protected bool m_propertyFromInspector; - protected double m_propertyFromInspectorTimestamp; - - protected bool m_checkDuplicateProperty; - protected double m_checkDuplicatePropertyTimestamp; - - protected double m_globalFetchTimestamp; - - protected bool m_delayedDirtyProperty; - protected double m_delayedDirtyPropertyTimestamp; - - protected string m_defaultPropertyName; - protected string m_oldName = string.Empty; - - private bool m_reRegisterName = false; - protected bool m_allowPropertyDuplicates = false; - //protected bool m_useCustomPrefix = false; - protected string m_customPrefix = null; - - protected int m_propertyTab = 0; - - [SerializeField] - private string m_uniqueName; - - // Property Attributes - private const float ButtonLayoutWidth = 15; - - protected bool m_visibleAttribsFoldout; - protected bool m_visibleEnumsFoldout; - protected bool m_visibleCustomAttrFoldout; - protected List<PropertyAttributes> m_availableAttribs = new List<PropertyAttributes>(); - private string[] m_availableAttribsArr; - - [SerializeField] - private bool[] m_selectedAttribsArr; - - [SerializeField] - protected List<int> m_selectedAttribs = new List<int>(); - - //Title editing - protected bool m_isEditing; - protected bool m_stopEditing; - protected bool m_startEditing; - protected double m_clickTime; - protected double m_doubleClickTime = 0.3; - private Rect m_titleClickArea; - - protected bool m_srpBatcherCompatible = false; - protected bool m_excludeUniform = false; - - [SerializeField] - private bool m_addGlobalToSRPBatcher = false; - - public PropertyNode() : base() { } - public PropertyNode( int uniqueId, float x, float y, float width, float height ) : base( uniqueId, x, y, width, height ) { } - - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_textLabelWidth = 105; - if( UIUtils.CurrentWindow != null && UIUtils.CurrentWindow.CurrentGraph != null ) - m_orderIndex = UIUtils.GetPropertyNodeAmount(); - m_currentParameterType = PropertyType.Constant; - m_freeType = true; - m_freeName = true; - m_propertyNameIsDirty = true; - m_customPrecision = true; - m_availableAttribs.Add( new PropertyAttributes( "Hide in Inspector", "[HideInInspector]" ) ); - m_availableAttribs.Add( new PropertyAttributes( "HDR", "[HDR]" ) ); - m_availableAttribs.Add( new PropertyAttributes( "Gamma", "[Gamma]" ) ); - m_availableAttribs.Add( new PropertyAttributes( "Per Renderer Data", "[PerRendererData]" ) ); - } - - public override void AfterCommonInit() - { - base.AfterCommonInit(); - - if( PaddingTitleLeft == 0 && m_freeType ) - { - PaddingTitleLeft = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; - if( PaddingTitleRight == 0 ) - PaddingTitleRight = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; - } - - m_hasLeftDropdown = m_freeType; - } - - protected void BeginDelayedDirtyProperty() - { - m_delayedDirtyProperty = true; - m_delayedDirtyPropertyTimestamp = EditorApplication.timeSinceStartup; - } - - public void CheckDelayedDirtyProperty() - { - if( m_delayedDirtyProperty ) - { - if( ( EditorApplication.timeSinceStartup - m_delayedDirtyPropertyTimestamp ) > MaxPropertyTimestamp ) - { - m_delayedDirtyProperty = false; - m_propertyNameIsDirty = true; - m_sizeIsDirty = true; - } - } - } - - public void BeginPropertyFromInspectorCheck() - { - m_propertyFromInspector = true; - m_propertyFromInspectorTimestamp = EditorApplication.timeSinceStartup; - } - - public virtual void CheckPropertyFromInspector( bool forceUpdate = false ) - { - if( m_propertyFromInspector ) - { - if( forceUpdate || ( EditorApplication.timeSinceStartup - m_propertyFromInspectorTimestamp ) > MaxTimestamp ) - { - m_propertyFromInspector = false; - bool autoGlobal = m_autoGlobalName || m_currentParameterType == PropertyType.Global; - RegisterPropertyName( true, m_propertyInspectorName, autoGlobal, m_underscoredGlobal ); - m_propertyNameIsDirty = true; - } - } - } - - public void CheckDuplicateProperty() - { - if( m_checkDuplicateProperty && - ( EditorApplication.timeSinceStartup - m_checkDuplicatePropertyTimestamp ) > MaxTimestamp ) - { - m_checkDuplicateProperty = false; - m_propertyName = UIUtils.GeneratePropertyName( m_propertyName, PropertyType.Global, false ); - - if( UIUtils.IsNumericName( m_propertyName ) ) - { - UIUtils.ShowMessage( UniqueId, string.Format("Invalid property name '{0}' as it cannot start with numbers. Reverting to previous name.", m_propertyName ), MessageSeverity.Warning ); - m_propertyName = m_oldName; - GUI.FocusControl( string.Empty ); - return; - } - - if( !m_propertyName.Equals( m_oldName ) ) - { - if( UIUtils.IsUniformNameAvailable( m_propertyName ) || m_allowPropertyDuplicates ) - { - UIUtils.ReleaseUniformName( UniqueId, m_oldName ); - - m_oldName = m_propertyName; - m_propertyNameIsDirty = true; - m_reRegisterName = false; - UIUtils.RegisterUniformName( UniqueId, m_propertyName ); - OnPropertyNameChanged(); - } - else - { - GUI.FocusControl( string.Empty ); - RegisterFirstAvailablePropertyName( true, true ); - UIUtils.ShowMessage( UniqueId, string.Format( "Duplicate property name found on edited node.\nAssigning first valid one {0}", m_propertyName ) ); - } - } - } - } - - protected override void OnUniqueIDAssigned() - { - if( m_variableMode == VariableMode.Create ) - RegisterFirstAvailablePropertyName( false ); - - if( m_nodeAttribs != null ) - m_uniqueName = m_nodeAttribs.Name + UniqueId; - - UIUtils.RegisterRawPropertyNode( this ); - } - - public bool CheckLocalVariable( ref MasterNodeDataCollector dataCollector ) - { - bool addToLocalValue = false; - int count = 0; - for( int i = 0; i < m_outputPorts.Count; i++ ) - { - if( m_outputPorts[ i ].IsConnected ) - { - if( m_outputPorts[ i ].ConnectionCount > 1 ) - { - addToLocalValue = true; - break; - } - count += 1; - if( count > 1 ) - { - addToLocalValue = true; - break; - } - } - } - - if( addToLocalValue ) - { - ConfigureLocalVariable( ref dataCollector ); - } - - return addToLocalValue; - } - - public virtual void ConfigureLocalVariable( ref MasterNodeDataCollector dataCollector ) { } - public virtual void CopyDefaultsToMaterial() { } - - public override void SetupFromCastObject( UnityEngine.Object obj ) - { - RegisterPropertyName( true, obj.name, true, m_underscoredGlobal ); - } - - public void ChangeParameterType( PropertyType parameterType ) - { - Undo.RegisterCompleteObjectUndo( m_containerGraph.ParentWindow, Constants.UndoChangePropertyTypeNodesId ); - Undo.RegisterCompleteObjectUndo( m_containerGraph, Constants.UndoChangePropertyTypeNodesId ); - Undo.RecordObject( this, Constants.UndoChangePropertyTypeNodesId ); - - if( m_currentParameterType == PropertyType.Constant || m_currentParameterType == PropertyType.Global ) - { - CopyDefaultsToMaterial(); - } - - if( parameterType == PropertyType.InstancedProperty ) - { - //if( m_containerGraph.IsSRP ) - //{ - // UIUtils.ShowMessage( InstancedPropertyWarning,MessageSeverity.Warning ); - //} - - UIUtils.CurrentWindow.OutsideGraph.AddInstancePropertyCount(); - } - else if( m_currentParameterType == PropertyType.InstancedProperty ) - { - UIUtils.CurrentWindow.OutsideGraph.RemoveInstancePropertyCount(); - } - - if( ( parameterType == PropertyType.Property || parameterType == PropertyType.InstancedProperty ) - && m_currentParameterType != PropertyType.Property && m_currentParameterType != PropertyType.InstancedProperty ) - { - UIUtils.RegisterPropertyNode( this ); - } - - if( ( parameterType != PropertyType.Property && parameterType != PropertyType.InstancedProperty ) - && ( m_currentParameterType == PropertyType.Property || m_currentParameterType == PropertyType.InstancedProperty ) ) - { - UIUtils.UnregisterPropertyNode( this ); - } - - m_currentParameterType = parameterType; - if( parameterType == PropertyType.Constant ) - { - CurrentVariableMode = VariableMode.Create; - } - - } - - void InitializeAttribsArray() - { - m_availableAttribsArr = new string[ m_availableAttribs.Count ]; - m_selectedAttribsArr = new bool[ m_availableAttribs.Count ]; - for( int i = 0; i < m_availableAttribsArr.Length; i++ ) - { - m_availableAttribsArr[ i ] = m_availableAttribs[ i ].Name; - m_selectedAttribsArr[ i ] = false; - - if( m_selectedAttribs.FindIndex( x => x == i ) > -1 ) - { - m_selectedAttribsArr[ i ] = true; - m_visibleAttribsFoldout = true; - } - } - } - - protected virtual void OnAtrributesChanged() { CheckEnumAttribute(); } - void DrawAttributesAddRemoveButtons() - { - if( m_availableAttribsArr == null ) - { - InitializeAttribsArray(); - } - - int attribCount = m_selectedAttribs.Count; - // Add new port - if( GUILayout.Button( string.Empty, UIUtils.PlusStyle, GUILayout.Width( ButtonLayoutWidth ) ) ) - { - m_visibleAttribsFoldout = true; - m_selectedAttribs.Add( 0 ); - OnAtrributesChanged(); - } - - //Remove port - if( GUILayout.Button( string.Empty, UIUtils.MinusStyle, GUILayout.Width( ButtonLayoutWidth ) ) ) - { - if( attribCount > 0 ) - { - m_selectedAttribs.RemoveAt( attribCount - 1 ); - OnAtrributesChanged(); - } - } - } - - void CheckEnumAttribute() - { - m_hasEnum = false; - foreach( var item in m_selectedAttribs ) - { - if( m_availableAttribsArr[ item ].Equals( "Enum" ) ) - m_hasEnum = true; - } - } - void DrawEnumAddRemoveButtons() - { - // Add new port - if( GUILayout.Button( string.Empty, UIUtils.PlusStyle, GUILayout.Width( ButtonLayoutWidth ) ) && m_enumModeInt == 0 ) - { - m_enumNames.Add( "Option" + ( m_enumValues.Count + 1 ) ); - m_enumValues.Add( m_enumValues.Count ); - m_enumCount++; - m_visibleEnumsFoldout = true; - } - - //Remove port - if( GUILayout.Button( string.Empty, UIUtils.MinusStyle, GUILayout.Width( ButtonLayoutWidth ) ) && m_enumModeInt == 0 ) - { - if( m_enumNames.Count - 1 > -1 ) - { - m_enumNames.RemoveAt( m_enumNames.Count - 1 ); - m_enumValues.RemoveAt( m_enumValues.Count - 1 ); - m_enumCount--; - } - } - } - - protected void DrawEnums() - { - m_enumModeInt = EditorGUILayout.IntPopup( "Mode", m_enumModeInt, EnumModesStr, EnumModeIntValues ); - - if( m_enumModeInt == 0 ) - { - if( m_enumNames.Count == 0 ) - EditorGUILayout.HelpBox( "Your list is Empty!\nUse the plus button to add more.", MessageType.Info ); - - float cacheLabelSize = EditorGUIUtility.labelWidth; - EditorGUIUtility.labelWidth = 50; - - for( int i = 0; i < m_enumNames.Count; i++ ) - { - EditorGUI.BeginChangeCheck(); - EditorGUILayout.BeginHorizontal(); - m_enumNames[ i ] = EditorGUILayoutTextField( "Name", m_enumNames[ i ] ); - m_enumValues[ i ] = EditorGUILayoutIntField( "Value", m_enumValues[ i ], GUILayout.Width( 100 ) ); - EditorGUILayout.EndHorizontal(); - if( EditorGUI.EndChangeCheck() ) - { - m_enumNames[ i ] = UIUtils.RemoveInvalidEnumCharacters( m_enumNames[ i ] ); - if( string.IsNullOrEmpty( m_enumNames[ i ] ) ) - { - m_enumNames[ i ] = "Option" + ( i + 1 ); - } - } - } - - EditorGUIUtility.labelWidth = cacheLabelSize; - if( m_enumNames.Count > 0 ) - { - EditorGUILayout.BeginHorizontal(); - GUILayout.Label( " " ); - DrawEnumAddRemoveButtons(); - EditorGUILayout.EndHorizontal(); - } - } - else - { - EditorGUILayout.BeginHorizontal(); - m_enumClassName = EditorGUILayoutTextField( "Class Name", m_enumClassName ); - - if( GUILayout.Button( string.Empty, UIUtils.InspectorPopdropdownFallback, GUILayout.Width( 17 ), GUILayout.Height( 19 ) ) ) - { - GenericMenu menu = new GenericMenu(); - AddMenuItem( menu, "UnityEngine.Rendering.CullMode" ); - AddMenuItem( menu, "UnityEngine.Rendering.ColorWriteMask" ); - AddMenuItem( menu, "UnityEngine.Rendering.CompareFunction" ); - AddMenuItem( menu, "UnityEngine.Rendering.StencilOp" ); - AddMenuItem( menu, "UnityEngine.Rendering.BlendMode" ); - AddMenuItem( menu, "UnityEngine.Rendering.BlendOp" ); - menu.ShowAsContext(); - } - EditorGUILayout.EndHorizontal(); - } - } - - private void AddMenuItem( GenericMenu menu, string newClass ) - { - menu.AddItem( new GUIContent( newClass ), m_enumClassName.Equals( newClass ), OnSelection, newClass ); - } - - private void OnSelection( object newClass ) - { - m_enumClassName = (string)newClass; - } - - protected void DrawCustomAttrAddRemoveButtons() - { - // Add new port - if( GUILayout.Button( string.Empty, UIUtils.PlusStyle, GUILayout.Width( ButtonLayoutWidth ) ) ) - { - m_customAttr.Add( "" ); - m_customAttrCount++; - //m_enumCount++; - m_visibleCustomAttrFoldout = true; - } - - //Remove port - if( GUILayout.Button( string.Empty, UIUtils.MinusStyle, GUILayout.Width( ButtonLayoutWidth ) ) ) - { - if( m_customAttr.Count - 1 > -1 ) - { - m_customAttr.RemoveAt( m_customAttr.Count - 1 ); - m_customAttrCount--; - } - } - } - - protected void DrawCustomAttributes() - { - for( int i = 0; i < m_customAttrCount; i++ ) - { - EditorGUI.BeginChangeCheck(); - m_customAttr[ i ] = EditorGUILayoutTextField( "Attribute " + i, m_customAttr[ i ] ); - if( EditorGUI.EndChangeCheck() ) - { - m_customAttr[ i ] = UIUtils.RemoveInvalidAttrCharacters( m_customAttr[ i ] ); - } - } - - if( m_customAttrCount <= 0 ) - { - EditorGUILayout.HelpBox( "Your list is Empty!\nUse the plus button to add more.", MessageType.Info ); - return; - } - - EditorGUILayout.BeginHorizontal(); - GUILayout.Label( " " ); - DrawCustomAttrAddRemoveButtons(); - EditorGUILayout.EndHorizontal(); - } - - public virtual void DrawAttributes() - { - int attribCount = m_selectedAttribs.Count; - EditorGUI.BeginChangeCheck(); - if( m_availableAttribsArr == null ) - { - InitializeAttribsArray(); - } - for( int i = 0; i < m_availableAttribsArr.Length; i++ ) - { - m_selectedAttribsArr[ i ] = EditorGUILayoutToggleLeft( m_availableAttribsArr[ i ], m_selectedAttribsArr[ i ] ); - } - if( EditorGUI.EndChangeCheck() ) - { - m_selectedAttribs.Clear(); - for( int i = 0; i < m_selectedAttribsArr.Length; i++ ) - { - if( m_selectedAttribsArr[ i ] ) - m_selectedAttribs.Add( i ); - } - - OnAtrributesChanged(); - } - - bool customAttr = EditorGUILayoutToggleLeft( "Custom", m_customAttrCount == 0 ? false : true ); - if( !customAttr ) - { - m_customAttrCount = 0; - } - else if( customAttr && m_customAttrCount < 1 ) - { - if( m_customAttr.Count == 0 ) - m_customAttr.Add( "" ); - - m_customAttrCount = m_customAttr.Count; - } - //m_customAttrCount = EditorGUILayoutToggleLeft( "Custom Attribute", m_customAttrCount == 0 ? false : true ) == 0 ? false : true; - - //if( attribCount == 0 ) - //{ - // EditorGUILayout.HelpBox( "Your list is Empty!\nUse the plus button to add more.", MessageType.Info ); - //} - - //bool actionAllowed = true; - //int deleteItem = -1; - - //for ( int i = 0; i < attribCount; i++ ) - //{ - // EditorGUI.BeginChangeCheck(); - // { - // m_selectedAttribs[ i ] = EditorGUILayoutPopup( m_selectedAttribs[ i ], m_availableAttribsArr ); - // } - // if ( EditorGUI.EndChangeCheck() ) - // { - // OnAtrributesChanged(); - // } - - // EditorGUILayout.BeginHorizontal(); - // GUILayout.Label( " " ); - // // Add After - // if ( GUILayout.Button( string.Empty, UIUtils.PlusStyle, GUILayout.Width( ButtonLayoutWidth ) ) ) - // { - // if ( actionAllowed ) - // { - // m_selectedAttribs.Insert( i, m_selectedAttribs[ i ] ); - // actionAllowed = false; - // OnAtrributesChanged(); - // } - // } - - // // Remove Current - // if ( GUILayout.Button( string.Empty, UIUtils.MinusStyle, GUILayout.Width( ButtonLayoutWidth ) ) ) - // { - // if ( actionAllowed ) - // { - // actionAllowed = false; - // deleteItem = i; - // } - // } - // EditorGUILayout.EndHorizontal(); - //} - //if ( deleteItem > -1 ) - //{ - // m_selectedAttribs.RemoveAt( deleteItem ); - // OnAtrributesChanged(); - //} - } - public virtual void DrawMainPropertyBlock() - { - EditorGUILayout.BeginVertical(); - { - if( m_freeType ) - { - PropertyType parameterType = (PropertyType)EditorGUILayoutEnumPopup( ParameterTypeStr, m_currentParameterType ); - if( parameterType != m_currentParameterType ) - { - ChangeParameterType( parameterType ); - BeginPropertyFromInspectorCheck(); - } - } - - if( m_freeName ) - { - switch( m_currentParameterType ) - { - case PropertyType.Property: - case PropertyType.InstancedProperty: - { - ShowPropertyInspectorNameGUI(); - ShowPropertyNameGUI( true ); - ShowVariableMode(); - ShowHybridInstanced(); - ShowAutoRegister(); - ShowPrecision(); - ShowToolbar(); - } - break; - case PropertyType.Global: - { - ShowPropertyInspectorNameGUI(); - ShowPropertyNameGUI( false ); - ShowVariableMode(); - ShowAutoRegister(); - ShowPrecision(); - ShowDefaults(); - } - break; - case PropertyType.Constant: - { - ShowPropertyInspectorNameGUI(); - ShowPrecision(); - ShowDefaults(); - } - break; - } - } - } - EditorGUILayout.EndVertical(); - } - - public void DrawMainPropertyBlockNoPrecision() - { - EditorGUILayout.BeginVertical(); - { - if( m_freeType ) - { - PropertyType parameterType = (PropertyType)EditorGUILayoutEnumPopup( ParameterTypeStr, m_currentParameterType ); - if( parameterType != m_currentParameterType ) - { - ChangeParameterType( parameterType ); - BeginPropertyFromInspectorCheck(); - } - } - - if( m_freeName ) - { - switch( m_currentParameterType ) - { - case PropertyType.Property: - case PropertyType.InstancedProperty: - { - ShowPropertyInspectorNameGUI(); - ShowPropertyNameGUI( true ); - ShowToolbar(); - } - break; - case PropertyType.Global: - { - ShowPropertyInspectorNameGUI(); - ShowPropertyNameGUI( false ); - ShowDefaults(); - } - break; - case PropertyType.Constant: - { - ShowPropertyInspectorNameGUI(); - ShowDefaults(); - } - break; - } - } - } - EditorGUILayout.EndVertical(); - } - - public override void DrawProperties() - { - base.DrawProperties(); - if( m_freeType || m_freeName ) - { - NodeUtils.DrawPropertyGroup( ref m_propertiesFoldout, Constants.ParameterLabelStr, DrawMainPropertyBlock ); - if( m_drawAttributes ) - NodeUtils.DrawPropertyGroup( ref m_visibleAttribsFoldout, Constants.AttributesLaberStr, DrawAttributes ); - - if( m_hasEnum ) - { - if( m_enumModeInt == 0 ) - NodeUtils.DrawPropertyGroup( ref m_visibleEnumsFoldout, EnumsStr, DrawEnums, DrawEnumAddRemoveButtons ); - else - NodeUtils.DrawPropertyGroup( ref m_visibleEnumsFoldout, EnumsStr, DrawEnums ); - } - - if( m_drawAttributes && m_customAttrCount > 0 ) - NodeUtils.DrawPropertyGroup( ref m_visibleCustomAttrFoldout, CustomAttrStr, DrawCustomAttributes, DrawCustomAttrAddRemoveButtons ); - - CheckPropertyFromInspector(); - } - } - - public void ShowPrecision() - { - if( m_drawPrecisionUI ) - { - bool guiEnabled = GUI.enabled; - GUI.enabled = m_currentParameterType == PropertyType.Constant || m_variableMode == VariableMode.Create; - EditorGUI.BeginChangeCheck(); - DrawPrecisionProperty(); - if( EditorGUI.EndChangeCheck() ) - m_precisionString = UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, m_outputPorts[ 0 ].DataType ); - - GUI.enabled = guiEnabled; - - } - } - - public void ShowToolbar() - { - //if ( !CanDrawMaterial ) - //{ - // ShowDefaults(); - // return; - //} - - EditorGUILayout.BeginHorizontal(); - GUILayout.Space( 20 ); - m_propertyTab = GUILayout.Toolbar( m_propertyTab, LabelToolbarTitle ); - EditorGUILayout.EndHorizontal(); - switch( m_propertyTab ) - { - default: - case 0: - { - EditorGUI.BeginChangeCheck(); - DrawMaterialProperties(); - if( EditorGUI.EndChangeCheck() ) - { - BeginDelayedDirtyProperty(); - } - } - break; - case 1: - { - ShowDefaults(); - } - break; - } - } - - public void ShowDefaults() - { - EditorGUI.BeginChangeCheck(); - DrawSubProperties(); - if( EditorGUI.EndChangeCheck() ) - { - BeginDelayedDirtyProperty(); - } - if( m_currentParameterType == PropertyType.Global && m_globalDefaultBehavior ) - { - if( DebugConsoleWindow.DeveloperMode ) - { - ShowGlobalValueButton(); - } - EditorGUILayout.HelpBox( GlobalTypeWarningText, MessageType.Warning ); - } - } - - public void ShowPropertyInspectorNameGUI() - { - EditorGUI.BeginChangeCheck(); - m_propertyInspectorName = EditorGUILayoutTextField( PropertyInspectorStr, m_propertyInspectorName ); - if( EditorGUI.EndChangeCheck() ) - { - if( m_propertyInspectorName.Length > 0 ) - { - BeginPropertyFromInspectorCheck(); - } - } - } - - public void ShowPropertyNameGUI( bool isProperty ) - { - bool guiEnabledBuffer = GUI.enabled; - if( isProperty ) - { - EditorGUILayout.BeginHorizontal(); - GUI.enabled = !m_autoGlobalName; - EditorGUI.BeginChangeCheck(); - m_propertyName = EditorGUILayoutTextField( PropertyNameStr, m_propertyName ); - if( EditorGUI.EndChangeCheck() ) - { - //BeginPropertyFromInspectorCheck(); - m_checkDuplicateProperty = true; - m_checkDuplicatePropertyTimestamp = EditorApplication.timeSinceStartup; - } - GUI.enabled = guiEnabledBuffer; - EditorGUI.BeginChangeCheck(); - m_autoGlobalName = GUILayout.Toggle( m_autoGlobalName, ( m_autoGlobalName ? UIUtils.LockIconOpen : UIUtils.LockIconClosed ), "minibutton", GUILayout.Width( 22 ) ); - if( EditorGUI.EndChangeCheck() ) - { - if( m_autoGlobalName ) - BeginPropertyFromInspectorCheck(); - } - EditorGUILayout.EndHorizontal(); - } - else - { - GUI.enabled = false; - m_propertyName = EditorGUILayoutTextField( PropertyNameStr, m_propertyName ); - GUI.enabled = guiEnabledBuffer; - } - } - - public void ShowVariableMode() - { - if( m_showVariableMode || m_freeType ) - CurrentVariableMode = (VariableMode)EditorGUILayoutEnumPopup( IgnoreVarDeclarationStr, m_variableMode ); - } - - public void ShowHybridInstanced() - { - if( m_showHybridInstancedUI && CurrentParameterType == PropertyType.Property && (m_containerGraph.IsSRP || m_containerGraph.CurrentShaderFunction != null) ) - { - m_hybridInstanced = EditorGUILayoutToggle( HybridInstancedStr, m_hybridInstanced ); - } - } - - public void ShowAutoRegister() - { - if( m_showAutoRegisterUI && CurrentParameterType != PropertyType.Constant ) - { - m_autoRegister = EditorGUILayoutToggle( AutoRegisterStr, m_autoRegister ); - } - } - - public virtual string GetPropertyValStr() { return string.Empty; } - - public override bool OnClick( Vector2 currentMousePos2D ) - { - bool singleClick = base.OnClick( currentMousePos2D ); - m_propertyTab = m_materialMode ? 0 : 1; - return singleClick; - } - - public override void OnNodeDoubleClicked( Vector2 currentMousePos2D ) - { - if( currentMousePos2D.y - m_globalPosition.y > ( Constants.NODE_HEADER_HEIGHT + Constants.NODE_HEADER_EXTRA_HEIGHT ) * ContainerGraph.ParentWindow.CameraDrawInfo.InvertedZoom ) - { - ContainerGraph.ParentWindow.ParametersWindow.IsMaximized = !ContainerGraph.ParentWindow.ParametersWindow.IsMaximized; - } - } - - public override void DrawTitle( Rect titlePos ) - { - //base.DrawTitle( titlePos ); - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - - // Custom Editable Title - if( ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD3 ) - { - if( !m_isEditing && ( ( !ContainerGraph.ParentWindow.MouseInteracted && drawInfo.CurrentEventType == EventType.MouseDown && m_titleClickArea.Contains( drawInfo.MousePosition ) ) ) ) - { - if( ( EditorApplication.timeSinceStartup - m_clickTime ) < m_doubleClickTime ) - m_startEditing = true; - else - GUI.FocusControl( null ); - m_clickTime = EditorApplication.timeSinceStartup; - } - else if( m_isEditing && ( ( drawInfo.CurrentEventType == EventType.MouseDown && !m_titleClickArea.Contains( drawInfo.MousePosition ) ) || !EditorGUIUtility.editingTextField ) ) - { - m_stopEditing = true; - } - - if( m_isEditing || m_startEditing ) - { - EditorGUI.BeginChangeCheck(); - GUI.SetNextControlName( m_uniqueName ); - m_propertyInspectorName = EditorGUITextField( m_titleClickArea, string.Empty, m_propertyInspectorName, UIUtils.GetCustomStyle( CustomStyle.NodeTitle ) ); - if( EditorGUI.EndChangeCheck() ) - { - SetClippedTitle( m_propertyInspectorName, m_longNameSize ); - m_sizeIsDirty = true; - m_isDirty = true; - if( m_propertyInspectorName.Length > 0 ) - { - BeginPropertyFromInspectorCheck(); - } - } - - if( m_startEditing ) - EditorGUI.FocusTextInControl( m_uniqueName ); - //if( m_stopEditing ) - // GUI.FocusControl( null ); - } - - if( drawInfo.CurrentEventType == EventType.Repaint ) - { - if( m_startEditing ) - { - m_startEditing = false; - m_isEditing = true; - } - - if( m_stopEditing ) - { - m_stopEditing = false; - m_isEditing = false; - GUI.FocusControl( null ); - } - } - - - if( m_freeType ) - { - if( m_dropdownEditing ) - { - PropertyType parameterType = (PropertyType)EditorGUIEnumPopup( m_dropdownRect, m_currentParameterType, UIUtils.PropertyPopUp ); - if( parameterType != m_currentParameterType ) - { - ChangeParameterType( parameterType ); - BeginPropertyFromInspectorCheck(); - DropdownEditing = false; - } - } - } - } - - } - - public override void OnNodeLayout( DrawInfo drawInfo ) - { - //base.OnNodeLayout( drawInfo ); - if( m_reRegisterName ) - { - m_reRegisterName = false; - UIUtils.RegisterUniformName( UniqueId, m_propertyName ); - } - - CheckDelayedDirtyProperty(); - - if( m_currentParameterType != m_lastParameterType || m_propertyNameIsDirty ) - { - m_lastParameterType = m_currentParameterType; - m_propertyNameIsDirty = false; - OnDirtyProperty(); - if( m_currentParameterType != PropertyType.Constant ) - { - SetClippedTitle( m_propertyInspectorName, m_longNameSize ); - //bool globalHandler = false; - //if( globalHandler ) - //{ - string currValue = ( m_currentParameterType == PropertyType.Global && m_globalDefaultBehavior ) ? "<GLOBAL>" : GetPropertyValStr(); - SetClippedAdditionalTitle( string.Format( m_useVarSubtitle ? Constants.SubTitleVarNameFormatStr : Constants.SubTitleValueFormatStr, currValue ), m_longNameSize, LongNameEnder ); - //} - //else - //{ - // if( m_currentParameterType == PropertyType.Global ) - // { - // SetAdditonalTitleText( "Global" ); - // } - // else - // { - // SetAdditonalTitleText( string.Format( m_useVarSubtitle ? Constants.SubTitleVarNameFormatStr : Constants.SubTitleValueFormatStr, GetPropertyValStr() ) ); - // } - //} - } - else - { - SetClippedTitle( m_propertyInspectorName, m_longNameSize ); - SetClippedAdditionalTitle( string.Format( Constants.SubTitleConstFormatStr, GetPropertyValStr() ), m_longNameSize, LongNameEnder ); - } - } - - CheckPropertyFromInspector(); - CheckDuplicateProperty(); - // RUN LAYOUT CHANGES AFTER TITLES CHANGE - base.OnNodeLayout( drawInfo ); - - m_titleClickArea = m_titlePos; - m_titleClickArea.height = Constants.NODE_HEADER_HEIGHT; - } - - public override void OnNodeRepaint( DrawInfo drawInfo ) - { - base.OnNodeRepaint( drawInfo ); - - if( !m_isVisible ) - return; - - // Fixed Title ( only renders when not editing ) - if( m_showTitleWhenNotEditing && !m_isEditing && !m_startEditing && ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD3 ) - { - GUI.Label( m_titleClickArea, m_content, UIUtils.GetCustomStyle( CustomStyle.NodeTitle ) ); - } - } - - public void RegisterFirstAvailablePropertyName( bool releaseOldOne, bool appendIndexToCurrOne = false ) - { - if( releaseOldOne ) - UIUtils.ReleaseUniformName( UniqueId, m_oldName ); - - if( m_isNodeBeingCopied || appendIndexToCurrOne ) - { - if( string.IsNullOrEmpty( m_propertyName ) ) - return; - - string newPropertyName = UIUtils.GetUniqueUniformName( m_propertyName ); - if( newPropertyName != m_propertyName ) - { - UIUtils.RegisterUniformName( UniqueId, newPropertyName ); - m_propertyName = newPropertyName; - } - else - { - if( UIUtils.IsUniformNameAvailable( m_propertyName ) ) - UIUtils.RegisterUniformName( UniqueId, m_propertyName ); - else - UIUtils.GetFirstAvailableName( UniqueId, m_outputPorts[ 0 ].DataType, out m_propertyName, out m_propertyInspectorName, !string.IsNullOrEmpty( m_customPrefix ), m_customPrefix ); - } - - } - else - { - UIUtils.GetFirstAvailableName( UniqueId, m_outputPorts[ 0 ].DataType, out m_propertyName, out m_propertyInspectorName, !string.IsNullOrEmpty( m_customPrefix ), m_customPrefix ); - } - m_oldName = m_propertyName; - m_propertyNameIsDirty = true; - m_reRegisterName = false; - OnPropertyNameChanged(); - } - - public void SetRawPropertyName( string name ) - { - m_propertyName = name; - } - - public void RegisterPropertyName( bool releaseOldOne, string newName, bool autoGlobal = true, bool forceUnderscore = false ) - { - if( m_currentParameterType != PropertyType.Constant && m_variableMode == VariableMode.Fetch ) - { - string localPropertyName = string.Empty; - if( autoGlobal ) - localPropertyName = UIUtils.GeneratePropertyName( newName, m_currentParameterType, forceUnderscore ); - else - { - localPropertyName = UIUtils.GeneratePropertyName( m_propertyName, PropertyType.Global, forceUnderscore ); - if( UIUtils.IsNumericName( localPropertyName ) ) - { - m_propertyName = m_oldName; - } - - } - - m_propertyName = localPropertyName; - m_propertyInspectorName = newName; - m_propertyNameIsDirty = true; - m_reRegisterName = false; - OnPropertyNameChanged(); - return; - } - - string propertyName = string.Empty; - if( autoGlobal ) - propertyName = UIUtils.GeneratePropertyName( newName, m_currentParameterType, forceUnderscore ); - else - { - propertyName = UIUtils.GeneratePropertyName( m_propertyName, PropertyType.Global, forceUnderscore ); - if( UIUtils.IsNumericName( propertyName ) ) - { - m_propertyName = m_oldName; - } - } - - if( m_propertyName.Equals( propertyName ) ) - return; - - if( UIUtils.IsUniformNameAvailable( propertyName ) || m_allowPropertyDuplicates ) - { - if( releaseOldOne ) - UIUtils.ReleaseUniformName( UniqueId, m_oldName ); - - m_oldName = propertyName; - m_propertyName = propertyName; - if( autoGlobal ) - m_propertyInspectorName = newName; - m_propertyNameIsDirty = true; - m_reRegisterName = false; - UIUtils.RegisterUniformName( UniqueId, propertyName ); - OnPropertyNameChanged(); - } - else - { - GUI.FocusControl( string.Empty ); - RegisterFirstAvailablePropertyName( releaseOldOne ); - UIUtils.ShowMessage( UniqueId, string.Format( "Duplicate name found on edited node.\nAssigning first valid one {0}", m_propertyInspectorName ) ); - } - } - - protected string CreateLocalVarDec( string value ) - { - return string.Format( Constants.PropertyLocalVarDec, UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, m_outputPorts[ 0 ].DataType ), m_propertyName, value ); - } - - public virtual void CheckIfAutoRegister( ref MasterNodeDataCollector dataCollector ) - { - if( CurrentParameterType != PropertyType.Constant && m_autoRegister && m_connStatus != NodeConnectionStatus.Connected ) - { - RegisterProperty( ref dataCollector ); - } - } - - virtual protected void RegisterProperty( ref MasterNodeDataCollector dataCollector ) - { - CheckPropertyFromInspector( true ); - if( m_propertyName.Length == 0 ) - { - RegisterFirstAvailablePropertyName( false ); - } - - switch( CurrentParameterType ) - { - case PropertyType.Property: - { - //Debug.Log( this.GetInstanceID()+" "+ OrderIndex+" "+GetPropertyValue() ); - dataCollector.AddToProperties( UniqueId, GetPropertyValue(), OrderIndex ); - string dataType = string.Empty; - string dataName = string.Empty; - bool fullValue = false; - if( m_variableMode == VariableMode.Create && GetUniformData( out dataType, out dataName, ref fullValue ) ) - { - if( fullValue ) - { - dataCollector.AddToUniforms( UniqueId, dataName, m_srpBatcherCompatible ); - } - else - { - dataCollector.AddToUniforms( UniqueId, dataType, dataName, m_srpBatcherCompatible, m_excludeUniform ); - } - } - - if( m_hybridInstanced && dataCollector.IsTemplate && dataCollector.IsSRP ) - { - dataCollector.AddToDotsProperties( m_outputPorts[ 0 ].DataType, UniqueId, m_propertyName, OrderIndex, CurrentPrecisionType ); - } - //dataCollector.AddToUniforms( m_uniqueId, GetUniformValue() ); - } - break; - case PropertyType.InstancedProperty: - { - dataCollector.AddToPragmas( UniqueId, IOUtils.InstancedPropertiesHeader ); - - if( m_registerPropertyOnInstancing ) - dataCollector.AddToProperties( UniqueId, GetPropertyValue(), OrderIndex ); - - dataCollector.AddToInstancedProperties( m_outputPorts[ 0 ].DataType, UniqueId, GetInstancedUniformValue( dataCollector.IsTemplate, dataCollector.IsSRP ), OrderIndex ); - } - break; - case PropertyType.Global: - { - string dataType = string.Empty; - string dataName = string.Empty; - bool fullValue = false; - if( m_variableMode == VariableMode.Create && GetUniformData( out dataType, out dataName, ref fullValue ) ) - { - if( fullValue ) - { - dataCollector.AddToUniforms( UniqueId, dataName, m_addGlobalToSRPBatcher ); - } - else - { - dataCollector.AddToUniforms( UniqueId, dataType, dataName, m_addGlobalToSRPBatcher, m_excludeUniform ); - } - } - //dataCollector.AddToUniforms( m_uniqueId, GetUniformValue() ); - } - break; - case PropertyType.Constant: break; - } - dataCollector.AddPropertyNode( this ); - if( m_currentParameterType == PropertyType.InstancedProperty && !m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) - { - string instancedVar = dataCollector.IsSRP ? - //m_propertyName : - string.Format( IOUtils.LWSRPInstancedPropertiesData, dataCollector.InstanceBlockName, m_propertyName ) : - string.Format( IOUtils.InstancedPropertiesData, m_propertyName ); - - bool insideSF = InsideShaderFunction; - ParentGraph cachedGraph = ContainerGraph.ParentWindow.CustomGraph; - if( insideSF ) - ContainerGraph.ParentWindow.CustomGraph = this.ContainerGraph; - - RegisterLocalVariable( 0, instancedVar, ref dataCollector, m_propertyName + "_Instance" ); - - if( insideSF ) - ContainerGraph.ParentWindow.CustomGraph = cachedGraph; - } - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - RegisterProperty( ref dataCollector ); - return string.Empty; - } - - public override void Destroy() - { - base.Destroy(); - UIUtils.UnregisterRawPropertyNode( this ); - if( !string.IsNullOrEmpty( m_propertyName ) && UniqueId >= 0 ) - UIUtils.ReleaseUniformName( UniqueId, m_propertyName ); - - if( m_currentParameterType == PropertyType.InstancedProperty ) - { - UIUtils.CurrentWindow.OutsideGraph.RemoveInstancePropertyCount(); - UIUtils.UnregisterPropertyNode( this ); - } - - if( m_currentParameterType == PropertyType.Property ) - { - UIUtils.UnregisterPropertyNode( this ); - } - - if( m_availableAttribs != null ) - m_availableAttribs.Clear(); - - m_availableAttribs = null; - } - - string BuildEnum() - { - string result = "[Enum("; - if( m_enumModeInt == 0 ) - { - for( int i = 0; i < m_enumNames.Count; i++ ) - { - result += m_enumNames[ i ] + "," + m_enumValues[ i ]; - if( i + 1 < m_enumNames.Count ) - result += ","; - } - } - else - { - result += m_enumClassName; - } - result += ")]"; - return result; - } - - public string PropertyAttributes - { - get - { - int attribCount = m_selectedAttribs.Count; - - if( m_selectedAttribs.Count == 0 && m_customAttrCount == 0 ) - return string.Empty; - - string attribs = string.Empty; - for( int i = 0; i < attribCount; i++ ) - { - if( m_availableAttribs[ m_selectedAttribs[ i ] ].Name.Equals( "Enum" ) ) - attribs += BuildEnum(); - else - attribs += m_availableAttribs[ m_selectedAttribs[ i ] ].Attribute; - } - - for( int i = 0; i < m_customAttrCount; i++ ) - { - if( !string.IsNullOrEmpty( m_customAttr[ i ] ) ) - attribs += "[" + m_customAttr[ i ] + "]"; - } - return attribs; - } - } - public virtual void OnDirtyProperty() { } - public virtual void OnPropertyNameChanged() { UIUtils.UpdatePropertyDataNode( UniqueId, PropertyInspectorName ); } - public virtual void DrawSubProperties() { } - public virtual void DrawMaterialProperties() { } - - public virtual string GetPropertyValue() { return string.Empty; } - - public string GetInstancedUniformValue( bool isTemplate, bool isSRP ) - { - if( isTemplate ) - { - if( isSRP ) - { - return string.Format( IOUtils.LWSRPInstancedPropertiesElement, UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, m_outputPorts[ 0 ].DataType ), m_propertyName ); - //return GetUniformValue(); - } - else - { - return string.Format( IOUtils.InstancedPropertiesElement, UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, m_outputPorts[ 0 ].DataType ), m_propertyName ); - } - } - else - return string.Format( IOUtils.InstancedPropertiesElementTabs, UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, m_outputPorts[ 0 ].DataType ), m_propertyName ); - } - - public string GetInstancedUniformValue( bool isTemplate, bool isSRP, WirePortDataType dataType, string value ) - { - if( isTemplate ) - { - if( isSRP ) - { - //return GetUniformValue( dataType, value ); - return string.Format( IOUtils.LWSRPInstancedPropertiesElement, UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, dataType ), value ); - } - else - { - return string.Format( IOUtils.InstancedPropertiesElement, UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, dataType ), value ); - } - } - else - return string.Format( IOUtils.InstancedPropertiesElementTabs, UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, dataType ), value ); - } - - public virtual string GetUniformValue() - { - bool excludeUniformKeyword = ( m_currentParameterType == PropertyType.InstancedProperty ) || - m_containerGraph.IsSRP; - int index = excludeUniformKeyword ? 1 : 0; - return string.Format( Constants.UniformDec[ index ], UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, m_outputPorts[ 0 ].DataType ), m_propertyName ); - } - - public string GetUniformValue( WirePortDataType dataType, string value ) - { - bool excludeUniformKeyword = ( m_currentParameterType == PropertyType.InstancedProperty ) || - m_containerGraph.IsSRP; - int index = excludeUniformKeyword ? 1 : 0; - return string.Format( Constants.UniformDec[ index ], UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, dataType ), value ); - } - - public virtual bool GetUniformData( out string dataType, out string dataName, ref bool fullValue ) - { - dataType = UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, m_outputPorts[ 0 ].DataType ); - dataName = m_propertyName; - fullValue = false; - return true; - } - - public PropertyType CurrentParameterType - { - get { return m_currentParameterType; } - set { m_currentParameterType = value; } - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_currentParameterType ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_propertyName ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_propertyInspectorName ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_orderIndex ); - int attribCount = m_selectedAttribs.Count; - IOUtils.AddFieldValueToString( ref nodeInfo, attribCount ); - if( attribCount > 0 ) - { - for( int i = 0; i < attribCount; i++ ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_availableAttribs[ m_selectedAttribs[ i ] ].Attribute ); - } - } - IOUtils.AddFieldValueToString( ref nodeInfo, m_variableMode ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_autoGlobalName ); - - - IOUtils.AddFieldValueToString( ref nodeInfo, m_enumCount ); - for( int i = 0; i < m_enumCount; i++ ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_enumNames[ i ] ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_enumValues[ i ] ); - } - IOUtils.AddFieldValueToString( ref nodeInfo, m_enumModeInt ); - if( m_enumModeInt == 1 ) - IOUtils.AddFieldValueToString( ref nodeInfo, m_enumClassName ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_autoRegister ); - - IOUtils.AddFieldValueToString( ref nodeInfo, m_customAttrCount ); - if( m_customAttrCount > 0 ) - { - for( int i = 0; i < m_customAttrCount; i++ ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_customAttr[ i ] ); - } - } - - IOUtils.AddFieldValueToString( ref nodeInfo, m_hybridInstanced ); - } - - int IdForAttrib( string name ) - { - int attribCount = m_availableAttribs.Count; - for( int i = 0; i < attribCount; i++ ) - { - if( m_availableAttribs[ i ].Attribute.Equals( name ) ) - return i; - } - return 0; - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - if( UIUtils.CurrentShaderVersion() < 2505 ) - { - string property = GetCurrentParam( ref nodeParams ); - m_currentParameterType = property.Equals( "Uniform" ) ? PropertyType.Global : (PropertyType)Enum.Parse( typeof( PropertyType ), property ); - } - else - { - m_currentParameterType = (PropertyType)Enum.Parse( typeof( PropertyType ), GetCurrentParam( ref nodeParams ) ); - } - - if( m_currentParameterType == PropertyType.InstancedProperty ) - { - UIUtils.CurrentWindow.OutsideGraph.AddInstancePropertyCount(); - UIUtils.RegisterPropertyNode( this ); - } - - if( m_currentParameterType == PropertyType.Property ) - { - UIUtils.RegisterPropertyNode( this ); - } - - m_propertyName = GetCurrentParam( ref nodeParams ); - m_propertyInspectorName = GetCurrentParam( ref nodeParams ); - - if( UIUtils.CurrentShaderVersion() > 13 ) - { - m_orderIndex = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - } - - if( UIUtils.CurrentShaderVersion() > 4102 ) - { - int attribAmount = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - if( attribAmount > 0 ) - { - for( int i = 0; i < attribAmount; i++ ) - { - m_selectedAttribs.Add( IdForAttrib( GetCurrentParam( ref nodeParams ) ) ); - } - - m_visibleAttribsFoldout = true; - } - InitializeAttribsArray(); - } - - - if( UIUtils.CurrentShaderVersion() > 14003 ) - { - m_variableMode = (VariableMode)Enum.Parse( typeof( VariableMode ), GetCurrentParam( ref nodeParams ) ); - } - - if( UIUtils.CurrentShaderVersion() > 14201 ) - { - m_autoGlobalName = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - } - if( UIUtils.CurrentShaderVersion() > 14403 ) - { - m_enumCount = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - for( int i = 0; i < m_enumCount; i++ ) - { - m_enumNames.Add( GetCurrentParam( ref nodeParams ) ); - m_enumValues.Add( Convert.ToInt32( GetCurrentParam( ref nodeParams ) ) ); - } - } - - if( UIUtils.CurrentShaderVersion() > 14501 ) - { - m_enumModeInt = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - if( m_enumModeInt == 1 ) - m_enumClassName = GetCurrentParam( ref nodeParams ); - m_autoRegister = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - - m_customAttrCount = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - for( int i = 0; i < m_customAttrCount; i++ ) - { - m_customAttr.Add( GetCurrentParam( ref nodeParams ) ); - } - if( m_customAttrCount > 0 ) - { - m_visibleCustomAttrFoldout = true; - m_visibleAttribsFoldout = true; - } - } - - if( UIUtils.CurrentShaderVersion() > 18003 ) - { - m_hybridInstanced = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - } - - CheckEnumAttribute(); - if( m_enumCount > 0 ) - m_visibleEnumsFoldout = true; - - m_propertyNameIsDirty = true; - m_reRegisterName = false; - - if( !m_isNodeBeingCopied ) - { - if( m_variableMode != VariableMode.Fetch || m_currentParameterType == PropertyType.Constant ) - { - UIUtils.ReleaseUniformName( UniqueId, m_oldName ); - UIUtils.RegisterUniformName( UniqueId, m_propertyName ); - m_oldName = m_propertyName; - } - } - else - { - m_oldName = m_propertyName; - } - - } - - void UpdateTooltip() - { - string currValue = string.Empty; - if( m_currentParameterType != PropertyType.Constant ) - { - currValue = ( m_currentParameterType == PropertyType.Global && m_globalDefaultBehavior ) ? "<GLOBAL>" : GetPropertyValStr(); - } - else - { - currValue = GetPropertyValStr(); - } - - m_tooltipText = string.Format( TooltipFormatter, m_nodeAttribs.Description, m_propertyInspectorName, currValue ); - } - - public override void SetClippedTitle( string newText, int maxSize = 170, string endString = "..." ) - { - base.SetClippedTitle( newText, maxSize, endString ); - UpdateTooltip(); - } - - public override void SetClippedAdditionalTitle( string newText, int maxSize = 170, string endString = "..." ) - { - base.SetClippedAdditionalTitle( newText, maxSize, endString ); - UpdateTooltip(); - } - - public override void OnEnable() - { - base.OnEnable(); - m_reRegisterName = true; - } - - public bool CanDrawMaterial { get { return m_materialMode && m_currentParameterType != PropertyType.Constant; } } - public int RawOrderIndex - { - get { return m_orderIndex; } - } - - public int OrderIndex - { - get { return m_orderIndex + m_orderIndexOffset; } - set { m_orderIndex = value; } - } - - public int OrderIndexOffset - { - get { return m_orderIndexOffset; } - set { m_orderIndexOffset = value; } - } - - public VariableMode CurrentVariableMode - { - get { return m_variableMode; } - set - { - if( value != m_variableMode ) - { - m_variableMode = value; - if( value == VariableMode.Fetch ) - { - m_oldName = m_propertyName; - } - else - { - if( !m_propertyName.Equals( m_oldName ) ) - { - if( UIUtils.IsUniformNameAvailable( m_propertyName ) ) - { - UIUtils.ReleaseUniformName( UniqueId, m_oldName ); - UIUtils.RegisterUniformName( UniqueId, m_propertyName ); - } - else - { - UIUtils.ShowMessage( UniqueId, string.Format( FetchToCreateDuplicatesMsg, m_propertyName, m_oldName ), MessageSeverity.Warning ); - m_propertyName = m_oldName; - } - m_propertyNameIsDirty = true; - OnPropertyNameChanged(); - } - else if( UIUtils.CheckUniformNameOwner( m_propertyName ) != UniqueId ) - { - string oldProperty = m_propertyName; - RegisterFirstAvailablePropertyName( false ); - UIUtils.ShowMessage( UniqueId, string.Format( FetchToCreateOnDuplicateNodeMsg, m_propertyName, oldProperty ), MessageSeverity.Warning ); - } - } - } - } - } - - public string PropertyData( MasterNodePortCategory portCategory ) - { - return ( m_currentParameterType == PropertyType.InstancedProperty ) ? m_outputPorts[ 0 ].LocalValue( portCategory ) : m_propertyName; - } - - public override void OnNodeLogicUpdate( DrawInfo drawInfo ) - { - base.OnNodeLogicUpdate( drawInfo ); - if( m_currentParameterType == PropertyType.Global && m_globalDefaultBehavior && ( EditorApplication.timeSinceStartup - m_globalFetchTimestamp ) > MaxGlobalFetchTimestamp ) - { - FetchGlobalValue(); - m_globalFetchTimestamp = EditorApplication.timeSinceStartup; - } - } - - public void ShowGlobalValueButton() - { - if( GUILayout.Button( "Set Global Value" ) ) - { - SetGlobalValue(); - } - } - - public override bool CheckFindText( string text ) - { - return base.CheckFindText( text ) || - m_propertyName.IndexOf( text, StringComparison.CurrentCultureIgnoreCase ) >= 0 || - m_propertyInspectorName.IndexOf( text, StringComparison.CurrentCultureIgnoreCase ) >= 0; - } - - //This should only be used on template internal properties - public void PropertyNameFromTemplate( TemplateShaderPropertyData data ) - { - m_propertyName = data.PropertyName; - m_propertyInspectorName = data.PropertyInspectorName; - } - public virtual void GeneratePPSInfo( ref string propertyDeclaration, ref string propertySet ) { } - public virtual void SetGlobalValue() { } - public virtual void FetchGlobalValue() { } - - public virtual string PropertyName { get { return m_propertyName; } } - public virtual string PropertyInspectorName { get { return m_propertyInspectorName; } } - public bool FreeType { get { return m_freeType; } set { m_freeType = value; } } - public bool ReRegisterName { get { return m_reRegisterName; } set { m_reRegisterName = value; } } - public string CustomPrefix { get { return m_customPrefix; } set { m_customPrefix = value; } } - public override void RefreshOnUndo() - { - base.RefreshOnUndo(); - BeginPropertyFromInspectorCheck(); - } - public override string DataToArray { get { return PropertyInspectorName; } } - public bool RegisterPropertyOnInstancing { get { return m_registerPropertyOnInstancing; } set { m_registerPropertyOnInstancing = value; } } - public bool SrpBatcherCompatible { get { return m_srpBatcherCompatible; } } - public bool AddGlobalToSRPBatcher { get { return m_addGlobalToSRPBatcher; } set { m_addGlobalToSRPBatcher = value; } } - public bool AutoRegister { get { return m_autoRegister; } set { m_autoRegister = value; } } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/PropertyNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/PropertyNode.cs.meta deleted file mode 100644 index 704a2440..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/PropertyNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 5bbfd66571b12f84983b398231271694 -timeCreated: 1481126956 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/RangedFloatNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/RangedFloatNode.cs deleted file mode 100644 index 5c070e2b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/RangedFloatNode.cs +++ /dev/null @@ -1,530 +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( "Float", "Constants And Properties", "Float property", null, KeyCode.Alpha1 )] - public sealed class RangedFloatNode : PropertyNode - { - private const int OriginalFontSize = 11; - - private const string MinValueStr = "Min"; - private const string MaxValueStr = "Max"; - - private const float LabelWidth = 8; - - [SerializeField] - private float m_defaultValue = 0; - - [SerializeField] - private float m_materialValue = 0; - - [SerializeField] - private float m_min = 0; - - [SerializeField] - private float m_max = 0; - - [SerializeField] - private bool m_floatMode = true; - - private int m_cachedPropertyId = -1; - - private bool m_isEditingFields; - private Vector3 m_previousValue = Vector3.zero; - private string[] m_fieldText = new string[] { "0", "0", "0" }; - - public RangedFloatNode() : base() { } - public RangedFloatNode( int uniqueId, float x, float y, float width, float height ) : base( uniqueId, x, y, width, height ) { } - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - GlobalTypeWarningText = string.Format( GlobalTypeWarningText, "Float" ); - AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); - m_insideSize.Set( 50, 0 ); - m_showPreview = false; - m_showHybridInstancedUI = true; - m_selectedLocation = PreviewLocation.BottomCenter; - m_availableAttribs.Add( new PropertyAttributes( "Toggle", "[Toggle]" ) ); - m_availableAttribs.Add( new PropertyAttributes( "Int Range", "[IntRange]" ) ); - m_availableAttribs.Add( new PropertyAttributes( "Enum", "[Enum]" ) ); - m_previewShaderGUID = "d9ca47581ac157145bff6f72ac5dd73e"; - m_srpBatcherCompatible = true; - } - - protected override void OnUniqueIDAssigned() - { - base.OnUniqueIDAssigned(); - UIUtils.RegisterFloatIntNode( this ); - } - - public override void Destroy() - { - base.Destroy(); - UIUtils.UnregisterFloatIntNode( this ); - } - - public override void OnDirtyProperty() - { - UIUtils.UpdateFloatIntDataNode( UniqueId, PropertyInspectorName ); - } - - public override void RefreshExternalReferences() - { - base.RefreshExternalReferences(); - OnPropertyNameChanged(); - OnDirtyProperty(); - } - - public void SetFloatMode( bool value ) - { - if ( m_floatMode == value ) - return; - - m_floatMode = value; - if ( value ) - { - m_insideSize.x = 50;// + ( m_showPreview ? 50 : 0 ); - //m_firstPreviewDraw = true; - } - else - { - m_insideSize.x = 200;// + ( m_showPreview ? 0 : 0 ); - //m_firstPreviewDraw = true; - } - m_sizeIsDirty = true; - } - - public override void CopyDefaultsToMaterial() - { - m_materialValue = m_defaultValue; - } - - void DrawMinMaxUI() - { - EditorGUI.BeginChangeCheck(); - m_min = EditorGUILayoutFloatField( MinValueStr, m_min ); - m_max = EditorGUILayoutFloatField( MaxValueStr, m_max ); - if ( m_min > m_max ) - m_min = m_max; - - if ( m_max < m_min ) - m_max = m_min; - - if ( EditorGUI.EndChangeCheck() ) - { - SetFloatMode( m_min == m_max ); - } - } - public override void DrawSubProperties() - { - DrawMinMaxUI(); - - if ( m_floatMode ) - { - m_defaultValue = EditorGUILayoutFloatField( Constants.DefaultValueLabel, m_defaultValue ); - } - else - { - m_defaultValue = EditorGUILayoutSlider( Constants.DefaultValueLabel, m_defaultValue, m_min, m_max ); - } - } - - public override void DrawMaterialProperties() - { - DrawMinMaxUI(); - - EditorGUI.BeginChangeCheck(); - - if ( m_floatMode ) - { - m_materialValue = EditorGUILayoutFloatField( Constants.MaterialValueLabel, m_materialValue ); - } - else - { - m_materialValue = EditorGUILayoutSlider( Constants.MaterialValueLabel, m_materialValue, m_min, m_max ); - } - if ( EditorGUI.EndChangeCheck() ) - { - //MarkForPreviewUpdate(); - if ( m_materialMode ) - m_requireMaterialUpdate = true; - } - } - - public override void SetPreviewInputs() - { - base.SetPreviewInputs(); - - if ( m_cachedPropertyId == -1 ) - m_cachedPropertyId = Shader.PropertyToID( "_InputFloat" ); - - if ( m_materialMode && m_currentParameterType != PropertyType.Constant ) - PreviewMaterial.SetFloat( m_cachedPropertyId, m_materialValue ); - else - PreviewMaterial.SetFloat( m_cachedPropertyId, m_defaultValue ); - } - - public override void OnNodeLayout( DrawInfo drawInfo ) - { - base.OnNodeLayout( drawInfo ); - - if ( m_floatMode ) - { - m_propertyDrawPos = m_remainingBox; - m_propertyDrawPos.x = m_remainingBox.x - LabelWidth * drawInfo.InvertedZoom; - m_propertyDrawPos.width = drawInfo.InvertedZoom * Constants.FLOAT_DRAW_WIDTH_FIELD_SIZE; - m_propertyDrawPos.height = drawInfo.InvertedZoom * Constants.FLOAT_DRAW_HEIGHT_FIELD_SIZE; - } - else - { - m_propertyDrawPos = m_remainingBox; - m_propertyDrawPos.width = m_outputPorts[ 0 ].Position.x - m_propertyDrawPos.x - (m_outputPorts[ 0 ].LabelSize.x + (Constants.PORT_TO_LABEL_SPACE_X + 3) * drawInfo.InvertedZoom + 2); - m_propertyDrawPos.height = drawInfo.InvertedZoom * Constants.FLOAT_DRAW_HEIGHT_FIELD_SIZE; - } - } - - public override void DrawGUIControls( DrawInfo drawInfo ) - { - base.DrawGUIControls( drawInfo ); - - if ( drawInfo.CurrentEventType != EventType.MouseDown ) - return; - - Rect hitBox = m_remainingBox; - hitBox.xMin -= LabelWidth * drawInfo.InvertedZoom; - bool insideBox = hitBox.Contains( drawInfo.MousePosition ); - - if ( insideBox ) - { - GUI.FocusControl( null ); - m_isEditingFields = true; - } - else if ( m_isEditingFields && !insideBox ) - { - GUI.FocusControl( null ); - m_isEditingFields = false; - } - } - void DrawFakeFloatMaterial( DrawInfo drawInfo ) - { - if( m_floatMode ) - { - //UIUtils.DrawFloat( this, ref m_propertyDrawPos, ref m_materialValue, LabelWidth * drawInfo.InvertedZoom ); - Rect fakeField = m_propertyDrawPos; - fakeField.xMin += LabelWidth * drawInfo.InvertedZoom; - if( GUI.enabled ) - { - Rect fakeLabel = m_propertyDrawPos; - fakeLabel.xMax = fakeField.xMin; - EditorGUIUtility.AddCursorRect( fakeLabel, MouseCursor.SlideArrow ); - EditorGUIUtility.AddCursorRect( fakeField, MouseCursor.Text ); - } - if( m_previousValue[ 0 ] != m_materialValue ) - { - m_previousValue[ 0 ] = m_materialValue; - m_fieldText[ 0 ] = m_materialValue.ToString(); - } - - GUI.Label( fakeField, m_fieldText[ 0 ], UIUtils.MainSkin.textField ); - } - else - { - DrawFakeSlider( ref m_materialValue, drawInfo ); - } - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - - if ( !m_isVisible ) - return; - - if ( m_isEditingFields && m_currentParameterType != PropertyType.Global ) - { - if ( m_materialMode && m_currentParameterType != PropertyType.Constant ) - { - EditorGUI.BeginChangeCheck(); - if ( m_floatMode ) - { - UIUtils.DrawFloat( this, ref m_propertyDrawPos, ref m_materialValue, LabelWidth * drawInfo.InvertedZoom ); - } - else - { - DrawSlider( ref m_materialValue, drawInfo ); - } - if ( EditorGUI.EndChangeCheck() ) - { - PreviewIsDirty = true; - m_requireMaterialUpdate = true; - if ( m_currentParameterType != PropertyType.Constant ) - { - BeginDelayedDirtyProperty(); - } - } - } - else - { - EditorGUI.BeginChangeCheck(); - - if ( m_floatMode ) - { - UIUtils.DrawFloat( this, ref m_propertyDrawPos, ref m_defaultValue, LabelWidth * drawInfo.InvertedZoom ); - } - else - { - DrawSlider( ref m_defaultValue, drawInfo ); - } - if ( EditorGUI.EndChangeCheck() ) - { - PreviewIsDirty = true; - BeginDelayedDirtyProperty(); - } - - } - } - else if ( drawInfo.CurrentEventType == EventType.Repaint && ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD4 ) - { - if( m_currentParameterType == PropertyType.Global ) - { - bool guiEnabled = GUI.enabled; - GUI.enabled = false; - DrawFakeFloatMaterial( drawInfo ); - GUI.enabled = guiEnabled; - } - else if ( m_materialMode && m_currentParameterType != PropertyType.Constant ) - { - DrawFakeFloatMaterial( drawInfo ); - } - else - { - if ( m_floatMode ) - { - //UIUtils.DrawFloat( this, ref m_propertyDrawPos, ref m_defaultValue, LabelWidth * drawInfo.InvertedZoom ); - Rect fakeField = m_propertyDrawPos; - fakeField.xMin += LabelWidth * drawInfo.InvertedZoom; - Rect fakeLabel = m_propertyDrawPos; - fakeLabel.xMax = fakeField.xMin; - EditorGUIUtility.AddCursorRect( fakeLabel, MouseCursor.SlideArrow ); - EditorGUIUtility.AddCursorRect( fakeField, MouseCursor.Text ); - - if ( m_previousValue[ 0 ] != m_defaultValue ) - { - m_previousValue[ 0 ] = m_defaultValue; - m_fieldText[ 0 ] = m_defaultValue.ToString(); - } - - GUI.Label( fakeField, m_fieldText[ 0 ], UIUtils.MainSkin.textField ); - } - else - { - DrawFakeSlider( ref m_defaultValue, drawInfo ); - } - } - } - } - - void DrawFakeSlider( ref float value, DrawInfo drawInfo ) - { - float rangeWidth = 30 * drawInfo.InvertedZoom; - float rangeSpacing = 5 * drawInfo.InvertedZoom; - - //Min - Rect minRect = m_propertyDrawPos; - minRect.width = rangeWidth; - EditorGUIUtility.AddCursorRect( minRect, MouseCursor.Text ); - if ( m_previousValue[ 1 ] != m_min ) - { - m_previousValue[ 1 ] = m_min; - m_fieldText[ 1 ] = m_min.ToString(); - } - GUI.Label( minRect, m_fieldText[ 1 ], UIUtils.MainSkin.textField ); - - //Value Area - Rect valRect = m_propertyDrawPos; - valRect.width = rangeWidth; - valRect.x = m_propertyDrawPos.xMax - rangeWidth - rangeWidth - rangeSpacing; - EditorGUIUtility.AddCursorRect( valRect, MouseCursor.Text ); - if ( m_previousValue[ 0 ] != value ) - { - m_previousValue[ 0 ] = value; - m_fieldText[ 0 ] = value.ToString(); - } - GUI.Label( valRect, m_fieldText[ 0 ], UIUtils.MainSkin.textField ); - - //Max - Rect maxRect = m_propertyDrawPos; - maxRect.width = rangeWidth; - maxRect.x = m_propertyDrawPos.xMax - rangeWidth; - EditorGUIUtility.AddCursorRect( maxRect, MouseCursor.Text ); - if ( m_previousValue[ 2 ] != m_max ) - { - m_previousValue[ 2 ] = m_max; - m_fieldText[ 2 ] = m_max.ToString(); - } - GUI.Label( maxRect, m_fieldText[ 2 ], UIUtils.MainSkin.textField ); - - Rect sliderValRect = m_propertyDrawPos; - sliderValRect.x = minRect.xMax + rangeSpacing; - sliderValRect.xMax = valRect.xMin - rangeSpacing; - Rect sliderBackRect = sliderValRect; - sliderBackRect.height = 5 * drawInfo.InvertedZoom; - sliderBackRect.center = new Vector2( sliderValRect.center.x, Mathf.Round( sliderValRect.center.y ) ); - - - GUI.Label( sliderBackRect, string.Empty, UIUtils.GetCustomStyle( CustomStyle.SliderStyle ) ); - - sliderValRect.width = 10; - float percent = ( value - m_min) / ( m_max-m_min ); - percent = Mathf.Clamp01( percent ); - sliderValRect.x += percent * (sliderBackRect.width - 10 * drawInfo.InvertedZoom ); - GUI.Label( sliderValRect, string.Empty, UIUtils.RangedFloatSliderThumbStyle ); - } - - void DrawSlider( ref float value, DrawInfo drawInfo ) - { - float rangeWidth = 30 * drawInfo.InvertedZoom; - float rangeSpacing = 5 * drawInfo.InvertedZoom; - - //Min - Rect minRect = m_propertyDrawPos; - minRect.width = rangeWidth; - m_min = EditorGUIFloatField( minRect, m_min, UIUtils.MainSkin.textField ); - - //Value Area - Rect valRect = m_propertyDrawPos; - valRect.width = rangeWidth; - valRect.x = m_propertyDrawPos.xMax - rangeWidth - rangeWidth - rangeSpacing; - value = EditorGUIFloatField( valRect, value, UIUtils.MainSkin.textField ); - - //Max - Rect maxRect = m_propertyDrawPos; - maxRect.width = rangeWidth; - maxRect.x = m_propertyDrawPos.xMax - rangeWidth; - m_max = EditorGUIFloatField( maxRect, m_max, UIUtils.MainSkin.textField ); - - //Value Slider - Rect sliderValRect = m_propertyDrawPos; - sliderValRect.x = minRect.xMax + rangeSpacing; - sliderValRect.xMax = valRect.xMin - rangeSpacing; - Rect sliderBackRect = sliderValRect; - sliderBackRect.height = 5 * drawInfo.InvertedZoom; - sliderBackRect.center = new Vector2( sliderValRect.center.x, Mathf.Round( sliderValRect.center.y )); - GUI.Label( sliderBackRect, string.Empty, UIUtils.GetCustomStyle( CustomStyle.SliderStyle ) ); - value = GUIHorizontalSlider( sliderValRect, value, m_min, m_max, GUIStyle.none, UIUtils.RangedFloatSliderThumbStyle ); - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); - m_precisionString = UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, m_outputPorts[ 0 ].DataType ); - - if ( m_currentParameterType != PropertyType.Constant ) - return PropertyData( dataCollector.PortCategory ); - - return IOUtils.Floatify( m_defaultValue ); - } - - public override string GetPropertyValue() - { - if ( m_floatMode ) - { - return PropertyAttributes + m_propertyName + "(\"" + m_propertyInspectorName + "\", Float) = " + m_defaultValue; - } - else - { - return PropertyAttributes + m_propertyName + "(\"" + m_propertyInspectorName + "\", Range( " + m_min + " , " + m_max + ")) = " + m_defaultValue; - } - } - - public override void UpdateMaterial( Material mat ) - { - base.UpdateMaterial( mat ); - if ( UIUtils.IsProperty( m_currentParameterType ) && !InsideShaderFunction ) - { - mat.SetFloat( m_propertyName, m_materialValue ); - } - } - - public override void SetMaterialMode( Material mat , bool fetchMaterialValues ) - { - base.SetMaterialMode( mat , fetchMaterialValues ); - if ( fetchMaterialValues && m_materialMode && UIUtils.IsProperty( m_currentParameterType ) && mat.HasProperty( m_propertyName ) ) - { - m_materialValue = mat.GetFloat( m_propertyName ); - } - } - - public override void ForceUpdateFromMaterial( Material material ) - { - if( UIUtils.IsProperty( m_currentParameterType ) && material.HasProperty( m_propertyName ) ) - { - m_materialValue = material.GetFloat( m_propertyName ); - PreviewIsDirty = true; - } - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - m_defaultValue = Convert.ToSingle( GetCurrentParam( ref nodeParams ) ); - if( UIUtils.CurrentShaderVersion() > 14101 ) - { - m_materialValue = Convert.ToSingle( GetCurrentParam( ref nodeParams ) ); - } - - m_min = Convert.ToSingle( GetCurrentParam( ref nodeParams ) ); - m_max = Convert.ToSingle( GetCurrentParam( ref nodeParams ) ); - SetFloatMode( m_min == m_max ); - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_defaultValue ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_materialValue ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_min ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_max ); - } - - public override string GetPropertyValStr() - { - return ( m_materialMode && m_currentParameterType != PropertyType.Constant ) ? - m_materialValue.ToString( Mathf.Abs( m_materialValue ) > 1000 ? Constants.PropertyBigFloatFormatLabel : Constants.PropertyFloatFormatLabel ) : - m_defaultValue.ToString( Mathf.Abs( m_defaultValue ) > 1000 ? Constants.PropertyBigFloatFormatLabel : Constants.PropertyFloatFormatLabel ); - } - - public override void SetGlobalValue() { Shader.SetGlobalFloat( m_propertyName, m_defaultValue ); } - public override void FetchGlobalValue() { m_materialValue = Shader.GetGlobalFloat( m_propertyName ); } - public float Value - { - get { return m_defaultValue; } - set { m_defaultValue = value; } - } - - public void SetMaterialValueFromInline( float val ) - { - m_materialValue = val; - m_requireMaterialUpdate = true; - } - public override void GeneratePPSInfo( ref string propertyDeclaration, ref string propertySet ) - { - string additionalHeaders = string.Empty; - if( !m_floatMode ) - { - additionalHeaders = string.Format( "Range( {0}, {1} ),", m_min, m_max ); - } - propertyDeclaration += string.Format( ASEPPSHelperTool.PPSPropertyDecFormat, additionalHeaders, PropertyInspectorName, - ASEPPSHelperTool.WireToPPSType[ WirePortDataType.FLOAT ], PropertyName, m_defaultValue ); - - propertySet += string.Format( ASEPPSHelperTool.PPSPropertySetFormat, "Float", PropertyName ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/RangedFloatNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/RangedFloatNode.cs.meta deleted file mode 100644 index dbf3243f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/RangedFloatNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: e81453c5ad3b8224db874b56bf00cad2 -timeCreated: 1481126960 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables.meta deleted file mode 100644 index 22447d40..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 92f993d3ba8b1394eaf8c4fe308cab11 -folderAsset: yes -timeCreated: 1481126946 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen.meta deleted file mode 100644 index e1fbf68d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 8c4b0845954941d4d9809abaa67bdc2b -folderAsset: yes -timeCreated: 1481126947 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/CameraProjectionNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/CameraProjectionNode.cs deleted file mode 100644 index 0591ba12..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/CameraProjectionNode.cs +++ /dev/null @@ -1,100 +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 -{ - public enum BuiltInShaderCameraTypes - { - unity_CameraProjection = 0, - unity_CameraInvProjection - } - - [Serializable] - [NodeAttributes( "Projection Matrices", "Camera And Screen", "Camera's Projection/Inverse Projection matrix" )] - public sealed class CameraProjectionNode : ShaderVariablesNode - { - private const string _projMatrixLabelStr = "Projection Matrix"; - private readonly string[] _projMatrixValuesStr = { "Camera Projection", - "Inverse Camera Projection"}; - - - [SerializeField] - private BuiltInShaderCameraTypes m_selectedType = BuiltInShaderCameraTypes.unity_CameraProjection; - - private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper(); - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - ChangeOutputProperties( 0, _projMatrixValuesStr[ (int)m_selectedType ], WirePortDataType.FLOAT4x4 ); - m_textLabelWidth = 115; - m_autoWrapProperties = true; - m_hasLeftDropdown = true; - } - - public override void AfterCommonInit() - { - base.AfterCommonInit(); - if( PaddingTitleLeft == 0 ) - { - PaddingTitleLeft = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; - if( PaddingTitleRight == 0 ) - PaddingTitleRight = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; - } - } - - public override void Destroy() - { - base.Destroy(); - m_upperLeftWidget = null; - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - EditorGUI.BeginChangeCheck(); - m_selectedType = (BuiltInShaderCameraTypes)m_upperLeftWidget.DrawWidget( this, (int)m_selectedType, _projMatrixValuesStr ); - if( EditorGUI.EndChangeCheck() ) - { - ChangeOutputName( 0, _projMatrixValuesStr[ (int)m_selectedType ] ); - SetSaveIsDirty(); - } - } - - public override void DrawProperties() - { - base.DrawProperties(); - EditorGUI.BeginChangeCheck(); - m_selectedType = (BuiltInShaderCameraTypes)EditorGUILayoutPopup( _projMatrixLabelStr, (int)m_selectedType, _projMatrixValuesStr ); - if( EditorGUI.EndChangeCheck() ) - { - ChangeOutputName( 0, _projMatrixValuesStr[ (int)m_selectedType ] ); - SetSaveIsDirty(); - } - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); - GeneratorUtils.RegisterUnity2019MatrixDefines( ref dataCollector ); - return m_selectedType.ToString(); - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - m_selectedType = (BuiltInShaderCameraTypes)Enum.Parse( typeof( BuiltInShaderCameraTypes ), GetCurrentParam( ref nodeParams ) ); - ChangeOutputName( 0, _projMatrixValuesStr[ (int)m_selectedType ] ); - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_selectedType ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/CameraProjectionNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/CameraProjectionNode.cs.meta deleted file mode 100644 index 11a1c16b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/CameraProjectionNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: f776bdd36b750304c8e0de8ee1f31fc0 -timeCreated: 1481126960 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/CameraWorldClipPlanes.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/CameraWorldClipPlanes.cs deleted file mode 100644 index fd23099e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/CameraWorldClipPlanes.cs +++ /dev/null @@ -1,115 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using UnityEngine; -using UnityEditor; - -namespace AmplifyShaderEditor -{ - public enum BuiltInShaderClipPlanesTypes - { - Left = 0, - Right, - Bottom, - Top, - Near, - Far - } - - [Serializable] - [NodeAttributes( "Clip Planes", "Camera And Screen", "Camera World Clip Planes" )] - public sealed class CameraWorldClipPlanes : ShaderVariablesNode - { - [SerializeField] - private BuiltInShaderClipPlanesTypes m_selectedType = BuiltInShaderClipPlanesTypes.Left; - - private const string LabelStr = "Plane"; - private const string ValueStr = "unity_CameraWorldClipPlanes"; - - private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper(); - private int m_planeId; - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - ChangeOutputProperties( 0, "ABCD", WirePortDataType.FLOAT4 ); - m_textLabelWidth = 55; - m_autoWrapProperties = true; - m_hasLeftDropdown = true; - SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, m_selectedType ) ); - m_previewShaderGUID = "6afe5a4ad7bbd0e4ab352c758f543a09"; - } - - public override void OnEnable() - { - base.OnEnable(); - m_planeId = Shader.PropertyToID( "_PlaneId" ); - } - - public override void AfterCommonInit() - { - base.AfterCommonInit(); - if( PaddingTitleLeft == 0 ) - { - PaddingTitleLeft = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; - if( PaddingTitleRight == 0 ) - PaddingTitleRight = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; - } - } - - public override void Destroy() - { - base.Destroy(); - m_upperLeftWidget = null; - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - m_upperLeftWidget.DrawWidget<BuiltInShaderClipPlanesTypes>(ref m_selectedType, this, OnWidgetUpdate ); - } - - private readonly Action<ParentNode> OnWidgetUpdate = ( x ) => { - x.SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, ( x as CameraWorldClipPlanes ).Type ) ); - }; - - public BuiltInShaderClipPlanesTypes Type { get { return m_selectedType; } } - - public override void DrawProperties() - { - base.DrawProperties(); - EditorGUI.BeginChangeCheck(); - m_selectedType = ( BuiltInShaderClipPlanesTypes ) EditorGUILayoutEnumPopup( LabelStr, m_selectedType ); - if ( EditorGUI.EndChangeCheck() ) - { - SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, m_selectedType ) ); - SetSaveIsDirty(); - } - } - - public override void SetPreviewInputs() - { - base.SetPreviewInputs(); - PreviewMaterial.SetInt( m_planeId, (int)m_selectedType ); - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); - return ValueStr + "[" + ( int ) m_selectedType + "]"; - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - m_selectedType = ( BuiltInShaderClipPlanesTypes ) Enum.Parse( typeof( BuiltInShaderClipPlanesTypes ), GetCurrentParam( ref nodeParams ) ); - SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, m_selectedType ) ); - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_selectedType ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/CameraWorldClipPlanes.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/CameraWorldClipPlanes.cs.meta deleted file mode 100644 index 3b17b846..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/CameraWorldClipPlanes.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: e5a9a010f1c8dda449c8ca7ee9e25869 -timeCreated: 1481126959 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/OrthoParams.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/OrthoParams.cs deleted file mode 100644 index c2e93c26..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/OrthoParams.cs +++ /dev/null @@ -1,38 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Ortho Params", "Camera And Screen", "Orthographic Parameters" )] - public sealed class OrthoParams : ConstVecShaderVariable - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - ChangeOutputName( 1, "Ortho Cam Width" ); - ChangeOutputName( 2, "Ortho Cam Height" ); - ChangeOutputName( 3, "Unused" ); - ChangeOutputName( 4, "Projection Mode" ); - m_value = "unity_OrthoParams"; - m_previewShaderGUID = "88a910ece3dce224793e669bb1bc158d"; - } - - public override void RefreshExternalReferences() - { - base.RefreshExternalReferences(); - if( !m_outputPorts[ 0 ].IsConnected ) - { - m_outputPorts[ 0 ].Visible = false; - m_sizeIsDirty = true; - } - - if( !m_outputPorts[ 3 ].IsConnected ) - { - m_outputPorts[ 3 ].Visible = false; - m_sizeIsDirty = true; - } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/OrthoParams.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/OrthoParams.cs.meta deleted file mode 100644 index d406a63e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/OrthoParams.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: f9431cdf8e81c1d4f902b3fa7d04f7ac -timeCreated: 1481126960 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ProjectionParams.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ProjectionParams.cs deleted file mode 100644 index 9e4357b7..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ProjectionParams.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Projection Params", "Camera And Screen", "Projection Near/Far parameters" )] - public sealed class ProjectionParams : ConstVecShaderVariable - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - ChangeOutputName( 1, "Flipped" ); - ChangeOutputName( 2, "Near Plane" ); - ChangeOutputName( 3, "Far Plane" ); - ChangeOutputName( 4, "1/Far Plane" ); - m_value = "_ProjectionParams"; - m_previewShaderGUID = "97ae846cb0a6b044388fad3bc03bb4c2"; - } - - public override void RefreshExternalReferences() - { - base.RefreshExternalReferences(); - if( !m_outputPorts[ 0 ].IsConnected ) - { - m_outputPorts[ 0 ].Visible = false; - m_sizeIsDirty = true; - } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ProjectionParams.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ProjectionParams.cs.meta deleted file mode 100644 index 8e87d5a2..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ProjectionParams.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: ba1ca8bace2c2dd4dafac6f73f4dfb1b -timeCreated: 1481126958 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ScreenParams.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ScreenParams.cs deleted file mode 100644 index 5446ac2f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ScreenParams.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Screen Params", "Camera And Screen", "Camera's Render Target size parameters" )] - public sealed class ScreenParams : ConstVecShaderVariable - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - ChangeOutputName( 1, "RT Width" ); - ChangeOutputName( 2, "RT Height" ); - ChangeOutputName( 3, "1+1/Width" ); - ChangeOutputName( 4, "1+1/Height" ); - m_value = "_ScreenParams"; - m_previewShaderGUID = "78173633b803de4419206191fed3d61e"; - } - - //public override void RefreshExternalReferences() - //{ - // base.RefreshExternalReferences(); - // if( !m_outputPorts[ 0 ].IsConnected ) - // { - // m_outputPorts[ 0 ].Visible = false; - // m_sizeIsDirty = true; - // } - //} - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ScreenParams.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ScreenParams.cs.meta deleted file mode 100644 index f43db824..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ScreenParams.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 2e593f23857d59643b5b5f6dd6264e1b -timeCreated: 1481126954 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/WorldSpaceCameraPos.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/WorldSpaceCameraPos.cs deleted file mode 100644 index 2342f158..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/WorldSpaceCameraPos.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "World Space Camera Pos", "Camera And Screen", "World Space Camera position" )] - public sealed class WorldSpaceCameraPos : ConstantShaderVariable - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - ChangeOutputProperties( 0, "XYZ", WirePortDataType.FLOAT3 ); - AddOutputPort( WirePortDataType.FLOAT, "X" ); - AddOutputPort( WirePortDataType.FLOAT, "Y" ); - AddOutputPort( WirePortDataType.FLOAT, "Z" ); - - m_value = "_WorldSpaceCameraPos"; - m_previewShaderGUID = "6b0c78411043dd24dac1152c84bb63ba"; - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - return GetOutputVectorItem( 0, outputId, base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ) ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/WorldSpaceCameraPos.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/WorldSpaceCameraPos.cs.meta deleted file mode 100644 index 8a47447f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/WorldSpaceCameraPos.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 972d92a6008896f4292a61726e18f667 -timeCreated: 1481126957 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ZBufferParams.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ZBufferParams.cs deleted file mode 100644 index 4fcb5e19..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ZBufferParams.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Z-Buffer Params", "Camera And Screen", "Linearized Z buffer values" )] - public sealed class ZBufferParams : ConstVecShaderVariable - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - ChangeOutputName( 1, "1-far/near" ); - ChangeOutputName( 2, "far/near" ); - ChangeOutputName( 3, "[0]/far" ); - ChangeOutputName( 4, "[1]/far" ); - m_value = "_ZBufferParams"; - m_previewShaderGUID = "56c42c106bcb497439187f5bb6b6f94d"; - } - public override void RefreshExternalReferences() - { - base.RefreshExternalReferences(); - if( !m_outputPorts[ 0 ].IsConnected ) - { - m_outputPorts[ 0 ].Visible = false; - m_sizeIsDirty = true; - } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ZBufferParams.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ZBufferParams.cs.meta deleted file mode 100644 index e8b668c8..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/CameraAndScreen/ZBufferParams.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 2765a41106f478f4982e859b978bdec4 -timeCreated: 1481126954 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/ConstVecShaderVariable.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/ConstVecShaderVariable.cs deleted file mode 100644 index d74d8a5f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/ConstVecShaderVariable.cs +++ /dev/null @@ -1,39 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEngine; -using System; -namespace AmplifyShaderEditor -{ - [Serializable] - public class ConstVecShaderVariable : ShaderVariablesNode - { - [SerializeField] - protected string m_value; - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - ChangeOutputProperties( 0, " ", WirePortDataType.FLOAT4 ); - AddOutputPort( WirePortDataType.FLOAT, "0" ); - AddOutputPort( WirePortDataType.FLOAT, "1" ); - AddOutputPort( WirePortDataType.FLOAT, "2" ); - AddOutputPort( WirePortDataType.FLOAT, "3" ); - } - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); - switch ( outputId ) - { - case 0: return m_value; - case 1: return ( m_value + ".x" ); - case 2: return ( m_value + ".y" ); - case 3: return ( m_value + ".z" ); - case 4: return ( m_value + ".w" ); - } - - UIUtils.ShowMessage( UniqueId, "ConstVecShaderVariable generating empty code", MessageSeverity.Warning ); - return string.Empty; - } - - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/ConstVecShaderVariable.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/ConstVecShaderVariable.cs.meta deleted file mode 100644 index 97976c8a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/ConstVecShaderVariable.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 9102c0b554fd5ad4785acf870dcc17eb -timeCreated: 1481126957 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/ConstantShaderVariable.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/ConstantShaderVariable.cs deleted file mode 100644 index ff6279e7..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/ConstantShaderVariable.cs +++ /dev/null @@ -1,35 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using UnityEngine; - -namespace AmplifyShaderEditor -{ - [Serializable] - public class ConstantShaderVariable : ShaderVariablesNode - { - [SerializeField] - protected string m_value; - - [SerializeField] - protected string m_HDValue = string.Empty; - - [SerializeField] - protected string m_LWValue = string.Empty; - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); - if( dataCollector.IsTemplate ) - { - if( dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HD && !string.IsNullOrEmpty( m_HDValue ) ) - return m_HDValue; - - if( dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.Lightweight && !string.IsNullOrEmpty( m_LWValue )) - return m_LWValue; - } - return m_value; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/ConstantShaderVariable.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/ConstantShaderVariable.cs.meta deleted file mode 100644 index 55110165..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/ConstantShaderVariable.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 266391c3c4308014e9ce246e5484b917 -timeCreated: 1481126954 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/FogAndAmbient.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/FogAndAmbient.meta deleted file mode 100644 index e0c69e86..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/FogAndAmbient.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 78eb7b1e34d423c40a949c9e75b5f24a -folderAsset: yes -timeCreated: 1481126946 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/FogAndAmbient/FogAndAmbientColorsNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/FogAndAmbient/FogAndAmbientColorsNode.cs deleted file mode 100644 index 2af78f78..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/FogAndAmbient/FogAndAmbientColorsNode.cs +++ /dev/null @@ -1,126 +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 -{ - public enum BuiltInFogAndAmbientColors - { - UNITY_LIGHTMODEL_AMBIENT = 0, - unity_AmbientSky, - unity_AmbientEquator, - unity_AmbientGround, - unity_FogColor - } - - [Serializable] - [NodeAttributes( "Fog And Ambient Colors", "Light", "Fog and Ambient colors" )] - public sealed class FogAndAmbientColorsNode : ShaderVariablesNode - { - private const string ColorLabelStr = "Color"; - private readonly string[] ColorValuesStr = { - "Ambient light ( Legacy )", - "Sky ambient light", - "Equator ambient light", - "Ground ambient light", - "Fog" - }; - - [SerializeField] - private BuiltInFogAndAmbientColors m_selectedType = BuiltInFogAndAmbientColors.UNITY_LIGHTMODEL_AMBIENT; - - private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper(); - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - ChangeOutputProperties( 0, ColorValuesStr[ ( int ) m_selectedType ], WirePortDataType.COLOR ); - m_textLabelWidth = 50; - m_autoWrapProperties = true; - m_hasLeftDropdown = true; - m_previewShaderGUID = "937c7bde062f0f942b600d9950d2ebb2"; - } - - public override void AfterCommonInit() - { - base.AfterCommonInit(); - if( PaddingTitleLeft == 0 ) - { - PaddingTitleLeft = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; - if( PaddingTitleRight == 0 ) - PaddingTitleRight = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; - } - } - - public override void SetPreviewInputs() - { - base.SetPreviewInputs(); - m_previewMaterialPassId = (int)m_selectedType; - } - - public override void Destroy() - { - base.Destroy(); - m_upperLeftWidget = null; - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - EditorGUI.BeginChangeCheck(); - m_selectedType = (BuiltInFogAndAmbientColors)m_upperLeftWidget.DrawWidget( this, (int)m_selectedType, ColorValuesStr ); - if( EditorGUI.EndChangeCheck() ) - { - ChangeOutputName( 0, ColorValuesStr[ (int)m_selectedType ] ); - } - } - - public override void DrawProperties() - { - base.DrawProperties(); - EditorGUI.BeginChangeCheck(); - m_selectedType = ( BuiltInFogAndAmbientColors ) EditorGUILayoutPopup( ColorLabelStr, ( int ) m_selectedType, ColorValuesStr ); - - if ( EditorGUI.EndChangeCheck() ) - { - ChangeOutputName( 0, ColorValuesStr[ ( int ) m_selectedType ] ); - } - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); - if( dataCollector.IsTemplate && dataCollector.CurrentSRPType == TemplateSRPType.HD ) - { - switch( m_selectedType ) - { - case BuiltInFogAndAmbientColors.unity_AmbientSky: - return "_Ambient_ColorSky"; - case BuiltInFogAndAmbientColors.unity_AmbientEquator: - return "_Ambient_Equator"; - case BuiltInFogAndAmbientColors.unity_AmbientGround: - return "_Ambient_Ground"; - case BuiltInFogAndAmbientColors.unity_FogColor: - return "_FogColor"; - } - } - return m_selectedType.ToString(); - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - m_selectedType = ( BuiltInFogAndAmbientColors ) Enum.Parse( typeof( BuiltInFogAndAmbientColors ), GetCurrentParam( ref nodeParams ) ); - ChangeOutputName( 0, ColorValuesStr[ ( int ) m_selectedType ] ); - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_selectedType ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/FogAndAmbient/FogAndAmbientColorsNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/FogAndAmbient/FogAndAmbientColorsNode.cs.meta deleted file mode 100644 index f2ab7d02..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/FogAndAmbient/FogAndAmbientColorsNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: e2bdfc2fa6fcd0640b01a8b7448a1a11 -timeCreated: 1481126959 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/FogAndAmbient/FogParamsNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/FogAndAmbient/FogParamsNode.cs deleted file mode 100644 index 63a635d1..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/FogAndAmbient/FogParamsNode.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Fog Params", "Light", "Parameters for fog calculation" )] - public sealed class FogParamsNode : ConstVecShaderVariable - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - ChangeOutputName( 1, "Density/Sqrt(Ln(2))" ); - ChangeOutputName( 2, "Density/Ln(2)" ); - ChangeOutputName( 3, "-1/(End-Start)" ); - ChangeOutputName( 4, "End/(End-Start))" ); - m_value = "unity_FogParams"; - m_previewShaderGUID = "42abde3281b1848438c3b53443c91a1e"; - } - - public override void RefreshExternalReferences() - { - base.RefreshExternalReferences(); - if( !m_outputPorts[ 0 ].IsConnected ) - { - m_outputPorts[ 0 ].Visible = false; - m_sizeIsDirty = true; - } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/FogAndAmbient/FogParamsNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/FogAndAmbient/FogParamsNode.cs.meta deleted file mode 100644 index ccc0df5e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/FogAndAmbient/FogParamsNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: a3d8c31159e07bc419a7484ab5e894ed -timeCreated: 1481126958 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting.meta deleted file mode 100644 index 86287e65..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 47f503bcb5935b649beee3296dd40260 -folderAsset: yes -timeCreated: 1481126946 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/CustomStandardSurface.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/CustomStandardSurface.cs deleted file mode 100644 index d985714c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/CustomStandardSurface.cs +++ /dev/null @@ -1,197 +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 -{ - - public enum ASEStandardSurfaceWorkflow - { - Metallic = 0, - Specular - } - - [Serializable] - [NodeAttributes( "Standard Surface Light", "Light", "Provides a way to create a standard surface light model in custom lighting mode", NodeAvailabilityFlags = (int)NodeAvailability.CustomLighting )] - public sealed class CustomStandardSurface : ParentNode - { - private const string WorkflowStr = "Workflow"; - - [SerializeField] - private ASEStandardSurfaceWorkflow m_workflow = ASEStandardSurfaceWorkflow.Metallic; - - [SerializeField] - private ViewSpace m_normalSpace = ViewSpace.Tangent; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT3, false, "Albedo" ); - AddInputPort( WirePortDataType.FLOAT3, false, "Normal" ); - m_inputPorts[ 1 ].Vector3InternalData = Vector3.forward; - AddInputPort( WirePortDataType.FLOAT3, false, "Emission" ); - AddInputPort( WirePortDataType.FLOAT, false, "Metallic" ); - AddInputPort( WirePortDataType.FLOAT, false, "Smoothness" ); - AddInputPort( WirePortDataType.FLOAT, false, "Occlusion" ); - m_inputPorts[ 5 ].FloatInternalData = 1; - AddOutputPort( WirePortDataType.FLOAT3, "RGB" ); - m_autoWrapProperties = true; - m_textLabelWidth = 100; - m_errorMessageTypeIsError = NodeMessageType.Warning; - m_errorMessageTooltip = "This node only returns correct information using a custom light model, otherwise returns 0"; - } - - public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) - { - base.PropagateNodeData( nodeData, ref dataCollector ); - if( m_inputPorts[ 1 ].IsConnected && m_normalSpace == ViewSpace.Tangent ) - dataCollector.DirtyNormal = true; - } - - public override void DrawProperties() - { - base.DrawProperties(); - EditorGUI.BeginChangeCheck(); - m_workflow = (ASEStandardSurfaceWorkflow)EditorGUILayoutEnumPopup( WorkflowStr, m_workflow ); - if( EditorGUI.EndChangeCheck() ) - { - UpdateSpecularMetallicPorts(); - } - - EditorGUI.BeginChangeCheck(); - m_normalSpace = (ViewSpace)EditorGUILayoutEnumPopup( "Normal Space", m_normalSpace ); - if( EditorGUI.EndChangeCheck() ) - { - UpdatePort(); - } - } - - private void UpdatePort() - { - if( m_normalSpace == ViewSpace.World ) - m_inputPorts[ 1 ].Name = "World Normal"; - else - m_inputPorts[ 1 ].Name = "Normal"; - - m_sizeIsDirty = true; - } - - void UpdateSpecularMetallicPorts() - { - if( m_workflow == ASEStandardSurfaceWorkflow.Specular ) - m_inputPorts[ 3 ].ChangeProperties( "Specular", WirePortDataType.FLOAT3, false ); - else - m_inputPorts[ 3 ].ChangeProperties( "Metallic", WirePortDataType.FLOAT, false ); - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if( dataCollector.GenType == PortGenType.NonCustomLighting || dataCollector.CurrentCanvasMode != NodeAvailability.CustomLighting ) - return "float3(0,0,0)"; - - if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) - return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); - - string specularMode = string.Empty; - if( m_workflow == ASEStandardSurfaceWorkflow.Specular ) - specularMode = "Specular"; - - dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_NORMAL, CurrentPrecisionType ); - - if( dataCollector.DirtyNormal ) - { - dataCollector.AddToInput( UniqueId, SurfaceInputs.INTERNALDATA, addSemiColon: false ); - dataCollector.ForceNormal = true; - } - - dataCollector.AddLocalVariable( UniqueId, "SurfaceOutputStandard" + specularMode + " s" + OutputId + " = (SurfaceOutputStandard" + specularMode + " ) 0;" ); - dataCollector.AddLocalVariable( UniqueId, "s" + OutputId + ".Albedo = " + m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ) + ";" ); - - string normal = string.Empty; - - if( m_inputPorts[ 1 ].IsConnected ) - { - normal = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); - if( m_normalSpace == ViewSpace.Tangent ) - { - normal = "WorldNormalVector( " + Constants.InputVarStr + " , " + normal + " )"; - } - } - else - { - normal = GeneratorUtils.GenerateWorldNormal( ref dataCollector, UniqueId ); - } - - - - dataCollector.AddLocalVariable( UniqueId, "s" + OutputId + ".Normal = "+ normal + ";" ); - dataCollector.AddLocalVariable( UniqueId, "s" + OutputId + ".Emission = " + m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ) + ";" ); - if( m_workflow == ASEStandardSurfaceWorkflow.Specular ) - dataCollector.AddLocalVariable( UniqueId, "s" + OutputId + ".Specular = " + m_inputPorts[ 3 ].GeneratePortInstructions( ref dataCollector ) + ";" ); - else - dataCollector.AddLocalVariable( UniqueId, "s" + OutputId + ".Metallic = " + m_inputPorts[ 3 ].GeneratePortInstructions( ref dataCollector ) + ";" ); - dataCollector.AddLocalVariable( UniqueId, "s" + OutputId + ".Smoothness = " + m_inputPorts[ 4 ].GeneratePortInstructions( ref dataCollector ) + ";" ); - dataCollector.AddLocalVariable( UniqueId, "s" + OutputId + ".Occlusion = " + m_inputPorts[ 5 ].GeneratePortInstructions( ref dataCollector ) + ";\n" ); - - dataCollector.AddLocalVariable( UniqueId, "data.light = gi.light;\n", true ); - - dataCollector.AddLocalVariable( UniqueId, "UnityGI gi" + OutputId + " = gi;" ); - dataCollector.AddLocalVariable( UniqueId, "#ifdef UNITY_PASS_FORWARDBASE", true ); - - dataCollector.AddLocalVariable( UniqueId, "Unity_GlossyEnvironmentData g" + OutputId + " = UnityGlossyEnvironmentSetup( s" + OutputId + ".Smoothness, data.worldViewDir, s" + OutputId + ".Normal, float3(0,0,0));" ); - dataCollector.AddLocalVariable( UniqueId, "gi" + OutputId + " = UnityGlobalIllumination( data, s" + OutputId + ".Occlusion, s" + OutputId + ".Normal, g" + OutputId + " );" ); - dataCollector.AddLocalVariable( UniqueId, "#endif\n", true ); - dataCollector.AddLocalVariable( UniqueId, "float3 surfResult" + OutputId + " = LightingStandard" + specularMode + " ( s" + OutputId + ", viewDir, gi" + OutputId + " ).rgb;" ); - //Emission must be always added to trick Unity, so it knows what needs to be created p.e. world pos - dataCollector.AddLocalVariable( UniqueId, "surfResult" + OutputId + " += s" + OutputId + ".Emission;\n" ); - - m_outputPorts[ 0 ].SetLocalValue( "surfResult" + OutputId, dataCollector.PortCategory ); - - //Remove emission contribution from Forward Add - dataCollector.AddLocalVariable( UniqueId, "#ifdef UNITY_PASS_FORWARDADD//" + OutputId ); - dataCollector.AddLocalVariable( UniqueId, string.Format( "surfResult{0} -= s{0}.Emission;", OutputId )); - dataCollector.AddLocalVariable( UniqueId, "#endif//" + OutputId ); - - return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - if( ContainerGraph.CurrentCanvasMode == NodeAvailability.TemplateShader || ( ContainerGraph.CurrentStandardSurface != null && ContainerGraph.CurrentStandardSurface.CurrentLightingModel != StandardShaderLightModel.CustomLighting ) ) - m_showErrorMessage = true; - else - m_showErrorMessage = false; - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - if( UIUtils.CurrentShaderVersion() < 13204 ) - { - m_workflow = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ) ? ASEStandardSurfaceWorkflow.Specular : ASEStandardSurfaceWorkflow.Metallic; - } - else - { - m_workflow = (ASEStandardSurfaceWorkflow)Enum.Parse( typeof( ASEStandardSurfaceWorkflow ), GetCurrentParam( ref nodeParams ) ); - } - UpdateSpecularMetallicPorts(); - - if( UIUtils.CurrentShaderVersion() >= 14402 ) - { - m_normalSpace = (ViewSpace)Enum.Parse( typeof( ViewSpace ), GetCurrentParam( ref nodeParams ) ); - } - UpdatePort(); - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_workflow ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_normalSpace ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/CustomStandardSurface.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/CustomStandardSurface.cs.meta deleted file mode 100644 index 172f37cd..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/CustomStandardSurface.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 78916999fd7bc3c4e9767bc9cf0698c0 -timeCreated: 1500054866 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/IndirectDiffuseLighting.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/IndirectDiffuseLighting.cs deleted file mode 100644 index c58da735..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/IndirectDiffuseLighting.cs +++ /dev/null @@ -1,366 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using UnityEngine; -using UnityEditor; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Indirect Diffuse Light", "Light", "Indirect Lighting", NodeAvailabilityFlags = (int)( NodeAvailability.CustomLighting | NodeAvailability.TemplateShader ) )] - public sealed class IndirectDiffuseLighting : ParentNode - { - [SerializeField] - private ViewSpace m_normalSpace = ViewSpace.Tangent; - - private int m_cachedIntensityId = -1; - - - private readonly string LWIndirectDiffuseHeader = "ASEIndirectDiffuse( {0}, {1})"; - private readonly string[] LWIndirectDiffuseBody = - { - "float3 ASEIndirectDiffuse( float2 uvStaticLightmap, float3 normalWS )\n", - "{\n", - "#ifdef LIGHTMAP_ON\n", - "\treturn SampleLightmap( uvStaticLightmap, normalWS );\n", - "#else\n", - "\treturn SampleSH(normalWS);\n", - "#endif\n", - "}\n" - }; - - - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT3, false, "Normal" ); - AddOutputPort( WirePortDataType.FLOAT3, "RGB" ); - m_inputPorts[ 0 ].Vector3InternalData = Vector3.forward; - m_autoWrapProperties = true; - m_errorMessageTypeIsError = NodeMessageType.Warning; - m_errorMessageTooltip = "This node only returns correct information using a custom light model, otherwise returns 0"; - m_previewShaderGUID = "b45d57fa606c1ea438fe9a2c08426bc7"; - m_drawPreviewAsSphere = true; - } - - public override void SetPreviewInputs() - { - base.SetPreviewInputs(); - - if( m_inputPorts[ 0 ].IsConnected ) - { - if( m_normalSpace == ViewSpace.Tangent ) - m_previewMaterialPassId = 1; - else - m_previewMaterialPassId = 2; - } - else - { - m_previewMaterialPassId = 0; - } - - if( m_cachedIntensityId == -1 ) - m_cachedIntensityId = Shader.PropertyToID( "_Intensity" ); - - PreviewMaterial.SetFloat( m_cachedIntensityId, RenderSettings.ambientIntensity ); - } - - public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) - { - base.PropagateNodeData( nodeData, ref dataCollector ); - // This needs to be rechecked - //if( m_inputPorts[ 0 ].IsConnected ) - dataCollector.DirtyNormal = true; - } - - public override void DrawProperties() - { - base.DrawProperties(); - - EditorGUI.BeginChangeCheck(); - m_normalSpace = (ViewSpace)EditorGUILayoutEnumPopup( "Normal Space", m_normalSpace ); - if( EditorGUI.EndChangeCheck() ) - { - UpdatePort(); - } - } - - private void UpdatePort() - { - if( m_normalSpace == ViewSpace.World ) - m_inputPorts[ 0 ].ChangeProperties( "World Normal", m_inputPorts[ 0 ].DataType, false ); - else - m_inputPorts[ 0 ].ChangeProperties( "Normal", m_inputPorts[ 0 ].DataType, false ); - - m_sizeIsDirty = true; - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - if( ( ContainerGraph.CurrentStandardSurface != null && ContainerGraph.CurrentStandardSurface.CurrentLightingModel != StandardShaderLightModel.CustomLighting ) ) - m_showErrorMessage = true; - else - m_showErrorMessage = 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 finalValue = string.Empty; - - if( dataCollector.IsTemplate && dataCollector.IsFragmentCategory ) - { - if( !dataCollector.IsSRP ) - { - dataCollector.AddToIncludes( UniqueId, Constants.UnityLightingLib ); - - string texcoord1 = string.Empty; - string texcoord2 = string.Empty; - - if( dataCollector.TemplateDataCollectorInstance.HasInfo( TemplateInfoOnSematics.TEXTURE_COORDINATES1, false, MasterNodePortCategory.Vertex ) ) - texcoord1 = dataCollector.TemplateDataCollectorInstance.GetInfo( TemplateInfoOnSematics.TEXTURE_COORDINATES1, false, MasterNodePortCategory.Vertex ).VarName; - else - texcoord1 = dataCollector.TemplateDataCollectorInstance.RegisterInfoOnSemantic( MasterNodePortCategory.Vertex, TemplateInfoOnSematics.TEXTURE_COORDINATES1, TemplateSemantics.TEXCOORD1, "texcoord1", WirePortDataType.FLOAT4, PrecisionType.Float, false ); - - if( dataCollector.TemplateDataCollectorInstance.HasInfo( TemplateInfoOnSematics.TEXTURE_COORDINATES2, false, MasterNodePortCategory.Vertex ) ) - texcoord2 = dataCollector.TemplateDataCollectorInstance.GetInfo( TemplateInfoOnSematics.TEXTURE_COORDINATES2, false, MasterNodePortCategory.Vertex ).VarName; - else - texcoord2 = dataCollector.TemplateDataCollectorInstance.RegisterInfoOnSemantic( MasterNodePortCategory.Vertex, TemplateInfoOnSematics.TEXTURE_COORDINATES2, TemplateSemantics.TEXCOORD2, "texcoord2", WirePortDataType.FLOAT4, PrecisionType.Float, false ); - - string vOutName = dataCollector.TemplateDataCollectorInstance.CurrentTemplateData.VertexFunctionData.OutVarName; - string fInName = dataCollector.TemplateDataCollectorInstance.CurrentTemplateData.FragmentFunctionData.InVarName; - TemplateVertexData data = dataCollector.TemplateDataCollectorInstance.RequestNewInterpolator( WirePortDataType.FLOAT4, false, "ase_lmap" ); - - string varName = "ase_lmap"; - if( data != null ) - varName = data.VarName; - - dataCollector.AddToVertexLocalVariables( UniqueId, "#ifdef DYNAMICLIGHTMAP_ON //dynlm" ); - dataCollector.AddToVertexLocalVariables( UniqueId, vOutName + "." + varName + ".zw = " + texcoord2 + ".xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw;" ); - dataCollector.AddToVertexLocalVariables( UniqueId, "#endif //dynlm" ); - dataCollector.AddToVertexLocalVariables( UniqueId, "#ifdef LIGHTMAP_ON //stalm" ); - dataCollector.AddToVertexLocalVariables( UniqueId, vOutName + "." + varName + ".xy = " + texcoord1 + ".xy * unity_LightmapST.xy + unity_LightmapST.zw;" ); - dataCollector.AddToVertexLocalVariables( UniqueId, "#endif //stalm" ); - - TemplateVertexData shdata = dataCollector.TemplateDataCollectorInstance.RequestNewInterpolator( WirePortDataType.FLOAT3, false, "ase_sh" ); - string worldPos = dataCollector.TemplateDataCollectorInstance.GetWorldPos( false, MasterNodePortCategory.Vertex ); - string worldNormal = dataCollector.TemplateDataCollectorInstance.GetWorldNormal( PrecisionType.Float, false, MasterNodePortCategory.Vertex ); - //Debug.Log( shdata ); - string shVarName = "ase_sh"; - if( shdata != null ) - shVarName = shdata.VarName; - string outSH = vOutName + "." + shVarName + ".xyz"; - dataCollector.AddToVertexLocalVariables( UniqueId, "#ifndef LIGHTMAP_ON //nstalm" ); - dataCollector.AddToVertexLocalVariables( UniqueId, "#if UNITY_SHOULD_SAMPLE_SH //sh" ); - dataCollector.AddToVertexLocalVariables( UniqueId, outSH + " = 0;" ); - dataCollector.AddToVertexLocalVariables( UniqueId, "#ifdef VERTEXLIGHT_ON //vl" ); - dataCollector.AddToVertexLocalVariables( UniqueId, outSH + " += Shade4PointLights (" ); - dataCollector.AddToVertexLocalVariables( UniqueId, "unity_4LightPosX0, unity_4LightPosY0, unity_4LightPosZ0," ); - dataCollector.AddToVertexLocalVariables( UniqueId, "unity_LightColor[0].rgb, unity_LightColor[1].rgb, unity_LightColor[2].rgb, unity_LightColor[3].rgb," ); - dataCollector.AddToVertexLocalVariables( UniqueId, "unity_4LightAtten0, " + worldPos + ", " + worldNormal + ");" ); - dataCollector.AddToVertexLocalVariables( UniqueId, "#endif //vl" ); - dataCollector.AddToVertexLocalVariables( UniqueId, outSH + " = ShadeSHPerVertex (" + worldNormal + ", " + outSH + ");" ); - dataCollector.AddToVertexLocalVariables( UniqueId, "#endif //sh" ); - dataCollector.AddToVertexLocalVariables( UniqueId, "#endif //nstalm" ); - - //dataCollector.AddToPragmas( UniqueId, "multi_compile_fwdbase" ); - - string fragWorldNormal = string.Empty; - if( m_inputPorts[ 0 ].IsConnected ) - { - if( m_normalSpace == ViewSpace.Tangent ) - fragWorldNormal = dataCollector.TemplateDataCollectorInstance.GetWorldNormal( UniqueId, CurrentPrecisionType, m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ), OutputId ); - else - fragWorldNormal = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - } - else - { - fragWorldNormal = dataCollector.TemplateDataCollectorInstance.GetWorldNormal( PrecisionType.Float, false, MasterNodePortCategory.Fragment ); - } - - dataCollector.AddLocalVariable( UniqueId, "UnityGIInput data" + OutputId + ";" ); - dataCollector.AddLocalVariable( UniqueId, "UNITY_INITIALIZE_OUTPUT( UnityGIInput, data" + OutputId + " );" ); - - dataCollector.AddLocalVariable( UniqueId, "#if defined(LIGHTMAP_ON) || defined(DYNAMICLIGHTMAP_ON) //dylm" + OutputId ); - dataCollector.AddLocalVariable( UniqueId, "data" + OutputId + ".lightmapUV = " + fInName + "." + varName + ";" ); - dataCollector.AddLocalVariable( UniqueId, "#endif //dylm" + OutputId ); - - dataCollector.AddLocalVariable( UniqueId, "#if UNITY_SHOULD_SAMPLE_SH //fsh" + OutputId ); - dataCollector.AddLocalVariable( UniqueId, "data" + OutputId + ".ambient = " + fInName + "." + shVarName + ";" ); - dataCollector.AddLocalVariable( UniqueId, "#endif //fsh" + OutputId ); - - dataCollector.AddToLocalVariables( UniqueId, "UnityGI gi" + OutputId + " = UnityGI_Base(data" + OutputId + ", 1, " + fragWorldNormal + ");" ); - - finalValue = "gi" + OutputId + ".indirect.diffuse"; - m_outputPorts[ 0 ].SetLocalValue( finalValue, dataCollector.PortCategory ); - return finalValue; - } - else - { - if( dataCollector.CurrentSRPType == TemplateSRPType.Lightweight ) - { - string texcoord1 = string.Empty; - - if( dataCollector.TemplateDataCollectorInstance.HasInfo( TemplateInfoOnSematics.TEXTURE_COORDINATES1, false, MasterNodePortCategory.Vertex ) ) - texcoord1 = dataCollector.TemplateDataCollectorInstance.GetInfo( TemplateInfoOnSematics.TEXTURE_COORDINATES1, false, MasterNodePortCategory.Vertex ).VarName; - else - texcoord1 = dataCollector.TemplateDataCollectorInstance.RegisterInfoOnSemantic( MasterNodePortCategory.Vertex, TemplateInfoOnSematics.TEXTURE_COORDINATES1, TemplateSemantics.TEXCOORD1, "texcoord1", WirePortDataType.FLOAT4, PrecisionType.Float, false ); - - string vOutName = dataCollector.TemplateDataCollectorInstance.CurrentTemplateData.VertexFunctionData.OutVarName; - string fInName = dataCollector.TemplateDataCollectorInstance.CurrentTemplateData.FragmentFunctionData.InVarName; - - - if( !dataCollector.TemplateDataCollectorInstance.HasRawInterpolatorOfName( "lightmapUVOrVertexSH" ) ) - { - string worldNormal = dataCollector.TemplateDataCollectorInstance.GetWorldNormal( PrecisionType.Float, false, MasterNodePortCategory.Vertex ); - dataCollector.TemplateDataCollectorInstance.RequestNewInterpolator( WirePortDataType.FLOAT4, false, "lightmapUVOrVertexSH" ); - - dataCollector.AddToVertexLocalVariables( UniqueId, "OUTPUT_LIGHTMAP_UV( " + texcoord1 + ", unity_LightmapST, " + vOutName + ".lightmapUVOrVertexSH.xy );" ); - dataCollector.AddToVertexLocalVariables( UniqueId, "OUTPUT_SH( " + worldNormal + ", " + vOutName + ".lightmapUVOrVertexSH.xyz );" ); - - dataCollector.AddToPragmas( UniqueId, "multi_compile _ DIRLIGHTMAP_COMBINED" ); - dataCollector.AddToPragmas( UniqueId, "multi_compile _ LIGHTMAP_ON" ); - } - - string fragWorldNormal = string.Empty; - if( m_inputPorts[ 0 ].IsConnected ) - { - if( m_normalSpace == ViewSpace.Tangent ) - fragWorldNormal = dataCollector.TemplateDataCollectorInstance.GetWorldNormal( UniqueId, CurrentPrecisionType, m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ), OutputId ); - else - fragWorldNormal = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - } - else - { - fragWorldNormal = dataCollector.TemplateDataCollectorInstance.GetWorldNormal( PrecisionType.Float, false, MasterNodePortCategory.Fragment ); - } - - //SAMPLE_GI - - //This function may not do full pixel and does not behave correctly with given normal thus is commented out - //dataCollector.AddLocalVariable( UniqueId, "float3 bakedGI" + OutputId + " = SAMPLE_GI( " + fInName + ".lightmapUVOrVertexSH.xy, " + fInName + ".lightmapUVOrVertexSH.xyz, " + fragWorldNormal + " );" ); - dataCollector.AddFunction( LWIndirectDiffuseBody[ 0 ], LWIndirectDiffuseBody, false ); - finalValue = "bakedGI" + OutputId; - string result = string.Format( LWIndirectDiffuseHeader, fInName + ".lightmapUVOrVertexSH.xy", fragWorldNormal ); - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT3, finalValue, result ); - - m_outputPorts[ 0 ].SetLocalValue( finalValue, dataCollector.PortCategory ); - return finalValue; - } - else if( dataCollector.CurrentSRPType == TemplateSRPType.HD ) - { - string texcoord1 = string.Empty; - string texcoord2 = string.Empty; - - if( dataCollector.TemplateDataCollectorInstance.HasInfo( TemplateInfoOnSematics.TEXTURE_COORDINATES1, false, MasterNodePortCategory.Vertex ) ) - texcoord1 = dataCollector.TemplateDataCollectorInstance.GetInfo( TemplateInfoOnSematics.TEXTURE_COORDINATES1, false, MasterNodePortCategory.Vertex ).VarName; - else - texcoord1 = dataCollector.TemplateDataCollectorInstance.RegisterInfoOnSemantic( MasterNodePortCategory.Vertex, TemplateInfoOnSematics.TEXTURE_COORDINATES1, TemplateSemantics.TEXCOORD1, "texcoord1", WirePortDataType.FLOAT4, PrecisionType.Float, false ); - - if( dataCollector.TemplateDataCollectorInstance.HasInfo( TemplateInfoOnSematics.TEXTURE_COORDINATES2, false, MasterNodePortCategory.Vertex ) ) - texcoord2 = dataCollector.TemplateDataCollectorInstance.GetInfo( TemplateInfoOnSematics.TEXTURE_COORDINATES2, false, MasterNodePortCategory.Vertex ).VarName; - else - texcoord2 = dataCollector.TemplateDataCollectorInstance.RegisterInfoOnSemantic( MasterNodePortCategory.Vertex, TemplateInfoOnSematics.TEXTURE_COORDINATES2, TemplateSemantics.TEXCOORD2, "texcoord2", WirePortDataType.FLOAT4, PrecisionType.Float, false ); - - dataCollector.TemplateDataCollectorInstance.RequestNewInterpolator( WirePortDataType.FLOAT4, false, "ase_lightmapUVs" ); - - string vOutName = dataCollector.TemplateDataCollectorInstance.CurrentTemplateData.VertexFunctionData.OutVarName; - string fInName = dataCollector.TemplateDataCollectorInstance.CurrentTemplateData.FragmentFunctionData.InVarName; - - dataCollector.AddToVertexLocalVariables( UniqueId, vOutName + ".ase_lightmapUVs.xy = " + texcoord1 + ".xy * unity_LightmapST.xy + unity_LightmapST.zw;" ); - dataCollector.AddToVertexLocalVariables( UniqueId, vOutName + ".ase_lightmapUVs.zw = " + texcoord2 + ".xy * unity_DynamicLightmapST.xy + unity_DynamicLightmapST.zw;" ); - - string worldPos = dataCollector.TemplateDataCollectorInstance.GetWorldPos( false, MasterNodePortCategory.Fragment ); - - dataCollector.AddToPragmas( UniqueId, "multi_compile _ LIGHTMAP_ON" ); - dataCollector.AddToPragmas( UniqueId, "multi_compile _ DIRLIGHTMAP_COMBINED" ); - dataCollector.AddToPragmas( UniqueId, "multi_compile _ DYNAMICLIGHTMAP_ON" ); - - string fragWorldNormal = string.Empty; - if( m_inputPorts[ 0 ].IsConnected ) - { - if( m_normalSpace == ViewSpace.Tangent ) - fragWorldNormal = dataCollector.TemplateDataCollectorInstance.GetWorldNormal( UniqueId, CurrentPrecisionType, m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ), OutputId ); - else - fragWorldNormal = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - } - else - { - fragWorldNormal = dataCollector.TemplateDataCollectorInstance.GetWorldNormal( PrecisionType.Float, false, MasterNodePortCategory.Fragment ); - } - - //SAMPLE_GI - dataCollector.AddLocalVariable( UniqueId, "float3 bakedGI" + OutputId + " = SampleBakedGI( " + worldPos + ", " + fragWorldNormal + ", " + fInName + ".ase_lightmapUVs.xy, " + fInName + ".ase_lightmapUVs.zw );" ); - finalValue = "bakedGI" + OutputId; - m_outputPorts[ 0 ].SetLocalValue( finalValue, dataCollector.PortCategory ); - return finalValue; - } - } - } - if( dataCollector.GenType == PortGenType.NonCustomLighting || dataCollector.CurrentCanvasMode != NodeAvailability.CustomLighting ) - return "float3(0,0,0)"; - - string normal = string.Empty; - if( m_inputPorts[ 0 ].IsConnected ) - { - dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_NORMAL, CurrentPrecisionType ); - dataCollector.AddToInput( UniqueId, SurfaceInputs.INTERNALDATA, addSemiColon: false ); - dataCollector.ForceNormal = true; - - normal = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - if( m_normalSpace == ViewSpace.Tangent ) - normal = "WorldNormalVector( " + Constants.InputVarStr + " , " + normal + " )"; - } - else - { - if( dataCollector.IsFragmentCategory ) - { - dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_NORMAL, CurrentPrecisionType ); - if( dataCollector.DirtyNormal ) - { - dataCollector.AddToInput( UniqueId, SurfaceInputs.INTERNALDATA, addSemiColon: false ); - dataCollector.ForceNormal = true; - } - } - - normal = GeneratorUtils.GenerateWorldNormal( ref dataCollector, UniqueId ); - } - - - if( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) - { - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT3, "indirectDiffuse" + OutputId, "ShadeSH9( float4( " + normal + ", 1 ) )" ); - } - else - { - dataCollector.AddLocalVariable( UniqueId, "UnityGI gi" + OutputId + " = gi;" ); - dataCollector.AddLocalVariable( UniqueId, PrecisionType.Float, WirePortDataType.FLOAT3, "diffNorm" + OutputId, normal ); - dataCollector.AddLocalVariable( UniqueId, "gi" + OutputId + " = UnityGI_Base( data, 1, diffNorm" + OutputId + " );" ); - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT3, "indirectDiffuse" + OutputId, "gi" + OutputId + ".indirect.diffuse + diffNorm" + OutputId + " * 0.0001" ); - } - - finalValue = "indirectDiffuse" + OutputId; - m_outputPorts[ 0 ].SetLocalValue( finalValue, dataCollector.PortCategory ); - return finalValue; - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - if( UIUtils.CurrentShaderVersion() > 13002 ) - m_normalSpace = (ViewSpace)Enum.Parse( typeof( ViewSpace ), GetCurrentParam( ref nodeParams ) ); - - UpdatePort(); - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_normalSpace ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/IndirectDiffuseLighting.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/IndirectDiffuseLighting.cs.meta deleted file mode 100644 index 2e9b5ba5..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/IndirectDiffuseLighting.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 11bf17b0757d57c47add2eb50c62c75e -timeCreated: 1495726164 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/IndirectSpecularLight.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/IndirectSpecularLight.cs deleted file mode 100644 index 197e193e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/IndirectSpecularLight.cs +++ /dev/null @@ -1,268 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using UnityEngine; -using UnityEditor; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Indirect Specular Light", "Light", "Indirect Specular Light", NodeAvailabilityFlags = (int)( NodeAvailability.CustomLighting | NodeAvailability.TemplateShader ) )] - public sealed class IndirectSpecularLight : ParentNode - { - [SerializeField] - private ViewSpace m_normalSpace = ViewSpace.Tangent; - - private const string DefaultErrorMessage = "This node only returns correct information using a custom light model, otherwise returns 0"; - private bool m_upgradeMessage = false; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT3, false, "Normal" ); - AddInputPort( WirePortDataType.FLOAT, false, "Smoothness" ); - AddInputPort( WirePortDataType.FLOAT, false, "Occlusion" ); - m_inputPorts[ 0 ].Vector3InternalData = Vector3.forward; - m_inputPorts[ 1 ].FloatInternalData = 0.5f; - m_inputPorts[ 2 ].FloatInternalData = 1; - m_inputPorts[ 1 ].AutoDrawInternalData = true; - m_inputPorts[ 2 ].AutoDrawInternalData = true; - m_autoWrapProperties = true; - AddOutputPort( WirePortDataType.FLOAT3, "RGB" ); - m_errorMessageTypeIsError = NodeMessageType.Warning; - m_errorMessageTooltip = DefaultErrorMessage; - m_previewShaderGUID = "d6e441d0a8608954c97fa347d3735e92"; - m_drawPreviewAsSphere = true; - } - - public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) - { - base.PropagateNodeData( nodeData, ref dataCollector ); - if( m_inputPorts[ 0 ].IsConnected ) - dataCollector.DirtyNormal = true; - } - - public override void SetPreviewInputs() - { - base.SetPreviewInputs(); - - if( m_inputPorts[ 0 ].IsConnected ) - { - if( m_normalSpace == ViewSpace.Tangent ) - m_previewMaterialPassId = 1; - else - m_previewMaterialPassId = 2; - } - else - { - m_previewMaterialPassId = 0; - } - } - - public override void DrawProperties() - { - base.DrawProperties(); - - EditorGUI.BeginChangeCheck(); - m_normalSpace = (ViewSpace)EditorGUILayoutEnumPopup( "Normal Space", m_normalSpace ); - if( EditorGUI.EndChangeCheck() ) - { - UpdatePort(); - } - if( !m_inputPorts[ 1 ].IsConnected ) - m_inputPorts[ 1 ].FloatInternalData = EditorGUILayout.FloatField( m_inputPorts[ 1 ].Name, m_inputPorts[ 1 ].FloatInternalData ); - if( !m_inputPorts[ 2 ].IsConnected ) - m_inputPorts[ 2 ].FloatInternalData = EditorGUILayout.FloatField( m_inputPorts[ 2 ].Name, m_inputPorts[ 2 ].FloatInternalData ); - } - - private void UpdatePort() - { - if( m_normalSpace == ViewSpace.World ) - m_inputPorts[ 0 ].ChangeProperties( "World Normal", m_inputPorts[ 0 ].DataType, false ); - else - m_inputPorts[ 0 ].ChangeProperties( "Normal", m_inputPorts[ 0 ].DataType, false ); - - m_sizeIsDirty = true; - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - if( m_upgradeMessage || ( ContainerGraph.CurrentStandardSurface != null && ContainerGraph.CurrentStandardSurface.CurrentLightingModel != StandardShaderLightModel.CustomLighting ) ) - m_showErrorMessage = true; - else - m_showErrorMessage = false; - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if( dataCollector.IsTemplate ) - { - if( !dataCollector.IsSRP ) - { - dataCollector.AddToIncludes( UniqueId, Constants.UnityLightingLib ); - string worldPos = dataCollector.TemplateDataCollectorInstance.GetWorldPos(); - string worldViewDir = dataCollector.TemplateDataCollectorInstance.GetViewDir( false, MasterNodePortCategory.Fragment ); - - string worldNormal = string.Empty; - if( m_inputPorts[ 0 ].IsConnected ) - { - if( m_normalSpace == ViewSpace.Tangent ) - worldNormal = dataCollector.TemplateDataCollectorInstance.GetWorldNormal( UniqueId, CurrentPrecisionType, m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ), OutputId ); - else - worldNormal = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - } - else - { - worldNormal = dataCollector.TemplateDataCollectorInstance.GetWorldNormal( PrecisionType.Float, false, MasterNodePortCategory.Fragment ); - } - - string tempsmoothness = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); - string tempocclusion = m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ); - - dataCollector.AddLocalVariable( UniqueId, "UnityGIInput data;" ); - dataCollector.AddLocalVariable( UniqueId, "UNITY_INITIALIZE_OUTPUT( UnityGIInput, data );" ); - dataCollector.AddLocalVariable( UniqueId, "data.worldPos = " + worldPos + ";" ); - dataCollector.AddLocalVariable( UniqueId, "data.worldViewDir = " + worldViewDir + ";" ); - dataCollector.AddLocalVariable( UniqueId, "data.probeHDR[0] = unity_SpecCube0_HDR;" ); - dataCollector.AddLocalVariable( UniqueId, "data.probeHDR[1] = unity_SpecCube1_HDR;" ); - dataCollector.AddLocalVariable( UniqueId, "#if UNITY_SPECCUBE_BLENDING || UNITY_SPECCUBE_BOX_PROJECTION //specdataif0" ); - dataCollector.AddLocalVariable( UniqueId, "\tdata.boxMin[0] = unity_SpecCube0_BoxMin;" ); - dataCollector.AddLocalVariable( UniqueId, "#endif //specdataif0" ); - dataCollector.AddLocalVariable( UniqueId, "#if UNITY_SPECCUBE_BOX_PROJECTION //specdataif1" ); - dataCollector.AddLocalVariable( UniqueId, "\tdata.boxMax[0] = unity_SpecCube0_BoxMax;" ); - dataCollector.AddLocalVariable( UniqueId, "\tdata.probePosition[0] = unity_SpecCube0_ProbePosition;" ); - dataCollector.AddLocalVariable( UniqueId, "\tdata.boxMax[1] = unity_SpecCube1_BoxMax;" ); - dataCollector.AddLocalVariable( UniqueId, "\tdata.boxMin[1] = unity_SpecCube1_BoxMin;" ); - dataCollector.AddLocalVariable( UniqueId, "\tdata.probePosition[1] = unity_SpecCube1_ProbePosition;" ); - dataCollector.AddLocalVariable( UniqueId, "#endif //specdataif1" ); - - dataCollector.AddLocalVariable( UniqueId, "Unity_GlossyEnvironmentData g" + OutputId + " = UnityGlossyEnvironmentSetup( " + tempsmoothness + ", " + worldViewDir + ", " + worldNormal + ", float3(0,0,0));" ); - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT3, "indirectSpecular" + OutputId, "UnityGI_IndirectSpecular( data, " + tempocclusion + ", " + worldNormal + ", g" + OutputId + " )" ); - return "indirectSpecular" + OutputId; - } - else - { - if( dataCollector.CurrentSRPType == TemplateSRPType.Lightweight ) - { - string worldViewDir = dataCollector.TemplateDataCollectorInstance.GetViewDir( false, MasterNodePortCategory.Fragment ); - string worldNormal = string.Empty; - if( m_inputPorts[ 0 ].IsConnected ) - { - if( m_normalSpace == ViewSpace.Tangent ) - worldNormal = dataCollector.TemplateDataCollectorInstance.GetWorldNormal( UniqueId, CurrentPrecisionType, m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ), OutputId ); - else - worldNormal = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - } - else - { - worldNormal = dataCollector.TemplateDataCollectorInstance.GetWorldNormal( PrecisionType.Float, false, MasterNodePortCategory.Fragment ); - } - - string tempsmoothness = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); - string tempocclusion = m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ); - - dataCollector.AddLocalVariable( UniqueId, "half3 reflectVector" + OutputId + " = reflect( -" + worldViewDir + ", " + worldNormal + " );" ); - dataCollector.AddLocalVariable( UniqueId, "float3 indirectSpecular" + OutputId + " = GlossyEnvironmentReflection( reflectVector" + OutputId + ", 1.0 - " + tempsmoothness + ", " + tempocclusion + " );" ); - return "indirectSpecular" + OutputId; - } - else if( dataCollector.CurrentSRPType == TemplateSRPType.HD ) - { - UIUtils.ShowMessage( UniqueId, "Indirect Specular Light node currently not supported on HDRP" ); - return m_outputPorts[0].ErrorValue; - } - } - } - - if( dataCollector.GenType == PortGenType.NonCustomLighting || dataCollector.CurrentCanvasMode != NodeAvailability.CustomLighting ) - return m_outputPorts[0].ErrorValue; - - string normal = string.Empty; - if( m_inputPorts[ 0 ].IsConnected ) - { - dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_NORMAL, CurrentPrecisionType ); - dataCollector.AddToInput( UniqueId, SurfaceInputs.INTERNALDATA, addSemiColon: false ); - dataCollector.ForceNormal = true; - - normal = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - if( m_normalSpace == ViewSpace.Tangent ) - normal = "WorldNormalVector( " + Constants.InputVarStr + " , " + normal + " )"; - - dataCollector.AddLocalVariable( UniqueId, "float3 indirectNormal" + OutputId + " = " + normal + ";" ); - normal = "indirectNormal" + OutputId; - } - else - { - if( dataCollector.IsFragmentCategory ) - { - dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_NORMAL, CurrentPrecisionType ); - if( dataCollector.DirtyNormal ) - { - dataCollector.AddToInput( UniqueId, SurfaceInputs.INTERNALDATA, addSemiColon: false ); - dataCollector.ForceNormal = true; - } - } - - normal = GeneratorUtils.GenerateWorldNormal( ref dataCollector, UniqueId ); - } - - string smoothness = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); - string occlusion = m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ); - string viewDir = "data.worldViewDir"; - - if( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) - { - string worldPos = GeneratorUtils.GenerateWorldPosition( ref dataCollector, UniqueId ); - viewDir = GeneratorUtils.GenerateViewDirection( ref dataCollector, UniqueId ); - - dataCollector.AddLocalVariable( UniqueId, "UnityGIInput data;" ); - dataCollector.AddLocalVariable( UniqueId, "UNITY_INITIALIZE_OUTPUT( UnityGIInput, data );" ); - dataCollector.AddLocalVariable( UniqueId, "data.worldPos = " + worldPos + ";" ); - dataCollector.AddLocalVariable( UniqueId, "data.worldViewDir = " + viewDir + ";" ); - dataCollector.AddLocalVariable( UniqueId, "data.probeHDR[0] = unity_SpecCube0_HDR;" ); - dataCollector.AddLocalVariable( UniqueId, "data.probeHDR[1] = unity_SpecCube1_HDR;" ); - dataCollector.AddLocalVariable( UniqueId, "#if UNITY_SPECCUBE_BLENDING || UNITY_SPECCUBE_BOX_PROJECTION //specdataif0" ); - dataCollector.AddLocalVariable( UniqueId, "data.boxMin[0] = unity_SpecCube0_BoxMin;" ); - dataCollector.AddLocalVariable( UniqueId, "#endif //specdataif0" ); - dataCollector.AddLocalVariable( UniqueId, "#if UNITY_SPECCUBE_BOX_PROJECTION //specdataif1" ); - dataCollector.AddLocalVariable( UniqueId, "data.boxMax[0] = unity_SpecCube0_BoxMax;" ); - dataCollector.AddLocalVariable( UniqueId, "data.probePosition[0] = unity_SpecCube0_ProbePosition;" ); - dataCollector.AddLocalVariable( UniqueId, "data.boxMax[1] = unity_SpecCube1_BoxMax;" ); - dataCollector.AddLocalVariable( UniqueId, "data.boxMin[1] = unity_SpecCube1_BoxMin;" ); - dataCollector.AddLocalVariable( UniqueId, "data.probePosition[1] = unity_SpecCube1_ProbePosition;" ); - dataCollector.AddLocalVariable( UniqueId, "#endif //specdataif1" ); - } - - dataCollector.AddLocalVariable( UniqueId, "Unity_GlossyEnvironmentData g" + OutputId + " = UnityGlossyEnvironmentSetup( " + smoothness + ", " + viewDir + ", " + normal + ", float3(0,0,0));" ); - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT3, "indirectSpecular" + OutputId, "UnityGI_IndirectSpecular( data, " + occlusion + ", " + normal + ", g" + OutputId + " )" ); - - return "indirectSpecular" + OutputId; - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - if( UIUtils.CurrentShaderVersion() > 13002 ) - m_normalSpace = (ViewSpace)Enum.Parse( typeof( ViewSpace ), GetCurrentParam( ref nodeParams ) ); - - if( UIUtils.CurrentShaderVersion() < 13804 ) - { - m_errorMessageTooltip = "Smoothness port was previously being used as Roughness, please check if you are correctly using it and save to confirm."; - m_upgradeMessage = true; - UIUtils.ShowMessage( UniqueId, "Indirect Specular Light node: Smoothness port was previously being used as Roughness, please check if you are correctly using it and save to confirm." ); - } - - UpdatePort(); - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_normalSpace ); - - m_errorMessageTooltip = DefaultErrorMessage; - m_upgradeMessage = false; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/IndirectSpecularLight.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/IndirectSpecularLight.cs.meta deleted file mode 100644 index 0c0bb141..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/IndirectSpecularLight.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 0820850e74009954188ff84e2f5cc4f2 -timeCreated: 1495817589 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/LightAttenuation.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/LightAttenuation.cs deleted file mode 100644 index 57ad0f44..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/LightAttenuation.cs +++ /dev/null @@ -1,128 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> -using UnityEditor; -using UnityEngine; - -namespace AmplifyShaderEditor -{ - [System.Serializable] - [NodeAttributes( "Light Attenuation", "Light", "Contains light attenuation for all types of light", NodeAvailabilityFlags = (int)( NodeAvailability.CustomLighting | NodeAvailability.TemplateShader ) )] - public sealed class LightAttenuation : ParentNode - { - static readonly string SurfaceError = "This node only returns correct information using a custom light model, otherwise returns 1"; - static readonly string TemplateError = "This node will only produce proper attenuation if the template contains a shadow caster pass"; - - private const string ASEAttenVarName = "ase_lightAtten"; - - private readonly string[] LightweightPragmaMultiCompiles = - { - "multi_compile _ _MAIN_LIGHT_SHADOWS", - "multi_compile _ _MAIN_LIGHT_SHADOWS_CASCADE", - "multi_compile _ _SHADOWS_SOFT" - }; - - //private readonly string[] LightweightVertexInstructions = - //{ - // /*local vertex position*/"VertexPositionInputs ase_vertexInput = GetVertexPositionInputs ({0});", - // "#ifdef _MAIN_LIGHT_SHADOWS//ase_lightAtten_vert", - // /*available interpolator*/"{0} = GetShadowCoord( ase_vertexInput );", - // "#endif//ase_lightAtten_vert" - //}; - private const string LightweightLightAttenDecl = "float ase_lightAtten = 0;"; - private readonly string[] LightweightFragmentInstructions = - { - /*shadow coords*/"Light ase_lightAtten_mainLight = GetMainLight( {0} );", - "ase_lightAtten = ase_lightAtten_mainLight.distanceAttenuation * ase_lightAtten_mainLight.shadowAttenuation;" - }; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddOutputPort( WirePortDataType.FLOAT, "Out" ); - m_errorMessageTypeIsError = NodeMessageType.Warning; - m_errorMessageTooltip = SurfaceError; - m_previewShaderGUID = "4b12227498a5c8d46b6c44ea018e5b56"; - m_drawPreviewAsSphere = true; - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if( dataCollector.IsTemplate ) - { - if( !dataCollector.IsSRP ) - { - return dataCollector.TemplateDataCollectorInstance.GetLightAtten( UniqueId ); - } - else - { - if( dataCollector.CurrentSRPType == TemplateSRPType.Lightweight ) - { - if( dataCollector.HasLocalVariable( LightweightLightAttenDecl )) - return ASEAttenVarName; - - // Pragmas - for( int i = 0; i < LightweightPragmaMultiCompiles.Length; i++ ) - dataCollector.AddToPragmas( UniqueId, LightweightPragmaMultiCompiles[ i ] ); - - string shadowCoords = dataCollector.TemplateDataCollectorInstance.GetShadowCoords( UniqueId/*, false, dataCollector.PortCategory*/ ); - //return shadowCoords; - // Vertex Instructions - //TemplateVertexData shadowCoordsData = dataCollector.TemplateDataCollectorInstance.RequestNewInterpolator( WirePortDataType.FLOAT4, false ); - //string vertexInterpName = dataCollector.TemplateDataCollectorInstance.CurrentTemplateData.VertexFunctionData.OutVarName; - //string vertexShadowCoords = vertexInterpName + "." + shadowCoordsData.VarNameWithSwizzle; - //string vertexPos = dataCollector.TemplateDataCollectorInstance.GetVertexPosition( WirePortDataType.FLOAT3, PrecisionType.Float ,false,MasterNodePortCategory.Vertex ); - - //dataCollector.AddToVertexLocalVariables( UniqueId, string.Format( LightweightVertexInstructions[ 0 ], vertexPos )); - //dataCollector.AddToVertexLocalVariables( UniqueId, LightweightVertexInstructions[ 1 ]); - //dataCollector.AddToVertexLocalVariables( UniqueId, string.Format( LightweightVertexInstructions[ 2 ], vertexShadowCoords ) ); - //dataCollector.AddToVertexLocalVariables( UniqueId, LightweightVertexInstructions[ 3 ]); - - // Fragment Instructions - //string fragmentInterpName = dataCollector.TemplateDataCollectorInstance.CurrentTemplateData.FragmentFunctionData.InVarName; - //string fragmentShadowCoords = fragmentInterpName + "." + shadowCoordsData.VarNameWithSwizzle; - - dataCollector.AddLocalVariable( UniqueId, LightweightLightAttenDecl ); - dataCollector.AddLocalVariable( UniqueId, string.Format( LightweightFragmentInstructions[ 0 ], shadowCoords ) ); - dataCollector.AddLocalVariable( UniqueId, LightweightFragmentInstructions[ 1 ] ); - return ASEAttenVarName; - } - else - { - UIUtils.ShowMessage( UniqueId, "Light Attenuation node currently not supported on HDRP" ); - return "1"; - } - } - } - - if ( dataCollector.GenType == PortGenType.NonCustomLighting || dataCollector.CurrentCanvasMode != NodeAvailability.CustomLighting ) - { - UIUtils.ShowMessage( UniqueId, "Light Attenuation node currently not supported on non-custom lighting surface shaders" ); - return "1"; - } - - dataCollector.UsingLightAttenuation = true; - return ASEAttenVarName; - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - if( ContainerGraph.CurrentCanvasMode == NodeAvailability.TemplateShader && ContainerGraph.CurrentSRPType != TemplateSRPType.Lightweight ) - { - m_showErrorMessage = true; - m_errorMessageTypeIsError = NodeMessageType.Warning; - m_errorMessageTooltip = TemplateError; - } else - { - m_errorMessageTypeIsError = NodeMessageType.Error; - m_errorMessageTooltip = SurfaceError; - if ( ( ContainerGraph.CurrentStandardSurface != null && ContainerGraph.CurrentStandardSurface.CurrentLightingModel != StandardShaderLightModel.CustomLighting ) ) - m_showErrorMessage = true; - else - m_showErrorMessage = false; - } - - - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/LightAttenuation.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/LightAttenuation.cs.meta deleted file mode 100644 index 05a8aa70..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/LightAttenuation.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 4e205b44d56609f459ffc558febe2792 -timeCreated: 1495449979 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/LightColorNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/LightColorNode.cs deleted file mode 100644 index 92021081..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/LightColorNode.cs +++ /dev/null @@ -1,88 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEngine; - -namespace AmplifyShaderEditor -{ - [System.Serializable] - [NodeAttributes( "Light Color", "Light", "Light Color, RGB value already contains light intensity while A only contains light intensity" )] - public sealed class LightColorNode : ShaderVariablesNode - { - private const string m_lightColorValue = "_LightColor0"; - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - ChangeOutputProperties( 0, "RGBA", WirePortDataType.COLOR ); - AddOutputPort( WirePortDataType.FLOAT3, "Color" ); - AddOutputPort( WirePortDataType.FLOAT, "Intensity" ); - m_previewShaderGUID = "43f5d3c033eb5044e9aeb40241358349"; - } - - public override void RenderNodePreview() - { - //Runs at least one time - if( !m_initialized ) - { - // nodes with no preview don't update at all - PreviewIsDirty = false; - return; - } - - if( !PreviewIsDirty ) - return; - - int count = m_outputPorts.Count; - for( int i = 0; i < count; i++ ) - { - RenderTexture temp = RenderTexture.active; - RenderTexture.active = m_outputPorts[ i ].OutputPreviewTexture; - Graphics.Blit( null, m_outputPorts[ i ].OutputPreviewTexture, PreviewMaterial, i ); - RenderTexture.active = temp; - } - - PreviewIsDirty = m_continuousPreviewRefresh; - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if( dataCollector.IsTemplate && !dataCollector.IsSRP ) - dataCollector.AddToIncludes( -1, Constants.UnityLightingLib ); - - base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); - - string finalVar = m_lightColorValue; - if( dataCollector.IsTemplate && dataCollector.IsSRP ) - { - if( dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HD ) - { - dataCollector.TemplateDataCollectorInstance.AddHDLightInfo(); - finalVar = string.Format( TemplateHelperFunctions.HDLightInfoFormat, "0", "color" ); ; - } - else - { - finalVar = "_MainLightColor"; - } - } - else - { - dataCollector.AddLocalVariable( UniqueId, "#if defined(LIGHTMAP_ON) && ( UNITY_VERSION < 560 || ( defined(LIGHTMAP_SHADOW_MIXING) && !defined(SHADOWS_SHADOWMASK) && defined(SHADOWS_SCREEN) ) )//aselc" ); - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT4, "ase_lightColor", "0" ); - dataCollector.AddLocalVariable( UniqueId, "#else //aselc" ); - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT4, "ase_lightColor", finalVar ); - dataCollector.AddLocalVariable( UniqueId, "#endif //aselc" ); - finalVar = "ase_lightColor"; - } - //else if( ContainerGraph.CurrentStandardSurface.CurrentLightingModel == StandardShaderLightModel.CustomLighting ) - // finalVar = "gi.light.color"; - - switch( outputId ) - { - default: - case 0: return finalVar; - case 1: return finalVar + ".rgb"; - case 2: return finalVar + ".a"; - } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/LightColorNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/LightColorNode.cs.meta deleted file mode 100644 index 9acf2a10..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/LightColorNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 275270020c577924caf04492f73b2ea6 -timeCreated: 1481126954 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/WorldSpaceLightPos.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/WorldSpaceLightPos.cs deleted file mode 100644 index 80aae5df..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/WorldSpaceLightPos.cs +++ /dev/null @@ -1,92 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEditor; -using UnityEngine; -namespace AmplifyShaderEditor -{ - [System.Serializable] - [NodeAttributes( "World Space Light Pos", "Light", "Light Position" )] - public sealed class WorldSpaceLightPos : ShaderVariablesNode - { - private const string HelperText = - "This node will behave differently according to light type." + - "\n\n- For directional lights the Dir/Pos output will specify a world space direction and Type will be set to 0." + - "\n\n- For other light types the Dir/Pos output will specify a world space position and Type will be set to 1."; - private const string m_lightPosValue = "_WorldSpaceLightPos0"; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - ChangeOutputProperties( 0, Constants.EmptyPortValue, WirePortDataType.FLOAT4 ); - AddOutputPort( WirePortDataType.FLOAT3, "Dir/Pos" ); - AddOutputPort( WirePortDataType.FLOAT, "Type" ); - m_previewShaderGUID = "2292a614672283c41a367b22cdde4620"; - m_drawPreviewAsSphere = true; - } - - public override void DrawProperties() - { - base.DrawProperties(); - EditorGUILayout.HelpBox( HelperText, MessageType.Info ); - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) - { - base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalVar ); - string finalVar = m_lightPosValue; - if( dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.IsSRP ) - finalVar = "_MainLightPosition"; - if( outputId == 1 ) - { - return finalVar + ".xyz"; - } - else if( outputId == 2 ) - { - return finalVar + ".w"; - } - else - { - return finalVar; - } - } - - public override void RefreshExternalReferences() - { - base.RefreshExternalReferences(); - if( !m_outputPorts[ 0 ].IsConnected ) - { - m_outputPorts[ 0 ].Visible = false; - m_sizeIsDirty = true; - } - } - - public override void RenderNodePreview() - { - //Runs at least one time - if( !m_initialized ) - { - // nodes with no preview don't update at all - PreviewIsDirty = false; - return; - } - - if( !PreviewIsDirty ) - return; - - SetPreviewInputs(); - - RenderTexture temp = RenderTexture.active; - - RenderTexture.active = m_outputPorts[ 0 ].OutputPreviewTexture; - Graphics.Blit( null, m_outputPorts[ 0 ].OutputPreviewTexture, PreviewMaterial, 0 ); - Graphics.Blit( m_outputPorts[ 0 ].OutputPreviewTexture, m_outputPorts[ 1 ].OutputPreviewTexture ); - - RenderTexture.active = m_outputPorts[ 2 ].OutputPreviewTexture; - Graphics.Blit( null, m_outputPorts[ 2 ].OutputPreviewTexture, PreviewMaterial, 1 ); - RenderTexture.active = temp; - - PreviewIsDirty = m_continuousPreviewRefresh; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/WorldSpaceLightPos.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/WorldSpaceLightPos.cs.meta deleted file mode 100644 index 79f4fc5b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Lighting/WorldSpaceLightPos.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: db94d973647dae9488d3ef5ee2fd95a4 -timeCreated: 1481126959 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/ShaderVariablesNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/ShaderVariablesNode.cs deleted file mode 100644 index 499999f1..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/ShaderVariablesNode.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - public class ShaderVariablesNode : ParentNode - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddOutputPort( WirePortDataType.OBJECT, "Out" ); - } - public override string GetIncludes() - { - return Constants.UnityShaderVariables; - } - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if( !( dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.IsSRP ) ) - dataCollector.AddToIncludes( UniqueId, Constants.UnityShaderVariables ); - return string.Empty; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/ShaderVariablesNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/ShaderVariablesNode.cs.meta deleted file mode 100644 index dce292dc..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/ShaderVariablesNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 1eb723e6ceff9a345a9dbfe04aa3dc11 -timeCreated: 1481126954 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time.meta deleted file mode 100644 index bfd7fd96..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 7c77e88b33fec7c429412624a7b2c620 -folderAsset: yes -timeCreated: 1481126947 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/CosTime.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/CosTime.cs deleted file mode 100644 index 096676f2..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/CosTime.cs +++ /dev/null @@ -1,55 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Cos Time", "Time", "Cosine of time" )] - public sealed class CosTime : ConstVecShaderVariable - { -#if UNITY_2018_3_OR_NEWER - private readonly string[] SRPTime = - { - "cos( _TimeParameters.x * 0.125 )", - "cos( _TimeParameters.x * 0.25 )", - "cos( _TimeParameters.x * 0.5 )", - "_TimeParameters.z", - }; -#endif - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - ChangeOutputName( 1, "t/8" ); - ChangeOutputName( 2, "t/4" ); - ChangeOutputName( 3, "t/2" ); - ChangeOutputName( 4, "t" ); - m_value = "_CosTime"; - m_previewShaderGUID = "3093999b42c3c0940a71799511d7781c"; - m_continuousPreviewRefresh = true; - } - - public override void RefreshExternalReferences() - { - base.RefreshExternalReferences(); - if( !m_outputPorts[ 0 ].IsConnected ) - { - m_outputPorts[ 0 ].Visible = false; - m_sizeIsDirty = true; - } - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { -#if UNITY_2018_3_OR_NEWER - if( outputId > 0 && dataCollector.IsTemplate ) - { - if( ( dataCollector.TemplateDataCollectorInstance.IsHDRP && ASEPackageManagerHelper.CurrentHDVersion > ASESRPVersions.ASE_SRP_5_16_1 ) || - ( dataCollector.TemplateDataCollectorInstance.IsLWRP && ASEPackageManagerHelper.CurrentLWVersion > ASESRPVersions.ASE_SRP_5_16_1 ) ) - return SRPTime[ outputId - 1 ]; - } -#endif - return base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/CosTime.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/CosTime.cs.meta deleted file mode 100644 index 80373c18..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/CosTime.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 447e504f2ca5aaf4bbf0fdbce33596bc -timeCreated: 1481126955 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/DeltaTime.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/DeltaTime.cs deleted file mode 100644 index a1f3380f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/DeltaTime.cs +++ /dev/null @@ -1,33 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Delta Time", "Time", "Delta time" )] - public sealed class DeltaTime : ConstVecShaderVariable - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - ChangeOutputName( 1, "dt" ); - ChangeOutputName( 2, "1/dt" ); - ChangeOutputName( 3, "smoothDt" ); - ChangeOutputName( 4, "1/smoothDt" ); - m_value = "unity_DeltaTime"; - m_previewShaderGUID = "9d69a693042c443498f96d6da60535eb"; - m_continuousPreviewRefresh = true; - } - - public override void RefreshExternalReferences() - { - base.RefreshExternalReferences(); - if( !m_outputPorts[ 0 ].IsConnected ) - { - m_outputPorts[ 0 ].Visible = false; - m_sizeIsDirty = true; - } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/DeltaTime.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/DeltaTime.cs.meta deleted file mode 100644 index 400f94fe..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/DeltaTime.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 3ddde7ed1ab4f8044a9a6aa3891f5ca4 -timeCreated: 1481126955 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/SimpleTimeNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/SimpleTimeNode.cs deleted file mode 100644 index 8445f90b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/SimpleTimeNode.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Time", "Time", "Time in seconds with a scale multiplier" )] - public sealed class SimpleTimeNode : ShaderVariablesNode - { - private const string TimeStandard = "_Time.y"; -#if UNITY_2018_3_OR_NEWER - private const string TimeSRP = "_TimeParameters.x"; -#endif - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - ChangeOutputProperties( 0, "Out", WirePortDataType.FLOAT ); - AddInputPort( WirePortDataType.FLOAT, false, "Scale" ); - m_inputPorts[ 0 ].FloatInternalData = 1; - m_useInternalPortData = true; - m_previewShaderGUID = "45b7107d5d11f124fad92bcb1fa53661"; - m_continuousPreviewRefresh = true; - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); - string multiplier = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - string timeGlobalVar = TimeStandard; -#if UNITY_2018_3_OR_NEWER - if( dataCollector.IsTemplate ) - { - if( ( dataCollector.TemplateDataCollectorInstance.IsHDRP && ASEPackageManagerHelper.CurrentHDVersion > ASESRPVersions.ASE_SRP_5_16_1 ) || - ( dataCollector.TemplateDataCollectorInstance.IsLWRP && ASEPackageManagerHelper.CurrentLWVersion > ASESRPVersions.ASE_SRP_5_16_1 ) ) - timeGlobalVar = TimeSRP; - } -#endif - if( multiplier == "1.0" ) - return timeGlobalVar; - - string scaledVarName = "mulTime" + OutputId; - string scaledVarValue = timeGlobalVar + " * " + multiplier; - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT, scaledVarName, scaledVarValue ); - return scaledVarName; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/SimpleTimeNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/SimpleTimeNode.cs.meta deleted file mode 100644 index 313b9315..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/SimpleTimeNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: f36e4491ee33fe74fa51cfb5ad450c6e -timeCreated: 1481126959 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/SinTimeNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/SinTimeNode.cs deleted file mode 100644 index aac2b1eb..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/SinTimeNode.cs +++ /dev/null @@ -1,58 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using UnityEditor; -using UnityEngine; -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Sin Time", "Time", "Unity sin time" )] - public sealed class SinTimeNode : ConstVecShaderVariable - { - //double m_time; -#if UNITY_2018_3_OR_NEWER - private readonly string[] SRPTime = - { - "sin( _TimeParameters.x * 0.125 )", - "sin( _TimeParameters.x * 0.25 )", - "sin( _TimeParameters.x * 0.5 )", - "_TimeParameters.y", - }; -#endif - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - ChangeOutputName( 1, "t/8" ); - ChangeOutputName( 2, "t/4" ); - ChangeOutputName( 3, "t/2" ); - ChangeOutputName( 4, "t" ); - m_value = "_SinTime"; - m_previewShaderGUID = "e4ba809e0badeb94994170b2cbbbba10"; - m_continuousPreviewRefresh = true; - } - - public override void RefreshExternalReferences() - { - base.RefreshExternalReferences(); - if( !m_outputPorts[ 0 ].IsConnected ) - { - m_outputPorts[ 0 ].Visible = false; - m_sizeIsDirty = true; - } - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { -#if UNITY_2018_3_OR_NEWER - if( outputId > 0 && dataCollector.IsTemplate ) - { - if( ( dataCollector.TemplateDataCollectorInstance.IsHDRP && ASEPackageManagerHelper.CurrentHDVersion > ASESRPVersions.ASE_SRP_5_16_1 ) || - ( dataCollector.TemplateDataCollectorInstance.IsLWRP && ASEPackageManagerHelper.CurrentLWVersion > ASESRPVersions.ASE_SRP_5_16_1 ) ) - return SRPTime[ outputId - 1 ]; - } -#endif - return base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/SinTimeNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/SinTimeNode.cs.meta deleted file mode 100644 index 876a7748..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/SinTimeNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 796acd44fcf330e4e921855630007b9b -timeCreated: 1481126957 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/TimeNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/TimeNode.cs deleted file mode 100644 index 258d5177..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/TimeNode.cs +++ /dev/null @@ -1,55 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Time Parameters", "Time", "Time since level load" )] - public sealed class TimeNode : ConstVecShaderVariable - { -#if UNITY_2018_3_OR_NEWER - private readonly string[] SRPTime = - { - "( _TimeParameters.x * 0.05 )", - "( _TimeParameters.x )", - "( _TimeParameters.x * 2 )", - "( _TimeParameters.x * 3 )", - }; -#endif - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - ChangeOutputName( 1, "t/20" ); - ChangeOutputName( 2, "t" ); - ChangeOutputName( 3, "t*2" ); - ChangeOutputName( 4, "t*3" ); - m_value = "_Time"; - m_previewShaderGUID = "73abc10c8d1399444827a7eeb9c24c2a"; - m_continuousPreviewRefresh = true; - } - - public override void RefreshExternalReferences() - { - base.RefreshExternalReferences(); - if( !m_outputPorts[ 0 ].IsConnected ) - { - m_outputPorts[ 0 ].Visible = false; - m_sizeIsDirty = true; - } - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { -#if UNITY_2018_3_OR_NEWER - if( outputId > 0 && dataCollector.IsTemplate ) - { - if( ( dataCollector.TemplateDataCollectorInstance.IsHDRP && ASEPackageManagerHelper.CurrentHDVersion > ASESRPVersions.ASE_SRP_5_16_1 ) || - ( dataCollector.TemplateDataCollectorInstance.IsLWRP && ASEPackageManagerHelper.CurrentLWVersion > ASESRPVersions.ASE_SRP_5_16_1 )) - return SRPTime[ outputId - 1 ]; - } -#endif - return base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/TimeNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/TimeNode.cs.meta deleted file mode 100644 index 521dcf41..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Time/TimeNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: d8c6b7bfb7784e14d8708ab6fb981268 -timeCreated: 1481126959 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform.meta deleted file mode 100644 index 008be40e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 2ce97203c4871664493f8760d88d0d4d -folderAsset: yes -timeCreated: 1481126946 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/CameraToWorldMatrix.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/CameraToWorldMatrix.cs deleted file mode 100644 index 1238566a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/CameraToWorldMatrix.cs +++ /dev/null @@ -1,24 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -namespace AmplifyShaderEditor -{ - [System.Serializable] - [NodeAttributes( "Camera To World Matrix", "Matrix Transform", "Current camera to world matrix" )] - public sealed class CameraToWorldMatrix : ConstantShaderVariable - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - ChangeOutputProperties( 0, "Out", WirePortDataType.FLOAT4x4 ); - m_value = "unity_CameraToWorld"; - m_drawPreview = false; - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - GeneratorUtils.RegisterUnity2019MatrixDefines( ref dataCollector ); - return base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/CameraToWorldMatrix.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/CameraToWorldMatrix.cs.meta deleted file mode 100644 index 2e13b7e9..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/CameraToWorldMatrix.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 6accfe0f350cf064dae07041fe90446b -timeCreated: 1481126959 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseProjectionMatrixNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseProjectionMatrixNode.cs deleted file mode 100644 index 0b53040c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseProjectionMatrixNode.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -namespace AmplifyShaderEditor -{ - [System.Serializable] - [NodeAttributes( "Inverse Projection Matrix", "Matrix Transform", "Current inverse projection matrix", NodeAvailabilityFlags = (int)( NodeAvailability.TemplateShader ) )] - public sealed class InverseProjectionMatrixNode : ConstantShaderVariable - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - ChangeOutputProperties( 0, "Out", WirePortDataType.FLOAT4x4 ); - m_value = "UNITY_MATRIX_I_P"; - m_drawPreview = false; - m_matrixId = 1; - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if( dataCollector.IsTemplate && dataCollector.IsSRP ) - { - return base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); - } - else - { - return GeneratorUtils.GenerateIdentity4x4( ref dataCollector, UniqueId ); - } - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - if( ContainerGraph.IsSRP ) - { - m_showErrorMessage = false; - } - else - { - m_showErrorMessage = true; - m_errorMessageTypeIsError = NodeMessageType.Warning; - m_errorMessageTooltip = "This node only works for Scriptable Render Pipeline (LWRP, HDRP, URP)"; - } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseProjectionMatrixNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseProjectionMatrixNode.cs.meta deleted file mode 100644 index 302ccf23..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseProjectionMatrixNode.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 0fdbc380972c44b489c5f948a40b8e69 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseTranspMVMatrixNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseTranspMVMatrixNode.cs deleted file mode 100644 index e4071ba0..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseTranspMVMatrixNode.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -namespace AmplifyShaderEditor -{ - [System.Serializable] - [NodeAttributes( "Inverse Transpose Model View Matrix", "Matrix Transform", "All Transformation types" )] - public sealed class InverseTranspMVMatrixNode : ConstantShaderVariable - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - ChangeOutputProperties( 0, "Out", WirePortDataType.FLOAT4x4 ); - m_value = "UNITY_MATRIX_IT_MV"; - m_drawPreview = false; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseTranspMVMatrixNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseTranspMVMatrixNode.cs.meta deleted file mode 100644 index 1b3b8fd3..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseTranspMVMatrixNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 3a71f1e560487aa4c8484c4153941884 -timeCreated: 1481126955 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseViewMatrixNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseViewMatrixNode.cs deleted file mode 100644 index c21aa195..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseViewMatrixNode.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -namespace AmplifyShaderEditor -{ - [System.Serializable] - [NodeAttributes( "Inverse View Matrix", "Matrix Transform", "Current inverse view matrix" )] - public sealed class InverseViewMatrixNode : ConstantShaderVariable - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - ChangeOutputProperties( 0, "Out", WirePortDataType.FLOAT4x4 ); - m_value = "UNITY_MATRIX_I_V"; - m_drawPreview = false; - m_matrixId = 0; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseViewMatrixNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseViewMatrixNode.cs.meta deleted file mode 100644 index 61b23243..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseViewMatrixNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: dd0c1c252c062184e9ad592b91e7fcd2 -timeCreated: 1481126956 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseViewProjectionMatrixNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseViewProjectionMatrixNode.cs deleted file mode 100644 index d812cc23..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseViewProjectionMatrixNode.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -namespace AmplifyShaderEditor -{ - [System.Serializable] - [NodeAttributes( "Inverse View Projection Matrix", "Matrix Transform", "Current view inverse projection matrix", NodeAvailabilityFlags = (int)( NodeAvailability.TemplateShader ) )] - public sealed class InverseViewProjectionMatrixNode : ConstantShaderVariable - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - ChangeOutputProperties( 0, "Out", WirePortDataType.FLOAT4x4 ); - m_value = "UNITY_MATRIX_I_VP"; - m_drawPreview = false; - m_matrixId = 1; - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if( dataCollector.IsTemplate && dataCollector.IsSRP ) - { - return base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); - } - else - { - return GeneratorUtils.GenerateIdentity4x4( ref dataCollector, UniqueId ); - } - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - if( ContainerGraph.IsSRP ) - { - m_showErrorMessage = false; - } - else - { - m_showErrorMessage = true; - m_errorMessageTypeIsError = NodeMessageType.Warning; - m_errorMessageTooltip = "This node only works for Scriptable Render Pipeline (LWRP, HDRP, URP)"; - } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseViewProjectionMatrixNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseViewProjectionMatrixNode.cs.meta deleted file mode 100644 index 6b221613..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/InverseViewProjectionMatrixNode.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: f6f151774e252dd4fb2b9ee440ec8eed -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/MMatrixNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/MMatrixNode.cs deleted file mode 100644 index ed903397..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/MMatrixNode.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -namespace AmplifyShaderEditor -{ - [System.Serializable] - [NodeAttributes( "Model Matrix", "Matrix Transform", "Current model matrix" )] - public sealed class MMatrixNode : ConstantShaderVariable - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - ChangeOutputProperties( 0, "Out", WirePortDataType.FLOAT4x4 ); - m_value = "UNITY_MATRIX_M"; - m_drawPreview = false; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/MMatrixNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/MMatrixNode.cs.meta deleted file mode 100644 index 51c6d1f8..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/MMatrixNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 503a386043991354eaca2410683d836a -timeCreated: 1481126955 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/MVMatrixNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/MVMatrixNode.cs deleted file mode 100644 index a99d8518..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/MVMatrixNode.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -namespace AmplifyShaderEditor -{ - [System.Serializable] - [NodeAttributes( "Model View Matrix", "Matrix Transform", "Current model * view matrix" )] - public sealed class MVMatrixNode : ConstantShaderVariable - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - ChangeOutputProperties( 0, "Out", WirePortDataType.FLOAT4x4 ); - m_value = "UNITY_MATRIX_MV"; - m_drawPreview = false; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/MVMatrixNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/MVMatrixNode.cs.meta deleted file mode 100644 index 6c0355ea..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/MVMatrixNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 30c7936db4e6fe5488076d799841f857 -timeCreated: 1481126954 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/MVPMatrixNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/MVPMatrixNode.cs deleted file mode 100644 index 324a1532..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/MVPMatrixNode.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -namespace AmplifyShaderEditor -{ - [System.Serializable] - [NodeAttributes( "Model View Projection Matrix", "Matrix Transform", "Current model * view * projection matrix" )] - public sealed class MVPMatrixNode : ConstantShaderVariable - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - ChangeOutputProperties( 0, "Out", WirePortDataType.FLOAT4x4 ); - m_value = "UNITY_MATRIX_MVP"; - m_drawPreview = false; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/MVPMatrixNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/MVPMatrixNode.cs.meta deleted file mode 100644 index 8275deff..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/MVPMatrixNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 74e00fb3d8e161f498c078795184bae4 -timeCreated: 1481126956 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ObjectToWorldMatrixNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ObjectToWorldMatrixNode.cs deleted file mode 100644 index 2f5873be..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ObjectToWorldMatrixNode.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -namespace AmplifyShaderEditor -{ - [System.Serializable] - [NodeAttributes( "Object To World Matrix", "Matrix Transform", "Current model matrix" )] - public sealed class ObjectToWorldMatrixNode : ConstantShaderVariable - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - ChangeOutputProperties( 0, "Out", WirePortDataType.FLOAT4x4 ); - m_value = "unity_ObjectToWorld"; - m_HDValue = "GetObjectToWorldMatrix()"; - m_LWValue = "GetObjectToWorldMatrix()"; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ObjectToWorldMatrixNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ObjectToWorldMatrixNode.cs.meta deleted file mode 100644 index 7d008d9d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ObjectToWorldMatrixNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: a0c0180a327eba54c832fbb695dd282f -timeCreated: 1481126958 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ProjectionMatrixNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ProjectionMatrixNode.cs deleted file mode 100644 index a80058d2..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ProjectionMatrixNode.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -namespace AmplifyShaderEditor -{ - [System.Serializable] - [NodeAttributes( "Projection Matrix", "Matrix Transform", "Current projection matrix" )] - public sealed class ProjectionMatrixNode : ConstantShaderVariable - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - ChangeOutputProperties( 0, "Out", WirePortDataType.FLOAT4x4 ); - m_value = "UNITY_MATRIX_P"; - m_drawPreview = false; - m_matrixId = 1; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ProjectionMatrixNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ProjectionMatrixNode.cs.meta deleted file mode 100644 index 5f2d19b1..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ProjectionMatrixNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 008fd07cf3f9a7140a9e23be43733f7c -timeCreated: 1481126953 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture0MatrixNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture0MatrixNode.cs deleted file mode 100644 index 4f568726..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture0MatrixNode.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -namespace AmplifyShaderEditor -{ - [System.Serializable] - [NodeAttributes( "Texture 0 Matrix", "Matrix Transform", "Texture 0 Matrix", null, UnityEngine.KeyCode.None, true, true )] - public sealed class Texture0MatrixNode : ConstantShaderVariable - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - ChangeOutputProperties( 0, "Out", WirePortDataType.FLOAT4x4 ); - m_value = "UNITY_MATRIX_TEXTURE0"; - m_drawPreview = false; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture0MatrixNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture0MatrixNode.cs.meta deleted file mode 100644 index fbdf6114..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture0MatrixNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: f57a1d05f7a9c5847912566ff1605c6d -timeCreated: 1481126960 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture1MatrixNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture1MatrixNode.cs deleted file mode 100644 index a9debbe5..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture1MatrixNode.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -namespace AmplifyShaderEditor -{ - [System.Serializable] - [NodeAttributes( "Texture 1 Matrix", "Matrix Transform", "Texture 1 Matrix", null, UnityEngine.KeyCode.None, true, true )] - public sealed class Texture1MatrixNode : ConstantShaderVariable - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - ChangeOutputProperties( 0, "Out", WirePortDataType.FLOAT4x4 ); - m_value = "UNITY_MATRIX_TEXTURE1"; - m_drawPreview = false; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture1MatrixNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture1MatrixNode.cs.meta deleted file mode 100644 index 429b1082..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture1MatrixNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 9ef360a7c6005ad479d7a3e6db1d32f4 -timeCreated: 1481126958 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture2MatrixNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture2MatrixNode.cs deleted file mode 100644 index c0938e7a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture2MatrixNode.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -namespace AmplifyShaderEditor -{ - [System.Serializable] - [NodeAttributes( "Texture 2 Matrix", "Matrix Transform", "Texture 2 Matrix", null, UnityEngine.KeyCode.None, true, true )] - public sealed class Texture2MatrixNode : ConstantShaderVariable - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - ChangeOutputProperties( 0, "Out", WirePortDataType.FLOAT4x4 ); - m_value = "UNITY_MATRIX_TEXTURE2"; - m_drawPreview = false; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture2MatrixNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture2MatrixNode.cs.meta deleted file mode 100644 index dc1e0080..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture2MatrixNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 6cf4950dda0f6e6438ace404fbef19a7 -timeCreated: 1481126956 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture3MatrixNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture3MatrixNode.cs deleted file mode 100644 index 8b5f86ae..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture3MatrixNode.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -namespace AmplifyShaderEditor -{ - [System.Serializable] - [NodeAttributes( "Texture 3 Matrix", "Matrix Transform", "Texture 3 Matrix", null, UnityEngine.KeyCode.None, true, true )] - public sealed class Texture3MatrixNode : ConstantShaderVariable - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - ChangeOutputProperties( 0, "Out", WirePortDataType.FLOAT4x4 ); - m_value = "UNITY_MATRIX_TEXTURE3"; - m_drawPreview = false; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture3MatrixNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture3MatrixNode.cs.meta deleted file mode 100644 index 00df6e3e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/Texture3MatrixNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 02a9fb7a3a104974e941f4109567b97f -timeCreated: 1481126953 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransformDirectionNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransformDirectionNode.cs deleted file mode 100644 index bc7ee22a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransformDirectionNode.cs +++ /dev/null @@ -1,560 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using UnityEngine; -using UnityEditor; - -namespace AmplifyShaderEditor -{ - public enum InverseTangentType - { - Fast, - Precise - } - - [Serializable] - [NodeAttributes( "Transform Direction", "Vector Operators", "Transforms a direction vector from one space to another" )] - public sealed class TransformDirectionNode : ParentNode - { - - [SerializeField] - private TransformSpaceFrom m_from = TransformSpaceFrom.Object; - - [SerializeField] - private TransformSpaceTo m_to = TransformSpaceTo.World; - - [SerializeField] - private bool m_normalize = false; - - [SerializeField] - private InverseTangentType m_inverseTangentType = InverseTangentType.Fast; - - private string InverseTBNStr = "Inverse TBN"; - - private const string NormalizeOptionStr = "Normalize"; - private const string NormalizeFunc = "normalize( {0} )"; - - private const string AseObjectToWorldDirVarName = "objToWorldDir"; - private const string AseObjectToWorldDirFormat = "mul( unity_ObjectToWorld, float4( {0}, 0 ) ).xyz"; - private const string AseSRPObjectToWorldDirFormat = "mul( GetObjectToWorldMatrix(), float4( {0}, 0 ) ).xyz"; - - private const string AseObjectToViewDirVarName = "objToViewDir"; - private const string AseObjectToViewDirFormat = "mul( UNITY_MATRIX_IT_MV, float4( {0}, 0 ) ).xyz"; - private const string AseHDObjectToViewDirFormat = "TransformWorldToViewDir( TransformObjectToWorldDir( {0} ))"; - - private const string AseWorldToObjectDirVarName = "worldToObjDir"; - private const string AseWorldToObjectDirFormat = "mul( unity_WorldToObject, float4( {0}, 0 ) ).xyz"; - private const string AseSRPWorldToObjectDirFormat = "mul( GetWorldToObjectMatrix(), float4( {0}, 0 ) ).xyz"; - - - private const string AseWorldToViewDirVarName = "worldToViewDir"; - private const string AseWorldToViewDirFormat = "mul( UNITY_MATRIX_V, float4( {0}, 0 ) ).xyz"; - - private const string AseViewToObjectDirVarName = "viewToObjDir"; - private const string AseViewToObjectDirFormat = "mul( UNITY_MATRIX_T_MV, float4( {0}, 0 ) ).xyz"; - - private const string AseViewToWorldDirVarName = "viewToWorldDir"; - private const string AseViewToWorldDirFormat = "mul( UNITY_MATRIX_I_V, float4( {0}, 0 ) ).xyz"; - - /////////////////////////////////////////////////////////// - private const string AseObjectToClipDirVarName = "objectToClipDir"; - private const string AseObjectToClipDirFormat = "mul(UNITY_MATRIX_VP, mul(unity_ObjectToWorld, float4({0}, 0.0)))"; - private const string AseSRPObjectToClipDirFormat = "TransformWorldToHClipDir(TransformObjectToWorldDir({0}))"; - - private const string AseWorldToClipDirVarName = "worldToClipDir"; - private const string AseWorldToClipDirFormat = "mul(UNITY_MATRIX_VP, float4({0}, 0.0))"; - private const string AseSRPWorldToClipDirFormat = "TransformWorldToHClipDir({0})"; - - private const string AseViewToClipDirVarName = "viewToClipDir"; - private const string AseViewToClipDirFormat = "mul(UNITY_MATRIX_P, float4({0}, 0.0))"; - private const string AseSRPViewToClipDirFormat = "mul(GetViewToHClipMatrix(), float4({0}, 1.0))"; - // - private const string AseClipToObjectDirVarName = "clipToObjectDir"; - - private const string AseClipToObjectDirFormat = "mul( UNITY_MATRIX_IT_MV, mul( unity_CameraInvProjection,float4({0},0)) ).xyz"; - private const string AseClipToWorldDirFormat = "mul( UNITY_MATRIX_I_V, mul( unity_CameraInvProjection,float4({0},0)) ).xyz"; - private const string AseClipToViewDirFormat = " mul( unity_CameraInvProjection,float4({0},0)).xyz"; - private const string AseHDClipToObjectDirFormat = "mul( UNITY_MATRIX_I_M, mul( UNITY_MATRIX_I_VP,float4({0},0)) ).xyz"; - - private const string AseClipToWorldDirVarName = "clipToWorldDir"; - private const string AseHDClipToWorldDirFormat = "mul( UNITY_MATRIX_I_VP, float4({0},0) ).xyz"; - - private const string AseClipToViewDirVarName = "clipToViewDir"; - private const string AseHDClipToViewDirFormat = " mul( UNITY_MATRIX_I_P,float4({0},0)).xyz"; - private const string AseClipToNDC = "{0}.xyz/{0}.w"; - - ///////////////////////////////////////////////////// - private const string AseObjectToTangentDirVarName = "objectToTangentDir"; - private const string AseWorldToTangentDirVarName = "worldToTangentDir"; - private const string AseViewToTangentDirVarName = "viewToTangentDir"; - private const string AseClipToTangentDirVarName = "clipToTangentDir"; - private const string ASEWorldToTangentFormat = "mul( ase_worldToTangent, {0})"; - - - private const string AseTangentToObjectDirVarName = "tangentTobjectDir"; - private const string AseTangentToWorldDirVarName = "tangentToWorldDir"; - private const string AseTangentToViewDirVarName = "tangentToViewDir"; - private const string AseTangentToClipDirVarName = "tangentToClipDir"; - private const string ASEMulOpFormat = "mul( {0}, {1} )"; - - - - /////////////////////////////////////////////////////////// - private const string FromStr = "From"; - private const string ToStr = "To"; - private const string SubtitleFormat = "{0} to {1}"; - - private readonly string[] m_spaceOptionsFrom = - { - "Object", - "World", - "View", - "Tangent" - }; - - private readonly string[] m_spaceOptionsTo = - { - "Object", - "World", - "View", - "Tangent", - "Clip" - }; - - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT3, false, Constants.EmptyPortValue ); - AddOutputVectorPorts( WirePortDataType.FLOAT3, "XYZ" ); - m_useInternalPortData = true; - m_autoWrapProperties = true; - m_previewShaderGUID = "74e4d859fbdb2c0468de3612145f4929"; - m_textLabelWidth = 100; - UpdateSubtitle(); - } - - private void UpdateSubtitle() - { - SetAdditonalTitleText( string.Format( SubtitleFormat, m_from, m_to ) ); - } - - public override void DrawProperties() - { - base.DrawProperties(); - EditorGUI.BeginChangeCheck(); - m_from = (TransformSpaceFrom)EditorGUILayoutPopup( FromStr, (int)m_from, m_spaceOptionsFrom ); - m_to = (TransformSpaceTo)EditorGUILayoutPopup( ToStr, (int)m_to, m_spaceOptionsTo ); - if( m_from == TransformSpaceFrom.Tangent ) - { - m_inverseTangentType = (InverseTangentType)EditorGUILayoutEnumPopup( InverseTBNStr, m_inverseTangentType ); - } - - m_normalize = EditorGUILayoutToggle( NormalizeOptionStr, m_normalize ); - if( EditorGUI.EndChangeCheck() ) - { - UpdateSubtitle(); - } - } - - public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) - { - base.PropagateNodeData( nodeData, ref dataCollector ); - if( (int)m_from != (int)m_to && ( m_from == TransformSpaceFrom.Tangent || m_to == TransformSpaceTo.Tangent ) ) - dataCollector.DirtyNormal = true; - } - - void CalculateTransform( TransformSpaceFrom from, TransformSpaceTo to, ref MasterNodeDataCollector dataCollector, ref string varName, ref string result ) - { - switch( from ) - { - case TransformSpaceFrom.Object: - { - switch( to ) - { - default: case TransformSpaceTo.Object: break; - case TransformSpaceTo.World: - { - if( dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType != TemplateSRPType.BuiltIn ) - result = string.Format( AseSRPObjectToWorldDirFormat, result ); - else - result = string.Format( AseObjectToWorldDirFormat, result ); - varName = AseObjectToWorldDirVarName + OutputId; - } - break; - case TransformSpaceTo.View: - { - if( dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HD ) - result = string.Format( AseHDObjectToViewDirFormat, result ); - else - result = string.Format( AseObjectToViewDirFormat, result ); - varName = AseObjectToViewDirVarName + OutputId; - } - break; - case TransformSpaceTo.Clip: - { - if( dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType != TemplateSRPType.BuiltIn ) - { - result = string.Format( AseSRPObjectToClipDirFormat, result ); - } - else - { - result = string.Format( AseObjectToClipDirFormat, result ); - } - varName = AseObjectToClipDirVarName + OutputId; - } - break; - } - } - break; - case TransformSpaceFrom.World: - { - switch( to ) - { - case TransformSpaceTo.Object: - { - if( dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType != TemplateSRPType.BuiltIn ) - result = string.Format( AseSRPWorldToObjectDirFormat, result ); - else - result = string.Format( AseWorldToObjectDirFormat, result ); - varName = AseWorldToObjectDirVarName + OutputId; - } - break; - default: - case TransformSpaceTo.World: break; - case TransformSpaceTo.View: - { - result = string.Format( AseWorldToViewDirFormat, result ); - varName = AseWorldToViewDirVarName + OutputId; - } - break; - case TransformSpaceTo.Clip: - { - if( dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType != TemplateSRPType.BuiltIn ) - { - result = string.Format( AseSRPWorldToClipDirFormat, result ); - } - else - { - result = string.Format( AseWorldToClipDirFormat, result ); - } - varName = AseWorldToClipDirVarName + OutputId; - } - break; - } - } - break; - case TransformSpaceFrom.View: - { - switch( to ) - { - case TransformSpaceTo.Object: - { - result = string.Format( AseViewToObjectDirFormat, result ); - varName = AseViewToObjectDirVarName + OutputId; - } - break; - case TransformSpaceTo.World: - { - result = string.Format( AseViewToWorldDirFormat, result ); - varName = AseViewToWorldDirVarName + OutputId; - } - break; - default: case TransformSpaceTo.View: break; - case TransformSpaceTo.Clip: - { - if( dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType != TemplateSRPType.BuiltIn ) - { - result = string.Format( AseSRPViewToClipDirFormat, result ); - } - else - { - result = string.Format( AseViewToClipDirFormat, result ); - } - varName = AseViewToClipDirVarName + OutputId; - } - break; - } - } - break; - //case TransformSpace.Clip: - //{ - // switch( to ) - // { - // case TransformSpace.Object: - // { - // if( dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HD ) - // { - // result = string.Format( AseHDClipToObjectDirFormat, result ); - // } - // else - // { - // result = string.Format( AseClipToObjectDirFormat, result ); - // } - // varName = AseClipToObjectDirVarName + OutputId; - // } - // break; - // case TransformSpace.World: - // { - // if( dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HD ) - // { - // result = string.Format( AseHDClipToWorldDirFormat, result ); - // } - // else - // { - // result = string.Format( AseClipToWorldDirFormat, result ); - // } - // varName = AseClipToWorldDirVarName + OutputId; - // } - // break; - // case TransformSpace.View: - // { - // if( dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HD ) - // { - // result = string.Format( AseHDClipToViewDirFormat, result ); - // } - // else - // { - // result = string.Format( AseClipToViewDirFormat, result ); - // } - // varName = AseClipToViewDirVarName + OutputId; - // } - // break; - // case TransformSpace.Clip: break; - // default: - // break; - // } - //} - //break; - default: break; - } - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) - return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); - - GeneratorUtils.RegisterUnity2019MatrixDefines( ref dataCollector ); - - string result = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - string varName = string.Empty; - - if( (int)m_from == (int)m_to ) - { - RegisterLocalVariable( 0, result, ref dataCollector ); - return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); - } - - switch( m_from ) - { - case TransformSpaceFrom.Object: - { - switch( m_to ) - { - default: case TransformSpaceTo.Object: break; - case TransformSpaceTo.World: - { - CalculateTransform( m_from, m_to, ref dataCollector, ref varName, ref result ); - } - break; - case TransformSpaceTo.View: - { - CalculateTransform( m_from, m_to, ref dataCollector, ref varName, ref result ); - } - break; - case TransformSpaceTo.Clip: - { - CalculateTransform( m_from, m_to, ref dataCollector, ref varName, ref result ); - } - break; - case TransformSpaceTo.Tangent: - { - GeneratorUtils.GenerateWorldToTangentMatrix( ref dataCollector, UniqueId, CurrentPrecisionType ); - CalculateTransform( m_from, TransformSpaceTo.World, ref dataCollector, ref varName, ref result ); - result = string.Format( ASEWorldToTangentFormat, result ); - varName = AseObjectToTangentDirVarName + OutputId; - } - break; - } - } - break; - case TransformSpaceFrom.World: - { - switch( m_to ) - { - case TransformSpaceTo.Object: - { - CalculateTransform( m_from, m_to, ref dataCollector, ref varName, ref result ); - } - break; - default: - case TransformSpaceTo.World: break; - case TransformSpaceTo.View: - { - CalculateTransform( m_from, m_to, ref dataCollector, ref varName, ref result ); - } - break; - case TransformSpaceTo.Clip: - { - CalculateTransform( m_from, m_to, ref dataCollector, ref varName, ref result ); - } - break; - case TransformSpaceTo.Tangent: - { - GeneratorUtils.GenerateWorldToTangentMatrix( ref dataCollector, UniqueId, CurrentPrecisionType ); - result = string.Format( ASEWorldToTangentFormat, result ); - varName = AseWorldToTangentDirVarName + OutputId; - } - break; - } - } - break; - case TransformSpaceFrom.View: - { - switch( m_to ) - { - case TransformSpaceTo.Object: - { - CalculateTransform( m_from, m_to, ref dataCollector, ref varName, ref result ); - } - break; - case TransformSpaceTo.World: - { - CalculateTransform( m_from, m_to, ref dataCollector, ref varName, ref result ); - } - break; - default: case TransformSpaceTo.View: break; - case TransformSpaceTo.Clip: - { - CalculateTransform( m_from, m_to, ref dataCollector, ref varName, ref result ); - } - break; - case TransformSpaceTo.Tangent: - { - GeneratorUtils.GenerateWorldToTangentMatrix( ref dataCollector, UniqueId, CurrentPrecisionType ); - CalculateTransform( m_from, TransformSpaceTo.World, ref dataCollector, ref varName, ref result ); - result = string.Format( ASEWorldToTangentFormat, result ); - varName = AseViewToTangentDirVarName + OutputId; - } - break; - } - } - break; - //case TransformSpace.Clip: - //{ - // switch( m_to ) - // { - // case TransformSpace.Object: - // { - // CalculateTransform( m_from, m_to, ref dataCollector, ref varName, ref result ); - // } - // break; - // case TransformSpace.World: - // { - // CalculateTransform( m_from, m_to, ref dataCollector, ref varName, ref result ); - // } - // break; - // case TransformSpace.View: - // { - // CalculateTransform( m_from, m_to, ref dataCollector, ref varName, ref result ); - // } - // break; - // case TransformSpace.Clip: break; - // case TransformSpace.Tangent: - // { - // GeneratorUtils.GenerateWorldToTangentMatrix( ref dataCollector, UniqueId, CurrentPrecisionType ); - // CalculateTransform( m_from, TransformSpace.World, ref dataCollector, ref varName, ref result ); - // result = string.Format( ASEWorldToTangentFormat, result ); - // varName = AseClipToTangentDirVarName + OutputId; - // } - // break; - // default: - // break; - // } - //}break; - case TransformSpaceFrom.Tangent: - { - string matrixVal = string.Empty; - if( m_inverseTangentType == InverseTangentType.Fast ) - matrixVal = GeneratorUtils.GenerateTangentToWorldMatrixFast( ref dataCollector, UniqueId, CurrentPrecisionType ); - else - matrixVal = GeneratorUtils.GenerateTangentToWorldMatrixPrecise( ref dataCollector, UniqueId, CurrentPrecisionType ); - - switch( m_to ) - { - case TransformSpaceTo.Object: - { - result = string.Format( ASEMulOpFormat, matrixVal, result ); - CalculateTransform( TransformSpaceFrom.World, m_to, ref dataCollector, ref varName, ref result ); - varName = AseTangentToObjectDirVarName + OutputId; - } - break; - case TransformSpaceTo.World: - { - result = string.Format( ASEMulOpFormat, matrixVal, result ); - varName = AseTangentToWorldDirVarName + OutputId; - } - break; - case TransformSpaceTo.View: - { - result = string.Format( ASEMulOpFormat, matrixVal, result ); - CalculateTransform( TransformSpaceFrom.World, m_to, ref dataCollector, ref varName, ref result ); - varName = AseTangentToViewDirVarName + OutputId; - } - break; - case TransformSpaceTo.Clip: - { - result = string.Format( ASEMulOpFormat, matrixVal, result ); - CalculateTransform( TransformSpaceFrom.World, m_to, ref dataCollector, ref varName, ref result ); - varName = AseTangentToClipDirVarName + OutputId; - } - break; - case TransformSpaceTo.Tangent: - default: - break; - } - } - break; - default: break; - } - - if( m_normalize ) - result = string.Format( NormalizeFunc, result ); - - RegisterLocalVariable( 0, result, ref dataCollector, varName ); - return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - string from = GetCurrentParam( ref nodeParams ); - if( UIUtils.CurrentShaderVersion() < 17500 && from.Equals( "Clip" ) ) - { - UIUtils.ShowMessage( UniqueId, "Clip Space no longer supported on From field over Transform Direction node" ); - } - else - { - m_from = (TransformSpaceFrom)Enum.Parse( typeof( TransformSpaceFrom ), from ); - } - m_to = (TransformSpaceTo)Enum.Parse( typeof( TransformSpaceTo ), GetCurrentParam( ref nodeParams ) ); - m_normalize = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - if( UIUtils.CurrentShaderVersion() > 15800 ) - { - m_inverseTangentType = (InverseTangentType)Enum.Parse( typeof( InverseTangentType ), GetCurrentParam( ref nodeParams ) ); - } - UpdateSubtitle(); - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_from ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_to ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_normalize ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_inverseTangentType ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransformDirectionNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransformDirectionNode.cs.meta deleted file mode 100644 index 123dc9ff..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransformDirectionNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 5088261e4c0031f4aba961a253707b80 -timeCreated: 1525857790 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransformPositionNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransformPositionNode.cs deleted file mode 100644 index 850f1a51..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransformPositionNode.cs +++ /dev/null @@ -1,620 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using UnityEngine; -using UnityEditor; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Transform Position", "Object Transform", "Transforms a position value from one space to another" )] - public sealed class TransformPositionNode : ParentNode - { - [SerializeField] - private TransformSpaceFrom m_from = TransformSpaceFrom.Object; - - [SerializeField] - private TransformSpaceTo m_to = TransformSpaceTo.World; - - [SerializeField] - private bool m_perspectiveDivide = false; - - [SerializeField] - private InverseTangentType m_inverseTangentType = InverseTangentType.Fast; - - [SerializeField] - private bool m_absoluteWorldPos = true; - - private const string AbsoluteWorldPosStr = "Absolute"; - - private string InverseTBNStr = "Inverse TBN"; - - private const string AseObjectToWorldPosVarName = "objToWorld"; - private const string AseObjectToWorldPosFormat = "mul( unity_ObjectToWorld, float4( {0}, 1 ) ).xyz"; - private const string AseHDObjectToWorldPosFormat = "mul( GetObjectToWorldMatrix(), float4( {0}, 1 ) ).xyz"; - private const string ASEHDAbsoluteWordPos = "GetAbsolutePositionWS({0})"; - private const string ASEHDRelaviveCameraPos = "GetCameraRelativePositionWS({0})"; - private const string AseObjectToViewPosVarName = "objToView"; - private const string AseObjectToViewPosFormat = "mul( UNITY_MATRIX_MV, float4( {0}, 1 ) ).xyz"; - private const string AseHDObjectToViewPosFormat = "TransformWorldToView( TransformObjectToWorld({0}) )"; - - private const string AseWorldToObjectPosVarName = "worldToObj"; - private const string AseWorldToObjectPosFormat = "mul( unity_WorldToObject, float4( {0}, 1 ) ).xyz"; - private const string AseSRPWorldToObjectPosFormat = "mul( GetWorldToObjectMatrix(), float4( {0}, 1 ) ).xyz"; - - - private const string AseWorldToViewPosVarName = "worldToView"; - private const string AseWorldToViewPosFormat = "mul( UNITY_MATRIX_V, float4( {0}, 1 ) ).xyz"; - - private const string AseViewToObjectPosVarName = "viewToObj"; - private const string AseViewToObjectPosFormat = "mul( unity_WorldToObject, mul( UNITY_MATRIX_I_V , float4( {0}, 1 ) ) ).xyz"; - private const string AseHDViewToObjectPosFormat = "mul( GetWorldToObjectMatrix(), mul( UNITY_MATRIX_I_V , float4( {0}, 1 ) ) ).xyz"; - - private const string AseViewToWorldPosVarName = "viewToWorld"; - private const string AseViewToWorldPosFormat = "mul( UNITY_MATRIX_I_V, float4( {0}, 1 ) ).xyz"; - - /////////////////////////////////////////////////////////// - private const string AseObjectToClipPosVarName = "objectToClip"; - private const string AseObjectToClipPosFormat = "UnityObjectToClipPos({0})"; - private const string AseSRPObjectToClipPosFormat = "TransformWorldToHClip(TransformObjectToWorld({0}))"; - - private const string AseWorldToClipPosVarName = "worldToClip"; - private const string AseWorldToClipPosFormat = "mul(UNITY_MATRIX_VP, float4({0}, 1.0))"; - private const string AseSRPWorldToClipPosFormat = "TransformWorldToHClip({0})"; - - private const string AseViewToClipPosVarName = "viewToClip"; - private const string AseViewToClipPosFormat = "mul(UNITY_MATRIX_P, float4({0}, 1.0))"; - private const string AseSRPViewToClipPosFormat = "TransformWViewToHClip({0})"; - // - - private const string AseClipToObjectPosVarName = "clipToObject"; - private const string AseClipToObjectPosFormat = "mul( UNITY_MATRIX_IT_MV, mul( unity_CameraInvProjection,float4({0},1)) ).xyz"; - private const string AseHDClipToObjectPosFormat = "mul( UNITY_MATRIX_I_M, mul( UNITY_MATRIX_I_VP,float4({0},1)) ).xyz"; - - private const string AseClipToWorldPosVarName = "clipToWorld"; - private const string AseClipToWorldPosFormat = "mul( UNITY_MATRIX_I_V, mul( unity_CameraInvProjection,float4({0},1)) ).xyz"; - private const string AseHDClipToWorldPosFormat = "mul( UNITY_MATRIX_I_VP, float4({0},1) ).xyz"; - - private const string AseClipToViewPosVarName = "clipToView"; - private const string AseClipToViewPosFormat = " mul( unity_CameraInvProjection,float4({0},1)).xyz"; - private const string AseHDClipToViewPosFormat = " mul( UNITY_MATRIX_I_P,float4({0},1)).xyz"; - private const string AseClipToNDC = "{0}.xyz/{0}.w"; - ///////////////////////////////////////////////////// - private const string AseObjectToTangentPosVarName = "objectToTangentPos"; - private const string AseWorldToTangentPosVarName = "worldToTangentPos"; - private const string AseViewToTangentPosVarName = "viewToTangentPos"; - private const string AseClipToTangentPosVarName = "clipToTangentPos"; - private const string ASEWorldToTangentFormat = "mul( ase_worldToTangent, {0})"; - - - private const string AseTangentToObjectPosVarName = "tangentTobjectPos"; - private const string AseTangentToWorldPosVarName = "tangentToWorldPos"; - private const string AseTangentToViewPosVarName = "tangentToViewPos"; - private const string AseTangentToClipPosVarName = "tangentToClipPos"; - private const string ASEMulOpFormat = "mul( {0}, {1} )"; - - - /////////////////////////////////////////////////////////// - private const string FromStr = "From"; - private const string ToStr = "To"; - private const string PerpectiveDivideStr = "Perpective Divide"; - private const string SubtitleFormat = "{0} to {1}"; - - private readonly string[] m_spaceOptionsFrom = - { - "Object", - "World", - "View", - "Tangent" - }; - - private readonly string[] m_spaceOptionsTo = - { - "Object", - "World", - "View", - "Tangent", - "Clip" - }; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT3, false, Constants.EmptyPortValue ); - AddOutputVectorPorts( WirePortDataType.FLOAT3, "XYZ" ); - m_useInternalPortData = true; - m_autoWrapProperties = true; - m_previewShaderGUID = "74e4d859fbdb2c0468de3612145f4929"; - m_textLabelWidth = 120; - UpdateSubtitle(); - } - - private void UpdateSubtitle() - { - SetAdditonalTitleText( string.Format( SubtitleFormat, m_from, m_to ) ); - } - - public override void DrawProperties() - { - base.DrawProperties(); - EditorGUI.BeginChangeCheck(); - m_from = (TransformSpaceFrom)EditorGUILayoutPopup( FromStr, (int)m_from, m_spaceOptionsFrom ); - m_to = (TransformSpaceTo)EditorGUILayoutPopup( ToStr, (int)m_to, m_spaceOptionsTo ); - if( m_from == TransformSpaceFrom.Tangent ) - { - m_inverseTangentType = (InverseTangentType)EditorGUILayoutEnumPopup( InverseTBNStr, m_inverseTangentType ); - } - if( EditorGUI.EndChangeCheck() ) - { - UpdateSubtitle(); - } - - if( m_to == TransformSpaceTo.Clip ) - { - m_perspectiveDivide = EditorGUILayoutToggle( PerpectiveDivideStr, m_perspectiveDivide ); - } - - //if( m_containerGraph.IsHDRP && ( m_from == TransformSpace.Object && m_to == TransformSpace.World ) || - // ( m_from == TransformSpace.World && m_to == TransformSpace.Object ) ) - //{ - // m_absoluteWorldPos = EditorGUILayoutToggle( AbsoluteWorldPosStr, m_absoluteWorldPos ); - //} - } - - public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) - { - base.PropagateNodeData( nodeData, ref dataCollector ); - if( (int)m_from != (int)m_to && ( m_from == TransformSpaceFrom.Tangent || m_to == TransformSpaceTo.Tangent ) ) - dataCollector.DirtyNormal = true; - } - - void CalculateTransform( TransformSpaceFrom from, TransformSpaceTo to, ref MasterNodeDataCollector dataCollector, ref string varName, ref string result ) - { - switch( from ) - { - case TransformSpaceFrom.Object: - { - switch( to ) - { - default: - case TransformSpaceTo.Object: break; - case TransformSpaceTo.World: - { - if( dataCollector.IsTemplate && dataCollector.IsSRP ) - { - if( dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HD ) - { - result = string.Format( AseHDObjectToWorldPosFormat, result ); - if( m_absoluteWorldPos ) - { - result = string.Format( ASEHDAbsoluteWordPos, result ); - } - } - else if( dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.Lightweight ) - { - result = string.Format( AseHDObjectToWorldPosFormat, result ); - } - } - else - result = string.Format( AseObjectToWorldPosFormat, result ); - - - varName = AseObjectToWorldPosVarName + OutputId; - } - break; - case TransformSpaceTo.View: - { - if( dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HD ) - result = string.Format( AseHDObjectToViewPosFormat, result ); - else - result = string.Format( AseObjectToViewPosFormat, result ); - varName = AseObjectToViewPosVarName + OutputId; - } - break; - case TransformSpaceTo.Clip: - { - if( dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType != TemplateSRPType.BuiltIn ) - { - result = string.Format( AseSRPObjectToClipPosFormat, result ); - } - else - { - result = string.Format( AseObjectToClipPosFormat, result ); - } - varName = AseObjectToClipPosVarName + OutputId; - } - break; - } - } - break; - case TransformSpaceFrom.World: - { - switch( to ) - { - case TransformSpaceTo.Object: - { - if( dataCollector.IsTemplate && dataCollector.IsSRP ) - { - if( dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HD ) - { - if( m_absoluteWorldPos ) - { - result = string.Format( ASEHDRelaviveCameraPos, result ); - } - result = string.Format( AseSRPWorldToObjectPosFormat, result ); - } - else if( dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.Lightweight ) - { - result = string.Format( AseSRPWorldToObjectPosFormat, result ); - } - - } - else - result = string.Format( AseWorldToObjectPosFormat, result ); - varName = AseWorldToObjectPosVarName + OutputId; - } - break; - default: - case TransformSpaceTo.World: break; - case TransformSpaceTo.View: - { - result = string.Format( AseWorldToViewPosFormat, result ); - varName = AseWorldToViewPosVarName + OutputId; - } - break; - case TransformSpaceTo.Clip: - { - if( dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType != TemplateSRPType.BuiltIn ) - { - result = string.Format( AseSRPWorldToClipPosFormat, result ); - } - else - { - result = string.Format( AseWorldToClipPosFormat, result ); - } - varName = AseWorldToClipPosVarName + OutputId; - } - break; - } - } - break; - case TransformSpaceFrom.View: - { - switch( to ) - { - case TransformSpaceTo.Object: - { - if( dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HD ) - result = string.Format( AseHDViewToObjectPosFormat, result ); - else - result = string.Format( AseViewToObjectPosFormat, result ); - varName = AseViewToObjectPosVarName + OutputId; - } - break; - case TransformSpaceTo.World: - { - result = string.Format( AseViewToWorldPosFormat, result ); - varName = AseViewToWorldPosVarName + OutputId; - } - break; - default: - case TransformSpaceTo.View: break; - case TransformSpaceTo.Clip: - { - if( dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType != TemplateSRPType.BuiltIn ) - { - result = string.Format( AseSRPViewToClipPosFormat, result ); - } - else - { - result = string.Format( AseViewToClipPosFormat, result ); - } - varName = AseViewToClipPosVarName + OutputId; - } - break; - } - } - break; - //case TransformSpace.Clip: - //{ - // switch( to ) - // { - // case TransformSpace.Object: - // { - // if( dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HD ) - // { - // result = string.Format( AseHDClipToObjectPosFormat, result ); - // } - // else - // { - // result = string.Format( AseClipToObjectPosFormat, result ); - // } - // varName = AseClipToObjectPosVarName + OutputId; - // } - // break; - // case TransformSpace.World: - // { - // if( dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HD ) - // { - // result = string.Format( AseHDClipToWorldPosFormat, result ); - // } - // else - // { - // result = string.Format( AseClipToWorldPosFormat, result ); - // } - // varName = AseClipToWorldPosVarName + OutputId; - // } - // break; - // case TransformSpace.View: - // { - // if( dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HD ) - // { - // result = string.Format( AseHDClipToViewPosFormat, result ); - // } - // else - // { - // result = string.Format( AseClipToViewPosFormat, result ); - // } - // varName = AseClipToViewPosVarName + OutputId; - // } - // break; - // case TransformSpace.Clip: break; - // default: - // break; - // } - //} - //break; - default: break; - } - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) - return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); - - GeneratorUtils.RegisterUnity2019MatrixDefines( ref dataCollector ); - - string result = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - string varName = string.Empty; - - if( (int)m_from == (int)m_to ) - { - RegisterLocalVariable( 0, result, ref dataCollector ); - return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); - } - - switch( m_from ) - { - case TransformSpaceFrom.Object: - { - switch( m_to ) - { - default: - case TransformSpaceTo.Object: break; - case TransformSpaceTo.World: - { - CalculateTransform( m_from, m_to, ref dataCollector, ref varName, ref result ); - } - break; - case TransformSpaceTo.View: - { - CalculateTransform( m_from, m_to, ref dataCollector, ref varName, ref result ); - } - break; - case TransformSpaceTo.Clip: - { - CalculateTransform( m_from, m_to, ref dataCollector, ref varName, ref result ); - } - break; - case TransformSpaceTo.Tangent: - { - GeneratorUtils.GenerateWorldToTangentMatrix( ref dataCollector, UniqueId, CurrentPrecisionType ); - CalculateTransform( m_from, TransformSpaceTo.World, ref dataCollector, ref varName, ref result ); - result = string.Format( ASEWorldToTangentFormat, result ); - varName = AseObjectToTangentPosVarName + OutputId; - } - break; - } - } - break; - case TransformSpaceFrom.World: - { - switch( m_to ) - { - case TransformSpaceTo.Object: - { - CalculateTransform( m_from, m_to, ref dataCollector, ref varName, ref result ); - } - break; - default: - case TransformSpaceTo.World: break; - case TransformSpaceTo.View: - { - CalculateTransform( m_from, m_to, ref dataCollector, ref varName, ref result ); - } - break; - case TransformSpaceTo.Clip: - { - CalculateTransform( m_from, m_to, ref dataCollector, ref varName, ref result ); - } - break; - case TransformSpaceTo.Tangent: - { - GeneratorUtils.GenerateWorldToTangentMatrix( ref dataCollector, UniqueId, CurrentPrecisionType ); - result = string.Format( ASEWorldToTangentFormat, result ); - varName = AseWorldToTangentPosVarName + OutputId; - } - break; - } - } - break; - case TransformSpaceFrom.View: - { - switch( m_to ) - { - case TransformSpaceTo.Object: - { - CalculateTransform( m_from, m_to, ref dataCollector, ref varName, ref result ); - } - break; - case TransformSpaceTo.World: - { - CalculateTransform( m_from, m_to, ref dataCollector, ref varName, ref result ); ; - } - break; - default: - case TransformSpaceTo.View: break; - case TransformSpaceTo.Clip: - { - CalculateTransform( m_from, m_to, ref dataCollector, ref varName, ref result ); - } - break; - case TransformSpaceTo.Tangent: - { - GeneratorUtils.GenerateWorldToTangentMatrix( ref dataCollector, UniqueId, CurrentPrecisionType ); - CalculateTransform( m_from, TransformSpaceTo.World, ref dataCollector, ref varName, ref result ); - result = string.Format( ASEWorldToTangentFormat, result ); - varName = AseViewToTangentPosVarName + OutputId; - } - break; - } - } - break; - //case TransformSpace.Clip: - //{ - // switch( m_to ) - // { - // case TransformSpace.Object: - // { - // CalculateTransform( m_from, m_to, ref dataCollector, ref varName, ref result ); - // } - // break; - // case TransformSpace.World: - // { - // CalculateTransform( m_from, m_to, ref dataCollector, ref varName, ref result ); - // } - // break; - // case TransformSpace.View: - // { - // CalculateTransform( m_from, m_to, ref dataCollector, ref varName, ref result ); - // } - // break; - // case TransformSpace.Clip: break; - // case TransformSpace.Tangent: - // { - // GeneratorUtils.GenerateWorldToTangentMatrix( ref dataCollector, UniqueId, CurrentPrecisionType ); - // CalculateTransform( m_from, TransformSpace.World, ref dataCollector, ref varName, ref result ); - // result = string.Format( ASEWorldToTangentFormat, result ); - // varName = AseClipToTangentPosVarName + OutputId; - // } - // break; - // default: - // break; - // } - //} - //break; - case TransformSpaceFrom.Tangent: - { - string matrixVal = string.Empty; - if( m_inverseTangentType == InverseTangentType.Fast ) - matrixVal = GeneratorUtils.GenerateTangentToWorldMatrixFast( ref dataCollector, UniqueId, CurrentPrecisionType ); - else - matrixVal = GeneratorUtils.GenerateTangentToWorldMatrixPrecise( ref dataCollector, UniqueId, CurrentPrecisionType ); - - switch( m_to ) - { - case TransformSpaceTo.Object: - { - result = string.Format( ASEMulOpFormat, matrixVal, result ); - CalculateTransform( TransformSpaceFrom.World, m_to, ref dataCollector, ref varName, ref result ); - varName = AseTangentToObjectPosVarName + OutputId; - } - break; - case TransformSpaceTo.World: - { - result = string.Format( ASEMulOpFormat, matrixVal, result ); - varName = AseTangentToWorldPosVarName + OutputId; - } - break; - case TransformSpaceTo.View: - { - result = string.Format( ASEMulOpFormat, matrixVal, result ); - CalculateTransform( TransformSpaceFrom.World, m_to, ref dataCollector, ref varName, ref result ); - varName = AseTangentToViewPosVarName + OutputId; - } - break; - case TransformSpaceTo.Clip: - { - result = string.Format( ASEMulOpFormat, matrixVal, result ); - CalculateTransform( TransformSpaceFrom.World, m_to, ref dataCollector, ref varName, ref result ); - varName = AseTangentToClipPosVarName + OutputId; - } - break; - case TransformSpaceTo.Tangent: - default: - break; - } - } - break; - default: break; - } - - if( m_to == TransformSpaceTo.Clip ) - { - if( m_perspectiveDivide ) - { - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT4, varName, result ); - result = string.Format( AseClipToNDC, varName ); - varName += "NDC"; - } - else - { - result += ".xyz"; - } - } - - RegisterLocalVariable( 0, result, ref dataCollector, varName ); - return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - string from = GetCurrentParam( ref nodeParams ); - if( UIUtils.CurrentShaderVersion() < 17500 && from.Equals( "Clip" ) ) - { - UIUtils.ShowMessage( UniqueId, "Clip Space no longer supported on From field over Transform Position node" ); - } - else - { - m_from = (TransformSpaceFrom)Enum.Parse( typeof( TransformSpaceFrom ), from ); - } - m_to = (TransformSpaceTo)Enum.Parse( typeof( TransformSpaceTo ), GetCurrentParam( ref nodeParams ) ); - if( UIUtils.CurrentShaderVersion() > 15701 ) - { - m_perspectiveDivide = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - } - if( UIUtils.CurrentShaderVersion() > 15800 ) - { - m_inverseTangentType = (InverseTangentType)Enum.Parse( typeof( InverseTangentType ), GetCurrentParam( ref nodeParams ) ); - } - if( UIUtils.CurrentShaderVersion() > 16103 ) - { - m_absoluteWorldPos = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - } - UpdateSubtitle(); - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_from ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_to ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_perspectiveDivide ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_inverseTangentType ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_absoluteWorldPos ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransformPositionNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransformPositionNode.cs.meta deleted file mode 100644 index 84e1fcd2..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransformPositionNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 274dde08d42e4b041b9be7a22a8c09d6 -timeCreated: 1525857790 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransformVariables.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransformVariables.cs deleted file mode 100644 index 1802fe55..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransformVariables.cs +++ /dev/null @@ -1,166 +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 -{ - public enum BuiltInShaderTransformTypes - { - UNITY_MATRIX_MVP = 0, - UNITY_MATRIX_MV, - UNITY_MATRIX_V, - UNITY_MATRIX_P, - UNITY_MATRIX_VP, - UNITY_MATRIX_T_MV, - UNITY_MATRIX_IT_MV, - //UNITY_MATRIX_TEXTURE0, - //UNITY_MATRIX_TEXTURE1, - //UNITY_MATRIX_TEXTURE2, - //UNITY_MATRIX_TEXTURE3, - _Object2World, - _World2Object//, - //unity_Scale - } - - [Serializable] - [NodeAttributes( "Common Transform Matrices", "Matrix Transform", "All Transformation types" )] - public sealed class TransformVariables : ShaderVariablesNode - { - [SerializeField] - private BuiltInShaderTransformTypes m_selectedType = BuiltInShaderTransformTypes.UNITY_MATRIX_MVP; - - private const string MatrixLabelStr = "Matrix"; - private readonly string[] ValuesStr = - { - "Model View Projection", - "Model View", - "View", - "Projection", - "View Projection", - "Transpose Model View", - "Inverse Transpose Model View", - "Object to World", - "Word to Object" - }; - - private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper(); - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - ChangeOutputProperties( 0, ValuesStr[ ( int ) m_selectedType ], WirePortDataType.FLOAT4x4 ); - m_textLabelWidth = 60; - m_hasLeftDropdown = true; - m_autoWrapProperties = true; - m_drawPreview = false; - } - - public override void AfterCommonInit() - { - base.AfterCommonInit(); - if( PaddingTitleLeft == 0 ) - { - PaddingTitleLeft = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; - if( PaddingTitleRight == 0 ) - PaddingTitleRight = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; - } - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - EditorGUI.BeginChangeCheck(); - m_selectedType = (BuiltInShaderTransformTypes)m_upperLeftWidget.DrawWidget( this, (int)m_selectedType, ValuesStr ); - if( EditorGUI.EndChangeCheck() ) - { - ChangeOutputName( 0, ValuesStr[ (int)m_selectedType ] ); - m_sizeIsDirty = true; - } - } - - public override void DrawProperties() - { - base.DrawProperties(); - EditorGUI.BeginChangeCheck(); - m_selectedType = ( BuiltInShaderTransformTypes ) EditorGUILayoutPopup( MatrixLabelStr, ( int ) m_selectedType, ValuesStr ); - if ( EditorGUI.EndChangeCheck() ) - { - ChangeOutputName( 0, ValuesStr[ ( int ) m_selectedType ] ); - m_sizeIsDirty = true; - } - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); - if( dataCollector.IsTemplate && dataCollector.IsSRP ) - { - switch( m_selectedType ) - { - case BuiltInShaderTransformTypes.UNITY_MATRIX_MVP: - return "mul(GetWorldToHClipMatrix(),GetObjectToWorldMatrix())"; - case BuiltInShaderTransformTypes.UNITY_MATRIX_MV: - return "mul( GetWorldToViewMatrix(),GetObjectToWorldMatrix())"; - case BuiltInShaderTransformTypes.UNITY_MATRIX_V: - return "GetWorldToViewMatrix()"; - case BuiltInShaderTransformTypes.UNITY_MATRIX_P: - return "GetViewToHClipMatrix()"; - case BuiltInShaderTransformTypes.UNITY_MATRIX_VP: - return "GetWorldToHClipMatrix()"; - case BuiltInShaderTransformTypes._Object2World: - return "GetObjectToWorldMatrix()"; - case BuiltInShaderTransformTypes._World2Object: - return "GetWorldToObjectMatrix()"; - case BuiltInShaderTransformTypes.UNITY_MATRIX_T_MV: - case BuiltInShaderTransformTypes.UNITY_MATRIX_IT_MV: - default: - { - UIUtils.ShowMessage( UniqueId, "Matrix not declared natively on SRP. Must create it manually inside ASE" ); - return "float4x4(" + - "1,0,0,0," + - "0,1,0,0," + - "0,0,1,0," + - "0,0,0,1)"; - } - } - } - else - { - return m_selectedType.ToString(); - } - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - string selectedTypeStr = GetCurrentParam( ref nodeParams ); - try - { - BuiltInShaderTransformTypes selectedType = (BuiltInShaderTransformTypes)Enum.Parse( typeof( BuiltInShaderTransformTypes ), selectedTypeStr ); - m_selectedType = selectedType; - } - catch( Exception e ) - { - switch( selectedTypeStr ) - { - default: Debug.LogException( e );break; - case "UNITY_MATRIX_TEXTURE0":UIUtils.ShowMessage( UniqueId, "Texture 0 matrix is no longer supported",MessageSeverity.Warning);break; - case "UNITY_MATRIX_TEXTURE1":UIUtils.ShowMessage( UniqueId, "Texture 1 matrix is no longer supported",MessageSeverity.Warning);break; - case "UNITY_MATRIX_TEXTURE2":UIUtils.ShowMessage( UniqueId, "Texture 2 matrix is no longer supported",MessageSeverity.Warning);break; - case "UNITY_MATRIX_TEXTURE3":UIUtils.ShowMessage( UniqueId, "Texture 3 matrix is no longer supported",MessageSeverity.Warning); break; - case "unity_Scale": UIUtils.ShowMessage( UniqueId, "Scale matrix is no longer supported", MessageSeverity.Warning ); break; - } - } - - ChangeOutputName( 0, ValuesStr[ ( int ) m_selectedType ] ); - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_selectedType ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransformVariables.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransformVariables.cs.meta deleted file mode 100644 index d0e613af..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransformVariables.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 04aad5172ee1d4d4795e20bfae0ff64d -timeCreated: 1481126953 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransposeMVMatrix.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransposeMVMatrix.cs deleted file mode 100644 index c7c46fe8..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransposeMVMatrix.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -namespace AmplifyShaderEditor -{ - [System.Serializable] - [NodeAttributes( "Transpose Model View Matrix", "Matrix Transform", "Transpose of model * view matrix" )] - public sealed class TransposeMVMatrix : ConstantShaderVariable - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - ChangeOutputProperties( 0, "Out", WirePortDataType.FLOAT4x4 ); - m_value = "UNITY_MATRIX_T_MV"; - m_drawPreview = false; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransposeMVMatrix.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransposeMVMatrix.cs.meta deleted file mode 100644 index 871d6018..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/TransposeMVMatrix.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 5762b195353d629448631bfb15fb8372 -timeCreated: 1481126955 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/UnityProjectorClipMatrixNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/UnityProjectorClipMatrixNode.cs deleted file mode 100644 index 09325ec7..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/UnityProjectorClipMatrixNode.cs +++ /dev/null @@ -1,23 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -namespace AmplifyShaderEditor -{ - [System.Serializable] - [NodeAttributes( "Projector Clip Matrix", "Matrix Transform", "Current Projector Clip matrix. To be used when working with Unity projector." )] - public sealed class UnityProjectorClipMatrixNode : ConstantShaderVariable - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - ChangeOutputProperties( 0, "Out", WirePortDataType.FLOAT4x4 ); - m_value = "unity_ProjectorClip"; - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - dataCollector.AddToUniforms( UniqueId, "float4x4 unity_ProjectorClip;" ); - return base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/UnityProjectorClipMatrixNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/UnityProjectorClipMatrixNode.cs.meta deleted file mode 100644 index 6bc17bde..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/UnityProjectorClipMatrixNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 6095e3e4dc186f146bc109813901ccc8 -timeCreated: 1512062884 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/UnityProjectorMatrixNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/UnityProjectorMatrixNode.cs deleted file mode 100644 index 4cfb63c8..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/UnityProjectorMatrixNode.cs +++ /dev/null @@ -1,23 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -namespace AmplifyShaderEditor -{ - [System.Serializable] - [NodeAttributes( "Projector Matrix", "Matrix Transform", "Current Projector Clip matrix. To be used when working with Unity projector." )] - public sealed class UnityProjectorMatrixNode : ConstantShaderVariable - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - ChangeOutputProperties( 0, "Out", WirePortDataType.FLOAT4x4 ); - m_value = "unity_Projector"; - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - dataCollector.AddToUniforms( UniqueId, "float4x4 unity_Projector;" ); - return base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/UnityProjectorMatrixNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/UnityProjectorMatrixNode.cs.meta deleted file mode 100644 index 0a62ab9f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/UnityProjectorMatrixNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: c3efd02b48473d94b92302654b671ddc -timeCreated: 1512062884 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/UnityScaleMatrix.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/UnityScaleMatrix.cs deleted file mode 100644 index 2d2f00c9..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/UnityScaleMatrix.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -namespace AmplifyShaderEditor -{ - [System.Serializable] - [NodeAttributes( "Scale Matrix", "Matrix Transform", "Scale Matrix",null, UnityEngine.KeyCode.None, true, true, "Object Scale" )] - public sealed class UnityScaleMatrix : ConstantShaderVariable - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - ChangeOutputProperties( 0, "Out", WirePortDataType.FLOAT4x4 ); - m_value = "unity_Scale"; - m_drawPreview = false; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/UnityScaleMatrix.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/UnityScaleMatrix.cs.meta deleted file mode 100644 index 26f2df76..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/UnityScaleMatrix.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 28a04286716e19f4aa58954888374428 -timeCreated: 1481126954 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ViewMatrixNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ViewMatrixNode.cs deleted file mode 100644 index 2291bc32..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ViewMatrixNode.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -namespace AmplifyShaderEditor -{ - [System.Serializable] - [NodeAttributes( "View Matrix", "Matrix Transform", "Current view matrix" )] - public sealed class ViewMatrixNode : ConstantShaderVariable - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - ChangeOutputProperties( 0, "Out", WirePortDataType.FLOAT4x4 ); - m_value = "UNITY_MATRIX_V"; - m_drawPreview = false; - m_matrixId = 0; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ViewMatrixNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ViewMatrixNode.cs.meta deleted file mode 100644 index bcfb2edc..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ViewMatrixNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 5aa75cc5e6044a44a9a4439eac1d948b -timeCreated: 1481126956 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ViewProjectionMatrixNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ViewProjectionMatrixNode.cs deleted file mode 100644 index 23e53e40..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ViewProjectionMatrixNode.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -namespace AmplifyShaderEditor -{ - [System.Serializable] - [NodeAttributes( "View Projection Matrix", "Matrix Transform", "Current view * projection matrix." )] - public sealed class ViewProjectionMatrixNode : ConstantShaderVariable - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - ChangeOutputProperties( 0, "Out", WirePortDataType.FLOAT4x4 ); - m_value = "UNITY_MATRIX_VP"; - m_drawPreview = false; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ViewProjectionMatrixNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ViewProjectionMatrixNode.cs.meta deleted file mode 100644 index 1a1cd1c4..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/ViewProjectionMatrixNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: fe26c99932382e047aebc05b7e67a3d0 -timeCreated: 1481126960 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/WorldToCameraMatrix.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/WorldToCameraMatrix.cs deleted file mode 100644 index 65d9e082..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/WorldToCameraMatrix.cs +++ /dev/null @@ -1,23 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -namespace AmplifyShaderEditor -{ - [System.Serializable] - [NodeAttributes( "World To Camera Matrix", "Matrix Transform", "Inverse of current camera to world matrix" )] - public sealed class WorldToCameraMatrix : ConstantShaderVariable - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - ChangeOutputProperties( 0, "Out", WirePortDataType.FLOAT4x4 ); - m_value = "unity_WorldToCamera"; - m_drawPreview = false; - } - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - GeneratorUtils.RegisterUnity2019MatrixDefines( ref dataCollector ); - return base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/WorldToCameraMatrix.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/WorldToCameraMatrix.cs.meta deleted file mode 100644 index a8d0b7a1..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/WorldToCameraMatrix.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 584bea5554dc1b64c8965d8fcfc54e23 -timeCreated: 1481126959 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/WorldToObjectMatrix.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/WorldToObjectMatrix.cs deleted file mode 100644 index dd82ebb1..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/WorldToObjectMatrix.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -namespace AmplifyShaderEditor -{ - [System.Serializable] - [NodeAttributes( "World To Object Matrix", "Matrix Transform", "Inverse of current world matrix" )] - public sealed class WorldToObjectMatrix : ConstantShaderVariable - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - ChangeOutputProperties( 0, "Out", WirePortDataType.FLOAT4x4 ); - m_value = "unity_WorldToObject"; - m_HDValue = "GetWorldToObjectMatrix()"; - m_LWValue = "GetWorldToObjectMatrix()"; - m_drawPreview = false; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/WorldToObjectMatrix.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/WorldToObjectMatrix.cs.meta deleted file mode 100644 index dd284eb7..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/WorldToObjectMatrix.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: d9e2a5077cc29de439d5c845eac35a04 -timeCreated: 1481126959 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/WorldToTangentMatrix.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/WorldToTangentMatrix.cs deleted file mode 100644 index 194802ef..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/WorldToTangentMatrix.cs +++ /dev/null @@ -1,47 +0,0 @@ -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "World To Tangent Matrix", "Matrix Transform", "World to tangent transform matrix" )] - public sealed class WorldToTangentMatrix : ParentNode - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddOutputPort( WirePortDataType.FLOAT3x3, "Out" ); - //UIUtils.AddNormalDependentCount(); - m_drawPreview = false; - } - - //public override void Destroy() - //{ - // ContainerGraph.RemoveNormalDependentCount(); - // base.Destroy(); - //} - - public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) - { - base.PropagateNodeData( nodeData, ref dataCollector ); - dataCollector.DirtyNormal = true; - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) - { - if( dataCollector.IsTemplate ) - return dataCollector.TemplateDataCollectorInstance.GetWorldToTangentMatrix( CurrentPrecisionType ); - - if( dataCollector.IsFragmentCategory ) - { - dataCollector.ForceNormal = true; - - dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_NORMAL, CurrentPrecisionType ); - dataCollector.AddToInput( UniqueId, SurfaceInputs.INTERNALDATA, addSemiColon: false ); - } - - GeneratorUtils.GenerateWorldToTangentMatrix( ref dataCollector, UniqueId, CurrentPrecisionType ); - - return GeneratorUtils.WorldToTangentStr; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/WorldToTangentMatrix.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/WorldToTangentMatrix.cs.meta deleted file mode 100644 index ed19db78..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Transform/WorldToTangentMatrix.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: b598d9ebc2d7be44a97270732f55f9bc -timeCreated: 1484747592 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various.meta deleted file mode 100644 index 89ede46c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 5bbb49ec7f4a3524d9950847c88d4afc -folderAsset: yes -timeCreated: 1481126946 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/ColorSpaceDouble.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/ColorSpaceDouble.cs deleted file mode 100644 index 231a0111..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/ColorSpaceDouble.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace AmplifyShaderEditor -{ - [System.Serializable] - [NodeAttributes( "Color Space Double", "Miscellaneous", "Color Space Double" )] - public class ColorSpaceDouble : ParentNode - { - private const string ColorSpaceDoubleStr = "unity_ColorSpaceDouble"; - - private readonly string[] ColorSpaceDoubleDef = - { - "#ifdef UNITY_COLORSPACE_GAMMA//ASE Color Space Def", - "#define unity_ColorSpaceDouble half4(2.0, 2.0, 2.0, 2.0)//ASE Color Space Def", - "#else // Linear values//ASE Color Space Def", - "#define unity_ColorSpaceDouble half4(4.59479380, 4.59479380, 4.59479380, 2.0)//ASE Color Space Def", - "#endif//ASE Color Space Def" - }; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddOutputColorPorts( "RGBA" ); - m_previewShaderGUID = "ac680a8772bb97c46851a7f075fd04e3"; - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if( dataCollector.IsTemplate && dataCollector.IsSRP ) - { - for( int i = 0; i < ColorSpaceDoubleDef.Length; i++ ) - { - dataCollector.AddToDirectives( ColorSpaceDoubleDef[ i ], -1 ); - } - } - return GetOutputVectorItem( 0, outputId, ColorSpaceDoubleStr ); ; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/ColorSpaceDouble.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/ColorSpaceDouble.cs.meta deleted file mode 100644 index 32721b88..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/ColorSpaceDouble.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 7d1204234983b3c4499da752961185be -timeCreated: 1481888315 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/FaceVariableNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/FaceVariableNode.cs deleted file mode 100644 index 0570939c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/FaceVariableNode.cs +++ /dev/null @@ -1,53 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Face", "Vertex Data", "Indicates whether the rendered surface is facing the camera (1), or facing away from the camera(-1)" )] - public class FaceVariableNode : ParentNode - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddOutputPort( WirePortDataType.FLOAT, "Out" ); - m_previewShaderGUID = "4b0b5b9f16353b840a5f5ad2baab3c3c"; - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if ( dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) - { - UIUtils.ShowMessage( UniqueId, m_nodeAttribs.Name + " node does not work on Tessellation port" ); - return m_outputPorts[0].ErrorValue; - } - - if ( dataCollector.PortCategory == MasterNodePortCategory.Vertex ) - { - if ( dataCollector.TesselationActive ) - { - UIUtils.ShowMessage( UniqueId, m_nodeAttribs.Name + " node does not work properly on Vertex/Tessellation ports" ); - return m_outputPorts[ 0 ].ErrorValue; - } - else - { - UIUtils.ShowMessage( UniqueId, m_nodeAttribs.Name + " node does not work propery on Vertex ports" ); - return m_outputPorts[ 0 ].ErrorValue; - } - } - - if ( dataCollector.IsTemplate ) - { - return dataCollector.TemplateDataCollectorInstance.GetVFace( UniqueId ); - } - else - { - dataCollector.AddToInput( UniqueId, SurfaceInputs.VFACE ); - string variable = ( dataCollector.PortCategory == MasterNodePortCategory.Vertex ) ? Constants.VertexShaderOutputStr : Constants.InputVarStr; - return variable + "." + Constants.VFaceVariable; - } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/FaceVariableNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/FaceVariableNode.cs.meta deleted file mode 100644 index b583327e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/FaceVariableNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 4b4a6f07436b05a4cbc2559e4e704000 -timeCreated: 1492513159 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/InstanceIdNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/InstanceIdNode.cs deleted file mode 100644 index c845e063..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/InstanceIdNode.cs +++ /dev/null @@ -1,43 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Instance ID", "Vertex Data", "Indicates the per-instance identifier" )] - public class InstanceIdNode : ParentNode - { - private readonly string[] InstancingVariableAttrib = - { "uint currInstanceId = 0;", - "#ifdef UNITY_INSTANCING_ENABLED", - "currInstanceId = unity_InstanceID;", - "#endif"}; - private const string InstancingInnerVariable = "currInstanceId"; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddOutputPort( WirePortDataType.INT, "Out" ); - m_previewShaderGUID = "03febce56a8cf354b90e7d5180c1dbd7"; - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if( dataCollector.IsTemplate ) - { - dataCollector.TemplateDataCollectorInstance.SetupInstancing(); - } - - if( !dataCollector.HasLocalVariable( InstancingVariableAttrib[ 0 ] ) ) - { - dataCollector.AddLocalVariable( UniqueId, InstancingVariableAttrib[ 0 ] ,true ); - dataCollector.AddLocalVariable( UniqueId, InstancingVariableAttrib[ 1 ] ,true ); - dataCollector.AddLocalVariable( UniqueId, InstancingVariableAttrib[ 2 ] ,true ); - dataCollector.AddLocalVariable( UniqueId, InstancingVariableAttrib[ 3 ] ,true ); - } - return InstancingInnerVariable; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/InstanceIdNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/InstanceIdNode.cs.meta deleted file mode 100644 index efae4fb9..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/InstanceIdNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: c449923583a9fbe4283acebc97756ea1 -timeCreated: 1547811127 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/LODFadeNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/LODFadeNode.cs deleted file mode 100644 index f2a1959f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/LODFadeNode.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "LOD Fade", "Miscellaneous", "LODFadeNode" )] - public sealed class LODFadeNode : ConstVecShaderVariable - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - ChangeOutputName( 1, "Fade[0...1]" ); - ChangeOutputName( 2, "Fade[16Lvl]" ); - ChangeOutputName( 3, "Unused" ); - ChangeOutputName( 4, "Unused" ); - m_value = "unity_LODFade"; - m_previewShaderGUID = "fcd4d93f57ffc51458d4ade10df2fdb4"; - } - - public override void RefreshExternalReferences() - { - base.RefreshExternalReferences(); - if( !m_outputPorts[ 0 ].IsConnected ) - { - m_outputPorts[ 0 ].Visible = false; - m_sizeIsDirty = true; - } - - if( !m_outputPorts[ 3 ].IsConnected ) - { - m_outputPorts[ 3 ].Visible = false; - m_sizeIsDirty = true; - } - - if( !m_outputPorts[ 4 ].IsConnected ) - { - m_outputPorts[ 4 ].Visible = false; - m_sizeIsDirty = true; - } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/LODFadeNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/LODFadeNode.cs.meta deleted file mode 100644 index a83635a4..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/LODFadeNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: f96cf34c2936c96458403e9cf75e8e10 -timeCreated: 1481126960 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/PrimitiveIdVariableNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/PrimitiveIdVariableNode.cs deleted file mode 100644 index b60f8472..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/PrimitiveIdVariableNode.cs +++ /dev/null @@ -1,38 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> -#if UNITY_EDITOR_WIN -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Primitive ID", "Vertex Data", "Per-primitive identifier automatically generated by the runtime" )] - public class PrimitiveIDVariableNode : ParentNode - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddOutputPort( WirePortDataType.INT, "Out" ); - m_previewShaderGUID = "92c1b588d7658594cb219696f593f64b"; - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if( !dataCollector.IsTemplate ) - { - UIUtils.ShowMessage( UniqueId, m_nodeAttribs.Name + " is not supported on surface shaders." ); - return m_outputPorts[0].ErrorValue; - } - - if ( dataCollector.PortCategory == MasterNodePortCategory.Vertex ) - { - UIUtils.ShowMessage( UniqueId, m_nodeAttribs.Name + " is not supported on Vertex ports" ); - return m_outputPorts[0].ErrorValue; - } - - return dataCollector.TemplateDataCollectorInstance.GetPrimitiveId(); - } - } -} -#endif - diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/PrimitiveIdVariableNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/PrimitiveIdVariableNode.cs.meta deleted file mode 100644 index 6d7d119b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/PrimitiveIdVariableNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: dd0af9fbbba750341a7b09316178f285 -timeCreated: 1492513159 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/SwitchByFaceNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/SwitchByFaceNode.cs deleted file mode 100644 index 6bfd7f36..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/SwitchByFaceNode.cs +++ /dev/null @@ -1,70 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; - -using UnityEngine; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Switch by Face", "Miscellaneous", "Switch which automaticaly uses a Face variable to select which input to use" )] - public class SwitchByFaceNode : DynamicTypeNode - { - private const string SwitchOp = "((({0}>0)?({1}):({2})))"; - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_inputPorts[ 0 ].Name = "Front"; - m_inputPorts[ 1 ].Name = "Back"; - m_textLabelWidth = 50; - m_previewShaderGUID = "f4edf6febb54dc743b25bd5b56facea8"; - } - - - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if ( dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) - { - UIUtils.ShowMessage( UniqueId, m_nodeAttribs.Name + " does not work on Tessellation port" ); - return GenerateErrorValue(); - } - - if ( dataCollector.PortCategory == MasterNodePortCategory.Vertex ) - { - if ( dataCollector.TesselationActive ) - { - UIUtils.ShowMessage( UniqueId, m_nodeAttribs.Name + " does not work properly on Vertex/Tessellation ports" ); - return GenerateErrorValue(); - } - else - { - UIUtils.ShowMessage( UniqueId, m_nodeAttribs.Name + " does not work properly on Vertex ports" ); - return GenerateErrorValue(); - } - } - - if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) - return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); - - string front = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - string back = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); - - dataCollector.AddToInput( UniqueId, SurfaceInputs.VFACE ); - string variable = string.Empty; - if ( dataCollector.IsTemplate ) - { - variable = dataCollector.TemplateDataCollectorInstance.GetVFace( UniqueId ); - } - else - { - variable = ( ( dataCollector.PortCategory == MasterNodePortCategory.Vertex ) ? Constants.VertexShaderOutputStr : Constants.InputVarStr ) + "." + Constants.VFaceVariable; - } - - string value = string.Format( SwitchOp, variable, front, back ); - RegisterLocalVariable( 0, value, ref dataCollector, "switchResult" + OutputId ); - return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/SwitchByFaceNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/SwitchByFaceNode.cs.meta deleted file mode 100644 index b12692c4..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/SwitchByFaceNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: b0464d8b27caa7d4d8fa5d1828934da8 -timeCreated: 1492515561 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/VertexIdVariableNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/VertexIdVariableNode.cs deleted file mode 100644 index d2b75192..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/VertexIdVariableNode.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Vertex ID", "Vertex Data", "Indicates current vertex number" )] - public class VertexIdVariableNode : ParentNode - { - private const string VertexIdVarName = "ase_vertexId"; - private const string VertexIdRegistry = "uint "+ VertexIdVarName + " : SV_VertexID;"; - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddOutputPort( WirePortDataType.INT, "Out" ); - m_previewShaderGUID = "5934bf2c10b127a459177a3b622cea65"; - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if ( dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) - { - UIUtils.ShowMessage( UniqueId, m_nodeAttribs.Name + " does not work on Tessellation port" ); - return m_outputPorts[0].ErrorValue; - } - - if ( dataCollector.IsTemplate ) - { - return dataCollector.TemplateDataCollectorInstance.GetVertexId(); - } - else - { - if( dataCollector.IsFragmentCategory ) - { - GenerateValueInVertex( ref dataCollector, WirePortDataType.UINT, Constants.VertexShaderInputStr + "."+ VertexIdVarName, VertexIdVarName, true ); - return Constants.InputVarStr + "."+ VertexIdVarName; - } - else - { - return Constants.VertexShaderInputStr + "."+ VertexIdVarName; - } - } - } - public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) - { - if( !dataCollector.IsTemplate ) - dataCollector.AddCustomAppData( VertexIdRegistry ); - - base.PropagateNodeData( nodeData, ref dataCollector ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/VertexIdVariableNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/VertexIdVariableNode.cs.meta deleted file mode 100644 index cad8fe04..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/VertexIdVariableNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: ce37a30cae7677942ad44f0945ab7b77 -timeCreated: 1492513159 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/WorldTransformParams.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/WorldTransformParams.cs deleted file mode 100644 index 49966a09..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/WorldTransformParams.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "World Transform Params", "Object Transform", "World Transform Params contains information about the transform, W is usually 1.0, or -1.0 for odd-negative scale transforms" )] - public sealed class WorldTransformParams : ConstVecShaderVariable - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - ChangeOutputName( 1, "X" ); - ChangeOutputName( 2, "Y" ); - ChangeOutputName( 3, "Z" ); - ChangeOutputName( 4, "W" ); - m_value = "unity_WorldTransformParams"; - m_previewShaderGUID = "5a2642605f085da458d6e03ade47b87a"; - } - - public override void RefreshExternalReferences() - { - base.RefreshExternalReferences(); - if( !m_outputPorts[ 0 ].IsConnected ) - { - m_outputPorts[ 0 ].Visible = false; - m_sizeIsDirty = true; - } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/WorldTransformParams.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/WorldTransformParams.cs.meta deleted file mode 100644 index b28aa84a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/ShaderVariables/Various/WorldTransformParams.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: aec376443deca354789bc36ba18af898 -timeCreated: 1481126960 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/StaticSwitch.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/StaticSwitch.cs deleted file mode 100644 index 6704cbee..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/StaticSwitch.cs +++ /dev/null @@ -1,1197 +0,0 @@ -// Amplify Shader Editor - Visual Shader vEditing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEngine; -using UnityEditor; -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Static Switch", "Logical Operators", "Creates a shader keyword toggle", Available = true )] - public sealed class StaticSwitch : PropertyNode - { - private float InstanceIconWidth = 19; - private float InstanceIconHeight = 19; - private readonly Color ReferenceHeaderColor = new Color( 0f, 0.5f, 0.585f, 1.0f ); - - [SerializeField] - private int m_defaultValue = 0; - - [SerializeField] - private int m_materialValue = 0; - - [SerializeField] - private int m_multiCompile = 0; - - [SerializeField] - private int m_currentKeywordId = 0; - - [SerializeField] - private string m_currentKeyword = string.Empty; - - [SerializeField] - private bool m_createToggle = true; - - private const string IsLocalStr = "Is Local"; -#if UNITY_2019_1_OR_NEWER - [SerializeField] - private bool m_isLocal = true; -#else - [SerializeField] - private bool m_isLocal = false; -#endif - private GUIContent m_checkContent; - private GUIContent m_popContent; - - private int m_conditionId = -1; - - private const int MinComboSize = 50; - private const int MaxComboSize = 105; - - private Rect m_varRect; - private Rect m_imgRect; - private bool m_editing; - - public enum KeywordModeType - { - Toggle = 0, - ToggleOff, - KeywordEnum, - } - - public enum StaticSwitchVariableMode - { - Create = 0, - Fetch, - Reference - } - - [SerializeField] - private KeywordModeType m_keywordModeType = KeywordModeType.Toggle; - - [SerializeField] - private StaticSwitch m_reference = null; - - private const string StaticSwitchStr = "Static Switch"; - private const string MaterialToggleStr = "Material Toggle"; - - private const string ToggleMaterialValueStr = "Material Value"; - private const string ToggleDefaultValueStr = "Default Value"; - - private const string AmountStr = "Amount"; - private const string KeywordStr = "Keyword"; - private const string CustomStr = "Custom"; - private const string ToggleTypeStr = "Toggle Type"; - private const string TypeStr = "Type"; - private const string ModeStr = "Mode"; - private const string KeywordTypeStr = "Keyword Type"; - - private const string KeywordNameStr = "Keyword Name"; - public readonly static string[] KeywordTypeList = { "Shader Feature", "Multi Compile"/*, "Define Symbol"*/ }; - public readonly static int[] KeywordTypeInt = { 0, 1/*, 2*/ }; - - [SerializeField] - private string[] m_defaultKeywordNames = { "Key0", "Key1", "Key2", "Key3", "Key4", "Key5", "Key6", "Key7", "Key8" }; - - [SerializeField] - private string[] m_keywordEnumList = { "Key0", "Key1" }; - - [SerializeField] - private StaticSwitchVariableMode m_staticSwitchVarMode = StaticSwitchVariableMode.Create; - - [SerializeField] - private int m_referenceArrayId = -1; - - [SerializeField] - private int m_referenceNodeId = -1; - - private int m_keywordEnumAmount = 2; - - private bool m_isStaticSwitchDirty = false; - - private Rect m_iconPos; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); - AddInputPort( WirePortDataType.FLOAT, false, "False", -1, MasterNodePortCategory.Fragment, 1 ); - AddInputPort( WirePortDataType.FLOAT, false, "True", -1, MasterNodePortCategory.Fragment, 0 ); - for( int i = 2; i < 9; i++ ) - { - AddInputPort( WirePortDataType.FLOAT, false, m_defaultKeywordNames[ i ] ); - m_inputPorts[ i ].Visible = false; - } - m_headerColor = new Color( 0.0f, 0.55f, 0.45f, 1f ); - m_customPrefix = KeywordStr + " "; - m_autoWrapProperties = false; - m_freeType = false; - m_useVarSubtitle = true; - m_allowPropertyDuplicates = true; - m_showTitleWhenNotEditing = false; - m_currentParameterType = PropertyType.Property; - - m_checkContent = new GUIContent(); - m_checkContent.image = UIUtils.CheckmarkIcon; - - m_popContent = new GUIContent(); - m_popContent.image = UIUtils.PopupIcon; - - m_previewShaderGUID = "0b708c11c68e6a9478ac97fe3643eab1"; - m_showAutoRegisterUI = true; - } - - public override void SetPreviewInputs() - { - base.SetPreviewInputs(); - - if( m_conditionId == -1 ) - m_conditionId = Shader.PropertyToID( "_Condition" ); - - StaticSwitch node = ( m_staticSwitchVarMode == StaticSwitchVariableMode.Reference && m_reference != null ) ? m_reference : this; - - if( m_createToggle ) - PreviewMaterial.SetInt( m_conditionId, node.MaterialValue ); - else - PreviewMaterial.SetInt( m_conditionId, node.DefaultValue ); - } - - protected override void OnUniqueIDAssigned() - { - base.OnUniqueIDAssigned(); - - if( m_createToggle ) - UIUtils.RegisterPropertyNode( this ); - else - UIUtils.UnregisterPropertyNode( this ); - - if( CurrentVarMode != StaticSwitchVariableMode.Reference ) - { - ContainerGraph.StaticSwitchNodes.AddNode( this ); - } - - if( UniqueId > -1 ) - ContainerGraph.StaticSwitchNodes.OnReorderEventComplete += OnReorderEventComplete; - } - - public override void Destroy() - { - base.Destroy(); - UIUtils.UnregisterPropertyNode( this ); - if( CurrentVarMode != StaticSwitchVariableMode.Reference ) - { - ContainerGraph.StaticSwitchNodes.RemoveNode( this ); - } - - if( UniqueId > -1 ) - ContainerGraph.StaticSwitchNodes.OnReorderEventComplete -= OnReorderEventComplete; - } - - void OnReorderEventComplete() - { - if( CurrentVarMode == StaticSwitchVariableMode.Reference ) - { - if( m_reference != null ) - { - m_referenceArrayId = ContainerGraph.StaticSwitchNodes.GetNodeRegisterIdx( m_reference.UniqueId ); - } - } - } - - public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) - { - base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); - UpdateConnections(); - } - - public override void OnConnectedOutputNodeChanges( int inputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) - { - base.OnConnectedOutputNodeChanges( inputPortId, otherNodeId, otherPortId, name, type ); - UpdateConnections(); - } - - public override void OnInputPortDisconnected( int portId ) - { - base.OnInputPortDisconnected( portId ); - UpdateConnections(); - } - - private void UpdateConnections() - { - WirePortDataType mainType = WirePortDataType.FLOAT; - - int highest = UIUtils.GetPriority( mainType ); - for( int i = 0; i < m_inputPorts.Count; i++ ) - { - if( m_inputPorts[ i ].IsConnected ) - { - WirePortDataType portType = m_inputPorts[ i ].GetOutputConnection().DataType; - if( UIUtils.GetPriority( portType ) > highest ) - { - mainType = portType; - highest = UIUtils.GetPriority( portType ); - } - } - } - - for( int i = 0; i < m_inputPorts.Count; i++ ) - { - m_inputPorts[ i ].ChangeType( mainType, false ); - } - - m_outputPorts[ 0 ].ChangeType( mainType, false ); - } - - public override string GetPropertyValue() - { - if( m_createToggle ) - if( m_keywordModeType == KeywordModeType.KeywordEnum && m_keywordEnumAmount > 0 ) - return PropertyAttributes + "[" + m_keywordModeType.ToString() + "(" + GetKeywordEnumPropertyList() + ")] " + m_propertyName + "(\"" + m_propertyInspectorName + "\", Float) = " + m_defaultValue; - else - return PropertyAttributes + "[" + m_keywordModeType.ToString() + "(" + GetPropertyValStr() + ")] " + m_propertyName + "(\"" + m_propertyInspectorName + "\", Float) = " + m_defaultValue; - else - return string.Empty; - } - - public string KeywordEnum( int index ) - { - if( m_createToggle ) - { - return string.IsNullOrEmpty( PropertyName ) ? KeywordEnumList( index ) : ( PropertyName + "_" + KeywordEnumList( index ) ); - } - else - { - return string.IsNullOrEmpty( PropertyName ) ? KeywordEnumList( index ) : ( PropertyName + KeywordEnumList( index ) ); - } - } - - public string KeywordEnumList( int index ) - { - if( CurrentVarMode == StaticSwitchVariableMode.Fetch ) - return m_keywordEnumList[ index ]; - else - { - return m_createToggle ? m_keywordEnumList[ index ].ToUpper() : m_keywordEnumList[ index ]; - } - - } - public override string PropertyName - { - get - { - if( CurrentVarMode == StaticSwitchVariableMode.Fetch ) - return m_currentKeyword; - else - { - return m_createToggle ? base.PropertyName.ToUpper() : base.PropertyName; - } - } - } - - public override string GetPropertyValStr() - { - if( m_keywordModeType == KeywordModeType.KeywordEnum ) - return PropertyName; - else if( CurrentVarMode == StaticSwitchVariableMode.Fetch ) - return m_currentKeyword; - else - return PropertyName + OnOffStr; - } - - private string GetKeywordEnumPropertyList() - { - string result = string.Empty; - for( int i = 0; i < m_keywordEnumList.Length; i++ ) - { - if( i == 0 ) - result = m_keywordEnumList[ i ]; - else - result += "," + m_keywordEnumList[ i ]; - } - return result; - } - - private string GetKeywordEnumPragmaList() - { - string result = string.Empty; - for( int i = 0; i < m_keywordEnumList.Length; i++ ) - { - if( i == 0 ) - result = KeywordEnum( i ); - else - result += " " + KeywordEnum( i ); - } - return result; - } - - public override string GetUniformValue() - { - return string.Empty; - } - - public override bool GetUniformData( out string dataType, out string dataName, ref bool fullValue ) - { - dataType = string.Empty; - dataName = string.Empty; - return false; - } - - public override void DrawProperties() - { - //base.DrawProperties(); - NodeUtils.DrawPropertyGroup( ref m_propertiesFoldout, Constants.ParameterLabelStr, PropertyGroup ); - NodeUtils.DrawPropertyGroup( ref m_visibleCustomAttrFoldout, CustomAttrStr, DrawCustomAttributes, DrawCustomAttrAddRemoveButtons ); - CheckPropertyFromInspector(); - } - - void DrawEnumList() - { - EditorGUI.BeginChangeCheck(); - KeywordEnumAmount = EditorGUILayoutIntSlider( AmountStr, KeywordEnumAmount, 2, 9 ); - if( EditorGUI.EndChangeCheck() ) - { - CurrentSelectedInput = Mathf.Clamp( CurrentSelectedInput, 0, KeywordEnumAmount - 1 ); - UpdateLabels(); - } - EditorGUI.indentLevel++; - for( int i = 0; i < m_keywordEnumList.Length; i++ ) - { - EditorGUI.BeginChangeCheck(); - m_keywordEnumList[ i ] = EditorGUILayoutTextField( "Item " + i, m_keywordEnumList[ i ] ); - if( EditorGUI.EndChangeCheck() ) - { - m_keywordEnumList[ i ] = UIUtils.RemoveInvalidEnumCharacters( m_keywordEnumList[ i ] ); - m_keywordEnumList[ i ] = m_keywordEnumList[ i ].Replace( " ", "" ); // sad face :( does not support spaces - m_inputPorts[ i ].Name = m_keywordEnumList[ i ]; - m_defaultKeywordNames[ i ] = m_inputPorts[ i ].Name; - } - } - EditorGUI.indentLevel--; - } - - public void UpdateLabels() - { - int maxinputs = m_keywordModeType == KeywordModeType.KeywordEnum ? KeywordEnumAmount : 2; - KeywordEnumAmount = Mathf.Clamp( KeywordEnumAmount, 0, maxinputs ); - m_keywordEnumList = new string[ maxinputs ]; - - for( int i = 0; i < maxinputs; i++ ) - { - m_keywordEnumList[ i ] = m_defaultKeywordNames[ i ]; - m_inputPorts[ i ].Name = m_keywordEnumList[ i ]; - } - - if( m_keywordModeType != KeywordModeType.KeywordEnum ) - { - m_inputPorts[ 0 ].Name = "False"; - m_inputPorts[ 1 ].Name = "True"; - } - - for( int i = 0; i < m_inputPorts.Count; i++ ) - { - m_inputPorts[ i ].Visible = ( i < maxinputs ); - } - m_sizeIsDirty = true; - m_isStaticSwitchDirty = true; - } - - void PropertyGroup() - { - EditorGUI.BeginChangeCheck(); - CurrentVarMode = (StaticSwitchVariableMode)EditorGUILayoutEnumPopup( ModeStr, CurrentVarMode ); - if( EditorGUI.EndChangeCheck() ) - { - if( CurrentVarMode == StaticSwitchVariableMode.Fetch ) - { - m_keywordModeType = KeywordModeType.Toggle; - UpdateLabels(); - } - - if( CurrentVarMode == StaticSwitchVariableMode.Reference ) - { - UIUtils.UnregisterPropertyNode( this ); - } - else - { - if( m_createToggle ) - UIUtils.RegisterPropertyNode( this ); - else - UIUtils.UnregisterPropertyNode( this ); - } - } - - if( CurrentVarMode == StaticSwitchVariableMode.Create ) - { - EditorGUI.BeginChangeCheck(); - m_multiCompile = EditorGUILayoutIntPopup( KeywordTypeStr, m_multiCompile, KeywordTypeList, KeywordTypeInt ); - if( EditorGUI.EndChangeCheck() ) - { - BeginPropertyFromInspectorCheck(); - } - } - else if( CurrentVarMode == StaticSwitchVariableMode.Reference ) - { - string[] arr = ContainerGraph.StaticSwitchNodes.NodesArr; - bool guiEnabledBuffer = GUI.enabled; - if( arr != null && arr.Length > 0 ) - { - GUI.enabled = true; - } - else - { - m_referenceArrayId = -1; - GUI.enabled = false; - } - - EditorGUI.BeginChangeCheck(); - m_referenceArrayId = EditorGUILayoutPopup( Constants.AvailableReferenceStr, m_referenceArrayId, arr ); - if( EditorGUI.EndChangeCheck() ) - { - m_reference = ContainerGraph.StaticSwitchNodes.GetNode( m_referenceArrayId ); - if( m_reference != null ) - { - m_referenceNodeId = m_reference.UniqueId; - CheckReferenceValues( true ); - } - else - { - m_referenceArrayId = -1; - m_referenceNodeId = -1; - } - } - GUI.enabled = guiEnabledBuffer; - - return; - } - - if( CurrentVarMode == StaticSwitchVariableMode.Create ) - { - EditorGUI.BeginChangeCheck(); - m_keywordModeType = (KeywordModeType)EditorGUILayoutEnumPopup( TypeStr, m_keywordModeType ); - if( EditorGUI.EndChangeCheck() ) - { - UpdateLabels(); - } - } - - if( m_keywordModeType != KeywordModeType.KeywordEnum ) - { - if( CurrentVarMode == StaticSwitchVariableMode.Create ) - { - ShowPropertyInspectorNameGUI(); - ShowPropertyNameGUI( true ); - bool guiEnabledBuffer = GUI.enabled; - GUI.enabled = false; - EditorGUILayout.TextField( KeywordNameStr, GetPropertyValStr() ); - GUI.enabled = guiEnabledBuffer; - } - - } - else - { - if( CurrentVarMode == StaticSwitchVariableMode.Create ) - { - ShowPropertyInspectorNameGUI(); - ShowPropertyNameGUI( true ); - DrawEnumList(); - } - - } - - if( CurrentVarMode == StaticSwitchVariableMode.Fetch ) - { - //ShowPropertyInspectorNameGUI(); - 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 ) - { - EditorGUI.BeginChangeCheck(); - m_currentKeyword = EditorGUILayoutTextField( CustomStr, m_currentKeyword ); - if( EditorGUI.EndChangeCheck() ) - { - m_currentKeyword = UIUtils.RemoveInvalidCharacters( m_currentKeyword ); - } - } - } - -#if UNITY_2019_1_OR_NEWER - m_isLocal = EditorGUILayoutToggle( IsLocalStr, m_isLocal ); -#endif - - if( CurrentVarMode == StaticSwitchVariableMode.Create ) - { - ShowAutoRegister(); - } - - EditorGUI.BeginChangeCheck(); - m_createToggle = EditorGUILayoutToggle( MaterialToggleStr, m_createToggle ); - if( EditorGUI.EndChangeCheck() ) - { - if( m_createToggle ) - UIUtils.RegisterPropertyNode( this ); - else - UIUtils.UnregisterPropertyNode( this ); - } - - - if( m_createToggle ) - { - EditorGUILayout.BeginHorizontal(); - GUILayout.Space( 20 ); - m_propertyTab = GUILayout.Toolbar( m_propertyTab, LabelToolbarTitle ); - EditorGUILayout.EndHorizontal(); - switch( m_propertyTab ) - { - default: - case 0: - { - EditorGUI.BeginChangeCheck(); - if( m_keywordModeType != KeywordModeType.KeywordEnum ) - m_materialValue = EditorGUILayoutToggle( ToggleMaterialValueStr, m_materialValue == 1 ) ? 1 : 0; - else - m_materialValue = EditorGUILayoutPopup( ToggleMaterialValueStr, m_materialValue, m_keywordEnumList ); - if( EditorGUI.EndChangeCheck() ) - m_requireMaterialUpdate = true; - } - break; - case 1: - { - if( m_keywordModeType != KeywordModeType.KeywordEnum ) - m_defaultValue = EditorGUILayoutToggle( ToggleDefaultValueStr, m_defaultValue == 1 ) ? 1 : 0; - else - m_defaultValue = EditorGUILayoutPopup( ToggleDefaultValueStr, m_defaultValue, m_keywordEnumList ); - } - break; - } - } - - //EditorGUILayout.HelpBox( "Keyword Type:\n" + - // "The difference is that unused variants of \"Shader Feature\" shaders will not be included into game build while \"Multi Compile\" variants are included regardless of their usage.\n\n" + - // "So \"Shader Feature\" makes most sense for keywords that will be set on the materials, while \"Multi Compile\" for keywords that will be set from code globally.\n\n" + - // "You can set keywords using the material property using the \"Property Name\" or you can set the keyword directly using the \"Keyword Name\".", MessageType.None ); - } - - public override void CheckPropertyFromInspector( bool forceUpdate = false ) - { - if( m_propertyFromInspector ) - { - if( forceUpdate || ( EditorApplication.timeSinceStartup - m_propertyFromInspectorTimestamp ) > MaxTimestamp ) - { - m_propertyFromInspector = false; - RegisterPropertyName( true, m_propertyInspectorName, m_autoGlobalName, m_underscoredGlobal ); - m_propertyNameIsDirty = true; - - if( CurrentVarMode != StaticSwitchVariableMode.Reference ) - { - ContainerGraph.StaticSwitchNodes.UpdateDataOnNode( UniqueId, DataToArray ); - } - } - } - } - - public override void OnNodeLayout( DrawInfo drawInfo ) - { - float finalSize = 0; - if( m_keywordModeType == KeywordModeType.KeywordEnum ) - { - GUIContent dropdown = new GUIContent( m_inputPorts[ CurrentSelectedInput ].Name ); - int cacheSize = UIUtils.GraphDropDown.fontSize; - UIUtils.GraphDropDown.fontSize = 10; - Vector2 calcSize = UIUtils.GraphDropDown.CalcSize( dropdown ); - UIUtils.GraphDropDown.fontSize = cacheSize; - finalSize = Mathf.Clamp( calcSize.x, MinComboSize, MaxComboSize ); - if( m_insideSize.x != finalSize ) - { - m_insideSize.Set( finalSize, 25 ); - m_sizeIsDirty = true; - } - } - - base.OnNodeLayout( drawInfo ); - - if( m_keywordModeType != KeywordModeType.KeywordEnum ) - { - m_varRect = m_remainingBox; - m_varRect.size = Vector2.one * 22 * drawInfo.InvertedZoom; - m_varRect.center = m_remainingBox.center; - if( m_showPreview ) - m_varRect.y = m_remainingBox.y; - } - else - { - m_varRect = m_remainingBox; - m_varRect.width = finalSize * drawInfo.InvertedZoom; - m_varRect.height = 16 * drawInfo.InvertedZoom; - m_varRect.x = m_remainingBox.xMax - m_varRect.width; - m_varRect.y += 1 * drawInfo.InvertedZoom; - - m_imgRect = m_varRect; - m_imgRect.x = m_varRect.xMax - 16 * drawInfo.InvertedZoom; - m_imgRect.width = 16 * drawInfo.InvertedZoom; - m_imgRect.height = m_imgRect.width; - } - - CheckReferenceValues( false ); - - if( m_staticSwitchVarMode == StaticSwitchVariableMode.Reference ) - { - m_iconPos = m_globalPosition; - m_iconPos.width = InstanceIconWidth * drawInfo.InvertedZoom; - m_iconPos.height = InstanceIconHeight * drawInfo.InvertedZoom; - - m_iconPos.y += 10 * drawInfo.InvertedZoom; - m_iconPos.x += /*m_globalPosition.width - m_iconPos.width - */5 * drawInfo.InvertedZoom; - } - - } - - void CheckReferenceValues( bool forceUpdate ) - { - if( m_staticSwitchVarMode == StaticSwitchVariableMode.Reference ) - { - if( m_reference == null && m_referenceNodeId > 0 ) - { - m_reference = ContainerGraph.GetNode( m_referenceNodeId ) as StaticSwitch; - m_referenceArrayId = ContainerGraph.StaticSwitchNodes.GetNodeRegisterIdx( m_referenceNodeId ); - } - - if( m_reference != null ) - { - if( forceUpdate || m_reference.IsStaticSwitchDirty ) - { - int count = m_inputPorts.Count; - for( int i = 0; i < count; i++ ) - { - m_inputPorts[ i ].Name = m_reference.InputPorts[ i ].Name; - m_inputPorts[ i ].Visible = m_reference.InputPorts[ i ].Visible; - } - m_sizeIsDirty = true; - } - } - } - else - { - m_isStaticSwitchDirty = false; - } - } - - public override void DrawGUIControls( DrawInfo drawInfo ) - { - base.DrawGUIControls( drawInfo ); - - if( drawInfo.CurrentEventType != EventType.MouseDown || !m_createToggle ) - return; - - if( m_varRect.Contains( drawInfo.MousePosition ) ) - { - m_editing = true; - } - else if( m_editing ) - { - m_editing = false; - } - } - - private int CurrentSelectedInput - { - get - { - return m_materialMode ? m_materialValue : m_defaultValue; - } - set - { - if( m_materialMode ) - m_materialValue = value; - else - m_defaultValue = value; - } - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - if( m_staticSwitchVarMode == StaticSwitchVariableMode.Reference ) - return; - - if( m_editing ) - { - if( m_keywordModeType != KeywordModeType.KeywordEnum ) - { - if( GUI.Button( m_varRect, GUIContent.none, UIUtils.GraphButton ) ) - { - CurrentSelectedInput = CurrentSelectedInput == 1 ? 0 : 1; - PreviewIsDirty = true; - m_editing = false; - if( m_materialMode ) - m_requireMaterialUpdate = true; - } - - if( CurrentSelectedInput == 1 ) - { - GUI.Label( m_varRect, m_checkContent, UIUtils.GraphButtonIcon ); - } - } - else - { - EditorGUI.BeginChangeCheck(); - CurrentSelectedInput = EditorGUIPopup( m_varRect, CurrentSelectedInput, m_keywordEnumList, UIUtils.GraphDropDown ); - if( EditorGUI.EndChangeCheck() ) - { - PreviewIsDirty = true; - m_editing = false; - if( m_materialMode ) - m_requireMaterialUpdate = true; - } - } - } - } - - public override void OnNodeRepaint( DrawInfo drawInfo ) - { - base.OnNodeRepaint( drawInfo ); - - if( !m_isVisible ) - return; - - if( m_staticSwitchVarMode == StaticSwitchVariableMode.Reference ) - { - GUI.Label( m_iconPos, string.Empty, UIUtils.GetCustomStyle( CustomStyle.SamplerTextureIcon ) ); - return; - } - - if( m_createToggle && ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD2 ) - { - if( !m_editing ) - { - if( m_keywordModeType != KeywordModeType.KeywordEnum ) - { - GUI.Label( m_varRect, GUIContent.none, UIUtils.GraphButton ); - - if( CurrentSelectedInput == 1 ) - GUI.Label( m_varRect, m_checkContent, UIUtils.GraphButtonIcon ); - } - else - { - GUI.Label( m_varRect, m_keywordEnumList[ CurrentSelectedInput ], UIUtils.GraphDropDown ); - GUI.Label( m_imgRect, m_popContent, UIUtils.GraphButtonIcon ); - } - } - } - } - - private string OnOffStr - { - get - { - StaticSwitch node = null; - switch( CurrentVarMode ) - { - default: - case StaticSwitchVariableMode.Create: - case StaticSwitchVariableMode.Fetch: - node = this; - break; - case StaticSwitchVariableMode.Reference: - { - node = ( m_reference != null ) ? m_reference : this; - } - break; - } - - if( !node.CreateToggle ) - return string.Empty; - - switch( node.KeywordModeTypeValue ) - { - default: - case KeywordModeType.Toggle: - return "_ON"; - case KeywordModeType.ToggleOff: - return "_OFF"; - } - } - } - string GetStaticSwitchType() - { - string staticSwitchType = ( m_multiCompile == 1 ) ? "multi_compile" : "shader_feature"; -#if UNITY_2019_1_OR_NEWER - if( m_isLocal ) - staticSwitchType += "_local"; -#endif - return staticSwitchType; - } - - void RegisterPragmas( ref MasterNodeDataCollector dataCollector ) - { - if( CurrentVarMode == StaticSwitchVariableMode.Create ) - { - string staticSwitchType = GetStaticSwitchType(); - if( m_keywordModeType == KeywordModeType.KeywordEnum ) - { - if( m_multiCompile == 1 ) - dataCollector.AddToPragmas( UniqueId, staticSwitchType + " " + GetKeywordEnumPragmaList() ); - else if( m_multiCompile == 0 ) - dataCollector.AddToPragmas( UniqueId, staticSwitchType + " " + GetKeywordEnumPragmaList() ); - } - else - { - if( m_multiCompile == 1 ) - dataCollector.AddToPragmas( UniqueId, staticSwitchType + " __ " + PropertyName + OnOffStr ); - else if( m_multiCompile == 0 ) - dataCollector.AddToPragmas( UniqueId, staticSwitchType + " " + PropertyName + OnOffStr ); - } - } - } - - protected override void RegisterProperty( ref MasterNodeDataCollector dataCollector ) - { - if( m_staticSwitchVarMode == StaticSwitchVariableMode.Reference && m_reference != null ) - { - m_reference.RegisterProperty( ref dataCollector ); - m_reference.RegisterPragmas( ref dataCollector ); - } - else - { - if( m_createToggle ) - base.RegisterProperty( ref dataCollector ); - - RegisterPragmas( ref dataCollector ); - } - } - - 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 ); - - base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); - - StaticSwitch node = ( m_staticSwitchVarMode == StaticSwitchVariableMode.Reference && m_reference != null ) ? m_reference : this; - - this.OrderIndex = node.RawOrderIndex; - this.OrderIndexOffset = node.OrderIndexOffset; - //if( m_keywordModeType == KeywordModeType.KeywordEnum ) - - //node.RegisterPragmas( ref dataCollector ); - - string outType = UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, m_outputPorts[ 0 ].DataType ); - - if( node.KeywordModeTypeValue == KeywordModeType.KeywordEnum ) - { - string defaultKey = "\t" + outType + " staticSwitch" + OutputId + " = " + m_inputPorts[ node.DefaultValue ].GeneratePortInstructions( ref dataCollector ) + ";"; - - string[] allOutputs = new string[ node.KeywordEnumAmount ]; - for( int i = 0; i < node.KeywordEnumAmount; i++ ) - allOutputs[ i ] = m_inputPorts[ i ].GeneratePortInstructions( ref dataCollector ); - - for( int i = 0; i < node.KeywordEnumAmount; i++ ) - { - string keyword = node.KeywordEnum( i ); - if( i == 0 ) - dataCollector.AddLocalVariable( UniqueId, "#if defined(" + keyword + ")", true ); - else - dataCollector.AddLocalVariable( UniqueId, "#elif defined(" + keyword + ")", true ); - - if( node.DefaultValue == i ) - dataCollector.AddLocalVariable( UniqueId, defaultKey, true ); - else - dataCollector.AddLocalVariable( UniqueId, "\t" + outType + " staticSwitch" + OutputId + " = " + allOutputs[ i ] + ";", true ); - } - dataCollector.AddLocalVariable( UniqueId, "#else", true ); - dataCollector.AddLocalVariable( UniqueId, defaultKey, true ); - dataCollector.AddLocalVariable( UniqueId, "#endif", true ); - } - else - { - string falseCode = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - string trueCode = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); - - if( node.CurrentVarMode == StaticSwitchVariableMode.Fetch ) - dataCollector.AddLocalVariable( UniqueId, "#ifdef " + node.CurrentKeyword, true ); - else - dataCollector.AddLocalVariable( UniqueId, "#ifdef " + node.PropertyName + OnOffStr, true ); - dataCollector.AddLocalVariable( UniqueId, "\t" + outType + " staticSwitch" + OutputId + " = " + trueCode + ";", true ); - dataCollector.AddLocalVariable( UniqueId, "#else", true ); - dataCollector.AddLocalVariable( UniqueId, "\t" + outType + " staticSwitch" + OutputId + " = " + falseCode + ";", true ); - dataCollector.AddLocalVariable( UniqueId, "#endif", true ); - } - - m_outputPorts[ 0 ].SetLocalValue( "staticSwitch" + OutputId, dataCollector.PortCategory ); - return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); - } - - public override void DrawTitle( Rect titlePos ) - { - bool referenceMode = m_staticSwitchVarMode == StaticSwitchVariableMode.Reference && m_reference != null; - string subTitle = string.Empty; - string subTitleFormat = string.Empty; - if( referenceMode ) - { - subTitle = m_reference.GetPropertyValStr(); - subTitleFormat = Constants.SubTitleRefNameFormatStr; - } - else - { - subTitle = GetPropertyValStr(); - subTitleFormat = Constants.SubTitleVarNameFormatStr; - } - - SetAdditonalTitleTextOnCallback( subTitle, ( instance, newSubTitle ) => instance.AdditonalTitleContent.text = string.Format( subTitleFormat, newSubTitle ) ); - - if( !m_isEditing && ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD3 ) - { - GUI.Label( titlePos, StaticSwitchStr, UIUtils.GetCustomStyle( CustomStyle.NodeTitle ) ); - } - } - - public override void UpdateMaterial( Material mat ) - { - base.UpdateMaterial( mat ); - if( UIUtils.IsProperty( m_currentParameterType ) && !InsideShaderFunction ) - { - if( m_keywordModeType == KeywordModeType.KeywordEnum ) - { - for( int i = 0; i < m_keywordEnumAmount; i++ ) - { - string key = KeywordEnum( i ); - mat.DisableKeyword( key ); - } - mat.EnableKeyword( KeywordEnum( m_materialValue )); - mat.SetFloat( m_propertyName, m_materialValue ); - } - else - { - int final = m_materialValue; - if( m_keywordModeType == KeywordModeType.ToggleOff ) - final = final == 1 ? 0 : 1; - mat.SetFloat( m_propertyName, m_materialValue ); - if( final == 1 ) - mat.EnableKeyword( GetPropertyValStr() ); - else - mat.DisableKeyword( GetPropertyValStr() ); - } - } - } - - public override void SetMaterialMode( Material mat, bool fetchMaterialValues ) - { - base.SetMaterialMode( mat, fetchMaterialValues ); - if( fetchMaterialValues && m_materialMode && UIUtils.IsProperty( m_currentParameterType ) && mat.HasProperty( m_propertyName ) ) - { - m_materialValue = mat.GetInt( m_propertyName ); - } - } - - public override void ForceUpdateFromMaterial( Material material ) - { - if( UIUtils.IsProperty( m_currentParameterType ) && material.HasProperty( m_propertyName ) ) - { - m_materialValue = material.GetInt( m_propertyName ); - PreviewIsDirty = true; - } - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - m_multiCompile = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - if( UIUtils.CurrentShaderVersion() > 14403 ) - { - m_defaultValue = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - if( UIUtils.CurrentShaderVersion() > 14101 ) - { - m_materialValue = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - } - } - else - { - m_defaultValue = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ) ? 1 : 0; - if( UIUtils.CurrentShaderVersion() > 14101 ) - { - m_materialValue = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ) ? 1 : 0; - } - } - - if( UIUtils.CurrentShaderVersion() > 13104 ) - { - m_createToggle = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - m_currentKeyword = GetCurrentParam( ref nodeParams ); - m_currentKeywordId = UIUtils.GetKeywordId( m_currentKeyword ); - } - if( UIUtils.CurrentShaderVersion() > 14001 ) - { - m_keywordModeType = (KeywordModeType)Enum.Parse( typeof( KeywordModeType ), GetCurrentParam( ref nodeParams ) ); - } - - if( UIUtils.CurrentShaderVersion() > 14403 ) - { - KeywordEnumAmount = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - for( int i = 0; i < KeywordEnumAmount; i++ ) - { - m_defaultKeywordNames[ i ] = GetCurrentParam( ref nodeParams ); - } - - UpdateLabels(); - } - - if( UIUtils.CurrentShaderVersion() > 16304 ) - { - string currentVarMode = GetCurrentParam( ref nodeParams ); - CurrentVarMode = (StaticSwitchVariableMode)Enum.Parse( typeof( StaticSwitchVariableMode ), currentVarMode ); - if( CurrentVarMode == StaticSwitchVariableMode.Reference ) - { - m_referenceNodeId = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - } - } - else - { - CurrentVarMode = (StaticSwitchVariableMode)m_variableMode; - } - - if( CurrentVarMode == StaticSwitchVariableMode.Reference ) - { - UIUtils.UnregisterPropertyNode( this ); - } - else - { - if( m_createToggle ) - UIUtils.RegisterPropertyNode( this ); - else - UIUtils.UnregisterPropertyNode( this ); - } - - if( UIUtils.CurrentShaderVersion() > 16700 ) - { - m_isLocal = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - } - - SetMaterialToggleRetrocompatibility(); - - if( !m_isNodeBeingCopied && CurrentVarMode != StaticSwitchVariableMode.Reference ) - { - ContainerGraph.StaticSwitchNodes.UpdateDataOnNode( UniqueId, DataToArray ); - } - } - - void SetMaterialToggleRetrocompatibility() - { - if( UIUtils.CurrentShaderVersion() < 17108 ) - { - if( !m_createToggle && m_staticSwitchVarMode == StaticSwitchVariableMode.Create ) - { - if( m_keywordModeType != KeywordModeType.KeywordEnum ) - { - m_propertyName = m_propertyName.ToUpper() + "_ON"; - } - else - { - m_propertyName = m_propertyName.ToUpper(); - for( int i = 0; i < m_keywordEnumList.Length; i++ ) - { - m_keywordEnumList[ i ] = "_" + m_keywordEnumList[ i ].ToUpper(); - } - } - m_autoGlobalName = false; - } - } - } - - public override void ReadFromDeprecated( ref string[] nodeParams, Type oldType = null ) - { - base.ReadFromDeprecated( ref nodeParams, oldType ); - { - m_currentKeyword = GetCurrentParam( ref nodeParams ); - m_currentKeywordId = UIUtils.GetKeywordId( m_currentKeyword ); - m_createToggle = false; - m_keywordModeType = KeywordModeType.Toggle; - m_variableMode = VariableMode.Fetch; - CurrentVarMode = StaticSwitchVariableMode.Fetch; - } - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_multiCompile ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_defaultValue ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_materialValue ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_createToggle ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_currentKeyword ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_keywordModeType ); - IOUtils.AddFieldValueToString( ref nodeInfo, KeywordEnumAmount ); - for( int i = 0; i < KeywordEnumAmount; i++ ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_keywordEnumList[ i ] ); - } - - IOUtils.AddFieldValueToString( ref nodeInfo, CurrentVarMode ); - if( CurrentVarMode == StaticSwitchVariableMode.Reference ) - { - int referenceId = ( m_reference != null ) ? m_reference.UniqueId : -1; - IOUtils.AddFieldValueToString( ref nodeInfo, referenceId ); - } - IOUtils.AddFieldValueToString( ref nodeInfo, m_isLocal ); - } - - public override void RefreshExternalReferences() - { - base.RefreshExternalReferences(); - CheckReferenceValues( true ); - } - - StaticSwitchVariableMode CurrentVarMode - { - get { return m_staticSwitchVarMode; } - set - { - if( m_staticSwitchVarMode != value ) - { - if( value == StaticSwitchVariableMode.Reference ) - { - ContainerGraph.StaticSwitchNodes.RemoveNode( this ); - m_referenceArrayId = -1; - m_referenceNodeId = -1; - m_reference = null; - m_headerColorModifier = ReferenceHeaderColor; - } - else - { - m_headerColorModifier = Color.white; - ContainerGraph.StaticSwitchNodes.AddNode( this ); - UpdateLabels(); - } - } - m_staticSwitchVarMode = value; - } - } - public bool IsStaticSwitchDirty { get { return m_isStaticSwitchDirty; } } - public KeywordModeType KeywordModeTypeValue { get { return m_keywordModeType; } } - public int DefaultValue { get { return m_defaultValue; } } - public int MaterialValue { get { return m_materialValue; } } - public string CurrentKeyword { get { return m_currentKeyword; } } - public bool CreateToggle { get { return m_createToggle; } } - - public int KeywordEnumAmount - { - get - { - return m_keywordEnumAmount; - } - set - { - m_keywordEnumAmount = value; - m_defaultValue = Mathf.Clamp( m_defaultValue, 0, m_keywordEnumAmount - 1 ); - m_materialValue = Mathf.Clamp( m_defaultValue, 0, m_keywordEnumAmount - 1 ); - } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/StaticSwitch.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/StaticSwitch.cs.meta deleted file mode 100644 index e1b216a4..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/StaticSwitch.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: b1d1a233ea65ccd478fb6caf4327da48 -timeCreated: 1497289190 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/TauNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/TauNode.cs deleted file mode 100644 index 4901dbbf..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/TauNode.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> -// -// Custom Node TAU -// Donated by The Four Headed Cat - @fourheadedcat - -using UnityEngine; -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Tau", "Constants And Properties", "Tau constant (2*PI): 6.28318530718", null, KeyCode.None, true, false, null,null, "The Four Headed Cat - @fourheadedcat" )] - public sealed class TauNode : ParentNode - { - private readonly string Tau = ( 2.0 * Mathf.PI ).ToString(); - public TauNode() : base() { } - public TauNode( int uniqueId, float x, float y, float width, float height ) : base( uniqueId, x, y, width, height ) { } - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); - m_previewShaderGUID = "701bc295c0d75d8429eabcf45e8e008d"; - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - return dataCollector.IsSRP? "TWO_PI": Tau; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/TauNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/TauNode.cs.meta deleted file mode 100644 index 96b9694f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/TauNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 1a6ded4f5e42f6d4684a6131a3cf4d33 -timeCreated: 1481126954 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/TextureArrayNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/TextureArrayNode.cs deleted file mode 100644 index 46584ded..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/TextureArrayNode.cs +++ /dev/null @@ -1,994 +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( "Texture Array", "Textures", "Texture Array fetches a texture from a texture2DArray asset file given a index value", KeyCode.None, true, 0, int.MaxValue, typeof( Texture2DArray ) )] - public class TextureArrayNode : PropertyNode - { - [SerializeField] - private Texture2DArray m_defaultTextureArray; - - [SerializeField] - private Texture2DArray m_materialTextureArray; - - [SerializeField] - private TexReferenceType m_referenceType = TexReferenceType.Object; - - [SerializeField] - private int m_uvSet = 0; - - [SerializeField] - private MipType m_mipMode = MipType.Auto; - - private readonly string[] m_mipOptions = { "Auto", "Mip Level", "Derivative" }; - - private TextureArrayNode m_referenceSampler = null; - - [SerializeField] - private int m_referenceArrayId = -1; - - [SerializeField] - private int m_referenceNodeId = -1; - - [SerializeField] - private bool m_autoUnpackNormals = false; - - private InputPort m_texPort; - private InputPort m_uvPort; - private InputPort m_indexPort; - private InputPort m_lodPort; - private InputPort m_normalPort; - private InputPort m_ddxPort; - private InputPort m_ddyPort; - - private OutputPort m_colorPort; - - private const string AutoUnpackNormalsStr = "Normal"; - private const string NormalScaleStr = "Scale"; - - private string m_labelText = "None (Texture2DArray)"; - - private readonly Color ReferenceHeaderColor = new Color( 2.66f, 1.02f, 0.6f, 1.0f ); - - private int m_cachedUvsId = -1; - private int m_cachedSamplerId = -1; - private int m_texConnectedId = -1; - private int m_cachedUnpackId = -1; - private int m_cachedLodId = -1; - - private Rect m_iconPos; - private bool m_isEditingPicker; - - private bool m_linearTexture; - protected bool m_drawPicker; - - private ReferenceState m_state = ReferenceState.Self; - private ParentNode m_previewTextProp = null; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddOutputColorPorts( "RGBA" ); - m_colorPort = m_outputPorts[ 0 ]; - AddInputPort( WirePortDataType.SAMPLER2D, false, "Tex", -1, MasterNodePortCategory.Fragment, 6 ); - AddInputPort( WirePortDataType.FLOAT2, false, "UV", -1, MasterNodePortCategory.Fragment, 0 ); - AddInputPort( WirePortDataType.FLOAT, false, "Index", -1, MasterNodePortCategory.Fragment, 1 ); - AddInputPort( WirePortDataType.FLOAT, false, "Level", -1, MasterNodePortCategory.Fragment, 2 ); - AddInputPort( WirePortDataType.FLOAT, false, NormalScaleStr, -1, MasterNodePortCategory.Fragment, 3 ); - AddInputPort( WirePortDataType.FLOAT2, false, "DDX", -1, MasterNodePortCategory.Fragment, 4 ); - AddInputPort( WirePortDataType.FLOAT2, false, "DDY", -1, MasterNodePortCategory.Fragment, 5 ); - m_inputPorts[ 2 ].AutoDrawInternalData = true; - - m_texPort = m_inputPorts[ 0 ]; - m_uvPort = m_inputPorts[ 1 ]; - m_indexPort = m_inputPorts[ 2 ]; - m_lodPort = m_inputPorts[ 3 ]; - - m_lodPort.Visible = false; - m_normalPort = m_inputPorts[ 4 ]; - m_normalPort.Visible = m_autoUnpackNormals; - m_normalPort.FloatInternalData = 1.0f; - m_ddxPort = m_inputPorts[ 5 ]; - m_ddxPort.Visible = false; - m_ddyPort = m_inputPorts[ 6 ]; - m_ddyPort.Visible = false; - m_insideSize.Set( 128, 128 + 5 ); - m_drawPrecisionUI = false; - m_currentParameterType = PropertyType.Property; - - m_availableAttribs.Add( new PropertyAttributes( "No Scale Offset", "[NoScaleOffset]" ) ); - - m_freeType = false; - m_showPreview = true; - m_drawPreviewExpander = false; - m_drawPreview = false; - m_drawPicker = true; - m_customPrefix = "Texture Array "; - m_selectedLocation = PreviewLocation.TopCenter; - m_previewShaderGUID = "2e6d093df2d289f47b827b36efb31a81"; - m_showAutoRegisterUI = false; - } - - public override void SetPreviewInputs() - { - base.SetPreviewInputs(); - - if( m_cachedUvsId == -1 ) - m_cachedUvsId = Shader.PropertyToID( "_CustomUVs" ); - - if( m_cachedSamplerId == -1 ) - m_cachedSamplerId = Shader.PropertyToID( "_Sampler" ); - - if( m_texConnectedId == -1 ) - m_texConnectedId = Shader.PropertyToID( "_TexConnected" ); - - if( m_cachedUnpackId == -1 ) - m_cachedUnpackId = Shader.PropertyToID( "_Unpack" ); - - if( m_cachedLodId == -1 ) - m_cachedLodId = Shader.PropertyToID( "_LodType" ); - - PreviewMaterial.SetFloat( m_cachedLodId, ( m_mipMode == MipType.MipLevel ? 1 : 0 ) ); - PreviewMaterial.SetFloat( m_cachedUnpackId, m_autoUnpackNormals ? 1 : 0 ); - if( m_referenceType == TexReferenceType.Instance && m_referenceSampler != null ) - { - if( (ParentNode)m_referenceSampler != m_referenceSampler.PreviewTextProp ) - { - PreviewMaterial.SetInt( m_texConnectedId, 1 ); - PreviewMaterial.SetTexture( "_G", m_referenceSampler.PreviewTextProp.PreviewTexture ); - } - else - { - PreviewMaterial.SetInt( m_texConnectedId, 0 ); - PreviewMaterial.SetTexture( m_cachedSamplerId, m_referenceSampler.TextureArray ); - } - } - else if( m_texPort.IsConnected ) - { - PreviewMaterial.SetInt( m_texConnectedId, 1 ); - } - else - { - PreviewMaterial.SetInt( m_texConnectedId, 0 ); - PreviewMaterial.SetTexture( m_cachedSamplerId, TextureArray ); - } - PreviewMaterial.SetFloat( m_cachedUvsId, ( m_uvPort.IsConnected ? 1 : 0 ) ); - } - - protected override void OnUniqueIDAssigned() - { - base.OnUniqueIDAssigned(); - if( m_referenceType == TexReferenceType.Object ) - { - UIUtils.RegisterTextureArrayNode( this ); - UIUtils.RegisterPropertyNode( this ); - } - - if( UniqueId > -1 ) - ContainerGraph.TextureArrayNodes.OnReorderEventComplete += OnReorderEventComplete; - - } - - private void OnReorderEventComplete() - { - if( m_referenceType == TexReferenceType.Instance && m_referenceSampler != null ) - { - m_referenceArrayId = ContainerGraph.TextureArrayNodes.GetNodeRegisterIdx( m_referenceSampler.UniqueId ); - } - } - - new void ShowDefaults() - { - m_uvSet = EditorGUILayoutIntPopup( Constants.AvailableUVSetsLabel, m_uvSet, Constants.AvailableUVSetsStr, Constants.AvailableUVSets ); - - MipType newMipMode = (MipType)EditorGUILayoutPopup( "Mip Mode", (int)m_mipMode, m_mipOptions ); - if( newMipMode != m_mipMode ) - { - m_mipMode = newMipMode; - } - - switch( m_mipMode ) - { - case MipType.Auto: - m_lodPort.Visible = false; - m_ddxPort.Visible = false; - m_ddyPort.Visible = false; - break; - case MipType.MipLevel: - m_lodPort.Visible = true; - m_ddxPort.Visible = false; - m_ddyPort.Visible = false; - break; - case MipType.MipBias: - case MipType.Derivative: - m_ddxPort.Visible = true; - m_ddyPort.Visible = true; - m_lodPort.Visible = false; - break; - } - - if( m_ddxPort.Visible ) - { - EditorGUILayout.HelpBox( "Warning: Derivative Mip Mode only works on some platforms (D3D11 XBOXONE GLES3 GLCORE)", MessageType.Warning ); - } - - if( !m_lodPort.IsConnected && m_lodPort.Visible ) - { - m_lodPort.FloatInternalData = EditorGUILayoutFloatField( "Mip Level", m_lodPort.FloatInternalData ); - } - - if( !m_indexPort.IsConnected ) - { - m_indexPort.FloatInternalData = EditorGUILayoutFloatField( "Index", m_indexPort.FloatInternalData ); - } - - - } - - public override void DrawMainPropertyBlock() - { - EditorGUI.BeginChangeCheck(); - m_referenceType = (TexReferenceType)EditorGUILayoutPopup( Constants.ReferenceTypeStr, (int)m_referenceType, Constants.ReferenceArrayLabels ); - if( EditorGUI.EndChangeCheck() ) - { - if( m_referenceType == TexReferenceType.Object ) - { - UIUtils.RegisterTextureArrayNode( this ); - UIUtils.RegisterPropertyNode( this ); - - SetTitleText( m_propertyInspectorName ); - SetAdditonalTitleText( string.Format( Constants.PropertyValueLabel, GetPropertyValStr() ) ); - m_referenceArrayId = -1; - m_referenceNodeId = -1; - m_referenceSampler = null; - } - else - { - UIUtils.UnregisterTextureArrayNode( this ); - UIUtils.UnregisterPropertyNode( this ); - } - UpdateHeaderColor(); - } - - if( m_referenceType == TexReferenceType.Object ) - { - EditorGUI.BeginChangeCheck(); - base.DrawMainPropertyBlock(); - if( EditorGUI.EndChangeCheck() ) - { - OnPropertyNameChanged(); - } - } - else - { - string[] arr = UIUtils.TextureArrayNodeArr(); - bool guiEnabledBuffer = GUI.enabled; - if( arr != null && arr.Length > 0 ) - { - GUI.enabled = true; - } - else - { - m_referenceArrayId = -1; - GUI.enabled = false; - } - - m_referenceArrayId = EditorGUILayoutPopup( Constants.AvailableReferenceStr, m_referenceArrayId, arr ); - GUI.enabled = guiEnabledBuffer; - - ShowDefaults(); - - DrawSamplerOptions(); - } - } - - public override void OnPropertyNameChanged() - { - base.OnPropertyNameChanged(); - UIUtils.UpdateTextureArrayDataNode( UniqueId, PropertyInspectorName ); - } - - public override void DrawSubProperties() - { - ShowDefaults(); - - DrawSamplerOptions(); - - EditorGUI.BeginChangeCheck(); - m_defaultTextureArray = EditorGUILayoutObjectField( Constants.DefaultValueLabel, m_defaultTextureArray, typeof( Texture2DArray ), false ) as Texture2DArray; - if( EditorGUI.EndChangeCheck() ) - { - CheckTextureImporter( true ); - SetAdditonalTitleText( string.Format( Constants.PropertyValueLabel, GetPropertyValStr() ) ); - } - } - - public override void DrawMaterialProperties() - { - ShowDefaults(); - - DrawSamplerOptions(); - - EditorGUI.BeginChangeCheck(); - m_materialTextureArray = EditorGUILayoutObjectField( Constants.MaterialValueLabel, m_materialTextureArray, typeof( Texture2DArray ), false ) as Texture2DArray; - if( EditorGUI.EndChangeCheck() ) - { - CheckTextureImporter( true ); - SetAdditonalTitleText( string.Format( Constants.PropertyValueLabel, GetPropertyValStr() ) ); - m_requireMaterialUpdate = true; - } - } - - public void DrawSamplerOptions() - { - EditorGUI.BeginChangeCheck(); - bool autoUnpackNormals = EditorGUILayoutToggle( "Normal Map", m_autoUnpackNormals ); - if( EditorGUI.EndChangeCheck() ) - { - if( m_autoUnpackNormals != autoUnpackNormals ) - { - AutoUnpackNormals = autoUnpackNormals; - - ConfigureInputPorts(); - ConfigureOutputPorts(); - } - } - - if( m_autoUnpackNormals && !m_normalPort.IsConnected ) - { - m_normalPort.FloatInternalData = EditorGUILayoutFloatField( NormalScaleStr, m_normalPort.FloatInternalData ); - } - } - - public void ConfigureInputPorts() - { - m_normalPort.Visible = AutoUnpackNormals; - - m_sizeIsDirty = true; - } - - public void ConfigureOutputPorts() - { - m_outputPorts[ m_colorPort.PortId + 4 ].Visible = !AutoUnpackNormals; - - if( !AutoUnpackNormals ) - { - m_colorPort.ChangeProperties( "RGBA", WirePortDataType.FLOAT4, false ); - m_outputPorts[ m_colorPort.PortId + 1 ].ChangeProperties( "R", WirePortDataType.FLOAT, false ); - m_outputPorts[ m_colorPort.PortId + 2 ].ChangeProperties( "G", WirePortDataType.FLOAT, false ); - m_outputPorts[ m_colorPort.PortId + 3 ].ChangeProperties( "B", WirePortDataType.FLOAT, false ); - m_outputPorts[ m_colorPort.PortId + 4 ].ChangeProperties( "A", WirePortDataType.FLOAT, false ); - - } - else - { - m_colorPort.ChangeProperties( "XYZ", WirePortDataType.FLOAT3, false ); - m_outputPorts[ m_colorPort.PortId + 1 ].ChangeProperties( "X", WirePortDataType.FLOAT, false ); - m_outputPorts[ m_colorPort.PortId + 2 ].ChangeProperties( "Y", WirePortDataType.FLOAT, false ); - m_outputPorts[ m_colorPort.PortId + 3 ].ChangeProperties( "Z", WirePortDataType.FLOAT, false ); - } - - m_sizeIsDirty = true; - } - - public virtual void CheckTextureImporter( bool additionalCheck ) - { - m_requireMaterialUpdate = true; - Texture2DArray texture = m_materialMode ? m_materialTextureArray : m_defaultTextureArray; - - UnityEngine.Object obj = AssetDatabase.LoadAssetAtPath( AssetDatabase.GetAssetPath( texture ), typeof( UnityEngine.Object ) ); - - if( obj != null ) - { - SerializedObject serializedObject = new UnityEditor.SerializedObject( obj ); - - if( serializedObject != null ) - { - SerializedProperty colorSpace = serializedObject.FindProperty( "m_ColorSpace" ); - m_linearTexture = ( colorSpace.intValue == 0 ); - } - } - } - - void UpdateHeaderColor() - { - m_headerColorModifier = ( m_referenceType == TexReferenceType.Object ) ? Color.white : ReferenceHeaderColor; - } - - public override void DrawGUIControls( DrawInfo drawInfo ) - { - base.DrawGUIControls( drawInfo ); - - if( !( drawInfo.CurrentEventType == EventType.MouseDown || drawInfo.CurrentEventType == EventType.MouseUp || drawInfo.CurrentEventType == EventType.ExecuteCommand || drawInfo.CurrentEventType == EventType.DragPerform ) ) - return; - - bool insideBox = m_previewRect.Contains( drawInfo.MousePosition ); - - if( insideBox ) - { - m_isEditingPicker = true; - } - else if( m_isEditingPicker && !insideBox && drawInfo.CurrentEventType != EventType.ExecuteCommand ) - { - GUI.FocusControl( null ); - m_isEditingPicker = false; - } - - if( m_state != ReferenceState.Self && drawInfo.CurrentEventType == EventType.MouseDown && m_previewRect.Contains( drawInfo.MousePosition ) ) - { - UIUtils.FocusOnNode( m_previewTextProp, 1, true ); - Event.current.Use(); - } - } - - public override void OnNodeLayout( DrawInfo drawInfo ) - { - base.OnNodeLayout( drawInfo ); - - if( m_drawPreview ) - { - m_iconPos = m_globalPosition; - m_iconPos.width = 19 * drawInfo.InvertedZoom; - m_iconPos.height = 19 * drawInfo.InvertedZoom; - - m_iconPos.y += 10 * drawInfo.InvertedZoom; - m_iconPos.x += m_globalPosition.width - m_iconPos.width - 5 * drawInfo.InvertedZoom; - } - - bool instanced = CheckReference(); - if( instanced ) - { - m_state = ReferenceState.Instance; - m_previewTextProp = m_referenceSampler; - } - else if( m_texPort.IsConnected ) - { - m_state = ReferenceState.Connected; - m_previewTextProp = m_texPort.GetOutputNode( 0 ) as ParentNode; - } - else - { - m_state = ReferenceState.Self; - m_previewTextProp = this; - } - - if( m_previewTextProp == null ) - m_previewTextProp = this; - - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - - if( m_isEditingPicker && m_drawPicker ) - { - Rect hitRect = m_previewRect; - hitRect.height = 14 * drawInfo.InvertedZoom; - hitRect.y = m_previewRect.yMax - hitRect.height; - hitRect.width = 4 * 14 * drawInfo.InvertedZoom; - - bool restoreMouse = false; - if( Event.current.type == EventType.MouseDown && hitRect.Contains( drawInfo.MousePosition ) ) - { - restoreMouse = true; - Event.current.type = EventType.Ignore; - } - - EditorGUI.BeginChangeCheck(); - m_colorBuffer = GUI.color; - GUI.color = Color.clear; - if( m_materialMode ) - m_materialTextureArray = EditorGUIObjectField( m_previewRect, m_materialTextureArray, typeof( Texture2DArray ), false ) as Texture2DArray; - else - m_defaultTextureArray = EditorGUIObjectField( m_previewRect, m_defaultTextureArray, typeof( Texture2DArray ), false ) as Texture2DArray; - GUI.color = m_colorBuffer; - - if( EditorGUI.EndChangeCheck() ) - { - PreviewIsDirty = true; - CheckTextureImporter( true ); - SetTitleText( PropertyInspectorName ); - SetAdditonalTitleText( string.Format( Constants.PropertyValueLabel, GetPropertyValStr() ) ); - ConfigureInputPorts(); - ConfigureOutputPorts(); - BeginDelayedDirtyProperty(); - m_requireMaterialUpdate = true; - } - - if( restoreMouse ) - { - Event.current.type = EventType.MouseDown; - } - - if( ( drawInfo.CurrentEventType == EventType.MouseDown || drawInfo.CurrentEventType == EventType.MouseUp ) ) - DrawPreviewMaskButtonsLayout( drawInfo, m_previewRect ); - } - - if( drawInfo.CurrentEventType != EventType.Repaint ) - return; - - switch( m_state ) - { - default: - case ReferenceState.Self: - if( drawInfo.CurrentEventType == EventType.Repaint ) - { - m_drawPreview = false; - m_drawPicker = true; - - DrawTexturePicker( drawInfo ); - } - break; - case ReferenceState.Connected: - if( drawInfo.CurrentEventType == EventType.Repaint ) - { - m_drawPreview = true; - m_drawPicker = false; - - if( m_previewTextProp != null ) - { - SetTitleTextOnCallback( m_previewTextProp.TitleContent.text, ( instance, newTitle ) => instance.TitleContent.text = newTitle + " (Input)" ); - SetAdditonalTitleText( m_previewTextProp.AdditonalTitleContent.text ); - } - - // Draw chain lock - GUI.Label( m_iconPos, string.Empty, UIUtils.GetCustomStyle( CustomStyle.SamplerTextureIcon ) ); - - // Draw frame around preview - GUI.Label( m_previewRect, string.Empty, UIUtils.GetCustomStyle( CustomStyle.SamplerFrame ) ); - } - break; - case ReferenceState.Instance: - { - m_drawPreview = true; - m_drawPicker = false; - - if( m_referenceSampler != null ) - { - SetTitleTextOnCallback( m_referenceSampler.PreviewTextProp.TitleContent.text, ( instance, newTitle ) => instance.TitleContent.text = newTitle + Constants.InstancePostfixStr ); - SetAdditonalTitleText( m_referenceSampler.PreviewTextProp.AdditonalTitleContent.text ); - } - - // Draw chain lock - GUI.Label( m_iconPos, string.Empty, UIUtils.GetCustomStyle( CustomStyle.SamplerTextureIcon ) ); - - // Draw frame around preview - GUI.Label( m_previewRect, string.Empty, UIUtils.GetCustomStyle( CustomStyle.SamplerFrame ) ); - } - break; - } - } - - protected void DrawTexturePicker( DrawInfo drawInfo ) - { - Rect newRect = m_previewRect; - Texture2DArray currentValue = m_materialMode ? m_materialTextureArray : m_defaultTextureArray; - - if( currentValue == null ) - GUI.Label( newRect, string.Empty, UIUtils.ObjectFieldThumb ); - else - DrawPreview( drawInfo, m_previewRect ); - - if( ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD2 ) - { - Rect butRect = m_previewRect; - butRect.y -= 1; - butRect.x += 1; - - Rect smallButton = newRect; - smallButton.height = 14 * drawInfo.InvertedZoom; - smallButton.y = newRect.yMax - smallButton.height - 2; - smallButton.width = 40 * drawInfo.InvertedZoom; - smallButton.x = newRect.xMax - smallButton.width - 2; - if( currentValue == null ) - { - GUI.Label( newRect, m_labelText, UIUtils.ObjectFieldThumbOverlay ); - } - else - { - DrawPreviewMaskButtonsRepaint( drawInfo, butRect ); - } - GUI.Label( smallButton, "Select", UIUtils.GetCustomStyle( CustomStyle.SamplerButton ) ); - } - - GUI.Label( newRect, string.Empty, UIUtils.GetCustomStyle( CustomStyle.SamplerFrame ) ); - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) - return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); - - - OnPropertyNameChanged(); - - if( CheckReference() ) - { - OrderIndex = m_referenceSampler.RawOrderIndex; - OrderIndexOffset = m_referenceSampler.OrderIndexOffset; - } - - bool isVertex = ( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation ); - - bool instanced = false; - - if( m_referenceType == TexReferenceType.Instance && m_referenceSampler != null ) - instanced = true; - - if( instanced ) - { - if( !m_referenceSampler.TexPort.IsConnected ) - base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); - } - else if( !m_texPort.IsConnected ) - base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); - - string level = string.Empty; - if( m_lodPort.Visible ) - { - level = m_lodPort.GeneratePortInstructions( ref dataCollector ); - } - - if( isVertex && !m_lodPort.Visible ) - level = "0"; - - string propertyName = string.Empty; - if( instanced ) - { - if( m_referenceSampler.TexPort.IsConnected ) - propertyName = m_referenceSampler.TexPort.GeneratePortInstructions( ref dataCollector ); - else - propertyName = m_referenceSampler.PropertyName; - } - else if( m_texPort.IsConnected ) - propertyName = m_texPort.GeneratePortInstructions( ref dataCollector ); - else - propertyName = PropertyName; - - string uvs = string.Empty; - if( m_uvPort.IsConnected ) - { - uvs = m_uvPort.GeneratePortInstructions( ref dataCollector ); - } - else - { - if( dataCollector.IsTemplate ) - { - uvs = dataCollector.TemplateDataCollectorInstance.GetTextureCoord( m_uvSet, propertyName/*( instanced ? m_referenceSampler.PropertyName : PropertyName )*/, UniqueId, CurrentPrecisionType ); - } - else - { - if( isVertex ) - uvs = TexCoordVertexDataNode.GenerateVertexUVs( ref dataCollector, UniqueId, m_uvSet, propertyName ); - else - uvs = TexCoordVertexDataNode.GenerateFragUVs( ref dataCollector, UniqueId, m_uvSet, propertyName ); - } - } - string index = m_indexPort.GeneratePortInstructions( ref dataCollector ); - - string m_normalMapUnpackMode = ""; - if( m_autoUnpackNormals ) - { - bool isScaledNormal = false; - if( m_normalPort.IsConnected ) - { - isScaledNormal = true; - } - else - { - if( m_normalPort.FloatInternalData != 1 ) - { - isScaledNormal = true; - } - } - - string scaleValue = isScaledNormal ? m_normalPort.GeneratePortInstructions( ref dataCollector ) : "1.0"; - m_normalMapUnpackMode = TemplateHelperFunctions.CreateUnpackNormalStr( dataCollector, isScaledNormal, scaleValue ); - if( isScaledNormal && ( !dataCollector.IsTemplate || !dataCollector.IsSRP ) ) - { - dataCollector.AddToIncludes( UniqueId, Constants.UnityStandardUtilsLibFuncs ); - } - - } - - string result = string.Empty; - - if( dataCollector.IsTemplate && dataCollector.IsSRP ) - { - //CAREFUL mipbias here means derivative (this needs index changes) - //TODO: unity now supports bias as well - if( m_mipMode == MipType.MipBias ) - { - dataCollector.UsingArrayDerivatives = true; - result = propertyName + ".SampleGrad(sampler" + propertyName + ", float3(" + uvs + ", " + index + "), " + m_ddxPort.GeneratePortInstructions( ref dataCollector ) + ", " + m_ddyPort.GeneratePortInstructions( ref dataCollector ) + ");"; - } - else if( m_lodPort.Visible || isVertex ) - { - result = "SAMPLE_TEXTURE2D_ARRAY_LOD(" + propertyName + ", sampler" + propertyName + ", " + uvs + ", " + index + ", " + level + " )"; - } - else - { - result = "SAMPLE_TEXTURE2D_ARRAY(" + propertyName + ", sampler" + propertyName + ", " + uvs + ", " + index + " )"; - } - } - else - { - //CAREFUL mipbias here means derivative (this needs index changes) - if( m_mipMode == MipType.MipBias ) - { - dataCollector.UsingArrayDerivatives = true; - result = "ASE_SAMPLE_TEX2DARRAY_GRAD(" + propertyName + ", float3(" + uvs + ", " + index + "), " + m_ddxPort.GeneratePortInstructions( ref dataCollector ) + ", " + m_ddyPort.GeneratePortInstructions( ref dataCollector ) + " )"; - } - else if( m_lodPort.Visible || isVertex ) - { - result = "UNITY_SAMPLE_TEX2DARRAY_LOD(" + propertyName + ", float3(" + uvs + ", " + index + "), " + level + " )"; - } - else - { - result = "UNITY_SAMPLE_TEX2DARRAY" + ( m_lodPort.Visible || isVertex ? "_LOD" : "" ) + "(" + propertyName + ", float3(" + uvs + ", " + index + ") " + ( m_lodPort.Visible || isVertex ? ", " + level : "" ) + " )"; - } - } - - if( m_autoUnpackNormals ) - result = string.Format( m_normalMapUnpackMode, result ); - - RegisterLocalVariable( 0, result, ref dataCollector, "texArray" + OutputId ); - return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); - } - - public override string PropertyName - { - get - { - if( m_referenceType == TexReferenceType.Instance && m_referenceSampler != null ) - return m_referenceSampler.PropertyName; - else - return base.PropertyName; - } - } - - public override string PropertyInspectorName - { - get - { - if( m_referenceType == TexReferenceType.Instance && m_referenceSampler != null ) - return m_referenceSampler.PropertyInspectorName; - else - return base.PropertyInspectorName; - } - } - - public override string GetPropertyValue() - { - return PropertyAttributes + PropertyName + "(\"" + PropertyInspectorName + "\", 2DArray ) = \"\" {}"; - } - - public override bool GetUniformData( out string dataType, out string dataName, ref bool fullValue ) - { - MasterNode currMasterNode = ( m_containerGraph.CurrentMasterNode != null ) ? m_containerGraph.CurrentMasterNode : m_containerGraph.ParentWindow.OutsideGraph.CurrentMasterNode; - if( currMasterNode != null && currMasterNode.CurrentDataCollector.IsTemplate && currMasterNode.CurrentDataCollector.IsSRP ) - { - dataType = "TEXTURE2D_ARRAY( " + PropertyName + ""; - dataName = ");\nuniform SAMPLER( sampler" + PropertyName + " )"; - return true; - } - dataType = "UNITY_DECLARE_TEX2DARRAY("; - dataName = PropertyName + " )"; - return true; - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - string textureName = GetCurrentParam( ref nodeParams ); - m_defaultTextureArray = AssetDatabase.LoadAssetAtPath<Texture2DArray>( textureName ); - m_uvSet = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - m_referenceType = (TexReferenceType)Enum.Parse( typeof( TexReferenceType ), GetCurrentParam( ref nodeParams ) ); - m_referenceNodeId = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - if( UIUtils.CurrentShaderVersion() > 3202 ) - m_mipMode = (MipType)Enum.Parse( typeof( MipType ), GetCurrentParam( ref nodeParams ) ); - if( UIUtils.CurrentShaderVersion() > 5105 ) - m_autoUnpackNormals = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - - if( m_referenceType == TexReferenceType.Instance ) - { - UIUtils.UnregisterTextureArrayNode( this ); - UIUtils.UnregisterPropertyNode( this ); - } - - ConfigureInputPorts(); - ConfigureOutputPorts(); - - m_lodPort.Visible = ( m_mipMode == MipType.MipLevel ); - m_ddxPort.Visible = ( m_mipMode == MipType.MipBias ); //not really bias, it's derivative - m_ddyPort.Visible = ( m_mipMode == MipType.MipBias ); //not really bias, it's derivative - - UpdateHeaderColor(); - - if( m_defaultTextureArray ) - { - m_materialTextureArray = m_defaultTextureArray; - } - - if( !m_isNodeBeingCopied && m_referenceType == TexReferenceType.Object ) - { - ContainerGraph.TextureArrayNodes.UpdateDataOnNode( UniqueId, DataToArray ); - } - } - - public override void RefreshExternalReferences() - { - base.RefreshExternalReferences(); - - m_referenceSampler = UIUtils.GetNode( m_referenceNodeId ) as TextureArrayNode; - m_referenceArrayId = UIUtils.GetTextureArrayNodeRegisterId( m_referenceNodeId ); - OnPropertyNameChanged(); - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, ( m_defaultTextureArray != null ) ? AssetDatabase.GetAssetPath( m_defaultTextureArray ) : Constants.NoStringValue ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_uvSet.ToString() ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_referenceType ); - IOUtils.AddFieldValueToString( ref nodeInfo, ( ( m_referenceSampler != null ) ? m_referenceSampler.UniqueId : -1 ) ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_mipMode ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_autoUnpackNormals ); - } - - public override void ReadAdditionalClipboardData( ref string[] nodeParams ) - { - base.ReadAdditionalClipboardData( ref nodeParams ); - string textureName = GetCurrentParam( ref nodeParams ); - m_materialTextureArray = AssetDatabase.LoadAssetAtPath<Texture2DArray>( textureName ); - } - - public override void WriteAdditionalClipboardData( ref string nodeInfo ) - { - base.WriteAdditionalClipboardData( ref nodeInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, ( m_materialTextureArray != null ) ? AssetDatabase.GetAssetPath( m_materialTextureArray ) : Constants.NoStringValue ); - } - - - public override void UpdateMaterial( Material mat ) - { - base.UpdateMaterial( mat ); - if( UIUtils.IsProperty( m_currentParameterType ) && !InsideShaderFunction && m_referenceType == TexReferenceType.Object ) - { - OnPropertyNameChanged(); - if( mat.HasProperty( PropertyName ) ) - { - mat.SetTexture( PropertyName, m_materialTextureArray ); - } - } - } - - public override void SetMaterialMode( Material mat, bool fetchMaterialValues ) - { - base.SetMaterialMode( mat, fetchMaterialValues ); - if( fetchMaterialValues && m_materialMode && UIUtils.IsProperty( m_currentParameterType ) ) - { - if( mat.HasProperty( PropertyName ) ) - { - m_materialTextureArray = (Texture2DArray)mat.GetTexture( PropertyName ); - if( m_materialTextureArray == null ) - m_materialTextureArray = m_defaultTextureArray; - } - } - } - - public override void ForceUpdateFromMaterial( Material material ) - { - if( UIUtils.IsProperty( m_currentParameterType ) && material.HasProperty( PropertyName ) ) - { - m_materialTextureArray = (Texture2DArray)material.GetTexture( PropertyName ); - if( m_materialTextureArray == null ) - m_materialTextureArray = m_defaultTextureArray; - - PreviewIsDirty = true; - } - } - - public override bool UpdateShaderDefaults( ref Shader shader, ref TextureDefaultsDataColector defaultCol ) - { - if( m_defaultTextureArray != null ) - { - defaultCol.AddValue( PropertyName, m_defaultTextureArray ); - } - - return true; - } - - public override string GetPropertyValStr() - { - return m_materialMode ? ( m_materialTextureArray != null ? m_materialTextureArray.name : IOUtils.NO_TEXTURES ) : ( m_defaultTextureArray != null ? m_defaultTextureArray.name : IOUtils.NO_TEXTURES ); - } - - public bool CheckReference() - { - if( m_referenceType == TexReferenceType.Instance && m_referenceArrayId > -1 ) - { - m_referenceSampler = UIUtils.GetTextureArrayNode( m_referenceArrayId ); - - if( m_referenceSampler == null ) - { - m_texPort.Locked = false; - m_referenceArrayId = -1; - } - else - m_texPort.Locked = true; - } - else - { - m_texPort.Locked = false; - } - - return m_referenceSampler != null; - } - - public override void SetupFromCastObject( UnityEngine.Object obj ) - { - base.SetupFromCastObject( obj ); - SetupFromObject( obj ); - } - - public override void OnObjectDropped( UnityEngine.Object obj ) - { - SetupFromObject( obj ); - } - - private void SetupFromObject( UnityEngine.Object obj ) - { - if( m_materialMode ) - m_materialTextureArray = obj as Texture2DArray; - else - m_defaultTextureArray = obj as Texture2DArray; - } - - public Texture2DArray TextureArray { get { return ( m_materialMode ? m_materialTextureArray : m_defaultTextureArray ); } } - - public bool IsLinearTexture { get { return m_linearTexture; } } - - public bool AutoUnpackNormals - { - get { return m_autoUnpackNormals; } - set { m_autoUnpackNormals = value; } - } - - public override string DataToArray { get { return PropertyInspectorName; } } - - public override void Destroy() - { - base.Destroy(); - m_defaultTextureArray = null; - m_materialTextureArray = null; - - m_texPort = null; - m_uvPort = null; - m_indexPort = null; - m_lodPort = null; - m_normalPort = null; - m_ddxPort = null; - m_ddyPort = null; - - if( m_referenceType == TexReferenceType.Object ) - { - UIUtils.UnregisterTextureArrayNode( this ); - UIUtils.UnregisterPropertyNode( this ); - } - - if( UniqueId > -1 ) - ContainerGraph.TextureArrayNodes.OnReorderEventComplete -= OnReorderEventComplete; - } - - public ParentNode PreviewTextProp { get { return m_previewTextProp; } } - public InputPort TexPort { get { return m_texPort; } } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/TextureArrayNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/TextureArrayNode.cs.meta deleted file mode 100644 index 54332f0b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/TextureArrayNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 3c5be6f9c03445d4fb70955f594877dc -timeCreated: 1485801067 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Vector2Node.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Vector2Node.cs deleted file mode 100644 index 306816ba..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Vector2Node.cs +++ /dev/null @@ -1,301 +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 -{ - [System.Serializable] - [NodeAttributes( "Vector2", "Constants And Properties", "Vector2 property", null, KeyCode.Alpha2 )] - public sealed class Vector2Node : PropertyNode - { - [SerializeField] - private Vector2 m_defaultValue = Vector2.zero; - - [SerializeField] - private Vector2 m_materialValue = Vector2.zero; - - private const float LabelWidth = 8; - - private int m_cachedPropertyId = -1; - - private bool m_isEditingFields; - private Vector2 m_previousValue = Vector2.zero; - private string[] m_fieldText = new string[] { "0", "0" }; - - public Vector2Node() : base() { } - public Vector2Node( int uniqueId, float x, float y, float width, float height ) : base( uniqueId, x, y, width, height ) { } - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - GlobalTypeWarningText = string.Format( GlobalTypeWarningText, "Vector" ); - m_insideSize.Set(50,20); - m_selectedLocation = PreviewLocation.BottomCenter; - AddOutputVectorPorts( WirePortDataType.FLOAT2, "XY" ); - m_availableAttribs.Add( new PropertyAttributes( "Remap Sliders", "[RemapSliders]" ) ); - m_previewShaderGUID = "88b4191eb06084d4da85d1dd2f984085"; - m_srpBatcherCompatible = true; - m_showHybridInstancedUI = true; - } - - public override void CopyDefaultsToMaterial() - { - m_materialValue = m_defaultValue; - } - - public override void DrawSubProperties() - { - m_defaultValue = EditorGUILayoutVector2Field( Constants.DefaultValueLabel, m_defaultValue ); - } - - public override void DrawMaterialProperties() - { - if ( m_materialMode ) - EditorGUI.BeginChangeCheck(); - - m_materialValue = EditorGUILayoutVector2Field( Constants.MaterialValueLabel, m_materialValue ); - if ( m_materialMode && EditorGUI.EndChangeCheck() ) - m_requireMaterialUpdate = true; - } - - public override void SetPreviewInputs() - { - base.SetPreviewInputs(); - - if ( m_cachedPropertyId == -1 ) - m_cachedPropertyId = Shader.PropertyToID( "_InputVector" ); - - if ( m_materialMode && m_currentParameterType != PropertyType.Constant ) - PreviewMaterial.SetVector( m_cachedPropertyId, new Vector4( m_materialValue[ 0 ], m_materialValue[ 1 ], 0, 0 ) ); - else - PreviewMaterial.SetVector( m_cachedPropertyId, new Vector4( m_defaultValue[ 0 ], m_defaultValue[ 1 ], 0, 0 ) ); - } - - public override void OnNodeLayout( DrawInfo drawInfo ) - { - base.OnNodeLayout( drawInfo ); - - m_propertyDrawPos = m_remainingBox; - m_propertyDrawPos.x = m_remainingBox.x - LabelWidth * drawInfo.InvertedZoom; - m_propertyDrawPos.width = drawInfo.InvertedZoom * Constants.FLOAT_DRAW_WIDTH_FIELD_SIZE; - m_propertyDrawPos.height = drawInfo.InvertedZoom * Constants.FLOAT_DRAW_HEIGHT_FIELD_SIZE; - } - - public override void DrawGUIControls( DrawInfo drawInfo ) - { - base.DrawGUIControls( drawInfo ); - - if ( drawInfo.CurrentEventType != EventType.MouseDown ) - return; - - Rect hitBox = m_remainingBox; - hitBox.xMin -= LabelWidth * drawInfo.InvertedZoom; - bool insideBox = hitBox.Contains( drawInfo.MousePosition ); - - if ( insideBox ) - { - GUI.FocusControl( null ); - m_isEditingFields = true; - } - else if ( m_isEditingFields && !insideBox ) - { - GUI.FocusControl( null ); - m_isEditingFields = false; - } - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - - if ( !m_isVisible ) - return; - - if ( m_isEditingFields && m_currentParameterType != PropertyType.Global) - { - EditorGUI.BeginChangeCheck(); - for ( int i = 0; i < 2; i++ ) - { - m_propertyDrawPos.y = m_outputPorts[ i + 1 ].Position.y - 2 * drawInfo.InvertedZoom; - if ( m_materialMode && m_currentParameterType != PropertyType.Constant ) - { - float val = m_materialValue[ i ]; - UIUtils.DrawFloat( this, ref m_propertyDrawPos, ref val, LabelWidth * drawInfo.InvertedZoom ); - m_materialValue[ i ] = val; - } - else - { - float val = m_defaultValue[ i ]; - UIUtils.DrawFloat( this, ref m_propertyDrawPos, ref val, LabelWidth * drawInfo.InvertedZoom ); - m_defaultValue[ i ] = val; - } - } - if ( EditorGUI.EndChangeCheck() ) - { - PreviewIsDirty = true; - m_requireMaterialUpdate = m_materialMode; - BeginDelayedDirtyProperty(); - } - } - else if ( drawInfo.CurrentEventType == EventType.Repaint && ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD4 ) - { - bool guiEnabled = GUI.enabled; - GUI.enabled = m_currentParameterType != PropertyType.Global; - for ( int i = 0; i < 2; i++ ) - { - m_propertyDrawPos.y = m_outputPorts[ i + 1 ].Position.y - 2 * drawInfo.InvertedZoom; - - Rect fakeField = m_propertyDrawPos; - fakeField.xMin += LabelWidth * drawInfo.InvertedZoom; - if( GUI.enabled ) - { - Rect fakeLabel = m_propertyDrawPos; - fakeLabel.xMax = fakeField.xMin; - EditorGUIUtility.AddCursorRect( fakeLabel, MouseCursor.SlideArrow ); - EditorGUIUtility.AddCursorRect( fakeField, MouseCursor.Text ); - } - if ( m_materialMode && m_currentParameterType != PropertyType.Constant ) - { - if ( m_previousValue[ i ] != m_materialValue[ i ] ) - { - m_previousValue[ i ] = m_materialValue[ i ]; - m_fieldText[ i ] = m_materialValue[ i ].ToString(); - } - } - else - { - if ( m_previousValue[ i ] != m_defaultValue[ i ] ) - { - m_previousValue[ i ] = m_defaultValue[ i ]; - m_fieldText[ i ] = m_defaultValue[ i ].ToString(); - } - } - - GUI.Label( fakeField, m_fieldText[ i ], UIUtils.MainSkin.textField ); - } - GUI.enabled = guiEnabled; - } - } - - public override void ConfigureLocalVariable( ref MasterNodeDataCollector dataCollector ) - { - Vector2 value = m_defaultValue; - dataCollector.AddLocalVariable( UniqueId, CreateLocalVarDec( value.x + "," + value.y ) ); - m_outputPorts[ 0 ].SetLocalValue( m_propertyName, dataCollector.PortCategory ); - m_outputPorts[ 1 ].SetLocalValue( m_propertyName + ".x" , dataCollector.PortCategory); - m_outputPorts[ 2 ].SetLocalValue( m_propertyName + ".y", dataCollector.PortCategory ); - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - base.GenerateShaderForOutput( outputId,ref dataCollector, ignoreLocalvar ); - m_precisionString = UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, m_outputPorts[ 0 ].DataType ); - - if ( m_currentParameterType != PropertyType.Constant ) - return GetOutputVectorItem( 0, outputId, PropertyData( dataCollector.PortCategory ) ); - - if ( m_outputPorts[ outputId ].IsLocalValue( dataCollector.PortCategory ) ) - { - return m_outputPorts[ outputId ].LocalValue( dataCollector.PortCategory ); - } - - if ( CheckLocalVariable( ref dataCollector ) ) - { - return m_outputPorts[ outputId ].LocalValue( dataCollector.PortCategory ); - } - - Vector2 value = m_defaultValue; - string result = string.Empty; - switch ( outputId ) - { - case 0: - { - result = m_precisionString+"( " + value.x + "," + value.y + " )"; - } - break; - - case 1: - { - result = value.x.ToString(); - } - break; - case 2: - { - result = value.y.ToString(); - } - break; - } - - if ( result.Equals( string.Empty ) ) - { - UIUtils.ShowMessage( UniqueId, "Vector2Node generating empty code", MessageSeverity.Warning ); - } - return result; - } - - public override string GetPropertyValue() - { - return PropertyAttributes + m_propertyName + "(\"" + m_propertyInspectorName + "\", Vector) = (" + m_defaultValue.x + "," + m_defaultValue.y + ",0,0)"; - } - - public override void UpdateMaterial( Material mat ) - { - base.UpdateMaterial( mat ); - if ( UIUtils.IsProperty( m_currentParameterType ) && !InsideShaderFunction ) - { - mat.SetVector( m_propertyName, m_materialValue ); - } - } - - public override void SetMaterialMode( Material mat , bool fetchMaterialValues ) - { - base.SetMaterialMode( mat , fetchMaterialValues ); - if ( fetchMaterialValues && m_materialMode && UIUtils.IsProperty( m_currentParameterType ) && mat.HasProperty( m_propertyName ) ) - { - m_materialValue = mat.GetVector( m_propertyName ); - } - } - - public override void ForceUpdateFromMaterial( Material material ) - { - if( UIUtils.IsProperty( m_currentParameterType ) && material.HasProperty( m_propertyName ) ) - { - m_materialValue = material.GetVector( m_propertyName ); - PreviewIsDirty = true; - } - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - m_defaultValue = IOUtils.StringToVector2( GetCurrentParam( ref nodeParams ) ); - if( UIUtils.CurrentShaderVersion() > 14101 ) - m_materialValue = IOUtils.StringToVector2( GetCurrentParam( ref nodeParams ) ); - } - - public override void SetGlobalValue() { Shader.SetGlobalVector( m_propertyName, m_defaultValue ); } - public override void FetchGlobalValue() { m_materialValue = Shader.GetGlobalVector( m_propertyName ); } - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, IOUtils.Vector2ToString( m_defaultValue ) ); - IOUtils.AddFieldValueToString( ref nodeInfo, IOUtils.Vector2ToString( m_materialValue ) ); - } - - public override string GetPropertyValStr() - { - return ( m_materialMode && m_currentParameterType != PropertyType.Constant ) ? m_materialValue.x.ToString( Mathf.Abs( m_materialValue.x ) > 1000 ? Constants.PropertyBigVectorFormatLabel : Constants.PropertyVectorFormatLabel ) + IOUtils.VECTOR_SEPARATOR + - m_materialValue.y.ToString( Mathf.Abs( m_materialValue.y ) > 1000 ? Constants.PropertyBigVectorFormatLabel : Constants.PropertyVectorFormatLabel ) : - m_defaultValue.x.ToString( Mathf.Abs( m_defaultValue.x ) > 1000 ? Constants.PropertyBigVectorFormatLabel : Constants.PropertyVectorFormatLabel ) + IOUtils.VECTOR_SEPARATOR + - m_defaultValue.y.ToString( Mathf.Abs( m_defaultValue.y ) > 1000 ? Constants.PropertyBigVectorFormatLabel : Constants.PropertyVectorFormatLabel ); - } - - public Vector2 Value - { - get { return m_defaultValue; } - set { m_defaultValue = value; } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Vector2Node.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Vector2Node.cs.meta deleted file mode 100644 index a241974a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Vector2Node.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 6ca8f5d67cf4c5f428a6dd646099897c -timeCreated: 1481126956 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Vector3Node.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Vector3Node.cs deleted file mode 100644 index 62be0696..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Vector3Node.cs +++ /dev/null @@ -1,315 +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 -{ - [System.Serializable] - [NodeAttributes( "Vector3", "Constants And Properties", "Vector3 property", null, KeyCode.Alpha3 )] - public sealed class Vector3Node : PropertyNode - { - [SerializeField] - private Vector3 m_defaultValue = Vector3.zero; - - [SerializeField] - private Vector3 m_materialValue = Vector3.zero; - - private const float LabelWidth = 8; - - private int m_cachedPropertyId = -1; - - public Vector3Node() : base() { } - public Vector3Node( int uniqueId, float x, float y, float width, float height ) : base( uniqueId, x, y, width, height ) { } - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - GlobalTypeWarningText = string.Format( GlobalTypeWarningText, "Vector" ); - m_insideSize.Set( 50, 30 ); - m_selectedLocation = PreviewLocation.BottomCenter; - AddOutputVectorPorts( WirePortDataType.FLOAT3, "XYZ" ); - m_previewShaderGUID = "8a44d38f06246bf48944b3f314bc7920"; - m_srpBatcherCompatible = true; - m_showHybridInstancedUI = true; - } - - public override void CopyDefaultsToMaterial() - { - m_materialValue = m_defaultValue; - } - - public override void DrawSubProperties() - { - m_defaultValue = EditorGUILayoutVector3Field( Constants.DefaultValueLabel, m_defaultValue ); - } - - public override void DrawMaterialProperties() - { - EditorGUI.BeginChangeCheck(); - - m_materialValue = EditorGUILayoutVector3Field( Constants.MaterialValueLabel, m_materialValue ); - - if( EditorGUI.EndChangeCheck() ) - { - //MarkForPreviewUpdate(); - if( m_materialMode ) - m_requireMaterialUpdate = true; - } - } - - public override void SetPreviewInputs() - { - base.SetPreviewInputs(); - - if( m_cachedPropertyId == -1 ) - m_cachedPropertyId = Shader.PropertyToID( "_InputVector" ); - - if( m_materialMode && m_currentParameterType != PropertyType.Constant ) - PreviewMaterial.SetVector( m_cachedPropertyId, new Vector4( m_materialValue[ 0 ], m_materialValue[ 1 ], m_materialValue[ 2 ], 0 ) ); - else - PreviewMaterial.SetVector( m_cachedPropertyId, new Vector4( m_defaultValue[ 0 ], m_defaultValue[ 1 ], m_defaultValue[ 2 ], 0 ) ); - } - - private bool m_isEditingFields; - private Vector3 m_previousValue = Vector3.zero; - private string[] m_fieldText = new string[] { "0", "0", "0" }; - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - - if( !m_isVisible ) - return; - - if( m_isEditingFields && m_currentParameterType != PropertyType.Global) - { - EditorGUI.BeginChangeCheck(); - for( int i = 0; i < 3; i++ ) - { - m_propertyDrawPos.y = m_outputPorts[ i + 1 ].Position.y - 2 * drawInfo.InvertedZoom; - if( m_materialMode && m_currentParameterType != PropertyType.Constant ) - { - float val = m_materialValue[ i ]; - UIUtils.DrawFloat( this, ref m_propertyDrawPos, ref val, LabelWidth * drawInfo.InvertedZoom ); - m_materialValue[ i ] = val; - } - else - { - float val = m_defaultValue[ i ]; - UIUtils.DrawFloat( this, ref m_propertyDrawPos, ref val, LabelWidth * drawInfo.InvertedZoom ); - m_defaultValue[ i ] = val; - } - } - if( EditorGUI.EndChangeCheck() ) - { - PreviewIsDirty = true; - m_requireMaterialUpdate = m_materialMode; - BeginDelayedDirtyProperty(); - } - } - else if( drawInfo.CurrentEventType == EventType.Repaint && ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD4 ) - { - bool guiEnabled = GUI.enabled; - GUI.enabled = m_currentParameterType != PropertyType.Global; - - for( int i = 0; i < 3; i++ ) - { - m_propertyDrawPos.y = m_outputPorts[ i + 1 ].Position.y - 2 * drawInfo.InvertedZoom; - - Rect fakeField = m_propertyDrawPos; - fakeField.xMin += LabelWidth * drawInfo.InvertedZoom; - if( GUI.enabled ) - { - Rect fakeLabel = m_propertyDrawPos; - fakeLabel.xMax = fakeField.xMin; - EditorGUIUtility.AddCursorRect( fakeLabel, MouseCursor.SlideArrow ); - EditorGUIUtility.AddCursorRect( fakeField, MouseCursor.Text ); - } - - if( m_materialMode && m_currentParameterType != PropertyType.Constant ) - { - if( m_previousValue[ i ] != m_materialValue[ i ] ) - { - m_previousValue[ i ] = m_materialValue[ i ]; - m_fieldText[ i ] = m_materialValue[ i ].ToString(); - } - } - else - { - if( m_previousValue[ i ] != m_defaultValue[ i ] ) - { - m_previousValue[ i ] = m_defaultValue[ i ]; - m_fieldText[ i ] = m_defaultValue[ i ].ToString(); - } - } - - GUI.Label( fakeField, m_fieldText[ i ], UIUtils.MainSkin.textField ); - } - GUI.enabled = guiEnabled; - } - } - - public override void OnNodeLayout( DrawInfo drawInfo ) - { - base.OnNodeLayout( drawInfo ); - - m_propertyDrawPos = m_remainingBox; - m_propertyDrawPos.x = m_remainingBox.x - LabelWidth * drawInfo.InvertedZoom; - m_propertyDrawPos.width = drawInfo.InvertedZoom * Constants.FLOAT_DRAW_WIDTH_FIELD_SIZE; - m_propertyDrawPos.height = drawInfo.InvertedZoom * Constants.FLOAT_DRAW_HEIGHT_FIELD_SIZE; - } - - public override void DrawGUIControls( DrawInfo drawInfo ) - { - base.DrawGUIControls( drawInfo ); - - if( drawInfo.CurrentEventType != EventType.MouseDown ) - return; - - Rect hitBox = m_remainingBox; - hitBox.xMin -= LabelWidth * drawInfo.InvertedZoom; - bool insideBox = hitBox.Contains( drawInfo.MousePosition ); - - if( insideBox ) - { - GUI.FocusControl( null ); - m_isEditingFields = true; - } - else if( m_isEditingFields && !insideBox ) - { - GUI.FocusControl( null ); - m_isEditingFields = false; - } - } - - public override void ConfigureLocalVariable( ref MasterNodeDataCollector dataCollector ) - { - Vector3 value = m_defaultValue; - dataCollector.AddLocalVariable( UniqueId, CreateLocalVarDec( value.x + "," + value.y + "," + value.z ) ); - m_outputPorts[ 0 ].SetLocalValue( m_propertyName , dataCollector.PortCategory ); - m_outputPorts[ 1 ].SetLocalValue( m_propertyName + ".x" , dataCollector.PortCategory ); - m_outputPorts[ 2 ].SetLocalValue( m_propertyName + ".y" , dataCollector.PortCategory ); - m_outputPorts[ 3 ].SetLocalValue( m_propertyName + ".z", dataCollector.PortCategory ); - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); - m_precisionString = UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, m_outputPorts[ 0 ].DataType ); - - if( m_currentParameterType != PropertyType.Constant ) - return GetOutputVectorItem( 0, outputId, PropertyData( dataCollector.PortCategory ) ); - - if( m_outputPorts[ outputId ].IsLocalValue( dataCollector.PortCategory ) ) - { - return m_outputPorts[ outputId ].LocalValue( dataCollector.PortCategory ); - } - - if( CheckLocalVariable( ref dataCollector ) ) - { - return m_outputPorts[ outputId ].LocalValue( dataCollector.PortCategory ); - } - - Vector3 value = m_defaultValue; - string result = string.Empty; - switch( outputId ) - { - case 0: - { - result = m_precisionString + "(" + value.x + "," + value.y + "," + value.z + ")"; - } - break; - - case 1: - { - result = value.x.ToString(); - } - break; - case 2: - { - result = value.y.ToString(); - } - break; - case 3: - { - result = value.z.ToString(); - } - break; - } - - if( result.Equals( string.Empty ) ) - { - UIUtils.ShowMessage( UniqueId, "Vector3Node generating empty code", MessageSeverity.Warning ); - } - return result; - } - - public override string GetPropertyValue() - { - return PropertyAttributes + m_propertyName + "(\"" + m_propertyInspectorName + "\", Vector) = (" + m_defaultValue.x + "," + m_defaultValue.y + "," + m_defaultValue.z + ",0)"; - } - - public override void UpdateMaterial( Material mat ) - { - base.UpdateMaterial( mat ); - if( UIUtils.IsProperty( m_currentParameterType ) && !InsideShaderFunction ) - { - mat.SetVector( m_propertyName, m_materialValue ); - } - } - - public override void SetMaterialMode( Material mat, bool fetchMaterialValues ) - { - base.SetMaterialMode( mat, fetchMaterialValues ); - if( fetchMaterialValues && m_materialMode && UIUtils.IsProperty( m_currentParameterType ) && mat.HasProperty( m_propertyName ) ) - { - m_materialValue = mat.GetVector( m_propertyName ); - } - } - - public override void ForceUpdateFromMaterial( Material material ) - { - if( UIUtils.IsProperty( m_currentParameterType ) && material.HasProperty( m_propertyName ) ) - { - m_materialValue = material.GetVector( m_propertyName ); - PreviewIsDirty = true; - } - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - m_defaultValue = IOUtils.StringToVector3( GetCurrentParam( ref nodeParams ) ); - if( UIUtils.CurrentShaderVersion() > 14101 ) - m_materialValue = IOUtils.StringToVector3( GetCurrentParam( ref nodeParams ) ); - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, IOUtils.Vector3ToString( m_defaultValue ) ); - IOUtils.AddFieldValueToString( ref nodeInfo, IOUtils.Vector3ToString( m_materialValue ) ); - } - - public override void SetGlobalValue() { Shader.SetGlobalVector( m_propertyName, m_defaultValue ); } - public override void FetchGlobalValue() { m_materialValue = Shader.GetGlobalVector( m_propertyName ); } - - public override string GetPropertyValStr() - { - return ( m_materialMode && m_currentParameterType != PropertyType.Constant ) ? m_materialValue.x.ToString( Mathf.Abs( m_materialValue.x ) > 1000 ? Constants.PropertyBigVectorFormatLabel : Constants.PropertyVectorFormatLabel ) + IOUtils.VECTOR_SEPARATOR + - m_materialValue.y.ToString( Mathf.Abs( m_materialValue.y ) > 1000 ? Constants.PropertyBigVectorFormatLabel : Constants.PropertyVectorFormatLabel ) + IOUtils.VECTOR_SEPARATOR + - m_materialValue.z.ToString( Mathf.Abs( m_materialValue.z ) > 1000 ? Constants.PropertyBigVectorFormatLabel : Constants.PropertyVectorFormatLabel ) : - m_defaultValue.x.ToString( Mathf.Abs( m_defaultValue.x ) > 1000 ? Constants.PropertyBigVectorFormatLabel : Constants.PropertyVectorFormatLabel ) + IOUtils.VECTOR_SEPARATOR + - m_defaultValue.y.ToString( Mathf.Abs( m_defaultValue.y ) > 1000 ? Constants.PropertyBigVectorFormatLabel : Constants.PropertyVectorFormatLabel ) + IOUtils.VECTOR_SEPARATOR + - m_defaultValue.z.ToString( Mathf.Abs( m_defaultValue.z ) > 1000 ? Constants.PropertyBigVectorFormatLabel : Constants.PropertyVectorFormatLabel ); - } - - public Vector3 Value - { - get { return m_defaultValue; } - set { m_defaultValue = value; } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Vector3Node.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Vector3Node.cs.meta deleted file mode 100644 index 467beba5..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Vector3Node.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 943f4b4fc1fa5214b8934bf4fb76474b -timeCreated: 1481126957 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Vector4Node.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Vector4Node.cs deleted file mode 100644 index e729b0d0..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Vector4Node.cs +++ /dev/null @@ -1,320 +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( "Vector4", "Constants And Properties", "Vector4 property", null, KeyCode.Alpha4 )] - public sealed class Vector4Node : PropertyNode - { - [SerializeField] - private Vector4 m_defaultValue = Vector4.zero; - - [SerializeField] - private Vector4 m_materialValue = Vector4.zero; - - private const float LabelWidth = 8; - - private int m_cachedPropertyId = -1; - - private bool m_isEditingFields; - private Vector4 m_previousValue = Vector4.zero; - private string[] m_fieldText = new string[] { "0", "0", "0", "0" }; - - public Vector4Node() : base() { } - public Vector4Node( int uniqueId, float x, float y, float width, float height ) : base( uniqueId, x, y, width, height ) { } - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - GlobalTypeWarningText = string.Format( GlobalTypeWarningText, "Vector" ); - m_insideSize.Set( 50, 40 ); - m_selectedLocation = PreviewLocation.BottomCenter; - AddOutputVectorPorts( WirePortDataType.FLOAT4, "XYZW" ); - m_previewShaderGUID = "aac241d0e47a5a84fbd2edcd640788dc"; - m_srpBatcherCompatible = true; - m_showHybridInstancedUI = true; - } - - public override void CopyDefaultsToMaterial() - { - m_materialValue = m_defaultValue; - } - - public override void DrawSubProperties() - { - m_defaultValue = EditorGUILayoutVector4Field( Constants.DefaultValueLabel, m_defaultValue ); - } - - public override void DrawMaterialProperties() - { - if ( m_materialMode ) - EditorGUI.BeginChangeCheck(); - - m_materialValue = EditorGUILayoutVector4Field( Constants.MaterialValueLabel, m_materialValue ); - if ( m_materialMode && EditorGUI.EndChangeCheck() ) - m_requireMaterialUpdate = true; - - } - - public override void SetPreviewInputs() - { - base.SetPreviewInputs(); - - if ( m_cachedPropertyId == -1 ) - m_cachedPropertyId = Shader.PropertyToID( "_InputVector" ); - - if ( m_materialMode && m_currentParameterType != PropertyType.Constant ) - PreviewMaterial.SetVector( m_cachedPropertyId, new Vector4( m_materialValue[ 0 ], m_materialValue[ 1 ], m_materialValue[ 2 ], m_materialValue[ 3 ] ) ); - else - PreviewMaterial.SetVector( m_cachedPropertyId, new Vector4( m_defaultValue[ 0 ], m_defaultValue[ 1 ], m_defaultValue[ 2 ], m_defaultValue[ 3 ] ) ); - } - - public override void OnNodeLayout( DrawInfo drawInfo ) - { - base.OnNodeLayout( drawInfo ); - - m_propertyDrawPos = m_remainingBox; - m_propertyDrawPos.x = m_remainingBox.x - LabelWidth * drawInfo.InvertedZoom; - m_propertyDrawPos.width = drawInfo.InvertedZoom * Constants.FLOAT_DRAW_WIDTH_FIELD_SIZE; - m_propertyDrawPos.height = drawInfo.InvertedZoom * Constants.FLOAT_DRAW_HEIGHT_FIELD_SIZE; - } - - public override void DrawGUIControls( DrawInfo drawInfo ) - { - base.DrawGUIControls( drawInfo ); - - if ( drawInfo.CurrentEventType != EventType.MouseDown ) - return; - - Rect hitBox = m_remainingBox; - hitBox.xMin -= LabelWidth * drawInfo.InvertedZoom; - bool insideBox = hitBox.Contains( drawInfo.MousePosition ); - - if ( insideBox ) - { - GUI.FocusControl( null ); - m_isEditingFields = true; - } - else if ( m_isEditingFields && !insideBox ) - { - GUI.FocusControl( null ); - m_isEditingFields = false; - } - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - - if ( !m_isVisible ) - return; - - if ( m_isEditingFields && m_currentParameterType != PropertyType.Global ) - { - EditorGUI.BeginChangeCheck(); - for ( int i = 0; i < 4; i++ ) - { - m_propertyDrawPos.y = m_outputPorts[ i + 1 ].Position.y - 2 * drawInfo.InvertedZoom; - if ( m_materialMode && m_currentParameterType != PropertyType.Constant ) - { - float val = m_materialValue[ i ]; - UIUtils.DrawFloat( this, ref m_propertyDrawPos, ref val, LabelWidth * drawInfo.InvertedZoom ); - m_materialValue[ i ] = val; - } - else - { - float val = m_defaultValue[ i ]; - UIUtils.DrawFloat( this, ref m_propertyDrawPos, ref val, LabelWidth * drawInfo.InvertedZoom ); - m_defaultValue[ i ] = val; - } - } - if ( EditorGUI.EndChangeCheck() ) - { - PreviewIsDirty = true; - m_requireMaterialUpdate = m_materialMode; - BeginDelayedDirtyProperty(); - //m_propertyNameIsDirty = true; - } - } - else if ( drawInfo.CurrentEventType == EventType.Repaint && ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD4 ) - { - bool guiEnabled = GUI.enabled; - GUI.enabled = m_currentParameterType != PropertyType.Global; - - for( int i = 0; i < 4; i++ ) - { - m_propertyDrawPos.y = m_outputPorts[ i + 1 ].Position.y - 2 * drawInfo.InvertedZoom; - - Rect fakeField = m_propertyDrawPos; - fakeField.xMin += LabelWidth * drawInfo.InvertedZoom; - if( GUI.enabled ) - { - Rect fakeLabel = m_propertyDrawPos; - fakeLabel.xMax = fakeField.xMin; - EditorGUIUtility.AddCursorRect( fakeLabel, MouseCursor.SlideArrow ); - EditorGUIUtility.AddCursorRect( fakeField, MouseCursor.Text ); - } - if ( m_materialMode && m_currentParameterType != PropertyType.Constant ) - { - if ( m_previousValue[ i ] != m_materialValue[ i ] ) - { - m_previousValue[ i ] = m_materialValue[ i ]; - m_fieldText[ i ] = m_materialValue[ i ].ToString(); - } - } - else - { - if ( m_previousValue[ i ] != m_defaultValue[ i ] ) - { - m_previousValue[ i ] = m_defaultValue[ i ]; - m_fieldText[ i ] = m_defaultValue[ i ].ToString(); - } - } - - GUI.Label( fakeField, m_fieldText[ i ], UIUtils.MainSkin.textField ); - } - GUI.enabled = guiEnabled; - } - } - - public override void ConfigureLocalVariable( ref MasterNodeDataCollector dataCollector ) - { - Vector4 value = m_defaultValue; - dataCollector.AddLocalVariable( UniqueId, CreateLocalVarDec( value.x + "," + value.y + "," + value.z + "," + value.w ) ); - m_outputPorts[ 0 ].SetLocalValue( m_propertyName, dataCollector.PortCategory ); - m_outputPorts[ 1 ].SetLocalValue( m_propertyName + ".x" , dataCollector.PortCategory ); - m_outputPorts[ 2 ].SetLocalValue( m_propertyName + ".y" , dataCollector.PortCategory ); - m_outputPorts[ 3 ].SetLocalValue( m_propertyName + ".z" , dataCollector.PortCategory ); - m_outputPorts[ 4 ].SetLocalValue( m_propertyName + ".w", dataCollector.PortCategory ); - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); - m_precisionString = UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, m_outputPorts[ 0 ].DataType ); - - if ( m_currentParameterType != PropertyType.Constant ) - return GetOutputVectorItem( 0, outputId, PropertyData( dataCollector.PortCategory ) ); - - if ( m_outputPorts[ outputId ].IsLocalValue( dataCollector.PortCategory ) ) - { - return m_outputPorts[ outputId ].LocalValue( dataCollector.PortCategory ); - } - - if ( CheckLocalVariable( ref dataCollector ) ) - { - return m_outputPorts[ outputId ].LocalValue( dataCollector.PortCategory ); - } - - Vector4 value = m_defaultValue; - string result = string.Empty; - switch ( outputId ) - { - case 0: - { - result = m_precisionString+"(" + value.x + "," + value.y + "," + value.z + "," + value.w + ")"; - } - break; - - case 1: - { - result = value.x.ToString(); - } - break; - case 2: - { - result = value.y.ToString(); - } - break; - case 3: - { - result = value.z.ToString(); - } - break; - case 4: - { - result = value.w.ToString(); - } - break; - } - - if ( result.Equals( string.Empty ) ) - { - UIUtils.ShowMessage( UniqueId, "Vector4Node generating empty code", MessageSeverity.Warning ); - } - return result; - } - - public override string GetPropertyValue() - { - return PropertyAttributes + m_propertyName + "(\"" + m_propertyInspectorName + "\", Vector) = (" + m_defaultValue.x + "," + m_defaultValue.y + "," + m_defaultValue.z + "," + m_defaultValue.w + ")"; - } - - public override void UpdateMaterial( Material mat ) - { - base.UpdateMaterial( mat ); - if ( UIUtils.IsProperty( m_currentParameterType ) && !InsideShaderFunction ) - { - mat.SetVector( m_propertyName, m_materialValue ); - } - } - - public override void SetMaterialMode( Material mat , bool fetchMaterialValues ) - { - base.SetMaterialMode( mat , fetchMaterialValues ); - if ( fetchMaterialValues && m_materialMode && UIUtils.IsProperty( m_currentParameterType ) && mat.HasProperty( m_propertyName ) ) - { - m_materialValue = mat.GetVector( m_propertyName ); - } - } - - public override void ForceUpdateFromMaterial( Material material ) - { - if( UIUtils.IsProperty( m_currentParameterType ) && material.HasProperty( m_propertyName ) ) - { - m_materialValue = material.GetVector( m_propertyName ); - PreviewIsDirty = true; - } - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - m_defaultValue = IOUtils.StringToVector4( GetCurrentParam( ref nodeParams ) ); - if( UIUtils.CurrentShaderVersion() > 14101 ) - m_materialValue = IOUtils.StringToVector4( GetCurrentParam( ref nodeParams ) ); - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, IOUtils.Vector4ToString( m_defaultValue ) ); - IOUtils.AddFieldValueToString( ref nodeInfo, IOUtils.Vector4ToString( m_materialValue ) ); - } - - public override void SetGlobalValue() { Shader.SetGlobalVector( m_propertyName, m_defaultValue ); } - public override void FetchGlobalValue() { m_materialValue = Shader.GetGlobalVector( m_propertyName ); } - - public override string GetPropertyValStr() - { - return ( m_materialMode && m_currentParameterType != PropertyType.Constant ) ? m_materialValue.x.ToString( Mathf.Abs( m_materialValue.x ) > 1000 ? Constants.PropertyBigVectorFormatLabel : Constants.PropertyVectorFormatLabel ) + IOUtils.VECTOR_SEPARATOR + - m_materialValue.y.ToString( Mathf.Abs( m_materialValue.y ) > 1000 ? Constants.PropertyBigVectorFormatLabel : Constants.PropertyVectorFormatLabel ) + IOUtils.VECTOR_SEPARATOR + - m_materialValue.z.ToString( Mathf.Abs( m_materialValue.z ) > 1000 ? Constants.PropertyBigVectorFormatLabel : Constants.PropertyVectorFormatLabel ) + IOUtils.VECTOR_SEPARATOR + - m_materialValue.w.ToString( Mathf.Abs( m_materialValue.w ) > 1000 ? Constants.PropertyBigVectorFormatLabel : Constants.PropertyVectorFormatLabel ) : - m_defaultValue.x.ToString( Mathf.Abs( m_defaultValue.x ) > 1000 ? Constants.PropertyBigVectorFormatLabel : Constants.PropertyVectorFormatLabel ) + IOUtils.VECTOR_SEPARATOR + - m_defaultValue.y.ToString( Mathf.Abs( m_defaultValue.y ) > 1000 ? Constants.PropertyBigVectorFormatLabel : Constants.PropertyVectorFormatLabel ) + IOUtils.VECTOR_SEPARATOR + - m_defaultValue.z.ToString( Mathf.Abs( m_defaultValue.z ) > 1000 ? Constants.PropertyBigVectorFormatLabel : Constants.PropertyVectorFormatLabel ) + IOUtils.VECTOR_SEPARATOR + - m_defaultValue.w.ToString( Mathf.Abs( m_defaultValue.w ) > 1000 ? Constants.PropertyBigVectorFormatLabel : Constants.PropertyVectorFormatLabel ); - } - - public Vector4 Value - { - get { return m_defaultValue; } - set { m_defaultValue = value; } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Vector4Node.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Vector4Node.cs.meta deleted file mode 100644 index 1cccc215..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Constants/Vector4Node.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 3bc3c79c7cc57df49bedb9d9b64b0bea -timeCreated: 1481126955 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/CustomAddNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/CustomAddNode.cs deleted file mode 100644 index c0570974..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/CustomAddNode.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Custom Add Node", "Debug", "Custom Node Debug ( Only for debug purposes)", null, UnityEngine.KeyCode.None, false )] - public sealed class CustomAddNode : CustomNode - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddOutputsFromString( "customOut0", "#IP2*(#IP0 + #IP1 / #IP2)" ); - AddOutputsFromString( "customOut1", "#IP3 + #IP0*#IP2 + #IP1 / #IP2" ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/CustomAddNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/CustomAddNode.cs.meta deleted file mode 100644 index 771b8a61..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/CustomAddNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 6fdecc48f5be618428240490565e9d8b -timeCreated: 1481126956 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/CustomNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/CustomNode.cs deleted file mode 100644 index bffd2b4f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/CustomNode.cs +++ /dev/null @@ -1,183 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace AmplifyShaderEditor -{ - [Serializable] - public class CustomNodeOutputData - { - public string expression; - public string name; - public List<CustomNodeInputData> inputData; - - public CustomNodeOutputData( string newName, string newExpression ) - { - name = newName; - expression = newExpression; - inputData = new List<CustomNodeInputData>(); - } - public void Destroy() - { - inputData.Clear(); - inputData = null; - } - - public override string ToString() - { - string result = "name: " + name + " outputExpression: " + expression + '\n'; - for ( int i = 0; i < inputData.Count; i++ ) - { - result += inputData[ i ].ToString() + '\n'; - } - return result; - } - } - - [Serializable] - public class CustomNodeInputData - { - public int index; - public int length; - public string name; - public CustomNodeInputData( int newIndex, int newLength, string newName ) - { - index = newIndex; - length = newLength; - name = newName; - - } - - public override string ToString() - { - return "index: " + index + " length: " + length + " name: " + name; - } - } - - [Serializable] - public class CustomNode : ParentNode - { - [SerializeField] - private List<string> m_includes; - - [SerializeField] - private List<CustomNodeOutputData> m_outputData; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_outputData = new List<CustomNodeOutputData>(); - } - - public void AddIncludes( string newInclude ) - { - m_includes.Add( newInclude ); - } - - protected void AddOutputsFromString( string outputName, string output ) - { - AddOutputPort( WirePortDataType.OBJECT, outputName ); - - CustomNodeOutputData currOutputData = new CustomNodeOutputData( outputName, output ); - - - // Get existing input nodes so we can test for duplicates - Dictionary<string, InputPort> existingPorts = InputPortsDict; - - // Create dictionary to prevent duplicates when dealing with expresssions with multiple occurences of an input - Dictionary<string, string> inputDuplicatePrevention = new Dictionary<string, string>(); - - - // Get all inputs on the expression and save their info - int[] indexes = output.AllIndexesOf( Constants.CNIP ); - for ( int i = 0; i < indexes.Length; i++ ) - { - string name = output.Substring( indexes[ i ], Constants.CNIP.Length + 1 ); - currOutputData.inputData.Add( new CustomNodeInputData( indexes[ i ], Constants.CNIP.Length + 1, name ) ); - - if ( !inputDuplicatePrevention.ContainsKey( name ) && !existingPorts.ContainsKey( name ) ) - { - inputDuplicatePrevention.Add( name, name ); - AddInputPort( WirePortDataType.OBJECT, false, name ); - } - } - - inputDuplicatePrevention.Clear(); - inputDuplicatePrevention = null; - - existingPorts.Clear(); - existingPorts = null; - - m_outputData.Add( currOutputData ); - - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); - if ( outputId < m_outputData.Count ) - { - Dictionary<string, InputPort> inputs = InputPortsDict; - - string value = m_outputData[ outputId ].expression; - for ( int i = 0; i < m_outputData[ outputId ].inputData.Count; i++ ) - { - if ( inputs.ContainsKey( m_outputData[ outputId ].inputData[ i ].name ) ) - { - InputPort inputPort = inputs[ m_outputData[ outputId ].inputData[ i ].name ]; - if ( inputPort != null ) - { - string inputValue = inputPort.GenerateShaderForOutput( ref dataCollector, WirePortDataType.OBJECT, ignoreLocalvar ); - value = value.Replace( m_outputData[ outputId ].inputData[ i ].name, inputValue ); - } - else - { - UIUtils.ShowMessage( UniqueId, m_outputData[ outputId ].inputData[ i ].name + " invalid on the inputs list", MessageSeverity.Error ); - return string.Empty; - } - } - else - { - UIUtils.ShowMessage( UniqueId, m_outputData[ outputId ].inputData[ i ].name + " Not found on the inputs list", MessageSeverity.Error ); - return string.Empty; - } - } - return value; - - } - - return string.Empty; - } - public void DumpOutputData() - { - for ( int i = 0; i < m_outputData.Count; i++ ) - { - Debug.Log( m_outputData[ i ] ); - } - } - - public override void Destroy() - { - base.Destroy(); - - if ( m_outputData != null ) - { - for ( int i = 0; i < m_outputData.Count; i++ ) - { - m_outputData[ i ].Destroy(); - } - m_outputData.Clear(); - m_outputData = null; - } - if ( m_includes != null ) - { - m_includes.Clear(); - m_includes = null; - } - } - - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/CustomNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/CustomNode.cs.meta deleted file mode 100644 index d5cd5ec0..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/CustomNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: c89fd369755de3e49a669e8e5daa8c2f -timeCreated: 1481126959 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/DrawInfo.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/DrawInfo.cs deleted file mode 100644 index 6a423446..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/DrawInfo.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEngine; -namespace AmplifyShaderEditor -{ - public class DrawInfo - { - public Rect TransformedCameraArea; - public Rect CameraArea; - public Vector2 MousePosition; - public Vector2 CameraOffset; - public float InvertedZoom; - public bool LeftMouseButtonPressed; - public EventType CurrentEventType; - public Vector2 TransformedMousePos; - public bool ZoomChanged; - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/DrawInfo.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/DrawInfo.cs.meta deleted file mode 100644 index 8783ef2f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/DrawInfo.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 36f40ed0b172d8f45810b3f6b8e2243d -timeCreated: 1481126954 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/DynamicTypeNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/DynamicTypeNode.cs deleted file mode 100644 index e4bb7e9f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/DynamicTypeNode.cs +++ /dev/null @@ -1,520 +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.Collections.Generic; - -namespace AmplifyShaderEditor -{ - [Serializable] - public class DynamicTypeNode : ParentNode - { - protected string m_inputA = string.Empty; - protected string m_inputB = string.Empty; - protected List<string> m_extensibleInputResults; - protected bool m_dynamicOutputType = true; - - protected bool m_extensibleInputPorts = false; - protected bool m_allowMatrixCheck = false; - protected bool m_vectorMatrixOps = false; - //[SerializeField] - private int m_inputCount = 2; - - //[SerializeField] - private int m_lastInputCount = 2; - - private bool m_previouslyDragging = false; - private int m_beforePreviewCount = 0; - - [UnityEngine.SerializeField] - protected WirePortDataType m_mainDataType = WirePortDataType.FLOAT; - - protected WirePortDataType[] m_dynamicRestrictions = - { - WirePortDataType.OBJECT, - WirePortDataType.FLOAT, - WirePortDataType.FLOAT2, - WirePortDataType.FLOAT3, - WirePortDataType.FLOAT4, - WirePortDataType.COLOR, - WirePortDataType.INT - }; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_useInternalPortData = true; - m_textLabelWidth = 35; - AddPorts(); - } - - protected virtual void AddPorts() - { - AddInputPort( WirePortDataType.FLOAT, false, "A" ); - AddInputPort( WirePortDataType.FLOAT, false, "B" ); - AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); - m_inputPorts[ 0 ].CreatePortRestrictions( m_dynamicRestrictions ); - m_inputPorts[ 1 ].CreatePortRestrictions( m_dynamicRestrictions ); - } - - public override void OnConnectedOutputNodeChanges( int inputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType 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 ); - UpdateDisconnectedConnection( portId ); - UpdateConnection( portId ); - UpdateEmptyInputPorts( true ); - } - - void UpdateDisconnectedConnection( int portId ) - { - if( m_extensibleInputPorts || m_allowMatrixCheck ) - { - int higher = 0; - int groupOneType = 0; - int groupTwoType = 0; - for( int i = 0; i < m_inputPorts.Count; i++ ) - { - if( m_inputPorts[ i ].IsConnected ) - { - int currentPriority = UIUtils.GetPriority( m_inputPorts[ i ].DataType ); - if( !m_vectorMatrixOps && currentPriority < 3 ) - currentPriority += 7; - if( currentPriority > higher && currentPriority > 2 ) - { - higher = currentPriority; - m_mainDataType = m_inputPorts[ i ].DataType; - } - switch( m_inputPorts[ i ].DataType ) - { - case WirePortDataType.FLOAT2: - case WirePortDataType.FLOAT3: - case WirePortDataType.FLOAT4: - case WirePortDataType.COLOR: - { - groupOneType++; - groupTwoType++; - } - break; - case WirePortDataType.FLOAT3x3: - { - groupOneType++; - } - break; - case WirePortDataType.FLOAT4x4: - { - groupTwoType++; - } - break; - } - } - } - - for( int i = 0; i < m_inputPorts.Count; i++ ) - { - if( !m_inputPorts[ i ].IsConnected ) - { - m_inputPorts[ i ].ChangeType( m_mainDataType, false ); - } - } - - if( groupOneType > 0 && m_mainDataType == WirePortDataType.FLOAT4x4 ) - { - m_errorMessageTooltip = "Doing this operation with FLOAT4x4 value only works against other FLOAT4x4 or FLOAT values"; - m_showErrorMessage = true; - } - else if( groupTwoType > 0 && m_mainDataType == WirePortDataType.FLOAT3x3 ) - { - m_errorMessageTooltip = "Doing this operation with FLOAT3x3 value only works against other FLOAT3x3 or FLOAT values"; - m_showErrorMessage = true; - } - else - { - m_showErrorMessage = false; - } - - if( m_dynamicOutputType ) - m_outputPorts[ 0 ].ChangeType( m_mainDataType, false ); - } - else - - if( m_inputPorts[ 0 ].DataType != m_inputPorts[ 1 ].DataType ) - { - int otherPortId = ( portId + 1 ) % 2; - if( m_inputPorts[ otherPortId ].IsConnected ) - { - m_mainDataType = m_inputPorts[ otherPortId ].DataType; - m_inputPorts[ portId ].ChangeType( m_mainDataType, false ); - if( m_dynamicOutputType ) - m_outputPorts[ 0 ].ChangeType( m_mainDataType, false ); - } - else - { - if( UIUtils.GetPriority( m_inputPorts[ 0 ].DataType ) > UIUtils.GetPriority( m_inputPorts[ 1 ].DataType ) ) - { - m_mainDataType = m_inputPorts[ 0 ].DataType; - m_inputPorts[ 1 ].ChangeType( m_mainDataType, false ); - } - else - { - m_mainDataType = m_inputPorts[ 1 ].DataType; - m_inputPorts[ 0 ].ChangeType( m_mainDataType, false ); - } - - if( m_dynamicOutputType ) - { - if( m_mainDataType != m_outputPorts[ 0 ].DataType ) - { - m_outputPorts[ 0 ].ChangeType( m_mainDataType, false ); - } - } - } - } - } - - void UpdateConnection( int portId ) - { - if( m_extensibleInputPorts || m_allowMatrixCheck ) - { - m_inputPorts[ portId ].MatchPortToConnection(); - - int higher = 0; - int groupOneType = 0; - int groupTwoType = 0; - for( int i = 0; i < m_inputPorts.Count; i++ ) - { - if( m_inputPorts[ i ].IsConnected ) - { - int currentPriority = UIUtils.GetPriority( m_inputPorts[ i ].DataType ); - if( !m_vectorMatrixOps && currentPriority < 3 ) - currentPriority += 7; - if( currentPriority > higher ) - { - higher = currentPriority; - m_mainDataType = m_inputPorts[ i ].DataType; - } - switch( m_inputPorts[ i ].DataType ) - { - case WirePortDataType.FLOAT2: - case WirePortDataType.FLOAT3: - case WirePortDataType.FLOAT4: - case WirePortDataType.COLOR: - { - groupOneType++; - groupTwoType++; - } - break; - case WirePortDataType.FLOAT3x3: - { - groupOneType++; - } - break; - case WirePortDataType.FLOAT4x4: - { - groupTwoType++; - } - break; - } - } - } - - for( int i = 0; i < m_inputPorts.Count; i++ ) - { - if( !m_inputPorts[ i ].IsConnected ) - { - m_inputPorts[ i ].ChangeType( m_mainDataType, false ); - } - } - if( groupOneType > 0 && m_mainDataType == WirePortDataType.FLOAT4x4 ) - { - m_errorMessageTooltip = "Doing this operation with FLOAT4x4 value only works against other FLOAT4x4 or FLOAT values"; - m_showErrorMessage = true; - } - else if( groupTwoType > 0 && m_mainDataType == WirePortDataType.FLOAT3x3 ) - { - m_errorMessageTooltip = "Doing this operation with FLOAT3x3 value only works against other FLOAT3x3 or FLOAT values"; - m_showErrorMessage = true; - } - else - { - m_showErrorMessage = false; - } - - if( m_dynamicOutputType ) - m_outputPorts[ 0 ].ChangeType( m_mainDataType, false ); - } - - else - { - m_inputPorts[ portId ].MatchPortToConnection(); - int otherPortId = ( portId + 1 ) % 2; - if( !m_inputPorts[ otherPortId ].IsConnected ) - { - m_inputPorts[ otherPortId ].ChangeType( m_inputPorts[ portId ].DataType, false ); - } - - if( m_inputPorts[ 0 ].DataType == m_inputPorts[ 1 ].DataType ) - { - m_mainDataType = m_inputPorts[ 0 ].DataType; - if( m_dynamicOutputType ) - m_outputPorts[ 0 ].ChangeType( InputPorts[ 0 ].DataType, false ); - } - else - { - if( UIUtils.GetPriority( m_inputPorts[ 0 ].DataType ) > UIUtils.GetPriority( m_inputPorts[ 1 ].DataType ) ) - { - m_mainDataType = m_inputPorts[ 0 ].DataType; - } - else - { - m_mainDataType = m_inputPorts[ 1 ].DataType; - } - - if( m_dynamicOutputType ) - { - if( m_mainDataType != m_outputPorts[ 0 ].DataType ) - { - m_outputPorts[ 0 ].ChangeType( m_mainDataType, false ); - } - } - } - } - } - - public override void OnNodeLogicUpdate( DrawInfo drawInfo ) - { - base.OnNodeLogicUpdate( drawInfo ); - - if( !m_extensibleInputPorts ) - return; - - if( m_previouslyDragging != m_containerGraph.ParentWindow.WireReferenceUtils.OutputPortReference.IsValid && m_containerGraph.ParentWindow.WireReferenceUtils.OutputPortReference.NodeId != UniqueId ) - { - if( m_containerGraph.ParentWindow.WireReferenceUtils.OutputPortReference.IsValid ) - { - m_beforePreviewCount = 2; - for( int i = 2; i < m_inputPorts.Count; i++ ) - { - if( m_inputPorts[ i ].IsConnected ) - { - m_beforePreviewCount++; - } - } - - m_inputCount = m_beforePreviewCount + 1; - if( m_inputCount <= 10 ) - { - if( m_inputCount > m_lastInputCount ) - { - Undo.RegisterCompleteObjectUndo( m_containerGraph.ParentWindow, Constants.UndoCreateDynamicPortId ); - RecordObject( Constants.UndoCreateDynamicPortId ); - - AddInputPort( m_mainDataType, false, ( ( char ) ( 'A' + m_inputCount - 1 ) ).ToString() ); - m_inputPorts[ m_inputCount - 1 ].CreatePortRestrictions( m_dynamicRestrictions ); - } - - m_lastInputCount = m_inputCount; - m_sizeIsDirty = true; - m_isDirty = true; - SetSaveIsDirty(); - } - } - else - { - bool hasEmpty = CheckValidConnections(); - if( hasEmpty ) - UpdateEmptyInputPorts( false ); - } - - m_previouslyDragging = m_containerGraph.ParentWindow.WireReferenceUtils.OutputPortReference.IsValid; - } - - UpdateEmptyInputPorts( false ); - } - - private bool CheckValidConnections() - { - if( !m_extensibleInputPorts ) - return false; - - bool hasEmptyConnections = false; - - bool hasMatrix = m_inputPorts[ 0 ].DataType == WirePortDataType.FLOAT3x3 || m_inputPorts[ 0 ].DataType == WirePortDataType.FLOAT4x4 || m_inputPorts[ 1 ].DataType == WirePortDataType.FLOAT3x3 || m_inputPorts[ 1 ].DataType == WirePortDataType.FLOAT4x4; - - if( m_inputPorts.Count != m_beforePreviewCount ) - { - if( hasMatrix ) - { - bool showError = false; - for( int i = m_inputPorts.Count - 1; i >= 2; i-- ) - { - if( m_inputPorts[ i ].IsConnected ) - { - showError = true; - m_inputPorts[ i ].FullDeleteConnections(); - } - - hasEmptyConnections = true; - } - if( showError ) - m_containerGraph.ParentWindow.ShowMessage( UniqueId, "Matrix operations are only valid for the first two inputs to prevent errors" ); - } - else - { - for( int i = m_inputPorts.Count - 1; i >= 2; i-- ) - { - if( m_inputPorts[ i ].DataType == WirePortDataType.FLOAT3x3 || m_inputPorts[ i ].DataType == WirePortDataType.FLOAT4x4 ) - { - m_containerGraph.ParentWindow.ShowMessage( UniqueId, "Matrix operations are only valid for the first two inputs to prevent errors" ); - m_inputPorts[ i ].FullDeleteConnections(); - hasEmptyConnections = true; - } - else if( !m_inputPorts[ i ].IsConnected ) - { - hasEmptyConnections = true; - } - } - } - } - - return hasEmptyConnections; - } - - private void UpdateEmptyInputPorts( bool recordUndo ) - { - if( !m_extensibleInputPorts ) - return; - NodeWireReferencesUtils wireReferenceUtils = m_containerGraph.ParentWindow.WireReferenceUtils; - if( !wireReferenceUtils.OutputPortReference.IsValid ) - { - if( recordUndo ) - { - Undo.RegisterCompleteObjectUndo( m_containerGraph.ParentWindow, Constants.UndoDeleteDynamicPortId ); - RecordObject( Constants.UndoDeleteDynamicPortId ); - } - - bool hasDeleted = false; - m_inputCount = 2; - for( int i = m_inputPorts.Count - 1; i >= 2; i-- ) - { - if( !m_inputPorts[ i ].IsConnected ) - { - hasDeleted = true; - if( wireReferenceUtils.InputPortReference.IsValid && - wireReferenceUtils.InputPortReference.NodeId == UniqueId && - wireReferenceUtils.InputPortReference.PortId == m_inputPorts[ i ].PortId ) - { - wireReferenceUtils.InputPortReference.Invalidate(); - } - DeleteInputPortByArrayIdx( i ); - } - else - { - m_inputCount++; - } - } - - if( hasDeleted || m_inputCount != m_lastInputCount ) - { - for( int i = 2; i < m_inputPorts.Count; i++ ) - { - m_inputPorts[ i ].Name = ( ( char ) ( 'A' + i ) ).ToString(); - } - - m_beforePreviewCount = m_inputPorts.Count; - m_inputCount = m_beforePreviewCount; - m_lastInputCount = m_inputCount; - m_sizeIsDirty = true; - m_isDirty = true; - SetSaveIsDirty(); - } - } - - m_inputCount = Mathf.Clamp( m_inputCount, 2, 10 ); - } - - public virtual string BuildResults( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if( !m_extensibleInputPorts ) - SetInputData( outputId, ref dataCollector, ignoreLocalvar ); - else - SetExtensibleInputData( outputId, ref dataCollector, ignoreLocalvar ); - return string.Empty; - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - string result = BuildResults( outputId, ref dataCollector, ignoreLocalvar ); - return CreateOutputLocalVariable( 0, result, ref dataCollector ); - } - - protected void SetInputData( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - m_inputA = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - if( m_inputPorts[ 0 ].DataType != m_mainDataType ) - { - m_inputA = UIUtils.CastPortType( ref dataCollector, CurrentPrecisionType, new NodeCastInfo( UniqueId, outputId ), m_inputA, m_inputPorts[ 0 ].DataType, m_mainDataType, m_inputA ); - } - m_inputB = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); - if( m_inputPorts[ 1 ].DataType != m_mainDataType ) - { - m_inputB = UIUtils.CastPortType( ref dataCollector, CurrentPrecisionType, new NodeCastInfo( UniqueId, outputId ), m_inputB, m_inputPorts[ 1 ].DataType, m_mainDataType, m_inputB ); - } - } - - protected void SetExtensibleInputData( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - m_extensibleInputResults = new List<string>(); - for( int i = 0; i < m_inputPorts.Count; i++ ) - { - m_extensibleInputResults.Add( m_inputPorts[ i ].GeneratePortInstructions( ref dataCollector ) ); - if( m_inputPorts[ i ].DataType != m_mainDataType && m_inputPorts[ i ].DataType != WirePortDataType.FLOAT && m_inputPorts[ i ].DataType != WirePortDataType.INT ) - { - m_extensibleInputResults[ i ] = UIUtils.CastPortType( ref dataCollector, CurrentPrecisionType, new NodeCastInfo( UniqueId, outputId ), m_extensibleInputResults[ i ], m_inputPorts[ i ].DataType, m_mainDataType, m_extensibleInputResults[ i ] ); - } - } - } - - void UpdatePorts() - { - m_lastInputCount = Mathf.Clamp( m_inputCount, 2, 10 ); - - for( int i = 2; i < m_inputCount; i++ ) - { - AddInputPort( m_mainDataType, false, ( ( char ) ( 'A' + i ) ).ToString() ); - m_inputPorts[ i ].CreatePortRestrictions( m_dynamicRestrictions ); - } - - m_sizeIsDirty = true; - SetSaveIsDirty(); - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - if( m_extensibleInputPorts && UIUtils.CurrentShaderVersion() > 10005 ) - { - m_inputCount = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - UpdatePorts(); - } - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - if( m_extensibleInputPorts ) - IOUtils.AddFieldValueToString( ref nodeInfo, m_inputCount ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/DynamicTypeNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/DynamicTypeNode.cs.meta deleted file mode 100644 index bac40f90..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/DynamicTypeNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 5b60c440b5db81c4d9df9c048aa22b48 -timeCreated: 1481126956 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs.meta deleted file mode 100644 index 2eaea63d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 868823c936b45494aa7f3ce9f16b5372 -folderAsset: yes -timeCreated: 1481126946 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/CameraDepthFade.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/CameraDepthFade.cs deleted file mode 100644 index e8c9fc58..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/CameraDepthFade.cs +++ /dev/null @@ -1,130 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Camera Depth Fade", "Camera And Screen", "Outputs a 0 - 1 gradient representing the distance between the surface of this object and camera near plane" )] - public sealed class CameraDepthFade : ParentNode - { - //{0} - Eye Depth - //{1} - Offset - //{2} - Distance - private const string CameraDepthFadeFormat = "(( {0} -_ProjectionParams.y - {1} ) / {2})"; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT3, false, "Vertex Position", -1, MasterNodePortCategory.Fragment, 2 ); - AddInputPort( WirePortDataType.FLOAT, false, "Length", -1, MasterNodePortCategory.Fragment, 0 ); - AddInputPort( WirePortDataType.FLOAT, false, "Offset", -1, MasterNodePortCategory.Fragment, 1 ); - GetInputPortByUniqueId( 0 ).FloatInternalData = 1; - AddOutputPort( WirePortDataType.FLOAT, "Out" ); - m_useInternalPortData = true; - } - - 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 ); - - InputPort vertexPort = GetInputPortByUniqueId( 2 ); - InputPort lengthPort = GetInputPortByUniqueId( 0 ); - InputPort offsetPort = GetInputPortByUniqueId( 1 ); - - string distance = lengthPort.GeneratePortInstructions( ref dataCollector ); - string offset = offsetPort.GeneratePortInstructions( ref dataCollector ); - - string value = string.Empty; - string eyeDepth = string.Empty; - - if( dataCollector.IsTemplate ) - { - if( vertexPort.IsConnected ) - { - string varName = "customSurfaceDepth" + OutputId; - GenerateInputInVertex( ref dataCollector, 2, varName, false ); - - string formatStr = string.Empty; - if( dataCollector.IsSRP ) - formatStr = "-TransformWorldToView(TransformObjectToWorld({0})).z"; - else - formatStr = "-UnityObjectToViewPos({0}).z"; - - string eyeInstruction = string.Format( formatStr, varName ); - eyeDepth = "customEye" + OutputId; - dataCollector.TemplateDataCollectorInstance.RegisterCustomInterpolatedData( eyeDepth, WirePortDataType.FLOAT, CurrentPrecisionType, eyeInstruction ); - } - else - { - eyeDepth = dataCollector.TemplateDataCollectorInstance.GetEyeDepth( CurrentPrecisionType ); - } - - value = string.Format( CameraDepthFadeFormat, eyeDepth, offset, distance ); - RegisterLocalVariable( 0, value, ref dataCollector, "cameraDepthFade" + OutputId ); - return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); - } - - if( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) - { - string vertexVarName = string.Empty; - if( vertexPort.IsConnected ) - { - vertexVarName = vertexPort.GeneratePortInstructions( ref dataCollector ); - } - else - { - vertexVarName = Constants.VertexShaderInputStr + ".vertex.xyz"; - } - - //dataCollector.AddVertexInstruction( "float cameraDepthFade" + UniqueId + " = (( -UnityObjectToViewPos( " + Constants.VertexShaderInputStr + ".vertex.xyz ).z -_ProjectionParams.y - " + offset + " ) / " + distance + ");", UniqueId ); - value = string.Format( CameraDepthFadeFormat, "-UnityObjectToViewPos( " + vertexVarName + " ).z", offset, distance ); - RegisterLocalVariable( 0, value, ref dataCollector, "cameraDepthFade" + OutputId ); - return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); - } - - dataCollector.AddToIncludes( UniqueId, Constants.UnityShaderVariables ); - - if( dataCollector.TesselationActive ) - { - if( vertexPort.IsConnected ) - { - string vertexValue = vertexPort.GeneratePortInstructions( ref dataCollector ); - eyeDepth = "customSurfaceDepth" + OutputId; - RegisterLocalVariable( 0, string.Format( "-UnityObjectToViewPos( {0} ).z", vertexValue ), ref dataCollector, eyeDepth ); - } - else - { - eyeDepth = GeneratorUtils.GenerateScreenDepthOnFrag( ref dataCollector, UniqueId, CurrentPrecisionType ); - } - } - else - { - - if( vertexPort.IsConnected ) - { - string varName = "customSurfaceDepth" + OutputId; - GenerateInputInVertex( ref dataCollector, 2, varName, false ); - dataCollector.AddToInput( UniqueId, varName, WirePortDataType.FLOAT ); - string vertexInstruction = "-UnityObjectToViewPos( " + varName + " ).z"; - dataCollector.AddToVertexLocalVariables( UniqueId, Constants.VertexShaderOutputStr + "." + varName + " = " + vertexInstruction + ";" ); - eyeDepth = Constants.InputVarStr + "." + varName; - } - else - { - dataCollector.AddToInput( UniqueId, "eyeDepth", WirePortDataType.FLOAT ); - string instruction = "-UnityObjectToViewPos( " + Constants.VertexShaderInputStr + ".vertex.xyz ).z"; - dataCollector.AddToVertexLocalVariables( UniqueId, Constants.VertexShaderOutputStr + ".eyeDepth = " + instruction + ";" ); - eyeDepth = Constants.InputVarStr + ".eyeDepth"; - } - } - - value = string.Format( CameraDepthFadeFormat, eyeDepth, offset, distance ); - RegisterLocalVariable( 0, value, ref dataCollector, "cameraDepthFade" + OutputId ); - //dataCollector.AddToLocalVariables( UniqueId, "float cameraDepthFade" + UniqueId + " = (( " + Constants.InputVarStr + ".eyeDepth -_ProjectionParams.y - "+ offset + " ) / " + distance + ");" ); - - return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/CameraDepthFade.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/CameraDepthFade.cs.meta deleted file mode 100644 index 2e13b8fb..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/CameraDepthFade.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 96f38a9f14906ca49b505b8e305c37ec -timeCreated: 1491316341 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ComputeGrabScreenPosHlpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ComputeGrabScreenPosHlpNode.cs deleted file mode 100644 index 362415d3..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ComputeGrabScreenPosHlpNode.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Compute Grab Screen Pos", "Camera And Screen", "Computes texture coordinate for doing a screenspace-mapped texture sample. Input is clip space position" )] - public sealed class ComputeGrabScreenPosHlpNode : HelperParentNode - { - private readonly string[] ComputeGrabScreenPosFunction = - { - "inline float4 ComputeGrabScreenPos( float4 pos )\n", - "{\n", - "#if UNITY_UV_STARTS_AT_TOP\n", - "\tfloat scale = -1.0;\n", - "#else\n", - "\tfloat scale = 1.0;\n", - "#endif\n", - "\tfloat4 o = pos * 0.5f;\n", - "\to.xy = float2( o.x, o.y*scale ) + o.w;\n", - "#ifdef UNITY_SINGLE_PASS_STEREO\n", - "\to.xy = TransformStereoScreenSpaceTex ( o.xy, pos.w );\n", - "#endif\n", - "\to.zw = pos.zw;\n", - "\treturn o;\n", - "}\n" - }; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_funcType = "ComputeGrabScreenPos"; - m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT4, false ); - m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT4, false ); - m_outputPorts[ 0 ].Name = "XYZW"; - } - - protected override void OnUniqueIDAssigned() - { - base.OnUniqueIDAssigned(); - m_localVarName = "computeGrabScreenPos" + OutputId; - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if( dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HD ) - { - dataCollector.AddFunction( m_funcType, ComputeGrabScreenPosFunction, false ); - } - return base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ComputeGrabScreenPosHlpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ComputeGrabScreenPosHlpNode.cs.meta deleted file mode 100644 index 4e68be78..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ComputeGrabScreenPosHlpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 5fe7f4be962b9e8459eb156503b99d41 -timeCreated: 1481126956 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ComputeScreenPosHlpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ComputeScreenPosHlpNode.cs deleted file mode 100644 index 883009b9..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ComputeScreenPosHlpNode.cs +++ /dev/null @@ -1,76 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> -using UnityEngine; -using System; -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Compute Screen Pos", "Camera And Screen", "Computes texture coordinate for doing a screenspace-mapped texture sample. Input is clip space position" )] - public sealed class ComputeScreenPosHlpNode : HelperParentNode - { - [SerializeField] - private bool m_normalize = false; - private string NormalizeStr = "Normalize"; - private readonly string[] NormalizeOps = - { "{0} = {0} / {0}.w;", - "{0}.z = ( UNITY_NEAR_CLIP_VALUE >= 0 ) ? {0}.z : {0}.z* 0.5 + 0.5;" - }; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_funcType = "ComputeScreenPos"; - m_funcHDFormatOverride = "ComputeScreenPos( {0} , _ProjectionParams.x )"; - m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT4, false ); - m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT4, false ); - m_outputPorts[ 0 ].Name = "XYZW"; - m_autoWrapProperties = true; - m_previewShaderGUID = "97bd4895d847d764eb21d2bf7aa13671"; - } - - public override void SetPreviewInputs() - { - base.SetPreviewInputs(); - m_previewMaterialPassId = m_normalize ? 1 : 0; - } - - protected override void OnUniqueIDAssigned() - { - base.OnUniqueIDAssigned(); - m_localVarName = "computeScreenPos" + OutputId; - } - - public override void DrawProperties() - { - base.DrawProperties(); - m_normalize = EditorGUILayoutToggle( NormalizeStr, m_normalize ); - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - string result = base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); - if( m_normalize ) - { - dataCollector.AddLocalVariable( UniqueId, string.Format( NormalizeOps[ 0 ], m_localVarName ) ); - dataCollector.AddLocalVariable( UniqueId, string.Format( NormalizeOps[ 1 ], m_localVarName ) ); - } - return result; - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_normalize ); - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - if( UIUtils.CurrentShaderVersion() > 15404 ) - { - m_normalize = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - } - } - - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ComputeScreenPosHlpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ComputeScreenPosHlpNode.cs.meta deleted file mode 100644 index a5dba00e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ComputeScreenPosHlpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: c220606396d6e6048a901f217be1435e -timeCreated: 1481126959 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeDepthNormalNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeDepthNormalNode.cs deleted file mode 100644 index fc094119..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeDepthNormalNode.cs +++ /dev/null @@ -1,38 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Decode Depth Normal", "Miscellaneous", "Decodes both Depth and Normal from a previously encoded pixel value" )] - public sealed class DecodeDepthNormalNode : ParentNode - { - private const string DecodeDepthNormalFunc = "DecodeDepthNormal( {0}, {1}, {2} );"; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT4, false, "Encoded" ); - AddOutputPort( WirePortDataType.FLOAT, "Depth" ); - AddOutputPort( WirePortDataType.FLOAT3, "Normal" ); - m_previewShaderGUID = "dbf37c4d3ce0f0b41822584d6c9ba203"; - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if( m_outputPorts[ outputId ].IsLocalValue( dataCollector.PortCategory ) ) - return m_outputPorts[ outputId ].LocalValue( dataCollector.PortCategory ); - - dataCollector.AddToIncludes( UniqueId, Constants.UnityCgLibFuncs ); - string encodedValue = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - string depthDecodedVal = "depthDecodedVal" + OutputId; - string normalDecodedVal = "normalDecodedVal" + OutputId; - RegisterLocalVariable( 0, "0", ref dataCollector, depthDecodedVal ); - RegisterLocalVariable( 1, "float3(0,0,0)", ref dataCollector, normalDecodedVal ); - dataCollector.AddLocalVariable( UniqueId, string.Format( DecodeDepthNormalFunc, encodedValue , depthDecodedVal, normalDecodedVal) ); - return m_outputPorts[ outputId ].LocalValue( dataCollector.PortCategory ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeDepthNormalNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeDepthNormalNode.cs.meta deleted file mode 100644 index 032de060..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeDepthNormalNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 1cc4e3c718669d54c97614ac6abcfaff -timeCreated: 1513695160 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeFloatRGBAHlpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeFloatRGBAHlpNode.cs deleted file mode 100644 index a80ad39d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeFloatRGBAHlpNode.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Decode Float RGBA", "Miscellaneous", "Decodes RGBA color into a float" )] - public sealed class DecodeFloatRGBAHlpNode : HelperParentNode - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_funcType = "DecodeFloatRGBA"; - m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT4, false ); - m_inputPorts[ 0 ].Name = "RGBA"; - m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT, false ); - m_previewShaderGUID = "f71b31b15ff3f2042bafbed40acd29f4"; - } - - protected override void OnUniqueIDAssigned() - { - base.OnUniqueIDAssigned(); - m_localVarName = "decodeFloatRGBA" + OutputId; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeFloatRGBAHlpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeFloatRGBAHlpNode.cs.meta deleted file mode 100644 index 132cd57d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeFloatRGBAHlpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 2c5479ff48207cf43a308ec9f110fa9f -timeCreated: 1481126954 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeFloatRGHlpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeFloatRGHlpNode.cs deleted file mode 100644 index 3751b228..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeFloatRGHlpNode.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Decode Float RG", "Miscellaneous", "Decodes a previously-encoded RG float" )] - public sealed class DecodeFloatRGHlpNode : HelperParentNode - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_funcType = "DecodeFloatRG"; - m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT2, false ); - m_inputPorts[ 0 ].Name = "RG"; - m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT, false ); - m_previewShaderGUID = "1fb3121b1c8febb4dbcc2a507a2df2db"; - } - - protected override void OnUniqueIDAssigned() - { - base.OnUniqueIDAssigned(); - m_localVarName = "decodeFloatRG" + OutputId; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeFloatRGHlpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeFloatRGHlpNode.cs.meta deleted file mode 100644 index e436b075..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeFloatRGHlpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: a965812ada2b83343a1f511273fcfc52 -timeCreated: 1481126958 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeLightmapHlpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeLightmapHlpNode.cs deleted file mode 100644 index a7f52ddf..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeLightmapHlpNode.cs +++ /dev/null @@ -1,109 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using UnityEngine; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Decode Lightmap", "Miscellaneous", "Decodes color from Unity lightmap (RGBM or dLDR depending on platform)" )] - public sealed class DecodeLightmapHlpNode : ParentNode - { - private const string m_funcStandard = "DecodeLightmap({0})"; - private string m_funcSRP = "DecodeLightmap({0},{1})"; - - private const string DecodeInstructionsLWValueStr = "half4 decodeLightmapInstructions = half4(LIGHTMAP_HDR_MULTIPLIER, LIGHTMAP_HDR_EXPONENT, 0.0h, 0.0h);"; - private const string DecodeInstructionsNameStr = "decodeLightmapInstructions"; - private readonly string[] DecodeInstructionsHDValueStr = - { - "#ifdef UNITY_LIGHTMAP_FULL_HDR//ase_decode_lightmap_0", - "\tbool useRGBMLightmap = false;//ase_decode_lightmap_1", - "\tfloat4 decodeLightmapInstructions = float4( 0.0, 0.0, 0.0, 0.0 );//ase_decode_lightmap_2", - "#else//ase_decode_lightmap//ase_decode_lightmap_3", - "\tbool useRGBMLightmap = true;//ase_decode_lightmap_4", - "#if defined(UNITY_LIGHTMAP_RGBM_ENCODING)//ase_decode_lightmap_5", - "\tfloat4 decodeLightmapInstructions = float4(34.493242, 2.2, 0.0, 0.0);//ase_decode_lightmap_6", - "#else//ase_decode_lightmap_7", - "\tfloat4 decodeLightmapInstructions = float4( 2.0, 2.2, 0.0, 0.0 );//ase_decode_lightmap_8", - "#endif//ase_decode_lightmap_9", - "#endif//ase_decode_lightmap_10" - }; - private string m_localVarName = null; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT4, false, "Value" ); - AddInputPort( WirePortDataType.FLOAT4, false, "Instructions" ); - - AddOutputPort( WirePortDataType.FLOAT3, Constants.EmptyPortValue ); - - m_previewShaderGUID = "c2d3bee1aee183343b31b9208cb402e9"; - m_useInternalPortData = true; - } - - public override string GetIncludes() - { - return Constants.UnityCgLibFuncs; - } - - protected override void OnUniqueIDAssigned() - { - base.OnUniqueIDAssigned(); - m_localVarName = "decodeLightMap" + OutputId; - } - - public override void OnNodeLogicUpdate( DrawInfo drawInfo ) - { - base.OnNodeLogicUpdate( drawInfo ); - m_inputPorts[ 1 ].Visible = m_containerGraph.ParentWindow.IsShaderFunctionWindow || m_containerGraph.IsSRP; - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) - return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); - - base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); - - string value = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - string finalResult = string.Empty; - if( dataCollector.IsTemplate && dataCollector.IsSRP ) - { - string instructions = string.Empty; - if( m_inputPorts[ 1 ].IsConnected ) - { - instructions = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); - } - else - { - if( dataCollector.TemplateDataCollectorInstance.IsHDRP ) - { - for( int i = 0; i < DecodeInstructionsHDValueStr.Length; i++ ) - { - dataCollector.AddLocalVariable( UniqueId, DecodeInstructionsHDValueStr[ i ] ); - } - } - else - { - dataCollector.AddLocalVariable( UniqueId, DecodeInstructionsLWValueStr ); - } - instructions = DecodeInstructionsNameStr; - - } - - finalResult = string.Format( m_funcSRP, value , instructions ); - - } - else - { - dataCollector.AddToIncludes( UniqueId, Constants.UnityCgLibFuncs ); - finalResult = string.Format( m_funcStandard, value ); - } - - RegisterLocalVariable( 0, finalResult, ref dataCollector, m_localVarName ); - return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeLightmapHlpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeLightmapHlpNode.cs.meta deleted file mode 100644 index 07aca766..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeLightmapHlpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: b3d1879d1e402b34f98b8e8cdf94d719 -timeCreated: 1481126958 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeViewNormalStereoHlpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeViewNormalStereoHlpNode.cs deleted file mode 100644 index a69b4997..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeViewNormalStereoHlpNode.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Decode View Normal Stereo", "Miscellaneous", "Decodes view space normal from enc4.xy" )] - public sealed class DecodeViewNormalStereoHlpNode : HelperParentNode - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_funcType = "DecodeViewNormalStereo"; - m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT4, false ); - m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT3, false ); - m_outputPorts[ 0 ].Name = "XYZ"; - m_previewShaderGUID = "e996db1cc4510c84185cb9f933f916bb"; - } - - protected override void OnUniqueIDAssigned() - { - base.OnUniqueIDAssigned(); - m_localVarName = "decodeViewNormalStereo" + OutputId; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeViewNormalStereoHlpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeViewNormalStereoHlpNode.cs.meta deleted file mode 100644 index 0bf44661..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DecodeViewNormalStereoHlpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 94df47461b7e6244eaf92b0dab7cc7ee -timeCreated: 1481126957 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DepthFade.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DepthFade.cs deleted file mode 100644 index cc6db43d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DepthFade.cs +++ /dev/null @@ -1,168 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEngine; -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Depth Fade", "Surface Data", "Outputs a linear gradient representing the distance between the surface of this object and geometry behind" )] - public sealed class DepthFade : ParentNode - { - private const string ConvertToLinearStr = "Convert To Linear"; - private const string SaturateStr = "Saturate"; - private const string MirrorStr = "Mirror"; - - [SerializeField] - private bool m_convertToLinear = true; - - [SerializeField] - private bool m_saturate = false; - - [SerializeField] - private bool m_mirror = true; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT3, false, "Vertex Position", -1, MasterNodePortCategory.Fragment, 1 ); - AddInputPort( WirePortDataType.FLOAT, false, "Distance",-1,MasterNodePortCategory.Fragment,0 ); - GetInputPortByUniqueId(0).FloatInternalData = 1; - AddOutputPort( WirePortDataType.FLOAT, "Out" ); - m_useInternalPortData = true; - m_autoWrapProperties = true; - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if( dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) - { - UIUtils.ShowNoVertexModeNodeMessage( this ); - return "0"; - } - - if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) - return GetOutputColorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); - - if( !( dataCollector.IsTemplate && dataCollector.IsSRP ) ) - dataCollector.AddToIncludes( UniqueId, Constants.UnityCgLibFuncs ); - - if( !dataCollector.IsTemplate || dataCollector.TemplateDataCollectorInstance.CurrentSRPType != TemplateSRPType.HD ) - { - if( dataCollector.IsTemplate && dataCollector.CurrentSRPType == TemplateSRPType.Lightweight ) - { - //dataCollector.AddToUniforms( UniqueId, Constants.CameraDepthTextureSRPVar ); - //dataCollector.AddToUniforms( UniqueId, Constants.CameraDepthTextureSRPSampler ); - dataCollector.AddToDirectives( Constants.CameraDepthTextureLWEnabler, -1, AdditionalLineType.Define ); - } - else - { - dataCollector.AddToUniforms( UniqueId, Constants.CameraDepthTextureValue ); - } - - dataCollector.AddToUniforms( UniqueId, Constants.CameraDepthTextureTexelSize ); - } - - string screenPosNorm = string.Empty; - InputPort vertexPosPort = GetInputPortByUniqueId( 1 ); - if( vertexPosPort.IsConnected ) - { - string vertexPosVar = "vertexPos" + OutputId; - GenerateInputInVertex( ref dataCollector, 1, vertexPosVar, false ); - screenPosNorm = GeneratorUtils.GenerateScreenPositionNormalizedForValue( vertexPosVar, OutputId, ref dataCollector, UniqueId, CurrentPrecisionType, !dataCollector.UsingCustomScreenPos ); - } - else - { - if( dataCollector.IsTemplate ) - { - string ppsScreenPos = string.Empty; - if( !dataCollector.TemplateDataCollectorInstance.GetCustomInterpolatedData( TemplateInfoOnSematics.SCREEN_POSITION_NORMALIZED, WirePortDataType.FLOAT4, PrecisionType.Float, ref ppsScreenPos, true, MasterNodePortCategory.Fragment ) ) - { - screenPosNorm = GeneratorUtils.GenerateScreenPositionNormalized( ref dataCollector, UniqueId, CurrentPrecisionType, !dataCollector.UsingCustomScreenPos ); - } - else - { - screenPosNorm = ppsScreenPos; - } - } - else - { - screenPosNorm = GeneratorUtils.GenerateScreenPositionNormalized( ref dataCollector, UniqueId, CurrentPrecisionType, !dataCollector.UsingCustomScreenPos ); - } - } - - string screenDepth = TemplateHelperFunctions.CreateDepthFetch( dataCollector, screenPosNorm ); - if( m_convertToLinear ) - { - if( dataCollector.IsTemplate && dataCollector.IsSRP ) - screenDepth = string.Format( "LinearEyeDepth({0},_ZBufferParams)", screenDepth ); - else - screenDepth = string.Format( "LinearEyeDepth({0})", screenDepth ); - } - else - { - screenDepth = string.Format( "({0}*( _ProjectionParams.z - _ProjectionParams.y ))", screenDepth ); - } - - string distance = GetInputPortByUniqueId( 0 ).GeneratePortInstructions( ref dataCollector ); - - dataCollector.AddLocalVariable( UniqueId, "float screenDepth" + OutputId + " = " + screenDepth + ";" ); - - string finalVarName = "distanceDepth" + OutputId; - string finalVarValue = string.Empty; - if( dataCollector.IsTemplate && dataCollector.IsSRP ) - finalVarValue = "( screenDepth" + OutputId + " - LinearEyeDepth( " + screenPosNorm + ".z,_ZBufferParams ) ) / ( " + distance + " )"; - else - finalVarValue = "( screenDepth" + OutputId + " - LinearEyeDepth( " + screenPosNorm + ".z ) ) / ( " + distance + " )"; - - if( m_mirror ) - { - finalVarValue = string.Format( "abs( {0} )", finalVarValue ); - } - - if( m_saturate ) - { - finalVarValue = string.Format( "saturate( {0} )", finalVarValue ); - } - - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT, finalVarName, finalVarValue ); - m_outputPorts[ 0 ].SetLocalValue( finalVarName, dataCollector.PortCategory ); - return GetOutputColorItem( 0, outputId, finalVarName ); - } - - public override void DrawProperties() - { - base.DrawProperties(); - m_convertToLinear = EditorGUILayoutToggle( ConvertToLinearStr, m_convertToLinear ); - m_mirror = EditorGUILayoutToggle( MirrorStr, m_mirror ); - m_saturate = EditorGUILayoutToggle( SaturateStr, m_saturate ); - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - if( UIUtils.CurrentShaderVersion() >= 13901 ) - { - m_convertToLinear = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - } - if( UIUtils.CurrentShaderVersion() > 15607 ) - { - m_saturate = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - } - - if( UIUtils.CurrentShaderVersion() > 15700 ) - { - m_mirror = 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_convertToLinear ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_saturate ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_mirror ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DepthFade.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DepthFade.cs.meta deleted file mode 100644 index c302a611..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DepthFade.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 279c74ce44e24204d803be6ec743c290 -timeCreated: 1491316341 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DiffuseAndSpecularFromMetallicNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DiffuseAndSpecularFromMetallicNode.cs deleted file mode 100644 index af599335..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DiffuseAndSpecularFromMetallicNode.cs +++ /dev/null @@ -1,59 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Diffuse And Specular From Metallic", "Miscellaneous", "Gets Diffuse and Specular values from Metallic. Uses DiffuseAndSpecularFromMetallic function from UnityStandardUtils." )] - public class DiffuseAndSpecularFromMetallicNode : ParentNode - { - //half3 DiffuseAndSpecularFromMetallic (half3 albedo, half metallic, out half3 specColor, out half oneMinusReflectivity) - private const string FuncFormat = "DiffuseAndSpecularFromMetallic({0},{1},{2},{3})"; - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT3, false, "Albedo" ); - AddInputPort( WirePortDataType.FLOAT, false, "Metallic" ); - AddOutputPort( WirePortDataType.FLOAT3, "Out" ); - AddOutputPort( WirePortDataType.FLOAT3, "Spec Color" ); - AddOutputPort( WirePortDataType.FLOAT, "One Minus Reflectivity" ); - m_previewShaderGUID = "c7c4485750948a045b5dab0985896e17"; - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if( dataCollector.IsSRP ) - { - UIUtils.ShowMessage( UniqueId, "Diffuse And Specular From Metallic Node not compatible with SRP" ); - return m_outputPorts[0].ErrorValue; - } - - if( m_outputPorts[ outputId ].IsLocalValue( dataCollector.PortCategory ) ) - { - return m_outputPorts[ outputId ].LocalValue( dataCollector.PortCategory ); - } - - dataCollector.AddToIncludes( UniqueId, Constants.UnityStandardUtilsLibFuncs ); - - string albedo = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - string metallic = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); - - string specColorVar = "specColor" + OutputId; - string oneMinusReflectivityVar = "oneMinusReflectivity" + OutputId; - string varName = "diffuseAndSpecularFromMetallic" + OutputId; - - dataCollector.AddLocalVariable( UniqueId, PrecisionType.Half, WirePortDataType.FLOAT3, specColorVar, "(0).xxx" ); - dataCollector.AddLocalVariable( UniqueId, PrecisionType.Half, WirePortDataType.FLOAT, oneMinusReflectivityVar, "0" ); - - - string varValue = string.Format( FuncFormat, albedo, metallic, specColorVar, oneMinusReflectivityVar ); - dataCollector.AddLocalVariable( UniqueId, PrecisionType.Half, WirePortDataType.FLOAT3, varName, varValue ); - m_outputPorts[ 0 ].SetLocalValue( varName, dataCollector.PortCategory ); - m_outputPorts[ 1 ].SetLocalValue( specColorVar, dataCollector.PortCategory ); - m_outputPorts[ 2 ].SetLocalValue( oneMinusReflectivityVar, dataCollector.PortCategory ); - - return m_outputPorts[ outputId ].LocalValue( dataCollector.PortCategory ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DiffuseAndSpecularFromMetallicNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DiffuseAndSpecularFromMetallicNode.cs.meta deleted file mode 100644 index 4ab9e6f0..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DiffuseAndSpecularFromMetallicNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: a792f114a5433af499dce78ebe05a9e6 -timeCreated: 1534266498 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DitheringNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DitheringNode.cs deleted file mode 100644 index a4dfafb1..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DitheringNode.cs +++ /dev/null @@ -1,284 +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( "Dither", "Camera And Screen", "Generates a dithering pattern" )] - public sealed class DitheringNode : ParentNode - { - private const string InputTypeStr = "Pattern"; - private const string CustomScreenPosStr = "screenPosition"; - - private string m_functionHeader = "Dither4x4Bayer( {0}, {1} )"; - private string m_functionBody = string.Empty; - - [SerializeField] - private int m_selectedPatternInt = 0; - - [SerializeField] - private bool m_customScreenPos = false; - - private readonly string[] PatternsFuncStr = { "4x4Bayer", "8x8Bayer", "NoiseTex" }; - private readonly string[] PatternsStr = { "4x4 Bayer", "8x8 Bayer", "Noise Texture" }; - - private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper(); - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT, false, Constants.EmptyPortValue ); - AddInputPort( WirePortDataType.SAMPLER2D, false, "Pattern"); - AddInputPort( WirePortDataType.FLOAT4, false, "Screen Position" ); - - AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); - m_textLabelWidth = 110; - m_autoWrapProperties = true; - m_hasLeftDropdown = true; - SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, PatternsStr[ m_selectedPatternInt ] ) ); - UpdatePorts(); - GeneratePattern(); - } - - public override void Destroy() - { - base.Destroy(); - m_upperLeftWidget = null; - } - - - public override void AfterCommonInit() - { - base.AfterCommonInit(); - if( PaddingTitleLeft == 0 ) - { - PaddingTitleLeft = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; - if( PaddingTitleRight == 0 ) - PaddingTitleRight = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; - } - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - EditorGUI.BeginChangeCheck(); - m_selectedPatternInt = m_upperLeftWidget.DrawWidget( this, m_selectedPatternInt, PatternsStr ); - if( EditorGUI.EndChangeCheck() ) - { - UpdatePorts(); - GeneratePattern(); - } - } - - public override void DrawProperties() - { - base.DrawProperties(); - EditorGUI.BeginChangeCheck(); - m_selectedPatternInt = EditorGUILayoutPopup( "Pattern", m_selectedPatternInt, PatternsStr ); - if ( EditorGUI.EndChangeCheck() ) - { - UpdatePorts(); - GeneratePattern(); - } - EditorGUI.BeginChangeCheck(); - m_customScreenPos = EditorGUILayoutToggle( "Screen Position", m_customScreenPos ); - if( EditorGUI.EndChangeCheck() ) - { - UpdatePorts(); - } - } - - private void UpdatePorts() - { - m_inputPorts[ 1 ].Visible = ( m_selectedPatternInt == 2 ); - m_inputPorts[ 2 ].Visible = m_customScreenPos; - m_sizeIsDirty = true; - } - - private void GeneratePattern() - { - SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, PatternsStr[ m_selectedPatternInt ] ) ); - switch ( m_selectedPatternInt ) - { - default: - case 0: - { - m_functionBody = string.Empty; - m_functionHeader = "Dither" + PatternsFuncStr[ m_selectedPatternInt ] + "( {0}, {1} )"; - IOUtils.AddFunctionHeader( ref m_functionBody, "inline float Dither" + PatternsFuncStr[ m_selectedPatternInt ] + "( int x, int y )" ); - IOUtils.AddFunctionLine( ref m_functionBody, "const float dither[ 16 ] = {" ); - IOUtils.AddFunctionLine( ref m_functionBody, " 1, 9, 3, 11," ); - IOUtils.AddFunctionLine( ref m_functionBody, " 13, 5, 15, 7," ); - IOUtils.AddFunctionLine( ref m_functionBody, " 4, 12, 2, 10," ); - IOUtils.AddFunctionLine( ref m_functionBody, " 16, 8, 14, 6 };" ); - IOUtils.AddFunctionLine( ref m_functionBody, "int r = y * 4 + x;" ); - IOUtils.AddFunctionLine( ref m_functionBody, "return dither[r] / 16; // same # of instructions as pre-dividing due to compiler magic" ); - IOUtils.CloseFunctionBody( ref m_functionBody ); - } - break; - case 1: - { - m_functionBody = string.Empty; - m_functionHeader = "Dither" + PatternsFuncStr[ m_selectedPatternInt ] + "( {0}, {1} )"; - IOUtils.AddFunctionHeader( ref m_functionBody, "inline float Dither" + PatternsFuncStr[ m_selectedPatternInt ] + "( int x, int y )" ); - IOUtils.AddFunctionLine( ref m_functionBody, "const float dither[ 64 ] = {" ); - IOUtils.AddFunctionLine( ref m_functionBody, " 1, 49, 13, 61, 4, 52, 16, 64," ); - IOUtils.AddFunctionLine( ref m_functionBody, " 33, 17, 45, 29, 36, 20, 48, 32," ); - IOUtils.AddFunctionLine( ref m_functionBody, " 9, 57, 5, 53, 12, 60, 8, 56," ); - IOUtils.AddFunctionLine( ref m_functionBody, " 41, 25, 37, 21, 44, 28, 40, 24," ); - IOUtils.AddFunctionLine( ref m_functionBody, " 3, 51, 15, 63, 2, 50, 14, 62," ); - IOUtils.AddFunctionLine( ref m_functionBody, " 35, 19, 47, 31, 34, 18, 46, 30," ); - IOUtils.AddFunctionLine( ref m_functionBody, " 11, 59, 7, 55, 10, 58, 6, 54," ); - IOUtils.AddFunctionLine( ref m_functionBody, " 43, 27, 39, 23, 42, 26, 38, 22};" ); - IOUtils.AddFunctionLine( ref m_functionBody, "int r = y * 8 + x;" ); - IOUtils.AddFunctionLine( ref m_functionBody, "return dither[r] / 64; // same # of instructions as pre-dividing due to compiler magic" ); - IOUtils.CloseFunctionBody( ref m_functionBody ); - } - break; - case 2: - { - bool sampleThroughMacros = UIUtils.CurrentWindow.OutsideGraph.SamplingThroughMacros; - - m_functionBody = string.Empty; - m_functionHeader = "Dither" + PatternsFuncStr[ m_selectedPatternInt ] + "( {0}, {1}, {2})"; - - if( sampleThroughMacros ) - { - IOUtils.AddFunctionHeader( ref m_functionBody, "inline float Dither" + PatternsFuncStr[ m_selectedPatternInt ] + "( float4 screenPos, TEXTURE2D_PARAM( noiseTexture, samplernoiseTexture ), float4 noiseTexelSize )" ); - IOUtils.AddFunctionLine( ref m_functionBody, "float dither = SAMPLE_TEXTURE2D_LOD( noiseTexture, samplernoiseTexture, float3( screenPos.xy * _ScreenParams.xy * noiseTexelSize.xy, 0 ), 0 ).g;" ); - } - else - { - IOUtils.AddFunctionHeader( ref m_functionBody, "inline float Dither" + PatternsFuncStr[ m_selectedPatternInt ] + "( float4 screenPos, sampler2D noiseTexture, float4 noiseTexelSize )" ); - IOUtils.AddFunctionLine( ref m_functionBody, "float dither = tex2Dlod( noiseTexture, float4( screenPos.xy * _ScreenParams.xy * noiseTexelSize.xy, 0, 0 ) ).g;" ); - } - IOUtils.AddFunctionLine( ref m_functionBody, "float ditherRate = noiseTexelSize.x * noiseTexelSize.y;" ); - IOUtils.AddFunctionLine( ref m_functionBody, "dither = ( 1 - ditherRate ) * dither + ditherRate;" ); - IOUtils.AddFunctionLine( ref m_functionBody, "return dither;" ); - IOUtils.CloseFunctionBody( ref m_functionBody ); - } - break; - } - } - - public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) - { - base.PropagateNodeData( nodeData, ref dataCollector ); - dataCollector.UsingCustomScreenPos = true; - } - - 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 ); - - GeneratePattern(); - - if( !( dataCollector.IsTemplate && dataCollector.IsSRP ) ) - dataCollector.AddToIncludes( UniqueId, Constants.UnityShaderVariables ); - string varName = string.Empty; - bool isFragment = dataCollector.IsFragmentCategory; - if( m_customScreenPos && m_inputPorts[ 2 ].IsConnected ) - { - varName = "ditherCustomScreenPos" + OutputId; - string customScreenPosVal = m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ); - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT4, varName, customScreenPosVal ); - } - else - { - if( dataCollector.TesselationActive && isFragment ) - { - varName = GeneratorUtils.GenerateClipPositionOnFrag( ref dataCollector, UniqueId, CurrentPrecisionType ); - } - else - { - if( dataCollector.IsTemplate ) - { - varName = dataCollector.TemplateDataCollectorInstance.GetScreenPosNormalized( CurrentPrecisionType ); - } - else - { - varName = GeneratorUtils.GenerateScreenPositionNormalized( ref dataCollector, UniqueId, CurrentPrecisionType, !dataCollector.UsingCustomScreenPos ); - } - } - } - string surfInstruction = varName + ".xy * _ScreenParams.xy"; - m_showErrorMessage = false; - string functionResult = ""; - switch ( m_selectedPatternInt ) - { - default: - case 0: - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT2, "clipScreen" + OutputId, surfInstruction ); - functionResult = dataCollector.AddFunctions( m_functionHeader, m_functionBody, "fmod(" + "clipScreen" + OutputId + ".x, 4)", "fmod(" + "clipScreen" + OutputId + ".y, 4)" ); - break; - case 1: - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT2, "clipScreen" + OutputId, surfInstruction ); - functionResult = dataCollector.AddFunctions( m_functionHeader, m_functionBody, "fmod(" + "clipScreen" + OutputId + ".x, 8)", "fmod(" + "clipScreen" + OutputId + ".y, 8)" ); - break; - case 2: - { - if( !m_inputPorts[ 1 ].IsConnected ) - { - m_showErrorMessage = true; - m_errorMessageTypeIsError = NodeMessageType.Warning; - m_errorMessageTooltip = "Please connect a texture object to the Pattern input port to generate a proper dithered pattern"; - return "0"; - } else - { - bool sampleThroughMacros = UIUtils.CurrentWindow.OutsideGraph.SamplingThroughMacros; - - string noiseTex = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); - dataCollector.AddToUniforms( UniqueId, "float4 " + noiseTex + "_TexelSize;", dataCollector.IsSRP ); - if( sampleThroughMacros ) - { - dataCollector.AddToUniforms( UniqueId, string.Format( Constants.SamplerDeclarationSRPMacros[ TextureType.Texture2D ], noiseTex ) ); - functionResult = dataCollector.AddFunctions( m_functionHeader, m_functionBody, varName, noiseTex+", sampler"+noiseTex, noiseTex + "_TexelSize" ); - } - else - { - functionResult = dataCollector.AddFunctions( m_functionHeader, m_functionBody, varName, noiseTex, noiseTex + "_TexelSize" ); - } - } - } - break; - } - - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT, "dither" + OutputId, functionResult ); - - if( m_inputPorts[ 0 ].IsConnected ) - { - string driver = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - dataCollector.AddLocalVariable( UniqueId, "dither" + OutputId+" = step( dither"+ OutputId + ", "+ driver + " );" ); - } - - //RegisterLocalVariable( 0, functionResult, ref dataCollector, "dither" + OutputId ); - m_outputPorts[ 0 ].SetLocalValue( "dither" + OutputId, dataCollector.PortCategory ); - - return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - m_selectedPatternInt = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - if( UIUtils.CurrentShaderVersion() > 15404 ) - { - m_customScreenPos = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - } - UpdatePorts(); - GeneratePattern(); - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_selectedPatternInt ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_customScreenPos ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DitheringNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DitheringNode.cs.meta deleted file mode 100644 index 0fc9587e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/DitheringNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 284ebed5f88c13e45bc331b2df93aa75 -timeCreated: 1481126954 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeDepthNormalNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeDepthNormalNode.cs deleted file mode 100644 index eec5532e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeDepthNormalNode.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Encode Depth Normal", "Miscellaneous", "Encodes both Depth and Normal values into a Float4 value" )] - public sealed class EncodeDepthNormalNode : ParentNode - { - private const string EncodeDepthNormalFunc = "EncodeDepthNormal( {0}, {1} )"; - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT, false, "Depth" ); - AddInputPort( WirePortDataType.FLOAT3, false, "Normal" ); - AddOutputPort( WirePortDataType.FLOAT4, Constants.EmptyPortValue ); - } - - 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 ); - - dataCollector.AddToIncludes( UniqueId, Constants.UnityCgLibFuncs ); - string depthValue = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - string normalValue = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); - - RegisterLocalVariable( 0, string.Format( EncodeDepthNormalFunc, depthValue, normalValue ), ref dataCollector, "encodedDepthNormal" + OutputId ); - return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeDepthNormalNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeDepthNormalNode.cs.meta deleted file mode 100644 index acc45fcc..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeDepthNormalNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: cabbbe25e4b26b54c84e27007c08a7dd -timeCreated: 1513695146 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeFloatRGBAHlpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeFloatRGBAHlpNode.cs deleted file mode 100644 index b3f95a02..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeFloatRGBAHlpNode.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Encode Float RGBA", "Miscellaneous", "Encodes [0..1] range float into RGBA color, for storage in low precision render target" )] - public sealed class EncodeFloatRGBAHlpNode : HelperParentNode - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_funcType = "EncodeFloatRGBA"; - m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT, false ); - m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT4, false ); - m_outputPorts[ 0 ].Name = "RGBA"; - m_previewShaderGUID = "c21569bf5b9371b4ca13c0c00abd5562"; - } - - protected override void OnUniqueIDAssigned() - { - base.OnUniqueIDAssigned(); - m_localVarName = "encodeFloatRGBA" + OutputId; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeFloatRGBAHlpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeFloatRGBAHlpNode.cs.meta deleted file mode 100644 index 0d25dc4c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeFloatRGBAHlpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 6532496dc1791d94cbb46004000bda61 -timeCreated: 1481126956 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeFloatRGHlpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeFloatRGHlpNode.cs deleted file mode 100644 index 093389e5..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeFloatRGHlpNode.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Encode Float RG ", "Miscellaneous", "Encodes [0..1] range float into a float2" )] - public sealed class EncodeFloatRGHlpNode : HelperParentNode - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_funcType = "EncodeFloatRG "; - m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT, false ); - m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT2, false ); - m_outputPorts[ 0 ].Name = "RG"; - m_previewShaderGUID = "a44b520baa5c39e41bc69a22ea46f24d"; - } - - protected override void OnUniqueIDAssigned() - { - base.OnUniqueIDAssigned(); - m_localVarName = "encodeFloatRG" + OutputId; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeFloatRGHlpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeFloatRGHlpNode.cs.meta deleted file mode 100644 index e5ce8e8b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeFloatRGHlpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: d8bce5e7063ac6b4d93aaf15f7fd1b10 -timeCreated: 1481126959 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeViewNormalStereoHlpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeViewNormalStereoHlpNode.cs deleted file mode 100644 index 767097bc..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeViewNormalStereoHlpNode.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Encode View Normal Stereo", "Miscellaneous", "Encodes view space normal into two numbers in [0..1] range" )] - public sealed class EncodeViewNormalStereoHlpNode : HelperParentNode - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_funcType = "EncodeViewNormalStereo"; - m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT3, false ); - m_inputPorts[ 0 ].Name = "XYZ"; - m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT2, false ); - m_previewShaderGUID = "3d0b3d482b7246c4cb60fa73e6ceac6c"; - } - - protected override void OnUniqueIDAssigned() - { - base.OnUniqueIDAssigned(); - m_localVarName = "encodeViewNormalStereo" + OutputId; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeViewNormalStereoHlpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeViewNormalStereoHlpNode.cs.meta deleted file mode 100644 index 48043ee4..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/EncodeViewNormalStereoHlpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 17511ec398441ac479a2dd77d2531837 -timeCreated: 1481126953 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/GammaToLinearNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/GammaToLinearNode.cs deleted file mode 100644 index afeaae0f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/GammaToLinearNode.cs +++ /dev/null @@ -1,122 +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( "Gamma To Linear", "Image Effects", "Converts color from gamma space to linear space" )] - public sealed class GammaToLinearNode : HelperParentNode - { - public readonly static string[] ModeListStr = { "Fast sRGB to Linear", "Exact sRGB to Linear" }; - public readonly static int[] ModeListInt = { 0, 1 }; - - public readonly static string[] ModeListStrLW = { "Fast sRGB to Linear", "Exact sRGB to Linear", "Gamma 2.0 to Linear", "Gamma 2.2 to Linear" }; - public readonly static int[] ModeListIntLW = { 0, 1, 2, 3 }; - - [SerializeField] - public int m_selectedMode = 0; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_funcType = "GammaToLinearSpace"; - m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT3, false ); - m_inputPorts[ 0 ].Name = "RGB"; - m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT3, false ); - m_autoWrapProperties = true; - m_previewShaderGUID = "e82a888a6ebdb1443823aafceaa051b9"; - m_textLabelWidth = 120; - } - - protected override void OnUniqueIDAssigned() - { - base.OnUniqueIDAssigned(); - m_localVarName = "gammaToLinear" + OutputId; - } - - public override void DrawProperties() - { - base.DrawProperties(); - if( ContainerGraph.IsSRP ) - { - m_selectedMode = EditorGUILayoutIntPopup( "Mode", m_selectedMode, ModeListStrLW, ModeListIntLW ); - EditorGUILayout.HelpBox( "Fast sRGB: fast approximation from sRGB to Linear\n\nExact sRGB: a more expensive but exact calculation from sRGB to Linear.\n\nGamma 2.0: crude approximation from Gamma to Linear using a power of 2.0 gamma value\n\nGamma 2.2: an approximation from Gamma to Linear using a power of 2.2 gamma value", MessageType.None ); - } - else - { - m_selectedMode = EditorGUILayoutIntPopup( "Mode", m_selectedMode, ModeListStr, ModeListInt ); - EditorGUILayout.HelpBox( "Fast sRGB: fast approximation from sRGB to Linear\n\nExact sRGB: a more expensive but exact calculation from sRGB to Linear.", MessageType.None ); - } - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - string result = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - - if( !dataCollector.IsSRP ) - { - m_selectedMode = Mathf.Min( m_selectedMode, 1 ); - - if( m_selectedMode == 1 ) - { - dataCollector.AddLocalVariable( UniqueId, "half3 " + m_localVarName + " = " + result + ";" ); - dataCollector.AddLocalVariable( UniqueId, m_localVarName + " = half3( GammaToLinearSpaceExact(" + m_localVarName + ".r), GammaToLinearSpaceExact(" + m_localVarName + ".g), GammaToLinearSpaceExact(" + m_localVarName + ".b) );" ); - return m_localVarName; - } - return base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); - } - else - { - dataCollector.AddToIncludes( UniqueId, TemplateHelperFunctions.CoreCommonLib ); - dataCollector.AddToIncludes( UniqueId, TemplateHelperFunctions.CoreColorLib ); - switch( m_selectedMode ) - { - default: - case 0: - m_funcLWFormatOverride = "FastSRGBToLinear( {0} )"; - m_funcHDFormatOverride = "FastSRGBToLinear( {0} )"; - break; - case 1: - m_funcLWFormatOverride = "SRGBToLinear( {0} )"; - m_funcHDFormatOverride = "SRGBToLinear( {0} )"; - break; - case 2: - m_funcLWFormatOverride = "Gamma20ToLinear( {0} )"; - m_funcHDFormatOverride = "Gamma20ToLinear( {0} )"; - break; - case 3: - m_funcLWFormatOverride = "Gamma22ToLinear( {0} )"; - m_funcHDFormatOverride = "Gamma22ToLinear( {0} )"; - break; - } - - return base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); - } - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_selectedMode ); - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - if( UIUtils.CurrentShaderVersion() > 11003 && UIUtils.CurrentShaderVersion() <= 14503 ) - { - bool fast = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - if( fast ) - m_selectedMode = 1; - } - - if( UIUtils.CurrentShaderVersion() > 14503 ) - { - m_selectedMode = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/GammaToLinearNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/GammaToLinearNode.cs.meta deleted file mode 100644 index 5c2ec6af..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/GammaToLinearNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: cb2775ac410d0134c85b7f1ac0a0399f -timeCreated: 1481126960 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/HelperParentNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/HelperParentNode.cs deleted file mode 100644 index 79c18bb1..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/HelperParentNode.cs +++ /dev/null @@ -1,93 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -//https://docs.unity3d.com/Manual/SL-BuiltinFunctions.html - -using System; -using UnityEngine; -namespace AmplifyShaderEditor -{ - [Serializable] - public class HelperParentNode : ParentNode - { - [SerializeField] - protected string m_funcType = string.Empty; - - [SerializeField] - protected string m_funcLWFormatOverride = string.Empty; - - [SerializeField] - protected string m_funcHDFormatOverride = string.Empty; - - protected string m_localVarName = null; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT, false, Constants.EmptyPortValue ); - AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); - m_useInternalPortData = true; - } - - public override string GetIncludes() - { - return Constants.UnityCgLibFuncs; - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) - return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); - - base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); - - if( !( dataCollector.IsTemplate && dataCollector.IsSRP ) ) - dataCollector.AddToIncludes( UniqueId, Constants.UnityCgLibFuncs ); - - string concatResults = string.Empty; - bool first = true; - for( int i = 0; i < m_inputPorts.Count; i++ ) - { - if( m_inputPorts[ i ].Visible ) - { - if( !first ) - { - concatResults += " , "; - } - else - { - first = false; - } - - string result = string.Empty; - if( m_inputPorts[ i ].IsConnected ) - { - result = m_inputPorts[ i ].GeneratePortInstructions( ref dataCollector ); - } - else - { - result = m_inputPorts[ i ].WrappedInternalData; - } - - concatResults += result; - } - } - string finalResult = m_funcType + "( " + concatResults + " )"; - if( dataCollector.IsTemplate ) - { - if( dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.Lightweight && !string.IsNullOrEmpty( m_funcLWFormatOverride ) ) - { - finalResult = string.Format( m_funcLWFormatOverride, concatResults ); - } - else if( dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HD && !string.IsNullOrEmpty( m_funcHDFormatOverride ) ) - { - finalResult = string.Format( m_funcHDFormatOverride, concatResults ); - } - - } - - RegisterLocalVariable( 0, finalResult, ref dataCollector, m_localVarName ); - return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/HelperParentNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/HelperParentNode.cs.meta deleted file mode 100644 index 504a4ccc..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/HelperParentNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 0eba64bdadd330743894a0623677cb83 -timeCreated: 1481126953 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/LinearToGammaNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/LinearToGammaNode.cs deleted file mode 100644 index 81171cc4..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/LinearToGammaNode.cs +++ /dev/null @@ -1,127 +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( "Linear To Gamma", "Image Effects", "Converts color from linear space to gamma space" )] - public sealed class LinearToGammaNode : HelperParentNode - { - //[SerializeField] - //private bool m_exact = false; - - //private readonly static GUIContent LGExactContent = new GUIContent( "Exact Conversion", "Uses a precise version of the conversion, it's more expensive and often not needed." ); - - public readonly static string[] ModeListStr = { "Fast Linear to sRGB", "Exact Linear to sRGB" }; - public readonly static int[] ModeListInt = { 0, 1 }; - - public readonly static string[] ModeListStrLW = { "Fast Linear to sRGB", "Exact Linear to sRGB", "Linear to Gamma 2.0", "Linear to Gamma 2.2" }; - public readonly static int[] ModeListIntLW = { 0, 1, 2, 3 }; - - [SerializeField] - public int m_selectedMode = 0; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_funcType = "LinearToGammaSpace"; - m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT3, false ); - m_inputPorts[ 0 ].Name = "RGB"; - m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT3, false ); - m_autoWrapProperties = true; - m_previewShaderGUID = "9027c408b928c5c4d8b450712049d541"; - m_textLabelWidth = 120; - } - - protected override void OnUniqueIDAssigned() - { - base.OnUniqueIDAssigned(); - m_localVarName = "linearToGamma" + OutputId; - } - - public override void DrawProperties() - { - base.DrawProperties(); - if( ContainerGraph.IsSRP ) - { - m_selectedMode = EditorGUILayoutIntPopup( "Mode", m_selectedMode, ModeListStrLW, ModeListIntLW ); - EditorGUILayout.HelpBox( "Fast Linear: fast approximation from Linear to sRGB\n\nExact Linear: a more expensive but exact calculation from Linear to sRGB.\n\nLinear 2.0: crude approximation from Linear to Gamma using a power of 1/2.0 gamma value\n\nLinear 2.2: an approximation from Linear to Gamma using a power of 1/2.2 gamma value", MessageType.None ); - } - else - { - m_selectedMode = EditorGUILayoutIntPopup( "Mode", m_selectedMode, ModeListStr, ModeListInt ); - EditorGUILayout.HelpBox( "Fast Linear: fast approximation from Linear to sRGB\n\nExact Linear: a more expensive but exact calculation from Linear to sRGB.", MessageType.None ); - } - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - string result = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - - if( !dataCollector.IsSRP ) - { - m_selectedMode = Mathf.Min( m_selectedMode, 1 ); - - if( m_selectedMode == 1 ) - { - dataCollector.AddLocalVariable( UniqueId, "half3 " + m_localVarName + " = " + result + ";" ); - dataCollector.AddLocalVariable( UniqueId, m_localVarName + " = half3( LinearToGammaSpaceExact(" + m_localVarName + ".r), LinearToGammaSpaceExact(" + m_localVarName + ".g), LinearToGammaSpaceExact(" + m_localVarName + ".b) );" ); - return m_localVarName; - } - return base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); - } - else - { - dataCollector.AddToIncludes( UniqueId, TemplateHelperFunctions.CoreCommonLib ); - dataCollector.AddToIncludes( UniqueId, TemplateHelperFunctions.CoreColorLib ); - switch( m_selectedMode ) - { - default: - case 0: - m_funcLWFormatOverride = "FastLinearToSRGB( {0} )"; - m_funcHDFormatOverride = "FastLinearToSRGB( {0} )"; - break; - case 1: - m_funcLWFormatOverride = "LinearToSRGB( {0} )"; - m_funcHDFormatOverride = "LinearToSRGB( {0} )"; - break; - case 2: - m_funcLWFormatOverride = "LinearToGamma20( {0} )"; - m_funcHDFormatOverride = "LinearToGamma20( {0} )"; - break; - case 3: - m_funcLWFormatOverride = "LinearToGamma22( {0} )"; - m_funcHDFormatOverride = "LinearToGamma22( {0} )"; - break; - } - - return base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); - } - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_selectedMode ); - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - if( UIUtils.CurrentShaderVersion() > 11003 && UIUtils.CurrentShaderVersion() <= 14503 ) - { - bool fast = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - if( fast ) - m_selectedMode = 1; - } - - if( UIUtils.CurrentShaderVersion() > 14503 ) - { - m_selectedMode = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/LinearToGammaNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/LinearToGammaNode.cs.meta deleted file mode 100644 index a4065b8c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/LinearToGammaNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: a5b8a474628aeca4e86b1599f0b26ebc -timeCreated: 1481126960 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/LuminanceHlpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/LuminanceHlpNode.cs deleted file mode 100644 index 6f9dd6c6..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/LuminanceHlpNode.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Luminance", "Image Effects", "Converts color to luminance (grayscale)", Deprecated = true, DeprecatedAlternativeType = typeof( TFHCGrayscale ), DeprecatedAlternative = "Grayscale" )] - public sealed class LuminanceHlpNode : HelperParentNode - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_funcType = "Luminance"; - m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT3, false ); - m_inputPorts[ 0 ].Name = "RGB"; - m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT, false ); - } - - protected override void OnUniqueIDAssigned() - { - base.OnUniqueIDAssigned(); - m_localVarName = "luminance" + OutputId; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/LuminanceHlpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/LuminanceHlpNode.cs.meta deleted file mode 100644 index 0b33efd1..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/LuminanceHlpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: e8567c2e3eb634a428819fbdfbff110f -timeCreated: 1481126960 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ObjSpaceLightDirHlpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ObjSpaceLightDirHlpNode.cs deleted file mode 100644 index d862fdac..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ObjSpaceLightDirHlpNode.cs +++ /dev/null @@ -1,43 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Object Space Light Dir", "Light", "Computes object space light direction (not normalized)" )] - public sealed class ObjSpaceLightDirHlpNode : HelperParentNode - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_funcType = "ObjSpaceLightDir"; - m_inputPorts[ 0 ].Visible = false; - m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT3, false ); - m_outputPorts[ 0 ].Name = "XYZ"; - - AddOutputPort( WirePortDataType.FLOAT, "X" ); - AddOutputPort( WirePortDataType.FLOAT, "Y" ); - AddOutputPort( WirePortDataType.FLOAT, "Z" ); - - m_useInternalPortData = false; - m_previewShaderGUID = "c7852de24cec4a744b5358921e23feee"; - m_drawPreviewAsSphere = true; - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if( dataCollector.IsTemplate ) - { - //Template must have its Light Mode correctly configured on tags to work as intended - return GetOutputVectorItem( 0, outputId, dataCollector.TemplateDataCollectorInstance.GetObjectSpaceLightDir( CurrentPrecisionType ) ); - } - - dataCollector.AddToIncludes( UniqueId, Constants.UnityCgLibFuncs ); - dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_POS ); - - string vertexPos = GeneratorUtils.GenerateVertexPosition( ref dataCollector, UniqueId, WirePortDataType.FLOAT4 ); - return GetOutputVectorItem( 0, outputId, GeneratorUtils.GenerateObjectLightDirection( ref dataCollector, UniqueId, CurrentPrecisionType, vertexPos ) ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ObjSpaceLightDirHlpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ObjSpaceLightDirHlpNode.cs.meta deleted file mode 100644 index b8965aa4..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ObjSpaceLightDirHlpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 0da9baf35c74c7e468cbe50c3d23ccf0 -timeCreated: 1481126953 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ObjSpaceViewDirHlpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ObjSpaceViewDirHlpNode.cs deleted file mode 100644 index 12c1ef80..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ObjSpaceViewDirHlpNode.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Object Space View Dir", "Object Transform", "Object space direction (not normalized) from given object space vertex position towards the camera" )] - public sealed class ObjSpaceViewDirHlpNode : HelperParentNode - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_funcType = "ObjSpaceViewDir"; - //TODO: revisit this later - m_funcLWFormatOverride = "( mul(GetWorldToObjectMatrix(), float4(_WorldSpaceCameraPos.xyz, 1)).xyz - {0}.xyz )"; - m_funcHDFormatOverride = "( mul(GetWorldToObjectMatrix(), float4(_WorldSpaceCameraPos.xyz, 1)).xyz - {0}.xyz )"; - m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT4, false ); - m_inputPorts[ 0 ].Vector4InternalData = new UnityEngine.Vector4( 0, 0, 0, 1 ); - m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT3, false ); - m_outputPorts[ 0 ].Name = "XYZ"; - AddOutputPort( WirePortDataType.FLOAT, "X" ); - AddOutputPort( WirePortDataType.FLOAT, "Y" ); - AddOutputPort( WirePortDataType.FLOAT, "Z" ); - m_previewShaderGUID = "c7852de24cec4a744b5358921e23feee"; - } - - protected override void OnUniqueIDAssigned() - { - base.OnUniqueIDAssigned(); - m_localVarName = "objectSpaceViewDir" + OutputId; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ObjSpaceViewDirHlpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ObjSpaceViewDirHlpNode.cs.meta deleted file mode 100644 index fc6c58f3..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ObjSpaceViewDirHlpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 590b8e54b63ad344f8d8c372e4fc5ed5 -timeCreated: 1481126955 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ParallaxMappingNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ParallaxMappingNode.cs deleted file mode 100644 index 929f41ba..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ParallaxMappingNode.cs +++ /dev/null @@ -1,148 +0,0 @@ -using UnityEngine; -using UnityEditor; - -using System; -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Parallax Mapping", "UV Coordinates", "Calculates offseted UVs for parallax mapping" )] - public sealed class ParallaxMappingNode : ParentNode - { - private enum ParallaxType { Normal, Planar } - - [SerializeField] - private int m_selectedParallaxTypeInt = 0; - - [SerializeField] - private ParallaxType m_selectedParallaxType = ParallaxType.Normal; - - private readonly string[] m_parallaxTypeStr = { "Normal", "Planar" }; - - private int m_cachedPropertyId = -1; - - private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper(); - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT2, false, "UV" ); - AddInputPort( WirePortDataType.FLOAT, false, "Height" ); - AddInputPort( WirePortDataType.FLOAT, false, "Scale" ); - AddInputPort( WirePortDataType.FLOAT3, false, "ViewDir (tan)" ); - AddOutputPort( WirePortDataType.FLOAT2, "Out" ); - m_useInternalPortData = true; - m_autoDrawInternalPortData = true; - m_autoWrapProperties = true; - m_textLabelWidth = 105; - UpdateTitle(); - m_forceDrawPreviewAsPlane = true; - m_hasLeftDropdown = true; - m_previewShaderGUID = "589f12f68e00ac74286815aa56053fcc"; - } - - public override void Destroy() - { - base.Destroy(); - m_upperLeftWidget = null; - } - - public override void SetPreviewInputs() - { - base.SetPreviewInputs(); - - if( m_cachedPropertyId == -1 ) - m_cachedPropertyId = Shader.PropertyToID( "_ParallaxType" ); - - PreviewMaterial.SetFloat( m_cachedPropertyId, ( m_selectedParallaxType == ParallaxType.Normal ? 0 : 1 ) ); - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); - - string textcoords = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - string height = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); - string scale = m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ); - string viewDirTan = m_inputPorts[ 3 ].GeneratePortInstructions( ref dataCollector ); - string localVarName = "Offset" + OutputId; - string calculation = ""; - - switch( m_selectedParallaxType ) - { - default: - case ParallaxType.Normal: - calculation = "( ( " + height + " - 1 ) * " + viewDirTan + ".xy * " + scale + " ) + " + textcoords; - break; - case ParallaxType.Planar: - calculation = "( ( " + height + " - 1 ) * ( " + viewDirTan + ".xy / " + viewDirTan + ".z ) * " + scale + " ) + " + textcoords; - break; - } - - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, m_outputPorts[ 0 ].DataType, localVarName, calculation ); - //dataCollector.AddToLocalVariables( UniqueId, m_currentPrecisionType, m_outputPorts[ 0 ].DataType, localVarName, calculation ); - return GetOutputVectorItem( 0, outputId, localVarName ); - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - EditorGUI.BeginChangeCheck(); - m_selectedParallaxTypeInt = m_upperLeftWidget.DrawWidget( this, m_selectedParallaxTypeInt, m_parallaxTypeStr ); - if( EditorGUI.EndChangeCheck() ) - { - switch( m_selectedParallaxTypeInt ) - { - default: - case 0: m_selectedParallaxType = ParallaxType.Normal; break; - case 1: m_selectedParallaxType = ParallaxType.Planar; break; - } - UpdateTitle(); - } - } - - public override void DrawProperties() - { - base.DrawProperties(); - - EditorGUI.BeginChangeCheck(); - m_selectedParallaxTypeInt = EditorGUILayoutPopup( "Parallax Type", m_selectedParallaxTypeInt, m_parallaxTypeStr ); - if( EditorGUI.EndChangeCheck() ) - { - switch( m_selectedParallaxTypeInt ) - { - default: - case 0: m_selectedParallaxType = ParallaxType.Normal; break; - case 1: m_selectedParallaxType = ParallaxType.Planar; break; - } - UpdateTitle(); - } - - EditorGUILayout.HelpBox( "Normal type does a cheaper approximation thats view dependent while Planar is more accurate but generates higher aliasing artifacts at steep angles.", MessageType.None ); - } - - - void UpdateTitle() - { - m_additionalContent.text = string.Format( Constants.SubTitleTypeFormatStr, m_parallaxTypeStr[ m_selectedParallaxTypeInt ] ); - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - m_selectedParallaxType = (ParallaxType)Enum.Parse( typeof( ParallaxType ), GetCurrentParam( ref nodeParams ) ); - switch( m_selectedParallaxType ) - { - default: - case ParallaxType.Normal: m_selectedParallaxTypeInt = 0; break; - case ParallaxType.Planar: m_selectedParallaxTypeInt = 1; break; - } - UpdateTitle(); - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_selectedParallaxType ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ParallaxMappingNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ParallaxMappingNode.cs.meta deleted file mode 100644 index 97f1c33e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ParallaxMappingNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 96d8f50a7481d5247b16cb16c053d5f6 -timeCreated: 1481126957 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ParallaxOcclusionMappingNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ParallaxOcclusionMappingNode.cs deleted file mode 100644 index a956b231..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ParallaxOcclusionMappingNode.cs +++ /dev/null @@ -1,744 +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 -{ - enum POMTexTypes - { - Texture2D, - Texture3D, - TextureArray - }; - - [Serializable] - [NodeAttributes( "Parallax Occlusion Mapping", "UV Coordinates", "Calculates offseted UVs for parallax occlusion mapping" )] - public sealed class ParallaxOcclusionMappingNode : ParentNode - { - private const string ArrayIndexStr = "Array Index"; - private const string Tex3DSliceStr = "Tex3D Slice"; - - private readonly string[] m_channelTypeStr = { "Red Channel", "Green Channel", "Blue Channel", "Alpha Channel" }; - private readonly string[] m_channelTypeVal = { "r", "g", "b", "a" }; - - [SerializeField] - private int m_selectedChannelInt = 0; - - //[SerializeField] - //private int m_minSamples = 8; - - //[SerializeField] - //private int m_maxSamples = 16; - [SerializeField] - private InlineProperty m_inlineMinSamples = new InlineProperty( 8 ); - - [SerializeField] - private InlineProperty m_inlineMaxSamples = new InlineProperty( 16 ); - - [ SerializeField] - private int m_sidewallSteps = 2; - - [SerializeField] - private float m_defaultScale = 0.02f; - - [SerializeField] - private float m_defaultRefPlane = 0f; - - [SerializeField] - private bool m_clipEnds = false; - - [SerializeField] - private Vector2 m_tilling = new Vector2( 1, 1 ); - - [SerializeField] - private bool m_useCurvature = false; - - //[SerializeField] - //private bool m_useTextureArray = false; - [SerializeField] - private POMTexTypes m_pomTexType = POMTexTypes.Texture2D; - - //[SerializeField] - //private bool m_useCurvature = false; - - [SerializeField] - private Vector2 m_CurvatureVector = new Vector2( 0, 0 ); - - private string m_functionHeader = "POM( {0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11}, {12}, {13} )"; - private string m_functionBody = string.Empty; - - //private const string WorldDirVarStr = "worldViewDir"; - - private InputPort m_uvPort; - private InputPort m_texPort; - private InputPort m_scalePort; - private InputPort m_viewdirTanPort; - private InputPort m_refPlanePort; - private InputPort m_curvaturePort; - private InputPort m_arrayIndexPort; - - private OutputPort m_pomUVPort; - - private Vector4Node m_texCoordsHelper; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT2, false, "UV" ); - AddInputPort( WirePortDataType.SAMPLER2D, false, "Tex" ); - AddInputPort( WirePortDataType.FLOAT, false, "Scale" ); - AddInputPort( WirePortDataType.FLOAT3, false, "ViewDir (tan)" ); - AddInputPort( WirePortDataType.FLOAT, false, "Ref Plane" ); - AddInputPort( WirePortDataType.FLOAT2, false, "Curvature" ); - AddInputPort( WirePortDataType.FLOAT, false, ArrayIndexStr ); - AddOutputPort( WirePortDataType.FLOAT2, "Out" ); - - m_uvPort = m_inputPorts[ 0 ]; - m_texPort = m_inputPorts[ 1 ]; - m_scalePort = m_inputPorts[ 2 ]; - m_viewdirTanPort = m_inputPorts[ 3 ]; - m_refPlanePort = m_inputPorts[ 4 ]; - m_pomUVPort = m_outputPorts[ 0 ]; - m_curvaturePort = m_inputPorts[ 5 ]; - m_arrayIndexPort = m_inputPorts[ 6 ]; - m_scalePort.FloatInternalData = 0.02f; - m_useInternalPortData = false; - m_textLabelWidth = 130; - m_autoWrapProperties = true; - m_curvaturePort.Visible = false; - m_arrayIndexPort.Visible = false; - UpdateSampler(); - } - - public override void DrawProperties() - { - base.DrawProperties(); - - EditorGUI.BeginChangeCheck(); - m_selectedChannelInt = EditorGUILayoutPopup( "Channel", m_selectedChannelInt, m_channelTypeStr ); - if ( EditorGUI.EndChangeCheck() ) - { - UpdateSampler(); - GeneratePOMfunction(); - } - EditorGUIUtility.labelWidth = 105; - - //m_minSamples = EditorGUILayoutIntSlider( "Min Samples", m_minSamples, 1, 128 ); - UndoParentNode inst = this; - m_inlineMinSamples.CustomDrawer( ref inst, ( x ) => { m_inlineMinSamples.IntValue = EditorGUILayoutIntSlider( "Min Samples", m_inlineMinSamples.IntValue, 1, 128 ); }, "Min Samples" ); - //m_maxSamples = EditorGUILayoutIntSlider( "Max Samples", m_maxSamples, 1, 128 ); - m_inlineMaxSamples.CustomDrawer( ref inst, ( x ) => { m_inlineMaxSamples.IntValue = EditorGUILayoutIntSlider( "Max Samples", m_inlineMaxSamples.IntValue, 1, 128 ); }, "Max Samples" ); - - EditorGUI.BeginChangeCheck(); - m_sidewallSteps = EditorGUILayoutIntSlider( "Sidewall Steps", m_sidewallSteps, 0, 10 ); - if ( EditorGUI.EndChangeCheck() ) - { - GeneratePOMfunction(); - } - - - EditorGUI.BeginDisabledGroup(m_scalePort.IsConnected ); - m_defaultScale = EditorGUILayoutSlider( "Default Scale", m_defaultScale, 0, 1 ); - EditorGUI.EndDisabledGroup(); - - EditorGUI.BeginDisabledGroup( m_refPlanePort.IsConnected ); - m_defaultRefPlane = EditorGUILayoutSlider( "Default Ref Plane", m_defaultRefPlane, 0, 1 ); - EditorGUI.EndDisabledGroup(); - EditorGUIUtility.labelWidth = m_textLabelWidth; - EditorGUI.BeginChangeCheck(); - //m_useTextureArray = EditorGUILayoutToggle( "Use Texture Array", m_useTextureArray ); - m_pomTexType = (POMTexTypes)EditorGUILayoutEnumPopup( "Texture Type", m_pomTexType ); - if( EditorGUI.EndChangeCheck() ) - { - UpdateIndexPort(); - m_sizeIsDirty = true; - GeneratePOMfunction(); - //UpdateCurvaturePort(); - } - - if( m_arrayIndexPort.Visible && !m_arrayIndexPort.IsConnected ) - { - m_arrayIndexPort.FloatInternalData = EditorGUILayoutFloatField( "Array Index", m_arrayIndexPort.FloatInternalData ); - } - - //float cached = EditorGUIUtility.labelWidth; - //EditorGUIUtility.labelWidth = 70; - m_clipEnds = EditorGUILayoutToggle( "Clip Edges", m_clipEnds ); - //EditorGUIUtility.labelWidth = -1; - //EditorGUIUtility.labelWidth = 100; - //EditorGUILayout.BeginHorizontal(); - //EditorGUI.BeginDisabledGroup( !m_clipEnds ); - //m_tilling = EditorGUILayout.Vector2Field( string.Empty, m_tilling ); - //EditorGUI.EndDisabledGroup(); - //EditorGUILayout.EndHorizontal(); - //EditorGUIUtility.labelWidth = cached; - - EditorGUI.BeginChangeCheck(); - m_useCurvature = EditorGUILayoutToggle( "Clip Silhouette", m_useCurvature ); - if ( EditorGUI.EndChangeCheck() ) - { - GeneratePOMfunction(); - UpdateCurvaturePort(); - } - - EditorGUI.BeginDisabledGroup( !(m_useCurvature && !m_curvaturePort.IsConnected) ); - m_CurvatureVector = EditorGUILayoutVector2Field( string.Empty, m_CurvatureVector ); - EditorGUI.EndDisabledGroup(); - - EditorGUILayout.HelpBox( "WARNING:\nTex must be connected to a Texture Object for this node to work\n\nMin and Max samples:\nControl the minimum and maximum number of layers extruded\n\nSidewall Steps:\nThe number of interpolations done to smooth the extrusion result on the side of the layer extrusions, min is used at steep angles while max is used at orthogonal angles\n\n"+ - "Ref Plane:\nReference plane lets you adjust the starting reference height, 0 = deepen ground, 1 = raise ground, any value above 0 might cause distortions at higher angles\n\n"+ - "Clip Edges:\nThis will clip the ends of your uvs to give a more 3D look at the edges. It'll use the tilling given by your Heightmap input.\n\n"+ - "Clip Silhouette:\nTurning this on allows you to use the UV coordinates to clip the effect curvature in U or V axis, useful for cylinders, works best with 'Clip Edges' turned OFF", MessageType.None ); - } - - private void UpdateIndexPort() - { - m_arrayIndexPort.Visible = m_pomTexType != POMTexTypes.Texture2D; - if( m_arrayIndexPort.Visible ) - { - m_arrayIndexPort.Name = m_pomTexType == POMTexTypes.Texture3D ? Tex3DSliceStr : ArrayIndexStr; - } - } - - private void UpdateSampler() - { - m_texPort.Name = "Tex (" + m_channelTypeVal[ m_selectedChannelInt ].ToUpper() + ")"; - } - - private void UpdateCurvaturePort() - { - if ( m_useCurvature ) - m_curvaturePort.Visible = true; - else - m_curvaturePort.Visible = false; - - m_sizeIsDirty = true; - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if( !m_texPort.IsConnected ) - { - UIUtils.ShowMessage( UniqueId, "Parallax Occlusion Mapping node only works if a Texture Object is connected to its Tex (R) port" ); - return "0"; - } - base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); - WirePortDataType texType = ( m_pomTexType == POMTexTypes.Texture3D )?WirePortDataType.SAMPLER3D: WirePortDataType.SAMPLER2D; - - GeneratePOMfunction(); - string arrayIndex = m_arrayIndexPort.Visible?m_arrayIndexPort.GeneratePortInstructions( ref dataCollector ):"0"; - string textcoords = m_uvPort.GeneratePortInstructions( ref dataCollector ); - if( m_pomTexType == POMTexTypes.Texture3D ) - { - string texName = "pomTexCoord" + OutputId; - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT3, texName, string.Format( "float3({0},{1})", textcoords, arrayIndex ) ); - textcoords = texName; - } - - string texture = m_texPort.GenerateShaderForOutput( ref dataCollector, texType,false,true ); - string scale = m_defaultScale.ToString(); - if( m_scalePort.IsConnected ) - scale = m_scalePort.GeneratePortInstructions( ref dataCollector ); - - string viewDirTan = ""; - if ( !m_viewdirTanPort.IsConnected ) - { - if ( !dataCollector.DirtyNormal ) - dataCollector.ForceNormal = true; - - - if ( dataCollector.IsTemplate ) - { - viewDirTan = dataCollector.TemplateDataCollectorInstance.GetTangentViewDir( CurrentPrecisionType ); - } - else - { - viewDirTan = GeneratorUtils.GenerateViewDirection( ref dataCollector, UniqueId, ViewSpace.Tangent ); - //dataCollector.AddToInput( UniqueId, SurfaceInputs.VIEW_DIR, m_currentPrecisionType ); - //viewDirTan = Constants.InputVarStr + "." + UIUtils.GetInputValueFromType( SurfaceInputs.VIEW_DIR ); - } - } - else - { - viewDirTan = m_viewdirTanPort.GeneratePortInstructions( ref dataCollector ); - } - - //generate world normal - string normalWorld = string.Empty; - if ( dataCollector.IsTemplate ) - { - normalWorld = dataCollector.TemplateDataCollectorInstance.GetWorldNormal( CurrentPrecisionType ); - } - else - { - dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_NORMAL, CurrentPrecisionType ); - dataCollector.AddToInput( UniqueId, SurfaceInputs.INTERNALDATA, addSemiColon: false ); - normalWorld = GeneratorUtils.GenerateWorldNormal( ref dataCollector, UniqueId ); - } - - //string normalWorld = "WorldNormalVector( " + Constants.InputVarStr + ", float3( 0, 0, 1 ) )"; - - //generate viewDir in world space - - //string worldPos = string.Empty; - //if( dataCollector.IsTemplate ) - //{ - // worldPos = dataCollector.TemplateDataCollectorInstance.GetWorldPos(); - //} - //else - //{ - // dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_POS ); - // worldPos = Constants.InputVarStr + ".worldPos"; - //} - - //if( !dataCollector.IsTemplate ) - // dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_POS ); - - string worldViewDir = GeneratorUtils.GenerateViewDirection( ref dataCollector, UniqueId, ViewSpace.World ); - //dataCollector.AddToLocalVariables( UniqueId, m_currentPrecisionType, WirePortDataType.FLOAT3, WorldDirVarStr, TemplateHelperFunctions.WorldSpaceViewDir( dataCollector, worldPos, true ) ); - string dx = "ddx("+ textcoords + ")"; - string dy = "ddy(" + textcoords + ")"; - - string refPlane = m_defaultRefPlane.ToString(); - if ( m_refPlanePort.IsConnected ) - refPlane = m_refPlanePort.GeneratePortInstructions( ref dataCollector ); - - - string curvature = "float2("+ m_CurvatureVector.x + "," + m_CurvatureVector.y + ")"; - if ( m_useCurvature ) - { - dataCollector.AddToProperties( UniqueId, "[Header(Parallax Occlusion Mapping)]", 300 ); - dataCollector.AddToProperties( UniqueId, "_CurvFix(\"Curvature Bias\", Range( 0 , 1)) = 1", 301 ); - dataCollector.AddToUniforms( UniqueId, "uniform float _CurvFix;" ); - - if ( m_curvaturePort.IsConnected ) - curvature = m_curvaturePort.GeneratePortInstructions( ref dataCollector ); - } - - - string localVarName = "OffsetPOM" + OutputId; - string textCoordsST = string.Empty; - //string textureSTType = dataCollector.IsSRP ? "float4 " : "uniform float4 "; - //dataCollector.AddToUniforms( UniqueId, textureSTType + texture +"_ST;"); - if( m_texCoordsHelper == null ) - { - m_texCoordsHelper = CreateInstance<Vector4Node>(); - m_texCoordsHelper.ContainerGraph = ContainerGraph; - m_texCoordsHelper.SetBaseUniqueId( UniqueId, true ); - m_texCoordsHelper.RegisterPropertyOnInstancing = false; - m_texCoordsHelper.AddGlobalToSRPBatcher = true; - } - - if( UIUtils.CurrentWindow.OutsideGraph.IsInstancedShader ) - { - m_texCoordsHelper.CurrentParameterType = PropertyType.InstancedProperty; - } - else - { - m_texCoordsHelper.CurrentParameterType = PropertyType.Global; - } - m_texCoordsHelper.ResetOutputLocals(); - m_texCoordsHelper.SetRawPropertyName( texture + "_ST" ); - textCoordsST = m_texCoordsHelper.GenerateShaderForOutput( 0, ref dataCollector, false ); - ////// - - if( m_pomTexType == POMTexTypes.TextureArray ) - dataCollector.UsingArrayDerivatives = true; - string textureArgs = string.Empty; - if( m_pomTexType == POMTexTypes.TextureArray ) - { - if( UIUtils.CurrentWindow.OutsideGraph.IsSRP ) - { - textureArgs = "TEXTURE2D_ARRAY_ARGS( " + texture + ", sampler" + texture + ")"; - } - else - { - textureArgs = "UNITY_PASS_TEX2DARRAY(" + texture + ")"; - } - } - else - { - bool sampleThroughMacros = UIUtils.CurrentWindow.OutsideGraph.SamplingThroughMacros; - if( sampleThroughMacros ) - { - dataCollector.AddToUniforms( UniqueId, string.Format( Constants.SamplerDeclarationSRPMacros[ TextureType.Texture2D ], texture ) ); - textureArgs = string.Format( "{0},sampler{0}", texture ); - } - else - { - textureArgs = texture; - } - } - //string functionResult = dataCollector.AddFunctions( m_functionHeader, m_functionBody, ( (m_pomTexType == POMTexTypes.TextureArray) ? "UNITY_PASS_TEX2DARRAY(" + texture + ")": texture), textcoords, dx, dy, normalWorld, worldViewDir, viewDirTan, m_minSamples, m_maxSamples, scale, refPlane, texture+"_ST.xy", curvature, arrayIndex ); - string functionResult = dataCollector.AddFunctions( m_functionHeader, m_functionBody, textureArgs, textcoords, dx, dy, normalWorld, worldViewDir, viewDirTan, m_inlineMinSamples.GetValueOrProperty(false), m_inlineMinSamples.GetValueOrProperty(false), scale, refPlane, textCoordsST + ".xy", curvature, arrayIndex ); - - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, m_pomUVPort.DataType, localVarName, functionResult ); - - return GetOutputVectorItem( 0, outputId, localVarName ); - } - - private void GeneratePOMfunction() - { - bool sampleThroughMacros = UIUtils.CurrentWindow.OutsideGraph.SamplingThroughMacros; - m_functionBody = string.Empty; - switch( m_pomTexType ) - { - default: - case POMTexTypes.Texture2D: - { - string sampleParam = sampleThroughMacros ? "TEXTURE2D_PARAM(heightMap,samplerheightMap)" : "sampler2D heightMap"; - IOUtils.AddFunctionHeader( ref m_functionBody, string.Format("inline float2 POM( {0}, float2 uvs, float2 dx, float2 dy, float3 normalWorld, float3 viewWorld, float3 viewDirTan, int minSamples, int maxSamples, float parallax, float refPlane, float2 tilling, float2 curv, int index )", sampleParam )); - } - break; - case POMTexTypes.Texture3D: - { - string sampleParam = sampleThroughMacros ? "TEXTURE3D_PARAM( heightMap,samplerheightMap) " : "sampler3D heightMap"; - IOUtils.AddFunctionHeader( ref m_functionBody, string.Format("inline float2 POM( {0}, float3 uvs, float3 dx, float3 dy, float3 normalWorld, float3 viewWorld, float3 viewDirTan, int minSamples, int maxSamples, float parallax, float refPlane, float2 tilling, float2 curv, int index )", sampleParam ) ); - } - break; - case POMTexTypes.TextureArray: - if( UIUtils.CurrentWindow.OutsideGraph.IsSRP ) - IOUtils.AddFunctionHeader( ref m_functionBody, "inline float2 POM( TEXTURE2D_ARRAY_PARAM(heightMap,samplerheightMap), float2 uvs, float2 dx, float2 dy, float3 normalWorld, float3 viewWorld, float3 viewDirTan, int minSamples, int maxSamples, float parallax, float refPlane, float2 tilling, float2 curv, int index )" ); - else - IOUtils.AddFunctionHeader( ref m_functionBody, "inline float2 POM( UNITY_ARGS_TEX2DARRAY(heightMap), float2 uvs, float2 dx, float2 dy, float3 normalWorld, float3 viewWorld, float3 viewDirTan, int minSamples, int maxSamples, float parallax, float refPlane, float2 tilling, float2 curv, int index )" ); - break; - } - - IOUtils.AddFunctionLine( ref m_functionBody, "float3 result = 0;" ); - IOUtils.AddFunctionLine( ref m_functionBody, "int stepIndex = 0;" ); - //IOUtils.AddFunctionLine( ref m_functionBody, "int numSteps = ( int )( minSamples + dot( viewWorld, normalWorld ) * ( maxSamples - minSamples ) );" ); - //IOUtils.AddFunctionLine( ref m_functionBody, "int numSteps = ( int )lerp( maxSamples, minSamples, length( fwidth( uvs ) ) * 10 );" ); - IOUtils.AddFunctionLine( ref m_functionBody, "int numSteps = ( int )lerp( (float)maxSamples, (float)minSamples, saturate( dot( normalWorld, viewWorld ) ) );" ); - IOUtils.AddFunctionLine( ref m_functionBody, "float layerHeight = 1.0 / numSteps;" ); - IOUtils.AddFunctionLine( ref m_functionBody, "float2 plane = parallax * ( viewDirTan.xy / viewDirTan.z );" ); - - switch( m_pomTexType ) - { - default: - case POMTexTypes.Texture2D: - IOUtils.AddFunctionLine( ref m_functionBody, "uvs += refPlane * plane;" ); - break; - case POMTexTypes.Texture3D: - IOUtils.AddFunctionLine( ref m_functionBody, "uvs.xy += refPlane * plane;" ); - break; - case POMTexTypes.TextureArray: - IOUtils.AddFunctionLine( ref m_functionBody, "uvs += refPlane * plane;" ); - break; - } - - IOUtils.AddFunctionLine( ref m_functionBody, "float2 deltaTex = -plane * layerHeight;" ); - IOUtils.AddFunctionLine( ref m_functionBody, "float2 prevTexOffset = 0;" ); - IOUtils.AddFunctionLine( ref m_functionBody, "float prevRayZ = 1.0f;" ); - IOUtils.AddFunctionLine( ref m_functionBody, "float prevHeight = 0.0f;" ); - IOUtils.AddFunctionLine( ref m_functionBody, "float2 currTexOffset = deltaTex;" ); - IOUtils.AddFunctionLine( ref m_functionBody, "float currRayZ = 1.0f - layerHeight;" ); - IOUtils.AddFunctionLine( ref m_functionBody, "float currHeight = 0.0f;" ); - IOUtils.AddFunctionLine( ref m_functionBody, "float intersection = 0;" ); - IOUtils.AddFunctionLine( ref m_functionBody, "float2 finalTexOffset = 0;" ); - IOUtils.AddFunctionLine( ref m_functionBody, "while ( stepIndex < numSteps + 1 )" ); - IOUtils.AddFunctionLine( ref m_functionBody, "{" ); - if( m_useCurvature ) - { - IOUtils.AddFunctionLine( ref m_functionBody, " result.z = dot( curv, currTexOffset * currTexOffset );" ); - - - switch( m_pomTexType ) - { - default: - case POMTexTypes.Texture2D: - { - if( sampleThroughMacros ) - { - IOUtils.AddFunctionLine( ref m_functionBody, " currHeight = SAMPLE_TEXTURE2D_GRAD( heightMap, samplerheightMap, uvs + currTexOffset, dx, dy )." + m_channelTypeVal[ m_selectedChannelInt ] + " * ( 1 - result.z );" ); - } - else - { - IOUtils.AddFunctionLine( ref m_functionBody, " currHeight = tex2Dgrad( heightMap, uvs + currTexOffset, dx, dy )." + m_channelTypeVal[ m_selectedChannelInt ] + " * ( 1 - result.z );" ); - } - } - break; - case POMTexTypes.Texture3D: - { - if( sampleThroughMacros ) - { - IOUtils.AddFunctionLine( ref m_functionBody, " currHeight = SAMPLE_TEXTURE2D_GRAD( heightMap, samplerheightMap, uvs + float3(currTexOffset,0), dx, dy )." + m_channelTypeVal[ m_selectedChannelInt ] + " * ( 1 - result.z );" ); - } - else - { - IOUtils.AddFunctionLine( ref m_functionBody, " currHeight = tex3Dgrad( heightMap, uvs + float3(currTexOffset,0), dx, dy )." + m_channelTypeVal[ m_selectedChannelInt ] + " * ( 1 - result.z );" ); - } - } - break; - case POMTexTypes.TextureArray: - if( UIUtils.CurrentWindow.OutsideGraph.IsSRP ) - IOUtils.AddFunctionLine( ref m_functionBody, " currHeight = SAMPLE_TEXTURE2D_ARRAY_GRAD( heightMap,samplerheightMap, uvs + currTexOffset,index, dx, dy )." + m_channelTypeVal[ m_selectedChannelInt ] + " * ( 1 - result.z );" ); - else - IOUtils.AddFunctionLine( ref m_functionBody, " currHeight = ASE_SAMPLE_TEX2DARRAY_GRAD( heightMap, float3(uvs + currTexOffset,index), dx, dy )." + m_channelTypeVal[ m_selectedChannelInt ] + " * ( 1 - result.z );" ); - break; - } - - } - else - { - switch( m_pomTexType ) - { - default: - case POMTexTypes.Texture2D: - { - if( sampleThroughMacros ) - { - IOUtils.AddFunctionLine( ref m_functionBody, " currHeight = SAMPLE_TEXTURE2D_GRAD( heightMap,samplerheightMap, uvs + currTexOffset, dx, dy )." + m_channelTypeVal[ m_selectedChannelInt ] + ";" ); - } - else - { - IOUtils.AddFunctionLine( ref m_functionBody, " currHeight = tex2Dgrad( heightMap, uvs + currTexOffset, dx, dy )." + m_channelTypeVal[ m_selectedChannelInt ] + ";" ); - } - } - break; - case POMTexTypes.Texture3D: - { - if( sampleThroughMacros ) - { - IOUtils.AddFunctionLine( ref m_functionBody, " currHeight = SAMPLE_TEXTURE2D_GRAD( heightMap, samplerheightMap, uvs + float3(currTexOffset,0), dx, dy )." + m_channelTypeVal[ m_selectedChannelInt ] + ";" ); - } - else - { - IOUtils.AddFunctionLine( ref m_functionBody, " currHeight = tex3Dgrad( heightMap, uvs + float3(currTexOffset,0), dx, dy )." + m_channelTypeVal[ m_selectedChannelInt ] + ";" ); - } - } - break; - case POMTexTypes.TextureArray: - if( UIUtils.CurrentWindow.OutsideGraph.IsSRP ) - IOUtils.AddFunctionLine( ref m_functionBody, " currHeight = SAMPLE_TEXTURE2D_ARRAY_GRAD( heightMap, samplerheightMap, uvs + currTexOffset,index, dx, dy )." + m_channelTypeVal[ m_selectedChannelInt ] + ";" ); - else - IOUtils.AddFunctionLine( ref m_functionBody, " currHeight = ASE_SAMPLE_TEX2DARRAY_GRAD( heightMap, float3(uvs + currTexOffset,index), dx, dy )." + m_channelTypeVal[ m_selectedChannelInt ] + ";" ); - break; - } - } - IOUtils.AddFunctionLine( ref m_functionBody, " if ( currHeight > currRayZ )" ); - IOUtils.AddFunctionLine( ref m_functionBody, " {" ); - IOUtils.AddFunctionLine( ref m_functionBody, " stepIndex = numSteps + 1;" ); - IOUtils.AddFunctionLine( ref m_functionBody, " }" ); - IOUtils.AddFunctionLine( ref m_functionBody, " else" ); - IOUtils.AddFunctionLine( ref m_functionBody, " {" ); - IOUtils.AddFunctionLine( ref m_functionBody, " stepIndex++;" ); - IOUtils.AddFunctionLine( ref m_functionBody, " prevTexOffset = currTexOffset;" ); - IOUtils.AddFunctionLine( ref m_functionBody, " prevRayZ = currRayZ;" ); - IOUtils.AddFunctionLine( ref m_functionBody, " prevHeight = currHeight;" ); - IOUtils.AddFunctionLine( ref m_functionBody, " currTexOffset += deltaTex;" ); - if ( m_useCurvature ) - IOUtils.AddFunctionLine( ref m_functionBody, " currRayZ -= layerHeight * ( 1 - result.z ) * (1+_CurvFix);" ); - else - IOUtils.AddFunctionLine( ref m_functionBody, " currRayZ -= layerHeight;" ); - IOUtils.AddFunctionLine( ref m_functionBody, " }" ); - IOUtils.AddFunctionLine( ref m_functionBody, "}" ); - - if ( m_sidewallSteps > 0 ) - { - IOUtils.AddFunctionLine( ref m_functionBody, "int sectionSteps = " + m_sidewallSteps + ";" ); - IOUtils.AddFunctionLine( ref m_functionBody, "int sectionIndex = 0;" ); - IOUtils.AddFunctionLine( ref m_functionBody, "float newZ = 0;" ); - IOUtils.AddFunctionLine( ref m_functionBody, "float newHeight = 0;" ); - IOUtils.AddFunctionLine( ref m_functionBody, "while ( sectionIndex < sectionSteps )" ); - IOUtils.AddFunctionLine( ref m_functionBody, "{" ); - IOUtils.AddFunctionLine( ref m_functionBody, " intersection = ( prevHeight - prevRayZ ) / ( prevHeight - currHeight + currRayZ - prevRayZ );" ); - IOUtils.AddFunctionLine( ref m_functionBody, " finalTexOffset = prevTexOffset + intersection * deltaTex;" ); - IOUtils.AddFunctionLine( ref m_functionBody, " newZ = prevRayZ - intersection * layerHeight;" ); - - switch( m_pomTexType ) - { - default: - case POMTexTypes.Texture2D: - { - if( sampleThroughMacros ) - { - IOUtils.AddFunctionLine( ref m_functionBody, " newHeight = SAMPLE_TEXTURE2D_GRAD( heightMap, samplerheightMap, uvs + finalTexOffset, dx, dy )." + m_channelTypeVal[ m_selectedChannelInt ] + ";" ); - } - else - { - IOUtils.AddFunctionLine( ref m_functionBody, " newHeight = tex2Dgrad( heightMap, uvs + finalTexOffset, dx, dy )." + m_channelTypeVal[ m_selectedChannelInt ] + ";" ); - } - } - break; - case POMTexTypes.Texture3D: - { - if( sampleThroughMacros ) - { - IOUtils.AddFunctionLine( ref m_functionBody, " newHeight = SAMPLE_TEXTURE2D_GRAD( heightMap, samplerheightMap, uvs + float3(finalTexOffset,0), dx, dy )." + m_channelTypeVal[ m_selectedChannelInt ] + ";" ); - } - else - { - IOUtils.AddFunctionLine( ref m_functionBody, " newHeight = tex3Dgrad( heightMap, uvs + float3(finalTexOffset,0), dx, dy )." + m_channelTypeVal[ m_selectedChannelInt ] + ";" ); - } - } - break; - case POMTexTypes.TextureArray: - if( UIUtils.CurrentWindow.OutsideGraph.IsSRP ) - IOUtils.AddFunctionLine( ref m_functionBody, " newHeight = SAMPLE_TEXTURE2D_ARRAY_GRAD( heightMap, samplerheightMap, uvs + finalTexOffset,index, dx, dy )." + m_channelTypeVal[ m_selectedChannelInt ] + ";" ); - else - IOUtils.AddFunctionLine( ref m_functionBody, " newHeight = ASE_SAMPLE_TEX2DARRAY_GRAD( heightMap, float3(uvs + finalTexOffset,index), dx, dy )." + m_channelTypeVal[ m_selectedChannelInt ] + ";" ); - break; - } - - IOUtils.AddFunctionLine( ref m_functionBody, " if ( newHeight > newZ )" ); - IOUtils.AddFunctionLine( ref m_functionBody, " {" ); - IOUtils.AddFunctionLine( ref m_functionBody, " currTexOffset = finalTexOffset;" ); - IOUtils.AddFunctionLine( ref m_functionBody, " currHeight = newHeight;" ); - IOUtils.AddFunctionLine( ref m_functionBody, " currRayZ = newZ;" ); - IOUtils.AddFunctionLine( ref m_functionBody, " deltaTex = intersection * deltaTex;" ); - IOUtils.AddFunctionLine( ref m_functionBody, " layerHeight = intersection * layerHeight;" ); - IOUtils.AddFunctionLine( ref m_functionBody, " }" ); - IOUtils.AddFunctionLine( ref m_functionBody, " else" ); - IOUtils.AddFunctionLine( ref m_functionBody, " {" ); - IOUtils.AddFunctionLine( ref m_functionBody, " prevTexOffset = finalTexOffset;" ); - IOUtils.AddFunctionLine( ref m_functionBody, " prevHeight = newHeight;" ); - IOUtils.AddFunctionLine( ref m_functionBody, " prevRayZ = newZ;" ); - IOUtils.AddFunctionLine( ref m_functionBody, " deltaTex = ( 1 - intersection ) * deltaTex;" ); - IOUtils.AddFunctionLine( ref m_functionBody, " layerHeight = ( 1 - intersection ) * layerHeight;" ); - IOUtils.AddFunctionLine( ref m_functionBody, " }" ); - IOUtils.AddFunctionLine( ref m_functionBody, " sectionIndex++;" ); - IOUtils.AddFunctionLine( ref m_functionBody, "}" ); - } - else - { - IOUtils.AddFunctionLine( ref m_functionBody, "finalTexOffset = currTexOffset;" ); - } - - if ( m_useCurvature ) - { - IOUtils.AddFunctionLine( ref m_functionBody, "#ifdef UNITY_PASS_SHADOWCASTER" ); - IOUtils.AddFunctionLine( ref m_functionBody, "if ( unity_LightShadowBias.z == 0.0 )" ); - IOUtils.AddFunctionLine( ref m_functionBody, "{" ); - IOUtils.AddFunctionLine( ref m_functionBody, "#endif" ); - IOUtils.AddFunctionLine( ref m_functionBody, " if ( result.z > 1 )" ); - IOUtils.AddFunctionLine( ref m_functionBody, " clip( -1 );" ); - IOUtils.AddFunctionLine( ref m_functionBody, "#ifdef UNITY_PASS_SHADOWCASTER" ); - IOUtils.AddFunctionLine( ref m_functionBody, "}" ); - IOUtils.AddFunctionLine( ref m_functionBody, "#endif" ); - } - - if ( m_clipEnds ) - { - IOUtils.AddFunctionLine( ref m_functionBody, "result.xy = uvs + finalTexOffset;" ); - IOUtils.AddFunctionLine( ref m_functionBody, "#ifdef UNITY_PASS_SHADOWCASTER" ); - IOUtils.AddFunctionLine( ref m_functionBody, "if ( unity_LightShadowBias.z == 0.0 )" ); - IOUtils.AddFunctionLine( ref m_functionBody, "{" ); - IOUtils.AddFunctionLine( ref m_functionBody, "#endif" ); - IOUtils.AddFunctionLine( ref m_functionBody, " if ( result.x < 0 )" ); - IOUtils.AddFunctionLine( ref m_functionBody, " clip( -1 );" ); - IOUtils.AddFunctionLine( ref m_functionBody, " if ( result.x > tilling.x )" ); - IOUtils.AddFunctionLine( ref m_functionBody, " clip( -1 );" ); - IOUtils.AddFunctionLine( ref m_functionBody, " if ( result.y < 0 )" ); - IOUtils.AddFunctionLine( ref m_functionBody, " clip( -1 );" ); - IOUtils.AddFunctionLine( ref m_functionBody, " if ( result.y > tilling.y )" ); - IOUtils.AddFunctionLine( ref m_functionBody, " clip( -1 );" ); - IOUtils.AddFunctionLine( ref m_functionBody, "#ifdef UNITY_PASS_SHADOWCASTER" ); - IOUtils.AddFunctionLine( ref m_functionBody, "}" ); - IOUtils.AddFunctionLine( ref m_functionBody, "#endif" ); - IOUtils.AddFunctionLine( ref m_functionBody, "return result.xy;" ); - } - else - { - IOUtils.AddFunctionLine( ref m_functionBody, "return uvs + finalTexOffset;" ); - } - IOUtils.CloseFunctionBody( ref m_functionBody ); - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - m_selectedChannelInt = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - //m_minSamples = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - //m_maxSamples = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - if( UIUtils.CurrentShaderVersion() < 15406 ) - { - m_inlineMinSamples.IntValue = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - m_inlineMaxSamples.IntValue = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - } - else - { - m_inlineMinSamples.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); - m_inlineMaxSamples.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); - } - m_sidewallSteps = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - m_defaultScale = Convert.ToSingle( GetCurrentParam( ref nodeParams ) ); - m_defaultRefPlane = Convert.ToSingle( GetCurrentParam( ref nodeParams ) ); - if ( UIUtils.CurrentShaderVersion() > 3001 ) - { - m_clipEnds = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - string[] vector2Component = GetCurrentParam( ref nodeParams ).Split( IOUtils.VECTOR_SEPARATOR ); - if ( vector2Component.Length == 2 ) - { - m_tilling.x = Convert.ToSingle( vector2Component[ 0 ] ); - m_tilling.y = Convert.ToSingle( vector2Component[ 1 ] ); - } - } - - if ( UIUtils.CurrentShaderVersion() > 5005 ) - { - m_useCurvature = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - m_CurvatureVector = IOUtils.StringToVector2( GetCurrentParam( ref nodeParams ) ); - } - - if( UIUtils.CurrentShaderVersion() > 13103 ) - { - if( UIUtils.CurrentShaderVersion() < 15307 ) - { - bool arrayIndexVisible = false; - arrayIndexVisible = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - m_pomTexType = arrayIndexVisible ? POMTexTypes.TextureArray : POMTexTypes.Texture2D; - } - else - { - m_pomTexType = (POMTexTypes)Enum.Parse( typeof(POMTexTypes), GetCurrentParam( ref nodeParams ) ); - } - - UpdateIndexPort(); - } - - UpdateSampler(); - GeneratePOMfunction(); - UpdateCurvaturePort(); - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_selectedChannelInt ); - //IOUtils.AddFieldValueToString( ref nodeInfo, m_minSamples ); - //IOUtils.AddFieldValueToString( ref nodeInfo, m_maxSamples ); - m_inlineMinSamples.WriteToString( ref nodeInfo ); - m_inlineMaxSamples.WriteToString( ref nodeInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_sidewallSteps ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_defaultScale ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_defaultRefPlane ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_clipEnds ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_tilling.x.ToString() + IOUtils.VECTOR_SEPARATOR + m_tilling.y.ToString() ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_useCurvature ); - IOUtils.AddFieldValueToString( ref nodeInfo, IOUtils.Vector2ToString( m_CurvatureVector ) ); - //IOUtils.AddFieldValueToString( ref nodeInfo, m_useTextureArray ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_pomTexType); - } - - public override void Destroy() - { - base.Destroy(); - //Not calling m_texCoordsHelper.Destroy() on purpose so UIUtils does not incorrectly unregister stuff - if( m_texCoordsHelper != null ) - { - DestroyImmediate( m_texCoordsHelper ); - m_texCoordsHelper = null; - } - - - m_uvPort = null; - m_texPort = null; - m_scalePort = null; - m_viewdirTanPort = null; - m_pomUVPort = null; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ParallaxOcclusionMappingNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ParallaxOcclusionMappingNode.cs.meta deleted file mode 100644 index 3a7443c6..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ParallaxOcclusionMappingNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: b2350150f3f2a0443827ca8925d5e759 -timeCreated: 1481126958 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ParallaxOffsetHlpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ParallaxOffsetHlpNode.cs deleted file mode 100644 index 26b8a542..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ParallaxOffsetHlpNode.cs +++ /dev/null @@ -1,47 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Parallax Offset", "UV Coordinates", "Calculates UV offset for parallax normal mapping" )] - public sealed class ParallaxOffsetHlpNode : HelperParentNode - { - public readonly string[] ParallaxOffsetFunc = - { - "inline float2 ParallaxOffset( half h, half height, half3 viewDir )\n", - "{\n", - "\th = h * height - height/2.0;\n", - "\tfloat3 v = normalize( viewDir );\n", - "\tv.z += 0.42;\n", - "\treturn h* (v.xy / v.z);\n", - "}\n" - }; - - void OnSRPActionEvent( int outputId, ref MasterNodeDataCollector dataCollector ) - { - dataCollector.AddFunction( ParallaxOffsetFunc[ 0 ], ParallaxOffsetFunc, false ); - } - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_funcType = "ParallaxOffset"; - m_inputPorts[ 0 ].ChangeProperties( "H", WirePortDataType.FLOAT, false ); - AddInputPort( WirePortDataType.FLOAT, false, "Height" ); - AddInputPort( WirePortDataType.FLOAT3, false, "ViewDir (tan)" ); - m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT2, false ); - m_outputPorts[ 0 ].Name = "Out"; - OnHDAction = OnSRPActionEvent; - OnLightweightAction = OnSRPActionEvent; - m_previewShaderGUID = "6085f804c6fbf354eac039c11feaa7cc"; - } - - protected override void OnUniqueIDAssigned() - { - base.OnUniqueIDAssigned(); - m_localVarName = "paralaxOffset" + OutputId; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ParallaxOffsetHlpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ParallaxOffsetHlpNode.cs.meta deleted file mode 100644 index 76316eed..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ParallaxOffsetHlpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 83b7d6fe57585b74d80c429aef719200 -timeCreated: 1481126957 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ShadeVertexLightsHlpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ShadeVertexLightsHlpNode.cs deleted file mode 100644 index e337326b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ShadeVertexLightsHlpNode.cs +++ /dev/null @@ -1,105 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using UnityEngine; -using UnityEditor; -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Shade Vertex Lights", "Light", "Computes illumination from four per-vertex lights and ambient, given object space position & normal" )] - public sealed class ShadeVertexLightsHlpNode : ParentNode - { - private const string HelperMessage = "Shade Vertex Lights node only outputs correct results on\nTemplate Vertex/Frag shaders with their LightMode set to Vertex."; - private const string ShadeVertexLightFunc = "ShadeVertexLightsFull({0},{1},{2},{3})"; - private const string LightCount = "Light Count"; - private const string IsSpotlight = "Is Spotlight"; - private const int MinLightCount = 0; - private const int MaxLightCount = 8; - [SerializeField] - private int m_lightCount = 4; - - [SerializeField] - private bool m_enableSpotlight = false; - - private int _LightCountId; - private int _IsSpotlightId; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT4, false, "Vertex Position" ); - AddInputPort( WirePortDataType.FLOAT3, false, "Vertex Normal" ); - AddOutputPort( WirePortDataType.FLOAT3, Constants.EmptyPortValue ); - m_useInternalPortData = true; - //m_autoWrapProperties = true; - m_textLabelWidth = 90; - m_previewShaderGUID = "3b6075034a85ad047be2d31dd213fb4f"; - } - - public override void OnEnable() - { - base.OnEnable(); - _LightCountId = Shader.PropertyToID( "_LightCount" ); - _IsSpotlightId = Shader.PropertyToID( "_IsSpotlight" ); - } - - public override void DrawProperties() - { - base.DrawProperties(); - NodeUtils.DrawPropertyGroup( ref m_propertiesFoldout, Constants.ParameterLabelStr, DrawGeneralProperties ); - EditorGUILayout.HelpBox( HelperMessage, MessageType.Info ); - } - - public override void SetPreviewInputs() - { - base.SetPreviewInputs(); - PreviewMaterial.SetInt( _LightCountId, m_lightCount ); - PreviewMaterial.SetInt( _IsSpotlightId, ( m_enableSpotlight ? 1 : 0 ) ); - - } - - void DrawGeneralProperties() - { - m_lightCount = EditorGUILayoutIntSlider( LightCount, m_lightCount, MinLightCount, MaxLightCount ); - m_enableSpotlight = EditorGUILayoutToggle( IsSpotlight, m_enableSpotlight ); - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if( dataCollector.MasterNodeCategory == AvailableShaderTypes.SurfaceShader ) - UIUtils.ShowMessage( UniqueId, HelperMessage, MessageSeverity.Warning ); - - if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) - return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); - - dataCollector.AddToIncludes( UniqueId, Constants.UnityCgLibFuncs ); - - string vertexPosition = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - string vertexNormal = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); - - string value = string.Format( ShadeVertexLightFunc, vertexPosition, vertexNormal, m_lightCount, m_enableSpotlight.ToString().ToLower() ); - - RegisterLocalVariable( 0, value, ref dataCollector, "shadeVertexLight" + OutputId ); - - return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - if( UIUtils.CurrentShaderVersion() > 14301 ) - { - m_lightCount = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - m_enableSpotlight = 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_lightCount ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_enableSpotlight ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ShadeVertexLightsHlpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ShadeVertexLightsHlpNode.cs.meta deleted file mode 100644 index 100f876b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/ShadeVertexLightsHlpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 74f44334b702bce4ba8e2681dc80fe3c -timeCreated: 1481126956 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/SurfaceDepthNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/SurfaceDepthNode.cs deleted file mode 100644 index 93e01b41..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/SurfaceDepthNode.cs +++ /dev/null @@ -1,184 +0,0 @@ -using UnityEngine; -using UnityEditor; - -using System; -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Surface Depth", "Surface Data", "Returns the surface view depth" )] - public sealed class SurfaceDepthNode : ParentNode - { - [SerializeField] - private int m_viewSpaceInt = 0; - - private readonly string[] m_viewSpaceStr = { "Eye Space", "0-1 Space" }; - private readonly string[] m_vertexNameStr = { "eyeDepth", "clampDepth" }; - - private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper(); - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT3, false, "Vertex Position" ); - AddOutputPort( WirePortDataType.FLOAT, "Depth" ); - m_autoWrapProperties = true; - m_hasLeftDropdown = true; - SetAdditonalTitleText( string.Format( Constants.SubTitleSpaceFormatStr, m_viewSpaceStr[ m_viewSpaceInt ] ) ); - } - - public override void Destroy() - { - base.Destroy(); - m_upperLeftWidget = null; - } - - public override void AfterCommonInit() - { - base.AfterCommonInit(); - if( PaddingTitleLeft == 0 ) - { - PaddingTitleLeft = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; - if( PaddingTitleRight == 0 ) - PaddingTitleRight = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; - } - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - EditorGUI.BeginChangeCheck(); - m_viewSpaceInt = m_upperLeftWidget.DrawWidget( this, m_viewSpaceInt, m_viewSpaceStr ); - if( EditorGUI.EndChangeCheck() ) - { - SetAdditonalTitleText( string.Format( Constants.SubTitleSpaceFormatStr, m_viewSpaceStr[ m_viewSpaceInt ] ) ); - } - } - - public override void DrawProperties() - { - base.DrawProperties(); - EditorGUI.BeginChangeCheck(); - m_viewSpaceInt = EditorGUILayoutPopup( "View Space", m_viewSpaceInt, m_viewSpaceStr ); - if( EditorGUI.EndChangeCheck() ) - { - SetAdditonalTitleText( string.Format( Constants.SubTitleSpaceFormatStr, m_viewSpaceStr[ m_viewSpaceInt ] ) ); - } - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if( dataCollector.IsTemplate ) - { - if( m_inputPorts[ 0 ].IsConnected ) - { - string space = string.Empty; - if( m_viewSpaceInt == 1 ) - space = " * _ProjectionParams.w"; - - string varName = "customSurfaceDepth" + OutputId; - GenerateInputInVertex( ref dataCollector, 0, varName, false ); - string instruction = "-UnityObjectToViewPos( " + varName + " ).z" + space; - if( dataCollector.IsSRP ) - instruction = "-TransformWorldToView(TransformObjectToWorld( " + varName + " )).z" + space; - string eyeVarName = "customEye" + OutputId; - dataCollector.TemplateDataCollectorInstance.RegisterCustomInterpolatedData( eyeVarName, WirePortDataType.FLOAT, CurrentPrecisionType, instruction ); - return eyeVarName; - } - else - { - return dataCollector.TemplateDataCollectorInstance.GetEyeDepth( CurrentPrecisionType, true, MasterNodePortCategory.Fragment, m_viewSpaceInt ); - } - } - - if( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) - { - string vertexVarName = string.Empty; - if( m_inputPorts[ 0 ].IsConnected ) - { - vertexVarName = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - } - else - { - vertexVarName = Constants.VertexShaderInputStr + ".vertex.xyz"; - } - - string vertexSpace = m_viewSpaceInt == 1 ? " * _ProjectionParams.w" : ""; - string vertexInstruction = "-UnityObjectToViewPos( " + vertexVarName + " ).z" + vertexSpace; - dataCollector.AddVertexInstruction( "float " + m_vertexNameStr[ m_viewSpaceInt ] + " = " + vertexInstruction, UniqueId ); - - return m_vertexNameStr[ m_viewSpaceInt ]; - } - - dataCollector.AddToIncludes( UniqueId, Constants.UnityShaderVariables ); - - - if( dataCollector.TesselationActive ) - { - if( m_inputPorts[ 0 ].IsConnected ) - { - string space = string.Empty; - if( m_viewSpaceInt == 1 ) - space = " * _ProjectionParams.w"; - - if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) - return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); - - string value = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - RegisterLocalVariable( 0, string.Format( "-UnityObjectToViewPos( {0} ).z", value ) + space, ref dataCollector, "customSurfaceDepth" + OutputId ); - return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); - } - else - { - string eyeDepth = GeneratorUtils.GenerateScreenDepthOnFrag( ref dataCollector, UniqueId, CurrentPrecisionType ); - if( m_viewSpaceInt == 1 ) - { - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT, m_vertexNameStr[ 1 ], eyeDepth + " * _ProjectionParams.w" ); - return m_vertexNameStr[ 1 ]; - } - else - { - return eyeDepth; - } - } - } - else - { - - string space = string.Empty; - if( m_viewSpaceInt == 1 ) - space = " * _ProjectionParams.w"; - - if( m_inputPorts[ 0 ].IsConnected ) - { - string varName = "customSurfaceDepth" + OutputId; - GenerateInputInVertex( ref dataCollector, 0, varName, false ); - dataCollector.AddToInput( UniqueId, varName, WirePortDataType.FLOAT ); - string instruction = "-UnityObjectToViewPos( " + varName + " ).z" + space; - dataCollector.AddToVertexLocalVariables( UniqueId , Constants.VertexShaderOutputStr + "." + varName + " = " + instruction+";" ); - return Constants.InputVarStr + "." + varName; - } - else - { - dataCollector.AddToInput( UniqueId, m_vertexNameStr[ m_viewSpaceInt ], WirePortDataType.FLOAT ); - string instruction = "-UnityObjectToViewPos( " + Constants.VertexShaderInputStr + ".vertex.xyz ).z" + space; - dataCollector.AddToVertexLocalVariables( UniqueId , Constants.VertexShaderOutputStr + "." + m_vertexNameStr[ m_viewSpaceInt ] + " = " + instruction+";" ); - return Constants.InputVarStr + "." + m_vertexNameStr[ m_viewSpaceInt ]; - } - } - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - m_viewSpaceInt = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - SetAdditonalTitleText( string.Format( Constants.SubTitleSpaceFormatStr, m_viewSpaceStr[ m_viewSpaceInt ] ) ); - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_viewSpaceInt ); - } - } - -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/SurfaceDepthNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/SurfaceDepthNode.cs.meta deleted file mode 100644 index e1aa08a6..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/SurfaceDepthNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: d3b0855152b8c5d478f236423cfb1959 -timeCreated: 1481126959 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/TriplanarNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/TriplanarNode.cs deleted file mode 100644 index ef31fac3..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/TriplanarNode.cs +++ /dev/null @@ -1,1494 +0,0 @@ -using UnityEngine; -using UnityEditor; - -using System; -using System.Collections.Generic; -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Triplanar Sample", "Textures", "Triplanar Mapping" )] - public sealed class TriplanarNode : ParentNode - { - [SerializeField] - private string m_uniqueName; - - private bool m_editPropertyNameMode = false; - [SerializeField] - private string m_propertyInspectorName = "Triplanar Sampler"; - - private enum TriplanarType { Spherical, Cylindrical } - - [SerializeField] - private TriplanarType m_selectedTriplanarType = TriplanarType.Spherical; - - private enum TriplanarSpace { Object, World } - - [SerializeField] - private TriplanarSpace m_selectedTriplanarSpace = TriplanarSpace.World; - - [SerializeField] - private bool m_normalCorrection = false; - - [SerializeField] - private bool m_arraySupport = false; - - [SerializeField] - private TexturePropertyNode m_topTexture; - [SerializeField] - private TexturePropertyNode m_midTexture; - [SerializeField] - private TexturePropertyNode m_botTexture; - - bool m_texturesInitialize = false; - - [SerializeField] - private string m_tempTopInspectorName = string.Empty; - [SerializeField] - private string m_tempTopName = string.Empty; - private TexturePropertyValues m_tempTopDefaultValue = TexturePropertyValues.white; - private int m_tempTopOrderIndex = -1; - private Texture2D m_tempTopDefaultTexture = null; - - private string m_tempMidInspectorName = string.Empty; - private string m_tempMidName = string.Empty; - private TexturePropertyValues m_tempMidDefaultValue = TexturePropertyValues.white; - private int m_tempMidOrderIndex = -1; - private Texture2D m_tempMidDefaultTexture = null; - - private string m_tempBotInspectorName = string.Empty; - private string m_tempBotName = string.Empty; - private TexturePropertyValues m_tempBotDefaultValue = TexturePropertyValues.white; - private int m_tempBotOrderIndex = -1; - private Texture2D m_tempBotDefaultTexture = null; - - private bool m_topTextureFoldout = true; - private bool m_midTextureFoldout = true; - private bool m_botTextureFoldout = true; - - private InputPort m_topTexPort; - private InputPort m_midTexPort; - private InputPort m_botTexPort; - private InputPort m_tilingPort; - private InputPort m_falloffPort; - private InputPort m_topIndexPort; - private InputPort m_midIndexPort; - private InputPort m_botIndexPort; - private InputPort m_scalePort; - private InputPort m_posPort; - - - private readonly string m_functionCall = "TriplanarSampling{0}( {1} )"; - private readonly string m_functionHeader = "inline {0} TriplanarSampling{1}( {2}float3 worldPos, float3 worldNormal, float falloff, float2 tiling, float3 normalScale, float3 index )"; - - private readonly string m_singularTextureRegular = "sampler2D topTexMap, "; - private readonly string m_topmidbotTextureRegular = "sampler2D topTexMap, sampler2D midTexMap, sampler2D botTexMap, "; - - private readonly string m_singularTextureSRP = "TEXTURE2D_PARAM( topTexMap, samplertopTexMap), "; - private readonly string m_topmidbotTextureSRP = "TEXTURE2D_PARAM( topTexMap, samplertopTexMap), TEXTURE2D_PARAM( midTexMap , samplermidTexMap), TEXTURE2D_PARAM( botTexMap , samplerbotTexMap), "; - - - private readonly string m_singularArrayTextureStandard = "UNITY_ARGS_TEX2DARRAY( topTexMap ), "; - private readonly string m_topmidbotArrayTextureStandard = "UNITY_ARGS_TEX2DARRAY( topTexMap ), UNITY_ARGS_TEX2DARRAY( midTexMap ), UNITY_ARGS_TEX2DARRAY( botTexMap ), "; - - private readonly string m_singularArrayTextureSRP = "ASE_TEXTURE2D_ARRAY_ARGS( topTexMap ), "; - private readonly string m_topmidbotArrayTextureSRP = "ASE_TEXTURE2D_ARRAY_ARGS( topTexMap ), ASE_TEXTURE2D_ARRAY_ARGS( midTexMap ), ASE_TEXTURE2D_ARRAY_ARGS( botTexMap ), "; - - private readonly List<string> m_functionSamplingBodyProj = new List<string>() { - "float3 projNormal = ( pow( abs( worldNormal ), falloff ) );", - "projNormal /= ( projNormal.x + projNormal.y + projNormal.z ) + 0.00001;",// 0.00001 is to prevent division by 0 - "float3 nsign = sign( worldNormal );" - }; - - private readonly List<string> m_functionSamplingBodyNegProj = new List<string>() { - "float negProjNormalY = max( 0, projNormal.y * -nsign.y );", - "projNormal.y = max( 0, projNormal.y * nsign.y );" - }; - - // Sphere sampling - private readonly List<string> m_functionSamplingBodySampSphere = new List<string>() { - "half4 xNorm; half4 yNorm; half4 zNorm;", - "xNorm = ( {0}( ASE_TEXTURE_PARAMS( topTexMap ), {1}tiling * worldPos.zy * float2( nsign.x, 1.0 ){2} ) );", - "yNorm = ( {0}( ASE_TEXTURE_PARAMS( topTexMap ), {1}tiling * worldPos.xz * float2( nsign.y, 1.0 ){2} ) );", - "zNorm = ( {0}( ASE_TEXTURE_PARAMS( topTexMap ), {1}tiling * worldPos.xy * float2( -nsign.z, 1.0 ){2} ) );" - }; - - // Cylinder sampling - private readonly List<string> m_functionSamplingBodySampCylinder = new List<string>() { - "half4 xNorm; half4 yNorm; half4 yNormN; half4 zNorm;", - "xNorm = ( {0}( ASE_TEXTURE_PARAMS( midTexMap ), {1}tiling * worldPos.zy * float2( nsign.x, 1.0 ){3} ) );", - "yNorm = ( {0}( ASE_TEXTURE_PARAMS( topTexMap ), {1}tiling * worldPos.xz * float2( nsign.y, 1.0 ){2} ) );", - "yNormN = ( {0}( ASE_TEXTURE_PARAMS( botTexMap ), {1}tiling * worldPos.xz * float2( nsign.y, 1.0 ){4} ) );", - "zNorm = ( {0}( ASE_TEXTURE_PARAMS( midTexMap ), {1}tiling * worldPos.xy * float2( -nsign.z, 1.0 ){3} ) );" - }; - - private readonly List<string> m_functionSamplingBodySignsSphere = new List<string>() { - "xNorm.xyz = half3( {0}( xNorm{1} ).xy * float2( nsign.x, 1.0 ) + worldNormal.zy, worldNormal.x ).zyx;", - "yNorm.xyz = half3( {0}( yNorm{1} ).xy * float2( nsign.y, 1.0 ) + worldNormal.xz, worldNormal.y ).xzy;", - "zNorm.xyz = half3( {0}( zNorm{1} ).xy * float2( -nsign.z, 1.0 ) + worldNormal.xy, worldNormal.z ).xyz;" - }; - - private readonly List<string> m_functionSamplingBodySignsSphereScale = new List<string>() { - "xNorm.xyz = half3( {0}( xNorm, normalScale.y ).xy * float2( nsign.x, 1.0 ) + worldNormal.zy, worldNormal.x ).zyx;", - "yNorm.xyz = half3( {0}( yNorm, normalScale.x ).xy * float2( nsign.y, 1.0 ) + worldNormal.xz, worldNormal.y ).xzy;", - "zNorm.xyz = half3( {0}( zNorm, normalScale.y ).xy * float2( -nsign.z, 1.0 ) + worldNormal.xy, worldNormal.z ).xyz;" - }; - - private readonly List<string> m_functionSamplingBodySignsCylinder = new List<string>() { - "yNormN.xyz = half3( {0}( yNormN {1} ).xy * float2( nsign.y, 1.0 ) + worldNormal.xz, worldNormal.y ).xzy;" - }; - - private readonly List<string> m_functionSamplingBodySignsCylinderScale = new List<string>() { - "yNormN.xyz = half3( {0}( yNormN, normalScale.z ).xy * float2( nsign.y, 1.0 ) + worldNormal.xz, worldNormal.y ).xzy;" - }; - - private readonly List<string> m_functionSamplingBodyReturnSphereNormalize = new List<string>() { - "return normalize( xNorm.xyz * projNormal.x + yNorm.xyz * projNormal.y + zNorm.xyz * projNormal.z );" - }; - - private readonly List<string> m_functionSamplingBodyReturnCylinderNormalize = new List<string>() { - "return normalize( xNorm.xyz * projNormal.x + yNorm.xyz * projNormal.y + yNormN.xyz * negProjNormalY + zNorm.xyz * projNormal.z );" - }; - - private readonly List<string> m_functionSamplingBodyReturnSphere = new List<string>() { - "return xNorm * projNormal.x + yNorm * projNormal.y + zNorm * projNormal.z;" - }; - - private readonly List<string> m_functionSamplingBodyReturnCylinder = new List<string>() { - "return xNorm * projNormal.x + yNorm * projNormal.y + yNormN * negProjNormalY + zNorm * projNormal.z;" - }; - - private Rect m_allPicker; - private Rect m_startPicker; - private Rect m_pickerButton; - private bool m_editing; - - void ConvertListTo( MasterNodeDataCollector dataCollector, bool scaleInfo, List<string> original, List<string> dest ) - { - int count = original.Count; - string scale = string.Empty; - string func = string.Empty; - bool applyScale = false; - if( dataCollector.IsTemplate && dataCollector.IsSRP ) - { - if( dataCollector.TemplateDataCollectorInstance.IsHDRP ) - { - func = "UnpackNormalmapRGorAG"; - } - else - { - func = "UnpackNormalScale"; - } - - if( !scaleInfo ) - { - scale = " , 1.0"; - applyScale = true; - } - } - else - { - func = scaleInfo ? "UnpackScaleNormal" : "UnpackNormal"; - applyScale = !scaleInfo; - } - - for( int i = 0; i < count; i++ ) - { - if( applyScale ) - dest.Add( string.Format( original[ i ], func, scale ) ); - else - dest.Add( string.Format( original[ i ], func ) ); - } - } - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.SAMPLER2D, true, "Top", -1, MasterNodePortCategory.Fragment, 0 ); - AddInputPort( WirePortDataType.FLOAT, true, "Top Index", -1, MasterNodePortCategory.Fragment, 5 ); - AddInputPort( WirePortDataType.SAMPLER2D, true, "Middle", -1, MasterNodePortCategory.Fragment, 1 ); - AddInputPort( WirePortDataType.FLOAT, true, "Mid Index", -1, MasterNodePortCategory.Fragment, 6 ); - AddInputPort( WirePortDataType.SAMPLER2D, true, "Bottom", -1, MasterNodePortCategory.Fragment, 2 ); - AddInputPort( WirePortDataType.FLOAT, true, "Bot Index", -1, MasterNodePortCategory.Fragment, 7 ); - AddInputPort( WirePortDataType.FLOAT3, true, "Pos", -1, MasterNodePortCategory.Fragment, 9 ); - AddInputPort( WirePortDataType.FLOAT3, true, "Scale", -1, MasterNodePortCategory.Fragment, 8 ); - AddInputPort( WirePortDataType.FLOAT2, true, "Tiling", -1, MasterNodePortCategory.Fragment, 3 ); - AddInputPort( WirePortDataType.FLOAT, true, "Falloff", -1, MasterNodePortCategory.Fragment, 4 ); - AddOutputColorPorts( "RGBA" ); - m_useInternalPortData = true; - m_topTexPort = InputPorts[ 0 ]; - m_topIndexPort = InputPorts[ 1 ]; - m_midTexPort = InputPorts[ 2 ]; - m_midIndexPort = InputPorts[ 3 ]; - m_botTexPort = InputPorts[ 4 ]; - m_botIndexPort = InputPorts[ 5 ]; - m_posPort = InputPorts[ 6 ]; - m_scalePort = InputPorts[ 7 ]; - m_tilingPort = InputPorts[ 8 ]; - m_falloffPort = InputPorts[ 9 ]; - - m_scalePort.Visible = false; - m_scalePort.Vector3InternalData = Vector3.one; - m_tilingPort.FloatInternalData = 1; - m_tilingPort.Vector2InternalData = Vector2.one; - m_topIndexPort.FloatInternalData = 1; - m_falloffPort.FloatInternalData = 1; - m_topIndexPort.Visible = false; - m_selectedLocation = PreviewLocation.TopCenter; - m_marginPreviewLeft = 43; - m_drawPreviewAsSphere = true; - m_drawPreviewExpander = false; - m_drawPreview = true; - m_showPreview = true; - m_autoDrawInternalPortData = false; - m_textLabelWidth = 125; - //m_propertyInspectorName = "Triplanar Sampler"; - m_previewShaderGUID = "8723015ec59743143aadfbe480e34391"; - } - - public void ReadPropertiesData() - { - // Top - if( UIUtils.IsUniformNameAvailable( m_tempTopName ) ) - { - UIUtils.ReleaseUniformName( UniqueId, m_topTexture.PropertyName ); - if( !string.IsNullOrEmpty( m_tempTopInspectorName ) ) - { - m_topTexture.SetInspectorName( m_tempTopInspectorName ); - } - if( !string.IsNullOrEmpty( m_tempTopName ) ) - m_topTexture.SetPropertyName( m_tempTopName ); - UIUtils.RegisterUniformName( UniqueId, m_topTexture.PropertyName ); - } - m_topTexture.DefaultTextureValue = m_tempTopDefaultValue; - m_topTexture.OrderIndex = m_tempTopOrderIndex; - m_topTexture.DefaultValue = m_tempTopDefaultTexture; - //m_topTexture.SetMaterialMode( UIUtils.CurrentWindow.CurrentGraph.CurrentMaterial, true ); - - // Mid - if( UIUtils.IsUniformNameAvailable( m_tempMidName ) ) - { - UIUtils.ReleaseUniformName( UniqueId, m_midTexture.PropertyName ); - if( !string.IsNullOrEmpty( m_tempMidInspectorName ) ) - m_midTexture.SetInspectorName( m_tempMidInspectorName ); - if( !string.IsNullOrEmpty( m_tempMidName ) ) - m_midTexture.SetPropertyName( m_tempMidName ); - UIUtils.RegisterUniformName( UniqueId, m_midTexture.PropertyName ); - } - m_midTexture.DefaultTextureValue = m_tempMidDefaultValue; - m_midTexture.OrderIndex = m_tempMidOrderIndex; - m_midTexture.DefaultValue = m_tempMidDefaultTexture; - - // Bot - if( UIUtils.IsUniformNameAvailable( m_tempBotName ) ) - { - UIUtils.ReleaseUniformName( UniqueId, m_botTexture.PropertyName ); - if( !string.IsNullOrEmpty( m_tempBotInspectorName ) ) - m_botTexture.SetInspectorName( m_tempBotInspectorName ); - if( !string.IsNullOrEmpty( m_tempBotName ) ) - m_botTexture.SetPropertyName( m_tempBotName ); - UIUtils.RegisterUniformName( UniqueId, m_botTexture.PropertyName ); - } - m_botTexture.DefaultTextureValue = m_tempBotDefaultValue; - m_botTexture.OrderIndex = m_tempBotOrderIndex; - m_botTexture.DefaultValue = m_tempBotDefaultTexture; - } - - public override void SetMaterialMode( Material mat, bool fetchMaterialValues ) - { - base.SetMaterialMode( mat, fetchMaterialValues ); - - if( !m_texturesInitialize ) - return; - - m_topTexture.SetMaterialMode( mat, fetchMaterialValues ); - m_midTexture.SetMaterialMode( mat, fetchMaterialValues ); - m_botTexture.SetMaterialMode( mat, fetchMaterialValues ); - } - - public void Init() - { - if( m_texturesInitialize ) - return; - else - m_texturesInitialize = true; - - // Top - if( m_topTexture == null ) - { - m_topTexture = ScriptableObject.CreateInstance<TexturePropertyNode>(); - } - m_topTexture.ContainerGraph = ContainerGraph; - m_topTexture.CustomPrefix = "Top Texture "; - m_topTexture.UniqueId = UniqueId; - m_topTexture.DrawAutocast = false; - m_topTexture.CurrentParameterType = PropertyType.Property; - - // Mid - if( m_midTexture == null ) - { - m_midTexture = ScriptableObject.CreateInstance<TexturePropertyNode>(); - } - m_midTexture.ContainerGraph = ContainerGraph; - m_midTexture.CustomPrefix = "Mid Texture "; - m_midTexture.UniqueId = UniqueId; - m_midTexture.DrawAutocast = false; - m_midTexture.CurrentParameterType = PropertyType.Property; - - // Bot - if( m_botTexture == null ) - { - m_botTexture = ScriptableObject.CreateInstance<TexturePropertyNode>(); - } - m_botTexture.ContainerGraph = ContainerGraph; - m_botTexture.CustomPrefix = "Bot Texture "; - m_botTexture.UniqueId = UniqueId; - m_botTexture.DrawAutocast = false; - m_botTexture.CurrentParameterType = PropertyType.Property; - - if( m_materialMode ) - SetDelayedMaterialMode( ContainerGraph.CurrentMaterial ); - - if( m_nodeAttribs != null ) - m_uniqueName = m_nodeAttribs.Name + UniqueId; - - ConfigurePorts(); - - ReRegisterPorts(); - } - - public override void Destroy() - { - base.Destroy(); - - //UIUtils.UnregisterPropertyNode( m_topTexture ); - //UIUtils.UnregisterTexturePropertyNode( m_topTexture ); - - //UIUtils.UnregisterPropertyNode( m_midTexture ); - //UIUtils.UnregisterTexturePropertyNode( m_midTexture ); - - //UIUtils.UnregisterPropertyNode( m_botTexture ); - //UIUtils.UnregisterTexturePropertyNode( m_botTexture ); - if( m_topTexture != null ) - m_topTexture.Destroy(); - m_topTexture = null; - if( m_midTexture != null ) - m_midTexture.Destroy(); - m_midTexture = null; - if( m_botTexture != null ) - m_botTexture.Destroy(); - m_botTexture = null; - - m_tempTopDefaultTexture = null; - m_tempMidDefaultTexture = null; - m_tempBotDefaultTexture = null; - - m_topTexPort = null; - m_midTexPort = null; - m_botTexPort = null; - m_tilingPort = null; - m_falloffPort = null; - m_topIndexPort = null; - m_midIndexPort = null; - m_botIndexPort = null; - } - - public override void SetPreviewInputs() - { - base.SetPreviewInputs(); - if( m_topTexture == null ) - return; - - - if( m_topTexPort.IsConnected ) - { - PreviewMaterial.SetTexture( "_A", m_topTexPort.InputPreviewTexture( ContainerGraph ) ); - } - else - { - PreviewMaterial.SetTexture( "_A", m_topTexture.Value ); - } - if( m_selectedTriplanarType == TriplanarType.Cylindrical && m_midTexture != null ) - { - if( m_midTexPort.IsConnected ) - PreviewMaterial.SetTexture( "_B", m_midTexPort.InputPreviewTexture( ContainerGraph ) ); - else - PreviewMaterial.SetTexture( "_B", m_midTexture.Value ); - if( m_botTexPort.IsConnected ) - PreviewMaterial.SetTexture( "_C", m_botTexPort.InputPreviewTexture( ContainerGraph ) ); - else - PreviewMaterial.SetTexture( "_C", m_botTexture.Value ); - } - - PreviewMaterial.SetFloat( "_IsNormal", ( m_normalCorrection ? 1 : 0 ) ); - PreviewMaterial.SetFloat( "_IsSpherical", ( m_selectedTriplanarType == TriplanarType.Spherical ? 1 : 0 ) ); - } - - public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) - { - base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); - if( m_texturesInitialize ) - ReRegisterPorts(); - } - - public override void OnInputPortDisconnected( int portId ) - { - base.OnInputPortDisconnected( portId ); - if( m_texturesInitialize ) - ReRegisterPorts(); - } - - public void ReRegisterPorts() - { - if( m_topTexPort.IsConnected ) - { - UIUtils.UnregisterPropertyNode( m_topTexture ); - UIUtils.UnregisterTexturePropertyNode( m_topTexture ); - } - else if( m_topTexPort.Visible ) - { - UIUtils.RegisterPropertyNode( m_topTexture ); - UIUtils.RegisterTexturePropertyNode( m_topTexture ); - } - - if( m_midTexPort.IsConnected || m_selectedTriplanarType == TriplanarType.Spherical ) - { - UIUtils.UnregisterPropertyNode( m_midTexture ); - UIUtils.UnregisterTexturePropertyNode( m_midTexture ); - } - else if( m_midTexPort.Visible && m_selectedTriplanarType == TriplanarType.Cylindrical ) - { - UIUtils.RegisterPropertyNode( m_midTexture ); - UIUtils.RegisterTexturePropertyNode( m_midTexture ); - } - - if( m_botTexPort.IsConnected || m_selectedTriplanarType == TriplanarType.Spherical ) - { - UIUtils.UnregisterPropertyNode( m_botTexture ); - UIUtils.UnregisterTexturePropertyNode( m_botTexture ); - } - else if( m_botTexPort.Visible && m_selectedTriplanarType == TriplanarType.Cylindrical ) - { - UIUtils.RegisterPropertyNode( m_botTexture ); - UIUtils.RegisterTexturePropertyNode( m_botTexture ); - } - } - - public void ConfigurePorts() - { - switch( m_selectedTriplanarType ) - { - case TriplanarType.Spherical: - m_topTexPort.Name = "Tex"; - m_midTexPort.Visible = false; - m_botTexPort.Visible = false; - m_scalePort.ChangeType( WirePortDataType.FLOAT, false ); - break; - case TriplanarType.Cylindrical: - m_topTexPort.Name = "Top"; - m_midTexPort.Visible = true; - m_botTexPort.Visible = true; - m_scalePort.ChangeType( WirePortDataType.FLOAT3, false ); - break; - } - - if( m_normalCorrection ) - { - m_outputPorts[ 0 ].ChangeProperties( "XYZ", WirePortDataType.FLOAT3, false ); - m_outputPorts[ 1 ].ChangeProperties( "X", WirePortDataType.FLOAT, false ); - m_outputPorts[ 2 ].ChangeProperties( "Y", WirePortDataType.FLOAT, false ); - m_outputPorts[ 3 ].ChangeProperties( "Z", WirePortDataType.FLOAT, false ); - - m_outputPorts[ 4 ].Visible = false; - - m_scalePort.Visible = true; - } - else - { - m_outputPorts[ 0 ].ChangeProperties( "RGBA", WirePortDataType.FLOAT4, false ); - m_outputPorts[ 1 ].ChangeProperties( "R", WirePortDataType.FLOAT, false ); - m_outputPorts[ 2 ].ChangeProperties( "G", WirePortDataType.FLOAT, false ); - m_outputPorts[ 3 ].ChangeProperties( "B", WirePortDataType.FLOAT, false ); - m_outputPorts[ 4 ].ChangeProperties( "A", WirePortDataType.FLOAT, false ); - - m_outputPorts[ 4 ].Visible = true; - - m_scalePort.Visible = false; - } - - if( m_arraySupport ) - { - m_topIndexPort.Visible = true; - if( m_selectedTriplanarType == TriplanarType.Cylindrical ) - { - m_midIndexPort.Visible = true; - m_botIndexPort.Visible = true; - } - else - { - m_midIndexPort.Visible = false; - m_botIndexPort.Visible = false; - } - } - else - { - m_topIndexPort.Visible = false; - m_midIndexPort.Visible = false; - m_botIndexPort.Visible = false; - } - - if( m_selectedTriplanarSpace == TriplanarSpace.World ) - m_posPort.Name = "World Pos"; - else - m_posPort.Name = "Local Pos"; - - m_outputPorts[ 0 ].DirtyLabelSize = true; - m_sizeIsDirty = true; - } - - public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) - { - base.PropagateNodeData( nodeData, ref dataCollector ); - dataCollector.DirtyNormal = true; - } - - public override void DrawProperties() - { - base.DrawProperties(); - NodeUtils.DrawPropertyGroup( ref m_propertiesFoldout, "Parameters", DrawMainOptions ); - DrawInternalDataGroup(); - if( m_selectedTriplanarType == TriplanarType.Spherical && !m_topTexPort.IsConnected ) - NodeUtils.DrawPropertyGroup( ref m_topTextureFoldout, "Texture", DrawTopTextureOptions ); - else if( !m_topTexPort.IsConnected ) - NodeUtils.DrawPropertyGroup( ref m_topTextureFoldout, "Top Texture", DrawTopTextureOptions ); - - if( m_selectedTriplanarType == TriplanarType.Cylindrical ) - { - if( !m_midTexPort.IsConnected ) - NodeUtils.DrawPropertyGroup( ref m_midTextureFoldout, "Middle Texture", DrawMidTextureOptions ); - if( !m_botTexPort.IsConnected ) - NodeUtils.DrawPropertyGroup( ref m_botTextureFoldout, "Bottom Texture", DrawBotTextureOptions ); - } - } - - void DrawMainOptions() - { - EditorGUI.BeginChangeCheck(); - m_propertyInspectorName = EditorGUILayoutTextField( "Name", m_propertyInspectorName ); - - m_selectedTriplanarType = (TriplanarType)EditorGUILayoutEnumPopup( "Mapping", m_selectedTriplanarType ); - - m_selectedTriplanarSpace = (TriplanarSpace)EditorGUILayoutEnumPopup( "Space", m_selectedTriplanarSpace ); - - m_normalCorrection = EditorGUILayoutToggle( "Normal Map", m_normalCorrection ); - - m_arraySupport = EditorGUILayoutToggle( "Use Texture Array", m_arraySupport ); - if( m_arraySupport ) - EditorGUILayout.HelpBox( "Please connect all texture ports to a Texture Object node with a texture array asset for this option to work correctly", MessageType.Info ); - - if( EditorGUI.EndChangeCheck() ) - { - SetTitleText( m_propertyInspectorName ); - ConfigurePorts(); - ReRegisterPorts(); - } - } - - void DrawTopTextureOptions() - { - EditorGUI.BeginChangeCheck(); - m_topTexture.ShowPropertyInspectorNameGUI(); - m_topTexture.ShowPropertyNameGUI( true ); - m_topTexture.ShowToolbar(); - if( EditorGUI.EndChangeCheck() ) - { - m_topTexture.BeginPropertyFromInspectorCheck(); - if( m_materialMode ) - m_requireMaterialUpdate = true; - } - - m_topTexture.CheckPropertyFromInspector(); - } - - void DrawMidTextureOptions() - { - if( m_midTexture == null ) - return; - - EditorGUI.BeginChangeCheck(); - m_midTexture.ShowPropertyInspectorNameGUI(); - m_midTexture.ShowPropertyNameGUI( true ); - m_midTexture.ShowToolbar(); - if( EditorGUI.EndChangeCheck() ) - { - m_midTexture.BeginPropertyFromInspectorCheck(); - if( m_materialMode ) - m_requireMaterialUpdate = true; - } - - m_midTexture.CheckPropertyFromInspector(); - } - - void DrawBotTextureOptions() - { - if( m_botTexture == null ) - return; - - EditorGUI.BeginChangeCheck(); - m_botTexture.ShowPropertyInspectorNameGUI(); - m_botTexture.ShowPropertyNameGUI( true ); - m_botTexture.ShowToolbar(); - if( EditorGUI.EndChangeCheck() ) - { - m_botTexture.BeginPropertyFromInspectorCheck(); - if( m_materialMode ) - m_requireMaterialUpdate = true; - } - - m_botTexture.CheckPropertyFromInspector(); - } - - public override void OnEnable() - { - base.OnEnable(); - //if( !m_afterDeserialize ) - //Init(); //Generate texture properties - //else - //m_afterDeserialize = false; - - //if( m_topTexture != null ) - // m_topTexture.ReRegisterName = true; - - //if( m_selectedTriplanarType == TriplanarType.Cylindrical ) - //{ - // if( m_midTexture != null ) - // m_midTexture.ReRegisterName = true; - - // if( m_botTexture != null ) - // m_botTexture.ReRegisterName = true; - //} - } - - //bool m_afterDeserialize = false; - - //public override void OnAfterDeserialize() - //{ - // base.OnAfterDeserialize(); - // m_afterDeserialize = true; - //} - - - public override void OnNodeLogicUpdate( DrawInfo drawInfo ) - { - base.OnNodeLogicUpdate( drawInfo ); - - Init(); - - if( m_topTexture.ReRegisterName ) - { - m_topTexture.ReRegisterName = false; - UIUtils.RegisterUniformName( UniqueId, m_topTexture.PropertyName ); - } - - m_topTexture.CheckDelayedDirtyProperty(); - m_topTexture.CheckPropertyFromInspector(); - m_topTexture.CheckDuplicateProperty(); - - if( m_selectedTriplanarType == TriplanarType.Cylindrical ) - { - if( m_midTexture.ReRegisterName ) - { - m_midTexture.ReRegisterName = false; - UIUtils.RegisterUniformName( UniqueId, m_midTexture.PropertyName ); - } - - m_midTexture.CheckDelayedDirtyProperty(); - m_midTexture.CheckPropertyFromInspector(); - m_midTexture.CheckDuplicateProperty(); - - if( m_botTexture.ReRegisterName ) - { - m_botTexture.ReRegisterName = false; - UIUtils.RegisterUniformName( UniqueId, m_botTexture.PropertyName ); - } - - m_botTexture.CheckDelayedDirtyProperty(); - m_botTexture.CheckPropertyFromInspector(); - m_botTexture.CheckDuplicateProperty(); - } - } - - public override void OnNodeLayout( DrawInfo drawInfo ) - { - base.OnNodeLayout( drawInfo ); - - m_allPicker = m_previewRect; - m_allPicker.x -= 43 * drawInfo.InvertedZoom; - m_allPicker.width = 43 * drawInfo.InvertedZoom; - - m_startPicker = m_previewRect; - m_startPicker.x -= 43 * drawInfo.InvertedZoom; - m_startPicker.width = 43 * drawInfo.InvertedZoom; - m_startPicker.height = 43 * drawInfo.InvertedZoom; - - m_pickerButton = m_startPicker; - m_pickerButton.width = 30 * drawInfo.InvertedZoom; - m_pickerButton.x = m_startPicker.xMax - m_pickerButton.width - 2; - m_pickerButton.height = 10 * drawInfo.InvertedZoom; - m_pickerButton.y = m_startPicker.yMax - m_pickerButton.height - 2; - } - - - - public override void DrawGUIControls( DrawInfo drawInfo ) - { - base.DrawGUIControls( drawInfo ); - - if( !( drawInfo.CurrentEventType == EventType.MouseDown || drawInfo.CurrentEventType == EventType.MouseUp || drawInfo.CurrentEventType == EventType.ExecuteCommand || drawInfo.CurrentEventType == EventType.DragPerform ) ) - return; - - bool insideBox = m_allPicker.Contains( drawInfo.MousePosition ); - - if( insideBox ) - { - m_editing = true; - } - else if( m_editing && !insideBox && drawInfo.CurrentEventType != EventType.ExecuteCommand ) - { - GUI.FocusControl( null ); - m_editing = false; - } - } - private int m_pickId = 0; - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - - Rect pickerButtonClone = m_pickerButton; - Rect startPickerClone = m_startPicker; - - if( m_editing ) - { - if( GUI.Button( pickerButtonClone, string.Empty, GUIStyle.none ) ) - { - int controlID = EditorGUIUtility.GetControlID( FocusType.Passive ); - EditorGUIUtility.ShowObjectPicker<Texture2D>( m_topTexture.Value, false, "", controlID ); - m_pickId = 0; - } - - if( m_selectedTriplanarType == TriplanarType.Cylindrical ) - { - pickerButtonClone.y += startPickerClone.height; - if( GUI.Button( pickerButtonClone, string.Empty, GUIStyle.none ) ) - { - int controlID = EditorGUIUtility.GetControlID( FocusType.Passive ); - EditorGUIUtility.ShowObjectPicker<Texture2D>( m_midTexture.Value, false, "", controlID ); - m_pickId = 1; - } - - pickerButtonClone.y += startPickerClone.height; - if( GUI.Button( pickerButtonClone, string.Empty, GUIStyle.none ) ) - { - int controlID = EditorGUIUtility.GetControlID( FocusType.Passive ); - EditorGUIUtility.ShowObjectPicker<Texture2D>( m_botTexture.Value, false, "", controlID ); - m_pickId = 2; - } - } - - string commandName = Event.current.commandName; - UnityEngine.Object newValue = null; - if( commandName.Equals( "ObjectSelectorUpdated" ) || commandName.Equals( "ObjectSelectorClosed" ) ) - { - newValue = EditorGUIUtility.GetObjectPickerObject(); - if( m_pickId == 2 ) - { - if( newValue != (UnityEngine.Object)m_botTexture.Value ) - { - PreviewIsDirty = true; - UndoRecordObject( "Changing value EditorGUIObjectField on node Triplanar Node" ); - m_botTexture.Value = newValue != null ? (Texture2D)newValue : null; - - if( m_materialMode ) - m_requireMaterialUpdate = true; - } - } - else if( m_pickId == 1 ) - { - if( newValue != (UnityEngine.Object)m_midTexture.Value ) - { - PreviewIsDirty = true; - UndoRecordObject( "Changing value EditorGUIObjectField on node Triplanar Node" ); - m_midTexture.Value = newValue != null ? (Texture2D)newValue : null; - - if( m_materialMode ) - m_requireMaterialUpdate = true; - } - } - else - { - if( newValue != (UnityEngine.Object)m_topTexture.Value ) - { - PreviewIsDirty = true; - UndoRecordObject( "Changing value EditorGUIObjectField on node Triplanar Node" ); - m_topTexture.Value = newValue != null ? (Texture2D)newValue : null; - - if( m_materialMode ) - m_requireMaterialUpdate = true; - } - } - - if( commandName.Equals( "ObjectSelectorClosed" ) ) - m_editing = false; - } - - if( GUI.Button( startPickerClone, string.Empty, GUIStyle.none ) ) - { - if( m_topTexPort.IsConnected ) - { - UIUtils.FocusOnNode( m_topTexPort.GetOutputNode( 0 ), 1, true ); - } - else - { - if( m_topTexture.Value != null ) - { - Selection.activeObject = m_topTexture.Value; - EditorGUIUtility.PingObject( Selection.activeObject ); - } - } - m_editing = false; - } - - if( m_selectedTriplanarType == TriplanarType.Cylindrical ) - { - startPickerClone.y += startPickerClone.height; - if( GUI.Button( startPickerClone, string.Empty, GUIStyle.none ) ) - { - if( m_midTexPort.IsConnected ) - { - UIUtils.FocusOnNode( m_midTexPort.GetOutputNode( 0 ), 1, true ); - } - else - { - if( m_midTexture.Value != null ) - { - Selection.activeObject = m_midTexture.Value; - EditorGUIUtility.PingObject( Selection.activeObject ); - } - } - m_editing = false; - } - - startPickerClone.y += startPickerClone.height; - if( GUI.Button( startPickerClone, string.Empty, GUIStyle.none ) ) - { - if( m_botTexPort.IsConnected ) - { - UIUtils.FocusOnNode( m_botTexPort.GetOutputNode( 0 ), 1, true ); - } - else - { - if( m_botTexture.Value != null ) - { - Selection.activeObject = m_botTexture.Value; - EditorGUIUtility.PingObject( Selection.activeObject ); - } - } - m_editing = false; - } - } - } - - pickerButtonClone = m_pickerButton; - startPickerClone = m_startPicker; - - if( drawInfo.CurrentEventType == EventType.Repaint ) - { - // Top - if( m_topTexPort.IsConnected ) - { - EditorGUI.DrawPreviewTexture( startPickerClone, m_topTexPort.GetOutputConnection( 0 ).OutputPreviewTexture, null, ScaleMode.ScaleAndCrop ); - } - else if( m_topTexture.Value != null ) - { - EditorGUI.DrawPreviewTexture( startPickerClone, m_topTexture.Value, null, ScaleMode.ScaleAndCrop ); - if( ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD2 ) - GUI.Label( pickerButtonClone, "Select", UIUtils.MiniSamplerButton ); - } - else - { - GUI.Label( startPickerClone, string.Empty, UIUtils.ObjectFieldThumb ); - if( ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD2 ) - { - GUI.Label( startPickerClone, "None (Texture2D)", UIUtils.MiniObjectFieldThumbOverlay ); - GUI.Label( pickerButtonClone, "Select", UIUtils.MiniSamplerButton ); - } - } - GUI.Label( startPickerClone, string.Empty, UIUtils.GetCustomStyle( CustomStyle.SamplerFrame ) ); - - if( m_selectedTriplanarType == TriplanarType.Cylindrical ) - { - // Mid - startPickerClone.y += startPickerClone.height; - pickerButtonClone.y += startPickerClone.height; - if( m_midTexPort.IsConnected ) - { - EditorGUI.DrawPreviewTexture( startPickerClone, m_midTexPort.GetOutputConnection( 0 ).OutputPreviewTexture, null, ScaleMode.ScaleAndCrop ); - } - else if( m_midTexture.Value != null ) - { - EditorGUI.DrawPreviewTexture( startPickerClone, m_midTexture.Value, null, ScaleMode.ScaleAndCrop ); - if( ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD2 ) - GUI.Label( pickerButtonClone, "Select", UIUtils.MiniSamplerButton ); - } - else - { - GUI.Label( startPickerClone, string.Empty, UIUtils.ObjectFieldThumb ); - if( ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD2 ) - { - GUI.Label( startPickerClone, "None (Texture2D)", UIUtils.MiniObjectFieldThumbOverlay ); - GUI.Label( pickerButtonClone, "Select", UIUtils.MiniSamplerButton ); - } - } - GUI.Label( startPickerClone, string.Empty, UIUtils.GetCustomStyle( CustomStyle.SamplerFrame ) ); - - // Bot - startPickerClone.y += startPickerClone.height; - startPickerClone.height = 42 * drawInfo.InvertedZoom; - pickerButtonClone.y += startPickerClone.height; - if( m_botTexPort.IsConnected ) - { - EditorGUI.DrawPreviewTexture( startPickerClone, m_botTexPort.GetOutputConnection( 0 ).OutputPreviewTexture, null, ScaleMode.ScaleAndCrop ); - } - else if( m_botTexture.Value != null ) - { - EditorGUI.DrawPreviewTexture( startPickerClone, m_botTexture.Value, null, ScaleMode.ScaleAndCrop ); - if( ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD2 ) - GUI.Label( pickerButtonClone, "Select", UIUtils.MiniSamplerButton ); - } - else - { - GUI.Label( startPickerClone, string.Empty, UIUtils.ObjectFieldThumb ); - if( ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD2 ) - { - GUI.Label( startPickerClone, "None (Texture2D)", UIUtils.MiniObjectFieldThumbOverlay ); - GUI.Label( pickerButtonClone, "Select", UIUtils.MiniSamplerButton ); - } - } - GUI.Label( startPickerClone, string.Empty, UIUtils.GetCustomStyle( CustomStyle.SamplerFrame ) ); - } - } - } - - public override void OnNodeDoubleClicked( Vector2 currentMousePos2D ) - { - if( currentMousePos2D.y - m_globalPosition.y > Constants.NODE_HEADER_HEIGHT + Constants.NODE_HEADER_EXTRA_HEIGHT ) - { - ContainerGraph.ParentWindow.ParametersWindow.IsMaximized = !ContainerGraph.ParentWindow.ParametersWindow.IsMaximized; - } - else - { - m_editPropertyNameMode = true; - GUI.FocusControl( m_uniqueName ); - TextEditor te = (TextEditor)GUIUtility.GetStateObject( typeof( TextEditor ), GUIUtility.keyboardControl ); - if( te != null ) - { - te.SelectAll(); - } - } - } - - public override void OnNodeSelected( bool value ) - { - base.OnNodeSelected( value ); - if( !value ) - m_editPropertyNameMode = false; - } - - public override void DrawTitle( Rect titlePos ) - { - if( m_editPropertyNameMode ) - { - titlePos.height = Constants.NODE_HEADER_HEIGHT; - EditorGUI.BeginChangeCheck(); - GUI.SetNextControlName( m_uniqueName ); - m_propertyInspectorName = GUITextField( titlePos, m_propertyInspectorName, UIUtils.GetCustomStyle( CustomStyle.NodeTitle ) ); - if( EditorGUI.EndChangeCheck() ) - { - SetTitleText( m_propertyInspectorName ); - } - - if( Event.current.isKey && ( Event.current.keyCode == KeyCode.Return || Event.current.keyCode == KeyCode.KeypadEnter ) ) - { - m_editPropertyNameMode = false; - GUIUtility.keyboardControl = 0; - } - } - else - { - base.DrawTitle( titlePos ); - } - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - bool sampleThroughMacros = UIUtils.CurrentWindow.OutsideGraph.SamplingThroughMacros; - //ConfigureFunctions(); - if( dataCollector.IsSRP ) - { - if( m_arraySupport ) - { - dataCollector.AddToDirectives( Constants.CustomASEStandardSamplerParams ); - for( int i = 0; i < Constants.CustomASESRPTextureArrayMacros.Length; i++ ) - dataCollector.AddToDirectives( Constants.CustomASESRPTextureArrayMacros[ i ] ); - } - else - { - if( sampleThroughMacros ) - { - dataCollector.AddToDirectives( Constants.CustomASESRPSamplerParams ); - } - else - { - dataCollector.AddToDirectives( Constants.CustomASEStandardSamplerParams ); - } - } - } - else - { - dataCollector.AddToDirectives( Constants.CustomASEStandardSamplerParams ); - } - dataCollector.AddPropertyNode( m_topTexture ); - dataCollector.AddPropertyNode( m_midTexture ); - dataCollector.AddPropertyNode( m_botTexture ); - - bool isVertex = ( dataCollector.PortCategory == MasterNodePortCategory.Tessellation || dataCollector.PortCategory == MasterNodePortCategory.Vertex ); - - string texTop = string.Empty; - string texMid = string.Empty; - string texBot = string.Empty; - - if( m_topTexPort.IsConnected ) - { - texTop = m_topTexPort.GeneratePortInstructions( ref dataCollector ); - } - else - { - dataCollector.AddToUniforms( UniqueId, m_topTexture.GetTexture2DUniformValue() ); - dataCollector.AddToProperties( UniqueId, m_topTexture.GetTexture2DPropertyValue(), m_topTexture.OrderIndex ); - texTop = m_topTexture.PropertyName; - } - - if( m_selectedTriplanarType == TriplanarType.Spherical ) - { - texMid = texTop; - texBot = texTop; - - if( sampleThroughMacros ) - { - dataCollector.AddToUniforms( UniqueId, string.Format( Constants.SamplerDeclarationSRPMacros[ TextureType.Texture2D ], texTop ) ); - texTop = string.Format( "TEXTURE2D_ARGS({0},sampler{0})", texTop ); - } - } - else - { - if( m_midTexPort.IsConnected ) - { - texMid = m_midTexPort.GeneratePortInstructions( ref dataCollector ); - } - else - { - dataCollector.AddToUniforms( UniqueId, m_midTexture.GetTexture2DUniformValue() ); - dataCollector.AddToProperties( UniqueId, m_midTexture.GetTexture2DPropertyValue(), m_midTexture.OrderIndex ); - texMid = m_midTexture.PropertyName; - } - - if( m_botTexPort.IsConnected ) - { - texBot = m_botTexPort.GeneratePortInstructions( ref dataCollector ); - } - else - { - dataCollector.AddToUniforms( UniqueId, m_botTexture.GetTexture2DUniformValue() ); - dataCollector.AddToProperties( UniqueId, m_botTexture.GetTexture2DPropertyValue(), m_botTexture.OrderIndex ); - texBot = m_botTexture.PropertyName; - } - - if( sampleThroughMacros ) - { - dataCollector.AddToUniforms( UniqueId, string.Format( Constants.SamplerDeclarationSRPMacros[ TextureType.Texture2D ], texTop ) ); - texTop = string.Format( "TEXTURE2D_ARGS({0},sampler{0})", texTop ); - dataCollector.AddToUniforms( UniqueId, string.Format( Constants.SamplerDeclarationSRPMacros[ TextureType.Texture2D ], texMid ) ); - texMid = string.Format( "TEXTURE2D_ARGS({0},sampler{0})", texMid ); - dataCollector.AddToUniforms( UniqueId, string.Format( Constants.SamplerDeclarationSRPMacros[ TextureType.Texture2D ], texBot ) ); - texBot = string.Format( "TEXTURE2D_ARGS({0},sampler{0})", texBot ); - } - } - - if( !isVertex ) - { - dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_POS ); - dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_NORMAL, CurrentPrecisionType ); - dataCollector.AddToInput( UniqueId, SurfaceInputs.INTERNALDATA, addSemiColon: false ); - dataCollector.ForceNormal = true; - } - - string topIndex = "0"; - string midIndex = "0"; - string botIndex = "0"; - - if( m_arraySupport && ( !m_topTexPort.IsConnected && m_selectedTriplanarType == TriplanarType.Spherical - || m_selectedTriplanarType == TriplanarType.Cylindrical && !( m_topTexPort.IsConnected && m_midTexPort.IsConnected && m_botTexPort.IsConnected ) ) ) - m_arraySupport = false; - - if( m_arraySupport ) - { - topIndex = m_topIndexPort.GeneratePortInstructions( ref dataCollector ); - if( m_selectedTriplanarType == TriplanarType.Cylindrical ) - { - midIndex = m_midIndexPort.GeneratePortInstructions( ref dataCollector ); - botIndex = m_botIndexPort.GeneratePortInstructions( ref dataCollector ); - } - } - - string tiling = m_tilingPort.GeneratePortInstructions( ref dataCollector ); - string falloff = m_falloffPort.GeneratePortInstructions( ref dataCollector ); - - bool scaleNormals = false; - if( m_scalePort.IsConnected || ( m_scalePort.IsConnected && ( m_scalePort.Vector3InternalData == Vector3.one || m_scalePort.FloatInternalData == 1 ) ) ) - scaleNormals = true; - - string samplingTriplanar = string.Empty; - string headerID = string.Empty; - string header = string.Empty; - string callHeader = string.Empty; - string samplers = string.Empty; - string extraArguments = string.Empty; - List<string> triplanarBody = new List<string>(); - - triplanarBody.AddRange( m_functionSamplingBodyProj ); - if( m_selectedTriplanarType == TriplanarType.Spherical ) - { - headerID += "S"; - samplers = m_arraySupport ? ( dataCollector.IsSRP ? m_singularArrayTextureSRP : m_singularArrayTextureStandard ) : (sampleThroughMacros? m_singularTextureSRP : m_singularTextureRegular); - - triplanarBody.AddRange( m_functionSamplingBodySampSphere ); - - if( m_normalCorrection ) - { - headerID += "N"; - if( scaleNormals ) - { - ConvertListTo( dataCollector, true, m_functionSamplingBodySignsSphereScale, triplanarBody ); - //triplanarBody.AddRange( m_functionSamplingBodySignsSphereScale ); - } - else - { - ConvertListTo( dataCollector, false, m_functionSamplingBodySignsSphere, triplanarBody ); - //triplanarBody.AddRange( m_functionSamplingBodySignsSphere ); - } - triplanarBody.AddRange( m_functionSamplingBodyReturnSphereNormalize ); - } - else - { - triplanarBody.AddRange( m_functionSamplingBodyReturnSphere ); - } - } - else - { - headerID += "C"; - samplers = m_arraySupport ? ( dataCollector.IsSRP ? m_topmidbotArrayTextureSRP : m_topmidbotArrayTextureStandard ) :( sampleThroughMacros? m_topmidbotTextureSRP: m_topmidbotTextureRegular); - extraArguments = ", {7}, {8}"; - triplanarBody.AddRange( m_functionSamplingBodyNegProj ); - - triplanarBody.AddRange( m_functionSamplingBodySampCylinder ); - - if( m_normalCorrection ) - { - headerID += "N"; - if( scaleNormals ) - { - //triplanarBody.AddRange( m_functionSamplingBodySignsSphereScale ); - ConvertListTo( dataCollector, true, m_functionSamplingBodySignsSphereScale, triplanarBody ); - ConvertListTo( dataCollector, true, m_functionSamplingBodySignsCylinderScale, triplanarBody ); - //triplanarBody.AddRange( m_functionSamplingBodySignsCylinderScale ); - } - else - { - //triplanarBody.AddRange( m_functionSamplingBodySignsSphere ); - ConvertListTo( dataCollector, false, m_functionSamplingBodySignsSphere, triplanarBody ); - ConvertListTo( dataCollector, false, m_functionSamplingBodySignsCylinder, triplanarBody ); - //triplanarBody.AddRange( m_functionSamplingBodySignsCylinder ); - } - triplanarBody.AddRange( m_functionSamplingBodyReturnCylinderNormalize ); - } - else - { - triplanarBody.AddRange( m_functionSamplingBodyReturnCylinder ); - } - } - - if( isVertex ) - { - if( m_arraySupport ) - { - string arrayFetch = dataCollector.IsSRP ? "ASE_SAMPLE_TEXTURE2D_ARRAY_LOD" : "UNITY_SAMPLE_TEX2DARRAY_LOD"; - - headerID += "VA"; - for( int i = 0; i < triplanarBody.Count; i++ ) - triplanarBody[ i ] = string.Format( triplanarBody[ i ], arrayFetch, "float3( ", ", 0 ), index.x", ", 0 ), index.y", ", 0 ), index.z" ); - } - else - { - headerID += "V"; - string sampleFunc = sampleThroughMacros ? "SAMPLE_TEXTURE2DLOD" : "tex2Dlod"; - for( int i = 0; i < triplanarBody.Count; i++ ) - triplanarBody[ i ] = string.Format( triplanarBody[ i ], sampleFunc, "float4( ", ", 0, 0 )", ", 0, 0 )", ", 0, 0 )" ); - } - } - else - { - if( m_arraySupport ) - { - string arrayFetch = dataCollector.IsSRP ? "ASE_SAMPLE_TEXTURE2D_ARRAY" : "UNITY_SAMPLE_TEX2DARRAY"; - headerID += "FA"; - for( int i = 0; i < triplanarBody.Count; i++ ) - triplanarBody[ i ] = string.Format( triplanarBody[ i ], arrayFetch, "float3( ", ", index.x )", ", index.y )", ", index.z )" ); - } - else - { - headerID += "F"; - string sampleFunc = sampleThroughMacros ? "SAMPLE_TEXTURE2D" : "tex2D"; - for( int i = 0; i < triplanarBody.Count; i++ ) - { - triplanarBody[ i ] = string.Format( triplanarBody[ i ], sampleFunc, "", "", "", "" ); - - } - } - } - - string type = UIUtils.WirePortToCgType( m_outputPorts[ 0 ].DataType ); - header = string.Format( m_functionHeader, type, headerID, samplers ); - callHeader = string.Format( m_functionCall, headerID, "{0}, {1}, {2}, {3}, {4}, {5}, {6}" + extraArguments ); - - IOUtils.AddFunctionHeader( ref samplingTriplanar, header ); - foreach( string line in triplanarBody ) - IOUtils.AddFunctionLine( ref samplingTriplanar, line ); - IOUtils.CloseFunctionBody( ref samplingTriplanar ); - - string pos = GeneratorUtils.GenerateWorldPosition( ref dataCollector, UniqueId ); - string norm = GeneratorUtils.GenerateWorldNormal( ref dataCollector, UniqueId ); - string worldToTangent = string.Empty; - if( m_normalCorrection ) - worldToTangent = GeneratorUtils.GenerateWorldToTangentMatrix( ref dataCollector, UniqueId, CurrentPrecisionType ); - - if( m_selectedTriplanarSpace == TriplanarSpace.Object ) - { - if( m_normalCorrection ) - { - string vt = GeneratorUtils.GenerateVertexTangent( ref dataCollector, UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT3 ); - string vbt = GeneratorUtils.GenerateVertexBitangent( ref dataCollector, UniqueId, CurrentPrecisionType ); - norm = GeneratorUtils.GenerateVertexNormal( ref dataCollector, UniqueId, CurrentPrecisionType ); - dataCollector.AddLocalVariable( UniqueId, "float3x3 objectToTangent = float3x3("+ vt + ", "+ vbt + ", "+ norm + ");" ); - pos = GeneratorUtils.GenerateVertexPosition( ref dataCollector, UniqueId, WirePortDataType.FLOAT3 ); - worldToTangent = "objectToTangent"; - } - else - { - pos = GeneratorUtils.GenerateVertexPosition( ref dataCollector, UniqueId, WirePortDataType.FLOAT3 ); - norm = GeneratorUtils.GenerateVertexNormal( ref dataCollector, UniqueId, CurrentPrecisionType ); - } - } - - if( m_posPort.IsConnected ) - { - pos = m_posPort.GeneratePortInstructions( ref dataCollector ); - } - - string call = string.Empty; - - if( m_arraySupport ) - { - string arrayPassParams = dataCollector.IsSRP ? "ASE_TEXTURE2D_ARRAY_PARAM" : "UNITY_PASS_TEX2DARRAY"; - texTop = arrayPassParams + "(" + texTop + ")"; - texMid = arrayPassParams + "(" + texMid + ")"; - texBot = arrayPassParams + "(" + texBot + ")"; - } - - string normalScale = m_scalePort.GeneratePortInstructions( ref dataCollector ); - - if( m_selectedTriplanarType == TriplanarType.Spherical ) - call = dataCollector.AddFunctions( callHeader, samplingTriplanar, texTop, pos, norm, falloff, tiling, normalScale, topIndex ); - else - call = dataCollector.AddFunctions( callHeader, samplingTriplanar, texTop, texMid, texBot, pos, norm, falloff, tiling, normalScale, "float3(" + topIndex + "," + midIndex + "," + botIndex + ")" ); - dataCollector.AddToLocalVariables( dataCollector.PortCategory, UniqueId, type + " triplanar" + OutputId + " = " + call + ";" ); - if( m_normalCorrection ) - { - dataCollector.AddToLocalVariables( dataCollector.PortCategory, UniqueId, "float3 tanTriplanarNormal" + OutputId + " = mul( " + worldToTangent + ", triplanar" + OutputId + " );" ); - return GetOutputVectorItem( 0, outputId, "tanTriplanarNormal" + OutputId ); - } - else - { - return GetOutputVectorItem( 0, outputId, "triplanar" + OutputId ); - } - } - - public override void UpdateMaterial( Material mat ) - { - base.UpdateMaterial( mat ); - m_topTexture.OnPropertyNameChanged(); - if( mat.HasProperty( m_topTexture.PropertyName ) && !InsideShaderFunction ) - { - mat.SetTexture( m_topTexture.PropertyName, m_topTexture.MaterialValue ); - } - - m_midTexture.OnPropertyNameChanged(); - if( mat.HasProperty( m_midTexture.PropertyName ) && !InsideShaderFunction ) - { - mat.SetTexture( m_midTexture.PropertyName, m_midTexture.MaterialValue ); - } - - m_botTexture.OnPropertyNameChanged(); - if( mat.HasProperty( m_botTexture.PropertyName ) && !InsideShaderFunction ) - { - mat.SetTexture( m_botTexture.PropertyName, m_botTexture.MaterialValue ); - } - } - - public void SetDelayedMaterialMode( Material mat ) - { - m_topTexture.SetMaterialMode( mat, false ); - if( mat.HasProperty( m_topTexture.PropertyName ) ) - { - m_topTexture.MaterialValue = mat.GetTexture( m_topTexture.PropertyName ); - } - - m_midTexture.SetMaterialMode( mat, false ); - if( mat.HasProperty( m_midTexture.PropertyName ) ) - { - m_midTexture.MaterialValue = mat.GetTexture( m_midTexture.PropertyName ); - } - - m_botTexture.SetMaterialMode( mat, false ); - if( mat.HasProperty( m_botTexture.PropertyName ) ) - { - m_botTexture.MaterialValue = mat.GetTexture( m_botTexture.PropertyName ); - } - } - - public override void ForceUpdateFromMaterial( Material material ) - { - base.ForceUpdateFromMaterial( material ); - if( material.HasProperty( m_topTexture.PropertyName ) ) - { - m_topTexture.MaterialValue = material.GetTexture( m_topTexture.PropertyName ); - PreviewIsDirty = true; - } - - if( material.HasProperty( m_midTexture.PropertyName ) ) - { - m_midTexture.MaterialValue = material.GetTexture( m_midTexture.PropertyName ); - PreviewIsDirty = true; - } - - if( material.HasProperty( m_botTexture.PropertyName ) ) - { - m_botTexture.MaterialValue = material.GetTexture( m_botTexture.PropertyName ); - PreviewIsDirty = true; - } - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - m_selectedTriplanarType = (TriplanarType)Enum.Parse( typeof( TriplanarType ), GetCurrentParam( ref nodeParams ) ); - m_selectedTriplanarSpace = (TriplanarSpace)Enum.Parse( typeof( TriplanarSpace ), GetCurrentParam( ref nodeParams ) ); - m_normalCorrection = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - - m_tempTopInspectorName = GetCurrentParam( ref nodeParams ); - m_tempTopName = GetCurrentParam( ref nodeParams ); - m_tempTopDefaultValue = (TexturePropertyValues)Enum.Parse( typeof( TexturePropertyValues ), GetCurrentParam( ref nodeParams ) ); - m_tempTopOrderIndex = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - m_tempTopDefaultTexture = AssetDatabase.LoadAssetAtPath<Texture2D>( GetCurrentParam( ref nodeParams ) ); - - m_tempMidInspectorName = GetCurrentParam( ref nodeParams ); - m_tempMidName = GetCurrentParam( ref nodeParams ); - m_tempMidDefaultValue = (TexturePropertyValues)Enum.Parse( typeof( TexturePropertyValues ), GetCurrentParam( ref nodeParams ) ); - m_tempMidOrderIndex = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - m_tempMidDefaultTexture = AssetDatabase.LoadAssetAtPath<Texture2D>( GetCurrentParam( ref nodeParams ) ); - - m_tempBotInspectorName = GetCurrentParam( ref nodeParams ); - m_tempBotName = GetCurrentParam( ref nodeParams ); - m_tempBotDefaultValue = (TexturePropertyValues)Enum.Parse( typeof( TexturePropertyValues ), GetCurrentParam( ref nodeParams ) ); - m_tempBotOrderIndex = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - m_tempBotDefaultTexture = AssetDatabase.LoadAssetAtPath<Texture2D>( GetCurrentParam( ref nodeParams ) ); - - if( UIUtils.CurrentShaderVersion() > 6102 ) - m_propertyInspectorName = GetCurrentParam( ref nodeParams ); - - if( UIUtils.CurrentShaderVersion() > 13701 ) - m_arraySupport = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - - SetTitleText( m_propertyInspectorName ); - - ConfigurePorts(); - } - - public override void RefreshExternalReferences() - { - base.RefreshExternalReferences(); - - Init(); - - ReadPropertiesData(); - - ConfigurePorts(); - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_selectedTriplanarType ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_selectedTriplanarSpace ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_normalCorrection ); - - IOUtils.AddFieldValueToString( ref nodeInfo, m_topTexture.PropertyInspectorName ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_topTexture.PropertyName ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_topTexture.DefaultTextureValue ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_topTexture.OrderIndex.ToString() ); - IOUtils.AddFieldValueToString( ref nodeInfo, ( m_topTexture.DefaultValue != null ) ? AssetDatabase.GetAssetPath( m_topTexture.DefaultValue ) : Constants.NoStringValue ); - - IOUtils.AddFieldValueToString( ref nodeInfo, m_midTexture.PropertyInspectorName ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_midTexture.PropertyName ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_midTexture.DefaultTextureValue ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_midTexture.OrderIndex.ToString() ); - IOUtils.AddFieldValueToString( ref nodeInfo, ( m_midTexture.DefaultValue != null ) ? AssetDatabase.GetAssetPath( m_midTexture.DefaultValue ) : Constants.NoStringValue ); - - IOUtils.AddFieldValueToString( ref nodeInfo, m_botTexture.PropertyInspectorName ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_botTexture.PropertyName ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_botTexture.DefaultTextureValue ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_botTexture.OrderIndex.ToString() ); - IOUtils.AddFieldValueToString( ref nodeInfo, ( m_botTexture.DefaultValue != null ) ? AssetDatabase.GetAssetPath( m_botTexture.DefaultValue ) : Constants.NoStringValue ); - - IOUtils.AddFieldValueToString( ref nodeInfo, m_propertyInspectorName ); - - IOUtils.AddFieldValueToString( ref nodeInfo, m_arraySupport ); - } - public override void RefreshOnUndo() - { - base.RefreshOnUndo(); - if( m_topTexture != null ) - { - m_topTexture.BeginPropertyFromInspectorCheck(); - } - - if( m_midTexture != null ) - { - m_midTexture.BeginPropertyFromInspectorCheck(); - } - - if( m_botTexture != null ) - { - m_botTexture.BeginPropertyFromInspectorCheck(); - } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/TriplanarNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/TriplanarNode.cs.meta deleted file mode 100644 index 39ce8dae..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/TriplanarNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 396e5bf33f08d3a42a19d7b161f573f2 -timeCreated: 1490358806 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/UnityObjToClipPosHlpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/UnityObjToClipPosHlpNode.cs deleted file mode 100644 index 277effc3..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/UnityObjToClipPosHlpNode.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Object To Clip Pos", "Object Transform", "Transforms a point from object space to the camera’s clip space in homogeneous coordinates" )] - public sealed class UnityObjToClipPosHlpNode : HelperParentNode - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_funcType = "UnityObjectToClipPos"; - //TODO: revisit this later - m_funcLWFormatOverride = "TransformWorldToHClip(TransformObjectToWorld({0}))"; - m_funcHDFormatOverride = "TransformWorldToHClip(TransformObjectToWorld({0}))"; - m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT3, false ); - m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT4, false ); - m_outputPorts[ 0 ].Name = "XYZW"; - AddOutputPort( WirePortDataType.FLOAT, "X" ); - AddOutputPort( WirePortDataType.FLOAT, "Y" ); - AddOutputPort( WirePortDataType.FLOAT, "Z" ); - AddOutputPort( WirePortDataType.FLOAT, "W" ); - m_previewShaderGUID = "14ec765a147a53340877b489e73f1c9f"; - } - - protected override void OnUniqueIDAssigned() - { - base.OnUniqueIDAssigned(); - m_localVarName = "unityObjectToClipPos" + OutputId; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/UnityObjToClipPosHlpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/UnityObjToClipPosHlpNode.cs.meta deleted file mode 100644 index 0f62b63f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/UnityObjToClipPosHlpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: c01e190d996825f42bdc81e1fab5e897 -timeCreated: 1481126959 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/UnityObjToViewPosHlpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/UnityObjToViewPosHlpNode.cs deleted file mode 100644 index 89258e80..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/UnityObjToViewPosHlpNode.cs +++ /dev/null @@ -1,33 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Object To View Pos", "Object Transform", "Transforms a point from object space to view space" )] - public sealed class UnityObjToViewPosHlpNode : HelperParentNode - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_funcType = "UnityObjectToViewPos"; - //TODO: revisit this later - m_funcLWFormatOverride = "TransformWorldToView( TransformObjectToWorld( {0}) )"; - m_funcHDFormatOverride = "TransformWorldToView( TransformObjectToWorld( {0}) )"; - m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT3, false ); - m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT3, false ); - m_outputPorts[ 0 ].Name = "XYZ"; - AddOutputPort( WirePortDataType.FLOAT, "X" ); - AddOutputPort( WirePortDataType.FLOAT, "Y" ); - AddOutputPort( WirePortDataType.FLOAT, "Z" ); - m_previewShaderGUID = "b790bc1d468a51840a9facef372b4729"; - } - - protected override void OnUniqueIDAssigned() - { - base.OnUniqueIDAssigned(); - m_localVarName = "unityObjectToViewPos" + OutputId; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/UnityObjToViewPosHlpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/UnityObjToViewPosHlpNode.cs.meta deleted file mode 100644 index c0ea4e5a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/UnityObjToViewPosHlpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 5f35cf284cf7d2b47be5a32426fc7a77 -timeCreated: 1481126956 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/WorldSpaceLightDirHlpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/WorldSpaceLightDirHlpNode.cs deleted file mode 100644 index 28480030..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/WorldSpaceLightDirHlpNode.cs +++ /dev/null @@ -1,78 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using UnityEngine; -using UnityEditor; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "World Space Light Dir", "Light", "Computes normalized world space light direction" )] - public sealed class WorldSpaceLightDirHlpNode : HelperParentNode - { - private const string NormalizeOptionStr = "Safe Normalize"; - - [SerializeField] - private bool m_safeNormalize = false; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_funcType = "UnityWorldSpaceLightDir"; - m_inputPorts[ 0 ].Visible = false; - m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT3, false ); - m_outputPorts[ 0 ].Name = "XYZ"; - - AddOutputPort( WirePortDataType.FLOAT, "X" ); - AddOutputPort( WirePortDataType.FLOAT, "Y" ); - AddOutputPort( WirePortDataType.FLOAT, "Z" ); - - m_useInternalPortData = false; - m_drawPreviewAsSphere = true; - m_autoWrapProperties = true; - m_textLabelWidth = 120; - m_previewShaderGUID = "2e8dc46eb6fb2124d9f0007caf9567e3"; - } - - public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) - { - base.PropagateNodeData( nodeData, ref dataCollector ); - if( m_safeNormalize ) - dataCollector.SafeNormalizeLightDir = true; - } - - public override void DrawProperties() - { - base.DrawProperties(); - m_safeNormalize = EditorGUILayoutToggle( NormalizeOptionStr, m_safeNormalize ); - EditorGUILayout.HelpBox( "Having safe normalize ON makes sure your light vector is not zero even if there's no lights in your scene.", MessageType.None ); - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if( dataCollector.IsTemplate ) - return GetOutputVectorItem( 0, outputId, dataCollector.TemplateDataCollectorInstance.GetWorldSpaceLightDir( CurrentPrecisionType ) ); ; - - dataCollector.AddToIncludes( UniqueId, Constants.UnityCgLibFuncs ); - dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_POS ); - - return GetOutputVectorItem( 0, outputId, GeneratorUtils.GenerateWorldLightDirection( ref dataCollector, UniqueId, CurrentPrecisionType ) ); - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - if( UIUtils.CurrentShaderVersion() > 15201 ) - { - m_safeNormalize = 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_safeNormalize ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/WorldSpaceLightDirHlpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/WorldSpaceLightDirHlpNode.cs.meta deleted file mode 100644 index 87a3bc36..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/WorldSpaceLightDirHlpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 2134a58fb8235524d84046a051bce6b5 -timeCreated: 1481126954 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/WorldSpaceViewDirHlpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/WorldSpaceViewDirHlpNode.cs deleted file mode 100644 index 27b3dcbd..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/WorldSpaceViewDirHlpNode.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "World Space View Dir", "Object Transform", "World space direction (not normalized) from given object space vertex position towards the camera" )] - public sealed class WorldSpaceViewDirHlpNode : HelperParentNode - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_funcType = "WorldSpaceViewDir"; - //TODO: revisit this later - m_funcLWFormatOverride = "( _WorldSpaceCameraPos.xyz - mul(GetObjectToWorldMatrix(), {0} ).xyz )"; - m_funcHDFormatOverride = "( _WorldSpaceCameraPos.xyz - mul(GetObjectToWorldMatrix(), {0} ).xyz )"; - m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT4, false ); - m_inputPorts[ 0 ].Vector4InternalData = new UnityEngine.Vector4( 0, 0, 0, 1 ); - m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT3, false ); - m_outputPorts[ 0 ].Name = "XYZ"; - AddOutputPort( WirePortDataType.FLOAT, "X" ); - AddOutputPort( WirePortDataType.FLOAT, "Y" ); - AddOutputPort( WirePortDataType.FLOAT, "Z" ); - m_previewShaderGUID = "fe0e09756a8a0ba408015b43e66cb8a6"; - } - - protected override void OnUniqueIDAssigned() - { - base.OnUniqueIDAssigned(); - m_localVarName = "worldSpaceViewDir" + OutputId; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/WorldSpaceViewDirHlpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/WorldSpaceViewDirHlpNode.cs.meta deleted file mode 100644 index 4097cec0..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/HelperFuncs/WorldSpaceViewDirHlpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 61d7064bd5523634496fa412627603d7 -timeCreated: 1481126956 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ISignalGenerator.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ISignalGenerator.cs deleted file mode 100644 index aa649046..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ISignalGenerator.cs +++ /dev/null @@ -1,11 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -namespace AmplifyShaderEditor -{ - interface ISignalGenerator - { - void GenerateSignalPropagation(); - void GenerateSignalInibitor(); - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ISignalGenerator.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ISignalGenerator.cs.meta deleted file mode 100644 index 3bfa978a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ISignalGenerator.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: cfeab503d3318794ea1af322505320ef -timeCreated: 1481126959 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects.meta deleted file mode 100644 index ba29e65e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 2a5d24ae30c4ee74f81a2fa0615e2e95 -folderAsset: yes -timeCreated: 1481126945 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/BlendOpsNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/BlendOpsNode.cs deleted file mode 100644 index d7ac724f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/BlendOpsNode.cs +++ /dev/null @@ -1,443 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -//https://www.shadertoy.com/view/XdS3RW -//http://www.deepskycolors.com/archivo/2010/04/21/formulas-for-Photoshop-blending-modes.html -//http://www.pegtop.net/delphi/articles/blendmodes/softlight.htm - -using UnityEngine; -using UnityEditor; -using System; - -namespace AmplifyShaderEditor -{ - public enum BlendOps - { - ColorBurn, - ColorDodge, - Darken, - Divide, - Difference, - Exclusion, - SoftLight, - HardLight, - HardMix, - Lighten, - LinearBurn, - LinearDodge, - LinearLight, - Multiply, - Overlay, - PinLight, - Subtract, - Screen, - VividLight - } - [Serializable] - [NodeAttributes( "Blend Operations", "Image Effects", "Common layer blending modes" )] - public class BlendOpsNode : ParentNode - { - //private const string ASEHardLightCall = "ASEHardLight({0},{1})"; - //private const string ASEHardLightFunc = - //"inline float ASEHardLight( float srcLocalVar, float dstLocalVar ){" + - //" return ( ( srcLocalVar > 0.5 ) ? ( 1.0 - ( 1.0 - 2.0 * ( srcLocalVar - 0.5 ) ) * ( 1.0 - dstLocalVar ) ) : ( 2.0 * srcLocalVar * dstLocalVar ) ); }"; - - //private const string ASELinearLightCall = "ASELinearLight({0},{1})"; - //private const string ASELinearLightFunc = - //"inline float ASELinearLight( float srcLocalVar, float dstLocalVar ){" + - //" return ( ( srcLocalVar > 0.5 ) ? ( dstLocalVar + 2.0 * srcLocalVar - 1.0 ) : ( dstLocalVar + 2.0 * ( srcLocalVar - 0.5 ) ) ); }"; - - //private const string ASEOverlayCall = "ASEOverlay({0},{1})"; - //private const string ASEOverlayFunc = - //"inline float ASEOverlay( float srcLocalVar, float dstLocalVar ){" + - //" return ( ( dstLocalVar > 0.5 ) ? ( 1.0 - ( 1.0 - 2.0 * ( dstLocalVar - 0.5 ) ) * ( 1.0 - srcLocalVar ) ) : ( 2.0 * dstLocalVar * srcLocalVar ) ); }"; - ////" return (dstLocalVar < 0.5) ? 2.0 * srcLocalVar * dstLocalVar : 1.0 - 2.0 * (1.0 - srcLocalVar) * (1.0 - dstLocalVar); }"; - - //private const string ASEPinLightCall = "ASEPinLight({0},{1})"; - //private const string ASEPinLightFunc = - //"inline float ASEPinLight( float srcLocalVar, float dstLocalVar ){" + - //" return ( ( srcLocalVar > 0.5 ) ? max( dstLocalVar , 2.0 * ( srcLocalVar - 0.5 ) ) : min( dstLocalVar , 2.0 * srcLocalVar ) ); }"; - - //private const string ASEVividLightCall = "ASEVividLight({0},{1})"; - //private const string ASEVividLightFunc = "inline float ASEVividLight( float srcLocalVar, float dstLocalVar ){" + - //" return ( ( srcLocalVar > 0.5 ) ? ( dstLocalVar / ( ( 1.0 - srcLocalVar ) * 2.0 ) ) : ( 1.0 - ( ( ( 1.0 - dstLocalVar ) * 0.5 ) / srcLocalVar ) ) ); }"; - - private const string ASEDarkerColorCall = "ASEDarkerColor{}({0},{1})"; - private const string ASEDarkerColorFunc = "inline float ASEDarkerColor{0}( float srcLocalVar, float dstLocalVar ){" + - " return ({1} < {2}) ? s : d; }"; - - private const string ASELighterColorCall = "ASELighterColor{}({0},{1})"; - private const string ASELighterColorFunc = "inline float ASELighterColor{0}( float srcLocalVar, float dstLocalVar ){" + - " return ({1} > {2}) ? s : d; }"; - - private const string BlendOpsModeStr = "Blend Op"; - private const string SaturateResultStr = "Saturate"; - - [SerializeField] - private BlendOps m_currentBlendOp = BlendOps.ColorBurn; - - [SerializeField] - private WirePortDataType m_mainDataType = WirePortDataType.COLOR; - - [SerializeField] - private bool m_saturate = true; - - private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper(); - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.COLOR, false, "Source" ); - AddInputPort( WirePortDataType.COLOR, false, "Destiny" ); - AddInputPort( WirePortDataType.FLOAT, false,"Alpha" ); - m_inputPorts[ 2 ].FloatInternalData = 1; - AddOutputPort( WirePortDataType.COLOR, Constants.EmptyPortValue ); - m_inputPorts[ 0 ].AddPortForbiddenTypes( WirePortDataType.FLOAT3x3, - WirePortDataType.FLOAT4x4, - WirePortDataType.SAMPLER1D, - WirePortDataType.SAMPLER2D, - WirePortDataType.SAMPLER3D, - WirePortDataType.SAMPLERCUBE ); - m_inputPorts[ 1 ].AddPortForbiddenTypes( WirePortDataType.FLOAT3x3, - WirePortDataType.FLOAT4x4, - WirePortDataType.SAMPLER1D, - WirePortDataType.SAMPLER2D, - WirePortDataType.SAMPLER3D, - WirePortDataType.SAMPLERCUBE ); - m_textLabelWidth = 75; - m_autoWrapProperties = true; - m_hasLeftDropdown = true; - SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, m_currentBlendOp ) ); - m_useInternalPortData = true; - m_previewShaderGUID = "6d6b3518705b3ba49acdc6e18e480257"; - } - - public override void SetPreviewInputs() - { - base.SetPreviewInputs(); - - m_previewMaterialPassId = (int)m_currentBlendOp; - PreviewMaterial.SetInt( "_Sat", m_saturate ? 1 : 0 ); - int lerpMode = ( m_inputPorts[ 2 ].IsConnected || m_inputPorts[ 2 ].FloatInternalData < 1 ) ? 1 : 0; - PreviewMaterial.SetInt( "_Lerp", lerpMode ); - } - - public override void AfterCommonInit() - { - base.AfterCommonInit(); - - if( PaddingTitleLeft == 0 ) - { - PaddingTitleLeft = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; - if( PaddingTitleRight == 0 ) - PaddingTitleRight = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; - } - } - - public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) - { - base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); - UpdateConnection( portId ); - } - - 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 OnInputPortDisconnected( int portId ) - { - base.OnInputPortDisconnected( portId ); - UpdateDisconnection( portId ); - } - - void UpdateConnection( int portId ) - { - if( portId == 2 ) - return; - - m_inputPorts[ portId ].MatchPortToConnection(); - int otherPortId = ( portId + 1 ) % 2; - if( m_inputPorts[ otherPortId ].IsConnected ) - { - m_mainDataType = UIUtils.GetPriority( m_inputPorts[ 0 ].DataType ) > UIUtils.GetPriority( m_inputPorts[ 1 ].DataType ) ? m_inputPorts[ 0 ].DataType : m_inputPorts[ 1 ].DataType; - } - else - { - m_mainDataType = m_inputPorts[ portId ].DataType; - m_inputPorts[ otherPortId ].ChangeType( m_mainDataType, false ); - } - m_outputPorts[ 0 ].ChangeType( m_mainDataType, false ); - } - - void UpdateDisconnection( int portId ) - { - if( portId == 2 ) - return; - - int otherPortId = ( portId + 1 ) % 2; - if( m_inputPorts[ otherPortId ].IsConnected ) - { - m_mainDataType = m_inputPorts[ otherPortId ].DataType; - m_inputPorts[ portId ].ChangeType( m_mainDataType, false ); - m_outputPorts[ 0 ].ChangeType( m_mainDataType, false ); - } - } - - public override void DrawProperties() - { - base.DrawProperties(); - EditorGUI.BeginChangeCheck(); - m_currentBlendOp = (BlendOps)EditorGUILayoutEnumPopup( BlendOpsModeStr, m_currentBlendOp ); - if( EditorGUI.EndChangeCheck() ) - { - SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, m_currentBlendOp ) ); - } - m_saturate = EditorGUILayoutToggle( SaturateResultStr, m_saturate ); - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - m_upperLeftWidget.DrawWidget<BlendOps>( ref m_currentBlendOp, this, OnWidgetUpdate ); - } - - private readonly Action<ParentNode> OnWidgetUpdate = ( x ) => - { - x.SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, ( x as BlendOpsNode ).m_currentBlendOp ) ); - }; - - private string CreateMultiChannel( ref MasterNodeDataCollector dataCollector, string function, string srcLocalVar, string dstLocalVar, string varName ) - { - switch( m_outputPorts[ 0 ].DataType ) - { - default: - { - return string.Format( function, srcLocalVar, dstLocalVar ); - } - case WirePortDataType.FLOAT2: - { - string xChannelName = varName + OutputId + "X"; - string xChannelValue = string.Format( function, srcLocalVar + ".x", dstLocalVar + ".x" ); - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT, xChannelName, xChannelValue ); - - string yChannelName = varName + OutputId + "Y"; - string yChannelValue = string.Format( function, srcLocalVar + ".y", dstLocalVar + ".y" ); - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT, yChannelName, yChannelValue ); - - return string.Format( "float2({0},{1})", xChannelName, yChannelName ); - } - case WirePortDataType.FLOAT3: - { - string xChannelName = varName + OutputId + "X"; - string xChannelValue = string.Format( function, srcLocalVar + ".x", dstLocalVar + ".x" ); - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT, xChannelName, xChannelValue ); - - string yChannelName = varName + OutputId + "Y"; - string yChannelValue = string.Format( function, srcLocalVar + ".y", dstLocalVar + ".y" ); - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT, yChannelName, yChannelValue ); - - string zChannelName = varName + OutputId + "Z"; - string zChannelValue = string.Format( function, srcLocalVar + ".z", dstLocalVar + ".z" ); - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT, zChannelName, zChannelValue ); - - return string.Format( "float3({0},{1},{2})", xChannelName, yChannelName, zChannelName ); - } - case WirePortDataType.FLOAT4: - case WirePortDataType.COLOR: - { - string xChannelName = varName + OutputId + "X"; - string xChannelValue = string.Format( function, srcLocalVar + ".x", dstLocalVar + ".x" ); - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT, xChannelName, xChannelValue ); - - string yChannelName = varName + OutputId + "Y"; - string yChannelValue = string.Format( function, srcLocalVar + ".y", dstLocalVar + ".y" ); - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT, yChannelName, yChannelValue ); - - string zChannelName = varName + OutputId + "Z"; - string zChannelValue = string.Format( function, srcLocalVar + ".z", dstLocalVar + ".z" ); - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT, zChannelName, zChannelValue ); - - string wChannelName = varName + OutputId + "W"; - string wChannelValue = string.Format( function, srcLocalVar + ".w", dstLocalVar + ".w" ); - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT, wChannelName, wChannelValue ); - - return string.Format( "float4({0},{1},{2},{3})", xChannelName, yChannelName, zChannelName, wChannelName ); - } - } - } - - 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 src = m_inputPorts[ 0 ].GenerateShaderForOutput( ref dataCollector, m_mainDataType, false, true ); - string dst = m_inputPorts[ 1 ].GenerateShaderForOutput( ref dataCollector, m_mainDataType, false, true ); - - string srcLocalVar = "blendOpSrc" + OutputId; - string dstLocalVar = "blendOpDest" + OutputId; - dataCollector.AddLocalVariable( UniqueId, UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, m_mainDataType ) + " " + srcLocalVar, src + ";" ); - dataCollector.AddLocalVariable( UniqueId, UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, m_mainDataType ) + " " + dstLocalVar, dst + ";" ); - - int currIndent = UIUtils.ShaderIndentLevel; - if( dataCollector.MasterNodeCategory == AvailableShaderTypes.Template ) - { - UIUtils.ShaderIndentLevel = 0; - } - else - { - UIUtils.ShaderIndentLevel = 1; - UIUtils.ShaderIndentLevel++; - } - - string result = string.Empty; - switch( m_currentBlendOp ) - { - case BlendOps.ColorBurn: - { - result = string.Format( "( 1.0 - ( ( 1.0 - {0}) / max( {1}, 0.00001) ) )", dstLocalVar, srcLocalVar); - } - break; - case BlendOps.ColorDodge: - { - result = string.Format( "( {0}/ max( 1.0 - {1}, 0.00001 ) )", dstLocalVar, srcLocalVar ); - } - break; - case BlendOps.Darken: - { - result = "min( " + srcLocalVar + " , " + dstLocalVar + " )"; - } - break; - case BlendOps.Divide: - { - result = string.Format( "( {0} / max({1},0.00001) )", dstLocalVar, srcLocalVar ); - } - break; - case BlendOps.Difference: - { - result = "abs( " + srcLocalVar + " - " + dstLocalVar + " )"; - } - break; - case BlendOps.Exclusion: - { - result = "( 0.5 - 2.0 * ( " + srcLocalVar + " - 0.5 ) * ( " + dstLocalVar + " - 0.5 ) )"; - } - break; - case BlendOps.SoftLight: - { - result = string.Format( "2.0f*{0}*{1} + {0}*{0}*(1.0f - 2.0f*{1})", dstLocalVar, srcLocalVar ); - } - break; - case BlendOps.HardLight: - { - result = " (( " + srcLocalVar + " > 0.5 ) ? ( 1.0 - ( 1.0 - 2.0 * ( " + srcLocalVar + " - 0.5 ) ) * ( 1.0 - " + dstLocalVar + " ) ) : ( 2.0 * " + srcLocalVar + " * " + dstLocalVar + " ) )"; - //dataCollector.AddFunction( ASEHardLightCall, UIUtils.ShaderIndentTabs + ASEHardLightFunc ); - //result = CreateMultiChannel( ref dataCollector, ASEHardLightCall, srcLocalVar, dstLocalVar, "hardLightBlend" ); - } - break; - case BlendOps.HardMix: - { - result = " round( 0.5 * ( " + srcLocalVar + " + " + dstLocalVar + " ) )"; - } - break; - case BlendOps.Lighten: - { - result = " max( " + srcLocalVar + ", " + dstLocalVar + " )"; - } - break; - case BlendOps.LinearBurn: - { - result = "( " + srcLocalVar + " + " + dstLocalVar + " - 1.0 )"; - } - break; - case BlendOps.LinearDodge: - { - result = "( " + srcLocalVar + " + " + dstLocalVar + " )"; - } - break; - case BlendOps.LinearLight: - { - result = "(( " + srcLocalVar + " > 0.5 )? ( " + dstLocalVar + " + 2.0 * " + srcLocalVar + " - 1.0 ) : ( " + dstLocalVar + " + 2.0 * ( " + srcLocalVar + " - 0.5 ) ) )"; - //dataCollector.AddFunction( ASELinearLightCall, UIUtils.ShaderIndentTabs + ASELinearLightFunc ); - //result = CreateMultiChannel( ref dataCollector, ASELinearLightCall, srcLocalVar, dstLocalVar, "linearLightBlend" ); - } - break; - case BlendOps.Multiply: - { - result = "( " + srcLocalVar + " * " + dstLocalVar + " )"; - } - break; - case BlendOps.Overlay: - { - //result = "(( " + dstLocalVar + " > 0.5 ) ? ( 1.0 - ( 1.0 - 2.0 * ( " + dstLocalVar + " - 0.5 ) ) * ( 1.0 - " + srcLocalVar + " ) ) : ( 2.0 * " + dstLocalVar + " * " + srcLocalVar + " ) )"; - result = "(( " + dstLocalVar + " > 0.5 ) ? ( 1.0 - 2.0 * ( 1.0 - " + dstLocalVar + " ) * ( 1.0 - " + srcLocalVar + " ) ) : ( 2.0 * " + dstLocalVar + " * " + srcLocalVar + " ) )"; - //dataCollector.AddFunction( ASEOverlayCall, UIUtils.ShaderIndentTabs + ASEOverlayFunc ); - //result = CreateMultiChannel( ref dataCollector, ASEOverlayCall, srcLocalVar, dstLocalVar, "overlayBlend" ); - } - break; - case BlendOps.PinLight: - { - result = "(( " + srcLocalVar + " > 0.5 ) ? max( " + dstLocalVar + ", 2.0 * ( " + srcLocalVar + " - 0.5 ) ) : min( " + dstLocalVar + ", 2.0 * " + srcLocalVar + " ) )"; - //dataCollector.AddFunction( ASEPinLightCall, UIUtils.ShaderIndentTabs + ASEPinLightFunc ); - //result = CreateMultiChannel( ref dataCollector, ASEPinLightCall, srcLocalVar, dstLocalVar, "pinLightBlend" ); - } - break; - case BlendOps.Subtract: - { - result = "( " + dstLocalVar + " - " + srcLocalVar + " )"; - } - break; - case BlendOps.Screen: - { - result = "( 1.0 - ( 1.0 - " + srcLocalVar + " ) * ( 1.0 - " + dstLocalVar + " ) )"; - } - break; - case BlendOps.VividLight: - { - result = string.Format( "(( {0} > 0.5 ) ? ( {1} / max( ( 1.0 - {0} ) * 2.0 ,0.00001) ) : ( 1.0 - ( ( ( 1.0 - {1} ) * 0.5 ) / max( {0},0.00001) ) ) )", srcLocalVar, dstLocalVar); - //dataCollector.AddFunction( ASEVividLightCall, UIUtils.ShaderIndentTabs + ASEVividLightFunc ); - //result = CreateMultiChannel( ref dataCollector, ASEVividLightCall, srcLocalVar, dstLocalVar, "vividLightBlend" ); - } - break; - } - - UIUtils.ShaderIndentLevel = currIndent; - if( m_inputPorts[ 2 ].IsConnected || m_inputPorts[ 2 ].FloatInternalData < 1.0 ) - { - string opacity = m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ); - string lerpVar = "lerpBlendMode" + OutputId; - string lerpResult = string.Format( "lerp({0},{1},{2})", dstLocalVar, result, opacity ); - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, m_outputPorts[ 0 ].DataType, lerpVar, lerpResult ); - result = lerpVar; - } - - if( m_saturate ) - result = "( saturate( " + result + " ))"; - - return CreateOutputLocalVariable( 0, result, ref dataCollector ); - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_currentBlendOp ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_saturate ); - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - m_currentBlendOp = (BlendOps)Enum.Parse( typeof( BlendOps ), GetCurrentParam( ref nodeParams ) ); - m_saturate = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, m_currentBlendOp ) ); - } - - public override void Destroy() - { - base.Destroy(); - m_upperLeftWidget = null; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/BlendOpsNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/BlendOpsNode.cs.meta deleted file mode 100644 index 3a53cbc6..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/BlendOpsNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 09fb0867c2a616c488bad8929f4f7ad7 -timeCreated: 1481126953 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/DesaturateOpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/DesaturateOpNode.cs deleted file mode 100644 index 507c678d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/DesaturateOpNode.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -// http://stackoverflow.com/questions/9320953/what-algorithm-does-photoshop-use-to-desaturate-an-image -// https://www.shadertoy.com/view/lsdXDH - -namespace AmplifyShaderEditor -{ - [System.Serializable] - [NodeAttributes( "Desaturate", "Image Effects", "Generic desaturation operation" )] - public sealed class DesaturateOpNode : ParentNode - { - private const string GenericDesaturateOp0 = "dot( {0}, float3( 0.299, 0.587, 0.114 ))"; - private const string GenericDesaturateOp1 = "lerp( {0}, {1}.xxx, {2} )"; - //private const string GenericDesaturateOp = "lerp( {0},dot({0},float3(0.299,0.587,0.114)).xxx,{1})"; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT3, false, "RGB" ); - AddInputPort( WirePortDataType.FLOAT, false, "Fraction" ); - AddOutputPort( WirePortDataType.FLOAT3, Constants.EmptyPortValue ); - m_useInternalPortData = true; - m_previewShaderGUID = "faabe9efdf44b9648a523f1742abdfd3"; - } - - void UpdatePorts( int portId ) - { - if ( portId == 0 ) - { - m_inputPorts[ 0 ].MatchPortToConnection(); - m_outputPorts[ 0 ].ChangeType( m_inputPorts[ 0 ].DataType, 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 initalColorValue = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - string fraction = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); - - string initialColorVarName = "desaturateInitialColor" + OutputId; - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT3, initialColorVarName, initalColorValue ); - - string dotVarName = "desaturateDot" + OutputId; - string dotVarValue = string.Format( GenericDesaturateOp0, initialColorVarName ); - - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT, dotVarName, dotVarValue ); - RegisterLocalVariable( 0, string.Format( GenericDesaturateOp1, initialColorVarName, dotVarName,fraction ), ref dataCollector, "desaturateVar" + OutputId ); - - return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/DesaturateOpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/DesaturateOpNode.cs.meta deleted file mode 100644 index c931cbd2..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/DesaturateOpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: eddae0a124877fc47b28ae8853286174 -timeCreated: 1489414268 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/HSVToRGBNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/HSVToRGBNode.cs deleted file mode 100644 index a30c69aa..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/HSVToRGBNode.cs +++ /dev/null @@ -1,87 +0,0 @@ -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "HSV to RGB", "Image Effects", "Converts from HSV to RGB color space" )] - public sealed class HSVToRGBNode : ParentNode - { - public static readonly string HSVToRGBHeader = "HSVToRGB( {0}3({1},{2},{3}) )"; - public static readonly string[] HSVToRGBFunction = { "{0}3 HSVToRGB( {0}3 c )\n", - "{\n", - "\t{0}4 K = {0}4( 1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0 );\n", - "\t{0}3 p = abs( frac( c.xxx + K.xyz ) * 6.0 - K.www );\n", - "\treturn c.z * lerp( K.xxx, saturate( p - K.xxx ), c.y );\n", - "}\n"}; - public static readonly bool[] HSVToRGBFlags = { true, - false, - true, - true, - false, - false}; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT, false, "Hue" ); - AddInputPort( WirePortDataType.FLOAT, false, "Saturation" ); - AddInputPort( WirePortDataType.FLOAT, false, "Value" ); - AddOutputColorPorts( "RGB", false ); - m_previewShaderGUID = "fab445eb945d63047822a7a6b81b959d"; - m_useInternalPortData = true; - m_autoWrapProperties = true; - m_customPrecision = true; - } - - public override void DrawProperties() - { - base.DrawProperties(); - DrawPrecisionProperty(); - } - - public static void AddHSVToRGBFunction( ref MasterNodeDataCollector dataCollector , string precisionString ) - { - if( !dataCollector.HasFunction( HSVToRGBHeader ) ) - { - //Hack to be used util indent is properly used - int currIndent = UIUtils.ShaderIndentLevel; - if( dataCollector.MasterNodeCategory == AvailableShaderTypes.Template ) - { - UIUtils.ShaderIndentLevel = 0; - } - else - { - UIUtils.ShaderIndentLevel = 1; - UIUtils.ShaderIndentLevel++; - } - - string finalFunction = string.Empty; - for( int i = 0; i < HSVToRGBFunction.Length; i++ ) - { - finalFunction += UIUtils.ShaderIndentTabs + ( HSVToRGBFlags[ i ] ? string.Format( HSVToRGBFunction[ i ], precisionString ) : HSVToRGBFunction[ i ] ); - } - - UIUtils.ShaderIndentLevel = currIndent; - - dataCollector.AddFunction( HSVToRGBHeader, finalFunction ); - } - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) - return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); - - string precisionString = UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, WirePortDataType.FLOAT ); - - AddHSVToRGBFunction( ref dataCollector , precisionString ); - - string hue = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - string saturation = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); - string value = m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ); - - RegisterLocalVariable( 0, string.Format( HSVToRGBHeader, precisionString, hue, saturation, value ), ref dataCollector, "hsvTorgb" + OutputId ); - return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/HSVToRGBNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/HSVToRGBNode.cs.meta deleted file mode 100644 index 5d33d3ad..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/HSVToRGBNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 3d992a68cff329a4a9bd1deb999fe691 -timeCreated: 1494857111 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/LuminanceNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/LuminanceNode.cs deleted file mode 100644 index 2582a59b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/LuminanceNode.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Luminance", "Image Effects", "Calculates Luminance value from input")] - public sealed class LuminanceNode : ParentNode - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT3, false, "RGB" ); - AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); - m_previewShaderGUID = "81e1d8ffeec8a4b4cabb1094bc981048"; - } - - 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 value = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - string grayscale = "Luminance(" + value + ")"; - - RegisterLocalVariable( 0, grayscale, ref dataCollector, "luminance" + OutputId ); - return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/LuminanceNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/LuminanceNode.cs.meta deleted file mode 100644 index 20c21f37..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/LuminanceNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: c5f40d01acf184946b8660599f33109f -timeCreated: 1574935849 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/NoiseGeneratorNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/NoiseGeneratorNode.cs deleted file mode 100644 index c6805a41..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/NoiseGeneratorNode.cs +++ /dev/null @@ -1,466 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> -// Based on the work by https://github.com/keijiro/NoiseShader - -using System; -using UnityEditor; -using UnityEngine; - -namespace AmplifyShaderEditor -{ - public enum NoiseGeneratorType - { - Simplex2D, - Simplex3D, - Gradient, - Simple - }; - - [Serializable] - [NodeAttributes( "Noise Generator", "Miscellaneous", "Collection of procedural noise generators", tags: "simplex gradient" )] - public sealed class NoiseGeneratorNode : ParentNode - { - private const string TypeLabelStr = "Type"; - private const string SetTo01RangeOpStr = "{0} = {0}*0.5 + 0.5;"; - private const string SetToMinus1To1RangeOpStr = "{0} = {0}*2 - 1;"; - private const string SetTo01RangeLabel = "0-1 Range"; - private const string SetTo01RangePreviewId = "_To01Range"; - private const string UseUnityVersionLabel = "Use Unity Version"; - - // Simple - private const string SimpleNoiseRandomValueFunc = "inline float noise_randomValue (float2 uv) { return frac(sin(dot(uv, float2(12.9898, 78.233)))*43758.5453); }"; - private const string SimpleNoiseInterpolateFunc = "inline float noise_interpolate (float a, float b, float t) { return (1.0-t)*a + (t*b); }"; - private const string SimpleValueNoiseHeader = "inline float valueNoise (float2 uv)"; - private readonly string[] SimpleValueNoiseBody = { "inline float valueNoise (float2 uv)\n", - "{\n", - "\tfloat2 i = floor(uv);\n", - "\tfloat2 f = frac( uv );\n", - "\tf = f* f * (3.0 - 2.0 * f);\n", - "\tuv = abs( frac(uv) - 0.5);\n", - "\tfloat2 c0 = i + float2( 0.0, 0.0 );\n", - "\tfloat2 c1 = i + float2( 1.0, 0.0 );\n", - "\tfloat2 c2 = i + float2( 0.0, 1.0 );\n", - "\tfloat2 c3 = i + float2( 1.0, 1.0 );\n", - "\tfloat r0 = noise_randomValue( c0 );\n", - "\tfloat r1 = noise_randomValue( c1 );\n", - "\tfloat r2 = noise_randomValue( c2 );\n", - "\tfloat r3 = noise_randomValue( c3 );\n", - "\tfloat bottomOfGrid = noise_interpolate( r0, r1, f.x );\n", - "\tfloat topOfGrid = noise_interpolate( r2, r3, f.x );\n", - "\tfloat t = noise_interpolate( bottomOfGrid, topOfGrid, f.y );\n", - "\treturn t;\n", - "}\n"}; - - private const string SimpleNoiseHeader = "float SimpleNoise(float2 UV, float Scale)"; - private const string SimpleNoiseFunc = "SimpleNoise( {0} )"; - private readonly string[] SimpleNoiseBody = { "float SimpleNoise(float2 UV)\n", - "{\n", - "\tfloat t = 0.0;\n", - "\tfloat freq = pow( 2.0, float( 0 ) );\n", - "\tfloat amp = pow( 0.5, float( 3 - 0 ) );\n", - "\tt += valueNoise( UV/freq )*amp;\n", - "\tfreq = pow(2.0, float(1));\n", - "\tamp = pow(0.5, float(3-1));\n", - "\tt += valueNoise( UV/freq )*amp;\n", - "\tfreq = pow(2.0, float(2));\n", - "\tamp = pow(0.5, float(3-2));\n", - "\tt += valueNoise( UV/freq )*amp;\n", - "\treturn t;\n", - "}\n"}; - - // Simplex 2D - private const string Simplex2DFloat3Mod289Func = "float3 mod2D289( float3 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; }"; - private const string Simplex2DFloat2Mod289Func = "float2 mod2D289( float2 x ) { return x - floor( x * ( 1.0 / 289.0 ) ) * 289.0; }"; - private const string Simplex2DPermuteFunc = "float3 permute( float3 x ) { return mod2D289( ( ( x * 34.0 ) + 1.0 ) * x ); }"; - - private const string SimplexNoise2DHeader = "float snoise( float2 v )"; - private const string SimplexNoise2DFunc = "snoise( {0} )"; - private readonly string[] SimplexNoise2DBody = {"float snoise( float2 v )\n", - "{\n", - "\tconst float4 C = float4( 0.211324865405187, 0.366025403784439, -0.577350269189626, 0.024390243902439 );\n", - "\tfloat2 i = floor( v + dot( v, C.yy ) );\n", - "\tfloat2 x0 = v - i + dot( i, C.xx );\n", - "\tfloat2 i1;\n", - "\ti1 = ( x0.x > x0.y ) ? float2( 1.0, 0.0 ) : float2( 0.0, 1.0 );\n", - "\tfloat4 x12 = x0.xyxy + C.xxzz;\n", - "\tx12.xy -= i1;\n", - "\ti = mod2D289( i );\n", - "\tfloat3 p = permute( permute( i.y + float3( 0.0, i1.y, 1.0 ) ) + i.x + float3( 0.0, i1.x, 1.0 ) );\n", - "\tfloat3 m = max( 0.5 - float3( dot( x0, x0 ), dot( x12.xy, x12.xy ), dot( x12.zw, x12.zw ) ), 0.0 );\n", - "\tm = m * m;\n", - "\tm = m * m;\n", - "\tfloat3 x = 2.0 * frac( p * C.www ) - 1.0;\n", - "\tfloat3 h = abs( x ) - 0.5;\n", - "\tfloat3 ox = floor( x + 0.5 );\n", - "\tfloat3 a0 = x - ox;\n", - "\tm *= 1.79284291400159 - 0.85373472095314 * ( a0 * a0 + h * h );\n", - "\tfloat3 g;\n", - "\tg.x = a0.x * x0.x + h.x * x0.y;\n", - "\tg.yz = a0.yz * x12.xz + h.yz * x12.yw;\n", - "\treturn 130.0 * dot( m, g );\n", - "}\n"}; - // Simplex 3D - - - - private const string Simplex3DFloat3Mod289 = "float3 mod3D289( float3 x ) { return x - floor( x / 289.0 ) * 289.0; }"; - private const string Simplex3DFloat4Mod289 = "float4 mod3D289( float4 x ) { return x - floor( x / 289.0 ) * 289.0; }"; - private const string Simplex3DFloat4Permute = "float4 permute( float4 x ) { return mod3D289( ( x * 34.0 + 1.0 ) * x ); }"; - private const string TaylorInvSqrtFunc = "float4 taylorInvSqrt( float4 r ) { return 1.79284291400159 - r * 0.85373472095314; }"; - - private const string SimplexNoise3DHeader = "float snoise( float3 v )"; - private const string SimplexNoise3DFunc = "snoise( {0} )"; - private readonly string[] SimplexNoise3DBody = - { - "float snoise( float3 v )\n", - "{\n", - "\tconst float2 C = float2( 1.0 / 6.0, 1.0 / 3.0 );\n", - "\tfloat3 i = floor( v + dot( v, C.yyy ) );\n", - "\tfloat3 x0 = v - i + dot( i, C.xxx );\n", - "\tfloat3 g = step( x0.yzx, x0.xyz );\n", - "\tfloat3 l = 1.0 - g;\n", - "\tfloat3 i1 = min( g.xyz, l.zxy );\n", - "\tfloat3 i2 = max( g.xyz, l.zxy );\n", - "\tfloat3 x1 = x0 - i1 + C.xxx;\n", - "\tfloat3 x2 = x0 - i2 + C.yyy;\n", - "\tfloat3 x3 = x0 - 0.5;\n", - "\ti = mod3D289( i);\n", - "\tfloat4 p = permute( permute( permute( i.z + float4( 0.0, i1.z, i2.z, 1.0 ) ) + i.y + float4( 0.0, i1.y, i2.y, 1.0 ) ) + i.x + float4( 0.0, i1.x, i2.x, 1.0 ) );\n", - "\tfloat4 j = p - 49.0 * floor( p / 49.0 ); // mod(p,7*7)\n", - "\tfloat4 x_ = floor( j / 7.0 );\n", - "\tfloat4 y_ = floor( j - 7.0 * x_ ); // mod(j,N)\n", - "\tfloat4 x = ( x_ * 2.0 + 0.5 ) / 7.0 - 1.0;\n", - "\tfloat4 y = ( y_ * 2.0 + 0.5 ) / 7.0 - 1.0;\n", - "\tfloat4 h = 1.0 - abs( x ) - abs( y );\n", - "\tfloat4 b0 = float4( x.xy, y.xy );\n", - "\tfloat4 b1 = float4( x.zw, y.zw );\n", - "\tfloat4 s0 = floor( b0 ) * 2.0 + 1.0;\n", - "\tfloat4 s1 = floor( b1 ) * 2.0 + 1.0;\n", - "\tfloat4 sh = -step( h, 0.0 );\n", - "\tfloat4 a0 = b0.xzyw + s0.xzyw * sh.xxyy;\n", - "\tfloat4 a1 = b1.xzyw + s1.xzyw * sh.zzww;\n", - "\tfloat3 g0 = float3( a0.xy, h.x );\n", - "\tfloat3 g1 = float3( a0.zw, h.y );\n", - "\tfloat3 g2 = float3( a1.xy, h.z );\n", - "\tfloat3 g3 = float3( a1.zw, h.w );\n", - "\tfloat4 norm = taylorInvSqrt( float4( dot( g0, g0 ), dot( g1, g1 ), dot( g2, g2 ), dot( g3, g3 ) ) );\n", - "\tg0 *= norm.x;\n", - "\tg1 *= norm.y;\n", - "\tg2 *= norm.z;\n", - "\tg3 *= norm.w;\n", - "\tfloat4 m = max( 0.6 - float4( dot( x0, x0 ), dot( x1, x1 ), dot( x2, x2 ), dot( x3, x3 ) ), 0.0 );\n", - "\tm = m* m;\n", - "\tm = m* m;\n", - "\tfloat4 px = float4( dot( x0, g0 ), dot( x1, g1 ), dot( x2, g2 ), dot( x3, g3 ) );\n", - "\treturn 42.0 * dot( m, px);\n", - "}\n" - }; - - //Gradient Noise - private readonly string UnityGradientNoiseFunc = "UnityGradientNoise({0},{1})"; - private readonly string[] UnityGradientNoiseFunctionsBody = - { - "float2 UnityGradientNoiseDir( float2 p )\n", - "{\n", - "\tp = fmod(p , 289);\n", - "\tfloat x = fmod((34 * p.x + 1) * p.x , 289) + p.y;\n", - "\tx = fmod( (34 * x + 1) * x , 289);\n", - "\tx = frac( x / 41 ) * 2 - 1;\n", - "\treturn normalize( float2(x - floor(x + 0.5 ), abs( x ) - 0.5 ) );\n", - "}\n", - "\n", - "float UnityGradientNoise( float2 UV, float Scale )\n", - "{\n", - "\tfloat2 p = UV * Scale;\n", - "\tfloat2 ip = floor( p );\n", - "\tfloat2 fp = frac( p );\n", - "\tfloat d00 = dot( UnityGradientNoiseDir( ip ), fp );\n", - "\tfloat d01 = dot( UnityGradientNoiseDir( ip + float2( 0, 1 ) ), fp - float2( 0, 1 ) );\n", - "\tfloat d10 = dot( UnityGradientNoiseDir( ip + float2( 1, 0 ) ), fp - float2( 1, 0 ) );\n", - "\tfloat d11 = dot( UnityGradientNoiseDir( ip + float2( 1, 1 ) ), fp - float2( 1, 1 ) );\n", - "\tfp = fp * fp * fp * ( fp * ( fp * 6 - 15 ) + 10 );\n", - "\treturn lerp( lerp( d00, d01, fp.y ), lerp( d10, d11, fp.y ), fp.x ) + 0.5;\n", - "}\n" - }; - private readonly string GradientNoiseFunc = "GradientNoise({0},{1})"; - private readonly string[] GradientNoiseFunctionsBody = - { - "//https://www.shadertoy.com/view/XdXGW8\n", - "float2 GradientNoiseDir( float2 x )\n", - "{\n", - "\tconst float2 k = float2( 0.3183099, 0.3678794 );\n", - "\tx = x * k + k.yx;\n", - "\treturn -1.0 + 2.0 * frac( 16.0 * k * frac( x.x * x.y * ( x.x + x.y ) ) );\n", - "}\n", - "\n", - "float GradientNoise( float2 UV, float Scale )\n", - "{\n", - "\tfloat2 p = UV * Scale;\n", - "\tfloat2 i = floor( p );\n", - "\tfloat2 f = frac( p );\n", - "\tfloat2 u = f * f * ( 3.0 - 2.0 * f );\n", - "\treturn lerp( lerp( dot( GradientNoiseDir( i + float2( 0.0, 0.0 ) ), f - float2( 0.0, 0.0 ) ),\n", - "\t\t\tdot( GradientNoiseDir( i + float2( 1.0, 0.0 ) ), f - float2( 1.0, 0.0 ) ), u.x ),\n", - "\t\t\tlerp( dot( GradientNoiseDir( i + float2( 0.0, 1.0 ) ), f - float2( 0.0, 1.0 ) ),\n", - "\t\t\tdot( GradientNoiseDir( i + float2( 1.0, 1.0 ) ), f - float2( 1.0, 1.0 ) ), u.x ), u.y );\n", - "}\n" - }; - - [SerializeField] - private NoiseGeneratorType m_type = NoiseGeneratorType.Simplex2D; - - [SerializeField] - private bool m_setTo01Range = true; - - [SerializeField] - private bool m_unityVersion = false; - private int m_setTo01RangePreviewId; - - private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper(); - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT2, false, "UV" ); - AddInputPort( WirePortDataType.FLOAT, false, "Scale" ); - m_inputPorts[ 1 ].FloatInternalData = 1; - AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); - m_useInternalPortData = true; - m_autoWrapProperties = true; - m_hasLeftDropdown = true; - SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, m_type ) ); - m_previewShaderGUID = "cd2d37ef5da190b42a91a5a690ba2a7d"; - ConfigurePorts(); - } - - public override void OnEnable() - { - base.OnEnable(); - m_setTo01RangePreviewId = Shader.PropertyToID( SetTo01RangePreviewId ); - } - - public override void AfterCommonInit() - { - base.AfterCommonInit(); - if( PaddingTitleLeft == 0 ) - { - PaddingTitleLeft = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; - if( PaddingTitleRight == 0 ) - PaddingTitleRight = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; - } - } - - public override void Destroy() - { - base.Destroy(); - m_upperLeftWidget = null; - } - - public override void SetPreviewInputs() - { - base.SetPreviewInputs(); - float range01 = m_setTo01Range ? 1 : 0; - PreviewMaterial.SetFloat( m_setTo01RangePreviewId, range01 ); - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - m_upperLeftWidget.DrawWidget<NoiseGeneratorType>( ref m_type, this, OnWidgetUpdate ); - } - - private readonly Action<ParentNode> OnWidgetUpdate = ( x ) => - { - ( x as NoiseGeneratorNode ).ConfigurePorts(); - }; - - public override void DrawProperties() - { - base.DrawProperties(); - EditorGUI.BeginChangeCheck(); - m_type = (NoiseGeneratorType)EditorGUILayoutEnumPopup( TypeLabelStr, m_type ); - if( EditorGUI.EndChangeCheck() ) - { - ConfigurePorts(); - } - - m_setTo01Range = EditorGUILayoutToggle( SetTo01RangeLabel, m_setTo01Range ); - - if( m_type == NoiseGeneratorType.Gradient ) - { - EditorGUI.BeginChangeCheck(); - m_unityVersion = EditorGUILayoutToggle( UseUnityVersionLabel, m_unityVersion ); - if( EditorGUI.EndChangeCheck() ) - { - ConfigurePorts(); - } - } - //EditorGUILayout.HelpBox( "Node still under construction. Use with caution", MessageType.Info ); - } - - private void ConfigurePorts() - { - SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, m_type ) ); - - switch( m_type ) - { - case NoiseGeneratorType.Simplex2D: - { - m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT2, false ); - m_previewMaterialPassId = 0; - } - break; - - case NoiseGeneratorType.Simplex3D: - { - m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT3, false ); - m_previewMaterialPassId = 1; - } - break; - case NoiseGeneratorType.Gradient: - { - m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT2, false ); - m_previewMaterialPassId = m_unityVersion ? 3 : 2; - } - break; - case NoiseGeneratorType.Simple: - { - m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT2, false ); - m_previewMaterialPassId = 4; - } - break; - } - PreviewIsDirty = true; - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if( m_outputPorts[ outputId ].IsLocalValue( dataCollector.PortCategory ) ) - { - return m_outputPorts[ outputId ].LocalValue( dataCollector.PortCategory ); - } - - string size = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - string scale = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); - - switch( m_type ) - { - case NoiseGeneratorType.Simplex2D: - { - - string float3Mod289Func = ( dataCollector.IsTemplate ) ? Simplex2DFloat3Mod289Func : "\t\t" + Simplex2DFloat3Mod289Func; - dataCollector.AddFunction( Simplex2DFloat3Mod289Func, float3Mod289Func ); - - string float2Mod289Func = ( dataCollector.IsTemplate ) ? Simplex2DFloat2Mod289Func : "\t\t" + Simplex2DFloat2Mod289Func; - dataCollector.AddFunction( Simplex2DFloat2Mod289Func, float2Mod289Func ); - - string permuteFunc = ( dataCollector.IsTemplate ) ? Simplex2DPermuteFunc : "\t\t" + Simplex2DPermuteFunc; - dataCollector.AddFunction( Simplex2DPermuteFunc, permuteFunc ); - - dataCollector.AddFunction( SimplexNoise2DHeader, SimplexNoise2DBody, false ); - - - if( m_inputPorts[ 1 ].IsConnected || m_inputPorts[ 1 ].FloatInternalData != 1.0f ) - { - size = string.Format( "{0}*{1}", size, scale ); - } - - RegisterLocalVariable( 0, string.Format( SimplexNoise2DFunc, size ), ref dataCollector, ( "simplePerlin2D" + OutputId ) ); - } - break; - case NoiseGeneratorType.Simplex3D: - { - - string float3Mod289Func = ( dataCollector.IsTemplate ) ? Simplex3DFloat3Mod289 : "\t\t" + Simplex3DFloat3Mod289; - dataCollector.AddFunction( Simplex3DFloat3Mod289, float3Mod289Func ); - - string float4Mod289Func = ( dataCollector.IsTemplate ) ? Simplex3DFloat4Mod289 : "\t\t" + Simplex3DFloat4Mod289; - dataCollector.AddFunction( Simplex3DFloat4Mod289, float4Mod289Func ); - - string permuteFunc = ( dataCollector.IsTemplate ) ? Simplex3DFloat4Permute : "\t\t" + Simplex3DFloat4Permute; - dataCollector.AddFunction( Simplex3DFloat4Permute, permuteFunc ); - - string taylorInvSqrtFunc = ( dataCollector.IsTemplate ) ? TaylorInvSqrtFunc : "\t\t" + TaylorInvSqrtFunc; - dataCollector.AddFunction( TaylorInvSqrtFunc, taylorInvSqrtFunc ); - - dataCollector.AddFunction( SimplexNoise3DHeader, SimplexNoise3DBody, false ); - - if( m_inputPorts[ 1 ].IsConnected || m_inputPorts[ 1 ].FloatInternalData != 1.0f ) - { - size = string.Format( "{0}*{1}", size, scale ); - } - - RegisterLocalVariable( 0, string.Format( SimplexNoise3DFunc, size ), ref dataCollector, ( "simplePerlin3D" + OutputId ) ); - } - break; - - case NoiseGeneratorType.Gradient: - { - string[] body = m_unityVersion ? UnityGradientNoiseFunctionsBody : GradientNoiseFunctionsBody; - string func = m_unityVersion ? UnityGradientNoiseFunc : GradientNoiseFunc; - - dataCollector.AddFunction( body[ 0 ], body, false); - RegisterLocalVariable( 0, string.Format( func, size, scale ), ref dataCollector, ( "gradientNoise" + OutputId ) ); - } - break; - - case NoiseGeneratorType.Simple: - { - string randomValue = ( dataCollector.IsTemplate ) ? SimpleNoiseRandomValueFunc : "\t\t" + SimpleNoiseRandomValueFunc; - dataCollector.AddFunction( SimpleNoiseRandomValueFunc, randomValue ); - - string interpolate = ( dataCollector.IsTemplate ) ? SimpleNoiseInterpolateFunc : "\t\t" + SimpleNoiseInterpolateFunc; - dataCollector.AddFunction( SimpleNoiseInterpolateFunc, interpolate ); - - dataCollector.AddFunction( SimpleValueNoiseHeader, SimpleValueNoiseBody, false ); - - dataCollector.AddFunction( SimpleNoiseHeader, SimpleNoiseBody, false ); - - if( m_inputPorts[ 1 ].IsConnected || m_inputPorts[ 1 ].FloatInternalData != 1.0f ) - { - size = string.Format( "{0}*{1}", size, scale ); - } - RegisterLocalVariable( 0, string.Format( SimpleNoiseFunc, size ), ref dataCollector, ( "simpleNoise" + OutputId ) ); - } - break; - } - - if( m_type == NoiseGeneratorType.Simple && !m_setTo01Range ) - { - dataCollector.AddLocalVariable( outputId, string.Format( SetToMinus1To1RangeOpStr, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ) ); - } - - if( m_setTo01Range && m_type != NoiseGeneratorType.Simple ) - { - dataCollector.AddLocalVariable( outputId, string.Format( SetTo01RangeOpStr, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ) ); - } - - return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - m_type = (NoiseGeneratorType)Enum.Parse( typeof( NoiseGeneratorType ), GetCurrentParam( ref nodeParams ) ); - if( UIUtils.CurrentShaderVersion() < 16903 ) - { - m_setTo01Range = false; - } - else - { - m_setTo01Range = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - m_unityVersion = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - } - - ConfigurePorts(); - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_type ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_setTo01Range ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_unityVersion ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/NoiseGeneratorNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/NoiseGeneratorNode.cs.meta deleted file mode 100644 index cb3c00c4..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/NoiseGeneratorNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 6b82a8d1dffe4204fa03a09e2fe783b3 -timeCreated: 1485355115 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/PosterizeNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/PosterizeNode.cs deleted file mode 100644 index 9518f64e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/PosterizeNode.cs +++ /dev/null @@ -1,98 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -//https://www.shadertoy.com/view/ldX3D4 -using UnityEngine; -using UnityEditor; -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Posterize", "Image Effects", "Converts a continuous gradation of tones to multiple regions of fewer tones" )] - public sealed class PosterizeNode : ParentNode - { - private const string PosterizationPowerStr = "Power"; - [SerializeField] - private int m_posterizationPower = 1; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.COLOR, false, "RGBA", -1, MasterNodePortCategory.Fragment, 1 ); - AddInputPort( WirePortDataType.INT, false, "Power", -1, MasterNodePortCategory.Fragment, 0 ); - m_inputPorts[ 1 ].AutoDrawInternalData = true; - AddOutputPort( WirePortDataType.COLOR, Constants.EmptyPortValue ); - m_textLabelWidth = 60; - m_autoWrapProperties = true; - m_previewShaderGUID = "ecb3048ef0eec1645bad1d72a98d8279"; - } - - public override void DrawProperties() - { - base.DrawProperties(); - if( !m_inputPorts[ 1 ].IsConnected ) - { - EditorGUILayout.BeginVertical(); - { - EditorGUI.BeginChangeCheck(); - m_posterizationPower = EditorGUILayoutIntSlider( PosterizationPowerStr, m_posterizationPower, 1, 256 ); - if( EditorGUI.EndChangeCheck() ) - { - GetInputPortByUniqueId( 0 ).IntInternalData = m_posterizationPower; - } - } - EditorGUILayout.EndVertical(); - } - else - { - EditorGUILayout.Space(); - } - } - - 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 posterizationPower = "1"; - if( m_inputPorts[ 1 ].IsConnected ) - { - posterizationPower = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); - } - else - { - posterizationPower = m_posterizationPower.ToString(); - } - - string colorTarget = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - - string divVar = "div" + OutputId; - dataCollector.AddLocalVariable( UniqueId, "float " + divVar + "=256.0/float(" + posterizationPower + ");" ); - string result = "( floor( " + colorTarget + " * " + divVar + " ) / " + divVar + " )"; - - RegisterLocalVariable( 0, result, ref dataCollector, "posterize" + OutputId ); - - return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); - } - - public override void RefreshExternalReferences() - { - base.RefreshExternalReferences(); - m_inputPorts[ 0 ].ChangeType( WirePortDataType.COLOR, false ); - m_inputPorts[ 1 ].ChangeType( WirePortDataType.INT, false ); - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_posterizationPower ); - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - m_posterizationPower = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/PosterizeNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/PosterizeNode.cs.meta deleted file mode 100644 index edceea37..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/PosterizeNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 7dc4667cd643835489312daa244a03b9 -timeCreated: 1481126957 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/RGBToHSVNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/RGBToHSVNode.cs deleted file mode 100644 index 1fa7c92e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/RGBToHSVNode.cs +++ /dev/null @@ -1,93 +0,0 @@ -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "RGB to HSV", "Image Effects", "Converts from RGB to HSV color space" )] - public sealed class RGBToHSVNode : ParentNode - { - public static readonly string RGBToHSVHeader = "RGBToHSV( {0} )"; - public static readonly string[] RGBToHSVFunction = { "{0}3 RGBToHSV({0}3 c)\n", - "{\n", - "\t{0}4 K = {0}4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);\n", - "\t{0}4 p = lerp( {0}4( c.bg, K.wz ), {0}4( c.gb, K.xy ), step( c.b, c.g ) );\n", - "\t{0}4 q = lerp( {0}4( p.xyw, c.r ), {0}4( c.r, p.yzx ), step( p.x, c.r ) );\n", - "\t{0} d = q.x - min( q.w, q.y );\n", - "\t{0} e = 1.0e-10;\n", - "\treturn {0}3( abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);\n", - "}" - }; - - public static readonly bool[] RGBToHSVFlags = { true, - false, - true, - true, - true, - true, - true, - true, - false}; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT3, false, "RGB" ); - AddOutputPort( WirePortDataType.FLOAT3, "HSV" ); - AddOutputPort( WirePortDataType.FLOAT, "Hue" ); - AddOutputPort( WirePortDataType.FLOAT, "Saturation" ); - AddOutputPort( WirePortDataType.FLOAT, "Value" ); - m_previewShaderGUID = "0f2f09b49bf4954428aafa2dfe1a9a09"; - m_useInternalPortData = true; - m_autoWrapProperties = true; - m_customPrecision = true; - } - - public override void DrawProperties() - { - base.DrawProperties(); - DrawPrecisionProperty(); - } - - public void AddRGBToHSVFunction( ref MasterNodeDataCollector dataCollector, string precisionString ) - { - if( !dataCollector.HasFunction( RGBToHSVHeader ) ) - { - //Hack to be used util indent is properly used - int currIndent = UIUtils.ShaderIndentLevel; - if( dataCollector.MasterNodeCategory == AvailableShaderTypes.Template ) - { - UIUtils.ShaderIndentLevel = 0; - } - else - { - UIUtils.ShaderIndentLevel = 1; - UIUtils.ShaderIndentLevel++; - } - - string finalFunction = string.Empty; - for( int i = 0; i < RGBToHSVFunction.Length; i++ ) - { - finalFunction += UIUtils.ShaderIndentTabs + ( RGBToHSVFlags[ i ] ? string.Format( RGBToHSVFunction[ i ], precisionString ) : RGBToHSVFunction[ i ] ); - } - UIUtils.ShaderIndentLevel--; - UIUtils.ShaderIndentLevel = currIndent; - - dataCollector.AddFunction( RGBToHSVHeader, finalFunction ); - } - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) - return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); - - string precisionString = UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, WirePortDataType.FLOAT ); - AddRGBToHSVFunction( ref dataCollector, precisionString ); - - string rgbValue = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - - RegisterLocalVariable( 0, string.Format( RGBToHSVHeader, rgbValue ), ref dataCollector, "hsvTorgb" + OutputId ); - return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/RGBToHSVNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/RGBToHSVNode.cs.meta deleted file mode 100644 index b5abf86a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/RGBToHSVNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 4d24b838adbc80d4cb63e3fc4f5a1c79 -timeCreated: 1494863846 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/SimpleContrastOpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/SimpleContrastOpNode.cs deleted file mode 100644 index 01310922..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/SimpleContrastOpNode.cs +++ /dev/null @@ -1,55 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Simple Contrast", "Image Effects", "Simple contrast matrix multiplication" )] - public sealed class SimpleContrastOpNode : ParentNode - { - private const string InputTypeStr = "Contrast"; - private const string FunctionHeader = "CalculateContrast({0},{1})"; - private readonly string[] m_functionBody = { "float4 CalculateContrast( float contrastValue, float4 colorTarget )\n", - "{\n", - "\tfloat t = 0.5 * ( 1.0 - contrastValue );\n", - "\treturn mul( float4x4( contrastValue,0,0,t, 0,contrastValue,0,t, 0,0,contrastValue,t, 0,0,0,1 ), colorTarget );\n", - "}"}; - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddPorts(); - m_textLabelWidth = 70; - m_useInternalPortData = true; - m_previewShaderGUID = "8d76799413f9f0547ac9b1de7ba798f1"; - } - - void AddPorts() - { - AddInputPort( WirePortDataType.COLOR, false, "RGBA", -1, MasterNodePortCategory.Fragment, 1 ); - AddInputPort( WirePortDataType.FLOAT, false, "Value", -1, MasterNodePortCategory.Fragment, 0 ); - AddOutputPort( WirePortDataType.COLOR, Constants.EmptyPortValue ); - } - - 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 contrastValue = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); - string colorTarget = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - string result = dataCollector.AddFunctions( FunctionHeader, m_functionBody, false, contrastValue, colorTarget ); - - return CreateOutputLocalVariable( 0, result, ref dataCollector ); - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - if( UIUtils.CurrentShaderVersion() < 5004 ) - { - m_inputPorts[ 1 ].FloatInternalData = Convert.ToSingle( GetCurrentParam( ref nodeParams ) ); - } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/SimpleContrastOpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/SimpleContrastOpNode.cs.meta deleted file mode 100644 index a860f21a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/SimpleContrastOpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 3f49defa61805f948a04775d391e507a -timeCreated: 1481126955 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/SimplexNoiseNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/SimplexNoiseNode.cs deleted file mode 100644 index ec946236..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/SimplexNoiseNode.cs +++ /dev/null @@ -1,104 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -//https://www.shadertoy.com/view/XsX3zB -using System; -using UnityEngine; -using UnityEditor; - - -namespace AmplifyShaderEditor -{ - public enum NoiseType - { - Simplex3D, - Simplex3DFractal - } - - [Serializable] - [NodeAttributes( "[Deprecated] Simplex Noise", "Image Effects", "Noise generated via the Simplex algorithm",null,KeyCode.None,false,true)] - public sealed class SimplexNoiseNode : ParentNode - { - private string m_randomFuncBody; - private string m_simplex3dFuncBody; - private string m_simplex3dFractalFuncBody; - - private const string RandomfunctionHeader = "Random3({0})"; - private const string Simplex3dfunctionHeader = "Simplex3d({0})"; - private const string Simplex3dFractalfunctionHeader = "Simplex3dFractal( {0})"; - - private const string NoiseTypeStr = "Type"; - - [SerializeField] - private NoiseType m_type = NoiseType.Simplex3D; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - - IOUtils.AddFunctionHeader( ref m_randomFuncBody, "float3 Random3 ( float3 c )" ); - IOUtils.AddFunctionLine( ref m_randomFuncBody, "float fracMul = 512.0;float j = 4096.0*sin ( dot ( c, float3 ( 17.0, 59.4, 15.0 ) ) );float3 r;r.z = frac ( fracMul*j );j *= .125;r.x = frac ( fracMul*j );j *= .125;r.y = frac ( fracMul*j );return r - 0.5;" ); - IOUtils.CloseFunctionBody( ref m_randomFuncBody ); - - IOUtils.AddFunctionHeader( ref m_simplex3dFuncBody, "float3 Simplex3d ( float3 p )" ); - IOUtils.AddFunctionLine( ref m_simplex3dFuncBody, "float F3 = 0.3333333;float G3 = 0.1666667;float3 s = floor ( p + dot ( p, F3.xxx ) );float3 x = p - s + dot ( s, G3.xxx );float3 e = step ( ( 0.0 ).xxx, x - x.yzx );float3 i1 = e*( 1.0 - e.zxy );float3 i2 = 1.0 - e.zxy*( 1.0 - e );float3 x1 = x - i1 + G3;float3 x2 = x - i2 + 2.0*G3;float3 x3 = x - 1.0 + 3.0*G3;float4 w, d;w.x = dot ( x, x );w.y = dot ( x1, x1 );w.z = dot ( x2, x2 );w.w = dot ( x3, x3 );w = max ( 0.6 - w, 0.0 );d.x = dot ( Random3 ( s ), x );d.y = dot ( Random3 ( s + i1 ), x1 );d.z = dot ( Random3 ( s + i2 ), x2 );d.w = dot ( Random3 ( s + 1.0 ), x3 );w *= w;w *= w;d *= w;return dot ( d, ( 52.0 ).xxx ).xxx;" ); - IOUtils.CloseFunctionBody( ref m_simplex3dFuncBody ); - - IOUtils.AddFunctionHeader( ref m_simplex3dFractalFuncBody, "float3 Simplex3dFractal ( float3 m )" ); - IOUtils.AddFunctionLine( ref m_simplex3dFractalFuncBody, "return (0.5333333*Simplex3d ( m ) + 0.2666667*Simplex3d ( 2.0*m ) + 0.1333333*Simplex3d ( 4.0*m ) + 0.0666667*Simplex3d ( 8.0*m )).xxx;" ); - IOUtils.CloseFunctionBody( ref m_simplex3dFractalFuncBody ); - - AddInputPort( WirePortDataType.FLOAT3, false, "Position" ); - AddInputPort( WirePortDataType.FLOAT, false, "Width" ); - AddOutputPort( WirePortDataType.FLOAT3, Constants.EmptyPortValue ); - m_textLabelWidth = 50; - m_useInternalPortData = true; - m_autoWrapProperties = true; - } - - public override void DrawProperties() - { - base.DrawProperties(); - m_type = ( NoiseType ) EditorGUILayoutEnumPopup( NoiseTypeStr, m_type ); - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - - - string posValue = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - string widthValue = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); - dataCollector.AddFunctions( RandomfunctionHeader, m_randomFuncBody, "0" ); - string result = string.Empty; - switch ( m_type ) - { - case NoiseType.Simplex3D: - { - string finalValue = dataCollector.AddFunctions( Simplex3dfunctionHeader, m_simplex3dFuncBody, posValue + "*" + widthValue ); - result = finalValue + "* 0.5 + 0.5"; - }break; - - case NoiseType.Simplex3DFractal: - { - dataCollector.AddFunctions( Simplex3dfunctionHeader, m_simplex3dFuncBody, posValue + "*" + widthValue ); - string finalValue = dataCollector.AddFunctions( Simplex3dFractalfunctionHeader, m_simplex3dFractalFuncBody, posValue + "*" + widthValue + "+" + widthValue ); - result = finalValue + "* 0.5 + 0.5"; - }break; - } - - return CreateOutputLocalVariable( 0, result, ref dataCollector ); - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - m_type = ( NoiseType ) Enum.Parse( typeof( NoiseType ), GetCurrentParam( ref nodeParams ) ); - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_type ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/SimplexNoiseNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/SimplexNoiseNode.cs.meta deleted file mode 100644 index 477f0e33..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/SimplexNoiseNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 3f888e3dadb5df94199547ab13cb74d2 -timeCreated: 1481126955 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/TFHCGrayscale.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/TFHCGrayscale.cs deleted file mode 100644 index 5620173c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/TFHCGrayscale.cs +++ /dev/null @@ -1,116 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> -// -// Custom Node Grayscale -// Donated by The Four Headed Cat - @fourheadedcat - -using UnityEngine; -using UnityEditor; -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Grayscale", "Image Effects", "Convert image colors to grayscale", null, KeyCode.None, true, false, null, null, "The Four Headed Cat - @fourheadedcat", tags:"luminance" )] - public sealed class TFHCGrayscale : ParentNode - { - private const string GrayscaleStyleStr = "Grayscale Style"; - - [SerializeField] - private int m_grayscaleStyle; - - [SerializeField] - private readonly string[] m_GrayscaleStyleValues = { "Luminance", "Natural Classic", "Old School" }; - - private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper(); - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT3, false, "RGB" ); - AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); - m_textLabelWidth = 120; - m_useInternalPortData = true; - m_hasLeftDropdown = true; - m_autoWrapProperties = true; - SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, m_GrayscaleStyleValues[ m_grayscaleStyle ] ) ); - m_previewShaderGUID = "56781cd022be9124597f0f396a46a35f"; - } - - public override void AfterCommonInit() - { - base.AfterCommonInit(); - if( PaddingTitleLeft == 0 ) - { - PaddingTitleLeft = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; - if( PaddingTitleRight == 0 ) - PaddingTitleRight = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; - } - } - - public override void Destroy() - { - base.Destroy(); - m_upperLeftWidget = null; - } - - void UpdateFromSelected() - { - m_previewMaterialPassId = m_grayscaleStyle; - SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, m_GrayscaleStyleValues[ m_grayscaleStyle ] ) ); - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - EditorGUI.BeginChangeCheck(); - m_grayscaleStyle = m_upperLeftWidget.DrawWidget( this, m_grayscaleStyle, m_GrayscaleStyleValues ); - if( EditorGUI.EndChangeCheck() ) - { - UpdateFromSelected(); - } - } - - public override void DrawProperties() - { - base.DrawProperties(); - EditorGUI.BeginChangeCheck(); - m_grayscaleStyle = EditorGUILayoutPopup( GrayscaleStyleStr, m_grayscaleStyle, m_GrayscaleStyleValues ); - if( EditorGUI.EndChangeCheck() ) - { - UpdateFromSelected(); - } - EditorGUILayout.HelpBox( "Grayscale Old:\n\n - In: Image to convert.\n - Grayscale Style: Select the grayscale style.\n\n - Out: Grayscale version of the image.", MessageType.None ); - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - m_grayscaleStyle = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - UpdateFromSelected(); - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_grayscaleStyle ); - } - - 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 i = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - string grayscale = string.Empty; - switch( m_grayscaleStyle ) - { - case 1: { grayscale = "dot(" + i + ", float3(0.299,0.587,0.114))"; } break; - case 2: { grayscale = "(" + i + ".r + " + i + ".g + " + i + ".b) / 3"; } break; - default: { grayscale = "Luminance(" + i + ")"; } break; - } - RegisterLocalVariable( 0, grayscale, ref dataCollector, "grayscale" + OutputId ); - return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/TFHCGrayscale.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/TFHCGrayscale.cs.meta deleted file mode 100644 index 07f01e0a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/TFHCGrayscale.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 32d7b01a9f453d448abf3685a35c4a19 -timeCreated: 1481126954 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/VoronoiNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/VoronoiNode.cs deleted file mode 100644 index 552f5653..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/VoronoiNode.cs +++ /dev/null @@ -1,555 +0,0 @@ -// Amplify Texture Editor - Visual Texture Editing Tool -// Amplify Texture Editor - Visual Texture Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using UnityEditor; -using UnityEngine; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Voronoi", "Miscellaneous", "Voronoi", Tags = "noise" )] - public sealed class VoronoiNode : ParentNode - { - // Unity Voronoi - private readonly string UnityVoronoiNoiseFunc = "UnityVoronoi({0},{1},{2})"; - private readonly string[] UnityVoroniNoiseFunctionsBody = - { - "inline float2 UnityVoronoiRandomVector( float2 UV, float offset )\n", - "{\n", - "\tfloat2x2 m = float2x2( 15.27, 47.63, 99.41, 89.98 );\n", - "\tUV = frac( sin(mul(UV, m) ) * 46839.32 );\n", - "\treturn float2( sin(UV.y* +offset ) * 0.5 + 0.5, cos( UV.x* offset ) * 0.5 + 0.5 );\n", - "}\n", - "\n", - "//x - Out y - Cells\n", - "float3 UnityVoronoi( float2 UV, float AngleOffset, float CellDensity )\n", - "{\n", - "\tfloat2 g = floor( UV * CellDensity );\n", - "\tfloat2 f = frac( UV * CellDensity );\n", - "\tfloat t = 8.0;\n", - "\tfloat3 res = float3( 8.0, 0.0, 0.0 );\n", - "\n", - "\tfor( int y = -1; y <= 1; y++ )\n", - "\t{\n", - "\t for( int x = -1; x <= 1; x++ )\n", - "\t {\n", - "\t\t\tfloat2 lattice = float2( x, y );\n", - "\t\t\tfloat2 offset = UnityVoronoiRandomVector( lattice + g, AngleOffset );\n", - "\t\t\tfloat d = distance( lattice + offset, f );\n", - "\n", - "\t\t\tif( d < res.x )\n", - "\t\t\t{\n", - "\t\t\t\tres = float3( d, offset.x, offset.y );\n", - "\t\t\t}\n", - "\t }\n", - "\t}\n", - "\treturn res;\n", - "}\n", - }; - - //////////// - - private const string VoronoiHashHeader = "float2 voronoihash{0}( float2 p )"; - private readonly string[] VoronoiHashBody = { "p = p - 2 * floor( p / 2 );", - "p = float2( dot( p, float2( 127.1, 311.7 ) ), dot( p, float2( 269.5, 183.3 ) ) );", - "return frac( sin( p ) *43758.5453);" }; - - - private const string VoronoiHeader = "float voronoi{0}( float2 v, float time, inout float2 id, float smoothness )"; - private const string VoronoiFunc = "voronoi{0}( {1}, {2},{3}, {4} )"; - private string[] VoronoiBody = - { - "float2 n = floor( v );", - "float2 f = frac( v );", - "float F1 = 8.0;", - "float F2 = 8.0; float2 mr = 0; float2 mg = 0;", - "for ( int j = -1; j <= 1; j++ )", - "{", - " \tfor ( int i = -1; i <= 1; i++ )", - " \t{", - " \t\tfloat2 g = float2( i, j );", - " \t\tfloat2 o = voronoihash{0}( n + g );", - " \t\tfloat2 r = g - f + (sin(0 + o * 6.2831)*0.5 + 0.5);", - " \t\tfloat d = dot( r, r );", - " \t\tif( d<F1 ) {",//12 - " \t\t\tF2 = F1;",//13 - " \t\t\tF1 = d; mg = g; mr = r; id = o;",//14 - " \t\t} else if( d<F2 ) {",//15 - " \t\t\tF2 = d;",//16 - " \t\t}",//17 - " \t}", - "}", - "return F1;" - }; - - private string VoronoiDistanceBody = - "\nF1 = 8.0;" + - "\nfor ( int j = -2; j <= 2; j++ )" + - "\n{{" + - "\nfor ( int i = -2; i <= 2; i++ )" + - "\n{{" + - "\nfloat2 g = mg + float2( i, j );" + - "\nfloat2 o = voronoihash{1}( n + g );" + - "\n{0}" + - "\nfloat d = dot( 0.5 * ( mr + r ), normalize( r - mr ) );" + - "\nF1 = min( F1, d );" + - "\n}}" + - "\n}}" + - "\nreturn F1;"; - - [SerializeField] - private int m_distanceFunction = 0; - - [SerializeField] - private float m_minkowskiPower = 1; - - [SerializeField] - private int m_functionType = 0; - - [SerializeField] - private int m_octaves = 1; - - [SerializeField] - private bool m_tileable = false; - - [SerializeField] - private int m_tileScale = 1; - - [SerializeField] - private bool m_useUnity = false; - - [SerializeField] - private bool m_calculateSmoothValue = false; - - private const string FunctionTypeStr = "Method";//"Function Type"; - private readonly string[] m_functionTypeStr = { "Cells", "Crystal", "Glass", "Caustic", "Distance" }; - - private const string DistanceFunctionLabelStr = "Distance Function"; - private readonly string[] m_distanceFunctionStr = { "Euclidean\u00B2", "Euclidean", "Manhattan", "Chebyshev", "Minkowski" }; - - [SerializeField] - private int m_searchQuality = 0; - private const string SearchQualityLabelStr = "Search Quality"; - private readonly string[] m_searchQualityStr = { "9 Cells", "25 Cells", "49 Cells" }; - - - private const string UseTileScaleStr = "_UseTileScale"; - private const string TileScaleStr = "_TileScale"; - private const string MinkowskiPowerStr = "_MinkowskiPower"; - private const string DistFuncStr = "_DistFunc"; - private const string MethodTypeStr = "_MethodType"; - private const string SearchQualityStr = "_SearchQuality"; - private const string OctavesStr = "_Octaves"; - private const string UseSmoothnessStr = "_UseSmoothness"; - - private int m_UseTileScaleId; - private int m_TileScaleId; - private int m_MinkowskiPowerId; - private int m_DistFuncId; - private int m_MethodTypeId; - private int m_SearchQualityId; - private int m_OctavesId; - private int m_UseSmoothnessId; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT2, false, "UV" ); - AddInputPort( WirePortDataType.FLOAT, false, "Angle" ); - AddInputPort( WirePortDataType.FLOAT, false, "Scale" ); - AddInputPort( WirePortDataType.FLOAT, false, "Smoothness" ); - - m_inputPorts[ 2 ].FloatInternalData = 1; - - AddOutputPort( WirePortDataType.FLOAT, "Out" ); - AddOutputPort( WirePortDataType.FLOAT2, "ID" ); - m_textLabelWidth = 120; - m_useInternalPortData = true; - m_autoWrapProperties = true; - m_previewShaderGUID = "bc1498ccdade442479038b24982fc946"; - ChangePorts(); - ChechSmoothPorts(); - } - - void ChechSmoothPorts() - { - m_inputPorts[ 3 ].Visible = !m_useUnity && m_calculateSmoothValue && (m_functionType == 0) ; - m_sizeIsDirty = true; - } - - void ChangePorts() - { - m_previewMaterialPassId = 0; - } - - public override void OnEnable() - { - base.OnEnable(); - m_UseTileScaleId = Shader.PropertyToID( UseTileScaleStr ); - m_TileScaleId = Shader.PropertyToID( TileScaleStr ); - m_MinkowskiPowerId = Shader.PropertyToID( MinkowskiPowerStr ); - m_DistFuncId = Shader.PropertyToID( DistFuncStr ); - m_MethodTypeId = Shader.PropertyToID( MethodTypeStr ); - m_SearchQualityId = Shader.PropertyToID( SearchQualityStr ); - m_OctavesId = Shader.PropertyToID( OctavesStr ); - m_UseSmoothnessId = Shader.PropertyToID( UseSmoothnessStr ); - } - - public override void SetPreviewInputs() - { - base.SetPreviewInputs(); - m_previewMaterialPassId = m_useUnity ? 0 : 1; - if( !m_useUnity ) - { - PreviewMaterial.SetInt( m_SearchQualityId, m_searchQuality + 1 ); - - if( m_functionType == 4) - { - PreviewMaterial.SetInt( m_DistFuncId, 0 ); - } else - { - PreviewMaterial.SetInt( m_DistFuncId, m_distanceFunction ); - } - - if( m_distanceFunction == 4 ) - { - PreviewMaterial.SetFloat( m_MinkowskiPowerId, m_minkowskiPower ); - } - - PreviewMaterial.SetInt( m_MethodTypeId, m_functionType ); - int smoothnessValue = m_calculateSmoothValue ? 1 : 0; - PreviewMaterial.SetInt( m_UseSmoothnessId, smoothnessValue ); - - PreviewMaterial.SetFloat( m_UseTileScaleId, m_tileable ? 1.0f : 0.0f ); - - if( m_tileable ) - PreviewMaterial.SetInt( m_TileScaleId, m_tileScale ); - - PreviewMaterial.SetInt( m_OctavesId, m_octaves ); - } - } - - public override void RenderNodePreview() - { - //Runs at least one time - if( !m_initialized ) - { - // nodes with no preview don't update at all - PreviewIsDirty = false; - return; - } - - if( !PreviewIsDirty ) - return; - - SetPreviewInputs(); - - RenderTexture temp = RenderTexture.active; - - RenderTexture.active = m_outputPorts[ 0 ].OutputPreviewTexture; - PreviewMaterial.SetInt( "_PreviewID", 0 ); - Graphics.Blit( null, m_outputPorts[ 0 ].OutputPreviewTexture, PreviewMaterial, m_previewMaterialPassId ); - - RenderTexture.active = m_outputPorts[ 1 ].OutputPreviewTexture; - PreviewMaterial.SetInt( "_PreviewID", 1 ); - Graphics.Blit( null, m_outputPorts[ 1 ].OutputPreviewTexture, PreviewMaterial, m_previewMaterialPassId ); - RenderTexture.active = temp; - - PreviewIsDirty = m_continuousPreviewRefresh; - - FinishPreviewRender = true; - } - - public override void DrawProperties() - { - base.DrawProperties(); - EditorGUI.BeginChangeCheck(); - { - EditorGUI.BeginDisabledGroup( m_useUnity ); - { - EditorGUI.BeginChangeCheck(); - m_functionType = EditorGUILayoutPopup( FunctionTypeStr, m_functionType, m_functionTypeStr ); - if( EditorGUI.EndChangeCheck() ) - { - ChechSmoothPorts(); - } - - EditorGUI.BeginDisabledGroup( m_functionType == 4 ); - m_distanceFunction = EditorGUILayoutPopup( DistanceFunctionLabelStr, m_distanceFunction, m_distanceFunctionStr ); - if( m_distanceFunction == 4 ) - { - m_minkowskiPower = EditorGUILayoutSlider( "Minkowski Power", m_minkowskiPower, 1, 5 ); - } - EditorGUI.EndDisabledGroup(); - - m_searchQuality = EditorGUILayoutPopup( SearchQualityLabelStr, m_searchQuality, m_searchQualityStr ); - m_octaves = EditorGUILayoutIntSlider( "Octaves", m_octaves, 1, 8 ); - m_tileable = EditorGUILayoutToggle( "Tileable", m_tileable ); - EditorGUI.BeginDisabledGroup( !m_tileable ); - m_tileScale = EditorGUILayoutIntField( "Tile Scale", m_tileScale ); - EditorGUI.EndDisabledGroup(); - - //Only smoothing cells type for now - if( m_functionType == 0 ) - { - EditorGUI.BeginChangeCheck(); - m_calculateSmoothValue = EditorGUILayoutToggle( "Smooth", m_calculateSmoothValue ); - if( EditorGUI.EndChangeCheck() ) - { - ChechSmoothPorts(); - } - } - } - EditorGUI.EndDisabledGroup(); - - EditorGUI.BeginChangeCheck(); - m_useUnity = EditorGUILayoutToggle( "Unity's Voronoi", m_useUnity ); - if( EditorGUI.EndChangeCheck() ) - { - ChangePorts(); - ChechSmoothPorts(); - } - } - if( EditorGUI.EndChangeCheck() ) - { - PreviewIsDirty = true; - } - - } - - void ChangeFunction( string scale ) - { - VoronoiBody[ 10 ] = "\t\to = ( sin( time + o * 6.2831 ) * 0.5 + 0.5 ); float2 r = g - f + o;"; - int q = m_searchQuality + 1; - VoronoiBody[ 4 ] = "for ( int j = -" + q + "; j <= " + q + "; j++ )"; - VoronoiBody[ 6 ] = "\tfor ( int i = -" + q + "; i <= " + q + "; i++ )"; - int dFunction = m_distanceFunction; - if( m_functionType == 4 ) - dFunction = 0; - switch( dFunction ) - { - default: - case 0: - VoronoiBody[ 11 ] = "\t\tfloat d = 0.5 * dot( r, r );"; - break; - case 1: - VoronoiBody[ 11 ] = "\t\tfloat d = 0.707 * sqrt(dot( r, r ));"; - break; - case 2: - VoronoiBody[ 11 ] = "\t\tfloat d = 0.5 * ( abs(r.x) + abs(r.y) );"; - break; - case 3: - VoronoiBody[ 11 ] = "\t\tfloat d = max(abs(r.x), abs(r.y));"; - break; - case 4: - VoronoiBody[ 11 ] = "\t\tfloat d = " + ( 1 / Mathf.Pow( 2, 1 / m_minkowskiPower ) ).ToString( "n3" ) + " * pow( ( pow( abs( r.x ), " + m_minkowskiPower + " ) + pow( abs( r.y ), " + m_minkowskiPower + " ) ), " + ( 1 / m_minkowskiPower ).ToString( "n3" ) + " );"; - break; - } - - if( m_functionType == 0 ) - { - if( m_calculateSmoothValue ) - { - VoronoiBody[ 12 ] = " //\t\tif( d<F1 ) {"; - VoronoiBody[ 13 ] = " //\t\t\tF2 = F1;"; - VoronoiBody[ 14 ] = " \t\t\tfloat h = smoothstep(0.0, 1.0, 0.5 + 0.5 * (F1 - d) / smoothness); F1 = lerp(F1, d, h) - smoothness * h * (1.0 - h);mg = g; mr = r; id = o;"; - VoronoiBody[ 15 ] = " //\t\t} else if( d<F2 ) {"; - VoronoiBody[ 16 ] = " //\t\t\tF2 = d;"; - VoronoiBody[ 17 ] = " //\t\t}"; - } - else - { - VoronoiBody[ 12 ] = " \t\tif( d<F1 ) {"; - VoronoiBody[ 13 ] = " \t\t\tF2 = F1;"; - VoronoiBody[ 14 ] = " \t\t\tF1 = d; mg = g; mr = r; id = o;"; - VoronoiBody[ 15 ] = " \t\t} else if( d<F2 ) {"; - VoronoiBody[ 16 ] = " \t\t\tF2 = d;"; - VoronoiBody[ 17 ] = " \t\t}"; - } - - - } - else - { - VoronoiBody[ 12 ] = " \t\tif( d<F1 ) {"; - VoronoiBody[ 13 ] = " \t\t\tF2 = F1;"; - VoronoiBody[ 14 ] = " \t\t\tF1 = d; mg = g; mr = r; id = o;"; - VoronoiBody[ 15 ] = " \t\t} else if( d<F2 ) {"; - VoronoiBody[ 16 ] = " \t\t\tF2 = d;"; - VoronoiBody[ 17 ] = " \t\t}"; - } - - switch( m_functionType ) - { - default: - case 0: - VoronoiBody[ 20 ] = "return F1;"; - break; - case 1: - VoronoiBody[ 20 ] = "return F2;"; - break; - case 2: - VoronoiBody[ 20 ] = "return F2 - F1;"; - break; - case 3: - VoronoiBody[ 20 ] = "return (F2 + F1) * 0.5;"; - break; - case 4: - VoronoiBody[ 20 ] = string.Format( VoronoiDistanceBody , VoronoiBody[ 10 ], OutputId ); - break; - } - - if( m_tileable ) - { - - VoronoiHashBody[ 0 ] = "p = p - " + m_tileScale + " * floor( p / " + m_tileScale + " );"; - } - else - { - VoronoiHashBody[ 0 ] = ""; - } - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if( m_outputPorts[ outputId ].IsLocalValue( dataCollector.PortCategory ) ) - { - return m_outputPorts[ outputId ].LocalValue( dataCollector.PortCategory ); - } - - if( m_useUnity ) - { - string uvValue = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - string angleOffset = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); - string cellDensity = m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ); - dataCollector.AddFunction( UnityVoroniNoiseFunctionsBody[ 0 ], UnityVoroniNoiseFunctionsBody, false ); - string varName = "unityVoronoy" + OutputId; - string varValue = string.Format( UnityVoronoiNoiseFunc, uvValue, angleOffset, cellDensity ); - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT3, varName, varValue ); - m_outputPorts[ 0 ].SetLocalValue( varName + ".x", dataCollector.PortCategory ); - m_outputPorts[ 1 ].SetLocalValue( varName + ".yz", dataCollector.PortCategory ); - return m_outputPorts[ outputId ].LocalValue( dataCollector.PortCategory ); - } - else - { - - string scaleValue = m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ); - - string timeVarValue = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); - string timeVarName = "time" + OutputId; - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT, timeVarName, timeVarValue ); - - ChangeFunction( scaleValue ); - - string voronoiHashFunc = string.Empty; - string VoronoiHashHeaderFormatted = string.Format( VoronoiHashHeader, OutputId ); - IOUtils.AddFunctionHeader( ref voronoiHashFunc, VoronoiHashHeaderFormatted ); - for( int i = 0; i < VoronoiHashBody.Length; i++ ) - { - IOUtils.AddFunctionLine( ref voronoiHashFunc, VoronoiHashBody[ i ] ); - } - IOUtils.CloseFunctionBody( ref voronoiHashFunc ); - dataCollector.AddFunction( VoronoiHashHeaderFormatted, voronoiHashFunc ); - - string smoothnessName = "0"; - if( m_calculateSmoothValue ) - { - smoothnessName = "voronoiSmooth" + outputId; - string smoothnessValue = m_inputPorts[ 3 ].GeneratePortInstructions( ref dataCollector ); - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT, smoothnessName, smoothnessValue ); - } - - string voronoiFunc = string.Empty; - IOUtils.AddFunctionHeader( ref voronoiFunc, string.Format( VoronoiHeader, OutputId ) ); - for( int i = 0; i < VoronoiBody.Length; i++ ) - { - if( i == 9 ) - { - IOUtils.AddFunctionLine( ref voronoiFunc, string.Format( VoronoiBody[ i ],OutputId ) ); - } - else - { - IOUtils.AddFunctionLine( ref voronoiFunc, VoronoiBody[ i ] ); - } - } - IOUtils.CloseFunctionBody( ref voronoiFunc ); - dataCollector.AddFunction( string.Format( VoronoiHeader, OutputId ), voronoiFunc ); - - string uvs = string.Empty; - if( m_inputPorts[ 0 ].IsConnected ) - uvs = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - else - { - if( dataCollector.IsTemplate ) - { - uvs = dataCollector.TemplateDataCollectorInstance.GenerateAutoUVs( 0 ); - } - else - { - uvs = GeneratorUtils.GenerateAutoUVs( ref dataCollector, UniqueId, 0 ); - } - } - - dataCollector.AddLocalVariable( UniqueId, string.Format( "float2 coords{0} = {1} * {2};", OutputId, uvs, scaleValue ) ); - dataCollector.AddLocalVariable( UniqueId, string.Format( "float2 id{0} = 0;", OutputId ) ); - - if( m_octaves == 1 ) - { - dataCollector.AddLocalVariable( UniqueId, string.Format( "float voroi{0} = {1};", OutputId, string.Format( VoronoiFunc, OutputId, "coords" + OutputId,timeVarName, "id"+ OutputId,smoothnessName ) ) ); - } - else - { - dataCollector.AddLocalVariable( UniqueId, string.Format( "float fade{0} = 0.5;", OutputId ) ); - dataCollector.AddLocalVariable( UniqueId, string.Format( "float voroi{0} = 0;", OutputId ) ); - dataCollector.AddLocalVariable( UniqueId, string.Format( "float rest{0} = 0;", OutputId ) ); - dataCollector.AddLocalVariable( UniqueId, string.Format( "for( int it{0} = 0; it{0} <" + m_octaves + "; it{0}++ ){{", OutputId) ); - dataCollector.AddLocalVariable( UniqueId, string.Format( "voroi{0} += fade{0} * voronoi{0}( coords{0}, time{0}, id{0},{1} );", OutputId, smoothnessName ) ); - dataCollector.AddLocalVariable( UniqueId, string.Format( "rest{0} += fade{0};", OutputId ) ); - dataCollector.AddLocalVariable( UniqueId, string.Format( "coords{0} *= 2;", OutputId ) ); - dataCollector.AddLocalVariable( UniqueId, string.Format( "fade{0} *= 0.5;", OutputId ) ); - dataCollector.AddLocalVariable( UniqueId, "}" + "//Voronoi" + OutputId ); - dataCollector.AddLocalVariable( UniqueId, string.Format( "voroi{0} /= rest{0};", OutputId ) ); - } - m_outputPorts[ 0 ].SetLocalValue( "voroi" + OutputId, dataCollector.PortCategory ); - m_outputPorts[ 1 ].SetLocalValue( "id" + OutputId, dataCollector.PortCategory ); - return m_outputPorts[ outputId ].LocalValue( dataCollector.PortCategory ); - } - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - m_searchQuality = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - m_distanceFunction = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - m_minkowskiPower = Convert.ToSingle( GetCurrentParam( ref nodeParams ) ); - m_functionType = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - m_octaves = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - m_tileable = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - m_tileScale = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - m_useUnity = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - if( UIUtils.CurrentShaderVersion() > 17402 ) - { - m_calculateSmoothValue = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - } - - ChangePorts(); - ChechSmoothPorts(); - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_searchQuality ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_distanceFunction ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_minkowskiPower ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_functionType ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_octaves ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_tileable.ToString() ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_tileScale ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_useUnity ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_calculateSmoothValue ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/VoronoiNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/VoronoiNode.cs.meta deleted file mode 100644 index fb9562a3..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ImageEffects/VoronoiNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: a3f99c25e876b164789b7612a63ec748 -timeCreated: 1566897514 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators.meta deleted file mode 100644 index 5a304e67..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/LogicalOperators.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 2123282111ea51445b360151bd090f3a -folderAsset: yes -timeCreated: 1481126945 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: 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: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master.meta deleted file mode 100644 index e014e2d5..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 7787d08c0679d324c99a7ca9a1a3e6a4 -folderAsset: yes -timeCreated: 1481126946 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalDefinesHelper.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalDefinesHelper.cs deleted file mode 100644 index 7aa08d96..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalDefinesHelper.cs +++ /dev/null @@ -1,140 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using System.Collections.Generic; -using UnityEngine; -using UnityEditor; - -namespace AmplifyShaderEditor -{ - [Serializable] - public class AdditionalDefinesHelper - { - private const string AdditionalDefinesStr = " Additional Defines"; - private const float ShaderKeywordButtonLayoutWidth = 15; - private ParentNode m_currentOwner; - - [SerializeField] - private List<string> m_additionalDefines = new List<string>(); - public List<string> DefineList { get { return m_additionalDefines; } set { m_additionalDefines = value; } } - - [SerializeField] - private List<string> m_outsideDefines = new List<string>(); - public List<string> OutsideList { get { return m_outsideDefines; } set { m_outsideDefines = value; } } - - public void Draw( ParentNode owner ) - { - m_currentOwner = owner; - bool value = owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedAdditionalDefines; - NodeUtils.DrawPropertyGroup( ref value, AdditionalDefinesStr, DrawMainBody, DrawButtons ); - owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedAdditionalDefines = value; - } - - void DrawButtons() - { - EditorGUILayout.Separator(); - - // Add keyword - if( GUILayout.Button( string.Empty, UIUtils.PlusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) - { - m_additionalDefines.Add( string.Empty ); - EditorGUI.FocusTextInControl( null ); - } - - //Remove keyword - if( GUILayout.Button( string.Empty, UIUtils.MinusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) - { - if( m_additionalDefines.Count > 0 ) - { - m_additionalDefines.RemoveAt( m_additionalDefines.Count - 1 ); - EditorGUI.FocusTextInControl( null ); - } - } - } - - void DrawMainBody() - { - EditorGUILayout.Separator(); - int itemCount = m_additionalDefines.Count; - int markedToDelete = -1; - for( int i = 0; i < itemCount; i++ ) - { - EditorGUILayout.BeginHorizontal(); - { - EditorGUI.BeginChangeCheck(); - m_additionalDefines[ i ] = EditorGUILayout.TextField( m_additionalDefines[ i ] ); - if( EditorGUI.EndChangeCheck() ) - { - m_additionalDefines[ i ] = UIUtils.RemoveShaderInvalidCharacters( m_additionalDefines[ i ] ); - } - - // Add new port - if( m_currentOwner.GUILayoutButton( string.Empty, UIUtils.PlusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) - { - m_additionalDefines.Insert( i + 1, string.Empty ); - EditorGUI.FocusTextInControl( null ); - } - - //Remove port - if( m_currentOwner.GUILayoutButton( string.Empty, UIUtils.MinusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) - { - markedToDelete = i; - } - } - EditorGUILayout.EndHorizontal(); - } - - if( markedToDelete > -1 ) - { - if( m_additionalDefines.Count > markedToDelete ) - { - m_additionalDefines.RemoveAt( markedToDelete ); - EditorGUI.FocusTextInControl( null ); - } - } - EditorGUILayout.Separator(); - EditorGUILayout.HelpBox( "Please add your defines without the #define keywords", MessageType.Info ); - } - - public void ReadFromString( ref uint index, ref string[] nodeParams ) - { - int count = Convert.ToInt32( nodeParams[ index++ ] ); - for( int i = 0; i < count; i++ ) - { - m_additionalDefines.Add( nodeParams[ index++ ] ); - } - } - - public void WriteToString( ref string nodeInfo ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_additionalDefines.Count ); - for( int i = 0; i < m_additionalDefines.Count; i++ ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_additionalDefines[ i ] ); - } - } - - public void AddToDataCollector( ref MasterNodeDataCollector dataCollector ) - { - for( int i = 0; i < m_additionalDefines.Count; i++ ) - { - if( !string.IsNullOrEmpty( m_additionalDefines[ i ] ) ) - dataCollector.AddToDefines( -1, m_additionalDefines[ i ] ); - } - - for( int i = 0; i < m_outsideDefines.Count; i++ ) - { - if( !string.IsNullOrEmpty( m_outsideDefines[ i ] ) ) - dataCollector.AddToDefines( -1, m_outsideDefines[ i ] ); - } - } - - public void Destroy() - { - m_additionalDefines.Clear(); - m_additionalDefines = null; - m_currentOwner = null; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalDefinesHelper.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalDefinesHelper.cs.meta deleted file mode 100644 index 6839c0e6..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalDefinesHelper.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 0801a5994efb46142ad8dcc0fe3c47f8 -timeCreated: 1513252939 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalIncludesHelper.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalIncludesHelper.cs deleted file mode 100644 index 542b586f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalIncludesHelper.cs +++ /dev/null @@ -1,154 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; -using UnityEditor; - -namespace AmplifyShaderEditor -{ - [Serializable] - public class AdditionalIncludesHelper - { - private const string AdditionalIncludesStr = " Additional Includes"; - private const float ShaderKeywordButtonLayoutWidth = 15; - private ParentNode m_currentOwner; - - [SerializeField] - private List<string> m_additionalIncludes = new List<string>(); - public List<string> IncludeList { get { return m_additionalIncludes; } set { m_additionalIncludes = value; } } - - [SerializeField] - private List<string> m_outsideIncludes = new List<string>(); - public List<string> OutsideList { get { return m_outsideIncludes; } set { m_outsideIncludes = value; } } - - public void Draw( ParentNode owner ) - { - m_currentOwner = owner; - bool value = owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedAdditionalIncludes; - NodeUtils.DrawPropertyGroup( ref value, AdditionalIncludesStr, DrawMainBody, DrawButtons ); - owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedAdditionalIncludes = value; - - } - - void DrawButtons() - { - EditorGUILayout.Separator(); - - // Add keyword - if( GUILayout.Button( string.Empty, UIUtils.PlusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) - { - m_additionalIncludes.Add( string.Empty ); - EditorGUI.FocusTextInControl( null ); - } - - //Remove keyword - if( GUILayout.Button( string.Empty, UIUtils.MinusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) - { - if( m_additionalIncludes.Count > 0 ) - { - m_additionalIncludes.RemoveAt( m_additionalIncludes.Count - 1 ); - EditorGUI.FocusTextInControl( null ); - } - } - } - - void DrawMainBody() - { - EditorGUILayout.Separator(); - //if( OutsideList != null && OutsideList.Count > 0 ) - //{ - // m_drawElements.Clear(); - // EditorGUI.BeginDisabledGroup( true ); - // int outsideCount = OutsideList.Count; - // for( int i = 0; i < outsideCount; i++ ) - // { - // if( !m_drawElements.Contains( OutsideList[ i ] ) ) - // { - // m_drawElements.Add( OutsideList[ i ] ); - // EditorGUILayout.TextField( OutsideList[ i ] ); - // } - // } - // EditorGUI.EndDisabledGroup(); - // EditorGUILayout.Separator(); - //} - int itemCount = m_additionalIncludes.Count; - int markedToDelete = -1; - for( int i = 0; i < itemCount; i++ ) - { - EditorGUILayout.BeginHorizontal(); - { - EditorGUI.BeginChangeCheck(); - m_additionalIncludes[ i ] = EditorGUILayout.TextField( m_additionalIncludes[ i ] ); - if( EditorGUI.EndChangeCheck() ) - { - m_additionalIncludes[ i ] = UIUtils.RemoveShaderInvalidCharacters( m_additionalIncludes[ i ] ); - } - - // Add new port - if( m_currentOwner.GUILayoutButton( string.Empty, UIUtils.PlusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) - { - m_additionalIncludes.Insert( i + 1, string.Empty ); - EditorGUI.FocusTextInControl( null ); - } - - //Remove port - if( m_currentOwner.GUILayoutButton( string.Empty, UIUtils.MinusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) - { - markedToDelete = i; - } - } - EditorGUILayout.EndHorizontal(); - } - - if( markedToDelete > -1 ) - { - if( m_additionalIncludes.Count > markedToDelete ) - { - m_additionalIncludes.RemoveAt( markedToDelete ); - EditorGUI.FocusTextInControl( null ); - } - } - EditorGUILayout.Separator(); - EditorGUILayout.HelpBox( "Please add your includes without the #include \"\" keywords", MessageType.Info ); - } - - public void ReadFromString( ref uint index, ref string[] nodeParams ) - { - int count = Convert.ToInt32( nodeParams[ index++ ] ); - for( int i = 0; i < count; i++ ) - { - m_additionalIncludes.Add( nodeParams[ index++ ] ); - } - } - - public void WriteToString( ref string nodeInfo ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_additionalIncludes.Count ); - for( int i = 0; i < m_additionalIncludes.Count; i++ ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_additionalIncludes[ i ] ); - } - } - - public void AddToDataCollector( ref MasterNodeDataCollector dataCollector ) - { - for( int i = 0; i < m_additionalIncludes.Count; i++ ) - { - if( !string.IsNullOrEmpty( m_additionalIncludes[ i ] ) ) - dataCollector.AddToIncludes( -1, m_additionalIncludes[ i ] ); - } - - for( int i = 0; i < m_outsideIncludes.Count; i++ ) - { - if( !string.IsNullOrEmpty( m_outsideIncludes[ i ] ) ) - dataCollector.AddToIncludes( -1, m_outsideIncludes[ i ] ); - } - } - - public void Destroy() - { - m_additionalIncludes.Clear(); - m_additionalIncludes = null; - m_currentOwner = null; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalIncludesHelper.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalIncludesHelper.cs.meta deleted file mode 100644 index 0997164e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalIncludesHelper.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 74ff3d342e013f64198aaf767e623962 -timeCreated: 1498123240 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalPragmasHelper.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalPragmasHelper.cs deleted file mode 100644 index a7e89707..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalPragmasHelper.cs +++ /dev/null @@ -1,141 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using System.Collections.Generic; -using UnityEngine; -using UnityEditor; - -namespace AmplifyShaderEditor -{ - [Serializable] - public class AdditionalPragmasHelper - { - private const string AdditionalPragmasStr = " Additional Pragmas"; - private const float ShaderKeywordButtonLayoutWidth = 15; - private ParentNode m_currentOwner; - - [SerializeField] - private List<string> m_additionalPragmas = new List<string>(); - public List<string> PragmaList { get { return m_additionalPragmas; } set { m_additionalPragmas = value; } } - - [SerializeField] - private List<string> m_outsidePragmas = new List<string>(); - public List<string> OutsideList { get { return m_outsidePragmas; } set { m_outsidePragmas = value; } } - - public void Draw( ParentNode owner ) - { - m_currentOwner = owner; - bool value = owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedAdditionalPragmas; - NodeUtils.DrawPropertyGroup( ref value, AdditionalPragmasStr, DrawMainBody, DrawButtons ); - owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedAdditionalPragmas = value; - - } - - void DrawButtons() - { - EditorGUILayout.Separator(); - - // Add keyword - if( GUILayout.Button( string.Empty, UIUtils.PlusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) - { - m_additionalPragmas.Add( string.Empty ); - EditorGUI.FocusTextInControl( null ); - } - - //Remove keyword - if( GUILayout.Button( string.Empty, UIUtils.MinusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) - { - if( m_additionalPragmas.Count > 0 ) - { - m_additionalPragmas.RemoveAt( m_additionalPragmas.Count - 1 ); - EditorGUI.FocusTextInControl( null ); - } - } - } - - void DrawMainBody() - { - EditorGUILayout.Separator(); - int itemCount = m_additionalPragmas.Count; - int markedToDelete = -1; - for( int i = 0; i < itemCount; i++ ) - { - EditorGUILayout.BeginHorizontal(); - { - EditorGUI.BeginChangeCheck(); - m_additionalPragmas[ i ] = EditorGUILayout.TextField( m_additionalPragmas[ i ] ); - if( EditorGUI.EndChangeCheck() ) - { - m_additionalPragmas[ i ] = UIUtils.RemoveShaderInvalidCharacters( m_additionalPragmas[ i ] ); - } - - // Add new port - if( m_currentOwner.GUILayoutButton( string.Empty, UIUtils.PlusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) - { - m_additionalPragmas.Insert( i + 1, string.Empty ); - EditorGUI.FocusTextInControl( null ); - } - - //Remove port - if( m_currentOwner.GUILayoutButton( string.Empty, UIUtils.MinusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) - { - markedToDelete = i; - } - } - EditorGUILayout.EndHorizontal(); - } - - if( markedToDelete > -1 ) - { - if( m_additionalPragmas.Count > markedToDelete ) - { - m_additionalPragmas.RemoveAt( markedToDelete ); - EditorGUI.FocusTextInControl( null ); - } - } - EditorGUILayout.Separator(); - EditorGUILayout.HelpBox( "Please add your pragmas without the #pragma keywords", MessageType.Info ); - } - - public void ReadFromString( ref uint index, ref string[] nodeParams ) - { - int count = Convert.ToInt32( nodeParams[ index++ ] ); - for( int i = 0; i < count; i++ ) - { - m_additionalPragmas.Add( nodeParams[ index++ ] ); - } - } - - public void WriteToString( ref string nodeInfo ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_additionalPragmas.Count ); - for( int i = 0; i < m_additionalPragmas.Count; i++ ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_additionalPragmas[ i ] ); - } - } - - public void AddToDataCollector( ref MasterNodeDataCollector dataCollector ) - { - for( int i = 0; i < m_additionalPragmas.Count; i++ ) - { - if( !string.IsNullOrEmpty( m_additionalPragmas[ i ] ) ) - dataCollector.AddToPragmas( -1, m_additionalPragmas[ i ] ); - } - - for( int i = 0; i < m_outsidePragmas.Count; i++ ) - { - if( !string.IsNullOrEmpty( m_outsidePragmas[ i ] ) ) - dataCollector.AddToPragmas( -1, m_outsidePragmas[ i ] ); - } - } - - public void Destroy() - { - m_additionalPragmas.Clear(); - m_additionalPragmas = null; - m_currentOwner = null; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalPragmasHelper.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalPragmasHelper.cs.meta deleted file mode 100644 index 3f245aaf..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalPragmasHelper.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 3153b4d10effd174988d75b84b12d281 -timeCreated: 1504515475 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalSurfaceOptionsHelper.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalSurfaceOptionsHelper.cs deleted file mode 100644 index cd3efae7..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalSurfaceOptionsHelper.cs +++ /dev/null @@ -1,153 +0,0 @@ -using System; -using UnityEngine; -using UnityEditor; -using System.Collections.Generic; - -namespace AmplifyShaderEditor -{ - - [Serializable] - public class AdditionalSurfaceOptionsHelper - { - private const string AdditionalOptionsStr = " Additional Surface Options"; - - - private const float ShaderKeywordButtonLayoutWidth = 15; - private ParentNode m_currentOwner; - - [SerializeField] - private List<string> m_availableOptions = new List<string>(); - - public void Draw( ParentNode owner ) - { - m_currentOwner = owner; - bool value = owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedAdditionalSurfaceOptions; - NodeUtils.DrawPropertyGroup( ref value, AdditionalOptionsStr, DrawMainBody, DrawButtons ); - owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedAdditionalSurfaceOptions = value; - } - - void DrawButtons() - { - EditorGUILayout.Separator(); - - // Add tag - if( GUILayout.Button( string.Empty, UIUtils.PlusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) - { - m_availableOptions.Add( string.Empty ); - EditorGUI.FocusTextInControl( null ); - } - - //Remove tag - if( GUILayout.Button( string.Empty, UIUtils.MinusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) - { - if( m_availableOptions.Count > 0 ) - { - m_availableOptions.RemoveAt( m_availableOptions.Count - 1 ); - EditorGUI.FocusTextInControl( null ); - } - } - } - - void DrawMainBody() - { - EditorGUILayout.Separator(); - int itemCount = m_availableOptions.Count; - - if( itemCount == 0 ) - { - EditorGUILayout.HelpBox( "Your list is Empty!\nUse the plus button to add one.", MessageType.Info ); - } - - int markedToDelete = -1; - float originalLabelWidth = EditorGUIUtility.labelWidth; - for( int i = 0; i < itemCount; i++ ) - { - - EditorGUI.indentLevel += 1; - EditorGUIUtility.labelWidth = 62; - EditorGUILayout.BeginHorizontal(); - //Option - EditorGUI.BeginChangeCheck(); - m_availableOptions[ i ] = EditorGUILayout.TextField( "["+i+"] -", m_availableOptions[ i ] ); - if( EditorGUI.EndChangeCheck() ) - { - m_availableOptions[ i ] = UIUtils.RemoveShaderInvalidCharacters( m_availableOptions[ i ] ); - } - - EditorGUIUtility.labelWidth = originalLabelWidth; - - { - // Add new port - if( m_currentOwner.GUILayoutButton( string.Empty, UIUtils.PlusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) - { - m_availableOptions.Insert( i + 1, string.Empty ); - EditorGUI.FocusTextInControl( null ); - } - - //Remove port - if( m_currentOwner.GUILayoutButton( string.Empty, UIUtils.MinusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) - { - markedToDelete = i; - } - } - EditorGUILayout.EndHorizontal(); - EditorGUI.indentLevel -= 1; - } - - if( markedToDelete > -1 ) - { - if( m_availableOptions.Count > markedToDelete ) - { - m_availableOptions.RemoveAt( markedToDelete ); - EditorGUI.FocusTextInControl( null ); - } - } - EditorGUILayout.Separator(); - } - - public void ReadFromString( ref uint index, ref string[] nodeParams ) - { - int count = Convert.ToInt32( nodeParams[ index++ ] ); - for( int i = 0; i < count; i++ ) - { - m_availableOptions.Add( nodeParams[ index++ ] ); - } - } - - public void WriteToString( ref string nodeInfo ) - { - int optionsCount = m_availableOptions.Count; - IOUtils.AddFieldValueToString( ref nodeInfo, optionsCount ); - for( int i = 0; i < optionsCount; i++ ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_availableOptions[ i ].ToString() ); - } - } - - public void WriteToOptionalSurfaceOptions( ref string currentOptions ) - { - int tagsCount = m_availableOptions.Count; - if( tagsCount == 0 ) - return; - - string result = " "; - - for( int i = 0; i < tagsCount; i++ ) - { - result += m_availableOptions[ i ]; - if( i < tagsCount - 1 ) - { - result += " "; - } - } - currentOptions = currentOptions + result; - } - - public void Destroy() - { - m_availableOptions.Clear(); - m_availableOptions = null; - m_currentOwner = null; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalSurfaceOptionsHelper.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalSurfaceOptionsHelper.cs.meta deleted file mode 100644 index ccd630e4..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/AdditionalSurfaceOptionsHelper.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: d830b2cc8bc5e174485077319135fc1e -timeCreated: 1528881842 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/BillboardOpHelper.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/BillboardOpHelper.cs deleted file mode 100644 index d1391d95..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/BillboardOpHelper.cs +++ /dev/null @@ -1,242 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -// Billboard based on: -// https://gist.github.com/renaudbedard/7a90ec4a5a7359712202 -using System; -using UnityEngine; -using System.Collections.Generic; - -namespace AmplifyShaderEditor -{ - public enum BillboardType - { - Cylindrical, - Spherical - } - - [Serializable] - public class BillboardOpHelper - { - public static readonly string BillboardTitleStr = " Billboard"; - public static readonly string BillboardTypeStr = "Type"; - public static readonly string BillboardRotIndStr = "Ignore Rotation"; - - public static readonly string[] BillboardCylindricalInstructions = { "//Calculate new billboard vertex position and normal", - "float3 upCamVec = float3( 0, 1, 0 )"}; - - public static readonly string[] BillboardSphericalInstructions = { "//Calculate new billboard vertex position and normal", - "float3 upCamVec = normalize ( UNITY_MATRIX_V._m10_m11_m12 )"}; - - - public static readonly string[] BillboardCommonInstructions = { "float3 forwardCamVec = -normalize ( UNITY_MATRIX_V._m20_m21_m22 )", - "float3 rightCamVec = normalize( UNITY_MATRIX_V._m00_m01_m02 )", - "float4x4 rotationCamMatrix = float4x4( rightCamVec, 0, upCamVec, 0, forwardCamVec, 0, 0, 0, 0, 1 )", - "{0} = normalize( mul( float4( {0} , 0 ), rotationCamMatrix )).xyz"}; - - public static readonly string[] BillboardRotDependent = { "//This unfortunately must be made to take non-uniform scaling into account", - "//Transform to world coords, apply rotation and transform back to local", - "{0} = mul( {1} , unity_ObjectToWorld ){2}", - "{0} = mul( {1} , rotationCamMatrix ){2}", - "{0} = mul( {1} , unity_WorldToObject ){2}"}; - - - public static readonly string[] BillboardRotIndependent = { "{0}.x *= length( unity_ObjectToWorld._m00_m10_m20 )", - "{0}.y *= length( unity_ObjectToWorld._m01_m11_m21 )", - "{0}.z *= length( unity_ObjectToWorld._m02_m12_m22 )", - "{0} = mul( {0}, rotationCamMatrix )", - "{0}.xyz += unity_ObjectToWorld._m03_m13_m23", - "//Need to nullify rotation inserted by generated surface shader", - "{0} = mul( unity_WorldToObject, {0} )"}; - - - - public static readonly string[] BillboardHDRotDependent = { "//This unfortunately must be made to take non-uniform scaling into account", - "//Transform to world coords, apply rotation and transform back to local", - "{0} = mul( {1} , GetObjectToWorldMatrix() ){2}", - "{0} = mul( {1} , rotationCamMatrix ){2}", - "{0} = mul( {1} , GetWorldToObjectMatrix() ){2}"}; - - - public static readonly string[] BillboardHDRotIndependent = { "{0}.x *= length( GetObjectToWorldMatrix()._m00_m10_m20 )", - "{0}.y *= length( GetObjectToWorldMatrix()._m01_m11_m21 )", - "{0}.z *= length( GetObjectToWorldMatrix()._m02_m12_m22 )", - "{0} = mul( {0}, rotationCamMatrix )", - "{0}.xyz += GetObjectToWorldMatrix()._m03_m13_m23", - "//Need to nullify rotation inserted by generated surface shader", - "{0} = mul( GetWorldToObjectMatrix(), {0} )"}; - - - [SerializeField] - private bool m_isBillboard = false; - - [SerializeField] - private BillboardType m_billboardType = BillboardType.Cylindrical; - - [SerializeField] - private bool m_rotationIndependent = false; - - public void Draw( ParentNode owner ) - { - bool visible = owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedVertexOptions; - bool enabled = m_isBillboard; - NodeUtils.DrawPropertyGroup( owner, ref visible, ref m_isBillboard, BillboardTitleStr, () => - { - m_billboardType = (BillboardType)owner.EditorGUILayoutEnumPopup( BillboardTypeStr, m_billboardType ); - m_rotationIndependent = owner.EditorGUILayoutToggle( BillboardRotIndStr, m_rotationIndependent ); - } ); - - owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedVertexOptions = visible; - if( m_isBillboard != enabled ) - { - UIUtils.RequestSave(); - } - } - public void FillDataCollectorWithInternalData( ref MasterNodeDataCollector dataCollector ) - { - if( m_isBillboard ) - { - FillDataCollector( ref dataCollector, m_billboardType, m_rotationIndependent, "v.vertex", "v.normal", false ); - } - } - // This should be called after the Vertex Offset and Vertex Normal ports are analised - public static void FillDataCollector( ref MasterNodeDataCollector dataCollector, BillboardType billboardType, bool rotationIndependent, string vertexPosValue, string vertexNormalValue, bool vertexIsFloat3 ) - { - switch( billboardType ) - { - case BillboardType.Cylindrical: - { - for( int i = 0; i < BillboardCylindricalInstructions.Length; i++ ) - { - dataCollector.AddVertexInstruction( BillboardCylindricalInstructions[ i ] + ( dataCollector.IsTemplate ? ";" : string.Empty ), -1, true ); - } - } - break; - - case BillboardType.Spherical: - { - for( int i = 0; i < BillboardCylindricalInstructions.Length; i++ ) - { - dataCollector.AddVertexInstruction( BillboardSphericalInstructions[ i ] + ( dataCollector.IsTemplate ? ";" : string.Empty ), -1, true ); - } - } - break; - } - - for( int i = 0; i < BillboardCommonInstructions.Length; i++ ) - { - string value = ( i == 3 ) ? string.Format( BillboardCommonInstructions[ i ], vertexNormalValue ) : BillboardCommonInstructions[ i ]; - dataCollector.AddVertexInstruction( value + ( dataCollector.IsTemplate ? ";" : string.Empty ), -1, true ); - } - - if( rotationIndependent ) - { - for( int i = 0; i < BillboardRotIndependent.Length; i++ ) - { - string value = string.Empty; - if( dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType != TemplateSRPType.BuiltIn ) - { - value = ( i != 5 ) ? string.Format( BillboardHDRotIndependent[ i ], vertexPosValue ) : BillboardHDRotIndependent[ i ]; - } - else - { - value = ( i != 5 ) ? string.Format( BillboardRotIndependent[ i ], vertexPosValue ) : BillboardRotIndependent[ i ]; - } - dataCollector.AddVertexInstruction( value + ( dataCollector.IsTemplate ? ";" : string.Empty ), -1, true ); - } - } - else - { - string vertexPosConverted = vertexIsFloat3 ? string.Format( "float4({0},0)", vertexPosValue ) : vertexPosValue; - for( int i = 0; i < BillboardRotDependent.Length; i++ ) - { - string value = string.Empty; - if( dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HD ) - { - value = ( i > 1 ) ? string.Format( BillboardHDRotDependent[ i ], vertexPosValue, vertexPosConverted, ( vertexIsFloat3 ? ".xyz" : string.Empty ) ) : BillboardHDRotDependent[ i ]; - } - else - { - value = ( i > 1 ) ? string.Format( BillboardRotDependent[ i ], vertexPosValue, vertexPosConverted, ( vertexIsFloat3 ? ".xyz" : string.Empty ) ) : BillboardRotDependent[ i ]; - } - dataCollector.AddVertexInstruction( value + ( dataCollector.IsTemplate ? ";" : string.Empty ), -1, true ); - } - } - } - - public string[] GetInternalMultilineInstructions() - { - // This method is only used on Surface ... no HD variation is needed - return GetMultilineInstructions( m_billboardType, m_rotationIndependent, "v.vertex", "v.normal" ); - } - - public static string[] GetMultilineInstructions( BillboardType billboardType, bool rotationIndependent, string vertexPosValue, string vertexNormalValue ) - { - // This method is only used on Surface ... no HD variation is needed - List<string> body = new List<string>(); - switch( billboardType ) - { - case BillboardType.Cylindrical: - { - for( int i = 0; i < BillboardCylindricalInstructions.Length; i++ ) - { - body.Add( BillboardCylindricalInstructions[ i ] ); - } - } - break; - - case BillboardType.Spherical: - { - for( int i = 0; i < BillboardCylindricalInstructions.Length; i++ ) - { - body.Add( BillboardSphericalInstructions[ i ] ); - } - } - break; - } - - for( int i = 0; i < BillboardCommonInstructions.Length; i++ ) - { - string value = ( i == 3 ) ? string.Format( BillboardCommonInstructions[ i ], vertexNormalValue ) : BillboardCommonInstructions[ i ]; - body.Add( value ); - } - - if( rotationIndependent ) - { - for( int i = 0; i < BillboardRotIndependent.Length; i++ ) - { - string value = ( i != 5 ) ? string.Format( BillboardRotIndependent[ i ], vertexPosValue ) : BillboardRotIndependent[ i ]; - body.Add( value ); - } - } - else - { - for( int i = 0; i < BillboardRotDependent.Length; i++ ) - { - string value = ( i > 1 ) ? string.Format( BillboardRotDependent[ i ], vertexPosValue ) : BillboardRotDependent[ i ]; - body.Add( value ); - } - } - return body.ToArray(); - } - - public void ReadFromString( ref uint index, ref string[] nodeParams ) - { - m_isBillboard = Convert.ToBoolean( nodeParams[ index++ ] ); - m_billboardType = (BillboardType)Enum.Parse( typeof( BillboardType ), nodeParams[ index++ ] ); - if( UIUtils.CurrentShaderVersion() > 11007 ) - { - m_rotationIndependent = Convert.ToBoolean( nodeParams[ index++ ] ); - } - } - - public void WriteToString( ref string nodeInfo ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_isBillboard ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_billboardType ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_rotationIndependent ); - } - - public bool IsBillboard { get { return m_isBillboard; } } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/BillboardOpHelper.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/BillboardOpHelper.cs.meta deleted file mode 100644 index 812475f8..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/BillboardOpHelper.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 837b906a268babc49ac733573c5b3394 -timeCreated: 1489159407 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/BlendOpsHelper.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/BlendOpsHelper.cs deleted file mode 100644 index 989ace5f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/BlendOpsHelper.cs +++ /dev/null @@ -1,447 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using UnityEngine; -using UnityEditor; -using System.Collections.Generic; - -namespace AmplifyShaderEditor -{ - public enum AvailableBlendFactor - { - One = 1, - Zero = 0, - SrcColor = 3, - SrcAlpha = 5, - DstColor = 2, - DstAlpha = 7, - OneMinusSrcColor = 6, - OneMinusSrcAlpha = 10, - OneMinusDstColor = 4, - OneMinusDstAlpha = 8, - SrcAlphaSaturate = 9 - }; - - public enum AvailableBlendOps - { - OFF = 0, - Add, - Sub, - RevSub, - Min, - Max, - //Direct X11 only - LogicalClear, - LogicalSet, - LogicalCopy, - LogicalCopyInverted, - LogicalNoop, - LogicalInvert, - LogicalAnd, - LogicalNand, - LogicalOr, - LogicalNor, - LogicalXor, - LogicalEquiv, - LogicalAndReverse, - LogicalAndInverted, - LogicalOrReverse, - LogicalOrInverted - }; - - public class CommonBlendTypes - { - public string Name; - public AvailableBlendFactor SourceFactor; - public AvailableBlendFactor DestFactor; - public CommonBlendTypes( string name, AvailableBlendFactor sourceFactor, AvailableBlendFactor destFactor ) - { - Name = name; - SourceFactor = sourceFactor; - DestFactor = destFactor; - } - } - - [Serializable] - public class BlendOpsHelper - { - public static readonly string[] BlendOpsLabels = - { - "<OFF>", - "Add", - "Sub", - "RevSub", - "Min", - "Max", - "LogicalClear ( DX11.1 Only )", - "LogicalSet ( DX11.1 Only )", - "LogicalCopy ( DX11.1 Only )", - "LogicalCopyInverted ( DX11.1 Only )", - "LogicalNoop ( DX11.1 Only )", - "LogicalInvert ( DX11.1 Only )", - "LogicalAnd ( DX11.1 Only )", - "LogicalNand ( DX11.1 Only )", - "LogicalOr ( DX11.1 Only )", - "LogicalNor ( DX11.1 Only )", - "LogicalXor ( DX11.1 Only )", - "LogicalEquiv ( DX11.1 Only )", - "LogicalAndReverse ( DX11.1 Only )", - "LogicalAndInverted ( DX11.1 Only )", - "LogicalOrReverse ( DX11.1 Only )", - "LogicalOrInverted ( DX11.1 Only )" - }; - - private const string BlendModesRGBStr = "Blend RGB"; - private const string BlendModesAlphaStr = "Blend Alpha"; - - private const string BlendOpsRGBStr = "Blend Op RGB"; - private const string BlendOpsAlphaStr = "Blend Op Alpha"; - - private const string SourceFactorStr = "Src"; - private const string DstFactorStr = "Dst"; - - private const string SingleBlendFactorStr = "Blend {0} {1}"; - private const string SeparateBlendFactorStr = "Blend {0} {1} , {2} {3}"; - - private const string SingleBlendOpStr = "BlendOp {0}"; - private const string SeparateBlendOpStr = "BlendOp {0} , {1}"; - - private string[] m_commonBlendTypesArr; - private List<CommonBlendTypes> m_commonBlendTypes = new List<CommonBlendTypes> { new CommonBlendTypes("<OFF>", AvailableBlendFactor.Zero, AvailableBlendFactor.Zero ), - new CommonBlendTypes("Custom", AvailableBlendFactor.Zero, AvailableBlendFactor.Zero ) , - new CommonBlendTypes("Alpha Blend", AvailableBlendFactor.SrcAlpha, AvailableBlendFactor.OneMinusSrcAlpha ) , - new CommonBlendTypes("Premultiplied", AvailableBlendFactor.One, AvailableBlendFactor.OneMinusSrcAlpha ), - new CommonBlendTypes("Additive", AvailableBlendFactor.One, AvailableBlendFactor.One ), - new CommonBlendTypes("Soft Additive", AvailableBlendFactor.OneMinusDstColor, AvailableBlendFactor.One ), - new CommonBlendTypes("Multiplicative", AvailableBlendFactor.DstColor, AvailableBlendFactor.Zero ), - new CommonBlendTypes("2x Multiplicative", AvailableBlendFactor.DstColor, AvailableBlendFactor.SrcColor ), - new CommonBlendTypes("Particle Additive", AvailableBlendFactor.SrcAlpha, AvailableBlendFactor.One ),}; - - [SerializeField] - private bool m_enabled = false; - - // Blend Factor - // RGB - [SerializeField] - private int m_currentIndex = 0; - - - [SerializeField] - private InlineProperty m_sourceFactorRGB = new InlineProperty( 0 ); - - [SerializeField] - private InlineProperty m_destFactorRGB = new InlineProperty( 0 ); - - // Alpha - [SerializeField] - private int m_currentAlphaIndex = 0; - - [SerializeField] - private InlineProperty m_sourceFactorAlpha = new InlineProperty( 0 ); - - [SerializeField] - private InlineProperty m_destFactorAlpha = new InlineProperty( 0 ); - - //Blend Ops - [SerializeField] - private bool m_blendOpEnabled = false; - - [SerializeField] - private InlineProperty m_blendOpRGB = new InlineProperty( 0 ); - - [SerializeField] - private InlineProperty m_blendOpAlpha = new InlineProperty( 0 ); - - public BlendOpsHelper() - { - m_commonBlendTypesArr = new string[ m_commonBlendTypes.Count ]; - for( int i = 0; i < m_commonBlendTypesArr.Length; i++ ) - { - m_commonBlendTypesArr[ i ] = m_commonBlendTypes[ i ].Name; - } - } - - public void Draw( UndoParentNode owner, bool customBlendAvailable ) - { - m_enabled = customBlendAvailable; - - // RGB - EditorGUI.BeginChangeCheck(); - m_currentIndex = owner.EditorGUILayoutPopup( BlendModesRGBStr, m_currentIndex, m_commonBlendTypesArr ); - if( EditorGUI.EndChangeCheck() ) - { - if( m_currentIndex > 1 ) - { - m_sourceFactorRGB.IntValue = (int)m_commonBlendTypes[ m_currentIndex ].SourceFactor; - m_sourceFactorRGB.SetInlineNodeValue(); - - m_destFactorRGB.IntValue = (int)m_commonBlendTypes[ m_currentIndex ].DestFactor; - m_destFactorRGB.SetInlineNodeValue(); - } - } - EditorGUI.BeginDisabledGroup( m_currentIndex == 0 ); - - EditorGUI.BeginChangeCheck(); - float cached = EditorGUIUtility.labelWidth; - EditorGUIUtility.labelWidth = 40; - - EditorGUILayout.BeginHorizontal(); - AvailableBlendFactor tempCast = (AvailableBlendFactor)m_sourceFactorRGB.IntValue; - m_sourceFactorRGB.CustomDrawer( ref owner, ( x ) => { tempCast = (AvailableBlendFactor)x.EditorGUILayoutEnumPopup( SourceFactorStr, tempCast ); }, SourceFactorStr ); - m_sourceFactorRGB.IntValue = (int)tempCast; - EditorGUI.indentLevel--; - EditorGUIUtility.labelWidth = 25; - tempCast = (AvailableBlendFactor)m_destFactorRGB.IntValue; - m_destFactorRGB.CustomDrawer( ref owner, ( x ) => { tempCast = (AvailableBlendFactor)x.EditorGUILayoutEnumPopup( DstFactorStr, tempCast ); }, DstFactorStr ); - m_destFactorRGB.IntValue = (int)tempCast; - EditorGUI.indentLevel++; - EditorGUILayout.EndHorizontal(); - - EditorGUIUtility.labelWidth = cached; - if( EditorGUI.EndChangeCheck() ) - { - CheckRGBIndex(); - } - - // Both these tests should be removed on a later stage - // ASE v154dev004 changed AvailableBlendOps.OFF value from -1 to 0 - // If importing the new package into an already opened ASE window makes - // hotcode to preserve the -1 value on these variables - if( m_blendOpRGB.FloatValue < 0 ) - m_blendOpRGB.FloatValue = 0; - - if( m_blendOpAlpha.FloatValue < 0 ) - m_blendOpAlpha.FloatValue = 0; - - EditorGUI.BeginChangeCheck(); - //AvailableBlendOps tempOpCast = (AvailableBlendOps)m_blendOpRGB.IntValue; - m_blendOpRGB.CustomDrawer( ref owner, ( x ) => { m_blendOpRGB.IntValue = x.EditorGUILayoutPopup( BlendOpsRGBStr, m_blendOpRGB.IntValue, BlendOpsLabels ); }, BlendOpsRGBStr ); - //m_blendOpRGB.IntValue = (int)tempOpCast; - if( EditorGUI.EndChangeCheck() ) - { - m_blendOpEnabled = ( !m_blendOpRGB.Active && m_blendOpRGB.IntValue > -1 ) || ( m_blendOpRGB.Active && m_blendOpRGB.NodeId > -1 );//AvailableBlendOps.OFF; - m_blendOpRGB.SetInlineNodeValue(); - } - - EditorGUI.EndDisabledGroup(); - - // Alpha - EditorGUILayout.Separator(); - - EditorGUI.BeginChangeCheck(); - m_currentAlphaIndex = owner.EditorGUILayoutPopup( BlendModesAlphaStr, m_currentAlphaIndex, m_commonBlendTypesArr ); - if( EditorGUI.EndChangeCheck() ) - { - if( m_currentAlphaIndex > 0 ) - { - m_sourceFactorAlpha.IntValue = (int)m_commonBlendTypes[ m_currentAlphaIndex ].SourceFactor; - m_sourceFactorAlpha.SetInlineNodeValue(); - - m_destFactorAlpha.IntValue = (int)m_commonBlendTypes[ m_currentAlphaIndex ].DestFactor; - m_destFactorAlpha.SetInlineNodeValue(); - } - } - EditorGUI.BeginDisabledGroup( m_currentAlphaIndex == 0 ); - - EditorGUI.BeginChangeCheck(); - cached = EditorGUIUtility.labelWidth; - EditorGUIUtility.labelWidth = 40; - EditorGUILayout.BeginHorizontal(); - tempCast = (AvailableBlendFactor)m_sourceFactorAlpha.IntValue; - m_sourceFactorAlpha.CustomDrawer( ref owner, ( x ) => { tempCast = (AvailableBlendFactor)x.EditorGUILayoutEnumPopup( SourceFactorStr, tempCast ); }, SourceFactorStr ); - m_sourceFactorAlpha.IntValue = (int)tempCast; - EditorGUI.indentLevel--; - EditorGUIUtility.labelWidth = 25; - tempCast = (AvailableBlendFactor)m_destFactorAlpha.IntValue; - m_destFactorAlpha.CustomDrawer( ref owner, ( x ) => { tempCast = (AvailableBlendFactor)x.EditorGUILayoutEnumPopup( DstFactorStr, tempCast ); }, DstFactorStr ); - m_destFactorAlpha.IntValue = (int)tempCast; - EditorGUI.indentLevel++; - EditorGUILayout.EndHorizontal(); - EditorGUIUtility.labelWidth = cached; - - if( EditorGUI.EndChangeCheck() ) - { - CheckAlphaIndex(); - } - EditorGUI.BeginChangeCheck(); - //tempOpCast = (AvailableBlendOps)m_blendOpAlpha.IntValue; - m_blendOpAlpha.CustomDrawer( ref owner, ( x ) => { m_blendOpAlpha.IntValue = x.EditorGUILayoutPopup( BlendOpsAlphaStr, m_blendOpAlpha.IntValue, BlendOpsLabels ); }, BlendOpsAlphaStr ); - //m_blendOpAlpha.IntValue = (int)tempOpCast; - if( EditorGUI.EndChangeCheck() ) - { - m_blendOpAlpha.SetInlineNodeValue(); - } - EditorGUI.EndDisabledGroup(); - EditorGUILayout.Separator(); - } - - void CheckRGBIndex() - { - int count = m_commonBlendTypes.Count; - m_currentIndex = 1; - for( int i = 1; i < count; i++ ) - { - if( m_commonBlendTypes[ i ].SourceFactor == (AvailableBlendFactor)m_sourceFactorRGB.IntValue && m_commonBlendTypes[ i ].DestFactor == (AvailableBlendFactor)m_destFactorRGB.IntValue ) - { - m_currentIndex = i; - return; - } - } - - } - - void CheckAlphaIndex() - { - int count = m_commonBlendTypes.Count; - m_currentAlphaIndex = 1; - for( int i = 1; i < count; i++ ) - { - if( m_commonBlendTypes[ i ].SourceFactor == (AvailableBlendFactor)m_sourceFactorAlpha.IntValue && m_commonBlendTypes[ i ].DestFactor == (AvailableBlendFactor)m_destFactorAlpha.IntValue ) - { - m_currentAlphaIndex = i; - if( m_currentAlphaIndex > 0 && m_currentIndex == 0 ) - m_currentIndex = 1; - return; - } - } - - if( m_currentAlphaIndex > 0 && m_currentIndex == 0 ) - m_currentIndex = 1; - } - - public void ReadFromString( ref uint index, ref string[] nodeParams ) - { - m_currentIndex = Convert.ToInt32( nodeParams[ index++ ] ); - if( UIUtils.CurrentShaderVersion() > 15103 ) - { - m_sourceFactorRGB.ReadFromString( ref index, ref nodeParams ); - m_destFactorRGB.ReadFromString( ref index, ref nodeParams ); - } - else - { - m_sourceFactorRGB.IntValue = (int)(AvailableBlendFactor)Enum.Parse( typeof( AvailableBlendFactor ), nodeParams[ index++ ] ); - m_destFactorRGB.IntValue = (int)(AvailableBlendFactor)Enum.Parse( typeof( AvailableBlendFactor ), nodeParams[ index++ ] ); - } - - m_currentAlphaIndex = Convert.ToInt32( nodeParams[ index++ ] ); - if( UIUtils.CurrentShaderVersion() > 15103 ) - { - m_sourceFactorAlpha.ReadFromString( ref index, ref nodeParams ); - m_destFactorAlpha.ReadFromString( ref index, ref nodeParams ); - - m_blendOpRGB.ReadFromString( ref index, ref nodeParams ); - m_blendOpAlpha.ReadFromString( ref index, ref nodeParams ); - if( UIUtils.CurrentShaderVersion() < 15404 ) - { - // Now BlendOps enum starts at 0 and not -1 - m_blendOpRGB.FloatValue += 1; - m_blendOpAlpha.FloatValue += 1; - } - } - else - { - m_sourceFactorAlpha.IntValue = (int)(AvailableBlendFactor)Enum.Parse( typeof( AvailableBlendFactor ), nodeParams[ index++ ] ); - m_destFactorAlpha.IntValue = (int)(AvailableBlendFactor)Enum.Parse( typeof( AvailableBlendFactor ), nodeParams[ index++ ] ); - m_blendOpRGB.IntValue = (int)(AvailableBlendOps)Enum.Parse( typeof( AvailableBlendOps ), nodeParams[ index++ ] ); - m_blendOpAlpha.IntValue = (int)(AvailableBlendOps)Enum.Parse( typeof( AvailableBlendOps ), nodeParams[ index++ ] ); - } - - m_enabled = ( m_currentIndex > 0 || m_currentAlphaIndex > 0 ); - m_blendOpEnabled = ( !m_blendOpRGB.Active && m_blendOpRGB.IntValue > -1 ) || ( m_blendOpRGB.Active && m_blendOpRGB.NodeId > -1 ); - } - - - public void WriteToString( ref string nodeInfo ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_currentIndex ); - m_sourceFactorRGB.WriteToString( ref nodeInfo ); - m_destFactorRGB.WriteToString( ref nodeInfo ); - - IOUtils.AddFieldValueToString( ref nodeInfo, m_currentAlphaIndex ); - m_sourceFactorAlpha.WriteToString( ref nodeInfo ); - m_destFactorAlpha.WriteToString( ref nodeInfo ); - - m_blendOpRGB.WriteToString( ref nodeInfo ); - m_blendOpAlpha.WriteToString( ref nodeInfo ); - } - - public void SetBlendOpsFromBlendMode( AlphaMode mode, bool customBlendAvailable ) - { - switch( mode ) - { - case AlphaMode.Transparent: - m_currentIndex = 2; - m_sourceFactorRGB.IntValue = (int)m_commonBlendTypes[ m_currentIndex ].SourceFactor; - m_destFactorRGB.IntValue = (int)m_commonBlendTypes[ m_currentIndex ].DestFactor; - break; - case AlphaMode.Masked: - case AlphaMode.Translucent: - m_currentIndex = 0; - break; - case AlphaMode.Premultiply: - m_currentIndex = 3; - m_sourceFactorRGB.IntValue = (int)m_commonBlendTypes[ m_currentIndex ].SourceFactor; - m_destFactorRGB.IntValue = (int)m_commonBlendTypes[ m_currentIndex ].DestFactor; - break; - } - m_enabled = customBlendAvailable; - } - - public string CreateBlendOps() - { - - string result = "\t\t" + CurrentBlendFactor + "\n"; - if( m_blendOpEnabled ) - { - result += "\t\t" + CurrentBlendOp + "\n"; - } - return result; - } - - public string CurrentBlendRGB { get { return m_commonBlendTypes[ m_currentIndex ].Name; } } - - public string CurrentBlendFactorSingle { get { return string.Format( SingleBlendFactorStr, m_sourceFactorRGB.GetValueOrProperty( ( (AvailableBlendFactor)m_sourceFactorRGB.IntValue ).ToString() ), m_destFactorRGB.GetValueOrProperty( ( (AvailableBlendFactor)m_destFactorRGB.IntValue ).ToString() ) ); } } - //public string CurrentBlendFactorSingleAlpha { get { return string.Format(SeparateBlendFactorStr, m_sourceFactorRGB, m_destFactorRGB, m_sourceFactorAlpha, m_destFactorAlpha); } } - public string CurrentBlendFactorSeparate - { - get - { - string src = ( m_currentIndex > 0 ? m_sourceFactorRGB.GetValueOrProperty( ( (AvailableBlendFactor)m_sourceFactorRGB.IntValue ).ToString() ) : AvailableBlendFactor.One.ToString() ); - string dst = ( m_currentIndex > 0 ? m_destFactorRGB.GetValueOrProperty( ( (AvailableBlendFactor)m_destFactorRGB.IntValue ).ToString() ) : AvailableBlendFactor.Zero.ToString() ); - string srca = m_sourceFactorAlpha.GetValueOrProperty( ( (AvailableBlendFactor)m_sourceFactorAlpha.IntValue ).ToString() ); - string dsta = m_destFactorAlpha.GetValueOrProperty( ( (AvailableBlendFactor)m_destFactorAlpha.IntValue ).ToString() ); - return string.Format( SeparateBlendFactorStr, src, dst, srca, dsta ); - } - } - public string CurrentBlendFactor { get { return ( ( m_currentAlphaIndex > 0 ) ? CurrentBlendFactorSeparate : CurrentBlendFactorSingle ); } } - - public string CurrentBlendOpSingle - { - get - { - string value = m_blendOpRGB.GetValueOrProperty( ( (AvailableBlendOps)m_blendOpRGB.IntValue ).ToString() ); - if( value.Equals( ( AvailableBlendOps.OFF ).ToString() ) ) - return string.Empty; - - return string.Format( SingleBlendOpStr, value ); - } - } - public string CurrentBlendOpSeparate - { - get - { - string rgbValue = m_blendOpRGB.GetValueOrProperty( ( (AvailableBlendOps)m_blendOpRGB.IntValue ).ToString() ); - - if( rgbValue.Equals( ( AvailableBlendOps.OFF ).ToString() )) - rgbValue = "Add"; - - string alphaValue = m_blendOpAlpha.GetValueOrProperty( ( (AvailableBlendOps)m_blendOpAlpha.IntValue ).ToString() ); - return string.Format( SeparateBlendOpStr, ( m_currentIndex > 0 ? rgbValue : AvailableBlendOps.Add.ToString() ), alphaValue ); - } - } - public string CurrentBlendOp { get { return ( ( m_currentAlphaIndex > 0 && m_blendOpAlpha.GetValueOrProperty( ( (AvailableBlendOps)m_blendOpAlpha.IntValue ).ToString() ) != AvailableBlendOps.OFF.ToString() ) ? CurrentBlendOpSeparate : CurrentBlendOpSingle ); } } - - public bool Active { get { return m_enabled && ( m_currentIndex > 0 || m_currentAlphaIndex > 0 ); } } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/BlendOpsHelper.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/BlendOpsHelper.cs.meta deleted file mode 100644 index 95ea7b51..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/BlendOpsHelper.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 8b59649a5f829e24cb4de8c1a715f8b4 -timeCreated: 1485530925 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/CodeGenerationData.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/CodeGenerationData.cs deleted file mode 100644 index 5245c9f4..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/CodeGenerationData.cs +++ /dev/null @@ -1,24 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEngine; -namespace AmplifyShaderEditor -{ - [System.Serializable] - public class CodeGenerationData - { - [SerializeField] - public bool IsActive; - [SerializeField] - public string Name; - [SerializeField] - public string Value; - - public CodeGenerationData( string name, string value ) - { - IsActive = false; - Name = name; - Value = value; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/CodeGenerationData.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/CodeGenerationData.cs.meta deleted file mode 100644 index 2c5d759e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/CodeGenerationData.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 7a47d8101acb2e94d95016b69a1c2e41 -timeCreated: 1481126957 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/ColorMaskHelper.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/ColorMaskHelper.cs deleted file mode 100644 index 2280c9f0..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/ColorMaskHelper.cs +++ /dev/null @@ -1,107 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> -using System; -using UnityEngine; -using UnityEditor; - -namespace AmplifyShaderEditor -{ - [Serializable] - class ColorMaskHelper - { - private GUIContent ColorMaskContent = new GUIContent( "Color Mask", "Sets color channel writing mask, turning all off makes the object completely invisible\nDefault: RGBA" ); - private readonly char[] m_colorMaskChar = { 'R', 'G', 'B', 'A' }; - - private GUIStyle m_leftToggleColorMask; - private GUIStyle m_middleToggleColorMask; - private GUIStyle m_rightToggleColorMask; - - - [SerializeField] - private bool[] m_colorMask = { true, true, true, true }; - - [SerializeField] - private InlineProperty m_inlineMask = new InlineProperty(); - - public void Draw( UndoParentNode owner ) - { - m_inlineMask.CustomDrawer( ref owner, DrawColorMaskControls, ColorMaskContent.text ); - } - - private void DrawColorMaskControls( UndoParentNode owner ) - { - if( m_leftToggleColorMask == null || m_leftToggleColorMask.normal.background == null ) - { - m_leftToggleColorMask = GUI.skin.GetStyle( "miniButtonLeft" ); - } - - if( m_middleToggleColorMask == null || m_middleToggleColorMask.normal.background == null ) - { - m_middleToggleColorMask = GUI.skin.GetStyle( "miniButtonMid" ); - } - - if( m_rightToggleColorMask == null || m_rightToggleColorMask.normal.background == null ) - { - m_rightToggleColorMask = GUI.skin.GetStyle( "miniButtonRight" ); - } - - - EditorGUILayout.BeginHorizontal(); - EditorGUILayout.LabelField( ColorMaskContent, GUILayout.Width( 90 ) ); - - m_colorMask[ 0 ] = owner.GUILayoutToggle( m_colorMask[ 0 ], "R", m_leftToggleColorMask ); - m_colorMask[ 1 ] = owner.GUILayoutToggle( m_colorMask[ 1 ], "G", m_middleToggleColorMask ); - m_colorMask[ 2 ] = owner.GUILayoutToggle( m_colorMask[ 2 ], "B", m_middleToggleColorMask ); - m_colorMask[ 3 ] = owner.GUILayoutToggle( m_colorMask[ 3 ], "A", m_rightToggleColorMask ); - - EditorGUILayout.EndHorizontal(); - } - - public void BuildColorMask( ref string ShaderBody, bool customBlendAvailable ) - { - int count = 0; - string colorMask = string.Empty; - for( int i = 0; i < m_colorMask.Length; i++ ) - { - if( m_colorMask[ i ] ) - { - count++; - colorMask += m_colorMaskChar[ i ]; - } - } - - if( ( count != m_colorMask.Length && customBlendAvailable ) || m_inlineMask.Active ) - { - MasterNode.AddRenderState( ref ShaderBody, "ColorMask", m_inlineMask.GetValueOrProperty( ( ( count == 0 ) ? "0" : colorMask ) ) ); - } - } - - public void ReadFromString( ref uint index, ref string[] nodeParams ) - { - for( int i = 0; i < m_colorMask.Length; i++ ) - { - m_colorMask[ i ] = Convert.ToBoolean( nodeParams[ index++ ] ); - } - - if( UIUtils.CurrentShaderVersion() > 14501 ) - m_inlineMask.ReadFromString( ref index, ref nodeParams ); - } - - public void WriteToString( ref string nodeInfo ) - { - for( int i = 0; i < m_colorMask.Length; i++ ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_colorMask[ i ] ); - } - - m_inlineMask.WriteToString( ref nodeInfo ); - } - - public void Destroy() - { - m_leftToggleColorMask = null; - m_middleToggleColorMask = null; - m_rightToggleColorMask = null; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/ColorMaskHelper.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/ColorMaskHelper.cs.meta deleted file mode 100644 index 69c24b06..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/ColorMaskHelper.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: bf65efd881afd1b4cbd2b27f3f17251b -timeCreated: 1488903773 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/CustomTagsHelper.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/CustomTagsHelper.cs deleted file mode 100644 index 11a3ee49..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/CustomTagsHelper.cs +++ /dev/null @@ -1,436 +0,0 @@ -using System; -using UnityEngine; -using UnityEditor; -using System.Collections.Generic; - -namespace AmplifyShaderEditor -{ - [Serializable] - public class CustomTagData - { - private const string TagFormat = "\"{0}\"=\"{1}\""; - public string TagName; - public string TagValue; - public int TagId = -1; - public bool TagFoldout = true; - - [SerializeField] - private TemplateSpecialTags m_specialTag = TemplateSpecialTags.None; - [SerializeField] - private RenderType m_renderType = RenderType.Opaque; - [SerializeField] - private RenderQueue m_renderQueue = RenderQueue.Geometry; - [SerializeField] - private int m_renderQueueOffset = 0; - - public CustomTagData() - { - TagName = string.Empty; - TagValue = string.Empty; - m_specialTag = TemplateSpecialTags.None; - m_renderType = RenderType.Opaque; - m_renderQueue = RenderQueue.Geometry; - m_renderQueueOffset = 0; - } - - public CustomTagData( CustomTagData other ) - { - TagName = other.TagName; - TagValue = other.TagValue; - TagId = other.TagId; - TagFoldout = other.TagFoldout; - - m_specialTag = other.m_specialTag; - m_renderType = other.m_renderType; - m_renderQueue = other.m_renderQueue; - m_renderQueueOffset = other.m_renderQueueOffset; - } - - public void SetTagValue( params string[] value ) - { - TagValue = value[ 0 ]; - switch( m_specialTag ) - { - case TemplateSpecialTags.RenderType: - { - if( !TemplateHelperFunctions.StringToRenderType.TryGetValue( value[ 0 ], out m_renderType ) ) - { - m_renderType = RenderType.Custom; - TagValue = value[ 0 ]; - } - } - break; - case TemplateSpecialTags.Queue: - { - if( value.Length == 2 ) - { - m_renderQueue = TemplateHelperFunctions.StringToRenderQueue[ value[ 0 ] ]; - int.TryParse( value[ 1 ], out m_renderQueueOffset ); - } - else - { - int indexPlus = value[ 0 ].IndexOf( '+' ); - if( indexPlus > 0 ) - { - string[] args = value[ 0 ].Split( '+' ); - m_renderQueue = TemplateHelperFunctions.StringToRenderQueue[ args[ 0 ] ]; - int.TryParse( args[ 1 ], out m_renderQueueOffset ); - } - else - { - int indexMinus = value[ 0 ].IndexOf( '-' ); - if( indexMinus > 0 ) - { - string[] args = value[ 0 ].Split( '-' ); - m_renderQueue = TemplateHelperFunctions.StringToRenderQueue[ args[ 0 ] ]; - int.TryParse( args[ 1 ], out m_renderQueueOffset ); - m_renderQueueOffset *= -1; - } - else - { - m_renderQueue = TemplateHelperFunctions.StringToRenderQueue[ value[ 0 ] ]; - m_renderQueueOffset = 0; - } - } - } - BuildQueueTagValue(); - } - break; - - } - } - - void CheckSpecialTag() - { - if( TagName.Equals( Constants.RenderTypeHelperStr ) ) - { - m_specialTag = TemplateSpecialTags.RenderType; - if( !TemplateHelperFunctions.StringToRenderType.TryGetValue( TagValue, out m_renderType )) - { - m_renderType = RenderType.Custom; - } - } - else if( TagName.Equals( Constants.RenderQueueHelperStr ) ) - { - m_specialTag = TemplateSpecialTags.Queue; - SetTagValue( TagValue ); - } - else - { - m_specialTag = TemplateSpecialTags.None; - } - } - - public CustomTagData( string name, string value, int id ) - { - TagName = name; - TagValue = value; - TagId = id; - CheckSpecialTag(); - } - - //Used on Template based shaders loading - public CustomTagData( string data, int id ) - { - TagId = id; - string[] arr = data.Split( IOUtils.VALUE_SEPARATOR ); - if( arr.Length > 1 ) - { - TagName = arr[ 0 ]; - TagValue = arr[ 1 ]; - } - - if( arr.Length > 2 ) - { - m_specialTag = (TemplateSpecialTags)Enum.Parse( typeof( TemplateSpecialTags ), arr[ 2 ] ); - switch( m_specialTag ) - { - case TemplateSpecialTags.RenderType: - { - if( !TemplateHelperFunctions.StringToRenderType.TryGetValue( TagValue, out m_renderType ) ) - { - m_renderType = RenderType.Custom; - } - } - break; - case TemplateSpecialTags.Queue: - { - if( arr.Length == 4 ) - { - m_renderQueue = (RenderQueue)Enum.Parse( typeof( RenderQueue ), TagValue ); - int.TryParse( arr[ 3 ], out m_renderQueueOffset ); - } - BuildQueueTagValue(); - } - break; - } - } - else if( UIUtils.CurrentShaderVersion() < 15600 ) - { - CheckSpecialTag(); - } - } - - //Used on Standard Surface shaders loading - public CustomTagData( string data ) - { - string[] arr = data.Split( IOUtils.VALUE_SEPARATOR ); - if( arr.Length > 1 ) - { - TagName = arr[ 0 ]; - TagValue = arr[ 1 ]; - } - } - - public override string ToString() - { - switch( m_specialTag ) - { - case TemplateSpecialTags.RenderType: - return TagName + IOUtils.VALUE_SEPARATOR + - ( RenderType != RenderType.Custom? RenderType.ToString(): TagValue ) + IOUtils.VALUE_SEPARATOR + - m_specialTag; - case TemplateSpecialTags.Queue: - return TagName + IOUtils.VALUE_SEPARATOR + - m_renderQueue.ToString() + IOUtils.VALUE_SEPARATOR + - m_specialTag + IOUtils.VALUE_SEPARATOR + - m_renderQueueOffset; - } - - return TagName + IOUtils.VALUE_SEPARATOR + TagValue; - } - - public string GenerateTag() - { - switch( m_specialTag ) - { - case TemplateSpecialTags.RenderType: - return string.Format( TagFormat, TagName, ( RenderType != RenderType.Custom ? RenderType.ToString() : TagValue ) ); - case TemplateSpecialTags.Queue: - case TemplateSpecialTags.None: - default: - return string.Format( TagFormat, TagName, TagValue ); - } - } - - public void BuildQueueTagValue() - { - TagValue = m_renderQueue.ToString(); - if( m_renderQueueOffset > 0 ) - { - TagValue += "+" + m_renderQueueOffset; - } - else if( m_renderQueueOffset < 0 ) - { - TagValue += m_renderQueueOffset; - } - } - - public TemplateSpecialTags SpecialTag - { - get { return m_specialTag; } - set - { - m_specialTag = value; - switch( value ) - { - case TemplateSpecialTags.RenderType: - { - //if( m_renderType != RenderType.Custom ) - // TagValue = m_renderType.ToString(); - } - break; - case TemplateSpecialTags.Queue: - { - BuildQueueTagValue(); - } - break; - } - } - } - - public RenderType RenderType - { - get { return m_renderType; } - set - { - m_renderType = value; - //if( m_renderType != RenderType.Custom ) - // TagValue = value.ToString(); - } - } - - public RenderQueue RenderQueue - { - get { return m_renderQueue; } - set { m_renderQueue = value; } - } - public int RenderQueueOffset - { - get { return m_renderQueueOffset; } - set { m_renderQueueOffset = value; } - } - - public bool IsValid { get { return ( !string.IsNullOrEmpty( TagValue ) && !string.IsNullOrEmpty( TagName ) ); } } - } - - [Serializable] - public class CustomTagsHelper - { - private const string CustomTagsStr = " Custom SubShader Tags"; - private const string TagNameStr = "Name"; - private const string TagValueStr = "Value"; - - private const float ShaderKeywordButtonLayoutWidth = 15; - private ParentNode m_currentOwner; - - [SerializeField] - private List<CustomTagData> m_availableTags = new List<CustomTagData>(); - - public void Draw( ParentNode owner ) - { - m_currentOwner = owner; - bool value = owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedCustomTags; - NodeUtils.DrawPropertyGroup( ref value, CustomTagsStr, DrawMainBody, DrawButtons ); - owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedCustomTags = value; - } - - void DrawButtons() - { - EditorGUILayout.Separator(); - - // Add tag - if( GUILayout.Button( string.Empty, UIUtils.PlusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) - { - m_availableTags.Add( new CustomTagData() ); - EditorGUI.FocusTextInControl( null ); - } - - //Remove tag - if( GUILayout.Button( string.Empty, UIUtils.MinusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) - { - if( m_availableTags.Count > 0 ) - { - m_availableTags.RemoveAt( m_availableTags.Count - 1 ); - EditorGUI.FocusTextInControl( null ); - } - } - } - - void DrawMainBody() - { - EditorGUILayout.Separator(); - int itemCount = m_availableTags.Count; - - if( itemCount == 0 ) - { - EditorGUILayout.HelpBox( "Your list is Empty!\nUse the plus button to add one.", MessageType.Info ); - } - - int markedToDelete = -1; - float originalLabelWidth = EditorGUIUtility.labelWidth; - for( int i = 0; i < itemCount; i++ ) - { - m_availableTags[ i ].TagFoldout = m_currentOwner.EditorGUILayoutFoldout( m_availableTags[ i ].TagFoldout, string.Format( "[{0}] - {1}", i, m_availableTags[ i ].TagName ) ); - if( m_availableTags[ i ].TagFoldout ) - { - EditorGUI.indentLevel += 1; - EditorGUIUtility.labelWidth = 70; - //Tag Name - EditorGUI.BeginChangeCheck(); - m_availableTags[ i ].TagName = EditorGUILayout.TextField( TagNameStr, m_availableTags[ i ].TagName ); - if( EditorGUI.EndChangeCheck() ) - { - m_availableTags[ i ].TagName = UIUtils.RemoveShaderInvalidCharacters( m_availableTags[ i ].TagName ); - } - - //Tag Value - EditorGUI.BeginChangeCheck(); - m_availableTags[ i ].TagValue = EditorGUILayout.TextField( TagValueStr, m_availableTags[ i ].TagValue ); - if( EditorGUI.EndChangeCheck() ) - { - m_availableTags[ i ].TagValue = UIUtils.RemoveShaderInvalidCharacters( m_availableTags[ i ].TagValue ); - } - - EditorGUIUtility.labelWidth = originalLabelWidth; - - EditorGUILayout.BeginHorizontal(); - { - GUILayout.Label( " " ); - // Add new port - if( m_currentOwner.GUILayoutButton( string.Empty, UIUtils.PlusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) - { - m_availableTags.Insert( i + 1, new CustomTagData() ); - EditorGUI.FocusTextInControl( null ); - } - - //Remove port - if( m_currentOwner.GUILayoutButton( string.Empty, UIUtils.MinusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) - { - markedToDelete = i; - } - } - EditorGUILayout.EndHorizontal(); - - EditorGUI.indentLevel -= 1; - } - - } - if( markedToDelete > -1 ) - { - if( m_availableTags.Count > markedToDelete ) - { - m_availableTags.RemoveAt( markedToDelete ); - EditorGUI.FocusTextInControl( null ); - } - } - EditorGUILayout.Separator(); - } - - - public void ReadFromString( ref uint index, ref string[] nodeParams ) - { - int count = Convert.ToInt32( nodeParams[ index++ ] ); - for( int i = 0; i < count; i++ ) - { - m_availableTags.Add( new CustomTagData( nodeParams[ index++ ] ) ); - } - } - - public void WriteToString( ref string nodeInfo ) - { - int tagsCount = m_availableTags.Count; - IOUtils.AddFieldValueToString( ref nodeInfo, tagsCount ); - for( int i = 0; i < tagsCount; i++ ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_availableTags[ i ].ToString() ); - } - } - - public string GenerateCustomTags() - { - int tagsCount = m_availableTags.Count; - string result = tagsCount == 0 ? string.Empty : " "; - - for( int i = 0; i < tagsCount; i++ ) - { - if( m_availableTags[ i ].IsValid ) - { - result += m_availableTags[ i ].GenerateTag(); - if( i < tagsCount - 1 ) - { - result += " "; - } - } - } - return result; - } - - public void Destroy() - { - m_availableTags.Clear(); - m_availableTags = null; - m_currentOwner = null; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/CustomTagsHelper.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/CustomTagsHelper.cs.meta deleted file mode 100644 index de6b426c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/CustomTagsHelper.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 5ed32be99aefda24483c9e3499a5cd23 -timeCreated: 1500400244 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/DependenciesHelper.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/DependenciesHelper.cs deleted file mode 100644 index 915f173c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/DependenciesHelper.cs +++ /dev/null @@ -1,210 +0,0 @@ -using System; -using UnityEngine; -using UnityEditor; -using System.Collections.Generic; - -namespace AmplifyShaderEditor -{ - [Serializable] - public class DependenciesData - { - private string DependencyFormat = "Dependency \"{0}\"=\"{1}\"\n"; - public string DependencyName; - public string DependencyValue; - public bool DependencyFoldout = true; - - public DependenciesData() - { - DependencyName = string.Empty; - DependencyValue = string.Empty; - } - - public DependenciesData( string data ) - { - string[] arr = data.Split( IOUtils.VALUE_SEPARATOR ); - if( arr.Length > 1 ) - { - DependencyName = arr[ 0 ]; - DependencyValue = arr[ 1 ]; - } - } - - public override string ToString() - { - return DependencyName + IOUtils.VALUE_SEPARATOR + DependencyValue; - } - - public string GenerateDependency() - { - return string.Format( DependencyFormat, DependencyName, DependencyValue ); - } - - public bool IsValid { get { return ( !string.IsNullOrEmpty( DependencyValue ) && !string.IsNullOrEmpty( DependencyName ) ); } } - } - - [Serializable] - public class DependenciesHelper - { - private const string CustomDependencysStr = " Dependencies"; - private const string DependencyNameStr = "Name"; - private const string DependencyValueStr = "Value"; - - private const float ShaderKeywordButtonLayoutWidth = 15; - private ParentNode m_currentOwner; - - [SerializeField] - private List<DependenciesData> m_availableDependencies = new List<DependenciesData>(); - - public void Draw( ParentNode owner, bool isNested = false ) - { - m_currentOwner = owner; - bool value = owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedDependencies; - if( isNested ) - { - NodeUtils.DrawNestedPropertyGroup( ref value, CustomDependencysStr, DrawMainBody, DrawButtons ); - } - else - { - NodeUtils.DrawPropertyGroup( ref value, CustomDependencysStr, DrawMainBody, DrawButtons ); - } - owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedDependencies = value; - } - - void DrawButtons() - { - EditorGUILayout.Separator(); - - // Add Dependency - if( GUILayout.Button( string.Empty, UIUtils.PlusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) - { - m_availableDependencies.Add( new DependenciesData() ); - EditorGUI.FocusTextInControl( null ); - } - - //Remove Dependency - if( GUILayout.Button( string.Empty, UIUtils.MinusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) - { - if( m_availableDependencies.Count > 0 ) - { - m_availableDependencies.RemoveAt( m_availableDependencies.Count - 1 ); - EditorGUI.FocusTextInControl( null ); - } - } - } - - void DrawMainBody() - { - EditorGUILayout.Separator(); - int itemCount = m_availableDependencies.Count; - - if( itemCount == 0 ) - { - EditorGUILayout.HelpBox( "Your list is Empty!\nUse the plus button to add one.", MessageType.Info ); - } - - int markedToDelete = -1; - float originalLabelWidth = EditorGUIUtility.labelWidth; - for( int i = 0; i < itemCount; i++ ) - { - m_availableDependencies[ i ].DependencyFoldout = m_currentOwner.EditorGUILayoutFoldout( m_availableDependencies[ i ].DependencyFoldout, string.Format( "[{0}] - {1}", i, m_availableDependencies[ i ].DependencyName ) ); - if( m_availableDependencies[ i ].DependencyFoldout ) - { - EditorGUI.indentLevel += 1; - EditorGUIUtility.labelWidth = 70; - //Dependency Name - EditorGUI.BeginChangeCheck(); - m_availableDependencies[ i ].DependencyName = EditorGUILayout.TextField( DependencyNameStr, m_availableDependencies[ i ].DependencyName ); - if( EditorGUI.EndChangeCheck() ) - { - m_availableDependencies[ i ].DependencyName = UIUtils.RemoveShaderInvalidCharacters( m_availableDependencies[ i ].DependencyName ); - } - - //Dependency Value - EditorGUI.BeginChangeCheck(); - m_availableDependencies[ i ].DependencyValue = EditorGUILayout.TextField( DependencyValueStr, m_availableDependencies[ i ].DependencyValue ); - if( EditorGUI.EndChangeCheck() ) - { - m_availableDependencies[ i ].DependencyValue = UIUtils.RemoveShaderInvalidCharacters( m_availableDependencies[ i ].DependencyValue ); - } - - EditorGUIUtility.labelWidth = originalLabelWidth; - - EditorGUILayout.BeginHorizontal(); - { - GUILayout.Label( " " ); - // Add new port - if( m_currentOwner.GUILayoutButton( string.Empty, UIUtils.PlusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) - { - m_availableDependencies.Insert( i + 1, new DependenciesData() ); - EditorGUI.FocusTextInControl( null ); - } - - //Remove port - if( m_currentOwner.GUILayoutButton( string.Empty, UIUtils.MinusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) - { - markedToDelete = i; - } - } - EditorGUILayout.EndHorizontal(); - - EditorGUI.indentLevel -= 1; - } - - } - if( markedToDelete > -1 ) - { - if( m_availableDependencies.Count > markedToDelete ) - { - m_availableDependencies.RemoveAt( markedToDelete ); - EditorGUI.FocusTextInControl( null ); - } - } - EditorGUILayout.Separator(); - } - - - public void ReadFromString( ref uint index, ref string[] nodeParams ) - { - int count = Convert.ToInt32( nodeParams[ index++ ] ); - for( int i = 0; i < count; i++ ) - { - m_availableDependencies.Add( new DependenciesData( nodeParams[ index++ ] ) ); - } - } - - public void WriteToString( ref string nodeInfo ) - { - int dependencyCount = m_availableDependencies.Count; - IOUtils.AddFieldValueToString( ref nodeInfo, dependencyCount ); - for( int i = 0; i < dependencyCount; i++ ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_availableDependencies[ i ].ToString() ); - } - } - - public string GenerateDependencies() - { - int dependencyCount = m_availableDependencies.Count; - string result = dependencyCount == 0 ? string.Empty : "\n"; - UIUtils.ShaderIndentLevel++; - for( int i = 0; i < dependencyCount; i++ ) - { - if( m_availableDependencies[ i ].IsValid ) - { - result += UIUtils.ShaderIndentTabs + m_availableDependencies[ i ].GenerateDependency(); - } - } - UIUtils.ShaderIndentLevel--; - return result; - } - - public void Destroy() - { - m_availableDependencies.Clear(); - m_availableDependencies = null; - m_currentOwner = null; - } - - public bool HasDependencies { get { return m_availableDependencies.Count > 0; } } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/DependenciesHelper.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/DependenciesHelper.cs.meta deleted file mode 100644 index 92e4d819..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/DependenciesHelper.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 2daff2983fe91ac43953017a8be984a7 -timeCreated: 1512404972 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FallbackPickerHelper.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FallbackPickerHelper.cs deleted file mode 100644 index 6d006a96..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FallbackPickerHelper.cs +++ /dev/null @@ -1,119 +0,0 @@ -using System; -using UnityEngine; -using UnityEditor; - -namespace AmplifyShaderEditor -{ - [Serializable] - public class FallbackPickerHelper : ScriptableObject - { - private const string FallbackFormat = "Fallback \"{0}\""; - private const string FallbackShaderStr = "Fallback"; - private const string ShaderPoputContext = "CONTEXT/ShaderPopup"; - - private Material m_dummyMaterial; - private MenuCommand m_dummyCommand; - - [SerializeField] - private string m_fallbackShader = string.Empty; - - public void Init() - { - hideFlags = HideFlags.HideAndDontSave; - m_dummyMaterial = null; - m_dummyCommand = null; - } - - public void Draw( ParentNode owner ) - { - EditorGUILayout.BeginHorizontal(); - m_fallbackShader = owner.EditorGUILayoutTextField( FallbackShaderStr, m_fallbackShader ); - if ( GUILayout.Button( string.Empty, UIUtils.InspectorPopdropdownFallback, GUILayout.Width( 17 ), GUILayout.Height( 19 ) ) ) - { - EditorGUI.FocusTextInControl( null ); - GUI.FocusControl( null ); - DisplayShaderContext( owner, GUILayoutUtility.GetRect( GUIContent.none, EditorStyles.popup ) ); - } - EditorGUILayout.EndHorizontal(); - } - - private void DisplayShaderContext( ParentNode node, Rect r ) - { - if ( m_dummyCommand == null ) - m_dummyCommand = new MenuCommand( this, 0 ); - - if ( m_dummyMaterial == null ) - m_dummyMaterial = new Material( Shader.Find( "Hidden/ASESShaderSelectorUnlit" ) ); - -#pragma warning disable 0618 - UnityEditorInternal.InternalEditorUtility.SetupShaderMenu( m_dummyMaterial ); -#pragma warning restore 0618 - EditorUtility.DisplayPopupMenu( r, ShaderPoputContext, m_dummyCommand ); - } - - private void OnSelectedShaderPopup( string command, Shader shader ) - { - if ( shader != null ) - { - UIUtils.MarkUndoAction(); - Undo.RecordObject( this, "Selected fallback shader" ); - m_fallbackShader = shader.name; - } - } - - public void ReadFromString( ref uint index, ref string[] nodeParams ) - { - m_fallbackShader = nodeParams[ index++ ]; - } - - public void WriteToString( ref string nodeInfo ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_fallbackShader ); - } - - public void Destroy() - { - GameObject.DestroyImmediate( m_dummyMaterial ); - m_dummyMaterial = null; - m_dummyCommand = null; - } - - public string TabbedFallbackShader - { - get - { - if( string.IsNullOrEmpty( m_fallbackShader ) ) - return string.Empty; - - return "\t" + string.Format( FallbackFormat, m_fallbackShader ) + "\n"; - } - } - - public string FallbackShader - { - get - { - if( string.IsNullOrEmpty( m_fallbackShader ) ) - return string.Empty; - - return string.Format( FallbackFormat, m_fallbackShader ); - } - } - - public string RawFallbackShader - { - get - { - return m_fallbackShader; - } - set - { - m_fallbackShader = value; - } - } - - - public bool Active { get { return !string.IsNullOrEmpty( m_fallbackShader ); } } - - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FallbackPickerHelper.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FallbackPickerHelper.cs.meta deleted file mode 100644 index 2336aa83..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FallbackPickerHelper.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: cd5a03cee1255ba438e2062d215b70b6 -timeCreated: 1490378537 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionInput.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionInput.cs deleted file mode 100644 index a253a5a8..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionInput.cs +++ /dev/null @@ -1,523 +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.Collections.Generic; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Function Input", "Functions", "Function Input adds an input port to the shader function", NodeAvailabilityFlags = (int)NodeAvailability.ShaderFunction )] - public sealed class FunctionInput : ParentNode - { - private const string InputTypeStr = "Input Type"; - private readonly string[] m_inputValueTypes ={ "Int", - "Float", - "Vector2", - "Vector3", - "Vector4", - "Color", - "Matrix 3x3", - "Matrix 4x4", - "Sampler 1D", - "Sampler 2D", - "Sampler 3D", - "Sampler Cube"}; - - [SerializeField] - private int m_selectedInputTypeInt = 1; - - private WirePortDataType m_selectedInputType = WirePortDataType.FLOAT; - - [SerializeField] - private FunctionNode m_functionNode; - - [SerializeField] - private string m_inputName = "Input"; - - [SerializeField] - private bool m_autoCast = false; - - [SerializeField] - private int m_orderIndex = -1; - - private int m_typeId = -1; - - public bool m_ignoreConnection = false; - - public delegate string PortGeneration( ref MasterNodeDataCollector dataCollector, int index, ParentGraph graph ); - public PortGeneration OnPortGeneration = null; - - //Title editing - [SerializeField] - private string m_uniqueName; - - private bool m_isEditing; - private bool m_stopEditing; - private bool m_startEditing; - private double m_clickTime; - private double m_doubleClickTime = 0.3; - private Rect m_titleClickArea; - private bool m_showTitleWhenNotEditing = true; - - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT, false, Constants.EmptyPortValue ); - m_inputPorts[ 0 ].AutoDrawInternalData = true; - //m_inputPorts[ 0 ].Visible = false; - AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); - m_autoWrapProperties = true; - m_textLabelWidth = 100; - SetTitleText( m_inputName ); - UpdatePorts(); - SetAdditonalTitleText( "( " + m_inputValueTypes[ m_selectedInputTypeInt ] + " )" ); - m_previewShaderGUID = "04bc8e7b317dccb4d8da601680dd8140"; - } - - public override void SetPreviewInputs() - { - if( Fnode == null ) - { - m_ignoreConnection = false; - CheckSpherePreview(); - } - else - { - var input = Fnode.GetInput( this ); - if( input != null && ( !InputPorts[ 0 ].IsConnected || input.IsConnected ) ) - { - m_ignoreConnection = true; - InputPorts[ 0 ].PreparePortCacheID(); - Fnode.SetPreviewInput( input ); - if( input.ExternalReferences.Count > 0 ) - { - SpherePreview = Fnode.ContainerGraph.GetNode( input.ExternalReferences[ 0 ].NodeId ).SpherePreview; - } - else - { - SpherePreview = false; - } - PreviewMaterial.SetTexture( InputPorts[ 0 ].CachedPropertyId, input.InputPreviewTexture( Fnode.ContainerGraph ) ); - } - else - { - m_ignoreConnection = false; - CheckSpherePreview(); - } - } - - if( !m_ignoreConnection ) - base.SetPreviewInputs(); - - for( int i = 0; i < OutputPorts[ 0 ].ExternalReferences.Count; i++ ) - { - ContainerGraph.GetNode( OutputPorts[ 0 ].ExternalReferences[ i ].NodeId ).OnNodeChange(); - } - - if( m_typeId == -1 ) - m_typeId = Shader.PropertyToID( "_Type" ); - - if( m_inputPorts[ 0 ].DataType == WirePortDataType.FLOAT || m_inputPorts[ 0 ].DataType == WirePortDataType.INT ) - PreviewMaterial.SetInt( m_typeId, 1 ); - else if( m_inputPorts[ 0 ].DataType == WirePortDataType.FLOAT2 ) - PreviewMaterial.SetInt( m_typeId, 2 ); - else if( m_inputPorts[ 0 ].DataType == WirePortDataType.FLOAT3 ) - PreviewMaterial.SetInt( m_typeId, 3 ); - else - PreviewMaterial.SetInt( m_typeId, 0 ); - - } - - public override bool RecursivePreviewUpdate( Dictionary<string, bool> duplicatesDict = null ) - { - if( duplicatesDict == null ) - { - duplicatesDict = ContainerGraph.ParentWindow.VisitedChanged; - } - - for( int i = 0; i < InputPorts.Count; i++ ) - { - ParentNode outNode = null; - if( Fnode != null ) - { - var input = Fnode.GetInput( this ); - if( input.ExternalReferences.Count > 0 ) - { - outNode = Fnode.ContainerGraph.GetNode( input.ExternalReferences[ 0 ].NodeId ); - } - else if( InputPorts[ i ].ExternalReferences.Count > 0 ) - { - outNode = ContainerGraph.GetNode( InputPorts[ i ].ExternalReferences[ 0 ].NodeId ); - } - } - else - { - if( InputPorts[ i ].ExternalReferences.Count > 0 ) - { - outNode = ContainerGraph.GetNode( InputPorts[ i ].ExternalReferences[ 0 ].NodeId ); - } - } - if( outNode != null ) - { - if( !duplicatesDict.ContainsKey( outNode.OutputId ) ) - { - bool result = outNode.RecursivePreviewUpdate(); - if( result ) - PreviewIsDirty = true; - } - else if( duplicatesDict[ outNode.OutputId ] ) - { - PreviewIsDirty = true; - } - } - } - - bool needsUpdate = PreviewIsDirty; - RenderNodePreview(); - if( !duplicatesDict.ContainsKey( OutputId ) ) - duplicatesDict.Add( OutputId, needsUpdate ); - return needsUpdate; - } - - protected override void OnUniqueIDAssigned() - { - base.OnUniqueIDAssigned(); - UIUtils.RegisterFunctionInputNode( this ); - if( m_nodeAttribs != null ) - m_uniqueName = m_nodeAttribs.Name + UniqueId; - } - - public override void Destroy() - { - base.Destroy(); - OnPortGeneration = null; - UIUtils.UnregisterFunctionInputNode( this ); - } - - public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) - { - base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); - if( AutoCast ) - { - m_inputPorts[ 0 ].MatchPortToConnection(); - SetIntTypeFromPort(); - UpdatePorts(); - SetAdditonalTitleText( "( " + m_inputValueTypes[ m_selectedInputTypeInt ] + " )" ); - } - } - - public override void OnConnectedOutputNodeChanges( int portId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) - { - base.OnConnectedOutputNodeChanges( portId, otherNodeId, otherPortId, name, type ); - if( AutoCast ) - { - m_inputPorts[ 0 ].MatchPortToConnection(); - SetIntTypeFromPort(); - UpdatePorts(); - SetAdditonalTitleText( "( " + m_inputValueTypes[ m_selectedInputTypeInt ] + " )" ); - } - } - - public void SetIntTypeFromPort() - { - switch( m_inputPorts[ 0 ].DataType ) - { - case WirePortDataType.INT: m_selectedInputTypeInt = 0; break; - default: - case WirePortDataType.FLOAT: m_selectedInputTypeInt = 1; break; - case WirePortDataType.FLOAT2: m_selectedInputTypeInt = 2; break; - case WirePortDataType.FLOAT3: m_selectedInputTypeInt = 3; break; - case WirePortDataType.FLOAT4: m_selectedInputTypeInt = 4; break; - case WirePortDataType.COLOR: m_selectedInputTypeInt = 5; break; - case WirePortDataType.FLOAT3x3: m_selectedInputTypeInt = 6; break; - case WirePortDataType.FLOAT4x4: m_selectedInputTypeInt = 7; break; - case WirePortDataType.SAMPLER1D: m_selectedInputTypeInt = 8; break; - case WirePortDataType.SAMPLER2D: m_selectedInputTypeInt = 9; break; - case WirePortDataType.SAMPLER3D: m_selectedInputTypeInt = 10; break; - case WirePortDataType.SAMPLERCUBE: m_selectedInputTypeInt = 11; break; - } - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - // Custom Editable Title - if( ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD3 ) - { - if( !m_isEditing && ( ( !ContainerGraph.ParentWindow.MouseInteracted && drawInfo.CurrentEventType == EventType.MouseDown && m_titleClickArea.Contains( drawInfo.MousePosition ) ) ) ) - { - if( ( EditorApplication.timeSinceStartup - m_clickTime ) < m_doubleClickTime ) - m_startEditing = true; - else - GUI.FocusControl( null ); - m_clickTime = EditorApplication.timeSinceStartup; - } - else if( m_isEditing && ( ( drawInfo.CurrentEventType == EventType.MouseDown && !m_titleClickArea.Contains( drawInfo.MousePosition ) ) || !EditorGUIUtility.editingTextField ) ) - { - m_stopEditing = true; - } - - if( m_isEditing || m_startEditing ) - { - EditorGUI.BeginChangeCheck(); - GUI.SetNextControlName( m_uniqueName ); - m_inputName = EditorGUITextField( m_titleClickArea, string.Empty, m_inputName, UIUtils.GetCustomStyle( CustomStyle.NodeTitle ) ); - if( EditorGUI.EndChangeCheck() ) - { - SetTitleText( m_inputName ); - UIUtils.UpdateFunctionInputData( UniqueId, m_inputName ); - } - - if( m_startEditing ) - EditorGUI.FocusTextInControl( m_uniqueName ); - - } - - if( drawInfo.CurrentEventType == EventType.Repaint ) - { - if( m_startEditing ) - { - m_startEditing = false; - m_isEditing = true; - } - - if( m_stopEditing ) - { - m_stopEditing = false; - m_isEditing = false; - GUI.FocusControl( null ); - } - } - - - } - } - - public override void OnNodeLayout( DrawInfo drawInfo ) - { - // RUN LAYOUT CHANGES AFTER TITLES CHANGE - base.OnNodeLayout( drawInfo ); - m_titleClickArea = m_titlePos; - m_titleClickArea.height = Constants.NODE_HEADER_HEIGHT; - } - - public override void OnNodeRepaint( DrawInfo drawInfo ) - { - base.OnNodeRepaint( drawInfo ); - - if( !m_isVisible ) - return; - - // Fixed Title ( only renders when not editing ) - if( m_showTitleWhenNotEditing && !m_isEditing && !m_startEditing && ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD3 ) - { - GUI.Label( m_titleClickArea, m_content, UIUtils.GetCustomStyle( CustomStyle.NodeTitle ) ); - } - } - - public override void OnNodeDoubleClicked( Vector2 currentMousePos2D ) - { - if( currentMousePos2D.y - m_globalPosition.y > ( Constants.NODE_HEADER_HEIGHT + Constants.NODE_HEADER_EXTRA_HEIGHT ) * ContainerGraph.ParentWindow.CameraDrawInfo.InvertedZoom ) - { - ContainerGraph.ParentWindow.ParametersWindow.IsMaximized = !ContainerGraph.ParentWindow.ParametersWindow.IsMaximized; - } - } - - public override void DrawProperties() - { - base.DrawProperties(); - EditorGUILayout.BeginVertical(); - EditorGUI.BeginChangeCheck(); - m_inputName = EditorGUILayoutTextField( "Name", m_inputName ); - if( EditorGUI.EndChangeCheck() ) - { - SetTitleText( m_inputName ); - UIUtils.UpdateFunctionInputData( UniqueId, m_inputName ); - } - EditorGUI.BeginChangeCheck(); - m_selectedInputTypeInt = EditorGUILayoutPopup( InputTypeStr, m_selectedInputTypeInt, m_inputValueTypes ); - if( EditorGUI.EndChangeCheck() ) - { - UpdatePorts(); - SetAdditonalTitleText( "( " + m_inputValueTypes[ m_selectedInputTypeInt ] + " )" ); - } - - m_autoCast = EditorGUILayoutToggle( "Auto Cast", m_autoCast ); - - EditorGUILayout.Separator(); - if( !m_inputPorts[ 0 ].IsConnected && m_inputPorts[ 0 ].ValidInternalData ) - { - m_inputPorts[ 0 ].ShowInternalData( this, true, "Default Value" ); - } - - - EditorGUILayout.EndVertical(); - } - - void UpdatePorts() - { - //switch( m_inputPorts[ 0 ].DataType ) - //{ - // case WirePortDataType.INT: m_selectedInputTypeInt = 0; break; - // default: - // case WirePortDataType.FLOAT: m_selectedInputTypeInt = 1; break; - // case WirePortDataType.FLOAT2: m_selectedInputTypeInt = 2; break; - // case WirePortDataType.FLOAT3: m_selectedInputTypeInt = 3; break; - - // //case 2: m_selectedInputType = WirePortDataType.FLOAT2; break; - // //case 3: m_selectedInputType = WirePortDataType.FLOAT3; break; - // //case 4: m_selectedInputType = WirePortDataType.FLOAT4; break; - // //case 5: m_selectedInputType = WirePortDataType.COLOR; break; - // //case 6: m_selectedInputType = WirePortDataType.FLOAT3x3; break; - // //case 7: m_selectedInputType = WirePortDataType.FLOAT4x4; break; - // //case 8: m_selectedInputType = WirePortDataType.SAMPLER1D; break; - // //case 9: m_selectedInputType = WirePortDataType.SAMPLER2D; break; - // //case 10: m_selectedInputType = WirePortDataType.SAMPLER3D; break; - // //case 11: m_selectedInputType = WirePortDataType.SAMPLERCUBE; break; - //} - - switch( m_selectedInputTypeInt ) - { - case 0: m_selectedInputType = WirePortDataType.INT; break; - default: - case 1: m_selectedInputType = WirePortDataType.FLOAT; break; - case 2: m_selectedInputType = WirePortDataType.FLOAT2; break; - case 3: m_selectedInputType = WirePortDataType.FLOAT3; break; - case 4: m_selectedInputType = WirePortDataType.FLOAT4; break; - case 5: m_selectedInputType = WirePortDataType.COLOR; break; - case 6: m_selectedInputType = WirePortDataType.FLOAT3x3; break; - case 7: m_selectedInputType = WirePortDataType.FLOAT4x4; break; - case 8: m_selectedInputType = WirePortDataType.SAMPLER1D; break; - case 9: m_selectedInputType = WirePortDataType.SAMPLER2D; break; - case 10: m_selectedInputType = WirePortDataType.SAMPLER3D; break; - case 11: m_selectedInputType = WirePortDataType.SAMPLERCUBE; break; - } - - ChangeInputType( m_selectedInputType, false ); - - //This node doesn't have any restrictions but changing types should be restricted to prevent invalid connections - m_outputPorts[ 0 ].ChangeTypeWithRestrictions( m_selectedInputType, PortCreateRestriction( m_selectedInputType ) ); - m_sizeIsDirty = true; - } - - public int PortCreateRestriction( WirePortDataType dataType ) - { - int restrictions = 0; - WirePortDataType[] types = null; - switch( dataType ) - { - case WirePortDataType.OBJECT: - break; - case WirePortDataType.FLOAT: - case WirePortDataType.FLOAT2: - case WirePortDataType.FLOAT3: - case WirePortDataType.FLOAT4: - case WirePortDataType.COLOR: - case WirePortDataType.INT: - { - types = new WirePortDataType[] { WirePortDataType.FLOAT, WirePortDataType.FLOAT2, WirePortDataType.FLOAT3, WirePortDataType.FLOAT4, WirePortDataType.COLOR, WirePortDataType.INT, WirePortDataType.OBJECT }; - } - break; - case WirePortDataType.FLOAT3x3: - case WirePortDataType.FLOAT4x4: - { - types = new WirePortDataType[] { WirePortDataType.FLOAT3x3, WirePortDataType.FLOAT4x4, WirePortDataType.OBJECT }; - } - break; - case WirePortDataType.SAMPLER1D: - case WirePortDataType.SAMPLER2D: - case WirePortDataType.SAMPLER3D: - case WirePortDataType.SAMPLERCUBE: - { - types = new WirePortDataType[] { WirePortDataType.SAMPLER1D, WirePortDataType.SAMPLER2D, WirePortDataType.SAMPLER3D, WirePortDataType.SAMPLERCUBE, WirePortDataType.OBJECT }; - } - break; - default: - break; - } - - if( types != null ) - { - for( int i = 0; i < types.Length; i++ ) - { - restrictions = restrictions | (int)types[ i ]; - } - } - - return restrictions; - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if( m_outputPorts[ outputId ].IsLocalValue( dataCollector.PortCategory ) ) - return m_outputPorts[ outputId ].LocalValue( dataCollector.PortCategory ); - - string result = string.Empty; - if( OnPortGeneration != null ) - result = OnPortGeneration( ref dataCollector, m_orderIndex, ContainerGraph.ParentWindow.CustomGraph ); - else - result = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - - if( m_outputPorts[ outputId ].ConnectionCount > 1 ) - RegisterLocalVariable( outputId, result, ref dataCollector ); - else - m_outputPorts[ outputId ].SetLocalValue( result, dataCollector.PortCategory ); - - return m_outputPorts[ outputId ].LocalValue( dataCollector.PortCategory ); - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_inputName ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_selectedInputTypeInt ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_orderIndex ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_autoCast ); - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - m_inputName = GetCurrentParam( ref nodeParams ); - m_selectedInputTypeInt = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - m_orderIndex = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - m_autoCast = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - - SetTitleText( m_inputName ); - UpdatePorts(); - SetAdditonalTitleText( "( " + m_inputValueTypes[ m_selectedInputTypeInt ] + " )" ); - } - - public WirePortDataType SelectedInputType - { - get { return m_selectedInputType; } - } - - public string InputName - { - get { return m_inputName; } - } - - public int OrderIndex - { - get { return m_orderIndex; } - set { m_orderIndex = value; } - } - - public bool AutoCast - { - get { return m_autoCast; } - set { m_autoCast = value; } - } - - public FunctionNode Fnode - { - get { return m_functionNode; } - set { m_functionNode = value; } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionInput.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionInput.cs.meta deleted file mode 100644 index c5aa5505..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionInput.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 64064ea01705e084cbe00a3bbeef2c3d -timeCreated: 1491927259 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionNode.cs deleted file mode 100644 index de297c2e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionNode.cs +++ /dev/null @@ -1,1236 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -//#define ADD_SHADER_FUNCTION_HEADERS - -using UnityEngine; -using UnityEditor; -using System.Collections.Generic; -using System; -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Function Node", "Functions", "Function Node", KeyCode.None, false, 0, int.MaxValue, typeof( AmplifyShaderFunction ) )] - public class FunctionNode : ParentNode - { - [SerializeField] - private AmplifyShaderFunction m_function; - - [SerializeField] - private ParentGraph m_functionGraph; - - [SerializeField] - private int m_functionGraphId = -1; - - [SerializeField] - private List<FunctionInput> m_allFunctionInputs; - private Dictionary<int, FunctionInput> m_allFunctionInputsDict = new Dictionary<int, FunctionInput>(); - - [SerializeField] - private List<FunctionOutput> m_allFunctionOutputs; - private Dictionary<int, FunctionOutput> m_allFunctionOutputsDict = new Dictionary<int, FunctionOutput>(); - - [SerializeField] - private List<FunctionSwitch> m_allFunctionSwitches; - private Dictionary<int, FunctionSwitch> m_allFunctionSwitchesDict = new Dictionary<int, FunctionSwitch>(); - - [SerializeField] - private ReordenatorNode m_reordenator; - - [SerializeField] - private string m_filename; - - [SerializeField] - private string m_headerTitle = string.Empty; - - [SerializeField] - private int m_orderIndex; - - [SerializeField] - private string m_functionCheckSum; - - [SerializeField] - private string m_functionGUID = string.Empty; - - //[SerializeField] - //private List<string> m_includes = new List<string>(); - - //[SerializeField] - //private List<string> m_pragmas = new List<string>(); - - [SerializeField] - private List<AdditionalDirectiveContainer> m_directives = new List<AdditionalDirectiveContainer>(); - - private bool m_parametersFoldout = true; - [SerializeField] - private ParentGraph m_outsideGraph = null; - - [SerializeField] - private FunctionOutput m_mainPreviewNode; - - bool m_portsChanged = false; - //[SerializeField] - bool m_initialGraphDraw = false; - - private bool m_refreshIdsRequired = false; - - public string[] ReadOptionsHelper = new string[] { }; - - private bool m_lateRefresh = false; - - private Dictionary<int, bool> m_duplicatesBuffer = new Dictionary<int, bool>(); - string LastLine( string text ) - { - string[] lines = text.Replace( "\r", "" ).Split( '\n' ); - return lines[ lines.Length - 1 ]; - } - - public void CommonInit( AmplifyShaderFunction function, int uniqueId ) - { - SetBaseUniqueId( uniqueId ); - - if( function == null ) - return; - - m_refreshIdsRequired = UIUtils.IsLoading && ( UIUtils.CurrentShaderVersion() < 14004 ); - - m_function = function; - - if( Function.FunctionName.Length > 1 ) - { - SetTitleText( GraphContextMenu.AddSpacesToSentence( Function.FunctionName ) ); - } - else - { - SetTitleText( Function.FunctionName ); - } - m_tooltipText = Function.Description; - m_hasTooltipLink = false; - if( m_functionGraph == null ) - { - //m_functionGraph = new ParentGraph(); - m_functionGraph = CreateInstance<ParentGraph>(); - m_functionGraph.Init(); - m_functionGraph.ParentWindow = ContainerGraph.ParentWindow; - } - - if( string.IsNullOrEmpty( m_functionGUID ) ) - { - m_functionGUID = AssetDatabase.AssetPathToGUID( AssetDatabase.GetAssetPath( m_function ) ); - } - - m_functionGraphId = Mathf.Max( m_functionGraphId, ContainerGraph.ParentWindow.GraphCount ); - ContainerGraph.ParentWindow.GraphCount = m_functionGraphId + 1; - m_functionGraph.SetGraphId( m_functionGraphId ); - - ParentGraph cachedGraph = ContainerGraph.ParentWindow.CustomGraph; - ContainerGraph.ParentWindow.CustomGraph = m_functionGraph; - - AmplifyShaderEditorWindow.LoadFromMeta( ref m_functionGraph, ContainerGraph.ParentWindow.ContextMenuInstance, Function.FunctionInfo ); - //m_functionCheckSum = LastLine( m_function.FunctionInfo ); - m_functionCheckSum = AssetDatabase.GetAssetDependencyHash( AssetDatabase.GetAssetPath( m_function ) ).ToString(); - List<PropertyNode> propertyList = UIUtils.PropertyNodesList(); - m_allFunctionInputs = UIUtils.FunctionInputList(); - m_allFunctionOutputs = UIUtils.FunctionOutputList(); - m_allFunctionSwitches = UIUtils.FunctionSwitchList(); - - ContainerGraph.ParentWindow.CustomGraph = cachedGraph; - - m_allFunctionInputs.Sort( ( x, y ) => { return x.OrderIndex.CompareTo( y.OrderIndex ); } ); - m_allFunctionOutputs.Sort( ( x, y ) => { return x.OrderIndex.CompareTo( y.OrderIndex ); } ); - m_allFunctionSwitches.Sort( ( x, y ) => { return x.OrderIndex.CompareTo( y.OrderIndex ); } ); - - int inputCount = m_allFunctionInputs.Count; - for( int i = 0; i < inputCount; i++ ) - { - if( m_refreshIdsRequired ) - { - AddInputPort( m_allFunctionInputs[ i ].SelectedInputType, false, m_allFunctionInputs[ i ].InputName ); - } - else - { - AddInputPort( m_allFunctionInputs[ i ].SelectedInputType, false, m_allFunctionInputs[ i ].InputName, -1, MasterNodePortCategory.Fragment, m_allFunctionInputs[ i ].UniqueId ); - } - InputPortSwitchRestriction( m_inputPorts[ i ] ); - - if( !m_allFunctionInputs[ i ].InputPorts[ 0 ].IsConnected ) - { - m_inputPorts[ i ].AutoDrawInternalData = true; - m_inputPorts[ i ].InternalData = m_allFunctionInputs[ i ].InputPorts[ 0 ].InternalData; - } - m_allFunctionInputs[ i ].Fnode = this; - } - - int outputCount = m_allFunctionOutputs.Count; - FunctionOutput first = null; - for( int i = 0; i < outputCount; i++ ) - { - if( i == 0 ) - first = m_allFunctionOutputs[ i ]; - - if( m_allFunctionOutputs[ i ].PreviewNode ) - { - m_mainPreviewNode = m_allFunctionOutputs[ i ]; - } - - if( m_refreshIdsRequired ) - { - AddOutputPort( m_allFunctionOutputs[ i ].AutoOutputType, m_allFunctionOutputs[ i ].OutputName ); - } - else - { - AddOutputPort( m_allFunctionOutputs[ i ].AutoOutputType, m_allFunctionOutputs[ i ].OutputName, m_allFunctionOutputs[ i ].UniqueId ); - } - OutputPortSwitchRestriction( m_outputPorts[ i ] ); - } - - // make sure to hide the ports properly - CheckPortVisibility(); - - if( m_mainPreviewNode == null ) - m_mainPreviewNode = first; - - //create reordenator to main graph - bool inside = false; - if( ContainerGraph.ParentWindow.CustomGraph != null ) - inside = true; - - if( /*hasConnectedProperties*/propertyList.Count > 0 ) - { - m_reordenator = ScriptableObject.CreateInstance<ReordenatorNode>(); - m_reordenator.Init( "_" + Function.FunctionName, Function.FunctionName, propertyList, false ); - m_reordenator.OrderIndex = m_orderIndex; - m_reordenator.HeaderTitle = Function.FunctionName; - m_reordenator.IsInside = inside; - } - - if( m_reordenator != null ) - { - cachedGraph = ContainerGraph.ParentWindow.CustomGraph; - ContainerGraph.ParentWindow.CustomGraph = null; - UIUtils.RegisterPropertyNode( m_reordenator ); - ContainerGraph.ParentWindow.CustomGraph = cachedGraph; - - if( inside ) - { - UIUtils.RegisterPropertyNode( m_reordenator ); - } - } - - m_textLabelWidth = 120; - - UIUtils.RegisterFunctionNode( this ); - - m_previewShaderGUID = "aca70c900c50c004e8ef0b47c4fac4d4"; - m_useInternalPortData = false; - m_selectedLocation = function.PreviewPosition; - UIUtils.CurrentWindow.OutsideGraph.OnLODMasterNodesAddedEvent += OnLODMasterNodesAddedEvent; - } - - public InputPort GetInput( FunctionInput input ) - { - int index = m_allFunctionInputs.FindIndex( ( x ) => { return x.Equals( input ); } ); - if( index >= 0 ) - return InputPorts[ index ]; - else - return null; - } - - private void OnLODMasterNodesAddedEvent( int lod ) - { - AddShaderFunctionDirectivesInternal( lod ); - } - - public void SetPreviewInput( InputPort input ) - { - if( !HasPreviewShader || !m_initialized ) - return; - - if( input.IsConnected && input.InputNodeHasPreview( ContainerGraph ) ) - { - input.SetPreviewInputTexture( ContainerGraph ); - } - else - { - input.SetPreviewInputValue( ContainerGraph ); - } - } - - public override bool RecursivePreviewUpdate( Dictionary<string, bool> duplicatesDict = null ) - { - if( duplicatesDict == null ) - { - duplicatesDict = ContainerGraph.ParentWindow.VisitedChanged; - } - - if( m_allFunctionOutputs == null || m_allFunctionOutputs.Count == 0 ) - return false; - - for( int i = 0; i < m_allFunctionOutputs.Count; i++ ) - { - ParentNode outNode = m_allFunctionOutputs[ i ]; - if( outNode != null ) - { - if( !duplicatesDict.ContainsKey( outNode.OutputId ) ) - { - bool result = outNode.RecursivePreviewUpdate(); - if( result ) - PreviewIsDirty = true; - } - else if( duplicatesDict[ outNode.OutputId ] ) - { - PreviewIsDirty = true; - } - } - } - - bool needsUpdate = PreviewIsDirty; - RenderNodePreview(); - if( !duplicatesDict.ContainsKey( OutputId ) ) - duplicatesDict.Add( OutputId, needsUpdate ); - return needsUpdate; - } - - public override void RenderNodePreview() - { - if( m_outputPorts == null ) - return; - - if( !PreviewIsDirty && !m_continuousPreviewRefresh ) - return; - - // this is in the wrong place?? - if( m_drawPreviewAsSphere != m_mainPreviewNode.SpherePreview ) - { - m_drawPreviewAsSphere = m_mainPreviewNode.SpherePreview; - OnNodeChange(); - } - - int count = m_outputPorts.Count; - for( int i = 0; i < count; i++ ) - { - m_outputPorts[ i ].OutputPreviewTexture = m_allFunctionOutputs[ i ].PreviewTexture; - } - - if( PreviewIsDirty ) - FinishPreviewRender = true; - - PreviewIsDirty = false; - } - - public override RenderTexture PreviewTexture - { - get - { - if( m_mainPreviewNode != null ) - return m_mainPreviewNode.PreviewTexture; - else - return base.PreviewTexture; - } - } - - private void AddShaderFunctionDirectivesInternal( int lod ) - { - List<TemplateMultiPassMasterNode> nodes = ContainerGraph.ParentWindow.OutsideGraph.GetMultiPassMasterNodes( lod ); - int count = nodes.Count; - for( int i = 0; i < count; i++ ) - { - nodes[ i ].PassModule.AdditionalDirectives.AddShaderFunctionItems( OutputId, Function.AdditionalDirectives.DirectivesList ); - } - } - - public override void RefreshExternalReferences() - { - base.RefreshExternalReferences(); - if( Function == null ) - return; - - //Debug.Log( "RefreshExternalReferences " + m_function.FunctionName + " " + UIUtils.CurrentWindow.IsShaderFunctionWindow ); - - Function.UpdateDirectivesList(); - - MasterNode masterNode = UIUtils.CurrentWindow.OutsideGraph.CurrentMasterNode; - StandardSurfaceOutputNode surface = masterNode as StandardSurfaceOutputNode; - - - - if( surface != null ) - { - //for( int i = 0; i < Function.AdditionalIncludes.IncludeList.Count; i++ ) - //{ - // //ContainerGraph.ParentWindow.OutsideGraph.CurrentStandardSurface.AdditionalIncludes.OutsideList.Add( Function.AdditionalIncludes.IncludeList[ i ] ); - // ContainerGraph.ParentWindow.OutsideGraph.CurrentStandardSurface.AdditionalDirectives.AddShaderFunctionItem( AdditionalLineType.Include, Function.AdditionalIncludes.IncludeList[ i ] ); - // m_includes.Add( Function.AdditionalIncludes.IncludeList[ i ] ); - //} - - //for( int i = 0; i < Function.AdditionalPragmas.PragmaList.Count; i++ ) - //{ - // //ContainerGraph.ParentWindow.OutsideGraph.CurrentStandardSurface.AdditionalPragmas.OutsideList.Add( Function.AdditionalPragmas.PragmaList[ i ] ); - // ContainerGraph.ParentWindow.OutsideGraph.CurrentStandardSurface.AdditionalDirectives.AddShaderFunctionItem(AdditionalLineType.Pragma, Function.AdditionalPragmas.PragmaList[ i ] ); - // m_pragmas.Add( Function.AdditionalPragmas.PragmaList[ i ] ); - //} - surface.AdditionalDirectives.AddShaderFunctionItems( OutputId, Function.AdditionalDirectives.DirectivesList ); - } - else - { - if( ContainerGraph.ParentWindow.OutsideGraph.MultiPassMasterNodes.Count > 0 ) - { - for( int lod = -1; lod < ContainerGraph.ParentWindow.OutsideGraph.LodMultiPassMasternodes.Count; lod++ ) - { - AddShaderFunctionDirectivesInternal( lod ); - } - } - else - { - // Assuring that we're not editing a Shader Function, as directives setup is not needed there - if( !UIUtils.CurrentWindow.IsShaderFunctionWindow ) - { - // This function is nested inside a shader function itself and this method - // was called before the main output node was created. - // This is possible since all nodes RefreshExternalReferences(...) are called at the end - // of a LoadFromMeta - // Need to delay this setup to after all nodes are loaded to then setup the directives - m_lateRefresh = true; - return; - } - } - - } - m_directives.AddRange( Function.AdditionalDirectives.DirectivesList ); - - if( m_refreshIdsRequired ) - { - m_refreshIdsRequired = false; - int inputCount = m_inputPorts.Count; - for( int i = 0; i < inputCount; i++ ) - { - m_inputPorts[ i ].ChangePortId( m_allFunctionInputs[ i ].UniqueId ); - } - - int outputCount = m_outputPorts.Count; - for( int i = 0; i < outputCount; i++ ) - { - m_outputPorts[ i ].ChangePortId( m_allFunctionOutputs[ i ].UniqueId ); - } - } - - if( ContainerGraph.ParentWindow.CurrentGraph != m_functionGraph ) - ContainerGraph.ParentWindow.CurrentGraph.InstancePropertyCount += m_functionGraph.InstancePropertyCount; - - ParentGraph cachedGraph = ContainerGraph.ParentWindow.CustomGraph; - ContainerGraph.ParentWindow.CustomGraph = m_functionGraph; - - if( ReadOptionsHelper.Length > 2 ) - { - for( int i = 1; i < ReadOptionsHelper.Length; i += 2 ) - { - int optionId = Convert.ToInt32( ReadOptionsHelper[ i ] ); - int optionValue = Convert.ToInt32( ReadOptionsHelper[ i + 1 ] ); - for( int j = 0; j < m_allFunctionSwitches.Count; j++ ) - { - if( m_allFunctionSwitches[ j ].UniqueId == optionId ) - { - m_allFunctionSwitches[ j ].SetCurrentSelectedInput( optionValue, m_allFunctionSwitches[ j ].GetCurrentSelectedInput() ); - break; - } - } - } - } - - ContainerGraph.ParentWindow.CustomGraph = cachedGraph; - - m_portsChanged = true; - } - - void InputPortSwitchRestriction( WirePort port ) - { - switch( port.DataType ) - { - case WirePortDataType.OBJECT: - break; - case WirePortDataType.FLOAT: - case WirePortDataType.FLOAT2: - case WirePortDataType.FLOAT3: - case WirePortDataType.FLOAT4: - case WirePortDataType.COLOR: - case WirePortDataType.INT: - { - port.CreatePortRestrictions( WirePortDataType.FLOAT, WirePortDataType.FLOAT2, WirePortDataType.FLOAT3, WirePortDataType.FLOAT4, WirePortDataType.COLOR, WirePortDataType.INT, WirePortDataType.OBJECT ); - } - break; - case WirePortDataType.FLOAT3x3: - case WirePortDataType.FLOAT4x4: - { - port.CreatePortRestrictions( WirePortDataType.FLOAT3x3, WirePortDataType.FLOAT4x4, WirePortDataType.OBJECT ); - } - break; - case WirePortDataType.SAMPLER1D: - case WirePortDataType.SAMPLER2D: - case WirePortDataType.SAMPLER3D: - case WirePortDataType.SAMPLERCUBE: - { - port.CreatePortRestrictions( WirePortDataType.SAMPLER1D, WirePortDataType.SAMPLER2D, WirePortDataType.SAMPLER3D, WirePortDataType.SAMPLERCUBE, WirePortDataType.OBJECT ); - } - break; - default: - break; - } - } - - void OutputPortSwitchRestriction( WirePort port ) - { - switch( port.DataType ) - { - case WirePortDataType.OBJECT: - break; - case WirePortDataType.FLOAT: - case WirePortDataType.FLOAT2: - case WirePortDataType.FLOAT3: - case WirePortDataType.FLOAT4: - case WirePortDataType.COLOR: - case WirePortDataType.INT: - case WirePortDataType.FLOAT3x3: - case WirePortDataType.FLOAT4x4: - { - port.AddPortForbiddenTypes( WirePortDataType.SAMPLER1D, WirePortDataType.SAMPLER2D, WirePortDataType.SAMPLER3D, WirePortDataType.SAMPLERCUBE ); - } - break; - case WirePortDataType.SAMPLER1D: - case WirePortDataType.SAMPLER2D: - case WirePortDataType.SAMPLER3D: - case WirePortDataType.SAMPLERCUBE: - { - port.CreatePortRestrictions( WirePortDataType.SAMPLER1D, WirePortDataType.SAMPLER2D, WirePortDataType.SAMPLER3D, WirePortDataType.SAMPLERCUBE, WirePortDataType.OBJECT ); - } - break; - default: - break; - } - } - - public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) - { - ParentGraph cachedGraph = ContainerGraph.ParentWindow.CustomGraph; - m_outsideGraph = cachedGraph; - ContainerGraph.ParentWindow.CustomGraph = m_functionGraph; - - for( int i = 0; i < m_allFunctionOutputs.Count; i++ ) - { - m_allFunctionOutputs[ i ].PropagateNodeData( nodeData, ref dataCollector ); - } - - ContainerGraph.ParentWindow.CustomGraph = cachedGraph; - - base.PropagateNodeData( nodeData, ref dataCollector ); - } - - protected override void OnUniqueIDAssigned() - { - base.OnUniqueIDAssigned(); - UIUtils.RegisterFunctionNode( this ); - } - - public override void SetupFromCastObject( UnityEngine.Object obj ) - { - base.SetupFromCastObject( obj ); - AmplifyShaderFunction function = obj as AmplifyShaderFunction; - CommonInit( function, UniqueId ); - RefreshExternalReferences(); - } - - public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) - { - base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); - FunctionInput functionInput = m_refreshIdsRequired ? m_allFunctionInputs[ portId ] : GetFunctionInputByUniqueId( portId ); - functionInput.PreviewIsDirty = true; - if( functionInput.AutoCast ) - { - InputPort inputPort = m_refreshIdsRequired ? m_inputPorts[ portId ] : GetInputPortByUniqueId( portId ); - inputPort.MatchPortToConnection(); - - ParentGraph cachedGraph = ContainerGraph.ParentWindow.CustomGraph; - ContainerGraph.ParentWindow.CustomGraph = m_functionGraph; - functionInput.ChangeOutputType( inputPort.DataType, false ); - ContainerGraph.ParentWindow.CustomGraph = cachedGraph; - } - - for( int i = 0; i < m_allFunctionOutputs.Count; i++ ) - { - m_outputPorts[ i ].ChangeType( m_allFunctionOutputs[ i ].InputPorts[ 0 ].DataType, false ); - } - } - - public override void OnInputPortDisconnected( int portId ) - { - base.OnInputPortDisconnected( portId ); - - FunctionInput functionInput = m_refreshIdsRequired ? m_allFunctionInputs[ portId ] : GetFunctionInputByUniqueId( portId ); - functionInput.PreviewIsDirty = true; - } - - public override void OnConnectedOutputNodeChanges( int inputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) - { - base.OnConnectedOutputNodeChanges( inputPortId, otherNodeId, otherPortId, name, type ); - FunctionInput functionInput = m_refreshIdsRequired ? m_allFunctionInputs[ inputPortId ] : GetFunctionInputByUniqueId( inputPortId ); - functionInput.PreviewIsDirty = true; - if( functionInput.AutoCast ) - { - InputPort inputPort = m_refreshIdsRequired ? m_inputPorts[ inputPortId ] : GetInputPortByUniqueId( inputPortId ); - inputPort.MatchPortToConnection(); - - ParentGraph cachedGraph = ContainerGraph.ParentWindow.CustomGraph; - ContainerGraph.ParentWindow.CustomGraph = m_functionGraph; - functionInput.ChangeOutputType( inputPort.DataType, false ); - ContainerGraph.ParentWindow.CustomGraph = cachedGraph; - } - - for( int i = 0; i < m_allFunctionOutputs.Count; i++ ) - { - m_outputPorts[ i ].ChangeType( m_allFunctionOutputs[ i ].InputPorts[ 0 ].DataType, false ); - } - } - - public override void DrawProperties() - { - base.DrawProperties(); - - if( Function == null ) - return; - - if( Function.Description.Length > 0 || m_allFunctionSwitches.Count > 0 ) - NodeUtils.DrawPropertyGroup( ref m_parametersFoldout, "Parameters", DrawDescription ); - - bool drawInternalDataUI = false; - int inputCount = m_inputPorts.Count; - if( inputCount > 0 ) - { - for( int i = 0; i < inputCount; i++ ) - { - if( m_inputPorts[ i ].Available && m_inputPorts[ i ].ValidInternalData && !m_inputPorts[ i ].IsConnected && m_inputPorts[ i ].AutoDrawInternalData /*&& ( m_inputPorts[ i ].AutoDrawInternalData || ( m_autoDrawInternalPortData && m_useInternalPortData ) )*/ /*&& m_inputPorts[ i ].AutoDrawInternalData*/ ) - { - drawInternalDataUI = true; - break; - } - } - } - - if( drawInternalDataUI ) - NodeUtils.DrawPropertyGroup( ref m_internalDataFoldout, Constants.InternalDataLabelStr, () => - { - 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 ].AutoDrawInternalData ) - { - EditorGUI.BeginChangeCheck(); - m_inputPorts[ i ].ShowInternalData( this ); - if( EditorGUI.EndChangeCheck() ) - { - m_allFunctionInputs[ i ].PreviewIsDirty = true; - } - } - } - } ); - } - - private void DrawDescription() - { - if( Function.Description.Length > 0 ) - EditorGUILayout.HelpBox( Function.Description, MessageType.Info ); - - ParentGraph cachedGraph = ContainerGraph.ParentWindow.CustomGraph; - ContainerGraph.ParentWindow.CustomGraph = m_functionGraph; - for( int i = 0; i < m_allFunctionSwitches.Count; i++ ) - { - m_allFunctionSwitches[ i ].AsDrawn = false; - } - - for( int i = 0; i < m_allFunctionSwitches.Count; i++ ) - { - if( m_allFunctionSwitches[ i ].DrawOption( this ) ) - { - m_portsChanged = true; - } - } - ContainerGraph.ParentWindow.CustomGraph = cachedGraph; - } - - private void RemoveShaderFunctionDirectivesInternal( int lod ) - { - List<TemplateMultiPassMasterNode> nodes = ContainerGraph.ParentWindow.OutsideGraph.GetMultiPassMasterNodes( lod ); - int count = nodes.Count; - for( int i = 0; i < count; i++ ) - { - nodes[ i ].PassModule.AdditionalDirectives.RemoveShaderFunctionItems( OutputId ); - } - } - - public override void Destroy() - { - m_mainPreviewNode = null; - base.Destroy(); - - m_duplicatesBuffer.Clear(); - m_duplicatesBuffer = null; - - if( m_functionGraph != null && ContainerGraph.ParentWindow.CurrentGraph != m_functionGraph ) - ContainerGraph.ParentWindow.CurrentGraph.InstancePropertyCount -= m_functionGraph.InstancePropertyCount; - - if( ContainerGraph.ParentWindow.OutsideGraph.CurrentStandardSurface != null ) - { - //for( int i = 0; i < m_includes.Count; i++ ) - //{ - // //if( ContainerGraph.ParentWindow.OutsideGraph.CurrentStandardSurface.AdditionalIncludes.OutsideList.Contains( m_includes[ i ] ) ) - // //{ - // // ContainerGraph.ParentWindow.OutsideGraph.CurrentStandardSurface.AdditionalIncludes.OutsideList.Remove( m_includes[ i ] ); - // //} - // ContainerGraph.ParentWindow.OutsideGraph.CurrentStandardSurface.AdditionalDirectives.RemoveShaderFunctionItem( AdditionalLineType.Include, m_includes[ i ] ); - //} - - //for( int i = 0; i < m_pragmas.Count; i++ ) - //{ - // //if( ContainerGraph.ParentWindow.OutsideGraph.CurrentStandardSurface.AdditionalPragmas.OutsideList.Contains( m_pragmas[ i ] ) ) - // //{ - // // ContainerGraph.ParentWindow.OutsideGraph.CurrentStandardSurface.AdditionalPragmas.OutsideList.Remove( m_pragmas[ i ] ); - // //} - // ContainerGraph.ParentWindow.OutsideGraph.CurrentStandardSurface.AdditionalDirectives.RemoveShaderFunctionItem( AdditionalLineType.Pragma, m_pragmas[ i ] ); - //} - ContainerGraph.ParentWindow.OutsideGraph.CurrentStandardSurface.AdditionalDirectives.RemoveShaderFunctionItems( OutputId/*, m_directives */); - } - else - { - if( ContainerGraph.ParentWindow.OutsideGraph.MultiPassMasterNodes.Count > 0 ) - { - for( int lod = -1; lod < ContainerGraph.ParentWindow.OutsideGraph.LodMultiPassMasternodes.Count; lod++ ) - { - RemoveShaderFunctionDirectivesInternal( lod ); - } - } - } - - - - - // Cannot GameObject.Destroy(m_directives[i]) since we would be removing them from - // the shader function asset itself - - m_directives.Clear(); - m_directives = null; - - if( m_reordenator != null ) - { - ParentGraph cachedGraph = ContainerGraph.ParentWindow.CustomGraph; - ContainerGraph.ParentWindow.CustomGraph = null; - UIUtils.UnregisterPropertyNode( m_reordenator ); - ContainerGraph.ParentWindow.CustomGraph = cachedGraph; - - m_reordenator.Destroy(); - m_reordenator = null; - } - - UIUtils.UnregisterFunctionNode( this ); - - ParentGraph cachedGraph2 = ContainerGraph.ParentWindow.CustomGraph; - ContainerGraph.ParentWindow.CustomGraph = m_functionGraph; - - if( m_allFunctionInputs != null ) - m_allFunctionInputs.Clear(); - m_allFunctionInputs = null; - - if( m_allFunctionOutputs != null ) - m_allFunctionOutputs.Clear(); - m_allFunctionOutputs = null; - - if( m_functionGraph != null ) - m_functionGraph.SoftDestroy(); - m_functionGraph = null; - - ContainerGraph.ParentWindow.CustomGraph = cachedGraph2; - m_function = null; - - m_allFunctionOutputsDict.Clear(); - m_allFunctionOutputsDict = null; - - m_allFunctionSwitchesDict.Clear(); - m_allFunctionSwitchesDict = null; - - m_allFunctionInputsDict.Clear(); - m_allFunctionInputsDict = null; - - UIUtils.CurrentWindow.OutsideGraph.OnLODMasterNodesAddedEvent -= OnLODMasterNodesAddedEvent; - } - - public override void OnNodeLogicUpdate( DrawInfo drawInfo ) - { - if( m_lateRefresh ) - { - m_lateRefresh = false; - RefreshExternalReferences(); - } - - CheckForChangesRecursively(); - - base.OnNodeLogicUpdate( drawInfo ); - ParentGraph cachedGraph = ContainerGraph.ParentWindow.CustomGraph; - ContainerGraph.ParentWindow.CustomGraph = m_functionGraph; - - if( m_functionGraph != null ) - { - int nodeCount = m_functionGraph.AllNodes.Count; - for( int i = 0; i < nodeCount; i++ ) - { - m_functionGraph.AllNodes[ i ].OnNodeLogicUpdate( drawInfo ); - } - - if( !string.IsNullOrEmpty( FunctionGraph.CurrentFunctionOutput.SubTitle ) ) - { - SetAdditonalTitleText( FunctionGraph.CurrentFunctionOutput.SubTitle ); - } - } - - ContainerGraph.ParentWindow.CustomGraph = cachedGraph; - if( m_portsChanged ) - { - m_portsChanged = false; - for( int i = 0; i < m_allFunctionOutputs.Count; i++ ) - { - m_outputPorts[ i ].ChangeType( m_allFunctionOutputs[ i ].InputPorts[ 0 ].DataType, false ); - } - - CheckPortVisibility(); - } - } - - public override void Draw( DrawInfo drawInfo ) - { - //CheckForChangesRecursively(); - - if( !m_initialGraphDraw && drawInfo.CurrentEventType == EventType.Repaint ) - { - m_initialGraphDraw = true; - ParentGraph cachedGraph = ContainerGraph.ParentWindow.CustomGraph; - ContainerGraph.ParentWindow.CustomGraph = m_functionGraph; - if( m_functionGraph != null ) - { - for( int i = 0; i < m_functionGraph.AllNodes.Count; i++ ) - { - ParentNode node = m_functionGraph.AllNodes[ i ]; - if( node != null ) - { - node.OnNodeLayout( drawInfo ); - } - } - } - ContainerGraph.ParentWindow.CustomGraph = cachedGraph; - } - - base.Draw( drawInfo ); - } - - public bool CheckForChanges( bool forceCheck = false, bool forceChange = false ) - { - if( ( ContainerGraph.ParentWindow.CheckFunctions || forceCheck || forceChange ) && m_function != null ) - { - //string newCheckSum = LastLine( m_function.FunctionInfo ); - string newCheckSum = AssetDatabase.GetAssetDependencyHash( AssetDatabase.GetAssetPath( m_function ) ).ToString(); - if( !m_functionCheckSum.Equals( newCheckSum ) || forceChange ) - { - m_functionCheckSum = newCheckSum; - ContainerGraph.OnDuplicateEvent += DuplicateMe; - return true; - } - } - return false; - } - - public bool CheckForChangesRecursively() - { - if( m_functionGraph == null ) - return false; - - bool result = false; - for( int i = 0; i < m_functionGraph.FunctionNodes.NodesList.Count; i++ ) - { - if( m_functionGraph.FunctionNodes.NodesList[ i ].CheckForChangesRecursively() ) - result = true; - } - if( CheckForChanges( false, result ) ) - result = true; - - return result; - } - - public void DuplicateMe() - { - bool previewOpen = m_showPreview; - - string allOptions = m_allFunctionSwitches.Count.ToString(); - for( int i = 0; i < m_allFunctionSwitches.Count; i++ ) - { - allOptions += "," + m_allFunctionSwitches[ i ].UniqueId + "," + m_allFunctionSwitches[ i ].GetCurrentSelectedInput(); - } - - ReadOptionsHelper = allOptions.Split( ',' ); - - ParentGraph cachedGraph = ContainerGraph.ParentWindow.CustomGraph; - ContainerGraph.ParentWindow.CustomGraph = null; - MasterNode masterNode = ContainerGraph.ParentWindow.CurrentGraph.CurrentMasterNode; - if( masterNode != null ) - masterNode.InvalidateMaterialPropertyCount(); - - ContainerGraph.ParentWindow.CustomGraph = cachedGraph; - - ParentNode newNode = ContainerGraph.CreateNode( m_function, false, Vec2Position ); - newNode.ShowPreview = previewOpen; - ( newNode as FunctionNode ).ReadOptionsHelper = ReadOptionsHelper; - newNode.RefreshExternalReferences(); - if( ( newNode as FunctionNode ).m_reordenator && m_reordenator ) - ( newNode as FunctionNode ).m_reordenator.OrderIndex = m_reordenator.OrderIndex; - - for( int i = 0; i < m_outputPorts.Count; i++ ) - { - if( m_outputPorts[ i ].IsConnected ) - { - OutputPort newOutputPort = newNode.GetOutputPortByUniqueId( m_outputPorts[ i ].PortId ); - if( newNode.OutputPorts != null && newOutputPort != null ) - { - for( int j = m_outputPorts[ i ].ExternalReferences.Count - 1; j >= 0; j-- ) - { - ContainerGraph.CreateConnection( m_outputPorts[ i ].ExternalReferences[ j ].NodeId, m_outputPorts[ i ].ExternalReferences[ j ].PortId, newOutputPort.NodeId, newOutputPort.PortId ); - } - } - } - //else - //{ - //if( newNode.OutputPorts != null && newNode.OutputPorts[ i ] != null ) - //{ - // ContainerGraph.DeleteConnection( false, newNode.UniqueId, newNode.OutputPorts[ i ].PortId, false, false, false ); - //} - //} - } - - for( int i = 0; i < m_inputPorts.Count; i++ ) - { - if( m_inputPorts[ i ].IsConnected ) - { - InputPort newInputPort = newNode.GetInputPortByUniqueId( m_inputPorts[ i ].PortId ); - if( newNode.InputPorts != null && newInputPort != null ) - { - ContainerGraph.CreateConnection( newInputPort.NodeId, newInputPort.PortId, m_inputPorts[ i ].ExternalReferences[ 0 ].NodeId, m_inputPorts[ i ].ExternalReferences[ 0 ].PortId ); - } - } - } - - ContainerGraph.OnDuplicateEvent -= DuplicateMe; - - if( Selected ) - { - ContainerGraph.DeselectNode( this ); - ContainerGraph.SelectNode( newNode, true, false ); - } - - ContainerGraph.DestroyNode( this, false ); - } - - private FunctionOutput GetFunctionOutputByUniqueId( int uniqueId ) - { - int listCount = m_allFunctionOutputs.Count; - if( m_allFunctionOutputsDict.Count != m_allFunctionOutputs.Count ) - { - m_allFunctionOutputsDict.Clear(); - for( int i = 0; i < listCount; i++ ) - { - m_allFunctionOutputsDict.Add( m_allFunctionOutputs[ i ].UniqueId, m_allFunctionOutputs[ i ] ); - } - } - - if( m_allFunctionOutputsDict.ContainsKey( uniqueId ) ) - return m_allFunctionOutputsDict[ uniqueId ]; - - return null; - } - - private FunctionInput GetFunctionInputByUniqueId( int uniqueId ) - { - int listCount = m_allFunctionInputs.Count; - if( m_allFunctionInputsDict.Count != m_allFunctionInputs.Count ) - { - m_allFunctionInputsDict.Clear(); - for( int i = 0; i < listCount; i++ ) - { - m_allFunctionInputsDict.Add( m_allFunctionInputs[ i ].UniqueId, m_allFunctionInputs[ i ] ); - } - } - - if( m_allFunctionInputsDict.ContainsKey( uniqueId ) ) - return m_allFunctionInputsDict[ uniqueId ]; - - return null; - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - OutputPort outputPort = GetOutputPortByUniqueId( outputId ); - FunctionOutput functionOutput = GetFunctionOutputByUniqueId( outputId ); - - if( outputPort.IsLocalValue( dataCollector.PortCategory ) ) - return outputPort.LocalValue( dataCollector.PortCategory ); - - m_functionGraph.CurrentPrecision = ContainerGraph.ParentWindow.CurrentGraph.CurrentPrecision; - ParentGraph cachedGraph = ContainerGraph.ParentWindow.CustomGraph; - m_outsideGraph = cachedGraph; - ContainerGraph.ParentWindow.CustomGraph = m_functionGraph; -#if ADD_SHADER_FUNCTION_HEADERS - if( m_reordenator != null && m_reordenator.RecursiveCount() > 0 && m_reordenator.HasTitle ) - { - dataCollector.AddToProperties( UniqueId, "[Header(" + m_reordenator.HeaderTitle.Replace( "-", " " ) + ")]", m_reordenator.OrderIndex ); - } -#endif - string result = string.Empty; - for( int i = 0; i < m_allFunctionInputs.Count; i++ ) - { - if( !m_allFunctionInputs[ i ].InputPorts[ 0 ].IsConnected || m_inputPorts[ i ].IsConnected ) - m_allFunctionInputs[ i ].OnPortGeneration += FunctionNodeOnPortGeneration; - } - - result += functionOutput.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); - - for( int i = 0; i < m_allFunctionInputs.Count; i++ ) - { - if( !m_allFunctionInputs[ i ].InputPorts[ 0 ].IsConnected || m_inputPorts[ i ].IsConnected ) - m_allFunctionInputs[ i ].OnPortGeneration -= FunctionNodeOnPortGeneration; - } - - ContainerGraph.ParentWindow.CustomGraph = cachedGraph; - - if( outputPort.ConnectionCount > 1 ) - RegisterLocalVariable( outputId, result, ref dataCollector ); - else - outputPort.SetLocalValue( result, dataCollector.PortCategory ); - - return outputPort.LocalValue( dataCollector.PortCategory ); - } - - private string FunctionNodeOnPortGeneration( ref MasterNodeDataCollector dataCollector, int index, ParentGraph graph ) - { - ParentGraph cachedGraph = ContainerGraph.ParentWindow.CustomGraph; - ContainerGraph.ParentWindow.CustomGraph = m_outsideGraph; - string result = m_inputPorts[ index ].GeneratePortInstructions( ref dataCollector ); - ContainerGraph.ParentWindow.CustomGraph = cachedGraph; - return result; - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - - if( Function != null ) - IOUtils.AddFieldValueToString( ref nodeInfo, m_function.name ); - else - IOUtils.AddFieldValueToString( ref nodeInfo, m_filename ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_reordenator != null ? m_reordenator.RawOrderIndex : -1 ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_headerTitle ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_functionGraphId ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_functionGUID ); - - int functionSwitchCount = m_allFunctionSwitches != null ? m_allFunctionSwitches.Count : 0; - string allOptions = functionSwitchCount.ToString(); - for( int i = 0; i < functionSwitchCount; i++ ) - { - allOptions += "," + m_allFunctionSwitches[ i ].UniqueId + "," + m_allFunctionSwitches[ i ].GetCurrentSelectedInput(); - } - IOUtils.AddFieldValueToString( ref nodeInfo, allOptions ); - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - m_filename = GetCurrentParam( ref nodeParams ); - m_orderIndex = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - m_headerTitle = GetCurrentParam( ref nodeParams ); - - if( UIUtils.CurrentShaderVersion() > 7203 ) - { - m_functionGraphId = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - } - - if( UIUtils.CurrentShaderVersion() > 13704 ) - { - m_functionGUID = GetCurrentParam( ref nodeParams ); - } - - AmplifyShaderFunction loaded = AssetDatabase.LoadAssetAtPath<AmplifyShaderFunction>( AssetDatabase.GUIDToAssetPath( m_functionGUID ) ); - if( loaded != null ) - { - CommonInit( loaded, UniqueId ); - } - else - { - string[] guids = AssetDatabase.FindAssets( "t:AmplifyShaderFunction " + m_filename ); - if( guids.Length > 0 ) - { - string sfGuid = null; - - foreach( string guid in guids ) - { - string assetPath = AssetDatabase.GUIDToAssetPath( guid ); - string name = System.IO.Path.GetFileNameWithoutExtension( assetPath ); - if( name.Equals( m_filename, StringComparison.OrdinalIgnoreCase ) ) - { - sfGuid = guid; - break; - } - } - loaded = AssetDatabase.LoadAssetAtPath<AmplifyShaderFunction>( AssetDatabase.GUIDToAssetPath( sfGuid ) ); - - if( loaded != null ) - { - CommonInit( loaded, UniqueId ); - } - else - { - SetTitleText( "ERROR" ); - UIUtils.ShowMessage( UniqueId, string.Format( "Error loading {0} shader function from project folder", m_filename ), MessageSeverity.Error ); - } - } - else - { - SetTitleText( "Missing Function" ); - UIUtils.ShowMessage( UniqueId, string.Format( "Missing {0} shader function on project folder", m_filename ), MessageSeverity.Error ); - } - } - if( UIUtils.CurrentShaderVersion() > 14203 ) - { - ReadOptionsHelper = GetCurrentParam( ref nodeParams ).Split( ',' ); - } - } - - public override void ReadOutputDataFromString( ref string[] nodeParams ) - { - if( Function == null ) - return; - - base.ReadOutputDataFromString( ref nodeParams ); - - ConfigureInputportsAfterRead(); - } - - public override void OnNodeDoubleClicked( Vector2 currentMousePos2D ) - { - if( Function == null ) - return; - - ContainerGraph.DeSelectAll(); - this.Selected = true; - - ContainerGraph.ParentWindow.OnLeftMouseUp(); - AmplifyShaderEditorWindow.LoadShaderFunctionToASE( Function, true ); - this.Selected = false; - } - - private void ConfigureInputportsAfterRead() - { - if( InputPorts != null ) - { - int inputCount = InputPorts.Count; - for( int i = 0; i < inputCount; i++ ) - { - InputPorts[ i ].ChangeProperties( m_allFunctionInputs[ i ].InputName, m_allFunctionInputs[ i ].SelectedInputType, false ); - } - } - - if( OutputPorts != null ) - { - int outputCount = OutputPorts.Count; - for( int i = 0; i < outputCount; i++ ) - { - OutputPorts[ i ].ChangeProperties( m_allFunctionOutputs[ i ].OutputName, m_allFunctionOutputs[ i ].AutoOutputType, false ); - } - } - } - - private void CheckPortVisibility() - { - bool changes = false; - if( InputPorts != null ) - { - for( int i = 0; i < m_allFunctionInputs.Count; i++ ) - { - if( m_inputPorts[ i ].Visible != m_allFunctionInputs[ i ].IsConnected ) - { - m_inputPorts[ i ].Visible = m_allFunctionInputs[ i ].IsConnected; - changes = true; - } - } - } - - if( changes ) - m_sizeIsDirty = true; - } - - public bool HasProperties { get { return m_reordenator != null; } } - - public ParentGraph FunctionGraph - { - get { return m_functionGraph; } - set { m_functionGraph = value; } - } - - public AmplifyShaderFunction Function - { - get { return m_function; } - set { m_function = value; } - } - - public override void RecordObjectOnDestroy( string Id ) - { - base.RecordObjectOnDestroy( Id ); - if( m_reordenator != null ) - m_reordenator.RecordObject( Id ); - - if( m_functionGraph != null ) - { - Undo.RegisterCompleteObjectUndo( m_functionGraph, Id ); - for( int i = 0; i < m_functionGraph.AllNodes.Count; i++ ) - { - m_functionGraph.AllNodes[ i ].RecordObject( Id ); - } - } - } - - public override void SetContainerGraph( ParentGraph newgraph ) - { - base.SetContainerGraph( newgraph ); - if( m_functionGraph == null ) - return; - for( int i = 0; i < m_functionGraph.AllNodes.Count; i++ ) - { - m_functionGraph.AllNodes[ i ].SetContainerGraph( m_functionGraph ); - } - } - - public override void OnMasterNodeReplaced( MasterNode newMasterNode ) - { - base.OnMasterNodeReplaced( newMasterNode ); - if( m_functionGraph == null ) - return; - - m_functionGraph.FireMasterNodeReplacedEvent( newMasterNode ); - - StandardSurfaceOutputNode surface = newMasterNode as StandardSurfaceOutputNode; - if( surface != null ) - { - surface.AdditionalDirectives.AddShaderFunctionItems( OutputId, Function.AdditionalDirectives.DirectivesList ); - } - else - { - if( ContainerGraph.ParentWindow.OutsideGraph.MultiPassMasterNodes.Count > 0 ) - { - for( int lod = -1; lod < ContainerGraph.ParentWindow.OutsideGraph.LodMultiPassMasternodes.Count; lod++ ) - { - AddShaderFunctionDirectivesInternal( lod ); - } - } - } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionNode.cs.meta deleted file mode 100644 index 15ea8d35..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 7b3de46feda5b0f4ea58c852c4a521a9 -timeCreated: 1492001141 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionOutput.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionOutput.cs deleted file mode 100644 index baa49631..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionOutput.cs +++ /dev/null @@ -1,318 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEngine; -using UnityEditor; -using System.Collections.Generic; -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Function Output", "Functions", "Function Output adds an output port to the shader function, it's port type is determined automatically.", NodeAvailabilityFlags = (int)NodeAvailability.ShaderFunction )] - public sealed class FunctionOutput : OutputNode - { - public FunctionOutput() : base() { CommonInit(); } - public FunctionOutput( int uniqueId, float x, float y, float width, float height ) : base( uniqueId, x, y, width, height ) { CommonInit(); } - - [SerializeField] - private bool m_previewNode = false; - - [SerializeField] - private string m_outputName = "Output"; - - [SerializeField] - private int m_orderIndex = -1; - - [SerializeField] - private AmplifyShaderFunction m_function; - - //Title editing - [SerializeField] - private string m_uniqueName; - - private bool m_isEditing; - private bool m_stopEditing; - private bool m_startEditing; - private double m_clickTime; - private double m_doubleClickTime = 0.3; - private Rect m_titleClickArea; - private bool m_showTitleWhenNotEditing = true; - - [SerializeField] - private string m_subTitle = string.Empty; - - - void CommonInit() - { - m_isMainOutputNode = false; - m_connStatus = NodeConnectionStatus.Connected; - m_activeType = GetType(); - m_currentPrecisionType = PrecisionType.Inherit; - m_textLabelWidth = 100; - m_autoWrapProperties = true; - AddInputPort( WirePortDataType.FLOAT, false, " " ); - AddOutputPort( WirePortDataType.FLOAT, " " ); - m_outputPorts[ 0 ].Visible = false; - SetTitleText( m_outputName ); - m_previewShaderGUID = "e6d5f64114b18e24f99dc65290c0fe98"; - } - - public override void SetupNodeCategories() - { - //base.SetupNodeCategories(); - ContainerGraph.ResetNodesData(); - MasterNode masterNode = ContainerGraph.ParentWindow.CurrentGraph.CurrentMasterNode; - if( masterNode != null ) - { - 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(); - MasterNodeDataCollector temp = masterNode.CurrentDataCollector; - node.PropagateNodeData( nodeData, ref temp ); - temp = null; - } - } - } - } - - protected override void OnUniqueIDAssigned() - { - base.OnUniqueIDAssigned(); - UIUtils.RegisterFunctionOutputNode( this ); - if( m_nodeAttribs != null ) - m_uniqueName = m_nodeAttribs.Name + UniqueId; - } - - - public override void Destroy() - { - base.Destroy(); - UIUtils.UnregisterFunctionOutputNode( this ); - } - - public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) - { - base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); - m_inputPorts[ 0 ].MatchPortToConnection(); - m_outputPorts[ 0 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); - } - - public override void OnConnectedOutputNodeChanges( int outputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) - { - base.OnConnectedOutputNodeChanges( outputPortId, otherNodeId, otherPortId, name, type ); - m_inputPorts[ 0 ].MatchPortToConnection(); - m_outputPorts[ 0 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - return m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - } - - public override void DrawProperties() - { - base.DrawProperties(); - EditorGUI.BeginChangeCheck(); - m_outputName = EditorGUILayoutTextField( "Name", m_outputName ); - - if( EditorGUI.EndChangeCheck() ) - { - SetTitleText( m_outputName ); - UIUtils.UpdateFunctionOutputData( UniqueId, m_outputName ); - } - - EditorGUI.BeginDisabledGroup( m_previewNode ); - if( GUILayout.Button( "Set as Preview" ) ) - { - List<FunctionOutput> allOutputs = UIUtils.FunctionOutputList(); - - foreach( FunctionOutput item in allOutputs ) - item.PreviewNode = false; - - m_previewNode = true; - } - EditorGUI.EndDisabledGroup(); - } - [SerializeField] - private string m_currentTitle = string.Empty; - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - if( m_previewNode ) - m_currentTitle = "Preview"; - else - m_currentTitle = string.Empty; - - SetAdditonalTitleTextOnCallback( m_currentTitle, ( instance, newSubTitle ) => instance.AdditonalTitleContent.text = newSubTitle ); - - if( ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD3 ) - { - if( !m_isEditing && ( ( !ContainerGraph.ParentWindow.MouseInteracted && drawInfo.CurrentEventType == EventType.MouseDown && m_titleClickArea.Contains( drawInfo.MousePosition ) ) ) ) - { - if( ( EditorApplication.timeSinceStartup - m_clickTime ) < m_doubleClickTime ) - m_startEditing = true; - else - GUI.FocusControl( null ); - m_clickTime = EditorApplication.timeSinceStartup; - } - else if( m_isEditing && ( ( drawInfo.CurrentEventType == EventType.MouseDown && !m_titleClickArea.Contains( drawInfo.MousePosition ) ) || !EditorGUIUtility.editingTextField ) ) - { - m_stopEditing = true; - } - - if( m_isEditing || m_startEditing ) - { - EditorGUI.BeginChangeCheck(); - GUI.SetNextControlName( m_uniqueName ); - m_outputName = EditorGUITextField( m_titleClickArea, string.Empty, m_outputName, UIUtils.GetCustomStyle( CustomStyle.NodeTitle ) ); - if( EditorGUI.EndChangeCheck() ) - { - SetTitleText( m_outputName ); - UIUtils.UpdateFunctionInputData( UniqueId, m_outputName ); - } - - if( m_startEditing ) - EditorGUI.FocusTextInControl( m_uniqueName ); - - } - - if( drawInfo.CurrentEventType == EventType.Repaint ) - { - if( m_startEditing ) - { - m_startEditing = false; - m_isEditing = true; - } - - if( m_stopEditing ) - { - m_stopEditing = false; - m_isEditing = false; - GUI.FocusControl( null ); - } - } - } - } - - public override void OnNodeLayout( DrawInfo drawInfo ) - { - // RUN LAYOUT CHANGES AFTER TITLES CHANGE - base.OnNodeLayout( drawInfo ); - m_titleClickArea = m_titlePos; - m_titleClickArea.height = Constants.NODE_HEADER_HEIGHT; - } - - public override void OnNodeRepaint( DrawInfo drawInfo ) - { - base.OnNodeRepaint( drawInfo ); - - if( !m_isVisible ) - return; - - // Fixed Title ( only renders when not editing ) - if( m_showTitleWhenNotEditing && !m_isEditing && !m_startEditing && ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD3 ) - { - GUI.Label( m_titleClickArea, m_content, UIUtils.GetCustomStyle( CustomStyle.NodeTitle ) ); - } - } - - public override void OnNodeDoubleClicked( Vector2 currentMousePos2D ) - { - if( currentMousePos2D.y - m_globalPosition.y > ( Constants.NODE_HEADER_HEIGHT + Constants.NODE_HEADER_EXTRA_HEIGHT ) * ContainerGraph.ParentWindow.CameraDrawInfo.InvertedZoom ) - { - ContainerGraph.ParentWindow.ParametersWindow.IsMaximized = !ContainerGraph.ParentWindow.ParametersWindow.IsMaximized; - } - } - - public WirePortDataType AutoOutputType - { - get { return m_inputPorts[ 0 ].DataType; } - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_outputName ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_orderIndex ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_previewNode ); - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - m_outputName = GetCurrentParam( ref nodeParams ); - m_orderIndex = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - - if( UIUtils.CurrentShaderVersion() > 13706 ) - m_previewNode = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - - if( IsNodeBeingCopied ) - PreviewNode = false; - - if( m_function == null ) - m_function = UIUtils.CurrentWindow.OpenedShaderFunction; - - if( m_isMainOutputNode && m_function != null ) - { - m_function.UpdateDirectivesList(); - } - - SetTitleText( m_outputName ); - UIUtils.UpdateFunctionOutputData( UniqueId, m_outputName ); - } - - public AmplifyShaderFunction Function - { - get { return m_function; } - set - { - m_function = value; - if( m_isMainOutputNode && m_function != null ) - { - m_function.UpdateDirectivesList(); - } - } - } - - public string OutputName - { - get { return m_outputName; } - } - - public int OrderIndex - { - get { return m_orderIndex; } - set { m_orderIndex = value; } - } - - public string SubTitle - { - get { return m_subTitle; } - set { m_subTitle = value; } - } - - public bool PreviewNode - { - get { return m_previewNode; } - set - { - m_previewNode = value; - m_sizeIsDirty = true; - if( m_previewNode ) - { - m_currentTitle = "Preview"; - } - else - { - m_currentTitle = ""; - } - } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionOutput.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionOutput.cs.meta deleted file mode 100644 index 7ece5125..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionOutput.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 6293b1f56d13d6c4ca6a8e2a8099cca9 -timeCreated: 1491917775 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionSubtitle.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionSubtitle.cs deleted file mode 100644 index 42cf0b5f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionSubtitle.cs +++ /dev/null @@ -1,124 +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( "Function Subtitle", "Functions", "Adds a subtitle to its shader function", NodeAvailabilityFlags = (int)NodeAvailability.ShaderFunction )] - public sealed class FunctionSubtitle : ParentNode - { - - //protected override void CommonInit( int uniqueId ) - //{ - // base.CommonInit( uniqueId ); - // AddInputPort( WirePortDataType.FLOAT, false, Constants.EmptyPortValue ); - // AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); - // m_autoWrapProperties = true; - // m_textLabelWidth = 100; - // //SetTitleText( m_inputName ); - // //SetAdditonalTitleText( "( " + m_inputValueTypes[ m_selectedInputTypeInt ] + " )" ); - // m_previewShaderGUID = "04bc8e7b317dccb4d8da601680dd8140"; - //} - [SerializeField] - private string m_subttile = "Subtitle"; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT, false, Constants.EmptyPortValue ); - AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); - m_autoWrapProperties = true; - m_textLabelWidth = 100; - SetTitleText( m_subttile ); - m_previewShaderGUID = "74e4d859fbdb2c0468de3612145f4929"; - } - - public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) - { - base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); - m_inputPorts[ 0 ].MatchPortToConnection(); - m_outputPorts[ 0 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); - } - - public override void OnConnectedOutputNodeChanges( int outputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) - { - base.OnConnectedOutputNodeChanges( outputPortId, otherNodeId, otherPortId, name, type ); - m_inputPorts[ 0 ].MatchPortToConnection(); - m_outputPorts[ 0 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); - return m_inputPorts[ 0 ].GenerateShaderForOutput( ref dataCollector, m_inputPorts[ 0 ].DataType, ignoreLocalvar ); - } - - //public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) - //{ - // base.PropagateNodeData( nodeData, ref dataCollector ); - - // //if( m_containerGraph.CurrentShaderFunction != null ) - // //m_containerGraph.CurrentShaderFunction.FunctionSubtitle = m_subttile; - //} - - public override void OnNodeLogicUpdate( DrawInfo drawInfo ) - { - base.OnNodeLogicUpdate( drawInfo ); - //public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) - //{ - // base.PropagateNodeData( nodeData, ref dataCollector ); - //Debug.Log( IsConnected + " " + m_containerGraph.CurrentFunctionOutput ); - if( m_containerGraph.CurrentFunctionOutput != null && IsConnected ) - m_containerGraph.CurrentFunctionOutput.SubTitle = m_subttile; - // m_containerGraph.CurrentShaderFunction.FunctionSubtitle = m_subttile; - } - - public override void DrawProperties() - { - base.DrawProperties(); - EditorGUILayout.BeginVertical(); - EditorGUI.BeginChangeCheck(); - m_subttile = EditorGUILayoutTextField( "Name", m_subttile ); - if( EditorGUI.EndChangeCheck() ) - { - SetTitleText( m_subttile ); - //UIUtils.UpdateFunctionInputData( UniqueId, m_inputName ); - } - EditorGUI.BeginChangeCheck(); - //m_selectedInputTypeInt = EditorGUILayoutPopup( InputTypeStr, m_selectedInputTypeInt, m_inputValueTypes ); - //if( EditorGUI.EndChangeCheck() ) - //{ - // UpdatePorts(); - // SetAdditonalTitleText( "( " + m_inputValueTypes[ m_selectedInputTypeInt ] + " )" ); - //} - - //m_autoCast = EditorGUILayoutToggle( "Auto Cast", m_autoCast ); - - //EditorGUILayout.Separator(); - //if( !m_inputPorts[ 0 ].IsConnected && m_inputPorts[ 0 ].ValidInternalData ) - //{ - // m_inputPorts[ 0 ].ShowInternalData( this, true, "Default Value" ); - //} - - - EditorGUILayout.EndVertical(); - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_subttile ); - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - m_subttile = GetCurrentParam( ref nodeParams ); - SetTitleText( m_subttile ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionSubtitle.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionSubtitle.cs.meta deleted file mode 100644 index bd87bd97..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionSubtitle.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 97d5e0cd26200a64fa9d127599406008 -timeCreated: 1522434121 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionSwitch.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionSwitch.cs deleted file mode 100644 index e25ad54a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionSwitch.cs +++ /dev/null @@ -1,867 +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.Collections.Generic; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Function Switch", "Functions", "Function Switch allows switching options at compile time for shader function", NodeAvailabilityFlags = (int)NodeAvailability.ShaderFunction )] - public sealed class FunctionSwitch : ParentNode - { - private const string InputPortNameStr = "In "; - - private const string ToggleFalseStr = "False"; - private const string ToggleTrueStr = "True"; - - private const string CurrSelectedStr = "Current"; - private const string MaxAmountStr = "Amount"; - private const int MaxAllowedAmount = 9; - - private const int MinComboSize = 50; - private const int MaxComboSize = 105; - - [SerializeField] - private string m_optionLabel = "Option"; - - [SerializeField] - private string[] AvailableInputsLabels = { "In 0", "In 1" }; - - [SerializeField] - private int[] AvailableInputsValues = { 0, 1 }; - - [SerializeField] - private int m_previousSelectedInput = 0; - - [SerializeField] - private int m_currentSelectedInput = 0; - - [SerializeField] - private int m_maxAmountInputs = 2; - - [SerializeField] - private bool m_toggleMode = false; - - [SerializeField] - private string[] m_optionNames = { "In 0", "In 1", "In 2", "In 3", "In 4", "In 5", "In 6", "In 7", "In 8" }; - - [SerializeField] - private int m_orderIndex = -1; - - [SerializeField] - private TexReferenceType m_referenceType = TexReferenceType.Object; - - [SerializeField] - private FunctionSwitch m_functionSwitchReference = null; - - [SerializeField] - private int m_referenceUniqueId = -1; - - [SerializeField] - private bool m_validReference = false; - - private bool m_asDrawn = false; - - private GUIContent m_checkContent; - private GUIContent m_popContent; - - private const double MaxTimestamp = 1; - private bool m_nameModified = false; - private double m_lastTimeNameModified = 0; - - private Rect m_varRect; - private Rect m_imgRect; - private bool m_editing; - - private int m_cachedPropertyId = -1; - - [SerializeField] - private int m_refMaxInputs = -1; - - [SerializeField] - private string m_refOptionLabel = string.Empty; - - [SerializeField] - private int m_refSelectedInput = -1; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - for( int i = 0; i < MaxAllowedAmount; i++ ) - { - AddInputPort( WirePortDataType.FLOAT, false, InputPortNameStr + i ); - m_inputPorts[ i ].Visible = ( i < 2 ); - } - AddOutputPort( WirePortDataType.FLOAT, " " ); - - m_checkContent = new GUIContent(); - m_checkContent.image = UIUtils.CheckmarkIcon; - - m_popContent = new GUIContent(); - m_popContent.image = UIUtils.PopupIcon; - - m_textLabelWidth = 100; - m_autoWrapProperties = true; - m_insideSize.Set( 80, 25 ); - m_previewShaderGUID = "a58e46feaa5e3d14383bfeac24d008bc"; - } - - public void SetCurrentSelectedInput( int newValue, int prevValue ) - { - m_previousSelectedInput = prevValue; - if( m_validReference ) - m_currentSelectedInput = Mathf.Clamp( newValue, 0, m_refMaxInputs - 1 ); - else - m_currentSelectedInput = Mathf.Clamp( newValue, 0, m_maxAmountInputs - 1 ); - m_outputPorts[ 0 ].ChangeType( m_inputPorts[ m_currentSelectedInput ].DataType, false ); - PreviewIsDirty = true; - ChangeSignalPropagation(); - } - - public int GetCurrentSelectedInput() - { - return m_currentSelectedInput; - } - - - public override void SetPreviewInputs() - { - base.SetPreviewInputs(); - - if( m_cachedPropertyId == -1 ) - m_cachedPropertyId = Shader.PropertyToID( "_Current" ); - - PreviewMaterial.SetInt( m_cachedPropertyId, m_currentSelectedInput ); - } - - protected override void OnUniqueIDAssigned() - { - base.OnUniqueIDAssigned(); - if( m_referenceType == TexReferenceType.Object ) - { - UIUtils.RegisterFunctionSwitchNode( this ); - } - else - { - if( ContainerGraph.ParentWindow.CustomGraph != null ) - UIUtils.RegisterFunctionSwitchNode( this ); - UIUtils.RegisterFunctionSwitchCopyNode( this ); - } - } - - public override void Destroy() - { - base.Destroy(); - - m_functionSwitchReference = null; - m_referenceUniqueId = -1; - - if( m_referenceType == TexReferenceType.Object ) - { - UIUtils.UnregisterFunctionSwitchNode( this ); - } - else - { - UIUtils.UnregisterFunctionSwitchNode( this ); - UIUtils.UnregisterFunctionSwitchCopyNode( this ); - } - } - - public override void OnConnectedOutputNodeChanges( int portId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) - { - base.OnConnectedOutputNodeChanges( portId, otherNodeId, otherPortId, name, type ); - m_inputPorts[ portId ].MatchPortToConnection(); - if( portId == m_currentSelectedInput ) - m_outputPorts[ 0 ].ChangeType( m_inputPorts[ portId ].DataType, false ); - } - - public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) - { - InputPort port = GetInputPortByUniqueId( portId ); - int arrayPos = m_inputPorts.IndexOf( port ); - if( activateNode && m_connStatus == NodeConnectionStatus.Connected && arrayPos == m_currentSelectedInput ) - { - port.GetOutputNode().ActivateNode( m_activeNode, m_activePort, m_activeType ); - } - - OnNodeChange(); - SetSaveIsDirty(); - - m_inputPorts[ portId ].MatchPortToConnection(); - if( arrayPos == m_currentSelectedInput ) - m_outputPorts[ 0 ].ChangeType( m_inputPorts[ portId ].DataType, false ); - } - - public override void ActivateNode( int signalGenNodeId, int signalGenPortId, Type signalGenNodeType ) - { - if( m_selfPowered ) - return; - - ConnStatus = m_restrictions.GetRestiction( signalGenNodeType, signalGenPortId ) ? NodeConnectionStatus.Error : NodeConnectionStatus.Connected; - m_activeConnections += 1; - - m_activeType = signalGenNodeType; - m_activeNode = signalGenNodeId; - m_activePort = signalGenPortId; - if( m_activeConnections == 1 ) - if( m_inputPorts[ m_currentSelectedInput ].IsConnected ) - m_inputPorts[ m_currentSelectedInput ].GetOutputNode().ActivateNode( signalGenNodeId, signalGenPortId, signalGenNodeType ); - - SetSaveIsDirty(); - } - - public override void DeactivateInputPortNode( int deactivatedPort, bool forceComplete ) - { - InputPort port = GetInputPortByUniqueId( deactivatedPort ); - if( deactivatedPort == m_currentSelectedInput ) - port.GetOutputNode().DeactivateNode( deactivatedPort, false ); - } - - public override void DeactivateNode( int deactivatedPort, bool forceComplete ) - { - if( m_selfPowered ) - return; - - SetSaveIsDirty(); - m_activeConnections -= 1; - - if( ( forceComplete || m_activeConnections <= 0 ) ) - { - m_activeConnections = 0; - ConnStatus = NodeConnectionStatus.Not_Connected; - for( int i = 0; i < m_inputPorts.Count; i++ ) - { - if( m_inputPorts[ i ].IsConnected && i == m_currentSelectedInput ) - { - ParentNode node = m_inputPorts[ i ].GetOutputNode(); - if( node != null ) - node.DeactivateNode( deactivatedPort == -1 ? m_inputPorts[ i ].PortId : deactivatedPort, false ); - } - } - } - } - - public void ChangeSignalPropagation() - { - if( m_previousSelectedInput != m_currentSelectedInput && ConnStatus == NodeConnectionStatus.Connected ) - { - if( m_inputPorts[ m_previousSelectedInput ].IsConnected ) - m_inputPorts[ m_previousSelectedInput ].GetOutputNode().DeactivateNode( m_inputPorts[ m_previousSelectedInput ].PortId, false ); - - if( m_inputPorts[ m_currentSelectedInput ].IsConnected ) - m_inputPorts[ m_currentSelectedInput ].GetOutputNode().ActivateNode( UniqueId, m_inputPorts[ m_currentSelectedInput ].PortId, m_activeType ); - } - } - - public bool DrawOption( ParentNode owner, bool forceDraw = false ) - { - if( !IsConnected && !forceDraw ) - { - //EditorGUILayout.LabelField( "Not Connected" ); - return false; - } - - if( m_asDrawn ) //used to prevent the same property to be drawn more than once - return false; - - if( m_validReference ) - { - return m_functionSwitchReference.DrawOption( owner, true ); - } - - int prev = m_currentSelectedInput; - m_asDrawn = true; - if( m_toggleMode ) - { - m_currentSelectedInput = owner.EditorGUILayoutToggle( m_optionLabel, ( m_currentSelectedInput != 0 ? true : false ) ) ? 1 : 0; - - if( m_currentSelectedInput != prev ) - { - SetCurrentSelectedInput( m_currentSelectedInput, prev ); - return true; - } - else - { - return false; - } - } - else - { - m_currentSelectedInput = owner.EditorGUILayoutIntPopup( m_optionLabel, m_currentSelectedInput, AvailableInputsLabels, AvailableInputsValues ); - - if( m_currentSelectedInput != prev ) - { - SetCurrentSelectedInput( m_currentSelectedInput, prev ); - return true; - } - else - { - return false; - } - } - } - - public void CheckReference() - { - if( m_referenceType != TexReferenceType.Instance ) - { - m_validReference = false; - return; - } - - if( m_functionSwitchReference == null ) - { - m_validReference = false; - ResetToSelf(); - return; - } - - if( m_referenceUniqueId != m_functionSwitchReference.UniqueId ) - { - UpdateFromSelected(); - } - if( m_refSelectedInput != m_functionSwitchReference.GetCurrentSelectedInput() || m_refMaxInputs != m_functionSwitchReference.MaxAmountInputs || m_refOptionLabel != m_functionSwitchReference.OptionLabel ) - { - UpdateFromSelected(); - } - - m_validReference = true; - } - - void ResetToSelf() - { - m_functionSwitchReference = null; - m_validReference = false; - m_referenceUniqueId = -1; - m_refMaxInputs = -1; - m_refOptionLabel = string.Empty; - m_refSelectedInput = -1; - - for( int i = 0; i < MaxAllowedAmount; i++ ) - { - m_inputPorts[ i ].Visible = ( i < m_maxAmountInputs ); - m_inputPorts[ i ].Name = m_optionNames[ i ]; - } - - if( m_currentSelectedInput >= m_maxAmountInputs ) - { - m_currentSelectedInput = m_maxAmountInputs - 1; - } - - UpdateLabels(); - m_sizeIsDirty = true; - } - - void UpdateFromSelected() - { - if( m_referenceUniqueId < 0 ) - return; - - m_functionSwitchReference = UIUtils.GetNode( m_referenceUniqueId ) as FunctionSwitch; - if( m_functionSwitchReference != null ) - { - m_validReference = true; - for( int i = 0; i < MaxAllowedAmount; i++ ) - { - m_inputPorts[ i ].Visible = ( i < m_functionSwitchReference.MaxAmountInputs ); - m_inputPorts[ i ].Name = m_functionSwitchReference.InputPorts[ i ].Name; - } - UpdateLabels(); - m_refMaxInputs = m_functionSwitchReference.m_maxAmountInputs; - m_refOptionLabel = m_functionSwitchReference.OptionLabel; - m_refSelectedInput = m_functionSwitchReference.GetCurrentSelectedInput(); - OrderIndex = m_functionSwitchReference.OrderIndex; - - SetCurrentSelectedInput( m_functionSwitchReference.GetCurrentSelectedInput(), m_currentSelectedInput ); - } - - m_sizeIsDirty = true; - m_isDirty = true; - } - - public override void DrawProperties() - { - base.DrawProperties(); - EditorGUI.BeginChangeCheck(); - m_referenceType = (TexReferenceType)EditorGUILayoutPopup( Constants.ReferenceTypeStr, (int)m_referenceType, Constants.ReferenceArrayLabels ); - if( EditorGUI.EndChangeCheck() ) - { - if( m_referenceType == TexReferenceType.Object ) - { - if( ContainerGraph.ParentWindow.CustomGraph == null ) - UIUtils.UnregisterFunctionSwitchCopyNode( this ); - UIUtils.RegisterFunctionSwitchNode( this ); - ResetToSelf(); - } - else - { - if( ContainerGraph.ParentWindow.CustomGraph == null ) - UIUtils.UnregisterFunctionSwitchNode( this ); - UIUtils.RegisterFunctionSwitchCopyNode( this ); - } - } - - if( m_referenceType == TexReferenceType.Instance ) - { - EditorGUI.BeginChangeCheck(); - string[] arr = new string[ UIUtils.FunctionSwitchList().Count ]; - int[] ids = new int[ UIUtils.FunctionSwitchList().Count ]; - for( int i = 0; i < arr.Length; i++ ) - { - arr[ i ] = i + " - " + UIUtils.FunctionSwitchList()[ i ].OptionLabel; - ids[ i ] = UIUtils.FunctionSwitchList()[ i ].UniqueId; - } - m_referenceUniqueId = EditorGUILayout.IntPopup( Constants.AvailableReferenceStr, m_referenceUniqueId, arr, ids ); - if( EditorGUI.EndChangeCheck() ) - { - UpdateFromSelected(); - } - return; - } - - EditorGUI.BeginChangeCheck(); - m_optionLabel = EditorGUILayoutTextField( "Option Label", m_optionLabel ); - if( EditorGUI.EndChangeCheck() ) - { - m_optionLabel = UIUtils.RemoveInvalidEnumCharacters( m_optionLabel ); - if( string.IsNullOrEmpty( m_optionLabel ) ) - { - m_optionLabel = "Option"; - } - - UIUtils.UpdateFunctionSwitchData( UniqueId, m_optionLabel ); - } - - EditorGUI.BeginChangeCheck(); - m_toggleMode = EditorGUILayoutToggle( "Toggle Mode", m_toggleMode ); - if( EditorGUI.EndChangeCheck() ) - { - if( m_toggleMode ) - { - m_inputPorts[ 0 ].Name = ToggleFalseStr; - m_inputPorts[ 1 ].Name = ToggleTrueStr; - - for( int i = 0; i < MaxAllowedAmount; i++ ) - { - m_inputPorts[ i ].Visible = ( i < 2 ); - } - - if( m_currentSelectedInput >= 2 ) - { - m_currentSelectedInput = 1; - } - UpdateLabels(); - m_sizeIsDirty = true; - } - else - { - m_inputPorts[ 0 ].Name = m_optionNames[ 0 ]; - m_inputPorts[ 1 ].Name = m_optionNames[ 1 ]; - - for( int i = 0; i < MaxAllowedAmount; i++ ) - { - m_inputPorts[ i ].Visible = ( i < m_maxAmountInputs ); - } - - if( m_currentSelectedInput >= m_maxAmountInputs ) - { - m_currentSelectedInput = m_maxAmountInputs - 1; - } - - UpdateLabels(); - m_sizeIsDirty = true; - } - } - - if( !m_toggleMode ) - { - EditorGUI.BeginChangeCheck(); - m_maxAmountInputs = EditorGUILayoutIntSlider( MaxAmountStr, m_maxAmountInputs, 2, MaxAllowedAmount ); - if( EditorGUI.EndChangeCheck() ) - { - for( int i = 0; i < MaxAllowedAmount; i++ ) - { - m_inputPorts[ i ].Visible = ( i < m_maxAmountInputs ); - } - - if( m_currentSelectedInput >= m_maxAmountInputs ) - { - m_currentSelectedInput = m_maxAmountInputs - 1; - } - - UpdateLabels(); - m_sizeIsDirty = true; - } - - EditorGUI.indentLevel++; - for( int i = 0; i < m_maxAmountInputs; i++ ) - { - EditorGUI.BeginChangeCheck(); - m_inputPorts[ i ].Name = EditorGUILayoutTextField( "Item " + i, m_inputPorts[ i ].Name ); - if( EditorGUI.EndChangeCheck() ) - { - m_nameModified = true; - m_lastTimeNameModified = EditorApplication.timeSinceStartup; - m_inputPorts[ i ].Name = UIUtils.RemoveInvalidEnumCharacters( m_inputPorts[ i ].Name ); - m_optionNames[ i ] = m_inputPorts[ i ].Name; - if( string.IsNullOrEmpty( m_inputPorts[ i ].Name ) ) - { - m_inputPorts[ i ].Name = InputPortNameStr + i; - } - m_sizeIsDirty = true; - } - } - EditorGUI.indentLevel--; - - if( m_nameModified ) - { - UpdateLabels(); - } - } - - if( m_toggleMode ) - { - EditorGUI.BeginChangeCheck(); - int prevVal = m_currentSelectedInput; - m_currentSelectedInput = EditorGUILayoutToggle( CurrSelectedStr, ( m_currentSelectedInput != 0 ? true : false ) ) ? 1 : 0; - if( EditorGUI.EndChangeCheck() ) - SetCurrentSelectedInput( m_currentSelectedInput, prevVal ); - } - else - { - EditorGUI.BeginChangeCheck(); - int prevVal = m_currentSelectedInput; - m_currentSelectedInput = EditorGUILayoutIntPopup( CurrSelectedStr, m_currentSelectedInput, AvailableInputsLabels, AvailableInputsValues ); - if( EditorGUI.EndChangeCheck() ) - { - SetCurrentSelectedInput( m_currentSelectedInput, prevVal ); - } - } - } - - public override void RefreshExternalReferences() - { - base.RefreshExternalReferences(); - if( UIUtils.CurrentShaderVersion() > 14205 ) - { - if( m_referenceType == TexReferenceType.Instance ) - { - m_functionSwitchReference = UIUtils.GetNode( m_referenceUniqueId ) as FunctionSwitch; - UpdateFromSelected(); - } - } - - SetCurrentSelectedInput( m_currentSelectedInput, m_previousSelectedInput ); - } - - public void UpdateLabels() - { - int maxinputs = m_maxAmountInputs; - if( m_validReference ) - maxinputs = m_functionSwitchReference.MaxAmountInputs; - - AvailableInputsLabels = new string[ maxinputs ]; - AvailableInputsValues = new int[ maxinputs ]; - - for( int i = 0; i < maxinputs; i++ ) - { - AvailableInputsLabels[ i ] = m_optionNames[ i ]; - AvailableInputsValues[ i ] = i; - } - } - - public override void OnNodeLogicUpdate( DrawInfo drawInfo ) - { - base.OnNodeLogicUpdate( drawInfo ); - CheckReference(); - } - - public override void OnNodeLayout( DrawInfo drawInfo ) - { - float finalSize = 0; - if( !m_toggleMode ) - { - GUIContent dropdown = new GUIContent( m_inputPorts[ m_currentSelectedInput ].Name ); - int cacheSize = UIUtils.GraphDropDown.fontSize; - UIUtils.GraphDropDown.fontSize = 10; - Vector2 calcSize = UIUtils.GraphDropDown.CalcSize( dropdown ); - UIUtils.GraphDropDown.fontSize = cacheSize; - finalSize = Mathf.Clamp( calcSize.x, MinComboSize, MaxComboSize ); - if( m_insideSize.x != finalSize ) - { - m_insideSize.Set( finalSize, 25 ); - m_sizeIsDirty = true; - } - } - - base.OnNodeLayout( drawInfo ); - - bool toggleMode = m_toggleMode; - if( m_validReference ) - { - toggleMode = m_functionSwitchReference.m_toggleMode; - } - - if( toggleMode ) - { - m_varRect = m_remainingBox; - m_varRect.size = Vector2.one * 22 * drawInfo.InvertedZoom; - m_varRect.center = m_remainingBox.center; - if( m_showPreview ) - m_varRect.y = m_remainingBox.y; - } - else - { - m_varRect = m_remainingBox; - m_varRect.width = finalSize * drawInfo.InvertedZoom; - m_varRect.height = 16 * drawInfo.InvertedZoom; - m_varRect.x = m_remainingBox.xMax - m_varRect.width; - m_varRect.y += 1 * drawInfo.InvertedZoom; - - m_imgRect = m_varRect; - m_imgRect.x = m_varRect.xMax - 16 * drawInfo.InvertedZoom; - m_imgRect.width = 16 * drawInfo.InvertedZoom; - m_imgRect.height = m_imgRect.width; - } - } - - public override void DrawGUIControls( DrawInfo drawInfo ) - { - if( m_validReference ) - { - base.DrawGUIControls( drawInfo ); - } - else - { - base.DrawGUIControls( drawInfo ); - - if( drawInfo.CurrentEventType != EventType.MouseDown ) - return; - - if( m_varRect.Contains( drawInfo.MousePosition ) ) - { - m_editing = true; - } - else if( m_editing ) - { - m_editing = false; - } - } - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - - if( m_nameModified ) - { - if( ( EditorApplication.timeSinceStartup - m_lastTimeNameModified ) > MaxTimestamp ) - { - m_nameModified = false; - } - } - - if( m_validReference ) - { - SetAdditonalTitleTextOnCallback( m_functionSwitchReference.OptionLabel, ( instance, newSubTitle ) => instance.AdditonalTitleContent.text = string.Format( Constants.SubTitleVarNameFormatStr, newSubTitle ) ); - } - else - { - SetAdditonalTitleTextOnCallback( m_optionLabel, ( instance, newSubTitle ) => instance.AdditonalTitleContent.text = string.Format( Constants.SubTitleValueFormatStr, newSubTitle ) ); - - if( m_editing ) - { - if( m_toggleMode ) - { - if( GUI.Button( m_varRect, GUIContent.none, UIUtils.GraphButton ) ) - { - PreviewIsDirty = true; - int prevVal = m_currentSelectedInput; - m_currentSelectedInput = m_currentSelectedInput == 1 ? 0 : 1; - if( m_currentSelectedInput != prevVal ) - SetCurrentSelectedInput( m_currentSelectedInput, prevVal ); - m_editing = false; - } - - if( m_currentSelectedInput == 1 ) - { - GUI.Label( m_varRect, m_checkContent, UIUtils.GraphButtonIcon ); - } - } - else - { - EditorGUI.BeginChangeCheck(); - int prevVal = m_currentSelectedInput; - m_currentSelectedInput = EditorGUIIntPopup( m_varRect, m_currentSelectedInput, AvailableInputsLabels, AvailableInputsValues, UIUtils.GraphDropDown ); - if( EditorGUI.EndChangeCheck() ) - { - PreviewIsDirty = true; - SetCurrentSelectedInput( m_currentSelectedInput, prevVal ); - m_editing = false; - } - } - } - } - - } - - public override void OnNodeRepaint( DrawInfo drawInfo ) - { - base.OnNodeRepaint( drawInfo ); - - if( !m_isVisible ) - return; - - if( ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD2 ) - { - if( m_validReference ) - { - bool cacheState = GUI.enabled; - GUI.enabled = false; - if( m_functionSwitchReference.m_toggleMode ) - { - GUI.Label( m_varRect, GUIContent.none, UIUtils.GraphButton ); - if( m_functionSwitchReference.GetCurrentSelectedInput() == 1 ) - { - GUI.Label( m_varRect, m_checkContent, UIUtils.GraphButtonIcon ); - } - } - else - { - GUI.Label( m_varRect, m_functionSwitchReference.AvailableInputsLabels[ m_currentSelectedInput ], UIUtils.GraphDropDown ); - } - GUI.enabled = cacheState; - } - else - { - if( !m_editing ) - { - if( m_toggleMode ) - { - GUI.Label( m_varRect, GUIContent.none, UIUtils.GraphButton ); - - if( m_currentSelectedInput == 1 ) - { - GUI.Label( m_varRect, m_checkContent, UIUtils.GraphButtonIcon ); - } - } - else - { - GUI.Label( m_varRect, AvailableInputsLabels[ m_currentSelectedInput ], UIUtils.GraphDropDown ); - GUI.Label( m_imgRect, m_popContent, UIUtils.GraphButtonIcon ); - } - } - } - } - } - - public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) - { - m_inputPorts[ m_currentSelectedInput ].GetOutputNode().PropagateNodeData( nodeData, ref dataCollector ); - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - return m_inputPorts[ m_currentSelectedInput ].GeneratePortInstructions( ref dataCollector ); - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - m_optionLabel = GetCurrentParam( ref nodeParams ); - m_toggleMode = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - m_currentSelectedInput = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - m_previousSelectedInput = m_currentSelectedInput; - m_maxAmountInputs = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - m_orderIndex = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - - for( int i = 0; i < MaxAllowedAmount; i++ ) - { - m_inputPorts[ i ].Visible = ( i < m_maxAmountInputs ); - } - - if( m_currentSelectedInput >= m_maxAmountInputs ) - { - m_currentSelectedInput = m_maxAmountInputs - 1; - } - - for( int i = 0; i < m_maxAmountInputs; i++ ) - { - m_optionNames[ i ] = GetCurrentParam( ref nodeParams ); - m_inputPorts[ i ].Name = m_optionNames[ i ]; - } - - if( m_toggleMode ) - { - m_inputPorts[ 0 ].Name = ToggleFalseStr; - m_inputPorts[ 1 ].Name = ToggleTrueStr; - } - - UpdateLabels(); - m_sizeIsDirty = true; - - UIUtils.UpdateFunctionSwitchData( UniqueId, m_optionLabel ); - UIUtils.UpdateFunctionSwitchCopyData( UniqueId, m_optionLabel ); - if( UIUtils.CurrentShaderVersion() > 14205 ) - { - m_referenceType = (TexReferenceType)Enum.Parse( typeof( TexReferenceType ), GetCurrentParam( ref nodeParams ) ); - m_referenceUniqueId = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - - if( m_referenceType == TexReferenceType.Object ) - { - if( ContainerGraph.ParentWindow.CustomGraph == null ) - UIUtils.UnregisterFunctionSwitchCopyNode( this ); - UIUtils.RegisterFunctionSwitchNode( this ); - ResetToSelf(); - } - else - { - if( ContainerGraph.ParentWindow.CustomGraph == null ) - UIUtils.UnregisterFunctionSwitchNode( this ); - UIUtils.RegisterFunctionSwitchCopyNode( this ); - } - } - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_optionLabel ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_toggleMode ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_currentSelectedInput ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_maxAmountInputs ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_orderIndex ); - - for( int i = 0; i < m_maxAmountInputs; i++ ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_optionNames[ i ] ); - } - - IOUtils.AddFieldValueToString( ref nodeInfo, m_referenceType ); - IOUtils.AddFieldValueToString( ref nodeInfo, ( m_functionSwitchReference != null ? m_functionSwitchReference.UniqueId : -1 ) ); - } - - public int OrderIndex - { - get { return m_orderIndex; } - set { m_orderIndex = value; } - } - - public string OptionLabel - { - get { return m_optionLabel; } - set { m_optionLabel = value; } - } - - public bool AsDrawn { get { return m_asDrawn; } set { m_asDrawn = value; } } - - public override string DataToArray { get { return m_optionLabel; } } - public int MaxAmountInputs - { - get { return m_maxAmountInputs; } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionSwitch.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionSwitch.cs.meta deleted file mode 100644 index 8929a454..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionSwitch.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 2bd66b9ffd0acf84ab46c9f83300495c -timeCreated: 1515408158 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionSwitchByPipeline.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionSwitchByPipeline.cs deleted file mode 100644 index 5a05605e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionSwitchByPipeline.cs +++ /dev/null @@ -1,102 +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( "Switch by Pipeline", "Functions", "Executes branch according to current pipeline", NodeAvailabilityFlags = (int)NodeAvailability.ShaderFunction )] - public sealed class FunctionSwitchByPipeline : ParentNode - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT, false, "Surface", -1, MasterNodePortCategory.Fragment, 0 ); - AddInputPort( WirePortDataType.FLOAT, false, "Default RP", -1, MasterNodePortCategory.Fragment, 3 ); - AddInputPort( WirePortDataType.FLOAT, false, "Lightweight", -1, MasterNodePortCategory.Fragment, 1 ); - AddInputPort( WirePortDataType.FLOAT, false, "HD", -1, MasterNodePortCategory.Fragment, 2 ); - AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); - - } - - public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) - { - base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); - GetInputPortByUniqueId( portId ).MatchPortToConnection(); - UpdateOutputPort(); - } - - public override void OnConnectedOutputNodeChanges( int outputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) - { - base.OnConnectedOutputNodeChanges( outputPortId, otherNodeId, otherPortId, name, type ); - GetInputPortByUniqueId( outputPortId ).MatchPortToConnection(); - UpdateOutputPort(); - } - - void UpdateOutputPort() - { - switch( UIUtils.CurrentWindow.OutsideGraph.CurrentSRPType ) - { - case TemplateSRPType.BuiltIn: - { - InputPort port = UIUtils.CurrentWindow.OutsideGraph.IsStandardSurface ? GetInputPortByUniqueId( 0 ) : GetInputPortByUniqueId( 3 ); - m_outputPorts[ 0 ].ChangeType( port.DataType, false ); - } - break; - case TemplateSRPType.Lightweight: - { - InputPort port = GetInputPortByUniqueId( 1 ); - m_outputPorts[ 0 ].ChangeType( port.DataType, false ); - } - break; - case TemplateSRPType.HD: - { - InputPort port = GetInputPortByUniqueId( 2 ); - m_outputPorts[ 0 ].ChangeType( port.DataType, false ); - } - break; - } - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); - switch( dataCollector.CurrentSRPType ) - { - case TemplateSRPType.BuiltIn: - { - InputPort port = UIUtils.CurrentWindow.OutsideGraph.IsStandardSurface ? GetInputPortByUniqueId( 0 ) : GetInputPortByUniqueId( 3 ); - return port.GeneratePortInstructions( ref dataCollector ); - } - case TemplateSRPType.Lightweight: - { - InputPort port = GetInputPortByUniqueId( 1 ); - return port.GeneratePortInstructions( ref dataCollector ); - } - case TemplateSRPType.HD: - { - InputPort port = GetInputPortByUniqueId( 2 ); - return port.GeneratePortInstructions( ref dataCollector ); - } - } - - return "0"; - } - - public override void RefreshExternalReferences() - { - base.RefreshExternalReferences(); - if( UIUtils.CurrentShaderVersion() < 16303 ) - { - InputPort standardPort = GetInputPortByUniqueId( 0 ); - if( standardPort.IsConnected ) - { - UIUtils.SetConnection( UniqueId, 3, standardPort.GetConnection().NodeId, standardPort.GetConnection().PortId ); - } - } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionSwitchByPipeline.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionSwitchByPipeline.cs.meta deleted file mode 100644 index 9ecd8080..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/FunctionSwitchByPipeline.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 84a4868e0b1e8dd4bb0e71c8d9a9c130 -timeCreated: 1535365719 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/LogNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/LogNode.cs deleted file mode 100644 index d431cbb8..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/LogNode.cs +++ /dev/null @@ -1,80 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEngine; -using UnityEditor; - -namespace AmplifyShaderEditor -{ - [System.Serializable] - [NodeAttributes( "Log", "Master", "Debug node to dump output to log", null, KeyCode.None, false )] - public sealed class LogNode : MasterNode - { - private const string InputAmountStr = "Input amount"; - - [SerializeField] - private int m_inputCount = 1; - - [SerializeField] - private int m_lastInputCount = 1; - - public LogNode() : base() { } - public LogNode( int uniqueId, float x, float y, float width, float height ) : base( uniqueId, x, y, width, height ) { } - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddMasterPorts(); - } - - public override void AddMasterPorts() - { - DeleteAllInputConnections( true ); - base.AddMasterPorts(); - - for ( int i = 0; i < m_inputCount; i++ ) - { - AddInputPort( WirePortDataType.OBJECT, false, i.ToString() ); - } - m_sizeIsDirty = true; - } - - public override void DrawProperties() - { - base.DrawProperties(); - EditorGUILayout.BeginVertical(); - { - EditorGUILayout.LabelField( InputAmountStr ); - m_inputCount = EditorGUILayoutIntField( m_inputCount ); - } - EditorGUILayout.EndVertical(); - if ( m_inputCount != m_lastInputCount ) - { - m_lastInputCount = Mathf.Max( m_inputCount, 1 ); - AddMasterPorts(); - } - } - - public override void Execute( Shader currentSelected ) - { - string valueDump = ""; - string valueInstructions = ""; - - MasterNodeDataCollector dataCollector = new MasterNodeDataCollector( this ); - foreach ( InputPort port in InputPorts ) - { - if ( port.IsConnected ) - { - valueInstructions += "Port: " + port.PortId + " Value: " + port.GenerateShaderForOutput( ref dataCollector, port.DataType, false ); - } - } - Debug.Log( "Value: " + valueDump ); - Debug.Log( "Instructions: " + valueInstructions ); - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - } - - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/LogNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/LogNode.cs.meta deleted file mode 100644 index d2debabc..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/LogNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 3b0e734d4c354c74999e20ce054628d2 -timeCreated: 1481126955 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/MasterNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/MasterNode.cs deleted file mode 100644 index 5e4ec937..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/MasterNode.cs +++ /dev/null @@ -1,979 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using System.Collections.Generic; -using UnityEngine; -using UnityEditor; -using UnityEditorInternal; - -namespace AmplifyShaderEditor -{ - public enum PrecisionType - { - Float = 0, - Half, - Inherit - } - - public enum AvailableShaderTypes - { - SurfaceShader = 0, - Template - } - - [Serializable] - public class MasterNodeCategoriesData - { - public AvailableShaderTypes Category; - public string Name; - public MasterNodeCategoriesData( AvailableShaderTypes category, string name ) { Category = category; Name = name; } - } - - [Serializable] - public class MasterNode : OutputNode - { - protected const string CustomInspectorStr = "Custom Editor"; - protected const string CustomInspectorFormat = "CustomEditor \"{0}\""; - - private const string PropertyOrderFoldoutStr = " Material Properties"; - private const string PropertyOrderTemplateFoldoutStr = "Material Properties"; - - protected MasterNodeDataCollector m_currentDataCollector; - - protected const string ShaderNameStr = "Shader Name"; - protected GUIContent m_shaderNameContent; - - private const string IndentationHelper = "\t\t{0}\n"; - private const string ShaderLODFormat = "\t\tLOD {0}\n"; - - public delegate void OnMaterialUpdated( MasterNode masterNode ); - public event OnMaterialUpdated OnMaterialUpdatedEvent; - public event OnMaterialUpdated OnShaderUpdatedEvent; - - protected const string GeneralFoldoutStr = " General"; - - protected readonly string[] ShaderModelTypeArr = { "2.0", "2.5", "3.0", "3.5", "4.0", "4.5", "4.6", "5.0" }; - private const string ShaderKeywordsStr = "Shader Keywords"; - - [SerializeField] - protected int m_shaderLOD = 0; - - [SerializeField] - protected int m_shaderModelIdx = 2; - - [SerializeField] - protected Shader m_currentShader; - - [SerializeField] - protected Material m_currentMaterial; - - //[SerializeField] - //private bool m_isMainMasterNode = false; - - [SerializeField] - private Rect m_masterNodeIconCoords; - - [SerializeField] - protected string m_shaderName = Constants.DefaultShaderName; - - [SerializeField] - protected string m_croppedShaderName = Constants.DefaultShaderName; - - [SerializeField] - protected string m_customInspectorName = Constants.DefaultCustomInspector; - - [SerializeField] - protected int m_masterNodeCategory = 0;// MasterNodeCategories.SurfaceShader; - - [SerializeField] - protected string m_currentShaderData = string.Empty; - - private Texture2D m_masterNodeOnTex; - private Texture2D m_masterNodeOffTex; - - private Texture2D m_gpuInstanceOnTex; - private Texture2D m_gpuInstanceOffTex; - - // Shader Keywords - [SerializeField] - private List<string> m_shaderKeywords = new List<string>(); - - [SerializeField] - private bool m_shaderKeywordsFoldout = true; - - private GUIStyle m_addShaderKeywordStyle; - private GUIStyle m_removeShaderKeywordStyle; - private GUIStyle m_smallAddShaderKeywordItemStyle; - private GUIStyle m_smallRemoveShaderKeywordStyle; - private const float ShaderKeywordButtonLayoutWidth = 15; - - - public MasterNode() : base() { CommonInit(); } - public MasterNode( int uniqueId, float x, float y, float width, float height ) : base( uniqueId, x, y, width, height ) { CommonInit(); } - - protected GUIContent m_categoryLabel = new GUIContent( "Shader Type ", "Specify the shader type you want to be working on" ); - - protected GUIContent[] m_availableCategoryLabels; - protected MasterNodeCategoriesData[] m_availableCategories; - - [SerializeField] - private List<PropertyNode> m_propertyNodesVisibleList = new List<PropertyNode>(); - - private ReorderableList m_propertyReordableList; - protected bool m_propertyOrderChanged = false; - //private int m_availableCount = 0; - private int m_lastCount = 0; - - private GUIStyle m_propertyAdjustment; - protected bool m_shaderNameIsTitle = true; - - void CommonInit() - { - m_currentMaterial = null; - m_masterNodeIconCoords = new Rect( 0, 0, 64, 64 ); - m_isMainOutputNode = false; - m_connStatus = NodeConnectionStatus.Connected; - m_activeType = GetType(); - m_currentPrecisionType = PrecisionType.Float; - m_textLabelWidth = 120; - m_shaderNameContent = new GUIContent( ShaderNameStr, string.Empty ); - - AddMasterPorts(); - } - - void InitAvailableCategories() - { - int templateCount = m_containerGraph.ParentWindow.TemplatesManagerInstance.TemplateCount; - m_availableCategories = new MasterNodeCategoriesData[ templateCount + 1 ]; - m_availableCategoryLabels = new GUIContent[ templateCount + 1 ]; - - m_availableCategories[ 0 ] = new MasterNodeCategoriesData( AvailableShaderTypes.SurfaceShader, string.Empty ); - m_availableCategoryLabels[ 0 ] = new GUIContent( "Surface" ); - - for( int i = 0; i < templateCount; i++ ) - { - int idx = i + 1; - TemplateDataParent templateData = m_containerGraph.ParentWindow.TemplatesManagerInstance.GetTemplate( i ); - m_availableCategories[ idx ] = new MasterNodeCategoriesData( AvailableShaderTypes.Template, templateData.GUID ); - m_availableCategoryLabels[ idx ] = new GUIContent( templateData.Name ); - } - } - - public void SetMasterNodeCategoryFromGUID( string GUID ) - { - if( m_availableCategories == null ) - InitAvailableCategories(); - - m_masterNodeCategory = 0; - for( int i = 1; i < m_availableCategories.Length; i++ ) - { - if( m_availableCategories[ i ].Name.Equals( GUID ) ) - m_masterNodeCategory = i; - } - - } - - public override void SetupNodeCategories() - { - //base.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 m_currentDataCollector ); - } - else if( m_inputPorts[ i ].HasExternalLink ) - { - InputPort linkedPort = m_inputPorts[ i ].ExternalLink; - if( linkedPort != null && linkedPort.IsConnected ) - { - NodeData nodeData = new NodeData( linkedPort.Category ); - ParentNode node = linkedPort.GetOutputNode(); - node.PropagateNodeData( nodeData, ref m_currentDataCollector ); - } - } - } - } - - public virtual void RefreshAvailableCategories() - { - InitAvailableCategories(); - } - - public virtual void AddMasterPorts() { } - - public virtual void ForcePortType() { } - - public virtual void UpdateMasterNodeMaterial( Material material ) { } - - public virtual void SetName( string name ) { } - - public void CopyFrom( MasterNode other ) - { - Vec2Position = other.Vec2Position; - CurrentShader = other.CurrentShader; - CurrentMaterial = other.CurrentMaterial; - ShaderName = other.ShaderName; - m_masterNodeCategory = other.CurrentMasterNodeCategoryIdx; - } - - protected void DrawCurrentShaderType() - { - if( m_availableCategories == null ) - InitAvailableCategories(); - - int oldType = m_masterNodeCategory; - m_masterNodeCategory = EditorGUILayoutPopup( m_categoryLabel, m_masterNodeCategory, m_availableCategoryLabels ); - if( oldType != m_masterNodeCategory ) - { - m_containerGraph.ParentWindow.ReplaceMasterNode( m_availableCategories[ m_masterNodeCategory ], false ); - } - } - - protected void DrawCustomInspector( bool dropdown ) - { -#if !UNITY_2018_3_OR_NEWER - dropdown = false; -#else - if( ASEPackageManagerHelper.CurrentHDVersion <= ASESRPVersions.ASE_SRP_5_16_1 ) - dropdown = false; -#endif - - EditorGUILayout.BeginHorizontal(); - m_customInspectorName = EditorGUILayoutTextField( CustomInspectorStr, m_customInspectorName ); - if( !dropdown ) - { - if( GUILayoutButton( string.Empty, UIUtils.GetCustomStyle( CustomStyle.ResetToDefaultInspectorButton ), GUILayout.Width( 15 ), GUILayout.Height( 15 ) ) ) - { - GUIUtility.keyboardControl = 0; - m_customInspectorName = Constants.DefaultCustomInspector; - } - } - else - { - if( GUILayoutButton( string.Empty, UIUtils.InspectorPopdropdownFallback, GUILayout.Width( 17 ), GUILayout.Height( 19 ) ) ) - { - EditorGUI.FocusTextInControl( null ); - GUI.FocusControl( null ); - - GenericMenu menu = new GenericMenu(); - AddMenuItem( menu, Constants.DefaultCustomInspector ); -#if UNITY_2018_3_OR_NEWER - if( ASEPackageManagerHelper.CurrentHDVersion > ASESRPVersions.ASE_SRP_6_9_1 ) - { - AddMenuItem( menu, "UnityEditor.Rendering.HighDefinition.HDLitGUI" ); - AddMenuItem( menu, "UnityEditor.ShaderGraph.PBRMasterGUI" ); - } - else - { - AddMenuItem( menu, "UnityEditor.Experimental.Rendering.HDPipeline.HDLitGUI" ); - } -#else - AddMenuItem( menu, "UnityEditor.Experimental.Rendering.HDPipeline.HDLitGUI" ); -#endif - menu.ShowAsContext(); - } - } - EditorGUILayout.EndHorizontal(); - } - - private void AddMenuItem( GenericMenu menu, string newClass ) - { - menu.AddItem( new GUIContent( newClass ), m_customInspectorName.Equals( newClass ), OnSelection, newClass ); - } - - private void OnSelection( object newClass ) - { - m_customInspectorName = (string)newClass; - } - - protected void DrawShaderName() - { - EditorGUI.BeginChangeCheck(); - string newShaderName = EditorGUILayoutTextField( m_shaderNameContent, m_shaderName ); - if( EditorGUI.EndChangeCheck() ) - { - if( newShaderName.Length > 0 ) - { - newShaderName = UIUtils.RemoveShaderInvalidCharacters( newShaderName ); - } - else - { - newShaderName = Constants.DefaultShaderName; - } - ShaderName = newShaderName; - ContainerGraph.ParentWindow.UpdateTabTitle( ShaderName, true ); - } - m_shaderNameContent.tooltip = m_shaderName; - } - - public void DrawShaderKeywords() - { - if( m_addShaderKeywordStyle == null ) - m_addShaderKeywordStyle = UIUtils.PlusStyle; - - if( m_removeShaderKeywordStyle == null ) - m_removeShaderKeywordStyle = UIUtils.MinusStyle; - - if( m_smallAddShaderKeywordItemStyle == null ) - m_smallAddShaderKeywordItemStyle = UIUtils.PlusStyle; - - if( m_smallRemoveShaderKeywordStyle == null ) - m_smallRemoveShaderKeywordStyle = UIUtils.MinusStyle; - - EditorGUILayout.BeginHorizontal(); - { - m_shaderKeywordsFoldout = EditorGUILayout.Foldout( m_shaderKeywordsFoldout, ShaderKeywordsStr ); - - // Add keyword - if( GUILayout.Button( string.Empty, m_addShaderKeywordStyle ) ) - { - m_shaderKeywords.Insert( 0, "" ); - } - - //Remove keyword - if( GUILayout.Button( string.Empty, m_removeShaderKeywordStyle ) ) - { - m_shaderKeywords.RemoveAt( m_shaderKeywords.Count - 1 ); - } - } - EditorGUILayout.EndHorizontal(); - - if( m_shaderKeywordsFoldout ) - { - EditorGUI.indentLevel += 1; - int itemCount = m_shaderKeywords.Count; - int markedToDelete = -1; - for( int i = 0; i < itemCount; i++ ) - { - EditorGUILayout.BeginHorizontal(); - { - GUILayout.Label( " " ); - // Add new port - if( GUILayoutButton( string.Empty, m_smallAddShaderKeywordItemStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) - { - m_shaderKeywords.Insert( i, "" ); - } - - //Remove port - if( GUILayoutButton( string.Empty, m_smallRemoveShaderKeywordStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) - { - markedToDelete = i; - } - } - EditorGUILayout.EndHorizontal(); - } - if( markedToDelete > -1 ) - { - m_shaderKeywords.RemoveAt( markedToDelete ); - } - EditorGUI.indentLevel -= 1; - } - } - - public override void Draw( DrawInfo drawInfo ) - { - if( m_availableCategories == null ) - InitAvailableCategories(); - - base.Draw( drawInfo ); - } - - public override void OnNodeRepaint( DrawInfo drawInfo ) - { - base.OnNodeRepaint( drawInfo ); - - if( m_isMainOutputNode ) - { - if( m_masterNodeOnTex == null ) - { - m_masterNodeOnTex = UIUtils.MasterNodeOnTexture; - } - - if( m_masterNodeOffTex == null ) - { - m_masterNodeOffTex = UIUtils.MasterNodeOffTexture; - } - - if( m_gpuInstanceOnTex == null ) - { - m_gpuInstanceOnTex = UIUtils.GPUInstancedOnTexture; - } - - if( m_gpuInstanceOffTex == null ) - { - m_gpuInstanceOffTex = UIUtils.GPUInstancedOffTexture; - } - - m_masterNodeIconCoords = m_globalPosition; - m_masterNodeIconCoords.x += m_globalPosition.width - m_masterNodeOffTex.width * drawInfo.InvertedZoom; - m_masterNodeIconCoords.y += m_globalPosition.height - m_masterNodeOffTex.height * drawInfo.InvertedZoom; - m_masterNodeIconCoords.width = m_masterNodeOffTex.width * drawInfo.InvertedZoom; - m_masterNodeIconCoords.height = m_masterNodeOffTex.height * drawInfo.InvertedZoom; - - GUI.DrawTexture( m_masterNodeIconCoords, m_masterNodeOffTex ); - - if( m_gpuInstanceOnTex == null ) - { - m_gpuInstanceOnTex = UIUtils.GPUInstancedOnTexture; - } - } - } - - protected void DrawInstancedIcon( DrawInfo drawInfo ) - { - if( m_gpuInstanceOffTex == null || drawInfo.CurrentEventType != EventType.Repaint ) - return; - - m_masterNodeIconCoords = m_globalPosition; - m_masterNodeIconCoords.x += m_globalPosition.width - 5 - m_gpuInstanceOffTex.width * drawInfo.InvertedZoom; - m_masterNodeIconCoords.y += m_headerPosition.height; - m_masterNodeIconCoords.width = m_gpuInstanceOffTex.width * drawInfo.InvertedZoom; - m_masterNodeIconCoords.height = m_gpuInstanceOffTex.height * drawInfo.InvertedZoom; - GUI.DrawTexture( m_masterNodeIconCoords, m_gpuInstanceOffTex ); - } - //public override void DrawProperties() - //{ - // base.DrawProperties(); - // //EditorGUILayout.LabelField( _shaderTypeLabel ); - //} - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - //IOUtils.AddFieldValueToString( ref nodeInfo, m_isMainMasterNode ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_shaderModelIdx ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_customInspectorName ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_shaderLOD ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_masterNodeCategory ); - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - if( UIUtils.CurrentShaderVersion() > 21 ) - { - m_shaderModelIdx = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - if( UIUtils.CurrentShaderVersion() < 17005 ) - { - string val = GetCurrentParam( ref nodeParams ); - if( m_customPrecision ) - { - if( val.Equals( "Fixed" ) ) - m_currentPrecisionType = PrecisionType.Half; - else - m_currentPrecisionType = (PrecisionType)Enum.Parse( typeof( PrecisionType ), val ); - } - else - { - m_currentPrecisionType = PrecisionType.Inherit; - } - } - } - - if( UIUtils.CurrentShaderVersion() > 2404 ) - { - m_customInspectorName = GetCurrentParam( ref nodeParams ); - } - - if( UIUtils.CurrentShaderVersion() > 6101 ) - { - ShaderLOD = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - } - - if( UIUtils.CurrentShaderVersion() >= 13001 ) - { - //Debug.LogWarning( "Add correct version as soon as it is merged into master" ); - m_masterNodeCategory = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - } - } - - public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) - { - if( activateNode ) - { - InputPort port = GetInputPortByUniqueId( portId ); - port.GetOutputNode().ActivateNode( UniqueId, portId, m_activeType ); - } - } - - public void FireMaterialChangedEvt() - { - if( OnMaterialUpdatedEvent != null ) - { - OnMaterialUpdatedEvent( this ); - } - } - - public void FireShaderChangedEvt() - { - if( OnShaderUpdatedEvent != null ) - OnShaderUpdatedEvent( this ); - } - - public void RegisterStandaloneFuntions() - { - List<CustomExpressionNode> nodes = m_containerGraph.CustomExpressionOnFunctionMode.NodesList; - int count = nodes.Count; - Dictionary<int, CustomExpressionNode> examinedNodes = new Dictionary<int, CustomExpressionNode>(); - for( int i = 0; i < count; i++ ) - { - if( nodes[ i ].AutoRegisterMode ) - { - nodes[ i ].CheckDependencies( ref m_currentDataCollector, ref examinedNodes ); - } - } - examinedNodes.Clear(); - examinedNodes = null; - } - - // What operation this node does - public virtual void Execute( Shader selectedShader ) - { - Execute( AssetDatabase.GetAssetPath( selectedShader ), false ); - } - - public virtual Shader Execute( string pathname, bool isFullPath ) - { - ContainerGraph.ResetNodesLocalVariables(); - m_currentDataCollector = new MasterNodeDataCollector( this ); - return null; - } - - protected void SortInputPorts( ref List<InputPort> vertexPorts, ref List<InputPort> fragmentPorts ) - { - for( int i = 0; i < m_inputPorts.Count; i++ ) - { - if( m_inputPorts[ i ].Category == MasterNodePortCategory.Fragment || m_inputPorts[ i ].Category == MasterNodePortCategory.Debug ) - { - if( fragmentPorts != null ) - fragmentPorts.Add( m_inputPorts[ i ] ); - } - else - { - if( vertexPorts != null ) - vertexPorts.Add( m_inputPorts[ i ] ); - } - } - - if( fragmentPorts.Count > 0 ) - { - fragmentPorts.Sort( ( x, y ) => x.OrderId.CompareTo( y.OrderId ) ); - } - - if( vertexPorts.Count > 0 ) - { - vertexPorts.Sort( ( x, y ) => x.OrderId.CompareTo( y.OrderId ) ); - } - } - - protected void UpdateShaderAsset( ref string pathname, ref string shaderBody, bool isFullPath ) - { - // Generate Graph info - shaderBody += ContainerGraph.ParentWindow.GenerateGraphInfo(); - - //TODO: Remove current SaveDebugShader and uncomment SaveToDisk as soon as pathname is editable - if( !String.IsNullOrEmpty( pathname ) ) - { - IOUtils.StartSaveThread( shaderBody, ( isFullPath ? pathname : ( IOUtils.dataPath + pathname ) ) ); - } - else - { - IOUtils.StartSaveThread( shaderBody, Application.dataPath + "/AmplifyShaderEditor/Samples/Shaders/" + m_shaderName + ".shader" ); - } - - - if( CurrentShader == null ) - { - AssetDatabase.Refresh( ImportAssetOptions.ForceUpdate ); - CurrentShader = Shader.Find( ShaderName ); - } - //else - //{ - // // need to always get asset datapath because a user can change and asset location from the project window - // AssetDatabase.ImportAsset( AssetDatabase.GetAssetPath( m_currentShader ) ); - // //ShaderUtil.UpdateShaderAsset( m_currentShader, ShaderBody ); - // //ShaderImporter importer = (ShaderImporter)ShaderImporter.GetAtPath( AssetDatabase.GetAssetPath( CurrentShader ) ); - // //importer.SaveAndReimport(); - //} - - if( m_currentShader != null ) - { - m_currentDataCollector.UpdateShaderImporter( ref m_currentShader ); - if( m_currentMaterial != null ) - { - if( m_currentMaterial.shader != m_currentShader ) - m_currentMaterial.shader = m_currentShader; - - //m_currentDataCollector.UpdateMaterialOnPropertyNodes( m_currentMaterial ); - //This master node UpdateMaterial is needed on Standard Surface node to update its internal properties - UpdateMaterial( m_currentMaterial ); - - UIUtils.CurrentWindow.OutsideGraph.UpdateMaterialOnPropertyNodes( m_currentMaterial ); - - FireMaterialChangedEvt(); - // need to always get asset datapath because a user can change and asset location from the project window - //AssetDatabase.ImportAsset( AssetDatabase.GetAssetPath( m_currentMaterial ) ); - } - - } - - m_currentDataCollector.Destroy(); - m_currentDataCollector = null; - } - - - public void InvalidateMaterialPropertyCount() - { - m_lastCount = -1; - } - - private void RefreshVisibleList( ref List<PropertyNode> allNodes ) - { - // temp reference for lambda expression - List<PropertyNode> nodes = allNodes; - m_propertyNodesVisibleList.Clear(); - - for( int i = 0; i < nodes.Count; i++ ) - { - ReordenatorNode rnode = nodes[ i ] as ReordenatorNode; - if( ( rnode == null || !rnode.IsInside ) && ( !m_propertyNodesVisibleList.Exists( x => x.PropertyName.Equals( nodes[ i ].PropertyName ) ) ) ) - m_propertyNodesVisibleList.Add( nodes[ i ] ); - } - - m_propertyNodesVisibleList.Sort( ( x, y ) => { return x.OrderIndex.CompareTo( y.OrderIndex ); } ); - } - - public void DrawMaterialInputs( GUIStyle toolbarstyle, bool style = true ) - { - m_propertyOrderChanged = false; - Color cachedColor = GUI.color; - GUI.color = new Color( cachedColor.r, cachedColor.g, cachedColor.b, 0.5f ); - EditorGUILayout.BeginHorizontal( toolbarstyle ); - GUI.color = cachedColor; - - EditorGUI.BeginChangeCheck(); - if( style ) - { - ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedProperties = GUILayoutToggle( ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedProperties, PropertyOrderFoldoutStr, UIUtils.MenuItemToggleStyle ); - } - else - { - ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedProperties = GUILayoutToggle( ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedProperties, PropertyOrderTemplateFoldoutStr, UIUtils.MenuItemToggleStyle ); - } - - if( EditorGUI.EndChangeCheck() ) - { - EditorPrefs.SetBool( "ExpandedProperties", ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedProperties ); - } - - EditorGUILayout.EndHorizontal(); - if( !ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedProperties ) - return; - - cachedColor = GUI.color; - GUI.color = new Color( cachedColor.r, cachedColor.g, cachedColor.b, ( EditorGUIUtility.isProSkin ? 0.5f : 0.25f ) ); - EditorGUILayout.BeginVertical( UIUtils.MenuItemBackgroundStyle ); - GUI.color = cachedColor; - - List<PropertyNode> nodes = UIUtils.PropertyNodesList(); - - if( nodes.Count != m_lastCount ) - { - RefreshVisibleList( ref nodes ); - m_lastCount = nodes.Count; - } - - if( m_propertyReordableList == null ) - { - m_propertyReordableList = new ReorderableList( m_propertyNodesVisibleList, typeof( PropertyNode ), true, false, false, false ) - { - headerHeight = 0, - footerHeight = 0, - showDefaultBackground = false, - - drawElementCallback = ( Rect rect, int index, bool isActive, bool isFocused ) => - { - var first = rect; - first.width *= 0.60f; - EditorGUI.LabelField( first, m_propertyNodesVisibleList[ index ].PropertyInspectorName ); - var second = rect; - second.width *= 0.4f; - second.x += first.width; - if( GUI.Button( second, m_propertyNodesVisibleList[ index ].PropertyName, new GUIStyle( "AssetLabel Partial" ) ) ) - { - UIUtils.FocusOnNode( m_propertyNodesVisibleList[ index ], 1, false ); - } - }, - - onReorderCallback = ( list ) => - { - ReorderList( ref nodes ); - m_propertyOrderChanged = true; - //RecursiveLog(); - } - }; - ReorderList( ref nodes ); - } - - if( m_propertyReordableList != null ) - { - if( m_propertyAdjustment == null ) - { - m_propertyAdjustment = new GUIStyle(); - m_propertyAdjustment.padding.left = 17; - } - EditorGUILayout.BeginVertical( m_propertyAdjustment ); - m_propertyReordableList.DoLayoutList(); - EditorGUILayout.EndVertical(); - } - EditorGUILayout.EndVertical(); - } - - public void ForceReordering() - { - List<PropertyNode> nodes = UIUtils.PropertyNodesList(); - - if( nodes.Count != m_lastCount ) - { - RefreshVisibleList( ref nodes ); - m_lastCount = nodes.Count; - } - - ReorderList( ref nodes ); - //RecursiveLog(); - } - - private void RecursiveLog() - { - List<PropertyNode> nodes = UIUtils.PropertyNodesList(); - nodes.Sort( ( x, y ) => { return x.OrderIndex.CompareTo( y.OrderIndex ); } ); - for( int i = 0; i < nodes.Count; i++ ) - { - if( ( nodes[ i ] is ReordenatorNode ) ) - ( nodes[ i ] as ReordenatorNode ).RecursiveLog(); - else - Debug.Log( nodes[ i ].OrderIndex + " " + nodes[ i ].PropertyName ); - } - } - - private void ReorderList( ref List<PropertyNode> nodes ) - { - // clear lock list before reordering because of multiple sf being used - for( int i = 0; i < nodes.Count; i++ ) - { - ReordenatorNode rnode = nodes[ i ] as ReordenatorNode; - if( rnode != null ) - rnode.RecursiveClear(); - } - - int propoffset = 0; - int count = 0; - for( int i = 0; i < m_propertyNodesVisibleList.Count; i++ ) - { - ReordenatorNode renode = m_propertyNodesVisibleList[ i ] as ReordenatorNode; - if( renode != null ) - { - if( !renode.IsInside ) - { - m_propertyNodesVisibleList[ i ].OrderIndex = count + propoffset; - - if( renode.PropertyListCount > 0 ) - { - propoffset += renode.RecursiveCount(); - // the same reordenator can exist multiple times, apply ordering to all of them - for( int j = 0; j < nodes.Count; j++ ) - { - ReordenatorNode pnode = ( nodes[ j ] as ReordenatorNode ); - if( pnode != null && pnode.PropertyName.Equals( renode.PropertyName ) ) - { - pnode.OrderIndex = renode.RawOrderIndex; - pnode.RecursiveSetOrderOffset( renode.RawOrderIndex, true ); - } - } - } - else - { - count++; - } - } - else - { - m_propertyNodesVisibleList[ i ].OrderIndex = 0; - } - } - else - { - m_propertyNodesVisibleList[ i ].OrderIndex = count + propoffset; - count++; - } - } - } - - public void CopyPropertyListFrom( MasterNode masterNode ) - { - m_lastCount = masterNode.ReordableListLastCount; - m_propertyNodesVisibleList.Clear(); - m_propertyNodesVisibleList.AddRange( masterNode.PropertyNodesVisibleList ); - } - - public virtual void UpdateFromShader( Shader newShader ) { } - - public void ClearUpdateEvents() - { - OnShaderUpdatedEvent = null; - OnMaterialUpdatedEvent = null; - } - - public Material CurrentMaterial { get { return m_currentMaterial; } set { m_currentMaterial = value; } } - public Shader CurrentShader - { - set - { - if( value != null ) - { - SetName( value.name ); - } - - m_currentShader = value; - FireShaderChangedEvt(); - } - get { return m_currentShader; } - } - public virtual void OnRefreshLinkedPortsComplete() { } - public virtual void ReleaseResources() { } - public override void Destroy() - { - base.Destroy(); - OnMaterialUpdatedEvent = null; - OnShaderUpdatedEvent = null; - m_masterNodeOnTex = null; - m_masterNodeOffTex = null; - m_gpuInstanceOnTex = null; - m_gpuInstanceOffTex = null; - m_addShaderKeywordStyle = null; - m_removeShaderKeywordStyle = null; - m_smallAddShaderKeywordItemStyle = null; - m_smallRemoveShaderKeywordStyle = null; - m_shaderKeywords.Clear(); - m_shaderKeywords = null; - m_propertyReordableList = null; - m_propertyAdjustment = null; - if( m_currentDataCollector != null ) - { - m_currentDataCollector.Destroy(); - m_currentDataCollector = null; - } - } - - public static void OpenShaderBody( ref string result, string name ) - { - result += string.Format( "Shader \"{0}\"\n", name ) + "{\n"; - } - - public static void CloseShaderBody( ref string result ) - { - result += "}\n"; - } - - public static void OpenSubShaderBody( ref string result ) - { - result += "\n\tSubShader\n\t{\n"; - } - - public static void CloseSubShaderBody( ref string result ) - { - result += "\t}\n"; - } - - public static void AddShaderProperty( ref string result, string name, string value ) - { - result += string.Format( "\t{0} \"{1}\"\n", name, value ); - } - - public static void AddShaderPragma( ref string result, string value ) - { - result += string.Format( "\t\t#pragma {0}\n", value ); - } - - public static void AddRenderState( ref string result, string state, string stateParams ) - { - result += string.Format( "\t\t{0} {1}\n", state, stateParams ); - } - - public static void AddRenderTags( ref string result, string tags ) - { - result += string.Format( IndentationHelper, tags ); ; - } - - public static void AddShaderLOD( ref string result, int shaderLOD ) - { - if( shaderLOD > 0 ) - { - result += string.Format( ShaderLODFormat, shaderLOD ); - } - } - - public static void AddMultilineBody( ref string result, string[] lines ) - { - for( int i = 0; i < lines.Length; i++ ) - { - result += string.Format( IndentationHelper, lines[ i ] ); - } - } - - public static void OpenCGInclude( ref string result ) - { - result += "\t\tCGINCLUDE\n"; - } - - public static void OpenCGProgram( ref string result ) - { - result += "\t\tCGPROGRAM\n"; - } - - public static void CloseCGProgram( ref string result ) - { - result += "\n\t\tENDCG\n"; - } - - public string ShaderName - { - //get { return ( ( _isHidden ? "Hidden/" : string.Empty ) + ( String.IsNullOrEmpty( _shaderCategory ) ? "" : ( _shaderCategory + "/" ) ) + _shaderName ); } - get { return m_shaderName; } - set - { - m_shaderName = value; - string[] shaderNameArr = m_shaderName.Split( '/' ); - m_croppedShaderName = shaderNameArr[ shaderNameArr.Length - 1 ]; - - if( m_shaderNameIsTitle ) - m_content.text = GenerateClippedTitle( m_croppedShaderName ); - - m_sizeIsDirty = true; - } - } - public string CustomInspectorFormatted { get { return string.Format( CustomInspectorFormat, m_customInspectorName ); } } - public string CroppedShaderName { get { return m_croppedShaderName; } } - public AvailableShaderTypes CurrentMasterNodeCategory { get { return ( m_masterNodeCategory == 0 ) ? AvailableShaderTypes.SurfaceShader : AvailableShaderTypes.Template; } } - public int CurrentMasterNodeCategoryIdx { get { return m_masterNodeCategory; } } - public MasterNodeDataCollector CurrentDataCollector { get { return m_currentDataCollector; } set { m_currentDataCollector = value; } } - public List<PropertyNode> PropertyNodesVisibleList { get { return m_propertyNodesVisibleList; } } - public ReorderableList PropertyReordableList { get { return m_propertyReordableList; } } - public int ReordableListLastCount { get { return m_lastCount; } } - public MasterNodeCategoriesData CurrentCategoriesData { get { return m_availableCategories[ m_masterNodeCategory ]; } } - public int ShaderLOD - { - get { return m_shaderLOD; } - set - { - m_shaderLOD = Mathf.Max( 0, value ); - } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/MasterNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/MasterNode.cs.meta deleted file mode 100644 index 8a8a9339..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/MasterNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 7fc2c839ab9f3a045877b59493c51502 -timeCreated: 1481126957 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/MasterNodeDataCollector.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/MasterNodeDataCollector.cs deleted file mode 100644 index d6fce5fd..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/MasterNodeDataCollector.cs +++ /dev/null @@ -1,2038 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using System.Collections.Generic; -using UnityEngine; -using UnityEditor; -using System.Text.RegularExpressions; - -namespace AmplifyShaderEditor -{ - public class PropertyDataCollector - { - public int NodeId; - public int OrderIndex; - public string PropertyName; - public WirePortDataType DataType; - - public PropertyDataCollector( int nodeId, string propertyName, int orderIndex = -1 ) - { - NodeId = nodeId; - PropertyName = propertyName; - OrderIndex = orderIndex; - } - } - - public class InputCoordsCollector - { - public int NodeId; - public string CoordName; - public WirePortDataType DataType; - public PrecisionType Precision; - public int TextureSlot; - public int TextureIndex; - - public InputCoordsCollector( int nodeId, string coordName, WirePortDataType dataType, PrecisionType precision, int textureSlot, int textureIndex ) - { - NodeId = nodeId; - CoordName = coordName; - DataType = dataType; - Precision = precision; - TextureSlot = textureSlot; - TextureIndex = textureIndex; - } - } - - public class TextureDefaultsDataColector - { - private List<string> m_names = new List<string>(); - private List<Texture> m_values = new List<Texture>(); - public void AddValue( string newName, Texture newValue ) - { - m_names.Add( newName ); - m_values.Add( newValue ); - } - - public void Destroy() - { - m_names.Clear(); - m_names = null; - - m_values.Clear(); - m_values = null; - } - - public string[] NamesArr { get { return m_names.ToArray(); } } - public Texture[] ValuesArr { get { return m_values.ToArray(); } } - } - - public enum TextureChannelUsage - { - Not_Used, - Used, - Required - } - - public class MasterNodeDataCollector - { - private bool m_showDebugMessages = false; - private string m_input; - private string m_customInput; - private string m_properties; - private string m_instancedProperties; - private string m_instanceBlockName; - private string m_uniforms; - private string m_includes; - private string m_pragmas; - private string m_defines; - private string m_instructions; - private string m_localVariables; - private string m_vertexLocalVariables; - private string m_specialLocalVariables; - private string m_vertexData; - private string m_customOutput; - private string m_functions; - private string m_grabPass; - - private List<PropertyDataCollector> m_inputList; - private List<PropertyDataCollector> m_customInputList; - private List<PropertyDataCollector> m_propertiesList; - private List<PropertyDataCollector> m_instancedPropertiesList; - private List<PropertyDataCollector> m_dotsPropertiesList; - private List<PropertyDataCollector> m_dotsDefinesList; - private List<PropertyDataCollector> m_uniformsList; - private List<PropertyDataCollector> m_includesList; - private List<PropertyDataCollector> m_additionalDirectivesList; - //private List<PropertyDataCollector> m_tagsList; - private List<PropertyDataCollector> m_pragmasList; - private List<PropertyDataCollector> m_definesList; - private List<PropertyDataCollector> m_instructionsList; - private List<PropertyDataCollector> m_localVariablesList; - private List<PropertyDataCollector> m_vertexLocalVariablesList; - private List<PropertyDataCollector> m_specialLocalVariablesList; - private List<PropertyDataCollector> m_vertexDataList; - private List<PropertyDataCollector> m_customOutputList; - private List<PropertyDataCollector> m_functionsList; - private List<PropertyDataCollector> m_grabPassList; - private List<PropertyDataCollector> m_aboveUsePassesList; - private List<PropertyDataCollector> m_belowUsePassesList; - - private List<InputCoordsCollector> m_customShadowCoordsList; - private List<int> m_packSlotsList; - private string m_customAppDataItems; - - private Dictionary<string, PropertyDataCollector> m_inputDict; - private Dictionary<string, PropertyDataCollector> m_customInputDict; - private Dictionary<string, PropertyDataCollector> m_propertiesDict; - private Dictionary<string, PropertyDataCollector> m_instancedPropertiesDict; - private Dictionary<string, PropertyDataCollector> m_dotsPropertiesDict; - private Dictionary<string, PropertyDataCollector> m_uniformsDict; - private Dictionary<string, PropertyDataCollector> m_softRegisteredUniformsDict; - private Dictionary<string, PropertyDataCollector> m_includesDict; - private Dictionary<string, PropertyDataCollector> m_additionalDirectivesDict; - private Dictionary<string, string> m_includesExclusionDict; - - //private Dictionary<string, PropertyDataCollector> m_tagsDict; - private Dictionary<string, PropertyDataCollector> m_pragmasDict; - private Dictionary<string, PropertyDataCollector> m_definesDict; - private Dictionary<string, int> m_virtualCoordinatesDict; - private Dictionary<string, string> m_virtualVariablesDict; - private Dictionary<string, PropertyDataCollector> m_localVariablesDict; - private Dictionary<string, PropertyDataCollector> m_vertexLocalVariablesDict; - private Dictionary<string, PropertyDataCollector> m_specialLocalVariablesDict; - private Dictionary<string, PropertyDataCollector> m_vertexDataDict; - private Dictionary<string, PropertyDataCollector> m_customOutputDict; - private Dictionary<string, string> m_localFunctions; - private Dictionary<string, string> m_grabPassDict; - private Dictionary<string, string> m_usePassesDict; - private Dictionary<string, string> m_customAppDataItemsDict; - - private Dictionary<string, InputCoordsCollector> m_customShadowCoordsDict; - - private TextureChannelUsage[] m_requireTextureProperty = { TextureChannelUsage.Not_Used, TextureChannelUsage.Not_Used, TextureChannelUsage.Not_Used, TextureChannelUsage.Not_Used }; - - private bool m_dirtyAppData; - private bool m_dirtyInputs; - private bool m_dirtyCustomInputs; - private bool m_dirtyFunctions; - private bool m_dirtyProperties; - private bool m_dirtyInstancedProperties; - private bool m_dirtyUniforms; - private bool m_dirtyIncludes; - private bool m_dirtyPragmas; - private bool m_dirtyDefines; - private bool m_dirtyAdditionalDirectives; - private bool m_dirtyInstructions; - private bool m_dirtyLocalVariables; - private bool m_dirtyVertexLocalVariables; - private bool m_dirtySpecialLocalVariables; - private bool m_dirtyPerVertexData; - private bool m_dirtyNormal; - private bool m_forceNormal; - - private bool m_usingInternalData; - private bool m_usingVertexColor; - private bool m_usingWorldPosition; - private bool m_usingWorldNormal; - private bool m_usingScreenPos; - private bool m_usingWorldReflection; - private bool m_usingViewDirection; - private bool m_usingLightAttenuation; - private bool m_usingArrayDerivatives; - - private bool m_usingHigherSizeTexcoords; - private bool m_usingCustomScreenPos; - - private bool m_usingCustomOutlineColor; - private bool m_usingCustomOutlineWidth; - private bool m_usingCustomOutlineAlpha; - private int m_customOutlineSelectedAlpha = 0; - private bool m_usingCustomOutput; - - private bool m_safeNormalizeLightDir; - private bool m_safeNormalizeViewDir; - - private bool m_isOutlineDataCollector = false; - - private bool m_forceNormalIsDirty; - private bool m_grabPassIsDirty; - private bool m_tesselationActive; - - private Dictionary<int, PropertyNode> m_propertyNodes; - private MasterNode m_masterNode; - - private int m_availableVertexTempId = 0; - private int m_availableFragTempId = 0; - - private MasterNodePortCategory m_portCategory; - private PortGenType m_genType; - private RenderPath m_renderPath = RenderPath.All; - private NodeAvailability m_currentCanvasMode = NodeAvailability.SurfaceShader; - - //Templates specific data - private AvailableShaderTypes m_masterNodeCategory; - private List<string> m_vertexInputList; - private Dictionary<string, string> m_vertexInputDict; - private List<string> m_interpolatorsList; - private Dictionary<string, string> m_interpolatorsDict; - private List<string> m_vertexInterpDeclList; - private Dictionary<string, string> m_vertexInterpDeclDict; - private TemplateDataCollector m_templateDataCollector; - - public MasterNodeDataCollector( MasterNode masterNode ) : this() - { - m_masterNode = masterNode; - m_masterNodeCategory = masterNode.CurrentMasterNodeCategory; - m_currentCanvasMode = masterNode.ContainerGraph.CurrentCanvasMode; - } - - public MasterNodeDataCollector() - { - //m_masterNode = masterNode; - m_input = "struct Input\n\t\t{\n"; - m_customInput = "\t\tstruct SurfaceOutput{0}\n\t\t{\n"; - m_properties = IOUtils.PropertiesBegin;//"\tProperties\n\t{\n"; - m_uniforms = string.Empty; - m_instructions = string.Empty; - m_includes = string.Empty; - m_pragmas = string.Empty; - m_defines = string.Empty; - m_localVariables = string.Empty; - m_specialLocalVariables = string.Empty; - m_customOutput = string.Empty; - - m_inputList = new List<PropertyDataCollector>(); - m_customInputList = new List<PropertyDataCollector>(); - m_propertiesList = new List<PropertyDataCollector>(); - m_instancedPropertiesList = new List<PropertyDataCollector>(); - m_dotsPropertiesList = new List<PropertyDataCollector>(); - m_dotsDefinesList = new List<PropertyDataCollector>(); - m_uniformsList = new List<PropertyDataCollector>(); - m_includesList = new List<PropertyDataCollector>(); - m_additionalDirectivesList = new List<PropertyDataCollector>(); - //m_tagsList = new List<PropertyDataCollector>(); - m_pragmasList = new List<PropertyDataCollector>(); - m_definesList = new List<PropertyDataCollector>(); - m_instructionsList = new List<PropertyDataCollector>(); - m_localVariablesList = new List<PropertyDataCollector>(); - m_vertexLocalVariablesList = new List<PropertyDataCollector>(); - m_specialLocalVariablesList = new List<PropertyDataCollector>(); - m_vertexDataList = new List<PropertyDataCollector>(); - m_customOutputList = new List<PropertyDataCollector>(); - m_functionsList = new List<PropertyDataCollector>(); - m_grabPassList = new List<PropertyDataCollector>(); - m_aboveUsePassesList = new List<PropertyDataCollector>(); - m_belowUsePassesList = new List<PropertyDataCollector>(); - m_customAppDataItems = string.Empty; - m_customAppDataItemsDict = new Dictionary<string, string>(); - m_customShadowCoordsList = new List<InputCoordsCollector>(); - m_packSlotsList = new List<int>(); - - m_inputDict = new Dictionary<string, PropertyDataCollector>(); - m_customInputDict = new Dictionary<string, PropertyDataCollector>(); - - m_propertiesDict = new Dictionary<string, PropertyDataCollector>(); - m_instancedPropertiesDict = new Dictionary<string, PropertyDataCollector>(); - m_dotsPropertiesDict = new Dictionary<string, PropertyDataCollector>(); - m_uniformsDict = new Dictionary<string, PropertyDataCollector>(); - m_softRegisteredUniformsDict = new Dictionary<string, PropertyDataCollector>(); - m_includesDict = new Dictionary<string, PropertyDataCollector>(); - m_additionalDirectivesDict = new Dictionary<string, PropertyDataCollector>(); - m_includesExclusionDict = new Dictionary<string, string>(); - - //m_tagsDict = new Dictionary<string, PropertyDataCollector>(); - m_pragmasDict = new Dictionary<string, PropertyDataCollector>(); - m_definesDict = new Dictionary<string, PropertyDataCollector>(); - m_virtualCoordinatesDict = new Dictionary<string, int>(); - m_localVariablesDict = new Dictionary<string, PropertyDataCollector>(); - m_virtualVariablesDict = new Dictionary<string, string>(); - m_specialLocalVariablesDict = new Dictionary<string, PropertyDataCollector>(); - m_vertexLocalVariablesDict = new Dictionary<string, PropertyDataCollector>(); - m_localFunctions = new Dictionary<string, string>(); - m_vertexDataDict = new Dictionary<string, PropertyDataCollector>(); - m_customOutputDict = new Dictionary<string, PropertyDataCollector>(); - m_grabPassDict = new Dictionary<string, string>(); - m_usePassesDict = new Dictionary<string, string>(); - - m_customShadowCoordsDict = new Dictionary<string, InputCoordsCollector>(); - - m_dirtyAppData = false; - m_dirtyInputs = false; - m_dirtyCustomInputs = false; - m_dirtyProperties = false; - m_dirtyInstancedProperties = false; - m_dirtyUniforms = false; - m_dirtyInstructions = false; - m_dirtyIncludes = false; - m_dirtyPragmas = false; - m_dirtyDefines = false; - m_dirtyAdditionalDirectives = false; - m_dirtyLocalVariables = false; - m_dirtySpecialLocalVariables = false; - m_grabPassIsDirty = false; - - m_portCategory = MasterNodePortCategory.Fragment; - m_propertyNodes = new Dictionary<int, PropertyNode>(); - m_showDebugMessages = ( m_showDebugMessages && DebugConsoleWindow.DeveloperMode ); - - //templates - //m_masterNodeCategory = masterNode.CurrentMasterNodeCategory; - - m_vertexInputList = new List<string>(); - m_vertexInputDict = new Dictionary<string, string>(); - - m_interpolatorsList = new List<string>(); - m_interpolatorsDict = new Dictionary<string, string>(); - - m_vertexInterpDeclList = new List<string>(); - m_vertexInterpDeclDict = new Dictionary<string, string>(); - - m_templateDataCollector = new TemplateDataCollector(); - } - - public void SetChannelUsage( int channelId, TextureChannelUsage usage ) - { - if( channelId > -1 && channelId < 4 ) - m_requireTextureProperty[ channelId ] = usage; - } - - public TextureChannelUsage GetChannelUsage( int channelId ) - { - if( channelId > -1 && channelId < 4 ) - return m_requireTextureProperty[ channelId ]; - - return TextureChannelUsage.Not_Used; - } - public string SurfaceVertexStructure { get { return ( m_dirtyAppData ? Constants.CustomAppDataFullName : Constants.AppDataFullName ); } } - public void OpenPerVertexHeader( bool includeCustomData ) - { - string appData = "inout " + ( m_dirtyAppData ? Constants.CustomAppDataFullName : Constants.AppDataFullName ) + " "; - if( m_dirtyPerVertexData ) - return; - - m_dirtyPerVertexData = true; - if( m_tesselationActive ) - { - m_vertexData = "\t\tvoid " + Constants.VertexDataFunc + "( " + appData + Constants.VertexShaderInputStr + " )\n\t\t{\n"; - } - else - { - m_vertexData = "\t\tvoid " + Constants.VertexDataFunc + "( " + appData + Constants.VertexShaderInputStr + ( includeCustomData ? ( string.Format( ", out Input {0}", Constants.VertexShaderOutputStr ) ) : string.Empty ) + " )\n\t\t{\n"; - if( includeCustomData ) - m_vertexData += string.Format( "\t\t\tUNITY_INITIALIZE_OUTPUT( Input, {0} );\n", Constants.VertexShaderOutputStr ); - } - } - - public void ClosePerVertexHeader() - { - if( m_dirtyPerVertexData ) - m_vertexData += "\t\t}\n\n"; - } - - public void AddToVertexDisplacement( string value, VertexMode vertexMode ) - { - if( string.IsNullOrEmpty( value ) ) - return; - - if( !m_dirtyPerVertexData ) - { - OpenPerVertexHeader( true ); - } - - switch( vertexMode ) - { - default: - case VertexMode.Relative: - { - m_vertexData += "\t\t\t" + Constants.VertexShaderInputStr + ".vertex.xyz += " + value + ";\n"; - } - break; - case VertexMode.Absolute: - { - m_vertexData += "\t\t\t" + Constants.VertexShaderInputStr + ".vertex.xyz = " + value + ";\n"; - } - break; - } - } - - - public void AddToVertexNormal( string value ) - { - if( string.IsNullOrEmpty( value ) ) - return; - - if( !m_dirtyPerVertexData ) - { - OpenPerVertexHeader( true ); - } - - m_vertexData += "\t\t\t" + Constants.VertexShaderInputStr + ".normal = " + value + ";\n"; - } - - - public void AddVertexInstruction( string value, int nodeId = -1, bool addDelimiters = true ) - { - if( !m_dirtyPerVertexData && !IsOutlineDataCollector/*&& !(m_usingCustomOutlineColor || m_usingCustomOutlineWidth)*/ ) - { - OpenPerVertexHeader( true ); - } - if( !m_vertexDataDict.ContainsKey( value ) ) - { - m_vertexDataDict.Add( value, new PropertyDataCollector( nodeId, value ) ); - m_vertexDataList.Add( m_vertexDataDict[ value ] ); - m_vertexData += ( addDelimiters ? ( "\t\t\t" + value + ";\n" ) : value ); - } - } - - public bool ContainsInput( string value ) - { - return m_inputDict.ContainsKey( value ); - } - - public void AddToInput( int nodeId, string interpName, WirePortDataType dataType, PrecisionType precision = PrecisionType.Float, bool addSemiColon = true ) - { - string value = UIUtils.PrecisionWirePortToCgType( precision, dataType ) + " " + interpName; - AddToInput( nodeId, value, addSemiColon ); - - if( !m_customShadowCoordsDict.ContainsKey( interpName ) ) - { - int slot = 0; - int index = 0; - int size = UIUtils.GetChannelsAmount( dataType ); - - if( m_packSlotsList.Count == 0 ) - m_packSlotsList.Add( 4 ); - - for( int i = 0; i < m_packSlotsList.Count; i++ ) - { - slot = i; - if( m_packSlotsList[ i ] >= size ) - { - index = 4 - m_packSlotsList[ i ]; - m_packSlotsList[ i ] -= size; - break; - } - else if( i == m_packSlotsList.Count - 1 ) - { - m_packSlotsList.Add( 4 ); - } - } - m_customShadowCoordsDict.Add( interpName, new InputCoordsCollector( nodeId, interpName, dataType, precision, slot, index ) ); - m_customShadowCoordsList.Add( m_customShadowCoordsDict[ interpName ] ); - } - } - - public void AddToInput( int nodeId, SurfaceInputs surfaceInput, PrecisionType precision = PrecisionType.Float, bool addSemiColon = true ) - { - switch( surfaceInput ) - { - case SurfaceInputs.VIEW_DIR: - UsingViewDirection = true; - break; - case SurfaceInputs.SCREEN_POS: - UsingScreenPos = true; - break; - case SurfaceInputs.WORLD_POS: - UsingWorldPosition = true; - break; - case SurfaceInputs.WORLD_REFL: - UsingWorldReflection = true; - break; - case SurfaceInputs.WORLD_NORMAL: - UsingWorldNormal = true; - break; - case SurfaceInputs.INTERNALDATA: - UsingInternalData = true; - break; - case SurfaceInputs.COLOR: - UsingVertexColor = true; - break; - } - - AddToInput( nodeId, UIUtils.GetInputDeclarationFromType( precision, surfaceInput ), addSemiColon ); - } - - /// <summary> - /// Direct access to inputs, plese use another overload - /// </summary> - /// <param name="nodeId"></param> - /// <param name="value"></param> - /// <param name="addSemiColon"></param> - public void AddToInput( int nodeId, string value, bool addSemiColon ) - { - if( string.IsNullOrEmpty( value ) ) - return; - - if( !m_inputDict.ContainsKey( value ) ) - { - m_inputDict.Add( value, new PropertyDataCollector( nodeId, value ) ); - m_inputList.Add( m_inputDict[ value ] ); - - m_input += "\t\t\t" + value + ( ( addSemiColon ) ? ( ";\n" ) : "\n" ); - m_dirtyInputs = true; - } - } - - public void CloseInputs() - { - m_input += "\t\t};"; - } - - public void ChangeCustomInputHeader( string value ) - { - m_customInput = m_customInput.Replace( "{0}", value ); - } - - public void AddToCustomInput( int nodeId, string value, bool addSemiColon ) - { - if( string.IsNullOrEmpty( value ) ) - return; - - if( !m_customInputDict.ContainsKey( value ) ) - { - m_customInputDict.Add( value, new PropertyDataCollector( nodeId, value ) ); - m_customInputList.Add( m_customInputDict[ value ] ); - m_customInput += "\t\t\t" + value + ( ( addSemiColon ) ? ( ";\n" ) : "\n" ); - m_dirtyCustomInputs = true; - } - } - - public void CloseCustomInputs() - { - m_customInput += "\t\t};"; - } - - - // Used by Template Master Node to add tabs into variable declaration - public void TabifyInstancedVars() - { - for( int i = 0; i < m_instancedPropertiesList.Count; i++ ) - { - m_instancedPropertiesList[ i ].PropertyName = '\t' + m_instancedPropertiesList[ i ].PropertyName; - } - } - - private int GetWeightForInstancedType( WirePortDataType type ) - { - switch( type ) - { - case WirePortDataType.INT: - case WirePortDataType.FLOAT: return -1; - case WirePortDataType.FLOAT2: return -2; - case WirePortDataType.FLOAT3: return -3; - case WirePortDataType.COLOR: - case WirePortDataType.FLOAT4: return -4; - case WirePortDataType.FLOAT3x3: return -9; - case WirePortDataType.FLOAT4x4: return -16; - default: - case WirePortDataType.OBJECT: - case WirePortDataType.SAMPLER1D: - case WirePortDataType.SAMPLER2D: - case WirePortDataType.SAMPLER3D: - case WirePortDataType.SAMPLERCUBE: - return 0; - } - } - - public void OptimizeInstancedProperties() - { - if( m_instancedPropertiesList.Count > 0 ) - { - m_instancedProperties = string.Empty; - m_instancedPropertiesList.Sort( ( x, y ) => { return GetWeightForInstancedType( x.DataType ).CompareTo( GetWeightForInstancedType( y.DataType ) ); } ); - int count = m_instancedPropertiesList.Count; - for( int i = 0; i < count; i++ ) - { - m_instancedProperties += m_instancedPropertiesList[ i ].PropertyName; - } - } - } - // Instanced properties - public void SetupInstancePropertiesBlock( string blockName ) - { - m_instanceBlockName = blockName; - if( IsTemplate ) - { - //if( DebugConsoleWindow.DeveloperMode ) - // Debug.LogWarning( "SetupInstancePropertiesBlock should not be used during template mode" ); - - return; - } - - OptimizeInstancedProperties(); - - if( m_dirtyInstancedProperties ) - { - m_instancedProperties = string.Format( IOUtils.InstancedPropertiesBeginTabs, blockName ) + m_instancedProperties + IOUtils.InstancedPropertiesEndTabs; - } - } - - public void AddToDotsProperties( WirePortDataType dataType, int nodeId, string value, int orderIndex, PrecisionType precision ) - { - if( string.IsNullOrEmpty( value ) ) - return; - - string prop = string.Format( IOUtils.DotsInstancedPropertiesData, UIUtils.PrecisionWirePortToCgType( precision, dataType ), value ); - string define = string.Format( IOUtils.DotsInstancedDefinesData, UIUtils.PrecisionWirePortToCgType( precision, dataType ), value ); - - if( !m_dotsPropertiesDict.ContainsKey( value ) ) - { - PropertyDataCollector dataColl = new PropertyDataCollector( nodeId, prop, orderIndex ); - dataColl.DataType = dataType; - m_dotsPropertiesDict.Add( value, dataColl ); - m_dotsPropertiesList.Add( dataColl ); - - dataColl = new PropertyDataCollector( nodeId, define, orderIndex ); - m_dotsDefinesList.Add( dataColl ); - } - } - - public void AddToInstancedProperties( WirePortDataType dataType, int nodeId, string value, int orderIndex ) - { - if( string.IsNullOrEmpty( value ) ) - return; - string uniformValue = value.Contains( "uniform" ) ? value : "uniform " + value; - if( !m_instancedPropertiesDict.ContainsKey( value ) && - !m_uniformsDict.ContainsKey( value ) && - !m_uniformsDict.ContainsKey( uniformValue ) - ) - { - PropertyDataCollector dataColl = new PropertyDataCollector( nodeId, value, orderIndex ); - dataColl.DataType = dataType; - m_instancedPropertiesDict.Add( value, dataColl ); - m_instancedPropertiesList.Add( dataColl ); - m_instancedProperties += value; - m_dirtyInstancedProperties = true; - } - } - - public void CloseInstancedProperties() - { - if( m_dirtyInstancedProperties ) - { - m_instancedProperties += IOUtils.InstancedPropertiesEnd; - } - } - - // Properties - public void CopyPropertiesFromDataCollector( MasterNodeDataCollector dataCollector ) - { - if( dataCollector == null ) - return; - - int propertyCount = dataCollector.PropertiesList.Count; - for( int i = 0; i < propertyCount; i++ ) - { - AddToProperties( dataCollector.PropertiesList[ i ].NodeId, - dataCollector.PropertiesList[ i ].PropertyName, - dataCollector.PropertiesList[ i ].OrderIndex ); - } - - foreach( KeyValuePair<string, string> kvp in dataCollector.GrabPassDict ) - { - AddGrabPass( kvp.Value ); - } - - m_templateDataCollector.CopySRPPropertiesFromDataCollector( -1, dataCollector.TemplateDataCollectorInstance ); - } - - public void AddToProperties( int nodeId, string value, int orderIndex ) - { - if( string.IsNullOrEmpty( value ) ) - return; - - if( !m_propertiesDict.ContainsKey( value ) ) - { - //Debug.Log( UIUtils ); - m_propertiesDict.Add( value, new PropertyDataCollector( nodeId, value, orderIndex ) ); - m_propertiesList.Add( m_propertiesDict[ value ] ); - m_properties += string.Format( IOUtils.PropertiesElement, value ); - m_dirtyProperties = true; - } - } - - public string BuildPropertiesString() - { - List<PropertyDataCollector> list = new List<PropertyDataCollector>( m_propertiesDict.Values ); - //for ( int i = 0; i < list.Count; i++ ) - //{ - // Debug.Log( list[ i ].OrderIndex + " " + list[ i ].PropertyName ); - //} - - list.Sort( ( x, y ) => { return x.OrderIndex.CompareTo( y.OrderIndex ); } ); - CleanUpList( ref list ); - m_properties = IOUtils.PropertiesBegin; - for( int i = 0; i < list.Count; i++ ) - { - m_properties += string.Format( IOUtils.PropertiesElement, list[ i ].PropertyName ); - //Debug.Log() - } - m_properties += IOUtils.PropertiesEnd; - return m_properties; - } - - public bool ContainsProperty( string propertyName ) - { - // TODO: this needs to change, find the property should be dependant of have a "(" - List<PropertyDataCollector> list = new List<PropertyDataCollector>( m_propertiesDict.Values ); - return list.Find( x => x.PropertyName.Contains( propertyName+"(" ) ) != null; - } - - public string[] BuildUnformatedPropertiesStringArr() - { - List<PropertyDataCollector> list = new List<PropertyDataCollector>( m_propertiesDict.Values ); - list.Sort( ( x, y ) => { return x.OrderIndex.CompareTo( y.OrderIndex ); } ); - CleanUpList( ref list ); - string[] arr = new string[ list.Count ]; - for( int i = 0; i < list.Count; i++ ) - { - arr[ i ] = list[ i ].PropertyName; - } - return arr; - } - //This clean up was set to remove Header attributes from shader functions which would be last on the property list - //Thus creating a label on the inspector with no properties below - public void CleanUpList( ref List<PropertyDataCollector> list ) - { - if( list.Count == 0 ) - return; - - if( list[ list.Count - 1 ].PropertyName.Contains( "[Header(" ) ) - { - //Check if this is a complete property or just a standalone header - Match match = Regex.Match( list[ list.Count - 1 ].PropertyName, TemplateHelperFunctions.PropertiesPatternG ); - if( !match.Success ) - { - list.RemoveAt( list.Count - 1 ); - CleanUpList( ref list ); - } - } - } - - public void CloseProperties() - { - if( m_dirtyProperties ) - { - m_properties += IOUtils.PropertiesEnd; - } - } - - public void AddUsePass( string value, bool above ) - { - if( m_usePassesDict.ContainsKey( value ) ) - return; - m_usePassesDict.Add( value, value ); - if( above ) - { - m_aboveUsePassesList.Add( new PropertyDataCollector( -1, value ) ); - } - else - { - m_belowUsePassesList.Add( new PropertyDataCollector( -1, value ) ); - } - } - - public void AddGrabPass( string value ) - { - if( m_grabPassDict.ContainsKey( value ) ) - return; - - m_grabPassDict.Add( value, value ); - - if( string.IsNullOrEmpty( value ) ) - { - if( !m_grabPassIsDirty ) - m_grabPass += IOUtils.GrabPassEmpty; - } - else - { - m_grabPass += IOUtils.GrabPassBegin + value + IOUtils.GrabPassEnd; - } - m_grabPassList.Add( new PropertyDataCollector( -1, m_grabPass.Replace( "\t", string.Empty ).Replace( "\n", string.Empty ) ) ); - m_grabPassIsDirty = true; - } - - // This is used by templates global variables to register already existing globals/properties - //public void SoftRegisterUniform( string dataName ) - //{ - // if( !m_uniformsDict.ContainsKey( dataName ) ) - // { - // m_uniformsDict.Add( dataName, new PropertyDataCollector( -1, dataName ) ); - // } - //} - - public string GenerateInstanced(PrecisionType precisionType, WirePortDataType dataType,string propertyName ) - { - if( IsSRP ) - { - return string.Format( IOUtils.LWSRPInstancedPropertiesElement, UIUtils.PrecisionWirePortToCgType( precisionType, dataType ), propertyName ); - } - else - { - return string.Format( IOUtils.InstancedPropertiesElement, UIUtils.PrecisionWirePortToCgType( precisionType, dataType ), propertyName ); - } - } - - public bool CheckIfSoftRegistered( string name ) - { - return m_softRegisteredUniformsDict.ContainsKey( name ); - } - - public void SoftRegisterUniform( TemplateShaderPropertyData data ) - { - bool excludeUniformKeyword = ( data.PropertyType == PropertyType.InstancedProperty ) || IsSRP; - - string uniformName = UIUtils.GenerateUniformName( excludeUniformKeyword, data.PropertyDataType, data.PropertyName ); - if( !m_uniformsDict.ContainsKey( uniformName ) ) - { - PropertyDataCollector newEntry = new PropertyDataCollector( -1, uniformName ); - m_uniformsDict.Add( uniformName, newEntry ); - m_softRegisteredUniformsDict.Add( uniformName, newEntry ); - } - - string instancedUniform = GenerateInstanced( PrecisionType.Float, data.PropertyDataType, data.PropertyName ); - if( !m_uniformsDict.ContainsKey( instancedUniform ) ) - { - PropertyDataCollector newEntry = new PropertyDataCollector( -1, instancedUniform ); - m_uniformsDict.Add( instancedUniform, newEntry ); - m_softRegisteredUniformsDict.Add( instancedUniform, newEntry ); - } - - instancedUniform = GenerateInstanced( PrecisionType.Half, data.PropertyDataType, data.PropertyName ); - if( !m_uniformsDict.ContainsKey( instancedUniform ) ) - { - PropertyDataCollector newEntry = new PropertyDataCollector( -1, instancedUniform ); - m_uniformsDict.Add( instancedUniform, newEntry ); - m_softRegisteredUniformsDict.Add( instancedUniform, newEntry ); - } - } - - public void AddToUniforms( int nodeId, string dataType, string dataName, bool checkSRPBatch = false, bool excludeUniform = false ) - { - if( string.IsNullOrEmpty( dataName ) || string.IsNullOrEmpty( dataType ) ) - return; - - string value = UIUtils.GenerateUniformName( IsSRP || excludeUniform, dataType, dataName ); - if( !m_uniformsDict.ContainsKey( value ) && !m_uniformsDict.ContainsKey( dataName ) ) - { - m_uniformsDict.Add( value, new PropertyDataCollector( nodeId, value ) ); - if( IsSRP && checkSRPBatch ) - { - m_templateDataCollector.AddSRPBatcherProperty( nodeId, value ); - } - else - { - m_uniforms += "\t\t" + value + '\n'; - m_uniformsList.Add( m_uniformsDict[ value ] ); - } - m_dirtyUniforms = true; - } - } - - public void AddToUniforms( int nodeId, string value, bool checkSRPBatch = false ) - { - if( string.IsNullOrEmpty( value ) ) - return; - - if( !m_uniformsDict.ContainsKey( value ) ) - { - m_uniformsDict.Add( value, new PropertyDataCollector( nodeId, value ) ); - if( IsSRP && checkSRPBatch ) - { - m_templateDataCollector.AddSRPBatcherProperty( nodeId, value ); - } - else - { - m_uniforms += "\t\t" + value + '\n'; - m_uniformsList.Add( m_uniformsDict[ value ] ); - } - m_dirtyUniforms = true; - } - } - - public void AddToDirectives( string value, int orderIndex = -1 , AdditionalLineType type = AdditionalLineType.Custom ) - { - if( string.IsNullOrEmpty( value ) ) - return; - - switch( type ) - { - case AdditionalLineType.Include:value = "#include " + value;break; - case AdditionalLineType.Define:value = "#define " + value; break; - case AdditionalLineType.Pragma:value = "#pragma " + value; break; - } - if( !m_additionalDirectivesDict.ContainsKey( value ) ) - { - PropertyDataCollector data = new PropertyDataCollector( -1, value, orderIndex ); - m_additionalDirectivesDict.Add( value, data ); - m_additionalDirectivesList.Add( data ); - m_dirtyAdditionalDirectives = true; - } - } - - public void AddToIncludes( int nodeId, string value ) - { - if( string.IsNullOrEmpty( value ) ) - return; - - if( m_includesExclusionDict.ContainsKey( value ) ) - { - return; - } - - if( IsTemplate ) - { - if( m_templateDataCollector.HasDirective( AdditionalLineType.Include, value ) ) - return; - } - - if( !m_includesDict.ContainsKey( value ) ) - { - PropertyDataCollector data = new PropertyDataCollector( nodeId, "#include \"" + value + "\"" ); - m_includesDict.Add( value, data ); - m_includesList.Add( data ); - m_includes += "\t\t#include \"" + value + "\"\n"; - m_dirtyIncludes = true; - } - else - { - if( m_showDebugMessages ) UIUtils.ShowMessage( "AddToIncludes:Attempting to add duplicate " + value, MessageSeverity.Warning ); - } - } - - - public void RemoveFromIncludes( string value ) - { - if( string.IsNullOrEmpty( value ) ) - return; - - if( !m_includesExclusionDict.ContainsKey( value ) ) - { - m_includesExclusionDict.Add( value, value ); - } - - if( m_includesDict.ContainsKey( value ) ) - { - PropertyDataCollector data = m_includesDict[ value ]; - m_includesDict.Remove( value ); - m_includesList.Remove( data ); - m_dirtyIncludes = true; - string finalValueName = "\t\t#include \"" + value + "\"\n"; - m_includes = m_includes.Replace( finalValueName, string.Empty ); - } - } - - //public void AddToTags( int nodeId, string name, string value ) - //{ - // if( string.IsNullOrEmpty( name ) || string.IsNullOrEmpty( value ) ) - // return; - - // if( !m_tagsDict.ContainsKey( name ) ) - // { - // string finalResult = string.Format( "\"{0}\"=\"{1}\"", name, value ); - // m_tagsDict.Add( name, new PropertyDataCollector( nodeId, finalResult ) ); - // m_tagsList.Add( new PropertyDataCollector( nodeId, finalResult ) ); - // } - //} - - public void AddToPragmas( int nodeId, string value ) - { - if( string.IsNullOrEmpty( value ) ) - return; - - if( IsTemplate ) - { - if( m_templateDataCollector.HasDirective( AdditionalLineType.Pragma, value ) ) - return; - } - - if( !m_pragmasDict.ContainsKey( value ) ) - { - m_pragmasDict.Add( value, new PropertyDataCollector( nodeId, "#pragma " + value ) ); - m_pragmasList.Add( m_pragmasDict[ value ] ); - m_pragmas += "\t\t#pragma " + value + "\n"; - m_dirtyPragmas = true; - } - else - { - if( m_showDebugMessages ) UIUtils.ShowMessage( "AddToPragmas:Attempting to add duplicate " + value, MessageSeverity.Warning ); - } - } - - public void AddToDefines( int nodeId, string value, bool define = true ) - { - if( string.IsNullOrEmpty( value ) ) - return; - - if( IsTemplate ) - { - if( m_templateDataCollector.HasDirective( AdditionalLineType.Define, value ) ) - return; - } - - if( !m_definesDict.ContainsKey( value ) ) - { - string defineValue = ( define ? "#define " : "#undef " ) + value; - m_definesDict.Add( value, new PropertyDataCollector( nodeId, defineValue ) ); - m_definesList.Add( m_definesDict[ value ] ); - m_defines += "\t\t" + defineValue + "\n"; - m_dirtyDefines = true; - } - else - { - if( m_showDebugMessages ) UIUtils.ShowMessage( "AddToDefines:Attempting to add duplicate " + value, MessageSeverity.Warning ); - } - } - - public int GetVirtualCoordinatesId( int nodeId, string coord, string lodBias ) - { - if( !m_virtualCoordinatesDict.ContainsKey( coord ) ) - { - m_virtualCoordinatesDict.Add( coord, nodeId ); - AddLocalVariable( nodeId, "VirtualCoord " + Constants.VirtualCoordNameStr + nodeId + " = VTComputeVirtualCoord" + lodBias + "(" + coord + ");" ); - return nodeId; - } - else - { - int fetchedId = 0; - m_virtualCoordinatesDict.TryGetValue( coord, out fetchedId ); - return fetchedId; - } - } - - public bool AddToLocalVariables( MasterNodePortCategory category, int nodeId, PrecisionType precisionType, WirePortDataType type, string varName, string varValue ) - { - if( string.IsNullOrEmpty( varName ) || string.IsNullOrEmpty( varValue ) ) - return false; - - string value = UIUtils.PrecisionWirePortToCgType( precisionType, type ) + " " + varName + " = " + varValue + ";"; - return AddToLocalVariables( category, nodeId, value ); - } - - public bool AddToLocalVariables( int nodeId, PrecisionType precisionType, WirePortDataType type, string varName, string varValue ) - { - if( string.IsNullOrEmpty( varName ) || string.IsNullOrEmpty( varValue ) ) - return false; - - string value = UIUtils.PrecisionWirePortToCgType( precisionType, type ) + " " + varName + " = " + varValue + ";"; - return AddToLocalVariables( nodeId, value ); - } - - public bool AddToLocalVariables( MasterNodePortCategory category, int nodeId, string value, bool ignoreDuplicates = false ) - { - if( string.IsNullOrEmpty( value ) ) - return false; - - switch( category ) - { - case MasterNodePortCategory.Vertex: - case MasterNodePortCategory.Tessellation: - { - return AddToVertexLocalVariables( nodeId, value, ignoreDuplicates ); - } - case MasterNodePortCategory.Fragment: - case MasterNodePortCategory.Debug: - { - return AddToLocalVariables( nodeId, value, ignoreDuplicates ); - } - } - - return false; - } - - public bool AddLocalVariable( int nodeId, string customType, string varName, string varValue ) - { - if( string.IsNullOrEmpty( varName ) || string.IsNullOrEmpty( varValue ) ) - return false; - - string value = customType + " " + varName + " = " + varValue + ";"; - return AddLocalVariable( nodeId, value ); - } - - public bool AddLocalVariable( int nodeId, PrecisionType precisionType, WirePortDataType type, string varName, string varValue ) - { - if( string.IsNullOrEmpty( varName ) || string.IsNullOrEmpty( varValue ) ) - return false; - - string value = UIUtils.PrecisionWirePortToCgType( precisionType, type ) + " " + varName + " = " + varValue + ";"; - return AddLocalVariable( nodeId, value ); - } - - public bool AddLocalVariable( int nodeId, string name, string value, bool ignoreDuplicates = false , bool addSemiColon = false ) - { - string finalValue = addSemiColon ? name + " = " + value + ";" : name + " = " + value; - return AddLocalVariable( nodeId, finalValue, ignoreDuplicates ); - } - - public bool AddLocalVariable( int nodeId, string value, bool ignoreDuplicates = false ) - { - if( string.IsNullOrEmpty( value ) ) - return false; - - switch( m_portCategory ) - { - case MasterNodePortCategory.Vertex: - case MasterNodePortCategory.Tessellation: - { - return AddToVertexLocalVariables( nodeId, value, ignoreDuplicates ); - } - case MasterNodePortCategory.Fragment: - case MasterNodePortCategory.Debug: - { - return AddToLocalVariables( nodeId, value, ignoreDuplicates ); - } - } - - return false; - } - - public string AddVirtualLocalVariable( int nodeId, string variable, string value ) - { - if( string.IsNullOrEmpty( value ) ) - return string.Empty; - - string result = string.Empty; - - //switch ( m_portCategory ) - //{ - //case MasterNodePortCategory.Vertex: - //case MasterNodePortCategory.Tessellation: - //{ - //} - //break; - //case MasterNodePortCategory.Fragment: - //case MasterNodePortCategory.Debug: - //{ - if( !m_virtualVariablesDict.ContainsKey( value ) ) - { - m_virtualVariablesDict.Add( value, variable ); - result = variable; - } - else - { - m_virtualVariablesDict.TryGetValue( value, out result ); - } - //} - //break; - //} - - return result; - } - - public void AddCodeComments( bool forceForwardSlash, params string[] comments ) - { - if( m_portCategory == MasterNodePortCategory.Tessellation || m_portCategory == MasterNodePortCategory.Vertex ) - { - AddToVertexLocalVariables( 0, IOUtils.CreateCodeComments( forceForwardSlash, comments ) ); - } - else - { - AddToLocalVariables( 0, IOUtils.CreateCodeComments( forceForwardSlash, comments ) ); - } - } - - public bool HasLocalVariable( string value ) - { - switch( m_portCategory ) - { - case MasterNodePortCategory.Vertex: - case MasterNodePortCategory.Tessellation: - { - return m_vertexLocalVariablesDict.ContainsKey( value ); - } - case MasterNodePortCategory.Fragment: - case MasterNodePortCategory.Debug: - { - if( m_usingCustomOutput ) - { - return m_customOutputDict.ContainsKey( value ); - } - else - { - return m_localVariablesDict.ContainsKey( value ); - } - } - } - return false; - } - - public bool AddToLocalVariables( int nodeId, string value, bool ignoreDuplicates = false ) - { - if( string.IsNullOrEmpty( value ) ) - return false; - - if( m_usingCustomOutput ) - { - if( !m_customOutputDict.ContainsKey( value ) || ignoreDuplicates ) - { - if( !m_customOutputDict.ContainsKey( value ) ) - m_customOutputDict.Add( value, new PropertyDataCollector( nodeId, value ) ); - - m_customOutputList.Add( m_customOutputDict[ value ] ); - m_customOutput += "\t\t\t" + value + '\n'; - return true; - } - else - { - if( m_showDebugMessages ) UIUtils.ShowMessage( "AddToLocalVariables:Attempting to add duplicate " + value, MessageSeverity.Warning ); - } - } - else - { - if( !m_localVariablesDict.ContainsKey( value ) || ignoreDuplicates ) - { - if( !m_localVariablesDict.ContainsKey( value ) ) - m_localVariablesDict.Add( value, new PropertyDataCollector( nodeId, value ) ); - - m_localVariablesList.Add( m_localVariablesDict[ value ] ); - AddToSpecialLocalVariables( nodeId, value, ignoreDuplicates ); - return true; - } - else - { - if( m_showDebugMessages ) UIUtils.ShowMessage( "AddToLocalVariables:Attempting to add duplicate " + value, MessageSeverity.Warning ); - } - } - return false; - } - - public void AddToSpecialLocalVariables( int nodeId, string value, bool ignoreDuplicates = false ) - { - if( string.IsNullOrEmpty( value ) ) - return; - - if( m_usingCustomOutput ) - { - if( !m_customOutputDict.ContainsKey( value ) || ignoreDuplicates ) - { - if( !m_customOutputDict.ContainsKey( value ) ) - m_customOutputDict.Add( value, new PropertyDataCollector( nodeId, value ) ); - - m_customOutputList.Add( m_customOutputDict[ value ] ); - m_customOutput += "\t\t\t" + value + '\n'; - m_dirtySpecialLocalVariables = true; - } - else - { - if( m_showDebugMessages ) UIUtils.ShowMessage( "AddToSpecialLocalVariables:Attempting to add duplicate " + value, MessageSeverity.Warning ); - } - } - else - { - if( !m_specialLocalVariablesDict.ContainsKey( value ) || ignoreDuplicates ) - { - if( !m_specialLocalVariablesDict.ContainsKey( value ) ) - m_specialLocalVariablesDict.Add( value, new PropertyDataCollector( nodeId, value ) ); - - m_specialLocalVariablesList.Add( m_specialLocalVariablesDict[ value ] ); - m_specialLocalVariables += "\t\t\t" + value + '\n'; - m_dirtySpecialLocalVariables = true; - } - else - { - if( m_showDebugMessages ) UIUtils.ShowMessage( "AddToSpecialLocalVariables:Attempting to add duplicate " + value, MessageSeverity.Warning ); - } - } - } - - public void ClearSpecialLocalVariables() - { - //m_specialLocalVariablesDict.Clear(); - m_specialLocalVariables = string.Empty; - m_dirtySpecialLocalVariables = false; - } - - public bool AddToVertexLocalVariables( int nodeId, string varName, string varValue ) - { - if( string.IsNullOrEmpty( varName ) || string.IsNullOrEmpty( varValue ) ) - return false; - - string value = varName + " = " + varValue + ";"; - return AddToVertexLocalVariables( nodeId, value ); - } - - public bool AddToVertexLocalVariables( int nodeId, PrecisionType precisionType, WirePortDataType type, string varName, string varValue ) - { - if( string.IsNullOrEmpty( varName ) || string.IsNullOrEmpty( varValue ) ) - return false; - - string value = UIUtils.PrecisionWirePortToCgType( precisionType, type ) + " " + varName + " = " + varValue + ";"; - return AddToVertexLocalVariables( nodeId, value ); - } - - public bool AddToVertexLocalVariables( int nodeId, string value, bool ignoreDuplicates = false ) - { - if( string.IsNullOrEmpty( value ) ) - return false; - - if( !m_vertexLocalVariablesDict.ContainsKey( value ) || ignoreDuplicates ) - { - if( !m_vertexLocalVariablesDict.ContainsKey( value ) ) - m_vertexLocalVariablesDict.Add( value, new PropertyDataCollector( nodeId, value ) ); - - m_vertexLocalVariablesList.Add( m_vertexLocalVariablesDict[ value ] ); - m_vertexLocalVariables += "\t\t\t" + value + '\n'; - m_dirtyVertexLocalVariables = true; - return true; - } - else - { - if( m_showDebugMessages ) UIUtils.ShowMessage( "AddToVertexLocalVariables:Attempting to add duplicate " + value, MessageSeverity.Warning ); - } - - return false; - } - - public void ClearVertexLocalVariables() - { - //m_vertexLocalVariablesDict.Clear(); - m_vertexLocalVariables = string.Empty; - m_dirtyVertexLocalVariables = false; - } - - - public bool CheckFunction( string header ) - { - return m_localFunctions.ContainsKey( header ); - } - - public string AddFunctions( string header, string body, params object[] inParams ) - { - if( !m_localFunctions.ContainsKey( header ) ) - { - m_localFunctions.Add( header, body ); - m_functionsList.Add( new PropertyDataCollector( -1, body.Replace( "\t\t", string.Empty ) ) ); - m_functions += "\n" + body + "\n"; - m_dirtyFunctions = true; - } - - return String.Format( header, inParams ); - } - - public string AddFunctions( string header, string[] bodyLines, bool addNewLine, params object[] inParams ) - { - if( !m_localFunctions.ContainsKey( header ) ) - { - string body = string.Empty; - for( int i = 0; i < bodyLines.Length; i++ ) - { - body += ( m_masterNodeCategory == AvailableShaderTypes.Template ) ? bodyLines[ i ] : "\t\t" + bodyLines[ i ]; - if( addNewLine ) - body += '\n'; - } - - m_localFunctions.Add( header, body ); - m_functionsList.Add( new PropertyDataCollector( -1, body ) ); - m_functions += "\n" + body + "\n"; - m_dirtyFunctions = true; - } - - return String.Format( header, inParams ); - } - - public bool HasFunction( string functionId ) - { - return m_localFunctions.ContainsKey( functionId ); - } - - public void AddFunction( string functionId, string body ) - { - if( !m_localFunctions.ContainsKey( functionId ) ) - { - m_functionsList.Add( new PropertyDataCollector( -1, body ) ); - - m_localFunctions.Add( functionId, body ); - m_functions += "\n" + body + "\n"; - m_dirtyFunctions = true; - } - } - - public void AddFunction( string functionId, string[] bodyLines, bool addNewline ) - { - if( !m_localFunctions.ContainsKey( functionId ) ) - { - string body = string.Empty; - for( int i = 0; i < bodyLines.Length; i++ ) - { - body += ( m_masterNodeCategory == AvailableShaderTypes.Template ) ? bodyLines[ i ] : "\t\t" + bodyLines[ i ]; - if( addNewline ) - body += '\n'; - - } - m_functionsList.Add( new PropertyDataCollector( -1, body ) ); - - m_localFunctions.Add( functionId, body ); - m_functions += "\n" + body + "\n"; - m_dirtyFunctions = true; - } - } - - public void AddInstructions( string value, bool addTabs = false, bool addLineEnding = false ) - { - m_instructionsList.Add( new PropertyDataCollector( -1, value ) ); - m_instructions += addTabs ? "\t\t\t" + value : value; - if( addLineEnding ) - { - m_instructions += '\n'; - } - m_dirtyInstructions = true; - } - - - public void AddInstructions( bool addLineEnding, bool addTabs, params string[] values ) - { - for( int i = 0; i < values.Length; i++ ) - { - m_instructionsList.Add( new PropertyDataCollector( -1, values[ i ] ) ); - m_instructions += addTabs ? "\t\t\t" + values[ i ] : values[ i ]; - if( addLineEnding ) - { - m_instructions += '\n'; - } - } - m_dirtyInstructions = true; - } - - - - public void AddToStartInstructions( string value ) - { - if( string.IsNullOrEmpty( value ) ) - return; - - m_instructions = value + m_instructions; - m_dirtyInstructions = true; - } - - public void ResetInstructions() - { - m_instructionsList.Clear(); - m_instructions = string.Empty; - m_dirtyInstructions = false; - } - - - public void ResetVertexInstructions() - { - m_vertexDataList.Clear(); - m_vertexData = string.Empty; - m_dirtyPerVertexData = false; - } - - public void AddPropertyNode( PropertyNode node ) - { - if( !m_propertyNodes.ContainsKey( node.UniqueId ) ) - { - m_propertyNodes.Add( node.UniqueId, node ); - } - } - - public void UpdateMaterialOnPropertyNodes( Material material ) - { - m_masterNode.UpdateMaterial( material ); - foreach( KeyValuePair<int, PropertyNode> kvp in m_propertyNodes ) - { - kvp.Value.UpdateMaterial( material ); - } - } - - public void AddToVertexInput( string value ) - { - if( !m_vertexInputDict.ContainsKey( value ) ) - { - m_vertexInputDict.Add( value, value ); - m_vertexInputList.Add( value ); - } - } - - public void AddToInterpolators( string value ) - { - if( !m_interpolatorsDict.ContainsKey( value ) ) - { - m_interpolatorsDict.Add( value, value ); - m_interpolatorsList.Add( value ); - } - } - - public void AddToVertexInterpolatorsDecl( string value ) - { - if( !m_vertexInterpDeclDict.ContainsKey( value ) ) - { - m_vertexInterpDeclDict.Add( value, value ); - m_vertexInterpDeclList.Add( value ); - } - } - - public void UpdateShaderImporter( ref Shader shader ) - { - ShaderImporter importer = (ShaderImporter)ShaderImporter.GetAtPath( AssetDatabase.GetAssetPath( shader ) ); - if( m_propertyNodes.Count > 0 ) - { - try - { - bool hasContents = false; - TextureDefaultsDataColector defaultCol = new TextureDefaultsDataColector(); - foreach( KeyValuePair<int, PropertyNode> kvp in m_propertyNodes ) - { - hasContents = kvp.Value.UpdateShaderDefaults( ref shader, ref defaultCol ) || hasContents; - } - - if( hasContents ) - { - importer.SetDefaultTextures( defaultCol.NamesArr, defaultCol.ValuesArr ); - defaultCol.Destroy(); - defaultCol = null; - } - } - catch( Exception e ) - { - Debug.LogException( e ); - } - } - importer.SaveAndReimport(); - } - - public void AddCustomAppData( string value ) - { - if( m_customAppDataItemsDict.ContainsKey( value ) ) - return; - - m_customAppDataItemsDict.Add( value, value ); - m_customAppDataItems += "\t\t\t" + value + "\n"; - m_dirtyAppData = true; - } - public string CustomAppDataName { get { return m_dirtyAppData ? Constants.CustomAppDataFullName : Constants.AppDataFullName; } } - - public string CustomAppData - { - get - { - if( m_dirtyPerVertexData ) - return Constants.CustomAppDataFullBody + m_customAppDataItems + "\t\t};\n"; - - return string.Empty; - } - } - - public void Destroy() - { - m_masterNode = null; - - m_customAppDataItemsDict.Clear(); - m_customAppDataItemsDict = null; - - m_inputList.Clear(); - m_inputList = null; - - m_customInputList.Clear(); - m_customInputList = null; - - m_propertiesList.Clear(); - m_propertiesList = null; - - m_instancedPropertiesList.Clear(); - m_instancedPropertiesList = null; - - m_dotsPropertiesList.Clear(); - m_dotsPropertiesList = null; - - m_dotsDefinesList.Clear(); - m_dotsDefinesList = null; - - m_uniformsList.Clear(); - m_uniformsList = null; - - m_additionalDirectivesList.Clear(); - m_additionalDirectivesList = null; - - m_includesList.Clear(); - m_includesList = null; - - //m_tagsList.Clear(); - //m_tagsList = null; - - m_pragmasList.Clear(); - m_pragmasList = null; - - m_definesList.Clear(); - m_definesList = null; - - m_instructionsList.Clear(); - m_instructionsList = null; - - m_localVariablesList.Clear(); - m_localVariablesList = null; - - m_vertexLocalVariablesList.Clear(); - m_vertexLocalVariablesList = null; - - m_specialLocalVariablesList.Clear(); - m_specialLocalVariablesList = null; - - m_vertexDataList.Clear(); - m_vertexDataList = null; - - m_customOutputList.Clear(); - m_customOutputList = null; - - m_functionsList.Clear(); - m_functionsList = null; - - m_grabPassList.Clear(); - m_grabPassList = null; - - m_aboveUsePassesList.Clear(); - m_aboveUsePassesList = null; - - m_belowUsePassesList.Clear(); - m_belowUsePassesList = null; - - m_grabPassDict.Clear(); - m_grabPassDict = null; - - m_usePassesDict.Clear(); - m_usePassesDict = null; - - m_propertyNodes.Clear(); - m_propertyNodes = null; - - m_inputDict.Clear(); - m_inputDict = null; - - m_customInputDict.Clear(); - m_customInputDict = null; - - m_propertiesDict.Clear(); - m_propertiesDict = null; - - m_dotsPropertiesDict.Clear(); - m_dotsPropertiesDict = null; - - m_instancedPropertiesDict.Clear(); - m_instancedPropertiesDict = null; - - m_uniformsDict.Clear(); - m_uniformsDict = null; - - m_softRegisteredUniformsDict.Clear(); - m_softRegisteredUniformsDict = null; - - m_includesDict.Clear(); - m_includesDict = null; - - m_additionalDirectivesDict.Clear(); - m_additionalDirectivesDict = null; - - m_includesExclusionDict.Clear(); - m_includesExclusionDict = null; - //m_tagsDict.Clear(); - //m_tagsDict = null; - - m_pragmasDict.Clear(); - m_pragmasDict = null; - - m_definesDict.Clear(); - m_definesDict = null; - - m_virtualCoordinatesDict.Clear(); - m_virtualCoordinatesDict = null; - - m_virtualVariablesDict.Clear(); - m_virtualVariablesDict = null; - - m_localVariablesDict.Clear(); - m_localVariablesDict = null; - - m_specialLocalVariablesDict.Clear(); - m_specialLocalVariablesDict = null; - - m_vertexLocalVariablesDict.Clear(); - m_vertexLocalVariablesDict = null; - - m_localFunctions.Clear(); - m_localFunctions = null; - - m_vertexDataDict.Clear(); - m_vertexDataDict = null; - - m_customOutputDict.Clear(); - m_customOutputDict = null; - - //templates - m_vertexInputList.Clear(); - m_vertexInputList = null; - - m_vertexInputDict.Clear(); - m_vertexInputDict = null; - - m_interpolatorsList.Clear(); - m_interpolatorsList = null; - - m_interpolatorsDict.Clear(); - m_interpolatorsDict = null; - - m_vertexInterpDeclList.Clear(); - m_vertexInterpDeclList = null; - - m_vertexInterpDeclDict.Clear(); - m_vertexInterpDeclDict = null; - - m_templateDataCollector.Destroy(); - m_templateDataCollector = null; - - m_customShadowCoordsDict.Clear(); - m_customShadowCoordsDict = null; - - m_customShadowCoordsList.Clear(); - m_customShadowCoordsDict = null; - - m_packSlotsList.Clear(); - m_packSlotsList = null; - } - - public string Inputs { get { return m_input; } } - public string CustomInput { get { return m_customInput; } } - public string Properties { get { return m_properties; } } - public string InstanceBlockName { get { return m_instanceBlockName; } } - public string InstancedProperties { get { return m_instancedProperties; } } - public string Uniforms { get { return m_uniforms; } } - public string Instructions { get { return m_instructions; } } - public string Includes { get { return m_includes; } } - public string Pragmas { get { return m_pragmas; } } - public string Defines { get { return m_defines; } } - public string LocalVariables { get { return m_localVariables; } } - public string SpecialLocalVariables { get { return m_specialLocalVariables; } } - public string VertexLocalVariables { get { return m_vertexLocalVariables; } } - //public string VertexLocalVariablesFromList - //{ - // get - // { - // string result = string.Empty; - // int count = m_vertexLocalVariablesList.Count; - // for( int i = 0; i < count; i++ ) - // { - // result += m_vertexLocalVariablesList[ i ].PropertyName + "\n"; - // } - // return result; - // } - //} - public string VertexData { get { return m_vertexData; } } - public string CustomOutput { get { return m_customOutput; } } - public string Functions { get { return m_functions; } } - public string GrabPass { get { return m_grabPass; } } - public bool DirtyAppData { get { return m_dirtyAppData; } } - public bool DirtyInstructions { get { return m_dirtyInstructions; } } - public bool DirtyUniforms { get { return m_dirtyUniforms; } } - public bool DirtyProperties { get { return m_dirtyProperties; } } - public bool DirtyInstancedProperties { get { return m_dirtyInstancedProperties; } } - public bool DirtyInputs { get { return m_dirtyInputs; } } - public bool DirtyCustomInput { get { return m_dirtyCustomInputs; } } - public bool DirtyIncludes { get { return m_dirtyIncludes; } } - public bool DirtyPragmas { get { return m_dirtyPragmas; } } - public bool DirtyDefines { get { return m_dirtyDefines; } } - public bool DirtyAdditionalDirectives { get { return m_dirtyAdditionalDirectives; } } - public bool DirtyLocalVariables { get { return m_dirtyLocalVariables; } } - public bool DirtyVertexVariables { get { return m_dirtyVertexLocalVariables; } } - public bool DirtySpecialLocalVariables { get { return m_dirtySpecialLocalVariables; } } - public bool DirtyPerVertexData { get { return m_dirtyPerVertexData; } } - public bool DirtyFunctions { get { return m_dirtyFunctions; } } - public bool DirtyGrabPass { get { return m_grabPassIsDirty; } } - public int LocalVariablesAmount { get { return m_localVariablesDict.Count; } } - public int SpecialLocalVariablesAmount { get { return m_specialLocalVariablesDict.Count; } } - public int VertexLocalVariablesAmount { get { return m_vertexLocalVariablesDict.Count; } } - public bool TesselationActive { set { m_tesselationActive = value; } get { return m_tesselationActive; } } - - - public int AvailableVertexTempId { get { return m_availableVertexTempId++; } } - public int AvailableFragTempId { get { return m_availableFragTempId++; } } - - /// <summary> - /// Returns true if Normal output is being written by something else - /// </summary> - public bool DirtyNormal - { - get { return m_dirtyNormal; } - set { m_dirtyNormal = value; } - } - - public bool IsFragmentCategory - { - get { return m_portCategory == MasterNodePortCategory.Fragment || m_portCategory == MasterNodePortCategory.Debug; } - } - - public MasterNodePortCategory PortCategory - { - get { return m_portCategory; } - set { m_portCategory = value; } - } - - public PortGenType GenType - { - get { return m_genType; } - set { m_genType = value; } - } - - public bool IsTemplate { get { return m_masterNodeCategory == AvailableShaderTypes.Template; } } - - public bool IsSRP { get { return ( TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.Lightweight || TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HD ); } } - - public AvailableShaderTypes MasterNodeCategory - { - get { return m_masterNodeCategory; } - set { m_masterNodeCategory = value; } - } - - /// <summary> - /// Forces write to Normal output when the output is not connected - /// </summary> - public bool ForceNormal - { - get { return m_forceNormal; } - set - { - if( value ) - { - if( !m_forceNormalIsDirty ) - { - m_forceNormal = value; - m_forceNormalIsDirty = value; - } - } - else - { - m_forceNormal = value; - } - } - } - - public bool UsingVertexColor - { - get { return m_usingVertexColor; } - set { m_usingVertexColor = value; } - } - - public bool UsingInternalData - { - get { return m_usingInternalData; } - set { m_usingInternalData = value; } - } - - public bool UsingScreenPos - { - get { return m_usingScreenPos; } - set { m_usingScreenPos = value; } - } - - public bool UsingCustomScreenPos - { - get { return m_usingCustomScreenPos; } - set { m_usingCustomScreenPos = value; } - } - - public bool UsingWorldNormal - { - get { return m_usingWorldNormal; } - set { m_usingWorldNormal = value; } - } - - public bool UsingWorldReflection - { - get { return m_usingWorldReflection; } - set { m_usingWorldReflection = value; } - } - - public bool UsingWorldPosition - { - get { return m_usingWorldPosition; } - set { m_usingWorldPosition = value; } - } - - public bool UsingViewDirection - { - get { return m_usingViewDirection; } - set { m_usingViewDirection = value; } - } - - public bool IsOutlineDataCollector - { - get { return m_isOutlineDataCollector; } - set { m_isOutlineDataCollector = value; } - } - - public bool UsingCustomOutlineColor - { - get { return m_usingCustomOutlineColor; } - set { m_usingCustomOutlineColor = value; } - } - - public bool UsingCustomOutlineWidth - { - get { return m_usingCustomOutlineWidth; } - set { m_usingCustomOutlineWidth = value; } - } - - public bool UsingCustomOutlineAlpha - { - get { return m_usingCustomOutlineAlpha; } - set { m_usingCustomOutlineAlpha = value; } - } - - public int CustomOutlineSelectedAlpha - { - get { return m_customOutlineSelectedAlpha; } - set { m_customOutlineSelectedAlpha = value; } - } - - public bool UsingCustomOutput - { - get { return m_usingCustomOutput; } - set { m_usingCustomOutput = value; } - } - - public bool UsingHigherSizeTexcoords - { - get { return m_usingHigherSizeTexcoords; } - set { m_usingHigherSizeTexcoords = value; } - } - - public bool UsingLightAttenuation - { - get { return m_usingLightAttenuation; } - set { m_usingLightAttenuation = value; } - } - - public bool UsingArrayDerivatives - { - get { return m_usingArrayDerivatives; } - set - { - if( value ) - { - MasterNodeDataCollector instance = this; - GeneratorUtils.AddCustomArraySamplingMacros( ref instance ); - } - - m_usingArrayDerivatives = value; - } - } - - public bool SafeNormalizeLightDir - { - get { return m_safeNormalizeLightDir; } - set { m_safeNormalizeLightDir = value; } - } - - public bool SafeNormalizeViewDir - { - get { return m_safeNormalizeViewDir; } - set { m_safeNormalizeViewDir = value; } - } - - public string StandardAdditionalDirectives - { - get - { - string body = string.Empty; - int count = m_additionalDirectivesList.Count; - for( int i = 0; i < count; i++ ) - { - body += "\t\t" + m_additionalDirectivesList[ i ].PropertyName + "\n"; - } - return body; - } - } - - public List<PropertyDataCollector> InputList { get { return m_inputList; } } - public List<PropertyDataCollector> CustomInputList { get { return m_customInputList; } } - public List<PropertyDataCollector> PropertiesList { get { return m_propertiesList; } } - public List<PropertyDataCollector> InstancedPropertiesList { get { return m_instancedPropertiesList; } } - public List<PropertyDataCollector> DotsPropertiesList { get { return m_dotsPropertiesList; } } - public List<PropertyDataCollector> DotsDefinesList { get { return m_dotsDefinesList; } } - public List<PropertyDataCollector> UniformsList { get { return m_uniformsList; } } - public List<PropertyDataCollector> MiscList { get { return m_additionalDirectivesList; } } - public List<PropertyDataCollector> BeforeNativeDirectivesList { get { return m_additionalDirectivesList.FindAll( obj => obj.OrderIndex < 0 ); } } - public List<PropertyDataCollector> AfterNativeDirectivesList { get { return m_additionalDirectivesList.FindAll( obj => obj.OrderIndex > 0 ); } } - public List<PropertyDataCollector> IncludesList { get { return m_includesList; } } - //public List<PropertyDataCollector> TagsList { get { return m_tagsList; } } - public List<PropertyDataCollector> PragmasList { get { return m_pragmasList; } } - public List<PropertyDataCollector> DefinesList { get { return m_definesList; } } - public List<PropertyDataCollector> InstructionsList { get { return m_instructionsList; } } - public List<PropertyDataCollector> LocalVariablesList { get { return m_localVariablesList; } } - public List<PropertyDataCollector> VertexLocalVariablesList { get { return m_vertexLocalVariablesList; } } - public List<PropertyDataCollector> SpecialLocalVariablesList { get { return m_specialLocalVariablesList; } } - public List<PropertyDataCollector> VertexDataList { get { return m_vertexDataList; } } - public List<PropertyDataCollector> CustomOutputList { get { return m_customOutputList; } } - public List<PropertyDataCollector> FunctionsList { get { return m_functionsList; } } - public List<PropertyDataCollector> GrabPassList { get { return m_grabPassList; } } - public Dictionary<string, string> GrabPassDict { get { return m_grabPassDict; } } - public List<PropertyDataCollector> AboveUsePassesList { get { return m_aboveUsePassesList; } } - public List<PropertyDataCollector> BelowUsePassesList { get { return m_belowUsePassesList; } } - public Dictionary<string, string> AboveUsePassesDict { get { return m_usePassesDict; } } - public List<InputCoordsCollector> CustomShadowCoordsList { get { return m_customShadowCoordsList; } } - public List<int> PackSlotsList { get { return m_packSlotsList; } } - public Dictionary<string, string> LocalFunctions { get { return m_localFunctions; } } - //Templates - public List<string> VertexInputList { get { return m_vertexInputList; } } - public List<string> InterpolatorList { get { return m_interpolatorsList; } } - public List<string> VertexInterpDeclList { get { return m_vertexInterpDeclList; } } - public TemplateDataCollector TemplateDataCollectorInstance { get { return m_templateDataCollector; } } - public RenderPath CurrentRenderPath - { - get { return m_renderPath; } - set { m_renderPath = value; } - } - - public NodeAvailability CurrentCanvasMode { get { return m_currentCanvasMode; } set { m_currentCanvasMode = value; } } - public TemplateSRPType CurrentSRPType - { - get - { - if( IsTemplate ) - return m_templateDataCollector.CurrentSRPType; - - return TemplateSRPType.BuiltIn; - } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/MasterNodeDataCollector.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/MasterNodeDataCollector.cs.meta deleted file mode 100644 index 2b16420a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/MasterNodeDataCollector.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: d026d775ff431f34789437db3fb4abbb -timeCreated: 1481126959 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/OutlineOpHelper.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/OutlineOpHelper.cs deleted file mode 100644 index 38137434..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/OutlineOpHelper.cs +++ /dev/null @@ -1,629 +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.Collections.Generic; - -namespace AmplifyShaderEditor -{ - public enum OutlineMode - { - VertexOffset, - VertexScale - } - - [Serializable] - public sealed class OutlineOpHelper - { - - private string[] ModeTags = - { - "Tags{ }", - "Tags{ \"RenderType\" = \"TransparentCutout\" \"Queue\" = \"AlphaTest+0\"}", - "Tags{ \"RenderType\" = \"Transparent\" \"Queue\" = \"Transparent+0\"}", - "Tags{ \"RenderType\" = \"Transparent\" \"Queue\" = \"Transparent+0\" }" - }; - - private string[] ModePragma = - { - string.Empty, - string.Empty, - "alpha:fade ", - "alpha:premul " - }; - - - private readonly string OutlineSurfaceConfig = "#pragma surface outlineSurf Outline {0} keepalpha noshadow noambient novertexlights nolightmap nodynlightmap nodirlightmap nometa noforwardadd vertex:outlineVertexDataFunc "; - - private readonly string OutlineBodyStructBegin = "struct Input {"; - private readonly string OutlineBodyStructDefault = "\thalf filler;"; - private readonly string OutlineBodyStructEnd = "};"; - - private readonly string OutlineDefaultUniformColor = "half4 _ASEOutlineColor;"; - private readonly string OutlineDefaultUniformWidth = "half _ASEOutlineWidth;"; - private readonly string OutlineDefaultUniformColorInstanced = "UNITY_DEFINE_INSTANCED_PROP( half4, _ASEOutlineColor )"; - private readonly string OutlineDefaultUniformWidthInstanced = "UNITY_DEFINE_INSTANCED_PROP( half, _ASEOutlineWidth )"; - - private readonly string OutlineDefaultVertexHeader = "void outlineVertexDataFunc( inout appdata_full v, out Input o )\n\t\t{"; - private readonly string OutlineTessVertexHeader = "void outlineVertexDataFunc( inout appdata_full v )\n\t\t{"; - - private readonly string OutlineDefaultVertexOutputDeclaration = "\tUNITY_INITIALIZE_OUTPUT( Input, o );"; - - private readonly string[] OutlineSurfBody = { - "\to.Emission = _ASEOutlineColor.rgb;", - "\to.Alpha = 1;" - }; - - private readonly string[] OutlineSurfBodyInstanced = { - "\to.Emission = UNITY_ACCESS_INSTANCED_PROP(_ASEOutlineColor).rgb;", - "\to.Alpha = 1;" - }; - - private readonly string[] OutlineBodyDefaultSurfBegin = { - "}", - "inline half4 LightingOutline( SurfaceOutput s, half3 lightDir, half atten ) { return half4 ( 0,0,0, s.Alpha); }", - "void outlineSurf( Input i, inout SurfaceOutput o )", - "{"}; - - private readonly string[] OutlineBodyDefaultSurfEnd = { - "}", - "ENDCG", - "\n"}; - - //private const string OutlineInstancedHeader = "#pragma multi_compile_instancing"; - - //private readonly string[] OutlineBodyInstancedBegin = { - // "UNITY_INSTANCING_CBUFFER_START({0})", - // "\tUNITY_DEFINE_INSTANCED_PROP( half4, _ASEOutlineColor )", - // "\tUNITY_DEFINE_INSTANCED_PROP(half, _ASEOutlineWidth)", - // "UNITY_INSTANCING_CBUFFER_END", - // "void outlineVertexDataFunc( inout appdata_full v, out Input o )", - // "{", - // "\tUNITY_INITIALIZE_OUTPUT( Input, o );"}; - - //private readonly string[] OutlineBodyInstancedEnd = { - // "}", - // "inline half4 LightingOutline( SurfaceOutput s, half3 lightDir, half atten ) { return half4 ( 0,0,0, s.Alpha); }", - // "void outlineSurf( Input i, inout SurfaceOutput o ) { o.Emission = UNITY_ACCESS_INSTANCED_PROP( _ASEOutlineColor ).rgb; o.Alpha = 1; }", - // "ENDCG", - // "\n"}; - - private const string WidthVariableAccessInstanced = "UNITY_ACCESS_INSTANCED_PROP( _ASEOutlineWidth )"; - - private const string OutlineVertexOffsetMode = "\tv.vertex.xyz += ( v.normal * {0} );"; - private const string OutlineVertexScaleMode = "\tv.vertex.xyz *= ( 1 + {0});"; - private const string OutlineVertexCustomMode = "\tv.vertex.xyz += {0};"; - - private const string OutlineColorLabel = "Color"; - private const string OutlineWidthLabel = "Width"; - - private const string ColorPropertyName = "_ASEOutlineColor"; - private const string WidthPropertyName = "_ASEOutlineWidth"; - - - private const string WidthPropertyNameInstanced = "UNITY_ACCESS_INSTANCED_PROP(_ASEOutlineWidth)"; - - - - private const string ColorPropertyDec = "_ASEOutlineColor( \"Outline Color\", Color ) = ({0})"; - private const string OutlinePropertyDec = "_ASEOutlineWidth( \"Outline Width\", Float ) = {0}"; - - private const string ModePropertyStr = "Mode"; - - private const string NoFogStr = "No Fog"; - - private const string BillboardInstructionFormat = "\t{0};"; - - [SerializeField] - private Color m_outlineColor; - - [SerializeField] - private float m_outlineWidth; - - [SerializeField] - private bool m_enabled; - - [SerializeField] - private OutlineMode m_mode = OutlineMode.VertexOffset; - - [SerializeField] - private bool m_noFog = true; - - private CullMode m_cullMode = CullMode.Front; - private int m_zTestMode = 0; - private int m_zWriteMode = 0; - private bool m_dirtyInput = false; - private string m_inputs = string.Empty; - private List<PropertyDataCollector> m_inputList = new List<PropertyDataCollector>(); - private string m_uniforms = string.Empty; - private List<PropertyDataCollector> m_uniformList = new List<PropertyDataCollector>(); - private List<PropertyDataCollector> m_instancedPropertiesList = new List<PropertyDataCollector>(); - private string m_instancedProperties = string.Empty; - private string m_instructions = string.Empty; - private string m_functions = string.Empty; - private string m_includes = string.Empty; - private string m_pragmas = string.Empty; - private string m_defines = string.Empty; - private string m_vertexData = string.Empty; - private string m_grabPasses = string.Empty; - private Dictionary<string, string> m_localFunctions; - - //private OutlineMode m_customMode = OutlineMode.VertexOffset; - private int m_offsetMode = 0; - private bool m_customNoFog = true; - - public void Draw( ParentNode owner, GUIStyle toolbarstyle, Material mat ) - { - Color cachedColor = GUI.color; - GUI.color = new Color( cachedColor.r, cachedColor.g, cachedColor.b, 0.5f ); - EditorGUILayout.BeginHorizontal( toolbarstyle ); - GUI.color = cachedColor; - owner.ContainerGraph.ParentWindow.InnerWindowVariables.OutlineActiveMode = owner.GUILayoutToggle( owner.ContainerGraph.ParentWindow.InnerWindowVariables.OutlineActiveMode , EditorVariablesManager.OutlineActiveMode.LabelName, UIUtils.MenuItemToggleStyle, GUILayout.ExpandWidth( true ) ); - EditorGUI.BeginChangeCheck(); - m_enabled = owner.EditorGUILayoutToggle( string.Empty, m_enabled, UIUtils.MenuItemEnableStyle, GUILayout.Width( 16 ) ); - if( EditorGUI.EndChangeCheck() ) - { - if( m_enabled ) - UpdateToMaterial( mat ); - - UIUtils.RequestSave(); - } - EditorGUILayout.EndHorizontal(); - - if( owner.ContainerGraph.ParentWindow.InnerWindowVariables.OutlineActiveMode ) - { - cachedColor = GUI.color; - GUI.color = new Color( cachedColor.r, cachedColor.g, cachedColor.b, ( EditorGUIUtility.isProSkin ? 0.5f : 0.25f ) ); - EditorGUILayout.BeginVertical( UIUtils.MenuItemBackgroundStyle ); - GUI.color = cachedColor; - - EditorGUILayout.Separator(); - EditorGUI.BeginDisabledGroup( !m_enabled ); - - EditorGUI.indentLevel += 1; - { - m_mode = (OutlineMode)owner.EditorGUILayoutEnumPopup( ModePropertyStr, m_mode ); - - EditorGUI.BeginChangeCheck(); - m_outlineColor = owner.EditorGUILayoutColorField( OutlineColorLabel, m_outlineColor ); - if( EditorGUI.EndChangeCheck() && mat != null ) - { - if( mat.HasProperty( ColorPropertyName ) ) - { - mat.SetColor( ColorPropertyName, m_outlineColor ); - } - } - - EditorGUI.BeginChangeCheck(); - m_outlineWidth = owner.EditorGUILayoutFloatField( OutlineWidthLabel, m_outlineWidth ); - if( EditorGUI.EndChangeCheck() && mat != null ) - { - if( mat.HasProperty( WidthPropertyName ) ) - { - mat.SetFloat( WidthPropertyName, m_outlineWidth ); - } - } - - m_noFog = owner.EditorGUILayoutToggle( NoFogStr, m_noFog ); - } - - EditorGUI.indentLevel -= 1; - EditorGUI.EndDisabledGroup(); - EditorGUILayout.Separator(); - EditorGUILayout.EndVertical(); - } - } - - public void UpdateToMaterial( Material mat ) - { - if( mat == null ) - return; - - if( mat.HasProperty( ColorPropertyName ) ) - { - mat.SetColor( ColorPropertyName, m_outlineColor ); - } - - if( mat.HasProperty( WidthPropertyName ) ) - { - mat.SetFloat( WidthPropertyName, m_outlineWidth ); - } - } - - public void ReadFromString( ref uint index, ref string[] nodeParams ) - { - m_enabled = Convert.ToBoolean( nodeParams[ index++ ] ); - m_outlineWidth = Convert.ToSingle( nodeParams[ index++ ] ); - m_outlineColor = IOUtils.StringToColor( nodeParams[ index++ ] ); - if( UIUtils.CurrentShaderVersion() > 5004 ) - { - m_mode = (OutlineMode)Enum.Parse( typeof( OutlineMode ), nodeParams[ index++ ] ); - } - - if( UIUtils.CurrentShaderVersion() > 13902 ) - { - m_noFog = Convert.ToBoolean( nodeParams[ index++ ] ); - } - } - - public void WriteToString( ref string nodeInfo ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_enabled ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_outlineWidth ); - IOUtils.AddFieldValueToString( ref nodeInfo, IOUtils.ColorToString( m_outlineColor ) ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_mode ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_noFog ); - } - - public void AddToDataCollector( ref MasterNodeDataCollector dataCollector ) - { - if( !dataCollector.UsingCustomOutlineColor ) - dataCollector.AddToProperties( -1, string.Format( ColorPropertyDec, IOUtils.ColorToString( m_outlineColor ) ), -1 ); - if( !dataCollector.UsingCustomOutlineWidth ) - dataCollector.AddToProperties( -1, string.Format( OutlinePropertyDec, m_outlineWidth ), -1 ); - } - - public void UpdateFromMaterial( Material mat ) - { - if( mat.HasProperty( ColorPropertyName ) ) - { - m_outlineColor = mat.GetColor( ColorPropertyName ); - } - - if( mat.HasProperty( WidthPropertyName ) ) - { - m_outlineWidth = mat.GetFloat( WidthPropertyName ); - } - } - - void AddMultibodyString( string body , List<string> list ) - { - body = body.Replace( "\t\t", string.Empty ); - string[] strArr = body.Split( '\n' ); - for( int i = 0; i < strArr.Length; i++ ) - { - list.Add( strArr[ i ] ); - } - - } - public string[] OutlineFunctionBody( ref MasterNodeDataCollector dataCollector, bool instanced, bool isShadowCaster, string shaderName, string[] billboardInfo, ref TessellationOpHelper tessOpHelper, string target, PrecisionType precision ) - { - List<string> body = new List<string>(); - body.Add( ModeTags[ dataCollector.CustomOutlineSelectedAlpha ] ); - if( !string.IsNullOrEmpty( m_grabPasses )) - body.Add( m_grabPasses.Replace( "\t\t",string.Empty )); - - if( m_zWriteMode != 0 ) - body.Add( "ZWrite " + ZBufferOpHelper.ZWriteModeValues[ m_zWriteMode ] ); - if( m_zTestMode != 0 ) - body.Add( "ZTest " + ZBufferOpHelper.ZTestModeValues[ m_zTestMode ] ); - - body.Add( "Cull " + m_cullMode ); - body.Add( "CGPROGRAM" ); - if( tessOpHelper.EnableTesselation ) - { - body.Add( "#include \"" + TessellationOpHelper.TessInclude + "\"" ); - body.Add( "#pragma target " + target ); - } - else - { - body.Add( "#pragma target 3.0" ); - } - - bool customOutline = dataCollector.UsingCustomOutlineColor || dataCollector.UsingCustomOutlineWidth || dataCollector.UsingCustomOutlineAlpha; - int outlineMode = customOutline ? m_offsetMode : ( m_mode == OutlineMode.VertexOffset ? 0 : 1 ); - string extraOptions = ( customOutline ? m_customNoFog : m_noFog ) ? "nofog " : string.Empty; - if( dataCollector.CustomOutlineSelectedAlpha > 0 ) - { - extraOptions += ModePragma[ dataCollector.CustomOutlineSelectedAlpha ]; - } - - string surfConfig = string.Format( OutlineSurfaceConfig, extraOptions ); - - if( tessOpHelper.EnableTesselation ) - tessOpHelper.WriteToOptionalParams( ref surfConfig ); - - body.Add( surfConfig ); - if( !isShadowCaster ) - { - AddMultibodyString( m_defines, body ); - AddMultibodyString( m_includes, body ); - AddMultibodyString( m_pragmas, body ); - } - - //if( instanced ) - //{ - // body.Add( OutlineInstancedHeader ); - //} - - if( customOutline ) - { - if( isShadowCaster ) - { - - for( int i = 0; i < InputList.Count; i++ ) - { - dataCollector.AddToInput( InputList[ i ].NodeId, InputList[ i ].PropertyName, true ); - } - } - else - { - if( !string.IsNullOrEmpty( m_inputs ) ) - body.Add( m_inputs.Trim( '\t', '\n' ) ); - } - - if( !DirtyInput && !isShadowCaster ) - body.Add( OutlineBodyStructDefault ); - - if( !isShadowCaster ) - body.Add( OutlineBodyStructEnd ); - } - else if( !isShadowCaster ) - { - body.Add( OutlineBodyStructBegin ); - body.Add( OutlineBodyStructDefault ); - body.Add( OutlineBodyStructEnd ); - } - - if( instanced ) - { - //for( int i = 0; i < OutlineBodyInstancedBegin.Length; i++ ) - //{ - // body.Add( ( i == 0 ) ? string.Format( OutlineBodyInstancedBegin[ i ], shaderName ) : OutlineBodyInstancedBegin[ i ] ); - //} - - //if( (object)billboardInfo != null ) - //{ - // for( int j = 0; j < billboardInfo.Length; j++ ) - // { - // body.Add( string.Format( BillboardInstructionFormat, billboardInfo[ j ] ) ); - // } - //} - - //switch( outlineMode ) - //{ - // case 0: body.Add( string.Format( OutlineVertexOffsetMode, WidthVariableAccessInstanced ) ); break; - // case 1: body.Add( string.Format( OutlineVertexScaleMode, WidthVariableAccessInstanced ) ); break; - // case 2: body.Add( string.Format( OutlineVertexCustomMode, WidthVariableAccessInstanced ) ); break; - //} - //for( int i = 0; i < OutlineBodyInstancedEnd.Length; i++ ) - //{ - // body.Add( OutlineBodyInstancedEnd[ i ] ); - //} - bool openCBuffer = true; - if( customOutline ) - { - if( isShadowCaster ) - { - for( int i = 0; i < UniformList.Count; i++ ) - { - dataCollector.AddToUniforms( UniformList[ i ].NodeId, UniformList[ i ].PropertyName ); - } - - foreach( KeyValuePair<string, string> kvp in m_localFunctions ) - { - dataCollector.AddFunction( kvp.Key, kvp.Value ); - } - } - else - { - if( !string.IsNullOrEmpty( Uniforms ) ) - body.Add( Uniforms.Trim( '\t', '\n' ) ); - - openCBuffer = false; - body.Add( string.Format( IOUtils.InstancedPropertiesBegin, shaderName )); - if( !string.IsNullOrEmpty( InstancedProperties ) ) - body.Add( InstancedProperties.Trim( '\t', '\n' ) ); - } - } - - if( openCBuffer) - body.Add( string.Format( IOUtils.InstancedPropertiesBegin, shaderName ) ); - - if( !dataCollector.UsingCustomOutlineColor ) - body.Add( precision == PrecisionType.Float ? OutlineDefaultUniformColorInstanced.Replace( "half", "float" ) : OutlineDefaultUniformColorInstanced ); - - if( !dataCollector.UsingCustomOutlineWidth ) - body.Add( precision == PrecisionType.Float ? OutlineDefaultUniformWidthInstanced.Replace( "half", "float" ) : OutlineDefaultUniformWidthInstanced ); - - body.Add( IOUtils.InstancedPropertiesEnd ); - - //Functions - if( customOutline && !isShadowCaster ) - body.Add( Functions ); - - if( tessOpHelper.EnableTesselation && !isShadowCaster ) - { - body.Add( tessOpHelper.Uniforms().TrimStart( '\t' ) ); - body.Add( tessOpHelper.GetCurrentTessellationFunction.Trim( '\t', '\n' ) + "\n" ); - } - - if( tessOpHelper.EnableTesselation ) - { - body.Add( OutlineTessVertexHeader ); - } - else - { - body.Add( OutlineDefaultVertexHeader ); - body.Add( OutlineDefaultVertexOutputDeclaration ); - } - - if( customOutline ) - { - if( !string.IsNullOrEmpty( VertexData ) ) - body.Add( "\t" + VertexData.Trim( '\t', '\n' ) ); - } - - if( (object)billboardInfo != null ) - { - for( int j = 0; j < billboardInfo.Length; j++ ) - { - body.Add( string.Format( BillboardInstructionFormat, billboardInfo[ j ] ) ); - } - } - - switch( outlineMode ) - { - case 0: body.Add( string.Format( OutlineVertexOffsetMode, dataCollector.UsingCustomOutlineWidth ? "outlineVar" : WidthPropertyNameInstanced ) ); break; - case 1: body.Add( string.Format( OutlineVertexScaleMode, dataCollector.UsingCustomOutlineWidth ? "outlineVar" : WidthPropertyNameInstanced ) ); break; - case 2: body.Add( string.Format( OutlineVertexCustomMode, dataCollector.UsingCustomOutlineWidth ? "outlineVar" : WidthPropertyNameInstanced ) ); break; - } - - for( int i = 0; i < OutlineBodyDefaultSurfBegin.Length; i++ ) - { - body.Add( OutlineBodyDefaultSurfBegin[ i ] ); - } - if( dataCollector.UsingCustomOutlineColor || dataCollector.CustomOutlineSelectedAlpha > 0 ) - { - body.Add( "\t" + Instructions.Trim( '\t', '\n' ) ); - } - else - { - for( int i = 0; i < OutlineSurfBodyInstanced.Length; i++ ) - { - body.Add( OutlineSurfBodyInstanced[ i ] ); - } - } - - for( int i = 0; i < OutlineBodyDefaultSurfEnd.Length; i++ ) - { - body.Add( OutlineBodyDefaultSurfEnd[ i ] ); - } - } - else - { - if( customOutline ) - { - if( isShadowCaster ) - { - for( int i = 0; i < UniformList.Count; i++ ) - { - dataCollector.AddToUniforms( UniformList[ i ].NodeId, UniformList[ i ].PropertyName ); - } - - foreach( KeyValuePair<string, string> kvp in m_localFunctions ) - { - dataCollector.AddFunction( kvp.Key, kvp.Value ); - } - } - else - { - if( !string.IsNullOrEmpty( Uniforms ) ) - body.Add( Uniforms.Trim( '\t', '\n' ) ); - } - } - - if( !dataCollector.UsingCustomOutlineColor ) - body.Add( precision == PrecisionType.Float ? OutlineDefaultUniformColor.Replace( "half", "float" ) : OutlineDefaultUniformColor ); - - if( !dataCollector.UsingCustomOutlineWidth ) - body.Add( precision == PrecisionType.Float ? OutlineDefaultUniformWidth.Replace( "half", "float" ) : OutlineDefaultUniformWidth ); - - //Functions - if( customOutline && !isShadowCaster ) - body.Add( Functions ); - - if( tessOpHelper.EnableTesselation && !isShadowCaster ) - { - body.Add( tessOpHelper.Uniforms().TrimStart( '\t' ) ); - body.Add( tessOpHelper.GetCurrentTessellationFunction.Trim( '\t', '\n' ) + "\n" ); - } - - if( tessOpHelper.EnableTesselation ) - { - body.Add( OutlineTessVertexHeader ); - } - else - { - body.Add( OutlineDefaultVertexHeader ); - body.Add( OutlineDefaultVertexOutputDeclaration ); - } - - if( customOutline ) - { - if( !string.IsNullOrEmpty( VertexData ) ) - body.Add( "\t" + VertexData.Trim( '\t', '\n' ) ); - } - - if( (object)billboardInfo != null ) - { - for( int j = 0; j < billboardInfo.Length; j++ ) - { - body.Add( string.Format( BillboardInstructionFormat, billboardInfo[ j ] ) ); - } - } - - switch( outlineMode ) - { - case 0: body.Add( string.Format( OutlineVertexOffsetMode, dataCollector.UsingCustomOutlineWidth ? "outlineVar" : WidthPropertyName ) ); break; - case 1: body.Add( string.Format( OutlineVertexScaleMode, dataCollector.UsingCustomOutlineWidth ? "outlineVar" : WidthPropertyName ) ); break; - case 2: body.Add( string.Format( OutlineVertexCustomMode, dataCollector.UsingCustomOutlineWidth ? "outlineVar" : WidthPropertyName ) ); break; - } - for( int i = 0; i < OutlineBodyDefaultSurfBegin.Length; i++ ) - { - body.Add( OutlineBodyDefaultSurfBegin[ i ] ); - } - if( dataCollector.UsingCustomOutlineColor || dataCollector.CustomOutlineSelectedAlpha > 0 ) - { - body.Add( "\t" + Instructions.Trim( '\t', '\n' ) ); - } - else - { - for( int i = 0; i < OutlineSurfBody.Length; i++ ) - { - body.Add( OutlineSurfBody[ i ] ); - } - } - - for( int i = 0; i < OutlineBodyDefaultSurfEnd.Length; i++ ) - { - body.Add( OutlineBodyDefaultSurfEnd[ i ] ); - } - } - - string[] bodyArr = body.ToArray(); - body.Clear(); - body = null; - return bodyArr; - } - - - public void Destroy() - { - m_inputList = null; - m_uniformList = null; - m_instancedPropertiesList = null; - m_localFunctions = null; - } - - public bool EnableOutline { get { return m_enabled; } } - - public bool UsingCullMode { get { return m_cullMode != CullMode.Front; } } - public bool UsingZWrite { get { return m_zWriteMode != 0; } } - public bool UsingZTest { get { return m_zTestMode != 0; } } - public int ZWriteMode { get { return m_zWriteMode; } set { m_zWriteMode = value; } } - public int ZTestMode { get { return m_zTestMode; } set { m_zTestMode = value; } } - public CullMode OutlineCullMode { get { return m_cullMode; } set { m_cullMode = value; } } - public string Inputs { get { return m_inputs; } set { m_inputs = value; } } - public string Uniforms { get { return m_uniforms; } set { m_uniforms = value; } } - public string InstancedProperties { get { return m_instancedProperties; } set { m_instancedProperties = value; } } - public string Instructions { get { return m_instructions; } set { m_instructions = value; } } - public string Functions { get { return m_functions; } set { m_functions = value; } } - public string Includes { get { return m_includes; } set { m_includes = value; } } - public string Pragmas { get { return m_pragmas; } set { m_pragmas = value; } } - public string Defines { get { return m_defines; } set { m_defines = value; } } - public string VertexData { get { return m_vertexData; } set { m_vertexData = value; } } - public string GrabPasses { get { return m_grabPasses; } set { m_grabPasses = value; } } - public List<PropertyDataCollector> InputList { get { return m_inputList; } set { m_inputList = value; } } - public List<PropertyDataCollector> UniformList { get { return m_uniformList; } set { m_uniformList = value; } } - public List<PropertyDataCollector> InstancedPropertiesList { get { return m_instancedPropertiesList; } set { m_instancedPropertiesList = value; } } - - public Dictionary<string, string> LocalFunctions { get { return m_localFunctions; } set { m_localFunctions = value; } } - public bool DirtyInput { get { return m_dirtyInput; } set { m_dirtyInput = value; } } - - //public OutlineMode CustomMode { get { return m_customMode; } set { m_customMode = value; } } - public int OffsetMode { get { return m_offsetMode; } set { m_offsetMode = value; } } - public bool CustomNoFog { get { return m_customNoFog; } set { m_customNoFog = value; } } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/OutlineOpHelper.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/OutlineOpHelper.cs.meta deleted file mode 100644 index bb79b681..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/OutlineOpHelper.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: d0900a4b7d1563e49b6184d7579dcbec -timeCreated: 1487331466 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/OutputNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/OutputNode.cs deleted file mode 100644 index 1fffc290..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/OutputNode.cs +++ /dev/null @@ -1,90 +0,0 @@ -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; } } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/OutputNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/OutputNode.cs.meta deleted file mode 100644 index 79cae85e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/OutputNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: ed0ee3a73f11f344495d16b54bb3af29 -timeCreated: 1491918470 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/RenderingOptionsOpHelper.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/RenderingOptionsOpHelper.cs deleted file mode 100644 index 34c8e548..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/RenderingOptionsOpHelper.cs +++ /dev/null @@ -1,227 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using System.Collections.Generic; -using UnityEngine; -using UnityEditor; - -namespace AmplifyShaderEditor -{ - public enum DisableBatchingTagValues - { - True, - False, - LODFading - } - - [Serializable] - public class RenderingOptionsOpHelper - { - private const string RenderingOptionsStr = " Rendering Options"; - private readonly static GUIContent EmissionGIFlags = new GUIContent( "Emission GI Flag", "Modifies Emission GI flags" ); - private readonly static GUIContent LODCrossfadeContent = new GUIContent( " LOD Group Cross Fade", "Applies a dither crossfade to be used with LOD groups for smoother transitions. Uses one interpolator\nDefault: OFF" ); - private readonly static GUIContent DisableBatchingContent = new GUIContent( "Disable Batching", "\nDisables objects to be batched and used with DrawCallBatching Default: False" ); - private readonly static GUIContent IgnoreProjectorContent = new GUIContent( " Ignore Projector", "\nIf True then an object that uses this shader will not be affected by Projectors Default: False" ); - private readonly static GUIContent UseDefaultCasterContent = new GUIContent( " Use Default Shadow Caster", "\nIf True always use surface default shadow caster Default: False" ); - private readonly static GUIContent ForceNoShadowCastingContent = new GUIContent( " Force No Shadow Casting", "\nIf True then an object that is rendered using this subshader will never cast shadows Default: False" ); - private readonly static GUIContent ForceEnableInstancingContent = new GUIContent( " Force Enable Instancing", "\nIf True forces instancing on shader independent of having instanced properties" ); -#if UNITY_5_6_OR_NEWER - private readonly static GUIContent ForceDisableInstancingContent = new GUIContent( " Force Disable Instancing", "\nIf True forces disable instancing on shader independent of having instanced properties" ); -#endif - private readonly static GUIContent SpecularHightlightsContent = new GUIContent( " Fwd Specular Highlights Toggle", "\nIf True creates a material toggle to set Unity's internal specular highlight rendering keyword" ); - private readonly static GUIContent ReflectionsContent = new GUIContent( " Fwd Reflections Toggle", "\nIf True creates a material toggle to set Unity's internal reflections rendering keyword" ); - - [SerializeField] - private bool m_forceEnableInstancing = false; - - [SerializeField] - private bool m_forceDisableInstancing = false; - - [SerializeField] - private bool m_specularHighlightToggle = false; - - [SerializeField] - private bool m_reflectionsToggle = false; - - [SerializeField] - private bool m_lodCrossfade = false; - - [SerializeField] - private DisableBatchingTagValues m_disableBatching = DisableBatchingTagValues.False; - - [SerializeField] - private bool m_ignoreProjector = false; - - [SerializeField] - private bool m_useDefaultShadowCaster = false; - - [SerializeField] - private bool m_forceNoShadowCasting = false; - - [SerializeField] - private List<CodeGenerationData> m_codeGenerationDataList; - - public RenderingOptionsOpHelper() - { - m_codeGenerationDataList = new List<CodeGenerationData>(); - m_codeGenerationDataList.Add( new CodeGenerationData( " Exclude Deferred", "exclude_path:deferred" ) ); - m_codeGenerationDataList.Add( new CodeGenerationData( " Exclude Forward", "exclude_path:forward" ) ); - m_codeGenerationDataList.Add( new CodeGenerationData( " Exclude Legacy Deferred", "exclude_path:prepass" ) ); - m_codeGenerationDataList.Add( new CodeGenerationData( " Shadows", "noshadow" ) ); - m_codeGenerationDataList.Add( new CodeGenerationData( " Ambient Light", "noambient" ) ); - m_codeGenerationDataList.Add( new CodeGenerationData( " Per Vertex Light", "novertexlights" ) ); - m_codeGenerationDataList.Add( new CodeGenerationData( " Lightmaps", "nolightmap " ) ); - m_codeGenerationDataList.Add( new CodeGenerationData( " Dynamic Global GI", "nodynlightmap" ) ); - m_codeGenerationDataList.Add( new CodeGenerationData( " Directional lightmaps", "nodirlightmap" ) ); - m_codeGenerationDataList.Add( new CodeGenerationData( " Built-in Fog", "nofog" ) ); - m_codeGenerationDataList.Add( new CodeGenerationData( " Meta Pass", "nometa" ) ); - m_codeGenerationDataList.Add( new CodeGenerationData( " Add Pass", "noforwardadd" ) ); - } - - public bool IsOptionActive( string option ) - { - return !m_codeGenerationDataList.Find( x => x.Name.Equals( option ) ).IsActive; - } - - public void Draw( StandardSurfaceOutputNode owner ) - { - bool value = owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedRenderingOptions; - NodeUtils.DrawPropertyGroup( ref value, RenderingOptionsStr, () => - { - int codeGenCount = m_codeGenerationDataList.Count; - // Starting from index 4 because other options are already contemplated with m_renderPath and add/receive shadows - for( int i = 4; i < codeGenCount; i++ ) - { - m_codeGenerationDataList[ i ].IsActive = !owner.EditorGUILayoutToggleLeft( m_codeGenerationDataList[ i ].Name, !m_codeGenerationDataList[ i ].IsActive ); - } - m_lodCrossfade = owner.EditorGUILayoutToggleLeft( LODCrossfadeContent, m_lodCrossfade ); - m_ignoreProjector = owner.EditorGUILayoutToggleLeft( IgnoreProjectorContent, m_ignoreProjector ); - EditorGUI.BeginDisabledGroup( !owner.CastShadows ); - m_useDefaultShadowCaster = owner.EditorGUILayoutToggleLeft( UseDefaultCasterContent, m_useDefaultShadowCaster ); - EditorGUI.EndDisabledGroup(); - m_forceNoShadowCasting = owner.EditorGUILayoutToggleLeft( ForceNoShadowCastingContent, m_forceNoShadowCasting ); - if( owner.ContainerGraph.IsInstancedShader ) - { - GUI.enabled = false; - owner.EditorGUILayoutToggleLeft( ForceEnableInstancingContent, true ); - GUI.enabled = true; - } - else - { - m_forceEnableInstancing = owner.EditorGUILayoutToggleLeft( ForceEnableInstancingContent, m_forceEnableInstancing ); - } - -#if UNITY_5_6_OR_NEWER - m_forceDisableInstancing = owner.EditorGUILayoutToggleLeft( ForceDisableInstancingContent, m_forceDisableInstancing ); -#endif - m_specularHighlightToggle = owner.EditorGUILayoutToggleLeft( SpecularHightlightsContent, m_specularHighlightToggle ); - m_reflectionsToggle = owner.EditorGUILayoutToggleLeft( ReflectionsContent, m_reflectionsToggle ); - m_disableBatching = (DisableBatchingTagValues)owner.EditorGUILayoutEnumPopup( DisableBatchingContent, m_disableBatching ); - Material mat = owner.ContainerGraph.CurrentMaterial; - if( mat != null ) - { - mat.globalIlluminationFlags = (MaterialGlobalIlluminationFlags)owner.EditorGUILayoutEnumPopup( EmissionGIFlags, mat.globalIlluminationFlags ); - } - } ); - owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedRenderingOptions = value; - } - - public void Build( ref string OptionalParameters ) - { - int codeGenCount = m_codeGenerationDataList.Count; - - for( int i = 0; i < codeGenCount; i++ ) - { - if( m_codeGenerationDataList[ i ].IsActive ) - { - OptionalParameters += m_codeGenerationDataList[ i ].Value + Constants.OptionalParametersSep; - } - } - -#if UNITY_2017_1_OR_NEWER - if( m_lodCrossfade ) - { - OptionalParameters += Constants.LodCrossFadeOption2017 + Constants.OptionalParametersSep; - } -#endif - } - - public void ReadFromString( ref uint index, ref string[] nodeParams ) - { - for( int i = 0; i < m_codeGenerationDataList.Count; i++ ) - { - m_codeGenerationDataList[ i ].IsActive = Convert.ToBoolean( nodeParams[ index++ ] ); - } - - if( UIUtils.CurrentShaderVersion() > 10005 ) - { - m_lodCrossfade = Convert.ToBoolean( nodeParams[ index++ ] ); - } - - if( UIUtils.CurrentShaderVersion() > 10007 ) - { - m_disableBatching = (DisableBatchingTagValues)Enum.Parse( typeof( DisableBatchingTagValues ), nodeParams[ index++ ] ); - m_ignoreProjector = Convert.ToBoolean( nodeParams[ index++ ] ); - m_forceNoShadowCasting = Convert.ToBoolean( nodeParams[ index++ ] ); - } - - if( UIUtils.CurrentShaderVersion() > 11002 ) - { - m_forceEnableInstancing = Convert.ToBoolean( nodeParams[ index++ ] ); - } - - if( UIUtils.CurrentShaderVersion() > 15205 ) - { - m_forceDisableInstancing = Convert.ToBoolean( nodeParams[ index++ ] ); - } - - if( UIUtils.CurrentShaderVersion() > 14403 ) - { - m_specularHighlightToggle = Convert.ToBoolean( nodeParams[ index++ ] ); - m_reflectionsToggle = Convert.ToBoolean( nodeParams[ index++ ] ); - } - - if( UIUtils.CurrentShaderVersion() > 16307 ) - { - m_useDefaultShadowCaster = Convert.ToBoolean( nodeParams[ index++ ] ); - } - } - - public void WriteToString( ref string nodeInfo ) - { - for( int i = 0; i < m_codeGenerationDataList.Count; i++ ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_codeGenerationDataList[ i ].IsActive ); - } - - IOUtils.AddFieldValueToString( ref nodeInfo, m_lodCrossfade ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_disableBatching ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_ignoreProjector ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_forceNoShadowCasting ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_forceEnableInstancing ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_forceDisableInstancing ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_specularHighlightToggle ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_reflectionsToggle ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_useDefaultShadowCaster ); - } - - public void Destroy() - { - m_codeGenerationDataList.Clear(); - m_codeGenerationDataList = null; - } - public bool UseDefaultShadowCaster { get { return m_useDefaultShadowCaster; } } - public bool ForceEnableInstancing { get { return m_forceEnableInstancing; } } - public bool ForceDisableInstancing { get { return m_forceDisableInstancing; } } - - public bool LodCrossfade { get { return m_lodCrossfade; } } - public bool IgnoreProjectorValue { get { return m_ignoreProjector; } set { m_ignoreProjector = value; } } - public bool SpecularHighlightToggle { get { return m_specularHighlightToggle; } set { m_specularHighlightToggle = value; } } - public bool ReflectionsToggle { get { return m_reflectionsToggle; } set { m_reflectionsToggle = value; } } - - public string DisableBatchingTag { get { return ( m_disableBatching != DisableBatchingTagValues.False ) ? string.Format( Constants.TagFormat, "DisableBatching", m_disableBatching ) : string.Empty; } } - public string IgnoreProjectorTag { get { return ( m_ignoreProjector ) ? string.Format( Constants.TagFormat, "IgnoreProjector", "True" ) : string.Empty; } } - public string ForceNoShadowCastingTag { get { return ( m_forceNoShadowCasting ) ? string.Format( Constants.TagFormat, "ForceNoShadowCasting", "True" ) : string.Empty; } } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/RenderingOptionsOpHelper.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/RenderingOptionsOpHelper.cs.meta deleted file mode 100644 index e94a1528..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/RenderingOptionsOpHelper.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 26d840af03d4f7b418e9c7bece143648 -timeCreated: 1488906067 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/RenderingPlatformsOpHelper.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/RenderingPlatformsOpHelper.cs deleted file mode 100644 index c049d6d7..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/RenderingPlatformsOpHelper.cs +++ /dev/null @@ -1,238 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using UnityEditor; -using UnityEngine; -using System.Collections.Generic; - -namespace AmplifyShaderEditor -{ - [Serializable] - public class RenderPlatformInfo - { - public string Label; - public RenderPlatforms Value; - } - - [Serializable] - public class RenderingPlatformOpHelper - { - private const string RenderingPlatformsStr = " Rendering Platforms"; - private readonly RenderPlatformInfo[] RenderingPlatformsInfo = - { - new RenderPlatformInfo(){Label = " Direct3D 9", Value = RenderPlatforms.d3d9}, - new RenderPlatformInfo(){Label = " Direct3D 11 9.x", Value = RenderPlatforms.d3d11_9x}, - new RenderPlatformInfo(){Label = " Direct3D 11/12", Value = RenderPlatforms.d3d11}, - new RenderPlatformInfo(){Label = " OpenGL 3.x/4.x", Value = RenderPlatforms.glcore}, - new RenderPlatformInfo(){Label = " OpenGL ES 2.0", Value = RenderPlatforms.gles}, - new RenderPlatformInfo(){Label = " OpenGL ES 3.x", Value = RenderPlatforms.gles3}, - new RenderPlatformInfo(){Label = " iOS/Mac Metal", Value = RenderPlatforms.metal}, - new RenderPlatformInfo(){Label = " Vulkan", Value = RenderPlatforms.vulkan}, - new RenderPlatformInfo(){Label = " Xbox 360", Value = RenderPlatforms.xbox360}, - new RenderPlatformInfo(){Label = " Xbox One", Value = RenderPlatforms.xboxone}, - new RenderPlatformInfo(){Label = " PlayStation 4", Value = RenderPlatforms.ps4}, - new RenderPlatformInfo(){Label = " PlayStation Vita", Value = RenderPlatforms.psp2}, - new RenderPlatformInfo(){Label = " Nintendo 3DS", Value = RenderPlatforms.n3ds}, - new RenderPlatformInfo(){Label = " Nintendo Wii U", Value = RenderPlatforms.wiiu} - }; - - // Values from this dictionary must be the indices corresponding from the list above - private readonly Dictionary<RenderPlatforms, int> PlatformToIndex = new Dictionary<RenderPlatforms, int>() - { - {RenderPlatforms.d3d9, 0}, - {RenderPlatforms.d3d11_9x, 1}, - {RenderPlatforms.d3d11, 2}, - {RenderPlatforms.glcore, 3}, - {RenderPlatforms.gles, 4}, - {RenderPlatforms.gles3, 5}, - {RenderPlatforms.metal, 6}, - {RenderPlatforms.vulkan, 7}, - {RenderPlatforms.xbox360, 8}, - {RenderPlatforms.xboxone, 9}, - {RenderPlatforms.ps4, 10}, - {RenderPlatforms.psp2, 11}, - {RenderPlatforms.n3ds, 12}, - {RenderPlatforms.wiiu, 13} - }; - - - private readonly List<RenderPlatforms> LegacyIndexToPlatform = new List<RenderPlatforms>() - { - RenderPlatforms.d3d9, - RenderPlatforms.d3d11, - RenderPlatforms.glcore, - RenderPlatforms.gles, - RenderPlatforms.gles3, - RenderPlatforms.metal, - RenderPlatforms.d3d11_9x, - RenderPlatforms.xbox360, - RenderPlatforms.xboxone, - RenderPlatforms.ps4, - RenderPlatforms.psp2, - RenderPlatforms.n3ds, - RenderPlatforms.wiiu - }; - - [SerializeField] - private bool[] m_renderingPlatformValues; - - public RenderingPlatformOpHelper() - { - m_renderingPlatformValues = new bool[ RenderingPlatformsInfo.Length ]; - for( int i = 0; i < m_renderingPlatformValues.Length; i++ ) - { - m_renderingPlatformValues[ i ] = true; - } - } - - - public void Draw( ParentNode owner ) - { - bool value = owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedRenderingPlatforms; - NodeUtils.DrawPropertyGroup( ref value, RenderingPlatformsStr, () => - { - for( int i = 0; i < m_renderingPlatformValues.Length; i++ ) - { - m_renderingPlatformValues[ i ] = owner.EditorGUILayoutToggleLeft( RenderingPlatformsInfo[ i ].Label, m_renderingPlatformValues[ i ] ); - } - } ); - owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedRenderingPlatforms = value; - } - - public void SetRenderingPlatforms( ref string ShaderBody ) - { - int checkedPlatforms = 0; - int uncheckedPlatforms = 0; - - for( int i = 0; i < m_renderingPlatformValues.Length; i++ ) - { - if( m_renderingPlatformValues[ i ] ) - { - checkedPlatforms += 1; - } - else - { - uncheckedPlatforms += 1; - } - } - - if( checkedPlatforms > 0 && checkedPlatforms < m_renderingPlatformValues.Length ) - { - string result = string.Empty; - if( checkedPlatforms < uncheckedPlatforms ) - { - result = "only_renderers "; - for( int i = 0; i < m_renderingPlatformValues.Length; i++ ) - { - if( m_renderingPlatformValues[ i ] ) - { - result += (RenderPlatforms)RenderingPlatformsInfo[i].Value + " "; - } - } - } - else - { - result = "exclude_renderers "; - for( int i = 0; i < m_renderingPlatformValues.Length; i++ ) - { - if( !m_renderingPlatformValues[ i ] ) - { - result += (RenderPlatforms)RenderingPlatformsInfo[ i ].Value + " "; - } - } - } - MasterNode.AddShaderPragma( ref ShaderBody, result ); - } - } - - public void ReadFromString( ref uint index, ref string[] nodeParams ) - { - if( UIUtils.CurrentShaderVersion() < 17006 ) - { - for( int i = 0; i < m_renderingPlatformValues.Length; i++ ) - { - m_renderingPlatformValues[ i ] = false; - } - - int count = LegacyIndexToPlatform.Count; - int activeCount = 0; - for( int i = 0; i < count; i++ ) - { - RenderPlatforms platform = LegacyIndexToPlatform[ i ]; - int newIndex = PlatformToIndex[ platform ]; - bool value = Convert.ToBoolean( nodeParams[ index++ ] ); - if( value ) - { - m_renderingPlatformValues[ newIndex ] = true; - activeCount += 1; - } - else - { - m_renderingPlatformValues[ newIndex ] = false; - } - } - - if( activeCount == count ) - { - m_renderingPlatformValues[ PlatformToIndex[ RenderPlatforms.vulkan ] ] = true; - } - } - else - { - int count = Convert.ToInt32( nodeParams[ index++ ] ); - if( count > 0 ) - { - RenderPlatforms firstPlatform = (RenderPlatforms)Enum.Parse( typeof(RenderPlatforms), nodeParams[ index++ ] ); - if( firstPlatform == RenderPlatforms.all ) - { - for( int i = 0; i < m_renderingPlatformValues.Length; i++ ) - { - m_renderingPlatformValues[ i ] = true; - } - } - else - { - for( int i = 0; i < m_renderingPlatformValues.Length; i++ ) - { - m_renderingPlatformValues[ i ] = false; - } - - m_renderingPlatformValues[ PlatformToIndex[ firstPlatform ]] = true; - for( int i = 1; i < count; i++ ) - { - RenderPlatforms currPlatform = (RenderPlatforms)Enum.Parse( typeof( RenderPlatforms ), nodeParams[ index++ ] ); - m_renderingPlatformValues[ PlatformToIndex[ currPlatform ] ] = true; - } - } - } - } - } - - public void WriteToString( ref string nodeInfo ) - { - int active = 0; - for( int i = 0; i < m_renderingPlatformValues.Length; i++ ) - { - if( m_renderingPlatformValues[ i ] ) - active += 1; - } - IOUtils.AddFieldValueToString( ref nodeInfo, active ); - if( active == m_renderingPlatformValues.Length ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, RenderPlatforms.all ); - } - else - { - for( int i = 0; i < m_renderingPlatformValues.Length; i++ ) - { - if( m_renderingPlatformValues[ i ] ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, RenderingPlatformsInfo[i].Value ); - } - } - } - - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/RenderingPlatformsOpHelper.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/RenderingPlatformsOpHelper.cs.meta deleted file mode 100644 index 96f19245..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/RenderingPlatformsOpHelper.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 50a1f03b042823f469cef7d97c73fdc3 -timeCreated: 1488907373 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/StandardSurface.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/StandardSurface.cs deleted file mode 100644 index 9fd57e8a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/StandardSurface.cs +++ /dev/null @@ -1,3302 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using System.Collections.Generic; -using UnityEngine; -using UnityEditor; -using UnityEditorInternal; - -namespace AmplifyShaderEditor -{ - public enum VertexMode - { - Relative, - Absolute - } - - public enum RenderPath - { - All, - ForwardOnly, - DeferredOnly - } - - public enum StandardShaderLightModel - { - Standard, - StandardSpecular, - Lambert, - BlinnPhong, - Unlit, - CustomLighting - } - - public enum CullMode - { - Back, - Front, - Off - } - - public enum AlphaMode - { - Opaque = 0, - Masked = 1, - Transparent = 2, // Transparent (alpha:fade) - Translucent = 3, - Premultiply = 4, // Alpha Premul (alpha:premul) - Custom = 5, - } - - public enum RenderType - { - Opaque, - Transparent, - TransparentCutout, - Background, - Overlay, - TreeOpaque, - TreeTransparentCutout, - TreeBillboard, - Grass, - GrassBillboard, - Custom - } - - public enum RenderQueue - { - Background, - Geometry, - AlphaTest, - Transparent, - Overlay - } - - public enum RenderPlatforms - { - d3d9, - d3d11, - glcore, - gles, - gles3, - metal, - d3d11_9x, - xbox360, - xboxone, - ps4, - psp2, - n3ds, - wiiu, - vulkan, - all - } - - [Serializable] - public class NodeCache - { - public int TargetNodeId = -1; - public int TargetPortId = -1; - - public NodeCache( int targetNodeId, int targetPortId ) - { - SetData( targetNodeId, targetPortId ); - } - - public void SetData( int targetNodeId, int targetPortId ) - { - TargetNodeId = targetNodeId; - TargetPortId = targetPortId; - } - - public void Invalidate() - { - TargetNodeId = -1; - TargetPortId = -1; - } - - public bool IsValid - { - get { return ( TargetNodeId >= 0 ); } - } - - public override string ToString() - { - return "TargetNodeId " + TargetNodeId + " TargetPortId " + TargetPortId; - } - } - - [Serializable] - public class CacheNodeConnections - { - public Dictionary<string, List<NodeCache>> NodeCacheArray; - - public CacheNodeConnections() - { - NodeCacheArray = new Dictionary<string, List<NodeCache>>(); - } - - public void Add( string key, NodeCache value ) - { - if( NodeCacheArray.ContainsKey( key ) ) - { - NodeCacheArray[ key ].Add( value ); - } - else - { - NodeCacheArray.Add( key, new List<NodeCache>() ); - NodeCacheArray[ key ].Add( value ); - } - } - - public NodeCache Get( string key, int idx = 0 ) - { - if( NodeCacheArray.ContainsKey( key ) ) - { - if( idx < NodeCacheArray[ key ].Count ) - return NodeCacheArray[ key ][ idx ]; - } - return null; - } - - public List<NodeCache> GetList( string key ) - { - if( NodeCacheArray.ContainsKey( key ) ) - { - return NodeCacheArray[ key ]; - } - return null; - } - - public void Clear() - { - foreach( KeyValuePair<string, List<NodeCache>> kvp in NodeCacheArray ) - { - kvp.Value.Clear(); - } - NodeCacheArray.Clear(); - } - } - - [Serializable] - [NodeAttributes( "Standard Surface Output", "Master", "Surface shader generator output", null, KeyCode.None, false )] - public sealed class StandardSurfaceOutputNode : MasterNode, ISerializationCallbackReceiver - { - private readonly static string[] VertexLitFunc = { "\t\tinline half4 LightingUnlit( SurfaceOutput s, half3 lightDir, half atten )", - "\t\t{", - "\t\t\treturn half4 ( 0, 0, 0, s.Alpha );", - "\t\t}\n"}; - - private readonly static string[] FadeModeOptions = { "Opaque", "Masked", "Transparent", "Translucent", "Alpha Premultipled", "Custom" }; - private const string VertexModeStr = "Vertex Output"; - private readonly static GUIContent RenderPathContent = new GUIContent( "Render Path", "Selects and generates passes for the supported rendering paths\nDefault: All" ); - private const string ShaderModelStr = "Shader Model"; - private readonly static GUIContent LightModelContent = new GUIContent( "Light Model", "Surface shader lighting model defines how the surface reflects light\nDefault: Standard" ); - private readonly static GUIContent ShaderLODContent = new GUIContent( "Shader LOD", "Shader LOD" ); - private readonly static GUIContent CullModeContent = new GUIContent( "Cull Mode", "Polygon culling mode prevents rendering of either back-facing or front-facing polygons to save performance, turn it off if you want to render both sides\nDefault: Back" ); - - private const string ChromaticAberrationStr = "Chromatic Aberration"; - private const string DiscardStr = "Opacity Mask"; - private const string VertexDisplacementStr = "Local Vertex Offset"; - private const string VertexPositionStr = "Local Vertex Position"; - private const string VertexDataStr = "VertexData"; - private const string VertexNormalStr = "Local Vertex Normal"; - private const string CustomLightingStr = "Custom Lighting"; - private const string AlbedoStr = "Albedo"; - private const string NormalStr = "Normal"; - private const string EmissionStr = "Emission"; - private const string MetallicStr = "Metallic"; - private const string SmoothnessStr = "Smoothness"; - private const string OcclusionDataStr = "Occlusion"; - private const string OcclusionLabelStr = "Ambient Occlusion"; - private const string TransmissionStr = "Transmission"; - private const string TranslucencyStr = "Translucency"; - private const string RefractionStr = "Refraction"; - private const string AlphaStr = "Opacity"; - private const string AlphaDataStr = "Alpha"; - private const string DebugStr = "Debug"; - private const string SpecularStr = "Specular"; - private const string GlossStr = "Gloss"; - private const string CustomRenderTypeStr = "Custom Type"; - private readonly static GUIContent AlphaModeContent = new GUIContent( " Blend Mode", "Defines how the surface blends with the background\nDefault: Opaque" ); - private const string OpacityMaskClipValueStr = "Mask Clip Value"; - private readonly static GUIContent OpacityMaskClipValueContent = new GUIContent( "Mask Clip Value", "Default clip value to be compared with opacity alpha ( 0 = fully Opaque, 1 = fully Masked )\nDefault: 0.5" ); - private readonly static GUIContent CastShadowsContent = new GUIContent( "Cast Shadows", "Generates a shadow caster pass for vertex modifications and point lights in forward rendering\nDefault: ON" ); - private readonly static GUIContent ReceiveShadowsContent = new GUIContent( "Receive Shadows", "Untick it to disable shadow receiving, this includes self-shadowing (only for forward rendering) \nDefault: ON" ); - private readonly static GUIContent QueueIndexContent = new GUIContent( "Queue Index", "Value to offset the render queue, accepts both positive values to render later and negative values to render sooner\nDefault: 0" ); - private readonly static GUIContent RefractionLayerStr = new GUIContent( "Refraction Layer", "Use it to group or ungroup different refraction shaders into the same or different grabpass (only for forward rendering) \nDefault: 0" ); - private readonly static GUIContent AlphaToCoverageStr = new GUIContent( "Alpha To Coverage", "" ); - private readonly static GUIContent RenderQueueContent = new GUIContent( "Render Queue", "Base rendering queue index\n(Background = 1000, Geometry = 2000, AlphaTest = 2450, Transparent = 3000, Overlay = 4000)\nDefault: Geometry" ); - private readonly static GUIContent RenderTypeContent = new GUIContent( "Render Type", "Categorizes shaders into several predefined groups, usually to be used with screen shader effects\nDefault: Opaque" ); - - private const string ShaderInputOrderStr = "Shader Input Order"; - - - [SerializeField] - private BlendOpsHelper m_blendOpsHelper = new BlendOpsHelper(); - - [SerializeField] - private StencilBufferOpHelper m_stencilBufferHelper = new StencilBufferOpHelper(); - - [SerializeField] - private ZBufferOpHelper m_zBufferHelper = new ZBufferOpHelper(); - - [SerializeField] - private OutlineOpHelper m_outlineHelper = new OutlineOpHelper(); - - [SerializeField] - private TessellationOpHelper m_tessOpHelper = new TessellationOpHelper(); - - [SerializeField] - private ColorMaskHelper m_colorMaskHelper = new ColorMaskHelper(); - - [SerializeField] - private RenderingPlatformOpHelper m_renderingPlatformOpHelper = new RenderingPlatformOpHelper(); - - [SerializeField] - private RenderingOptionsOpHelper m_renderingOptionsOpHelper = new RenderingOptionsOpHelper(); - - [SerializeField] - private BillboardOpHelper m_billboardOpHelper = new BillboardOpHelper(); - - [SerializeField] - private FallbackPickerHelper m_fallbackHelper = null; - - [SerializeField] - private TerrainDrawInstancedHelper m_drawInstancedHelper = new TerrainDrawInstancedHelper(); - - //legacy - [SerializeField] - private AdditionalIncludesHelper m_additionalIncludes = new AdditionalIncludesHelper(); - //legacy - [SerializeField] - private AdditionalPragmasHelper m_additionalPragmas = new AdditionalPragmasHelper(); - //legacy - [SerializeField] - private AdditionalDefinesHelper m_additionalDefines = new AdditionalDefinesHelper(); - - [SerializeField] - private TemplateAdditionalDirectivesHelper m_additionalDirectives = new TemplateAdditionalDirectivesHelper( " Additional Directives" ); - - [SerializeField] - private AdditionalSurfaceOptionsHelper m_additionalSurfaceOptions = new AdditionalSurfaceOptionsHelper(); - - [SerializeField] - private UsePassHelper m_usePass; - - [SerializeField] - private CustomTagsHelper m_customTagsHelper = new CustomTagsHelper(); - - [SerializeField] - private DependenciesHelper m_dependenciesHelper = new DependenciesHelper(); - - [SerializeField] - private StandardShaderLightModel m_currentLightModel; - - [SerializeField] - private StandardShaderLightModel m_lastLightModel; - - [SerializeField] - private CullMode m_cullMode = CullMode.Back; - - [SerializeField] - private InlineProperty m_inlineCullMode = new InlineProperty(); - - [SerializeField] - private InlineProperty m_inlineChromaticAberration = new InlineProperty(0.1f); - - [SerializeField] - private AlphaMode m_alphaMode = AlphaMode.Opaque; - - [SerializeField] - private RenderType m_renderType = RenderType.Opaque; - - [SerializeField] - private string m_customRenderType = string.Empty; - - [SerializeField] - private RenderQueue m_renderQueue = RenderQueue.Geometry; - - [SerializeField] - private RenderPath m_renderPath = RenderPath.All; - - [SerializeField] - private VertexMode m_vertexMode = VertexMode.Relative; - - [SerializeField] - private bool m_customBlendMode = false; - - [SerializeField] - private float m_opacityMaskClipValue = 0.5f; - - [SerializeField] - private InlineProperty m_inlineOpacityMaskClipValue = new InlineProperty(); - - [SerializeField] - private InlineProperty m_inlineAlphaToCoverage = new InlineProperty(); - - [SerializeField] - private int m_customLightingPortId = -1; - - [SerializeField] - private int m_emissionPortId = -1; - - [SerializeField] - private int m_discardPortId = -1; - - [SerializeField] - private int m_opacityPortId = -1; - - [SerializeField] - private int m_vertexPortId = -1; - - [SerializeField] - private bool m_keepAlpha = true; - - [SerializeField] - private bool m_castShadows = true; - - //[SerializeField] - private bool m_customShadowCaster = false; - - [SerializeField] - private bool m_receiveShadows = true; - - [SerializeField] - private int m_queueOrder = 0; - - [SerializeField] - private int m_grabOrder = 0; - - [SerializeField] - private bool m_alphaToCoverage = false; - - private InputPort m_transmissionPort; - private InputPort m_translucencyPort; - private InputPort m_tessellationPort; - private bool m_previousTranslucencyOn = false; - private bool m_previousRefractionOn = false; - - [SerializeField] - private CacheNodeConnections m_cacheNodeConnections = new CacheNodeConnections(); - - - private bool m_usingProSkin = false; - private GUIStyle m_inspectorFoldoutStyle; - private GUIStyle m_inspectorToolbarStyle; - private GUIStyle m_inspectorTooldropdownStyle; - - - private bool m_customBlendAvailable = false; - - private Color m_cachedColor = Color.white; - private float m_titleOpacity = 0.5f; - private float m_boxOpacity = 0.5f; - - private InputPort m_refractionPort; - private InputPort m_normalPort; - - - private GUIStyle m_inspectorDefaultStyle; - - [SerializeField] - private ReordenatorNode m_specColorReorder = null; - - [SerializeField] - private int m_specColorOrderIndex = -1; - - [SerializeField] - private ReordenatorNode m_maskClipReorder = null; - - [SerializeField] - private int m_maskClipOrderIndex = -1; - - [SerializeField] - private ReordenatorNode m_translucencyReorder = null; - - [SerializeField] - private int m_translucencyOrderIndex = -1; - - [SerializeField] - private ReordenatorNode m_refractionReorder = null; - - [SerializeField] - private int m_refractionOrderIndex = -1; - - [SerializeField] - private ReordenatorNode m_tessellationReorder = null; - - [SerializeField] - private int m_tessellationOrderIndex = -1; - - private bool m_previousTessellationOn = false; - private bool m_initialize = true; - private bool m_checkChanges = true; - private bool m_lightModelChanged = true; - - private PropertyNode m_dummyProperty = null; - - protected override void CommonInit( int uniqueId ) - { - m_currentLightModel = m_lastLightModel = StandardShaderLightModel.Standard; - m_textLabelWidth = 120; - m_autoDrawInternalPortData = false; - base.CommonInit( uniqueId ); - m_zBufferHelper.ParentSurface = this; - m_tessOpHelper.ParentSurface = this; - m_customPrecision = true; - } - - public override void OnEnable() - { - base.OnEnable(); - if( m_usePass == null ) - { - m_usePass = ScriptableObject.CreateInstance<UsePassHelper>(); - m_usePass.Init( " Additional Use Passes" ); - } - - if( m_fallbackHelper == null ) - { - m_fallbackHelper = ScriptableObject.CreateInstance<FallbackPickerHelper>(); - m_fallbackHelper.Init(); - } - } - - public override void AddMasterPorts() - { - int vertexCorrection = 2; - int index = vertexCorrection + 2; - base.AddMasterPorts(); - switch( m_currentLightModel ) - { - case StandardShaderLightModel.Standard: - { - AddInputPort( WirePortDataType.FLOAT3, false, AlbedoStr, vertexCorrection + 1, MasterNodePortCategory.Fragment, 0 ); - AddInputPort( WirePortDataType.FLOAT3, false, NormalStr, vertexCorrection + 0, MasterNodePortCategory.Fragment, 1 ); - m_normalPort = m_inputPorts[ m_inputPorts.Count - 1 ]; - AddInputPort( WirePortDataType.FLOAT3, false, EmissionStr, index++, MasterNodePortCategory.Fragment, 2 ); - AddInputPort( WirePortDataType.FLOAT, false, MetallicStr, index++, MasterNodePortCategory.Fragment, 3 ); - AddInputPort( WirePortDataType.FLOAT, false, SmoothnessStr, index++, MasterNodePortCategory.Fragment, 4 ); - AddInputPort( WirePortDataType.FLOAT, false, OcclusionLabelStr, OcclusionDataStr, index++, MasterNodePortCategory.Fragment, 5 ); - } - break; - case StandardShaderLightModel.StandardSpecular: - { - AddInputPort( WirePortDataType.FLOAT3, false, AlbedoStr, vertexCorrection + 1, MasterNodePortCategory.Fragment, 0 ); - AddInputPort( WirePortDataType.FLOAT3, false, NormalStr, vertexCorrection + 0, MasterNodePortCategory.Fragment, 1 ); - m_normalPort = m_inputPorts[ m_inputPorts.Count - 1 ]; - AddInputPort( WirePortDataType.FLOAT3, false, EmissionStr, index++, MasterNodePortCategory.Fragment, 2 ); - AddInputPort( WirePortDataType.FLOAT3, false, SpecularStr, index++, MasterNodePortCategory.Fragment, 3 ); - AddInputPort( WirePortDataType.FLOAT, false, SmoothnessStr, index++, MasterNodePortCategory.Fragment, 4 ); - AddInputPort( WirePortDataType.FLOAT, false, OcclusionLabelStr, OcclusionDataStr, index++, MasterNodePortCategory.Fragment, 5 ); - } - break; - case StandardShaderLightModel.CustomLighting: - { - AddInputPort( WirePortDataType.FLOAT3, false, AlbedoStr, vertexCorrection + 1, MasterNodePortCategory.Fragment, 0 ); - AddInputPort( WirePortDataType.FLOAT3, false, NormalStr, vertexCorrection + 0, MasterNodePortCategory.Fragment, 1 ); - m_normalPort = m_inputPorts[ m_inputPorts.Count - 1 ]; - m_inputPorts[ m_inputPorts.Count - 1 ].Locked = true; - AddInputPort( WirePortDataType.FLOAT3, false, EmissionStr, index++, MasterNodePortCategory.Fragment, 2 ); - AddInputPort( WirePortDataType.FLOAT, false, SpecularStr, index++, MasterNodePortCategory.Fragment, 3 ); - m_inputPorts[ m_inputPorts.Count - 1 ].Locked = true; - AddInputPort( WirePortDataType.FLOAT, false, GlossStr, index++, MasterNodePortCategory.Fragment, 4 ); - m_inputPorts[ m_inputPorts.Count - 1 ].Locked = true; - } - break; - case StandardShaderLightModel.Unlit: - { - AddInputPort( WirePortDataType.FLOAT3, false, AlbedoStr, vertexCorrection + 1, MasterNodePortCategory.Fragment, 0 ); - m_inputPorts[ m_inputPorts.Count - 1 ].Locked = true; - AddInputPort( WirePortDataType.FLOAT3, false, NormalStr, vertexCorrection + 0, MasterNodePortCategory.Fragment, 1 ); - m_normalPort = m_inputPorts[ m_inputPorts.Count - 1 ]; - m_inputPorts[ m_inputPorts.Count - 1 ].Locked = true; - AddInputPort( WirePortDataType.FLOAT3, false, EmissionStr, index++, MasterNodePortCategory.Fragment, 2 ); - AddInputPort( WirePortDataType.FLOAT, false, SpecularStr, index++, MasterNodePortCategory.Fragment, 3 ); - m_inputPorts[ m_inputPorts.Count - 1 ].Locked = true; - AddInputPort( WirePortDataType.FLOAT, false, GlossStr, index++, MasterNodePortCategory.Fragment, 4 ); - m_inputPorts[ m_inputPorts.Count - 1 ].Locked = true; - } - break; - case StandardShaderLightModel.Lambert: - { - AddInputPort( WirePortDataType.FLOAT3, false, AlbedoStr, vertexCorrection + 1, MasterNodePortCategory.Fragment, 0 ); - AddInputPort( WirePortDataType.FLOAT3, false, NormalStr, vertexCorrection + 0, MasterNodePortCategory.Fragment, 1 ); - m_normalPort = m_inputPorts[ m_inputPorts.Count - 1 ]; - AddInputPort( WirePortDataType.FLOAT3, false, EmissionStr, index++, MasterNodePortCategory.Fragment, 2 ); - AddInputPort( WirePortDataType.FLOAT, false, SpecularStr, index++, MasterNodePortCategory.Fragment, 3 ); - AddInputPort( WirePortDataType.FLOAT, false, GlossStr, index++, MasterNodePortCategory.Fragment, 4 ); - } - break; - case StandardShaderLightModel.BlinnPhong: - { - AddInputPort( WirePortDataType.FLOAT3, false, AlbedoStr, vertexCorrection + 1, MasterNodePortCategory.Fragment, 0 ); - AddInputPort( WirePortDataType.FLOAT3, false, NormalStr, vertexCorrection + 0, MasterNodePortCategory.Fragment, 1 ); - m_normalPort = m_inputPorts[ m_inputPorts.Count - 1 ]; - AddInputPort( WirePortDataType.FLOAT3, false, EmissionStr, index++, MasterNodePortCategory.Fragment, 2 ); - AddInputPort( WirePortDataType.FLOAT, false, SpecularStr, index++, MasterNodePortCategory.Fragment, 3 ); - AddInputPort( WirePortDataType.FLOAT, false, GlossStr, index++, MasterNodePortCategory.Fragment, 4 ); - } - break; - } - - // instead of setting in the switch emission port is always at position 2; - m_emissionPortId = 2; - - AddInputPort( WirePortDataType.FLOAT3, false, TransmissionStr, index++, MasterNodePortCategory.Fragment, 6 ); - m_transmissionPort = m_inputPorts[ m_inputPorts.Count - 1 ]; - m_inputPorts[ m_inputPorts.Count - 1 ].Locked = ( m_currentLightModel == StandardShaderLightModel.Standard ) || ( m_currentLightModel == StandardShaderLightModel.StandardSpecular ) ? false : true; - - AddInputPort( WirePortDataType.FLOAT3, false, TranslucencyStr, index++, MasterNodePortCategory.Fragment, 7 ); - m_translucencyPort = m_inputPorts[ m_inputPorts.Count - 1 ]; - m_inputPorts[ m_inputPorts.Count - 1 ].Locked = ( m_currentLightModel == StandardShaderLightModel.Standard ) || ( m_currentLightModel == StandardShaderLightModel.StandardSpecular ) ? false : true; - - AddInputPort( WirePortDataType.FLOAT, false, RefractionStr, index + 2, MasterNodePortCategory.Fragment, 8 ); - m_refractionPort = m_inputPorts[ m_inputPorts.Count - 1 ]; - m_inputPorts[ m_inputPorts.Count - 1 ].Locked = ( m_alphaMode == AlphaMode.Opaque || m_alphaMode == AlphaMode.Masked || m_currentLightModel == StandardShaderLightModel.Unlit || m_currentLightModel == StandardShaderLightModel.CustomLighting ); - - AddInputPort( WirePortDataType.FLOAT, false, AlphaStr, index++, MasterNodePortCategory.Fragment, 9 ); - m_inputPorts[ m_inputPorts.Count - 1 ].DataName = AlphaDataStr; - m_opacityPortId = m_inputPorts.Count - 1; - m_inputPorts[ m_inputPorts.Count - 1 ].Locked = ( m_alphaMode == AlphaMode.Opaque || m_alphaMode == AlphaMode.Masked ); - - AddInputPort( WirePortDataType.FLOAT, false, DiscardStr, index++, MasterNodePortCategory.Fragment, 10 ); - m_inputPorts[ m_inputPorts.Count - 1 ].Locked = ( m_alphaMode != AlphaMode.Masked && m_alphaMode != AlphaMode.Custom ); - m_discardPortId = m_inputPorts.Count - 1; - - // This is done to take the index + 2 from refraction port into account and not overlap indexes - index++; - - AddInputPort( WirePortDataType.FLOAT3, false, CustomLightingStr, index++, MasterNodePortCategory.Fragment, 13 ); - m_inputPorts[ m_inputPorts.Count - 1 ].Locked = ( m_currentLightModel != StandardShaderLightModel.CustomLighting ); - m_inputPorts[ m_inputPorts.Count - 1 ].GenType = PortGenType.CustomLighting; - m_customLightingPortId = m_inputPorts.Count - 1; - - //////////////////////////////////////////////////////////////////////////////////////////////// - // Vertex functions - Adding ordex index in order to force these to be the last ones - // Well now they have been moved to be the first ones so operations on vertex are to be taken into account - // by dither, screen position and similar nodes - //////////////////////////////////////////////////////////////////////////////////////////////// - m_vertexPortId = m_inputPorts.Count; - m_tessOpHelper.VertexOffsetIndexPort = m_vertexPortId; - AddInputPort( WirePortDataType.FLOAT3, false, ( m_vertexMode == VertexMode.Relative ? VertexDisplacementStr : VertexPositionStr ), VertexDataStr, 0/*index++*/, MasterNodePortCategory.Vertex, 11 ); - AddInputPort( WirePortDataType.FLOAT3, false, VertexNormalStr, 1/*index++*/, MasterNodePortCategory.Vertex, 12 ); - - //AddInputPort( WirePortDataType.FLOAT3, false, CustomLightModelStr, index++, MasterNodePortCategory.Fragment, 13 ); - //m_inputPorts[ m_inputPorts.Count - 1 ].Locked = true;// !(m_currentLightModel == StandardShaderLightModel.CustomLighting); - - AddInputPort( WirePortDataType.FLOAT4, false, TessellationOpHelper.TessellationPortStr, index++, MasterNodePortCategory.Tessellation, 14 ); - m_tessellationPort = m_inputPorts[ m_inputPorts.Count - 1 ]; - m_tessOpHelper.MasterNodeIndexPort = m_tessellationPort.PortId; - - //////////////////////////////////////////////////////////////////////////////////// - AddInputPort( WirePortDataType.FLOAT3, false, DebugStr, index++, MasterNodePortCategory.Debug, 15 ); - - for( int i = 0; i < m_inputPorts.Count; i++ ) - { - m_inputPorts[ i ].CustomColor = Color.white; - } - m_sizeIsDirty = true; - } - - public override void ForcePortType() - { - int portId = 0; - switch( m_currentLightModel ) - { - case StandardShaderLightModel.Standard: - { - m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT3, false ); - m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT3, false ); - m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT3, false ); - m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT, false ); - m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT, false ); - m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT, false ); - } - break; - case StandardShaderLightModel.StandardSpecular: - { - m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT3, false ); - m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT3, false ); - m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT3, false ); - m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT3, false ); - m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT, false ); - m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT, false ); - } - break; - case StandardShaderLightModel.CustomLighting: - { - m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT3, false ); - m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT3, false ); - m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT3, false ); - m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT3, false ); - m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT, false ); - } - break; - case StandardShaderLightModel.Unlit: - case StandardShaderLightModel.Lambert: - { - m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT3, false ); - m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT3, false ); - m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT3, false ); - m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT, false ); - m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT, false ); - } - break; - case StandardShaderLightModel.BlinnPhong: - { - m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT3, false ); - m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT3, false ); - m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT3, false ); - m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT, false ); - m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT, false ); - } - break; - } - - //Transmission - m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT3, false ); - //Translucency - m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT3, false ); - //Refraction - m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT, false ); - //Alpha - m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT, false ); - //Discard - m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT, false ); - //Custom Lighting - m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT3, false ); - //Vertex Offset - m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT3, false ); - //Vertex Normal - m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT3, false ); - //Tessellation - m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT4, false ); - //Debug - m_inputPorts[ portId++ ].ChangeType( WirePortDataType.FLOAT3, false ); - } - - public override void SetName( string name ) - { - ShaderName = name; - } - - public void DrawInspectorProperty() - { - if( m_inspectorDefaultStyle == null ) - { - m_inspectorDefaultStyle = UIUtils.GetCustomStyle( CustomStyle.ResetToDefaultInspectorButton ); - } - - DrawCustomInspector( false ); - } - - private void RecursiveLog() - { - List<PropertyNode> nodes = UIUtils.PropertyNodesList(); - nodes.Sort( ( x, y ) => { return x.OrderIndex.CompareTo( y.OrderIndex ); } ); - for( int i = 0; i < nodes.Count; i++ ) - { - if( ( nodes[ i ] is ReordenatorNode ) ) - ( nodes[ i ] as ReordenatorNode ).RecursiveLog(); - else - Debug.Log( nodes[ i ].OrderIndex + " " + nodes[ i ].PropertyName ); - } - } - - public void DrawGeneralOptions() - { - DrawShaderName(); - DrawCurrentShaderType(); - - EditorGUI.BeginChangeCheck(); - m_currentLightModel = (StandardShaderLightModel)EditorGUILayoutEnumPopup( LightModelContent, m_currentLightModel ); - if( EditorGUI.EndChangeCheck() ) - { - ContainerGraph.ChangedLightingModel = true; - if( m_currentLightModel == StandardShaderLightModel.CustomLighting ) - { - ContainerGraph.ParentWindow.CurrentNodeAvailability = NodeAvailability.CustomLighting; - //ContainerGraph.CurrentCanvasMode = NodeAvailability.CustomLighting; - } - else - { - ContainerGraph.ParentWindow.CurrentNodeAvailability = NodeAvailability.SurfaceShader; - //ContainerGraph.CurrentCanvasMode = NodeAvailability.SurfaceShader; - } - } - - m_shaderModelIdx = EditorGUILayoutPopup( ShaderModelStr, m_shaderModelIdx, ShaderModelTypeArr ); - - EditorGUI.BeginChangeCheck(); - DrawPrecisionProperty( false ); - if( EditorGUI.EndChangeCheck() ) - ContainerGraph.CurrentPrecision = m_currentPrecisionType; - //m_cullMode = (CullMode)EditorGUILayoutEnumPopup( CullModeContent, m_cullMode ); - UndoParentNode inst = this; - m_inlineCullMode.CustomDrawer( ref inst, ( x ) => { m_cullMode = (CullMode)EditorGUILayoutEnumPopup( CullModeContent, m_cullMode ); }, CullModeContent.text ); - //m_inlineCullMode.Value = (int)m_cullMode; - //m_inlineCullMode.EnumTypePopup( ref inst, CullModeContent.text, Enum.GetNames( typeof( CullMode ) ) ); - //m_cullMode = (CullMode) m_inlineCullMode.Value; - - m_renderPath = (RenderPath)EditorGUILayoutEnumPopup( RenderPathContent, m_renderPath ); - - m_castShadows = EditorGUILayoutToggle( CastShadowsContent, m_castShadows ); - - m_receiveShadows = EditorGUILayoutToggle( ReceiveShadowsContent, m_receiveShadows ); - - m_drawInstancedHelper.Draw( this ); - - m_queueOrder = EditorGUILayoutIntField( QueueIndexContent, m_queueOrder ); - EditorGUI.BeginChangeCheck(); - m_vertexMode = (VertexMode)EditorGUILayoutEnumPopup( VertexModeStr, m_vertexMode ); - if( EditorGUI.EndChangeCheck() ) - { - m_inputPorts[ m_vertexPortId ].Name = m_vertexMode == VertexMode.Relative ? VertexDisplacementStr : VertexPositionStr; - m_sizeIsDirty = true; - } - - ShaderLOD = Mathf.Clamp( EditorGUILayoutIntField( ShaderLODContent, ShaderLOD ), 0, Shader.globalMaximumLOD ); - ////m_lodCrossfade = EditorGUILayoutToggle( LODCrossfadeContent, m_lodCrossfade ); - m_fallbackHelper.Draw( this ); - DrawInspectorProperty(); - - } - - public void ShowOpacityMaskValueUI() - { - EditorGUI.BeginChangeCheck(); - UndoParentNode inst = this; - m_inlineOpacityMaskClipValue.CustomDrawer( ref inst, ( x ) => { m_opacityMaskClipValue = EditorGUILayoutFloatField( OpacityMaskClipValueContent, m_opacityMaskClipValue ); }, OpacityMaskClipValueContent.text ); - if( EditorGUI.EndChangeCheck() ) - { - m_checkChanges = true; - if( m_currentMaterial != null && m_currentMaterial.HasProperty( IOUtils.MaskClipValueName ) ) - { - m_currentMaterial.SetFloat( IOUtils.MaskClipValueName, m_opacityMaskClipValue ); - } - } - } - - public override void DrawProperties() - { - if( m_inspectorFoldoutStyle == null || EditorGUIUtility.isProSkin != m_usingProSkin ) - m_inspectorFoldoutStyle = new GUIStyle( GUI.skin.GetStyle( "foldout" ) ); - - if( m_inspectorToolbarStyle == null || EditorGUIUtility.isProSkin != m_usingProSkin ) - { - m_inspectorToolbarStyle = new GUIStyle( GUI.skin.GetStyle( "toolbarbutton" ) ) - { - fixedHeight = 20 - }; - } - - if( m_inspectorTooldropdownStyle == null || EditorGUIUtility.isProSkin != m_usingProSkin ) - { - m_inspectorTooldropdownStyle = new GUIStyle( GUI.skin.GetStyle( "toolbardropdown" ) ) - { - fixedHeight = 20 - }; - m_inspectorTooldropdownStyle.margin.bottom = 2; - } - - if( EditorGUIUtility.isProSkin != m_usingProSkin ) - m_usingProSkin = EditorGUIUtility.isProSkin; - - base.DrawProperties(); - - EditorGUILayout.BeginVertical(); - { - EditorGUILayout.Separator(); - - m_titleOpacity = 0.5f; - m_boxOpacity = ( EditorGUIUtility.isProSkin ? 0.5f : 0.25f ); - m_cachedColor = GUI.color; - - // General - bool generalIsVisible = ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedGeneralShaderOptions; - NodeUtils.DrawPropertyGroup( ref generalIsVisible, GeneralFoldoutStr, DrawGeneralOptions ); - ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedGeneralShaderOptions = generalIsVisible; - - //Blend Mode - GUI.color = new Color( m_cachedColor.r, m_cachedColor.g, m_cachedColor.b, m_titleOpacity ); - EditorGUILayout.BeginHorizontal( m_inspectorToolbarStyle ); - GUI.color = m_cachedColor; - - bool blendOptionsVisible = GUILayout.Toggle( ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedBlendOptions, AlphaModeContent, UIUtils.MenuItemToggleStyle, GUILayout.ExpandWidth( true ) ); - if( Event.current.button == Constants.FoldoutMouseId ) - { - ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedBlendOptions = blendOptionsVisible; - } - - - if( !EditorGUIUtility.isProSkin ) - GUI.color = new Color( 0.25f, 0.25f, 0.25f, 1f ); - - float boxSize = 60; - switch( m_alphaMode ) - { - case AlphaMode.Transparent: - boxSize = 85; - break; - case AlphaMode.Translucent: - boxSize = 80; - break; - case AlphaMode.Premultiply: - boxSize = 120; - break; - } - EditorGUI.BeginChangeCheck(); - m_alphaMode = (AlphaMode)EditorGUILayoutPopup( string.Empty, (int)m_alphaMode, FadeModeOptions, UIUtils.InspectorPopdropdownStyle, GUILayout.Width( boxSize ), GUILayout.Height( 19 ) ); - if( EditorGUI.EndChangeCheck() ) - { - UpdateFromBlendMode(); - } - - GUI.color = m_cachedColor; - EditorGUILayout.EndHorizontal(); - - m_customBlendAvailable = ( m_alphaMode == AlphaMode.Custom || m_alphaMode == AlphaMode.Opaque ); - - if( ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedBlendOptions ) - { - GUI.color = new Color( m_cachedColor.r, m_cachedColor.g, m_cachedColor.b, m_boxOpacity ); - EditorGUILayout.BeginVertical( UIUtils.MenuItemBackgroundStyle ); - GUI.color = m_cachedColor; - EditorGUI.indentLevel++; - EditorGUILayout.Separator(); - EditorGUI.BeginChangeCheck(); - - - m_renderType = (RenderType)EditorGUILayoutEnumPopup( RenderTypeContent, m_renderType ); - if( m_renderType == RenderType.Custom ) - { - EditorGUI.BeginChangeCheck(); - m_customRenderType = EditorGUILayoutTextField( CustomRenderTypeStr, m_customRenderType ); - if( EditorGUI.EndChangeCheck() ) - { - m_customRenderType = UIUtils.RemoveInvalidCharacters( m_customRenderType ); - } - } - - m_renderQueue = (RenderQueue)EditorGUILayoutEnumPopup( RenderQueueContent, m_renderQueue ); - - if( EditorGUI.EndChangeCheck() ) - { - if( m_renderType == RenderType.Opaque && m_renderQueue == RenderQueue.Geometry ) - m_alphaMode = AlphaMode.Opaque; - else if( m_renderType == RenderType.TransparentCutout && m_renderQueue == RenderQueue.AlphaTest ) - m_alphaMode = AlphaMode.Masked; - else if( m_renderType == RenderType.Transparent && m_renderQueue == RenderQueue.Transparent ) - m_alphaMode = AlphaMode.Transparent; - else if( m_renderType == RenderType.Opaque && m_renderQueue == RenderQueue.Transparent ) - m_alphaMode = AlphaMode.Translucent; - else - m_alphaMode = AlphaMode.Custom; - - - UpdateFromBlendMode(); - } - - bool bufferedEnabled = GUI.enabled; - - GUI.enabled = ( m_alphaMode == AlphaMode.Masked || m_alphaMode == AlphaMode.Custom ); - m_inputPorts[ m_discardPortId ].Locked = !GUI.enabled; - ShowOpacityMaskValueUI(); - - GUI.enabled = bufferedEnabled; - - EditorGUI.BeginDisabledGroup( !( m_alphaMode == AlphaMode.Transparent || m_alphaMode == AlphaMode.Premultiply || m_alphaMode == AlphaMode.Translucent || m_alphaMode == AlphaMode.Custom ) ); - m_grabOrder = EditorGUILayoutIntField( RefractionLayerStr, m_grabOrder ); - float cachedLabelWidth = EditorGUIUtility.labelWidth; - UndoParentNode inst = this; - if( m_refractionPort.IsConnected ) - { - EditorGUIUtility.labelWidth = 145; - EditorGUI.BeginChangeCheck(); - m_inlineChromaticAberration.RangedFloatField( ref inst, ChromaticAberrationStr, 0.0f,0.3f ); - if( EditorGUI.EndChangeCheck() ) - { - if( m_currentMaterial != null && m_currentMaterial.HasProperty( IOUtils.ChromaticAberrationProperty ) ) - { - m_currentMaterial.SetFloat( IOUtils.ChromaticAberrationProperty, m_inlineChromaticAberration.FloatValue ); - } - } - } - - EditorGUIUtility.labelWidth = 130; - m_inlineAlphaToCoverage.CustomDrawer( ref inst, ( x ) => { m_alphaToCoverage = EditorGUILayoutToggle( AlphaToCoverageStr, m_alphaToCoverage ); }, AlphaToCoverageStr.text ); - EditorGUIUtility.labelWidth = cachedLabelWidth; - EditorGUI.EndDisabledGroup(); - - EditorGUILayout.Separator(); - - if( !m_customBlendAvailable ) - { - EditorGUILayout.HelpBox( "Advanced options are only available for Custom blend modes", MessageType.Warning ); - } - - EditorGUI.BeginDisabledGroup( !m_customBlendAvailable ); - m_blendOpsHelper.Draw( this, m_customBlendAvailable ); - m_colorMaskHelper.Draw( this ); - - EditorGUI.EndDisabledGroup(); - EditorGUILayout.Separator(); - EditorGUI.indentLevel--; - EditorGUILayout.EndVertical(); - } - - m_stencilBufferHelper.Draw( this ); - m_tessOpHelper.Draw( this, m_inspectorToolbarStyle, m_currentMaterial, m_tessellationPort.IsConnected ); - m_outlineHelper.Draw( this, m_inspectorToolbarStyle, m_currentMaterial ); - m_billboardOpHelper.Draw( this ); - m_zBufferHelper.Draw( this, m_inspectorToolbarStyle, m_customBlendAvailable ); - m_renderingOptionsOpHelper.Draw( this ); - m_renderingPlatformOpHelper.Draw( this ); - //m_additionalDefines.Draw( this ); - //m_additionalIncludes.Draw( this ); - //m_additionalPragmas.Draw( this ); - m_additionalSurfaceOptions.Draw( this ); - m_usePass.Draw( this ); - m_additionalDirectives.Draw( this ); - m_customTagsHelper.Draw( this ); - m_dependenciesHelper.Draw( this ); - DrawMaterialInputs( m_inspectorToolbarStyle ); - } - - EditorGUILayout.EndVertical(); - } - - public override void OnNodeLogicUpdate( DrawInfo drawInfo ) - { - base.OnNodeLogicUpdate( drawInfo ); - - if( m_initialize ) - { - m_initialize = false; - - if( m_dummyProperty == null ) - { - m_dummyProperty = ScriptableObject.CreateInstance<PropertyNode>(); - m_dummyProperty.ContainerGraph = ContainerGraph; - } - } - - if( m_currentLightModel != m_lastLightModel ) - m_lightModelChanged = true; - - if( m_lightModelChanged ) - { - m_lightModelChanged = false; - if( m_currentLightModel == StandardShaderLightModel.BlinnPhong ) - { - if( m_specColorReorder == null ) - { - m_specColorReorder = ScriptableObject.CreateInstance<ReordenatorNode>(); - m_specColorReorder.ContainerGraph = ContainerGraph; - m_specColorReorder.OrderIndex = m_specColorOrderIndex; - m_specColorReorder.Init( "_SpecColor", "Specular Color", null ); - } - - UIUtils.RegisterPropertyNode( m_specColorReorder ); - } - else - { - if( m_specColorReorder != null ) - UIUtils.UnregisterPropertyNode( m_specColorReorder ); - } - - if( m_currentLightModel == StandardShaderLightModel.CustomLighting && m_masterNodeCategory == 0 ) - ContainerGraph.CurrentCanvasMode = NodeAvailability.CustomLighting; - else if( m_masterNodeCategory == 0 ) - ContainerGraph.CurrentCanvasMode = NodeAvailability.SurfaceShader; - CacheCurrentSettings(); - m_lastLightModel = m_currentLightModel; - DeleteAllInputConnections( true, true ); - AddMasterPorts(); - ConnectFromCache(); - } - - if( drawInfo.CurrentEventType != EventType.Layout ) - return; - - if( m_transmissionPort != null && m_transmissionPort.IsConnected && m_renderPath != RenderPath.ForwardOnly ) - { - m_renderPath = RenderPath.ForwardOnly; - UIUtils.ShowMessage( "Render Path changed to Forward Only since transmission only works in forward rendering" ); - } - - if( m_translucencyPort != null && m_translucencyPort.IsConnected && m_renderPath != RenderPath.ForwardOnly ) - { - m_renderPath = RenderPath.ForwardOnly; - UIUtils.ShowMessage( "Render Path changed to Forward Only since translucency only works in forward rendering" ); - } - - if( m_translucencyPort.IsConnected != m_previousTranslucencyOn ) - m_checkChanges = true; - - if( m_refractionPort.IsConnected != m_previousRefractionOn ) - m_checkChanges = true; - - if( ( m_tessOpHelper.EnableTesselation && !m_tessellationPort.IsConnected ) != m_previousTessellationOn ) - m_checkChanges = true; - - m_previousTranslucencyOn = m_translucencyPort.IsConnected; - - m_previousRefractionOn = m_refractionPort.IsConnected; - - m_previousTessellationOn = ( m_tessOpHelper.EnableTesselation && !m_tessellationPort.IsConnected ); - - if( m_checkChanges ) - { - if( m_translucencyPort.IsConnected ) - { - if( m_translucencyReorder == null ) - { - List<PropertyNode> translucencyList = new List<PropertyNode>(); - for( int i = 0; i < 7; i++ ) - { - translucencyList.Add( m_dummyProperty ); - } - - m_translucencyReorder = ScriptableObject.CreateInstance<ReordenatorNode>(); - m_translucencyReorder.ContainerGraph = ContainerGraph; - m_translucencyReorder.OrderIndex = m_translucencyOrderIndex; - m_translucencyReorder.Init( "_TranslucencyGroup", "Translucency", translucencyList ); - } - - UIUtils.RegisterPropertyNode( m_translucencyReorder ); - } - else - { - if( m_translucencyReorder != null ) - UIUtils.UnregisterPropertyNode( m_translucencyReorder ); - } - - if( m_refractionPort.IsConnected ) - { - if( m_refractionReorder == null ) - { - List<PropertyNode> refractionList = new List<PropertyNode>(); - for( int i = 0; i < 2; i++ ) - { - refractionList.Add( m_dummyProperty ); - } - - m_refractionReorder = ScriptableObject.CreateInstance<ReordenatorNode>(); - m_refractionReorder.ContainerGraph = ContainerGraph; - m_refractionReorder.OrderIndex = m_refractionOrderIndex; - m_refractionReorder.Init( "_RefractionGroup", "Refraction", refractionList ); - } - - UIUtils.RegisterPropertyNode( m_refractionReorder ); - } - else - { - if( m_refractionReorder != null ) - UIUtils.UnregisterPropertyNode( m_refractionReorder ); - } - - if( m_tessOpHelper.EnableTesselation && !m_tessellationPort.IsConnected ) - { - if( m_tessellationReorder == null ) - { - List<PropertyNode> tessellationList = new List<PropertyNode>(); - for( int i = 0; i < 4; i++ ) - { - tessellationList.Add( m_dummyProperty ); - } - - m_tessellationReorder = ScriptableObject.CreateInstance<ReordenatorNode>(); - m_tessellationReorder.ContainerGraph = ContainerGraph; - m_tessellationReorder.OrderIndex = m_tessellationOrderIndex; - m_tessellationReorder.Init( "_TessellationGroup", "Tessellation", tessellationList ); - m_tessellationReorder.HeaderTitle = "Tesselation"; - } - - UIUtils.RegisterPropertyNode( m_tessellationReorder ); - } - else - { - if( m_tessellationReorder != null ) - UIUtils.UnregisterPropertyNode( m_tessellationReorder ); - } - - if( m_inputPorts[ m_discardPortId ].Available && !m_inlineOpacityMaskClipValue.IsValid ) - { - if( m_maskClipReorder == null ) - { - // Create dragable clip material property - m_maskClipReorder = ScriptableObject.CreateInstance<ReordenatorNode>(); - m_maskClipReorder.ContainerGraph = ContainerGraph; - m_maskClipReorder.OrderIndex = m_maskClipOrderIndex; - m_maskClipReorder.Init( "_Cutoff", "Mask Clip Value", null ); - } - - UIUtils.RegisterPropertyNode( m_maskClipReorder ); - } - else - { - if( m_maskClipReorder != null ) - UIUtils.UnregisterPropertyNode( m_maskClipReorder ); - } - - m_checkChanges = false; - } - } - - public override void OnNodeRepaint( DrawInfo drawInfo ) - { - base.OnNodeRepaint( drawInfo ); - - if( m_containerGraph.IsInstancedShader || m_renderingOptionsOpHelper.ForceEnableInstancing ) - { - DrawInstancedIcon( drawInfo ); - } - } - - private void CacheCurrentSettings() - { - m_cacheNodeConnections.Clear(); - for( int portId = 0; portId < m_inputPorts.Count; portId++ ) - { - if( m_inputPorts[ portId ].IsConnected ) - { - WireReference connection = m_inputPorts[ portId ].GetConnection(); - m_cacheNodeConnections.Add( m_inputPorts[ portId ].Name, new NodeCache( connection.NodeId, connection.PortId ) ); - } - } - } - - private void ConnectFromCache() - { - for( int i = 0; i < m_inputPorts.Count; i++ ) - { - NodeCache cache = m_cacheNodeConnections.Get( m_inputPorts[ i ].Name ); - if( cache != null ) - { - UIUtils.SetConnection( UniqueId, m_inputPorts[ i ].PortId, cache.TargetNodeId, cache.TargetPortId ); - } - } - } - - public override void UpdateMaterial( Material mat ) - { - base.UpdateMaterial( mat ); - if( m_alphaMode == AlphaMode.Masked || m_alphaMode == AlphaMode.Custom ) - { - if( mat.HasProperty( IOUtils.MaskClipValueName ) ) - mat.SetFloat( IOUtils.MaskClipValueName, m_opacityMaskClipValue ); - } - - if( m_refractionPort.IsConnected && !m_inlineChromaticAberration.Active ) - { - if( mat.HasProperty( IOUtils.ChromaticAberrationProperty ) ) - mat.SetFloat( IOUtils.ChromaticAberrationProperty, m_inlineChromaticAberration.FloatValue ); - } - } - - public override void SetMaterialMode( Material mat, bool fetchMaterialValues ) - { - base.SetMaterialMode( mat, fetchMaterialValues ); - if( m_alphaMode == AlphaMode.Masked || m_alphaMode == AlphaMode.Custom ) - { - if( fetchMaterialValues && m_materialMode && mat.HasProperty( IOUtils.MaskClipValueName ) ) - { - m_opacityMaskClipValue = mat.GetFloat( IOUtils.MaskClipValueName ); - } - } - - if( m_refractionPort.IsConnected && !m_inlineChromaticAberration.Active ) - { - if( fetchMaterialValues && m_materialMode && mat.HasProperty( IOUtils.ChromaticAberrationProperty ) ) - m_inlineChromaticAberration.FloatValue = mat.GetFloat( IOUtils.ChromaticAberrationProperty); - } - } - - public override void ForceUpdateFromMaterial( Material material ) - { - m_tessOpHelper.UpdateFromMaterial( material ); - m_outlineHelper.UpdateFromMaterial( material ); - - if( m_alphaMode == AlphaMode.Masked || m_alphaMode == AlphaMode.Custom ) - { - if( material.HasProperty( IOUtils.MaskClipValueName ) ) - m_opacityMaskClipValue = material.GetFloat( IOUtils.MaskClipValueName ); - } - - if( m_refractionPort.IsConnected && !m_inlineChromaticAberration.Active ) - { - if( material.HasProperty( IOUtils.ChromaticAberrationProperty ) ) - m_inlineChromaticAberration.FloatValue = material.GetFloat( IOUtils.ChromaticAberrationProperty ); - } - } - - public override void UpdateMasterNodeMaterial( Material material ) - { - m_currentMaterial = material; - UpdateMaterialEditor(); - } - - void UpdateMaterialEditor() - { - FireMaterialChangedEvt(); - } - - public string CreateInstructionsForVertexPort( InputPort port ) - { - //Vertex displacement and per vertex custom data - WireReference connection = port.GetConnection(); - ParentNode node = UIUtils.GetNode( connection.NodeId ); - - string vertexInstructions = node.GetValueFromOutputStr( connection.PortId, port.DataType, ref m_currentDataCollector, false ); - - if( m_currentDataCollector.DirtySpecialLocalVariables ) - { - m_currentDataCollector.AddVertexInstruction( m_currentDataCollector.SpecialLocalVariables, UniqueId, false ); - m_currentDataCollector.ClearSpecialLocalVariables(); - } - - if( m_currentDataCollector.DirtyVertexVariables ) - { - m_currentDataCollector.AddVertexInstruction( m_currentDataCollector.VertexLocalVariables, UniqueId, false ); - m_currentDataCollector.ClearVertexLocalVariables(); - } - - return vertexInstructions; - } - - public void CreateInstructionsForPort( InputPort port, string portName, bool addCustomDelimiters = false, string customDelimiterIn = null, string customDelimiterOut = null, bool ignoreLocalVar = false, bool normalIsConnected = false , bool isDebugPort = false ) - { - WireReference connection = port.GetConnection(); - ParentNode node = UIUtils.GetNode( connection.NodeId ); - - string newInstruction = node.GetValueFromOutputStr( connection.PortId, port.DataType, ref m_currentDataCollector, ignoreLocalVar ); - - if( m_currentDataCollector.DirtySpecialLocalVariables ) - { - m_currentDataCollector.AddInstructions( m_currentDataCollector.SpecialLocalVariables ); - m_currentDataCollector.ClearSpecialLocalVariables(); - } - - if( m_currentDataCollector.DirtyVertexVariables ) - { - m_currentDataCollector.AddVertexInstruction( m_currentDataCollector.VertexLocalVariables, port.NodeId, false ); - m_currentDataCollector.ClearVertexLocalVariables(); - } - - if( m_currentDataCollector.ForceNormal && !normalIsConnected ) - { - m_currentDataCollector.AddToStartInstructions( "\t\t\t" + Constants.OutputVarStr + ".Normal = float3(0,0,1);\n" ); - m_currentDataCollector.DirtyNormal = true; - m_currentDataCollector.ForceNormal = false; - } - - m_currentDataCollector.AddInstructions( addCustomDelimiters ? customDelimiterIn : ( "\t\t\t" + portName + " = " ) ); - m_currentDataCollector.AddInstructions( newInstruction ); - m_currentDataCollector.AddInstructions( addCustomDelimiters ? customDelimiterOut :((isDebugPort)?" + 1E-5;\n":";\n") ); - } - - public string CreateInstructionStringForPort( InputPort port, bool ignoreLocalVar = false ) - { - WireReference connection = port.GetConnection(); - ParentNode node = UIUtils.GetNode( connection.NodeId ); - - string newInstruction = node.GetValueFromOutputStr( connection.PortId, port.DataType, ref m_currentDataCollector, ignoreLocalVar ); - - if( m_currentDataCollector.DirtySpecialLocalVariables ) - { - m_currentDataCollector.AddInstructions( m_currentDataCollector.SpecialLocalVariables ); - m_currentDataCollector.ClearSpecialLocalVariables(); - } - - if( m_currentDataCollector.DirtyVertexVariables ) - { - m_currentDataCollector.AddVertexInstruction( m_currentDataCollector.VertexLocalVariables, port.NodeId, false ); - m_currentDataCollector.ClearVertexLocalVariables(); - } - - if( m_currentDataCollector.ForceNormal ) - { - m_currentDataCollector.AddToStartInstructions( "\t\t\t" + Constants.OutputVarStr + ".Normal = float3(0,0,1);\n" ); - m_currentDataCollector.DirtyNormal = true; - m_currentDataCollector.ForceNormal = false; - } - - return newInstruction; - } - - public override Shader Execute( string pathname, bool isFullPath ) - { - ForcePortType(); - ForceReordering(); - UpdateFromBlendMode(); - base.Execute( pathname, isFullPath ); - RegisterStandaloneFuntions(); - - bool isInstancedShader = m_renderingOptionsOpHelper.ForceEnableInstancing || UIUtils.IsInstancedShader(); - bool hasVirtualTexture = UIUtils.HasVirtualTexture(); - bool hasTranslucency = false; - bool hasTransmission = false; - bool hasEmission = false; - bool hasOpacity = false; - bool hasOpacityMask = false; - bool hasRefraction = false; - //bool hasVertexOffset = false; - //bool hasCustomLightingAlpha = false; - bool hasCustomLightingMask = false; - - string customLightingCode = string.Empty; - string customLightingAlphaCode = string.Empty; - string customLightingMaskCode = string.Empty; - string customLightingInstructions = string.Empty; - - string refractionCode = string.Empty; - string refractionInstructions = string.Empty; - string refractionFix = string.Empty; - - string aboveUsePasses = string.Empty; - string bellowUsePasses = string.Empty; - - - m_currentDataCollector.TesselationActive = m_tessOpHelper.EnableTesselation; - m_currentDataCollector.CurrentRenderPath = m_renderPath; - - StandardShaderLightModel cachedLightModel = m_currentLightModel; - NodeAvailability cachedAvailability = ContainerGraph.CurrentCanvasMode; - - bool debugIsUsingCustomLighting = false; - bool usingDebugPort = false; - if( m_inputPorts[ m_inputPorts.Count - 1 ].IsConnected ) - { - usingDebugPort = true; - debugIsUsingCustomLighting = m_currentLightModel == StandardShaderLightModel.CustomLighting; - - m_currentDataCollector.GenType = PortGenType.CustomLighting; - m_currentLightModel = StandardShaderLightModel.CustomLighting; - ContainerGraph.CurrentCanvasMode = NodeAvailability.CustomLighting; - } - - if( isInstancedShader ) - { - m_currentDataCollector.AddToPragmas( UniqueId, IOUtils.InstancedPropertiesHeader ); - } - - if( m_renderingOptionsOpHelper.SpecularHighlightToggle || m_renderingOptionsOpHelper.ReflectionsToggle ) - m_currentDataCollector.AddToProperties( UniqueId, "[Header(Forward Rendering Options)]", 10001 ); - if( m_renderingOptionsOpHelper.SpecularHighlightToggle ) - { - m_currentDataCollector.AddToProperties( UniqueId, "[ToggleOff] _SpecularHighlights(\"Specular Highlights\", Float) = 1.0", 10002 ); - m_currentDataCollector.AddToPragmas( UniqueId, "shader_feature _SPECULARHIGHLIGHTS_OFF" ); - } - if( m_renderingOptionsOpHelper.ReflectionsToggle ) - { - m_currentDataCollector.AddToProperties( UniqueId, "[ToggleOff] _GlossyReflections(\"Reflections\", Float) = 1.0", 10003 ); - m_currentDataCollector.AddToPragmas( UniqueId, "shader_feature _GLOSSYREFLECTIONS_OFF" ); - } - - - // See if each node is being used on frag and/or vert ports - SetupNodeCategories(); - m_containerGraph.CheckPropertiesAutoRegister( ref m_currentDataCollector ); - - if( m_refractionPort.IsConnected || m_inputPorts[ m_inputPorts.Count - 1 ].IsConnected ) - { - m_currentDataCollector.DirtyNormal = true; - m_currentDataCollector.ForceNormal = true; - } - //this.PropagateNodeData( nodeData ); - - string tags = "\"RenderType\" = \"{0}\" \"Queue\" = \"{1}\""; - string finalRenderType = ( m_renderType == RenderType.Custom && m_customRenderType.Length > 0 ) ? m_customRenderType : m_renderType.ToString(); - tags = string.Format( tags, finalRenderType, ( m_renderQueue + ( ( m_queueOrder >= 0 ) ? "+" : string.Empty ) + m_queueOrder ) ); - //if ( !m_customBlendMode ) - { - if( m_alphaMode == AlphaMode.Transparent || m_alphaMode == AlphaMode.Premultiply ) - { - //tags += " \"IgnoreProjector\" = \"True\""; - if( !m_renderingOptionsOpHelper.IgnoreProjectorValue ) - { - Debug.Log( string.Format( "Setting Ignore Projector to True since it's requires by Blend Mode {0}.", m_alphaMode ) ); - m_renderingOptionsOpHelper.IgnoreProjectorValue = true; - } - } - } - - tags += m_renderingOptionsOpHelper.IgnoreProjectorTag; - tags += m_renderingOptionsOpHelper.ForceNoShadowCastingTag; - tags += m_renderingOptionsOpHelper.DisableBatchingTag; - - //add virtual texture support - if( hasVirtualTexture ) - { - tags += " \"Amplify\" = \"True\" "; - } - - //tags = "Tags{ " + tags + " }"; - - string outputStruct = ""; - switch( m_currentLightModel ) - { - case StandardShaderLightModel.CustomLighting: outputStruct = "SurfaceOutputCustomLightingCustom"; break; - case StandardShaderLightModel.Standard: outputStruct = "SurfaceOutputStandard"; break; - case StandardShaderLightModel.StandardSpecular: outputStruct = "SurfaceOutputStandardSpecular"; break; - case StandardShaderLightModel.Unlit: - case StandardShaderLightModel.Lambert: - case StandardShaderLightModel.BlinnPhong: outputStruct = "SurfaceOutput"; break; - } - - if( m_currentLightModel == StandardShaderLightModel.CustomLighting ) - { - m_currentDataCollector.AddToIncludes( UniqueId, Constants.UnityPBSLightingLib ); - - m_currentDataCollector.ChangeCustomInputHeader( m_currentLightModel.ToString() + Constants.CustomLightStructStr ); - m_currentDataCollector.AddToCustomInput( UniqueId, "half3 Albedo", true ); - m_currentDataCollector.AddToCustomInput( UniqueId, "half3 Normal", true ); - m_currentDataCollector.AddToCustomInput( UniqueId, "half3 Emission", true ); - m_currentDataCollector.AddToCustomInput( UniqueId, "half Metallic", true ); - m_currentDataCollector.AddToCustomInput( UniqueId, "half Smoothness", true ); - m_currentDataCollector.AddToCustomInput( UniqueId, "half Occlusion", true ); - m_currentDataCollector.AddToCustomInput( UniqueId, "half Alpha", true ); - m_currentDataCollector.AddToCustomInput( UniqueId, "Input SurfInput", true ); - m_currentDataCollector.AddToCustomInput( UniqueId, "UnityGIInput GIData", true ); - } - - //Terrain Draw Instanced - if( m_drawInstancedHelper.Enabled ) - { - if( !m_currentDataCollector.DirtyPerVertexData ) - { - m_currentDataCollector.OpenPerVertexHeader( !m_tessOpHelper.EnableTesselation ); - } - m_drawInstancedHelper.UpdateDataCollectorForStandard( ref m_currentDataCollector ); - } - - // Need to sort before creating local vars so they can inspect the normal port correctly - SortedList<int, InputPort> sortedPorts = new SortedList<int, InputPort>(); - for( int i = 0; i < m_inputPorts.Count; i++ ) - { - sortedPorts.Add( m_inputPorts[ i ].OrderId, m_inputPorts[ i ] ); - } - - bool normalIsConnected = m_normalPort.IsConnected; - m_tessOpHelper.Reset(); - if( m_inputPorts[ m_inputPorts.Count - 1 ].IsConnected ) - { - //Debug Port active - InputPort debugPort = m_inputPorts[ m_inputPorts.Count - 1 ]; - m_currentDataCollector.PortCategory = debugPort.Category; - if( debugIsUsingCustomLighting ) - { - m_currentDataCollector.UsingCustomOutput = true; - WireReference connection = m_inputPorts[ m_inputPorts.Count - 1 ].GetConnection(); - ParentNode node = UIUtils.GetNode( connection.NodeId ); - customLightingCode = node.GetValueFromOutputStr( connection.PortId, WirePortDataType.FLOAT3, ref m_currentDataCollector, false ); - customLightingInstructions = m_currentDataCollector.CustomOutput; - - if( m_currentDataCollector.ForceNormal ) - { - m_currentDataCollector.AddToStartInstructions( "\t\t\t" + Constants.OutputVarStr + ".Normal = float3(0,0,1);\n" ); - m_currentDataCollector.DirtyNormal = true; - m_currentDataCollector.ForceNormal = false; - } - - if( m_currentDataCollector.DirtyVertexVariables ) - { - m_currentDataCollector.AddVertexInstruction( m_currentDataCollector.VertexLocalVariables, UniqueId, false ); - m_currentDataCollector.ClearVertexLocalVariables(); - } - m_currentDataCollector.UsingCustomOutput = false; - } - else - { - CreateInstructionsForPort( debugPort, Constants.OutputVarStr + ".Emission", false, null, null, false, false,true ); - } - } - else - { - MasterNodePortCategory currentCategory = sortedPorts[ 0 ].Category; - //Collect data from standard nodes - for( int i = 0; i < sortedPorts.Count; i++ ) - { - // prepare ports for custom lighting - m_currentDataCollector.GenType = sortedPorts[ i ].GenType; - if( m_currentLightModel == StandardShaderLightModel.CustomLighting && sortedPorts[ i ].Name.Equals( AlphaStr ) ) - ContainerGraph.ResetNodesLocalVariablesIfNot( MasterNodePortCategory.Vertex ); - - if( sortedPorts[ i ].IsConnected ) - { - m_currentDataCollector.PortCategory = sortedPorts[ i ].Category; - - if( sortedPorts[ i ].Name.Equals( NormalStr ) )// Normal Map is Connected - { - m_currentDataCollector.DirtyNormal = true; - } - if( sortedPorts[ i ].Name.Equals( TranslucencyStr ) ) - { - hasTranslucency = true; - } - if( sortedPorts[ i ].Name.Equals( TransmissionStr ) ) - { - hasTransmission = true; - } - if( sortedPorts[ i ].Name.Equals( EmissionStr ) ) - { - hasEmission = true; - } - - if( sortedPorts[ i ].Name.Equals( RefractionStr ) ) - { - hasRefraction = true; - } - - if( sortedPorts[ i ].Name.Equals( AlphaStr ) ) - { - hasOpacity = true; - } - - if( sortedPorts[ i ].Name.Equals( DiscardStr ) ) - { - hasOpacityMask = true; - } - - if( hasRefraction ) - { - m_currentDataCollector.AddToInput( UniqueId, SurfaceInputs.SCREEN_POS ); - m_currentDataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_POS ); - - //not necessary, just being safe - m_currentDataCollector.DirtyNormal = true; - m_currentDataCollector.ForceNormal = true; - - if( m_grabOrder != 0 ) - { - m_currentDataCollector.AddGrabPass( "RefractionGrab" + m_grabOrder ); - m_currentDataCollector.AddToUniforms( UniqueId, "uniform sampler2D RefractionGrab" + m_grabOrder + ";" ); - } - else - { - m_currentDataCollector.AddGrabPass( "" ); - m_currentDataCollector.AddToUniforms( UniqueId, "uniform sampler2D _GrabTexture;" ); - } - - if( !m_inlineChromaticAberration.Active ) - { - m_currentDataCollector.AddToUniforms( UniqueId, "uniform float _ChromaticAberration;" ); - - m_currentDataCollector.AddToProperties( UniqueId, "[Header(Refraction)]", m_refractionReorder.OrderIndex ); - m_currentDataCollector.AddToProperties( UniqueId, "_ChromaticAberration(\"Chromatic Aberration\", Range( 0 , 0.3)) = 0.1", m_refractionReorder.OrderIndex + 1 ); - } - - m_currentDataCollector.AddToPragmas( UniqueId, "multi_compile _ALPHAPREMULTIPLY_ON" ); - } - - if( hasTranslucency || hasTransmission ) - { - //Translucency and Transmission Generation - - //Add properties and uniforms - m_currentDataCollector.AddToIncludes( UniqueId, Constants.UnityPBSLightingLib ); - - if( hasTranslucency ) - { - m_currentDataCollector.AddToProperties( UniqueId, "[Header(Translucency)]", m_translucencyReorder.OrderIndex ); - m_currentDataCollector.AddToProperties( UniqueId, "_Translucency(\"Strength\", Range( 0 , 50)) = 1", m_translucencyReorder.OrderIndex + 1 ); - m_currentDataCollector.AddToProperties( UniqueId, "_TransNormalDistortion(\"Normal Distortion\", Range( 0 , 1)) = 0.1", m_translucencyReorder.OrderIndex + 2 ); - m_currentDataCollector.AddToProperties( UniqueId, "_TransScattering(\"Scaterring Falloff\", Range( 1 , 50)) = 2", m_translucencyReorder.OrderIndex + 3 ); - m_currentDataCollector.AddToProperties( UniqueId, "_TransDirect(\"Direct\", Range( 0 , 1)) = 1", m_translucencyReorder.OrderIndex + 4 ); - m_currentDataCollector.AddToProperties( UniqueId, "_TransAmbient(\"Ambient\", Range( 0 , 1)) = 0.2", m_translucencyReorder.OrderIndex + 5 ); - m_currentDataCollector.AddToProperties( UniqueId, "_TransShadow(\"Shadow\", Range( 0 , 1)) = 0.9", m_translucencyReorder.OrderIndex + 6 ); - - m_currentDataCollector.AddToUniforms( UniqueId, "uniform half _Translucency;" ); - m_currentDataCollector.AddToUniforms( UniqueId, "uniform half _TransNormalDistortion;" ); - m_currentDataCollector.AddToUniforms( UniqueId, "uniform half _TransScattering;" ); - m_currentDataCollector.AddToUniforms( UniqueId, "uniform half _TransDirect;" ); - m_currentDataCollector.AddToUniforms( UniqueId, "uniform half _TransAmbient;" ); - m_currentDataCollector.AddToUniforms( UniqueId, "uniform half _TransShadow;" ); - } - - //Add custom struct - switch( m_currentLightModel ) - { - case StandardShaderLightModel.Standard: - case StandardShaderLightModel.StandardSpecular: - outputStruct = "SurfaceOutput" + m_currentLightModel.ToString() + Constants.CustomLightStructStr; break; - } - - m_currentDataCollector.ChangeCustomInputHeader( m_currentLightModel.ToString() + Constants.CustomLightStructStr ); - m_currentDataCollector.AddToCustomInput( UniqueId, "half3 Albedo", true ); - m_currentDataCollector.AddToCustomInput( UniqueId, "half3 Normal", true ); - m_currentDataCollector.AddToCustomInput( UniqueId, "half3 Emission", true ); - switch( m_currentLightModel ) - { - case StandardShaderLightModel.Standard: - m_currentDataCollector.AddToCustomInput( UniqueId, "half Metallic", true ); - break; - case StandardShaderLightModel.StandardSpecular: - m_currentDataCollector.AddToCustomInput( UniqueId, "half3 Specular", true ); - break; - } - m_currentDataCollector.AddToCustomInput( UniqueId, "half Smoothness", true ); - m_currentDataCollector.AddToCustomInput( UniqueId, "half Occlusion", true ); - m_currentDataCollector.AddToCustomInput( UniqueId, "half Alpha", true ); - if( hasTranslucency ) - m_currentDataCollector.AddToCustomInput( UniqueId, "half3 Translucency", true ); - - if( hasTransmission ) - m_currentDataCollector.AddToCustomInput( UniqueId, "half3 Transmission", true ); - } - - if( sortedPorts[ i ].Name.Equals( DiscardStr ) ) - { - //Discard Op Node - if( m_currentLightModel == StandardShaderLightModel.CustomLighting ) - { - hasCustomLightingMask = true; - m_currentDataCollector.UsingCustomOutput = true; - m_currentDataCollector.GenType = PortGenType.CustomLighting; - WireReference connection = sortedPorts[ i ].GetConnection(); - ParentNode node = UIUtils.GetNode( connection.NodeId ); - - customLightingMaskCode = node.GetValueFromOutputStr( connection.PortId, WirePortDataType.FLOAT, ref m_currentDataCollector, false ); - customLightingMaskCode = "clip( " + customLightingMaskCode + " - " + m_inlineOpacityMaskClipValue.GetValueOrProperty( IOUtils.MaskClipValueName, false ) + " )"; - customLightingInstructions = m_currentDataCollector.CustomOutput; - - m_currentDataCollector.GenType = PortGenType.NonCustomLighting; - m_currentDataCollector.UsingCustomOutput = false; - continue; - } - else - { - string clipIn = "\t\t\tclip( "; - string clipOut = " - " + m_inlineOpacityMaskClipValue.GetValueOrProperty( IOUtils.MaskClipValueName, false ) + " );\n"; - //if( ( m_alphaToCoverage || m_inlineAlphaToCoverage.Active ) && m_castShadows ) - //{ - // clipIn = "\t\t\t#if UNITY_PASS_SHADOWCASTER\n" + clipIn; - // clipOut = clipOut + "\t\t\t#endif\n"; - //} - CreateInstructionsForPort( sortedPorts[ i ], Constants.OutputVarStr + "." + sortedPorts[ i ].DataName, true, clipIn, clipOut, false, normalIsConnected ); - } - } - else if( sortedPorts[ i ].DataName.Equals( VertexDataStr ) ) - { - string vertexInstructions = CreateInstructionsForVertexPort( sortedPorts[ i ] ); - m_currentDataCollector.AddToVertexDisplacement( vertexInstructions, m_vertexMode ); - } - else if( sortedPorts[ i ].DataName.Equals( VertexNormalStr ) ) - { - string vertexInstructions = CreateInstructionsForVertexPort( sortedPorts[ i ] ); - m_currentDataCollector.AddToVertexNormal( vertexInstructions ); - } - else if( m_tessOpHelper.IsTessellationPort( sortedPorts[ i ].PortId ) && sortedPorts[ i ].IsConnected /* && m_tessOpHelper.EnableTesselation*/) - { - //Vertex displacement and per vertex custom data - WireReference connection = sortedPorts[ i ].GetConnection(); - ParentNode node = UIUtils.GetNode( connection.NodeId ); - - string vertexInstructions = node.GetValueFromOutputStr( connection.PortId, sortedPorts[ i ].DataType, ref m_currentDataCollector, false ); - - if( m_currentDataCollector.DirtySpecialLocalVariables ) - { - m_tessOpHelper.AddAdditionalData( m_currentDataCollector.SpecialLocalVariables ); - m_currentDataCollector.ClearSpecialLocalVariables(); - } - - if( m_currentDataCollector.DirtyVertexVariables ) - { - m_tessOpHelper.AddAdditionalData( m_currentDataCollector.VertexLocalVariables ); - m_currentDataCollector.ClearVertexLocalVariables(); - } - - m_tessOpHelper.AddCustomFunction( vertexInstructions ); - } - else if( sortedPorts[ i ].Name.Equals( RefractionStr ) ) - { - ContainerGraph.ResetNodesLocalVariables(); - m_currentDataCollector.UsingCustomOutput = true; - - refractionFix = " + 0.00001 * i.screenPos * i.worldPos"; - m_currentDataCollector.AddInstructions( "\t\t\to.Normal = o.Normal" + refractionFix + ";\n" ); - refractionCode = CreateInstructionStringForPort( sortedPorts[ i ], false ); - refractionInstructions = m_currentDataCollector.CustomOutput; - - m_currentDataCollector.UsingCustomOutput = false; - } - else if( sortedPorts[ i ].Name.Equals( CustomLightingStr ) ) - { - m_currentDataCollector.UsingCustomOutput = true; - WireReference connection = sortedPorts[ i ].GetConnection(); - ParentNode node = UIUtils.GetNode( connection.NodeId ); - - customLightingCode = node.GetValueFromOutputStr( connection.PortId, WirePortDataType.FLOAT3, ref m_currentDataCollector, false ); - customLightingInstructions = m_currentDataCollector.CustomOutput; - - if( m_currentDataCollector.ForceNormal ) - { - m_currentDataCollector.AddToStartInstructions( "\t\t\t" + Constants.OutputVarStr + ".Normal = float3(0,0,1);\n" ); - m_currentDataCollector.DirtyNormal = true; - m_currentDataCollector.ForceNormal = false; - } - - if( m_currentDataCollector.DirtyVertexVariables ) - { - m_currentDataCollector.AddVertexInstruction( m_currentDataCollector.VertexLocalVariables, UniqueId, false ); - m_currentDataCollector.ClearVertexLocalVariables(); - } - - m_currentDataCollector.UsingCustomOutput = false; - - } - else if( sortedPorts[ i ].Name.Equals( AlphaStr ) && m_currentLightModel == StandardShaderLightModel.CustomLighting ) - { - m_currentDataCollector.UsingCustomOutput = true; - m_currentDataCollector.GenType = PortGenType.CustomLighting; - - WireReference connection = sortedPorts[ i ].GetConnection(); - ParentNode node = UIUtils.GetNode( connection.NodeId ); - - customLightingAlphaCode = node.GetValueFromOutputStr( connection.PortId, WirePortDataType.FLOAT, ref m_currentDataCollector, false ); - customLightingInstructions = m_currentDataCollector.CustomOutput; - - if( m_currentDataCollector.ForceNormal ) - { - m_currentDataCollector.AddToStartInstructions( "\t\t\t" + Constants.OutputVarStr + ".Normal = float3(0,0,1);\n" ); - m_currentDataCollector.DirtyNormal = true; - m_currentDataCollector.ForceNormal = false; - } - - if( m_currentDataCollector.DirtyVertexVariables ) - { - m_currentDataCollector.AddVertexInstruction( m_currentDataCollector.VertexLocalVariables, UniqueId, false ); - m_currentDataCollector.ClearVertexLocalVariables(); - } - - m_currentDataCollector.GenType = PortGenType.NonCustomLighting; - m_currentDataCollector.UsingCustomOutput = false; - } - else - { - // Surface shader instruccions - // if working on normals and have normal dependent node then ignore local var generation - CreateInstructionsForPort( sortedPorts[ i ], Constants.OutputVarStr + "." + sortedPorts[ i ].DataName, false, null, null, false, normalIsConnected ); - } - } - else if( sortedPorts[ i ].Name.Equals( AlphaStr ) ) - { - if( m_currentLightModel != StandardShaderLightModel.CustomLighting ) - { - m_currentDataCollector.AddInstructions( string.Format( "\t\t\t{0}.{1} = 1;\n", Constants.OutputVarStr, sortedPorts[ i ].DataName ) ); - } - } - } - - m_billboardOpHelper.FillDataCollectorWithInternalData( ref m_currentDataCollector ); - } - - - if( !m_renderingOptionsOpHelper.UseDefaultShadowCaster && - ( ( m_castShadows && ( m_alphaToCoverage || m_inlineAlphaToCoverage.Active ) ) || - ( m_castShadows && hasOpacity ) || - ( m_castShadows && ( m_currentDataCollector.UsingWorldNormal || m_currentDataCollector.UsingWorldReflection || m_currentDataCollector.UsingViewDirection ) ) || - ( m_castShadows && m_inputPorts[ m_discardPortId ].Available && m_inputPorts[ m_discardPortId ].IsConnected && m_currentLightModel == StandardShaderLightModel.CustomLighting ) )) - m_customShadowCaster = true; - else - m_customShadowCaster = false; - - //m_customShadowCaster = true; - - for( int i = 0; i < 4; i++ ) - { - if( m_currentDataCollector.GetChannelUsage( i ) == TextureChannelUsage.Required ) - { - string channelName = UIUtils.GetChannelName( i ); - m_currentDataCollector.AddToProperties( -1, UIUtils.GetTex2DProperty( channelName, TexturePropertyValues.white ), -1 ); - } - } - - m_currentDataCollector.AddToProperties( -1, IOUtils.DefaultASEDirtyCheckProperty, 10000 ); - if( m_inputPorts[ m_discardPortId ].Available && m_inputPorts[ m_discardPortId ].IsConnected ) - { - if( m_inlineOpacityMaskClipValue.IsValid ) - { - RangedFloatNode fnode = UIUtils.GetNode( m_inlineOpacityMaskClipValue.NodeId ) as RangedFloatNode; - if( fnode != null ) - { - m_currentDataCollector.AddToProperties( fnode.UniqueId, fnode.GetPropertyValue(), fnode.OrderIndex ); - m_currentDataCollector.AddToUniforms( fnode.UniqueId, fnode.GetUniformValue() ); - } - else - { - IntNode inode = UIUtils.GetNode( m_inlineOpacityMaskClipValue.NodeId ) as IntNode; - m_currentDataCollector.AddToProperties( inode.UniqueId, inode.GetPropertyValue(), inode.OrderIndex ); - m_currentDataCollector.AddToUniforms( inode.UniqueId, inode.GetUniformValue() ); - } - } - else - { - m_currentDataCollector.AddToProperties( -1, string.Format( IOUtils.MaskClipValueProperty, OpacityMaskClipValueStr, m_opacityMaskClipValue ), ( m_maskClipReorder != null ) ? m_maskClipReorder.OrderIndex : -1 ); - m_currentDataCollector.AddToUniforms( -1, string.Format( IOUtils.MaskClipValueUniform, m_opacityMaskClipValue ) ); - } - } - - if( !m_currentDataCollector.DirtyInputs ) - m_currentDataCollector.AddToInput( UniqueId, "half filler", true ); - - if( m_currentLightModel == StandardShaderLightModel.BlinnPhong ) - m_currentDataCollector.AddToProperties( -1, "_SpecColor(\"Specular Color\",Color)=(1,1,1,1)", m_specColorReorder.OrderIndex ); - - //Tesselation - if( m_tessOpHelper.EnableTesselation ) - { - m_tessOpHelper.AddToDataCollector( ref m_currentDataCollector, m_tessellationReorder != null ? m_tessellationReorder.OrderIndex : -1 ); - if( !m_currentDataCollector.DirtyPerVertexData ) - { - m_currentDataCollector.OpenPerVertexHeader( false ); - } - } - - - if( m_outlineHelper.EnableOutline || ( m_currentDataCollector.UsingCustomOutlineColor || m_currentDataCollector.CustomOutlineSelectedAlpha > 0 || m_currentDataCollector.UsingCustomOutlineWidth ) ) - { - m_outlineHelper.AddToDataCollector( ref m_currentDataCollector ); - } - -#if !UNITY_2017_1_OR_NEWER - if( m_renderingOptionsOpHelper.LodCrossfade ) - { - m_currentDataCollector.AddToPragmas( UniqueId, "multi_compile _ LOD_FADE_CROSSFADE" ); - m_currentDataCollector.AddToStartInstructions( "\t\t\tUNITY_APPLY_DITHER_CROSSFADE(i);\n" ); - m_currentDataCollector.AddToInput( UniqueId, "UNITY_DITHER_CROSSFADE_COORDS", false ); - m_currentDataCollector.AddVertexInstruction( "UNITY_TRANSFER_DITHER_CROSSFADE( " + Constants.VertexShaderOutputStr + ", " + Constants.VertexShaderInputStr + ".vertex )", UniqueId, true ); - } -#endif - //m_additionalIncludes.AddToDataCollector( ref m_currentDataCollector ); - //m_additionalPragmas.AddToDataCollector( ref m_currentDataCollector ); - //m_additionalDefines.AddToDataCollector( ref m_currentDataCollector ); - m_additionalDirectives.AddAllToDataCollector( ref m_currentDataCollector ); - - //m_currentDataCollector.CloseInputs(); - m_currentDataCollector.CloseCustomInputs(); - m_currentDataCollector.CloseProperties(); - m_currentDataCollector.ClosePerVertexHeader(); - - //build Shader Body - string ShaderBody = string.Empty; - OpenShaderBody( ref ShaderBody, m_shaderName ); - { - //set properties - if( m_currentDataCollector.DirtyProperties ) - { - ShaderBody += m_currentDataCollector.BuildPropertiesString(); - } - //set subshader - OpenSubShaderBody( ref ShaderBody ); - { - - // Add extra depth pass - m_zBufferHelper.DrawExtraDepthPass( ref ShaderBody ); - - // Add optionalPasses - if( m_outlineHelper.EnableOutline || ( m_currentDataCollector.UsingCustomOutlineColor || m_currentDataCollector.CustomOutlineSelectedAlpha > 0 || m_currentDataCollector.UsingCustomOutlineWidth ) ) - { - if( !usingDebugPort ) - AddMultilineBody( ref ShaderBody, m_outlineHelper.OutlineFunctionBody( ref m_currentDataCollector, isInstancedShader, m_customShadowCaster, UIUtils.RemoveInvalidCharacters( ShaderName ), ( m_billboardOpHelper.IsBillboard && !usingDebugPort ? m_billboardOpHelper.GetInternalMultilineInstructions() : null ), ref m_tessOpHelper, ShaderModelTypeArr[ m_shaderModelIdx ], CurrentPrecisionType ) ); - } - - //Add SubShader tags - if( hasEmission ) - { - tags += " \"IsEmissive\" = \"true\" "; - } - - tags += m_customTagsHelper.GenerateCustomTags(); - - tags = "Tags{ " + tags + " }"; - m_usePass.BuildUsePassInfo( m_currentDataCollector, ref aboveUsePasses, ref bellowUsePasses, "\t\t" ); - if( !string.IsNullOrEmpty( aboveUsePasses ) ) - { - ShaderBody += aboveUsePasses; - } - - AddRenderTags( ref ShaderBody, tags ); - AddShaderLOD( ref ShaderBody, ShaderLOD ); - AddRenderState( ref ShaderBody, "Cull", m_inlineCullMode.GetValueOrProperty( m_cullMode.ToString() ) ); - m_customBlendAvailable = ( m_alphaMode == AlphaMode.Custom || m_alphaMode == AlphaMode.Opaque ); - if( ( m_zBufferHelper.IsActive && m_customBlendAvailable ) || m_outlineHelper.UsingZWrite || m_outlineHelper.UsingZTest ) - { - ShaderBody += m_zBufferHelper.CreateDepthInfo( m_outlineHelper.UsingZWrite, m_outlineHelper.UsingZTest ); - } - if( m_stencilBufferHelper.Active ) - { - ShaderBody += m_stencilBufferHelper.CreateStencilOp( this ); - } - - if( m_blendOpsHelper.Active ) - { - ShaderBody += m_blendOpsHelper.CreateBlendOps(); - } - - if( m_alphaToCoverage || m_inlineAlphaToCoverage.Active ) - { - ShaderBody += "\t\tAlphaToMask "+ m_inlineAlphaToCoverage.GetValueOrProperty( "On" )+"\n"; - } - - // Build Color Mask - m_colorMaskHelper.BuildColorMask( ref ShaderBody, m_customBlendAvailable ); - - //ShaderBody += "\t\tZWrite " + _zWriteMode + '\n'; - //ShaderBody += "\t\tZTest " + _zTestMode + '\n'; - - //Add GrabPass - if( m_currentDataCollector.DirtyGrabPass ) - { - ShaderBody += m_currentDataCollector.GrabPass; - } - - // build optional parameters - string OptionalParameters = string.Empty; - - // addword standard to custom lighting to accepts standard lighting models - string standardCustomLighting = string.Empty; - if( m_currentLightModel == StandardShaderLightModel.CustomLighting ) - standardCustomLighting = "Standard"; - - //add cg program - if( m_customShadowCaster ) - OpenCGInclude( ref ShaderBody ); - else - OpenCGProgram( ref ShaderBody ); - { - //Add Defines - if( m_currentDataCollector.DirtyDefines ) - ShaderBody += m_currentDataCollector.Defines; - - //Add Includes - if( m_customShadowCaster ) - { - m_currentDataCollector.AddToIncludes( UniqueId, Constants.UnityPBSLightingLib ); - m_currentDataCollector.AddToIncludes( UniqueId, "Lighting.cginc" ); - } - if( m_currentDataCollector.DirtyIncludes ) - ShaderBody += m_currentDataCollector.Includes; - - //define as surface shader and specify lighting model - if( UIUtils.GetTextureArrayNodeAmount() > 0 && m_shaderModelIdx < 3 ) - { - UIUtils.ShowMessage( "Automatically changing Shader Model to 3.5 since\nit's the minimum required by texture arrays." ); - m_shaderModelIdx = 3; - } - - // if tessellation is active then we need be at least using shader model 4.6 - if( m_tessOpHelper.EnableTesselation && m_shaderModelIdx < 6 ) - { - UIUtils.ShowMessage( "Automatically changing Shader Model to 4.6 since\nit's the minimum required by tessellation." ); - m_shaderModelIdx = 6; - } - - // if translucency is ON change render path - if( hasTranslucency && m_renderPath != RenderPath.ForwardOnly ) - { - UIUtils.ShowMessage( "Automatically changing Render Path to Forward Only since\ntranslucency only works in forward rendering." ); - m_renderPath = RenderPath.ForwardOnly; - } - - // if outline is ON change render path - if( m_outlineHelper.EnableOutline && m_renderPath != RenderPath.ForwardOnly ) - { - UIUtils.ShowMessage( "Automatically changing Render Path to Forward Only since\noutline only works in forward rendering." ); - m_renderPath = RenderPath.ForwardOnly; - } - - // if transmission is ON change render path - if( hasTransmission && m_renderPath != RenderPath.ForwardOnly ) - { - UIUtils.ShowMessage( "Automatically changing Render Path to Forward Only since\ntransmission only works in forward rendering." ); - m_renderPath = RenderPath.ForwardOnly; - } - - // if refraction is ON change render path - if( hasRefraction && m_renderPath != RenderPath.ForwardOnly ) - { - UIUtils.ShowMessage( "Automatically changing Render Path to Forward Only since\nrefraction only works in forward rendering." ); - m_renderPath = RenderPath.ForwardOnly; - } - - ShaderBody += string.Format( IOUtils.PragmaTargetHeader, ShaderModelTypeArr[ m_shaderModelIdx ] ); - - - //Add pragmas (needs check to see if all pragmas work with custom shadow caster) - if( m_currentDataCollector.DirtyPragmas/* && !m_customShadowCaster */) - ShaderBody += m_currentDataCollector.Pragmas; - - if( m_currentDataCollector.DirtyAdditionalDirectives ) - ShaderBody += m_currentDataCollector.StandardAdditionalDirectives; - - //if ( !m_customBlendMode ) - { - switch( m_alphaMode ) - { - case AlphaMode.Opaque: - case AlphaMode.Masked: break; - case AlphaMode.Transparent: - { - OptionalParameters += "alpha:fade" + Constants.OptionalParametersSep; - } - break; - case AlphaMode.Premultiply: - { - OptionalParameters += "alpha:premul" + Constants.OptionalParametersSep; - } - break; - } - } - - if( m_keepAlpha ) - { - OptionalParameters += "keepalpha" + Constants.OptionalParametersSep; - } - - if( hasRefraction ) - { - OptionalParameters += "finalcolor:RefractionF" + Constants.OptionalParametersSep; - } - - if( !m_customShadowCaster && m_castShadows ) - { - OptionalParameters += "addshadow" + Constants.OptionalParametersSep; - } - - if( m_castShadows ) - { - OptionalParameters += "fullforwardshadows" + Constants.OptionalParametersSep; - } - - if( !m_receiveShadows ) - { - OptionalParameters += "noshadow" + Constants.OptionalParametersSep; - } - - if( m_renderingOptionsOpHelper.IsOptionActive( " Add Pass" ) && usingDebugPort ) - { - OptionalParameters += "noforwardadd" + Constants.OptionalParametersSep; - } - - if( m_renderingOptionsOpHelper.ForceDisableInstancing ) - { - OptionalParameters += "noinstancing" + Constants.OptionalParametersSep; - } - - switch( m_renderPath ) - { - case RenderPath.All: break; - case RenderPath.DeferredOnly: OptionalParameters += "exclude_path:forward" + Constants.OptionalParametersSep; break; - case RenderPath.ForwardOnly: OptionalParameters += "exclude_path:deferred" + Constants.OptionalParametersSep; break; - } - - //Add code generation options - m_renderingOptionsOpHelper.Build( ref OptionalParameters ); - - if( !m_customShadowCaster ) - { - string customLightSurface = string.Empty; - if( hasTranslucency || hasTransmission ) - customLightSurface = "Custom"; - m_renderingPlatformOpHelper.SetRenderingPlatforms( ref ShaderBody ); - - //Check if Custom Vertex is being used and add tag - if( m_currentDataCollector.DirtyPerVertexData ) - OptionalParameters += "vertex:" + Constants.VertexDataFunc + Constants.OptionalParametersSep; - - if( m_tessOpHelper.EnableTesselation && !usingDebugPort ) - { - m_tessOpHelper.WriteToOptionalParams( ref OptionalParameters ); - } - - m_additionalSurfaceOptions.WriteToOptionalSurfaceOptions( ref OptionalParameters ); - - AddShaderPragma( ref ShaderBody, "surface surf " + standardCustomLighting + m_currentLightModel.ToString() + customLightSurface + Constants.OptionalParametersSep + OptionalParameters ); - } - else - { - if( /*m_currentDataCollector.UsingWorldNormal ||*/ m_currentDataCollector.UsingInternalData ) - { - ShaderBody += "\t\t#ifdef UNITY_PASS_SHADOWCASTER\n"; - ShaderBody += "\t\t\t#undef INTERNAL_DATA\n"; - ShaderBody += "\t\t\t#undef WorldReflectionVector\n"; - ShaderBody += "\t\t\t#undef WorldNormalVector\n"; - ShaderBody += "\t\t\t#define INTERNAL_DATA half3 internalSurfaceTtoW0; half3 internalSurfaceTtoW1; half3 internalSurfaceTtoW2;\n"; - ShaderBody += "\t\t\t#define WorldReflectionVector(data,normal) reflect (data.worldRefl, half3(dot(data.internalSurfaceTtoW0,normal), dot(data.internalSurfaceTtoW1,normal), dot(data.internalSurfaceTtoW2,normal)))\n"; - ShaderBody += "\t\t\t#define WorldNormalVector(data,normal) half3(dot(data.internalSurfaceTtoW0,normal), dot(data.internalSurfaceTtoW1,normal), dot(data.internalSurfaceTtoW2,normal))\n"; - ShaderBody += "\t\t#endif\n"; - } - } - - if( m_currentDataCollector.UsingHigherSizeTexcoords ) - { - ShaderBody += "\t\t#undef TRANSFORM_TEX\n"; - ShaderBody += "\t\t#define TRANSFORM_TEX(tex,name) float4(tex.xy * name##_ST.xy + name##_ST.zw, tex.z, tex.w)\n"; - } - - if( m_currentDataCollector.DirtyAppData ) - ShaderBody += m_currentDataCollector.CustomAppData; - - // Add Input struct - if( m_currentDataCollector.DirtyInputs ) - ShaderBody += "\t\t" + m_currentDataCollector.Inputs + "\t\t};" + "\n\n"; - - // Add Custom Lighting struct - if( m_currentDataCollector.DirtyCustomInput ) - ShaderBody += m_currentDataCollector.CustomInput + "\n\n"; - - //Add Uniforms - if( m_currentDataCollector.DirtyUniforms ) - ShaderBody += m_currentDataCollector.Uniforms + "\n"; - - // Add Array Derivatives Macros - //if( m_currentDataCollector.UsingArrayDerivatives ) - //{ - // ShaderBody += "\t\t#if defined(UNITY_COMPILER_HLSL2GLSL) || defined(SHADER_TARGET_SURFACE_ANALYSIS)\n"; - // ShaderBody += "\t\t\t#define ASE_SAMPLE_TEX2DARRAY_GRAD(tex,coord,dx,dy) UNITY_SAMPLE_TEX2DARRAY (tex,coord)\n"; - // ShaderBody += "\t\t#else\n"; - // ShaderBody += "\t\t\t#define ASE_SAMPLE_TEX2DARRAY_GRAD(tex,coord,dx,dy) tex.SampleGrad (sampler##tex,coord,dx,dy)\n"; - // ShaderBody += "\t\t#endif\n\n"; - //} - - //Add Instanced Properties - if( isInstancedShader && m_currentDataCollector.DirtyInstancedProperties ) - { - m_currentDataCollector.SetupInstancePropertiesBlock( UIUtils.RemoveInvalidCharacters( ShaderName ) ); - ShaderBody += m_currentDataCollector.InstancedProperties + "\n"; - } - - if( m_currentDataCollector.DirtyFunctions ) - ShaderBody += m_currentDataCollector.Functions + "\n"; - - - //Tesselation - if( m_tessOpHelper.EnableTesselation && !usingDebugPort ) - { - ShaderBody += m_tessOpHelper.GetCurrentTessellationFunction + "\n"; - } - - //Add Custom Vertex Data - if( m_currentDataCollector.DirtyPerVertexData ) - { - ShaderBody += m_currentDataCollector.VertexData; - } - - if( m_currentLightModel == StandardShaderLightModel.Unlit ) - { - for( int i = 0; i < VertexLitFunc.Length; i++ ) - { - ShaderBody += VertexLitFunc[ i ] + "\n"; - } - } - - //Add custom lighting - if( m_currentLightModel == StandardShaderLightModel.CustomLighting ) - { - ShaderBody += "\t\tinline half4 LightingStandard" + m_currentLightModel.ToString() + "( inout " + outputStruct + " " + Constants.CustomLightOutputVarStr + ", half3 viewDir, UnityGI gi )\n\t\t{\n"; - ShaderBody += "\t\t\tUnityGIInput data = s.GIData;\n"; - ShaderBody += "\t\t\tInput i = s.SurfInput;\n"; - ShaderBody += "\t\t\thalf4 c = 0;\n"; - if( m_currentDataCollector.UsingLightAttenuation ) - { - ShaderBody += "\t\t\t#ifdef UNITY_PASS_FORWARDBASE\n"; - ShaderBody += "\t\t\tfloat ase_lightAtten = data.atten;\n"; - ShaderBody += "\t\t\tif( _LightColor0.a == 0)\n"; - ShaderBody += "\t\t\tase_lightAtten = 0;\n"; - ShaderBody += "\t\t\t#else\n"; - ShaderBody += "\t\t\tfloat3 ase_lightAttenRGB = gi.light.color / ( ( _LightColor0.rgb ) + 0.000001 );\n"; - ShaderBody += "\t\t\tfloat ase_lightAtten = max( max( ase_lightAttenRGB.r, ase_lightAttenRGB.g ), ase_lightAttenRGB.b );\n"; - ShaderBody += "\t\t\t#endif\n"; - - ShaderBody += "\t\t\t#if defined(HANDLE_SHADOWS_BLENDING_IN_GI)\n"; - ShaderBody += "\t\t\thalf bakedAtten = UnitySampleBakedOcclusion(data.lightmapUV.xy, data.worldPos);\n"; - ShaderBody += "\t\t\tfloat zDist = dot(_WorldSpaceCameraPos - data.worldPos, UNITY_MATRIX_V[2].xyz);\n"; - ShaderBody += "\t\t\tfloat fadeDist = UnityComputeShadowFadeDistance(data.worldPos, zDist);\n"; - ShaderBody += "\t\t\tase_lightAtten = UnityMixRealtimeAndBakedShadows(data.atten, bakedAtten, UnityComputeShadowFade(fadeDist));\n"; - ShaderBody += "\t\t\t#endif\n"; - } - - //if( m_currentDataCollector.dirtyc ) - ShaderBody += customLightingInstructions; - ShaderBody += "\t\t\tc.rgb = " + ( !string.IsNullOrEmpty( customLightingCode ) ? customLightingCode : "0" ) + ";\n"; - ShaderBody += "\t\t\tc.a = " + ( !string.IsNullOrEmpty( customLightingAlphaCode ) ? customLightingAlphaCode : "1" ) + ";\n"; - if( m_alphaMode == AlphaMode.Premultiply || ( ( m_alphaMode == AlphaMode.Custom || m_alphaMode == AlphaMode.Opaque ) && m_blendOpsHelper.CurrentBlendRGB.IndexOf( "Premultiplied" ) > -1 ) ) - ShaderBody += "\t\t\tc.rgb *= c.a;\n"; - if( hasCustomLightingMask ) - ShaderBody += "\t\t\t" + customLightingMaskCode + ";\n"; - ShaderBody += "\t\t\treturn c;\n"; - ShaderBody += "\t\t}\n\n"; - - //Add GI function - ShaderBody += "\t\tinline void LightingStandard" + m_currentLightModel.ToString() + "_GI( inout " + outputStruct + " " + Constants.CustomLightOutputVarStr + ", UnityGIInput data, inout UnityGI gi )\n\t\t{\n"; - ShaderBody += "\t\t\ts.GIData = data;\n"; - //ShaderBody += "\t\t\tUNITY_GI(gi, " + Constants.CustomLightOutputVarStr + ", data);\n"; - ShaderBody += "\t\t}\n\n"; - } - - //Add custom lighting function - if( hasTranslucency || hasTransmission ) - { - ShaderBody += "\t\tinline half4 Lighting" + m_currentLightModel.ToString() + Constants.CustomLightStructStr + "(" + outputStruct + " " + Constants.CustomLightOutputVarStr + ", half3 viewDir, UnityGI gi )\n\t\t{\n"; - if( hasTranslucency ) - { - ShaderBody += "\t\t\t#if !DIRECTIONAL\n"; - ShaderBody += "\t\t\tfloat3 lightAtten = gi.light.color;\n"; - ShaderBody += "\t\t\t#else\n"; - ShaderBody += "\t\t\tfloat3 lightAtten = lerp( _LightColor0.rgb, gi.light.color, _TransShadow );\n"; - ShaderBody += "\t\t\t#endif\n"; - ShaderBody += "\t\t\thalf3 lightDir = gi.light.dir + " + Constants.CustomLightOutputVarStr + ".Normal * _TransNormalDistortion;\n"; - ShaderBody += "\t\t\thalf transVdotL = pow( saturate( dot( viewDir, -lightDir ) ), _TransScattering );\n"; - ShaderBody += "\t\t\thalf3 translucency = lightAtten * (transVdotL * _TransDirect + gi.indirect.diffuse * _TransAmbient) * " + Constants.CustomLightOutputVarStr + ".Translucency;\n"; - ShaderBody += "\t\t\thalf4 c = half4( " + Constants.CustomLightOutputVarStr + ".Albedo * translucency * _Translucency, 0 );\n\n"; - } - - if( hasTransmission ) - { - ShaderBody += "\t\t\thalf3 transmission = max(0 , -dot(" + Constants.CustomLightOutputVarStr + ".Normal, gi.light.dir)) * gi.light.color * " + Constants.CustomLightOutputVarStr + ".Transmission;\n"; - ShaderBody += "\t\t\thalf4 d = half4(" + Constants.CustomLightOutputVarStr + ".Albedo * transmission , 0);\n\n"; - } - - ShaderBody += "\t\t\tSurfaceOutput" + m_currentLightModel.ToString() + " r;\n"; - ShaderBody += "\t\t\tr.Albedo = " + Constants.CustomLightOutputVarStr + ".Albedo;\n"; - ShaderBody += "\t\t\tr.Normal = " + Constants.CustomLightOutputVarStr + ".Normal;\n"; - ShaderBody += "\t\t\tr.Emission = " + Constants.CustomLightOutputVarStr + ".Emission;\n"; - switch( m_currentLightModel ) - { - case StandardShaderLightModel.Standard: - ShaderBody += "\t\t\tr.Metallic = " + Constants.CustomLightOutputVarStr + ".Metallic;\n"; - break; - case StandardShaderLightModel.StandardSpecular: - ShaderBody += "\t\t\tr.Specular = " + Constants.CustomLightOutputVarStr + ".Specular;\n"; - break; - } - ShaderBody += "\t\t\tr.Smoothness = " + Constants.CustomLightOutputVarStr + ".Smoothness;\n"; - ShaderBody += "\t\t\tr.Occlusion = " + Constants.CustomLightOutputVarStr + ".Occlusion;\n"; - ShaderBody += "\t\t\tr.Alpha = " + Constants.CustomLightOutputVarStr + ".Alpha;\n"; - ShaderBody += "\t\t\treturn Lighting" + m_currentLightModel.ToString() + " (r, viewDir, gi)" + ( hasTranslucency ? " + c" : "" ) + ( hasTransmission ? " + d" : "" ) + ";\n"; - ShaderBody += "\t\t}\n\n"; - - //Add GI function - ShaderBody += "\t\tinline void Lighting" + m_currentLightModel.ToString() + Constants.CustomLightStructStr + "_GI(" + outputStruct + " " + Constants.CustomLightOutputVarStr + ", UnityGIInput data, inout UnityGI gi )\n\t\t{\n"; - - ShaderBody += "\t\t\t#if defined(UNITY_PASS_DEFERRED) && UNITY_ENABLE_REFLECTION_BUFFERS\n"; - ShaderBody += "\t\t\t\tgi = UnityGlobalIllumination(data, " + Constants.CustomLightOutputVarStr + ".Occlusion, " + Constants.CustomLightOutputVarStr + ".Normal);\n"; - ShaderBody += "\t\t\t#else\n"; - ShaderBody += "\t\t\t\tUNITY_GLOSSY_ENV_FROM_SURFACE( g, " + Constants.CustomLightOutputVarStr + ", data );\n"; - ShaderBody += "\t\t\t\tgi = UnityGlobalIllumination( data, " + Constants.CustomLightOutputVarStr + ".Occlusion, " + Constants.CustomLightOutputVarStr + ".Normal, g );\n"; - ShaderBody += "\t\t\t#endif\n"; - - //ShaderBody += "\t\t\tUNITY_GI(gi, " + Constants.CustomLightOutputVarStr + ", data);\n"; - ShaderBody += "\t\t}\n\n"; - } - - if( hasRefraction ) - { - ShaderBody += "\t\tinline float4 Refraction( Input " + Constants.InputVarStr + ", " + outputStruct + " " + Constants.OutputVarStr + ", float indexOfRefraction, float chomaticAberration ) {\n"; - ShaderBody += "\t\t\tfloat3 worldNormal = " + Constants.OutputVarStr + ".Normal;\n"; - ShaderBody += "\t\t\tfloat4 screenPos = " + Constants.InputVarStr + ".screenPos;\n"; - ShaderBody += "\t\t\t#if UNITY_UV_STARTS_AT_TOP\n"; - ShaderBody += "\t\t\t\tfloat scale = -1.0;\n"; - ShaderBody += "\t\t\t#else\n"; - ShaderBody += "\t\t\t\tfloat scale = 1.0;\n"; - ShaderBody += "\t\t\t#endif\n"; - ShaderBody += "\t\t\tfloat halfPosW = screenPos.w * 0.5;\n"; - ShaderBody += "\t\t\tscreenPos.y = ( screenPos.y - halfPosW ) * _ProjectionParams.x * scale + halfPosW;\n"; - ShaderBody += "\t\t\t#if SHADER_API_D3D9 || SHADER_API_D3D11\n"; - ShaderBody += "\t\t\t\tscreenPos.w += 0.00000000001;\n"; - ShaderBody += "\t\t\t#endif\n"; - ShaderBody += "\t\t\tfloat2 projScreenPos = ( screenPos / screenPos.w ).xy;\n"; - ShaderBody += "\t\t\tfloat3 worldViewDir = normalize( UnityWorldSpaceViewDir( " + Constants.InputVarStr + ".worldPos ) );\n"; - ShaderBody += "\t\t\tfloat3 refractionOffset = ( indexOfRefraction - 1.0 ) * mul( UNITY_MATRIX_V, float4( worldNormal, 0.0 ) ) * ( 1.0 - dot( worldNormal, worldViewDir ) );\n"; - ShaderBody += "\t\t\tfloat2 cameraRefraction = float2( refractionOffset.x, refractionOffset.y );\n"; - - string grabpass = "_GrabTexture"; - if( m_grabOrder != 0 ) - grabpass = "RefractionGrab" + m_grabOrder; - ShaderBody += "\t\t\tfloat4 redAlpha = tex2D( " + grabpass + ", ( projScreenPos + cameraRefraction ) );\n"; - ShaderBody += "\t\t\tfloat green = tex2D( " + grabpass + ", ( projScreenPos + ( cameraRefraction * ( 1.0 - chomaticAberration ) ) ) ).g;\n"; - ShaderBody += "\t\t\tfloat blue = tex2D( " + grabpass + ", ( projScreenPos + ( cameraRefraction * ( 1.0 + chomaticAberration ) ) ) ).b;\n"; - ShaderBody += "\t\t\treturn float4( redAlpha.r, green, blue, redAlpha.a );\n"; - ShaderBody += "\t\t}\n\n"; - - ShaderBody += "\t\tvoid RefractionF( Input " + Constants.InputVarStr + ", " + outputStruct + " " + Constants.OutputVarStr + ", inout half4 color )\n"; - ShaderBody += "\t\t{\n"; - ShaderBody += "\t\t\t#ifdef UNITY_PASS_FORWARDBASE\n"; - ShaderBody += refractionInstructions; - if( m_inlineChromaticAberration.Active ) - { - ShaderBody += "\t\t\tcolor.rgb = color.rgb + Refraction( " + Constants.InputVarStr + ", " + Constants.OutputVarStr + ", " + refractionCode + ", " + m_inlineChromaticAberration.GetValueOrProperty(false) + " ) * ( 1 - color.a );\n"; - } - else - { - ShaderBody += "\t\t\tcolor.rgb = color.rgb + Refraction( " + Constants.InputVarStr + ", " + Constants.OutputVarStr + ", " + refractionCode + ", _ChromaticAberration ) * ( 1 - color.a );\n"; - } - ShaderBody += "\t\t\tcolor.a = 1;\n"; - ShaderBody += "\t\t\t#endif\n"; - ShaderBody += "\t\t}\n\n"; - } - - //Add Surface Shader body - ShaderBody += "\t\tvoid surf( Input " + Constants.InputVarStr + " , inout " + outputStruct + " " + Constants.OutputVarStr + " )\n\t\t{\n"; - { - // Pass input information to custom lighting function - if( m_currentLightModel == StandardShaderLightModel.CustomLighting ) - ShaderBody += "\t\t\t" + Constants.OutputVarStr + ".SurfInput = " + Constants.InputVarStr + ";\n"; - - //add local vars - if( m_currentDataCollector.DirtyLocalVariables ) - ShaderBody += m_currentDataCollector.LocalVariables; - - //add nodes ops - if( m_currentDataCollector.DirtyInstructions ) - ShaderBody += m_currentDataCollector.Instructions; - } - ShaderBody += "\t\t}\n"; - } - CloseCGProgram( ref ShaderBody ); - - - //Add custom Shadow Caster - if( m_customShadowCaster ) - { - OpenCGProgram( ref ShaderBody ); - string customLightSurface = hasTranslucency || hasTransmission ? "Custom" : ""; - m_renderingPlatformOpHelper.SetRenderingPlatforms( ref ShaderBody ); - - //Check if Custom Vertex is being used and add tag - if( m_currentDataCollector.DirtyPerVertexData ) - OptionalParameters += "vertex:" + Constants.VertexDataFunc + Constants.OptionalParametersSep; - - if( m_tessOpHelper.EnableTesselation && !usingDebugPort ) - { - m_tessOpHelper.WriteToOptionalParams( ref OptionalParameters ); - } - //if ( hasRefraction ) - // ShaderBody += "\t\t#pragma multi_compile _ALPHAPREMULTIPLY_ON\n"; - - m_additionalSurfaceOptions.WriteToOptionalSurfaceOptions( ref OptionalParameters ); - - AddShaderPragma( ref ShaderBody, "surface surf " + standardCustomLighting + m_currentLightModel.ToString() + customLightSurface + Constants.OptionalParametersSep + OptionalParameters ); - CloseCGProgram( ref ShaderBody ); - - ShaderBody += "\t\tPass\n"; - ShaderBody += "\t\t{\n"; - ShaderBody += "\t\t\tName \"ShadowCaster\"\n"; - ShaderBody += "\t\t\tTags{ \"LightMode\" = \"ShadowCaster\" }\n"; - ShaderBody += "\t\t\tZWrite On\n"; - if( m_alphaToCoverage || m_inlineAlphaToCoverage.Active ) - ShaderBody += "\t\t\tAlphaToMask Off\n"; - ShaderBody += "\t\t\tCGPROGRAM\n"; - ShaderBody += "\t\t\t#pragma vertex vert\n"; - ShaderBody += "\t\t\t#pragma fragment frag\n"; - ShaderBody += "\t\t\t#pragma target " + ShaderModelTypeArr[ m_shaderModelIdx ] + "\n"; - //ShaderBody += "\t\t\t#pragma multi_compile_instancing\n"; - ShaderBody += "\t\t\t#pragma multi_compile_shadowcaster\n"; - ShaderBody += "\t\t\t#pragma multi_compile UNITY_PASS_SHADOWCASTER\n"; - ShaderBody += "\t\t\t#pragma skip_variants FOG_LINEAR FOG_EXP FOG_EXP2\n"; - ShaderBody += "\t\t\t#include \"HLSLSupport.cginc\"\n"; -#if UNITY_2018_3_OR_NEWER - //Preventing WebGL to throw error Duplicate system value semantic definition: input semantic 'SV_POSITION' and input semantic 'VPOS' - ShaderBody += "\t\t\t#if ( SHADER_API_D3D11 || SHADER_API_GLCORE || SHADER_API_GLES || SHADER_API_GLES3 || SHADER_API_METAL || SHADER_API_VULKAN )\n"; -#else - ShaderBody += "\t\t\t#if ( SHADER_API_D3D11 || SHADER_API_GLCORE || SHADER_API_GLES3 || SHADER_API_METAL || SHADER_API_VULKAN )\n"; -#endif - ShaderBody += "\t\t\t\t#define CAN_SKIP_VPOS\n"; - ShaderBody += "\t\t\t#endif\n"; - ShaderBody += "\t\t\t#include \"UnityCG.cginc\"\n"; - ShaderBody += "\t\t\t#include \"Lighting.cginc\"\n"; - ShaderBody += "\t\t\t#include \"UnityPBSLighting.cginc\"\n"; - - if( !( ( m_alphaToCoverage || m_inlineAlphaToCoverage.Active ) && hasOpacity && hasOpacityMask ) ) - if( hasOpacity ) - ShaderBody += "\t\t\tsampler3D _DitherMaskLOD;\n"; - - //ShaderBody += "\t\t\tsampler3D _DitherMaskLOD;\n"; - - ShaderBody += "\t\t\tstruct v2f\n"; - ShaderBody += "\t\t\t{\n"; - ShaderBody += "\t\t\t\tV2F_SHADOW_CASTER;\n"; - int texcoordIndex = 1; - for( int i = 0; i < m_currentDataCollector.PackSlotsList.Count; i++ ) - { - int size = 4 - m_currentDataCollector.PackSlotsList[ i ]; - if( size > 0 ) - { - ShaderBody += "\t\t\t\tfloat" + size + " customPack" + ( i + 1 ) + " : TEXCOORD" + ( i + 1 ) + ";\n"; - } - texcoordIndex++; - } - - if( !m_currentDataCollector.UsingInternalData ) - ShaderBody += "\t\t\t\tfloat3 worldPos : TEXCOORD" + ( texcoordIndex++ ) + ";\n"; - if( m_currentDataCollector.UsingScreenPos ) - ShaderBody += "\t\t\t\tfloat4 screenPos : TEXCOORD" + ( texcoordIndex++ ) + ";\n"; - if( /*m_currentDataCollector.UsingWorldNormal || m_currentDataCollector.UsingWorldPosition ||*/ m_currentDataCollector.UsingInternalData || m_currentDataCollector.DirtyNormal ) - { - ShaderBody += "\t\t\t\tfloat4 tSpace0 : TEXCOORD" + ( texcoordIndex++ ) + ";\n"; - ShaderBody += "\t\t\t\tfloat4 tSpace1 : TEXCOORD" + ( texcoordIndex++ ) + ";\n"; - ShaderBody += "\t\t\t\tfloat4 tSpace2 : TEXCOORD" + ( texcoordIndex++ ) + ";\n"; - } - else if( !m_currentDataCollector.UsingInternalData && m_currentDataCollector.UsingWorldNormal ) - { - ShaderBody += "\t\t\t\tfloat3 worldNormal : TEXCOORD" + ( texcoordIndex++ ) + ";\n"; - } - - if( m_currentDataCollector.UsingVertexColor ) - ShaderBody += "\t\t\t\thalf4 color : COLOR0;\n"; - ShaderBody += "\t\t\t\tUNITY_VERTEX_INPUT_INSTANCE_ID\n"; - ShaderBody += "\t\t\t\tUNITY_VERTEX_OUTPUT_STEREO\n"; - ShaderBody += "\t\t\t};\n"; - - ShaderBody += "\t\t\tv2f vert( " + m_currentDataCollector.CustomAppDataName + " v )\n"; - ShaderBody += "\t\t\t{\n"; - ShaderBody += "\t\t\t\tv2f o;\n"; - - ShaderBody += "\t\t\t\tUNITY_SETUP_INSTANCE_ID( v );\n"; - ShaderBody += "\t\t\t\tUNITY_INITIALIZE_OUTPUT( v2f, o );\n"; - ShaderBody += "\t\t\t\tUNITY_INITIALIZE_VERTEX_OUTPUT_STEREO( o );\n"; - ShaderBody += "\t\t\t\tUNITY_TRANSFER_INSTANCE_ID( v, o );\n"; - - if( m_currentDataCollector.DirtyPerVertexData || m_currentDataCollector.CustomShadowCoordsList.Count > 0 ) - ShaderBody += "\t\t\t\tInput customInputData;\n"; - if( m_currentDataCollector.DirtyPerVertexData ) - { - ShaderBody += "\t\t\t\tvertexDataFunc( v" + ( m_currentDataCollector.TesselationActive ? "" : ", customInputData" ) + " );\n"; - } - - ShaderBody += "\t\t\t\tfloat3 worldPos = mul( unity_ObjectToWorld, v.vertex ).xyz;\n"; - ShaderBody += "\t\t\t\thalf3 worldNormal = UnityObjectToWorldNormal( v.normal );\n"; - if( m_currentDataCollector.UsingInternalData || m_currentDataCollector.DirtyNormal ) - { - ShaderBody += "\t\t\t\thalf3 worldTangent = UnityObjectToWorldDir( v.tangent.xyz );\n"; - ShaderBody += "\t\t\t\thalf tangentSign = v.tangent.w * unity_WorldTransformParams.w;\n"; - ShaderBody += "\t\t\t\thalf3 worldBinormal = cross( worldNormal, worldTangent ) * tangentSign;\n"; - ShaderBody += "\t\t\t\to.tSpace0 = float4( worldTangent.x, worldBinormal.x, worldNormal.x, worldPos.x );\n"; - ShaderBody += "\t\t\t\to.tSpace1 = float4( worldTangent.y, worldBinormal.y, worldNormal.y, worldPos.y );\n"; - ShaderBody += "\t\t\t\to.tSpace2 = float4( worldTangent.z, worldBinormal.z, worldNormal.z, worldPos.z );\n"; - } - else if( !m_currentDataCollector.UsingInternalData && m_currentDataCollector.UsingWorldNormal ) - { - ShaderBody += "\t\t\t\to.worldNormal = worldNormal;\n"; - } - - for( int i = 0; i < m_currentDataCollector.CustomShadowCoordsList.Count; i++ ) - { - int size = UIUtils.GetChannelsAmount( m_currentDataCollector.CustomShadowCoordsList[ i ].DataType ); - string channels = string.Empty; - for( int j = 0; j < size; j++ ) - { - channels += Convert.ToChar( 120 + m_currentDataCollector.CustomShadowCoordsList[ i ].TextureIndex + j ); - } - channels = channels.Replace( '{', 'w' ); - ShaderBody += "\t\t\t\to.customPack" + ( m_currentDataCollector.CustomShadowCoordsList[ i ].TextureSlot + 1 ) + "." + channels + " = customInputData." + m_currentDataCollector.CustomShadowCoordsList[ i ].CoordName + ";\n"; - - //TODO: TEMPORARY SOLUTION, this needs to go somewhere else, there's no need for these comparisons - if( m_currentDataCollector.CustomShadowCoordsList[ i ].CoordName.StartsWith( "uv_" ) ) - { - ShaderBody += "\t\t\t\to.customPack" + ( m_currentDataCollector.CustomShadowCoordsList[ i ].TextureSlot + 1 ) + "." + channels + " = v.texcoord;\n"; - } - else if( m_currentDataCollector.CustomShadowCoordsList[ i ].CoordName.StartsWith( "uv2_" ) ) - { - ShaderBody += "\t\t\t\to.customPack" + ( m_currentDataCollector.CustomShadowCoordsList[ i ].TextureSlot + 1 ) + "." + channels + " = v.texcoord1;\n"; - } - else if( m_currentDataCollector.CustomShadowCoordsList[ i ].CoordName.StartsWith( "uv3_" ) ) - { - ShaderBody += "\t\t\t\to.customPack" + ( m_currentDataCollector.CustomShadowCoordsList[ i ].TextureSlot + 1 ) + "." + channels + " = v.texcoord2;\n"; - } - else if( m_currentDataCollector.CustomShadowCoordsList[ i ].CoordName.StartsWith( "uv4_" ) ) - { - ShaderBody += "\t\t\t\to.customPack" + ( m_currentDataCollector.CustomShadowCoordsList[ i ].TextureSlot + 1 ) + "." + channels + " = v.texcoord3;\n"; - } - } - - if( !m_currentDataCollector.UsingInternalData ) - ShaderBody += "\t\t\t\to.worldPos = worldPos;\n"; - ShaderBody += "\t\t\t\tTRANSFER_SHADOW_CASTER_NORMALOFFSET( o )\n"; - if( m_currentDataCollector.UsingScreenPos ) - ShaderBody += "\t\t\t\to.screenPos = ComputeScreenPos( o.pos );\n"; - if( m_currentDataCollector.UsingVertexColor ) - ShaderBody += "\t\t\t\to.color = v.color;\n"; - ShaderBody += "\t\t\t\treturn o;\n"; - ShaderBody += "\t\t\t}\n"; - - ShaderBody += "\t\t\thalf4 frag( v2f IN\n"; - ShaderBody += "\t\t\t#if !defined( CAN_SKIP_VPOS )\n"; - ShaderBody += "\t\t\t, UNITY_VPOS_TYPE vpos : VPOS\n"; - ShaderBody += "\t\t\t#endif\n"; - ShaderBody += "\t\t\t) : SV_Target\n"; - ShaderBody += "\t\t\t{\n"; - ShaderBody += "\t\t\t\tUNITY_SETUP_INSTANCE_ID( IN );\n"; - ShaderBody += "\t\t\t\tInput surfIN;\n"; - ShaderBody += "\t\t\t\tUNITY_INITIALIZE_OUTPUT( Input, surfIN );\n"; - - for( int i = 0; i < m_currentDataCollector.CustomShadowCoordsList.Count; i++ ) - { - int size = UIUtils.GetChannelsAmount( m_currentDataCollector.CustomShadowCoordsList[ i ].DataType ); - string channels = string.Empty; - for( int j = 0; j < size; j++ ) - { - channels += Convert.ToChar( 120 + m_currentDataCollector.CustomShadowCoordsList[ i ].TextureIndex + j ); - } - channels = channels.Replace( '{', 'w' ); - ShaderBody += "\t\t\t\tsurfIN." + m_currentDataCollector.CustomShadowCoordsList[ i ].CoordName + " = IN.customPack" + ( m_currentDataCollector.CustomShadowCoordsList[ i ].TextureSlot + 1 ) + "." + channels + ";\n"; - } - - if( m_currentDataCollector.UsingInternalData ) - ShaderBody += "\t\t\t\tfloat3 worldPos = float3( IN.tSpace0.w, IN.tSpace1.w, IN.tSpace2.w );\n"; - else - ShaderBody += "\t\t\t\tfloat3 worldPos = IN.worldPos;\n"; - ShaderBody += "\t\t\t\thalf3 worldViewDir = normalize( UnityWorldSpaceViewDir( worldPos ) );\n"; - - if( m_currentDataCollector.UsingViewDirection && !m_currentDataCollector.DirtyNormal ) - ShaderBody += "\t\t\t\tsurfIN.viewDir = worldViewDir;\n"; - else if( m_currentDataCollector.UsingViewDirection ) - ShaderBody += "\t\t\t\tsurfIN.viewDir = IN.tSpace0.xyz * worldViewDir.x + IN.tSpace1.xyz * worldViewDir.y + IN.tSpace2.xyz * worldViewDir.z;\n"; - - if( m_currentDataCollector.UsingWorldPosition ) - ShaderBody += "\t\t\t\tsurfIN.worldPos = worldPos;\n"; - - if( m_currentDataCollector.UsingWorldNormal && m_currentDataCollector.UsingInternalData ) - ShaderBody += "\t\t\t\tsurfIN.worldNormal = float3( IN.tSpace0.z, IN.tSpace1.z, IN.tSpace2.z );\n"; - else if( !m_currentDataCollector.UsingInternalData && m_currentDataCollector.UsingWorldNormal ) - ShaderBody += "\t\t\t\tsurfIN.worldNormal = IN.worldNormal;\n"; - - if( m_currentDataCollector.UsingWorldReflection ) - ShaderBody += "\t\t\t\tsurfIN.worldRefl = -worldViewDir;\n"; - - if( m_currentDataCollector.UsingInternalData ) - { - ShaderBody += "\t\t\t\tsurfIN.internalSurfaceTtoW0 = IN.tSpace0.xyz;\n"; - ShaderBody += "\t\t\t\tsurfIN.internalSurfaceTtoW1 = IN.tSpace1.xyz;\n"; - ShaderBody += "\t\t\t\tsurfIN.internalSurfaceTtoW2 = IN.tSpace2.xyz;\n"; - } - - if( m_currentDataCollector.UsingScreenPos ) - ShaderBody += "\t\t\t\tsurfIN.screenPos = IN.screenPos;\n"; - - if( m_currentDataCollector.UsingVertexColor ) - ShaderBody += "\t\t\t\tsurfIN.vertexColor = IN.color;\n"; - - ShaderBody += "\t\t\t\t" + outputStruct + " o;\n"; - ShaderBody += "\t\t\t\tUNITY_INITIALIZE_OUTPUT( " + outputStruct + ", o )\n"; - ShaderBody += "\t\t\t\tsurf( surfIN, o );\n"; - if( ( hasOpacity || hasOpacityMask ) && m_currentLightModel == StandardShaderLightModel.CustomLighting ) - { - ShaderBody += "\t\t\t\tUnityGI gi;\n"; - ShaderBody += "\t\t\t\tUNITY_INITIALIZE_OUTPUT( UnityGI, gi );\n"; - ShaderBody += "\t\t\t\to.Alpha = LightingStandardCustomLighting( o, worldViewDir, gi ).a;\n"; - } - ShaderBody += "\t\t\t\t#if defined( CAN_SKIP_VPOS )\n"; - ShaderBody += "\t\t\t\tfloat2 vpos = IN.pos;\n"; - ShaderBody += "\t\t\t\t#endif\n"; - - /*if( ( ( m_alphaToCoverage || m_inlineAlphaToCoverage.Active ) && hasOpacity && m_inputPorts[ m_discardPortId ].IsConnected ) ) - { - - } - else*/ if(!( ( m_alphaToCoverage || m_inlineAlphaToCoverage.Active ) && hasOpacity && m_inputPorts[ m_discardPortId ].IsConnected ) && hasOpacity ) - { - ShaderBody += "\t\t\t\thalf alphaRef = tex3D( _DitherMaskLOD, float3( vpos.xy * 0.25, o.Alpha * 0.9375 ) ).a;\n"; - ShaderBody += "\t\t\t\tclip( alphaRef - 0.01 );\n"; - } - - ShaderBody += "\t\t\t\tSHADOW_CASTER_FRAGMENT( IN )\n"; - ShaderBody += "\t\t\t}\n"; - - ShaderBody += "\t\t\tENDCG\n"; - - ShaderBody += "\t\t}\n"; - } - - } - - if( !string.IsNullOrEmpty( bellowUsePasses ) ) - { - ShaderBody += bellowUsePasses; - } - - CloseSubShaderBody( ref ShaderBody ); - - if( m_dependenciesHelper.HasDependencies ) - { - ShaderBody += m_dependenciesHelper.GenerateDependencies(); - } - - if( m_fallbackHelper.Active ) - { - ShaderBody += m_fallbackHelper.TabbedFallbackShader; - } - else if( m_castShadows || m_receiveShadows ) - { - AddShaderProperty( ref ShaderBody, "Fallback", "Diffuse" ); - } - - if( !string.IsNullOrEmpty( m_customInspectorName ) ) - { - AddShaderProperty( ref ShaderBody, "CustomEditor", m_customInspectorName ); - } - } - CloseShaderBody( ref ShaderBody ); - - if( usingDebugPort ) - { - m_currentLightModel = cachedLightModel; - ContainerGraph.CurrentCanvasMode = cachedAvailability; - } - - // Generate Graph info - ShaderBody += ContainerGraph.ParentWindow.GenerateGraphInfo(); - - //TODO: Remove current SaveDebugShader and uncomment SaveToDisk as soon as pathname is editable - if( !String.IsNullOrEmpty( pathname ) ) - { - IOUtils.StartSaveThread( ShaderBody, ( isFullPath ? pathname : ( IOUtils.dataPath + pathname ) ) ); - } - else - { - IOUtils.StartSaveThread( ShaderBody, Application.dataPath + "/AmplifyShaderEditor/Samples/Shaders/" + m_shaderName + ".shader" ); - } - - // Load new shader into material - - if( CurrentShader == null ) - { - AssetDatabase.Refresh( ImportAssetOptions.ForceUpdate ); - CurrentShader = Shader.Find( ShaderName ); - } - //else - //{ - // // need to always get asset datapath because a user can change and asset location from the project window - // AssetDatabase.ImportAsset( AssetDatabase.GetAssetPath( m_currentShader ) ); - // //ShaderUtil.UpdateShaderAsset( m_currentShader, ShaderBody ); - //} - - if( m_currentShader != null ) - { - m_currentDataCollector.UpdateShaderImporter( ref m_currentShader ); - if( m_currentMaterial != null ) - { - if( m_currentShader != m_currentMaterial.shader ) - m_currentMaterial.shader = m_currentShader; -#if UNITY_5_6_OR_NEWER - if ( isInstancedShader ) - { - m_currentMaterial.enableInstancing = true; - } -#endif - m_currentDataCollector.UpdateMaterialOnPropertyNodes( m_currentMaterial ); - UpdateMaterialEditor(); - // need to always get asset datapath because a user can change and asset location from the project window - //AssetDatabase.ImportAsset( AssetDatabase.GetAssetPath( m_currentMaterial ) ); - } - } - - m_currentDataCollector.Destroy(); - m_currentDataCollector = null; - - return m_currentShader; - } - - public override void UpdateFromShader( Shader newShader ) - { - if( m_currentMaterial != null && m_currentMaterial.shader != newShader ) - { - m_currentMaterial.shader = newShader; - } - CurrentShader = newShader; - } - - public override void Destroy() - { - base.Destroy(); - - if( m_dummyProperty != null ) - { - m_dummyProperty.Destroy(); - GameObject.DestroyImmediate( m_dummyProperty ); - m_dummyProperty = null; - } - - m_drawInstancedHelper = null; - - m_translucencyPort = null; - m_transmissionPort = null; - m_refractionPort = null; - m_normalPort = null; - - m_renderingOptionsOpHelper.Destroy(); - m_renderingOptionsOpHelper = null; - - m_additionalIncludes.Destroy(); - m_additionalIncludes = null; - - m_additionalPragmas.Destroy(); - m_additionalPragmas = null; - - m_additionalDefines.Destroy(); - m_additionalDefines = null; - - m_additionalSurfaceOptions.Destroy(); - m_additionalSurfaceOptions = null; - - m_additionalDirectives.Destroy(); - m_additionalDirectives = null; - - m_customTagsHelper.Destroy(); - m_customTagsHelper = null; - - m_dependenciesHelper.Destroy(); - m_dependenciesHelper = null; - - m_renderingPlatformOpHelper = null; - m_inspectorDefaultStyle = null; - m_inspectorFoldoutStyle = null; - - m_zBufferHelper = null; - m_stencilBufferHelper = null; - m_blendOpsHelper = null; - m_tessOpHelper.Destroy(); - m_tessOpHelper = null; - m_outlineHelper.Destroy(); - m_outlineHelper = null; - m_colorMaskHelper.Destroy(); - m_colorMaskHelper = null; - m_billboardOpHelper = null; - - m_fallbackHelper.Destroy(); - GameObject.DestroyImmediate( m_fallbackHelper ); - m_fallbackHelper = null; - - m_usePass.Destroy(); - GameObject.DestroyImmediate( m_usePass ); - m_usePass = null; - } - - public override int VersionConvertInputPortId( int portId ) - { - int newPort = portId; - - //added translucency input after occlusion - if( UIUtils.CurrentShaderVersion() <= 2404 ) - { - switch( m_currentLightModel ) - { - case StandardShaderLightModel.Standard: - case StandardShaderLightModel.StandardSpecular: - if( portId >= 6 ) - newPort += 1; - break; - case StandardShaderLightModel.CustomLighting: - case StandardShaderLightModel.Unlit: - case StandardShaderLightModel.Lambert: - case StandardShaderLightModel.BlinnPhong: - if( portId >= 5 ) - newPort += 1; - break; - } - } - - portId = newPort; - - //added transmission input after occlusion - if( UIUtils.CurrentShaderVersion() < 2407 ) - { - switch( m_currentLightModel ) - { - case StandardShaderLightModel.Standard: - case StandardShaderLightModel.StandardSpecular: - if( portId >= 6 ) - newPort += 1; - break; - case StandardShaderLightModel.CustomLighting: - case StandardShaderLightModel.Unlit: - case StandardShaderLightModel.Lambert: - case StandardShaderLightModel.BlinnPhong: - if( portId >= 5 ) - newPort += 1; - break; - } - } - - portId = newPort; - - //added tessellation ports - if( UIUtils.CurrentShaderVersion() < 3002 ) - { - switch( m_currentLightModel ) - { - case StandardShaderLightModel.Standard: - case StandardShaderLightModel.StandardSpecular: - if( portId >= 13 ) - newPort += 1; - break; - case StandardShaderLightModel.CustomLighting: - case StandardShaderLightModel.Unlit: - case StandardShaderLightModel.Lambert: - case StandardShaderLightModel.BlinnPhong: - if( portId >= 10 ) - newPort += 1; - break; - } - } - - portId = newPort; - - //added refraction after translucency - if( UIUtils.CurrentShaderVersion() < 3204 ) - { - switch( m_currentLightModel ) - { - case StandardShaderLightModel.Standard: - case StandardShaderLightModel.StandardSpecular: - if( portId >= 8 ) - newPort += 1; - break; - case StandardShaderLightModel.CustomLighting: - case StandardShaderLightModel.Unlit: - case StandardShaderLightModel.Lambert: - case StandardShaderLightModel.BlinnPhong: - if( portId >= 7 ) - newPort += 1; - break; - } - } - - portId = newPort; - - //removed custom lighting port - //if ( UIUtils.CurrentShaderVersion() < 10003 ) //runs everytime because this system is only used after 5000 version - { - switch( m_currentLightModel ) - { - case StandardShaderLightModel.Standard: - case StandardShaderLightModel.StandardSpecular: - if( portId >= 13 ) - newPort -= 1; - break; - case StandardShaderLightModel.CustomLighting: - case StandardShaderLightModel.Unlit: - case StandardShaderLightModel.Lambert: - case StandardShaderLightModel.BlinnPhong: - if( portId >= 12 ) - newPort -= 1; - break; - } - } - - portId = newPort; - - //if( UIUtils.CurrentShaderVersion() < 13802 ) //runs everytime because this system is only used after 5000 version - { - switch( m_currentLightModel ) - { - case StandardShaderLightModel.Standard: - case StandardShaderLightModel.StandardSpecular: - if( portId >= 11 ) - newPort += 1; - break; - case StandardShaderLightModel.CustomLighting: - case StandardShaderLightModel.Unlit: - case StandardShaderLightModel.Lambert: - case StandardShaderLightModel.BlinnPhong: - if( portId >= 10 ) - newPort += 1; - break; - } - } - - portId = newPort; - return newPort; - } - - public override void ReadFromString( ref string[] nodeParams ) - { - try - { - base.ReadFromString( ref nodeParams ); - m_currentLightModel = (StandardShaderLightModel)Enum.Parse( typeof( StandardShaderLightModel ), GetCurrentParam( ref nodeParams ) ); - - if( CurrentMasterNodeCategory == AvailableShaderTypes.SurfaceShader && m_currentLightModel == StandardShaderLightModel.CustomLighting ) - { - ContainerGraph.CurrentCanvasMode = NodeAvailability.CustomLighting; - ContainerGraph.ParentWindow.CurrentNodeAvailability = NodeAvailability.CustomLighting; - } - else if( CurrentMasterNodeCategory == AvailableShaderTypes.SurfaceShader ) - { - ContainerGraph.CurrentCanvasMode = NodeAvailability.SurfaceShader; - ContainerGraph.ParentWindow.CurrentNodeAvailability = NodeAvailability.SurfaceShader; - } - //if ( _shaderCategory.Length > 0 ) - // _shaderCategory = UIUtils.RemoveInvalidCharacters( _shaderCategory ); - ShaderName = GetCurrentParam( ref nodeParams ); - if( m_shaderName.Length > 0 ) - ShaderName = UIUtils.RemoveShaderInvalidCharacters( ShaderName ); - - m_renderingOptionsOpHelper.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); - - m_cullMode = (CullMode)Enum.Parse( typeof( CullMode ), GetCurrentParam( ref nodeParams ) ); - m_zBufferHelper.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); - - string alphaMode = GetCurrentParam( ref nodeParams ); - - if( UIUtils.CurrentShaderVersion() < 4003 ) - { - if( alphaMode.Equals( "Fade" ) ) - { - alphaMode = "Transparent"; - } - else if( alphaMode.Equals( "Transparent" ) ) - { - alphaMode = "Premultiply"; - } - } - - m_alphaMode = (AlphaMode)Enum.Parse( typeof( AlphaMode ), alphaMode ); - m_opacityMaskClipValue = Convert.ToSingle( GetCurrentParam( ref nodeParams ) ); - m_keepAlpha = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - m_keepAlpha = true; - m_castShadows = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - m_queueOrder = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - if( UIUtils.CurrentShaderVersion() > 11 ) - { - m_customBlendMode = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - m_renderType = (RenderType)Enum.Parse( typeof( RenderType ), GetCurrentParam( ref nodeParams ) ); - if( UIUtils.CurrentShaderVersion() > 14305 ) - { - m_customRenderType = GetCurrentParam( ref nodeParams ); - } - m_renderQueue = (RenderQueue)Enum.Parse( typeof( RenderQueue ), GetCurrentParam( ref nodeParams ) ); - } - if( UIUtils.CurrentShaderVersion() > 2402 ) - { - m_renderPath = (RenderPath)Enum.Parse( typeof( RenderPath ), GetCurrentParam( ref nodeParams ) ); - } - if( UIUtils.CurrentShaderVersion() > 2405 ) - { - m_renderingPlatformOpHelper.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); - } - - if( UIUtils.CurrentShaderVersion() > 2500 ) - { - m_colorMaskHelper.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); - } - - if( UIUtils.CurrentShaderVersion() > 2501 ) - { - m_stencilBufferHelper.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); - } - - if( UIUtils.CurrentShaderVersion() > 2504 ) - { - m_tessOpHelper.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); - } - - if( UIUtils.CurrentShaderVersion() > 2505 ) - { - m_receiveShadows = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - } - - if( UIUtils.CurrentShaderVersion() > 3202 ) - { - m_blendOpsHelper.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); - } - - if( UIUtils.CurrentShaderVersion() > 3203 ) - { - m_grabOrder = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - } - - if( UIUtils.CurrentShaderVersion() > 5003 ) - { - m_outlineHelper.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); - } - - if( UIUtils.CurrentShaderVersion() > 5110 ) - { - m_billboardOpHelper.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); - } - - if( UIUtils.CurrentShaderVersion() > 6101 ) - { - m_vertexMode = (VertexMode)Enum.Parse( typeof( VertexMode ), GetCurrentParam( ref nodeParams ) ); - } - - if( UIUtils.CurrentShaderVersion() > 6102 ) - { - ShaderLOD = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - m_fallbackHelper.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); - } - - if( UIUtils.CurrentShaderVersion() > 7102 ) - { - m_maskClipOrderIndex = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - m_translucencyOrderIndex = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - m_refractionOrderIndex = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - m_tessellationOrderIndex = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - } - - if( UIUtils.CurrentShaderVersion() > 10010 && UIUtils.CurrentShaderVersion() < 15312 ) - { - m_additionalIncludes.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); - } - - if( UIUtils.CurrentShaderVersion() > 11006 ) - { - m_customTagsHelper.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); - } - - if( UIUtils.CurrentShaderVersion() > 13102 && UIUtils.CurrentShaderVersion() < 15312 ) - { - m_additionalPragmas.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); - } - - if( UIUtils.CurrentShaderVersion() > 13205 ) - { - m_alphaToCoverage = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - } - - if( UIUtils.CurrentShaderVersion() > 13903 ) - { - m_dependenciesHelper.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); - } - - if( UIUtils.CurrentShaderVersion() > 14005 && UIUtils.CurrentShaderVersion() < 15312 ) - { - m_additionalDefines.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); - } - - if( UIUtils.CurrentShaderVersion() > 14501 ) - { - m_inlineCullMode.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); - } - - if( UIUtils.CurrentShaderVersion() > 14502 ) - { - m_specColorOrderIndex = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - } - - if( UIUtils.CurrentShaderVersion() > 15204 ) - { - m_inlineOpacityMaskClipValue.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); - } - - if( UIUtils.CurrentShaderVersion() > 15311 ) - { - m_additionalDirectives.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); - m_additionalSurfaceOptions.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); - } - else - { - m_additionalDirectives.AddItems( AdditionalLineType.Define, m_additionalDefines.DefineList ); - m_additionalDirectives.AddItems( AdditionalLineType.Include, m_additionalIncludes.IncludeList ); - m_additionalDirectives.AddItems( AdditionalLineType.Pragma, m_additionalPragmas.PragmaList ); - } - - if( UIUtils.CurrentShaderVersion() > 15402 ) - { - m_usePass.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); - } - - if( UIUtils.CurrentShaderVersion() > 16203 ) - { - m_drawInstancedHelper.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); - } - - if( UIUtils.CurrentShaderVersion() > 16204 ) - m_inlineChromaticAberration.ReadFromString( ref m_currentReadParamIdx, ref nodeParams , false ); - - if( UIUtils.CurrentShaderVersion() > 16207 ) - m_inlineAlphaToCoverage.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); - - m_lightModelChanged = true; - m_lastLightModel = m_currentLightModel; - DeleteAllInputConnections( true ); - AddMasterPorts(); - UpdateFromBlendMode(); - m_customBlendMode = TestCustomBlendMode(); - - ContainerGraph.CurrentPrecision = m_currentPrecisionType; - } - catch( Exception e ) - { - Debug.Log( e ); - } - } - - public override void RefreshExternalReferences() - { - base.RefreshExternalReferences(); - - // change port connection from emission to the new custom lighting port - if( m_currentLightModel == StandardShaderLightModel.CustomLighting && m_inputPorts[ m_emissionPortId ].IsConnected && UIUtils.CurrentShaderVersion() < 13802 ) - { - OutputPort port = m_inputPorts[ m_emissionPortId ].GetOutputConnection( 0 ); - m_inputPorts[ m_emissionPortId ].FullDeleteConnections(); - UIUtils.SetConnection( m_inputPorts[ m_customLightingPortId ].NodeId, m_inputPorts[ m_customLightingPortId ].PortId, port.NodeId, port.PortId ); - } - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_currentLightModel ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_shaderName ); - m_renderingOptionsOpHelper.WriteToString( ref nodeInfo ); - - IOUtils.AddFieldValueToString( ref nodeInfo, m_cullMode ); - m_zBufferHelper.WriteToString( ref nodeInfo ); - - IOUtils.AddFieldValueToString( ref nodeInfo, m_alphaMode ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_opacityMaskClipValue ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_keepAlpha ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_castShadows ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_queueOrder ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_customBlendMode ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_renderType ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_customRenderType ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_renderQueue ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_renderPath ); - m_renderingPlatformOpHelper.WriteToString( ref nodeInfo ); - m_colorMaskHelper.WriteToString( ref nodeInfo ); - m_stencilBufferHelper.WriteToString( ref nodeInfo ); - m_tessOpHelper.WriteToString( ref nodeInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_receiveShadows ); - m_blendOpsHelper.WriteToString( ref nodeInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_grabOrder ); - m_outlineHelper.WriteToString( ref nodeInfo ); - m_billboardOpHelper.WriteToString( ref nodeInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_vertexMode ); - IOUtils.AddFieldValueToString( ref nodeInfo, ShaderLOD ); - m_fallbackHelper.WriteToString( ref nodeInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, ( m_maskClipReorder != null ) ? m_maskClipReorder.OrderIndex : -1 ); - IOUtils.AddFieldValueToString( ref nodeInfo, ( m_translucencyReorder != null ) ? m_translucencyReorder.OrderIndex : -1 ); - IOUtils.AddFieldValueToString( ref nodeInfo, ( m_refractionReorder != null ) ? m_refractionReorder.OrderIndex : -1 ); - IOUtils.AddFieldValueToString( ref nodeInfo, ( m_tessellationReorder != null ) ? m_tessellationReorder.OrderIndex : -1 ); - //m_additionalIncludes.WriteToString( ref nodeInfo ); - m_customTagsHelper.WriteToString( ref nodeInfo ); - //m_additionalPragmas.WriteToString( ref nodeInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_alphaToCoverage ); - m_dependenciesHelper.WriteToString( ref nodeInfo ); - //m_additionalDefines.WriteToString( ref nodeInfo ); - m_inlineCullMode.WriteToString( ref nodeInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, ( m_specColorReorder != null ) ? m_specColorReorder.OrderIndex : -1 ); - m_inlineOpacityMaskClipValue.WriteToString( ref nodeInfo ); - m_additionalDirectives.WriteToString( ref nodeInfo ); - m_additionalSurfaceOptions.WriteToString( ref nodeInfo ); - m_usePass.WriteToString( ref nodeInfo ); - m_drawInstancedHelper.WriteToString( ref nodeInfo ); - m_inlineChromaticAberration.WriteToString( ref nodeInfo ); - m_inlineAlphaToCoverage.WriteToString( ref nodeInfo ); - } - - private bool TestCustomBlendMode() - { - switch( m_alphaMode ) - { - case AlphaMode.Opaque: - { - if( m_renderType == RenderType.Opaque && m_renderQueue == RenderQueue.Geometry ) - return false; - } - break; - case AlphaMode.Masked: - { - if( m_renderType == RenderType.TransparentCutout && m_renderQueue == RenderQueue.AlphaTest ) - return false; - } - break; - case AlphaMode.Transparent: - case AlphaMode.Premultiply: - { - if( m_renderType == RenderType.Transparent && m_renderQueue == RenderQueue.Transparent ) - return false; - } - break; - case AlphaMode.Translucent: - { - if( m_renderType == RenderType.Opaque && m_renderQueue == RenderQueue.Transparent ) - return false; - } - break; - } - return true; - } - - private void UpdateFromBlendMode() - { - m_checkChanges = true; - bool lockRefractionPort = false; - if( m_currentLightModel == StandardShaderLightModel.Unlit || m_currentLightModel == StandardShaderLightModel.CustomLighting ) - { - lockRefractionPort = true; - } - - switch( m_alphaMode ) - { - case AlphaMode.Opaque: - { - m_renderType = RenderType.Opaque; - m_renderQueue = RenderQueue.Geometry; - m_keepAlpha = true; - m_refractionPort.Locked = true; - m_inputPorts[ m_opacityPortId ].Locked = true; - m_inputPorts[ m_discardPortId ].Locked = true; - } - break; - case AlphaMode.Masked: - { - m_renderType = RenderType.TransparentCutout; - m_renderQueue = RenderQueue.AlphaTest; - m_keepAlpha = true; - m_refractionPort.Locked = true; - m_inputPorts[ m_opacityPortId ].Locked = true; - m_inputPorts[ m_discardPortId ].Locked = false; - } - break; - case AlphaMode.Transparent: - case AlphaMode.Premultiply: - { - m_renderType = RenderType.Transparent; - m_renderQueue = RenderQueue.Transparent; - m_refractionPort.Locked = false || lockRefractionPort; - m_inputPorts[ m_opacityPortId ].Locked = false; - m_inputPorts[ m_discardPortId ].Locked = true; - } - break; - case AlphaMode.Translucent: - { - m_renderType = RenderType.Opaque; - m_renderQueue = RenderQueue.Transparent; - m_refractionPort.Locked = false || lockRefractionPort; - m_inputPorts[ m_opacityPortId ].Locked = false; - m_inputPorts[ m_discardPortId ].Locked = true; - } - break; - case AlphaMode.Custom: - { - m_refractionPort.Locked = false || lockRefractionPort; - m_inputPorts[ m_opacityPortId ].Locked = false; - m_inputPorts[ m_discardPortId ].Locked = false; - } - break; - } - - m_blendOpsHelper.SetBlendOpsFromBlendMode( m_alphaMode, ( m_alphaMode == AlphaMode.Custom || m_alphaMode == AlphaMode.Opaque ) ); - } - - public bool CastShadows { get { return m_castShadows; } } - public StandardShaderLightModel CurrentLightingModel { get { return m_currentLightModel; } } - public CullMode CurrentCullMode { get { return m_cullMode; } } - //public AdditionalIncludesHelper AdditionalIncludes { get { return m_additionalIncludes; } set { m_additionalIncludes = value; } } - //public AdditionalPragmasHelper AdditionalPragmas { get { return m_additionalPragmas; } set { m_additionalPragmas = value; } } - //public AdditionalDefinesHelper AdditionalDefines { get { return m_additionalDefines; } set { m_additionalDefines = value; } } - public TemplateAdditionalDirectivesHelper AdditionalDirectives { get { return m_additionalDirectives; } } - public OutlineOpHelper OutlineHelper { get { return m_outlineHelper; } } - public float OpacityMaskClipValue { get { return m_opacityMaskClipValue; } } - public InlineProperty InlineOpacityMaskClipValue { get { return m_inlineOpacityMaskClipValue; } set { m_inlineOpacityMaskClipValue = value; } } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/StandardSurface.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/StandardSurface.cs.meta deleted file mode 100644 index 0515f8ca..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/StandardSurface.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 59e61f9559385a94a87d4d37dbd556f0 -timeCreated: 1481126956 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/StencilBufferOpHelper.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/StencilBufferOpHelper.cs deleted file mode 100644 index b613f0f1..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/StencilBufferOpHelper.cs +++ /dev/null @@ -1,304 +0,0 @@ -using System; -using UnityEngine; -using UnityEditor; -using System.Collections.Generic; - -namespace AmplifyShaderEditor -{ - - [Serializable] - public class StencilBufferOpHelper - { - public static readonly string[] StencilComparisonValues = - { - "<Default>", - "Greater" , - "GEqual" , - "Less" , - "LEqual" , - "Equal" , - "NotEqual" , - "Always" , - "Never" - }; - - public static readonly Dictionary<string,int> StencilComparisonValuesDict = new Dictionary<string, int>() - { - {"Greater" , 1}, - {"GEqual" , 2}, - {"Less" , 3}, - {"LEqual" , 4}, - {"Equal" , 5}, - {"NotEqual", 6}, - {"Always" , 7}, - {"Never" , 8}, - }; - - public static readonly string[] StencilComparisonLabels = - { - "<Default>", - "Greater" , - "Greater or Equal" , - "Less" , - "Less or Equal" , - "Equal" , - "Not Equal" , - "Always" , - "Never" - }; - - - public static readonly string[] StencilOpsValues = - { - "<Default>", - "Keep", - "Zero", - "Replace", - "IncrSat", - "DecrSat", - "Invert", - "IncrWrap", - "DecrWrap" - }; - - public static readonly Dictionary<string,int> StencilOpsValuesDict = new Dictionary<string, int>() - { - {"Keep", 1}, - {"Zero", 2}, - {"Replace", 3}, - {"IncrSat", 4}, - {"DecrSat", 5}, - {"Invert", 6}, - {"IncrWrap",7}, - {"DecrWrap",8}, - }; - - public static readonly string[] StencilOpsLabels = - { - "<Default>", - "Keep", - "Zero", - "Replace", - "IncrSat", - "DecrSat", - "Invert", - "IncrWrap", - "DecrWrap" - }; - - - private const string FoldoutLabelStr = " Stencil Buffer"; - private GUIContent ReferenceValueContent = new GUIContent( "Reference", "The value to be compared against (if Comparison is anything else than always) and/or the value to be written to the buffer (if either Pass, Fail or ZFail is set to replace)" ); - private GUIContent ReadMaskContent = new GUIContent( "Read Mask", "An 8 bit mask as an 0-255 integer, used when comparing the reference value with the contents of the buffer (referenceValue & readMask) comparisonFunction (stencilBufferValue & readMask)" ); - private GUIContent WriteMaskContent = new GUIContent( "Write Mask", "An 8 bit mask as an 0-255 integer, used when writing to the buffer" ); - private const string ComparisonStr = "Comparison"; - private const string PassStr = "Pass"; - private const string FailStr = "Fail"; - private const string ZFailStr = "ZFail"; - - private const string ComparisonFrontStr = "Comp. Front"; - private const string PassFrontStr = "Pass Front"; - private const string FailFrontStr = "Fail Front"; - private const string ZFailFrontStr = "ZFail Front"; - - private const string ComparisonBackStr = "Comp. Back"; - private const string PassBackStr = "Pass Back"; - private const string FailBackStr = "Fail Back"; - private const string ZFailBackStr = "ZFail Back"; - - private const int ReadMaskDefaultValue = 255; - private const int WriteMaskDefaultValue = 255; - private const int ComparisonDefaultValue = 0; - private const int PassStencilOpDefaultValue = 0; - private const int FailStencilOpDefaultValue = 0; - private const int ZFailStencilOpDefaultValue = 0; - - [SerializeField] - private bool m_active; - - [SerializeField] - private InlineProperty m_refValue = new InlineProperty(); - [SerializeField] - private InlineProperty m_readMask = new InlineProperty( ReadMaskDefaultValue ); - [SerializeField] - private InlineProperty m_writeMask = new InlineProperty( WriteMaskDefaultValue ); - - //Comparison Function - [SerializeField] - private InlineProperty m_comparisonFunctionIdx = new InlineProperty( ComparisonDefaultValue ); - [SerializeField] - private InlineProperty m_comparisonFunctionBackIdx = new InlineProperty( ComparisonDefaultValue ); - - //Pass Stencil Op - [SerializeField] - private InlineProperty m_passStencilOpIdx = new InlineProperty( PassStencilOpDefaultValue ); - [SerializeField] - private InlineProperty m_passStencilOpBackIdx = new InlineProperty( PassStencilOpDefaultValue ); - - //Fail Stencil Op - [SerializeField] - private InlineProperty m_failStencilOpIdx = new InlineProperty( FailStencilOpDefaultValue ); - [SerializeField] - private InlineProperty m_failStencilOpBackIdx = new InlineProperty( FailStencilOpDefaultValue ); - - //ZFail Stencil Op - [SerializeField] - private InlineProperty m_zFailStencilOpIdx = new InlineProperty( ZFailStencilOpDefaultValue ); - [SerializeField] - private InlineProperty m_zFailStencilOpBackIdx = new InlineProperty( ZFailStencilOpDefaultValue ); - - public string CreateStencilOp( UndoParentNode owner ) - { - string result = "\t\tStencil\n\t\t{\n"; - result += string.Format( "\t\t\tRef {0}\n", m_refValue.GetValueOrProperty() ); - if( m_readMask.Active || m_readMask.IntValue != ReadMaskDefaultValue ) - { - result += string.Format( "\t\t\tReadMask {0}\n", m_readMask.GetValueOrProperty() ); - } - - if( m_writeMask.Active || m_writeMask.IntValue != WriteMaskDefaultValue ) - { - result += string.Format( "\t\t\tWriteMask {0}\n", m_writeMask.GetValueOrProperty() ); - } - - if( ( owner as StandardSurfaceOutputNode ).CurrentCullMode == CullMode.Off ) - { - if( m_comparisonFunctionIdx.IntValue != ComparisonDefaultValue || m_comparisonFunctionIdx.Active ) - result += string.Format( "\t\t\tCompFront {0}\n", m_comparisonFunctionIdx.GetValueOrProperty( StencilComparisonValues[ m_comparisonFunctionIdx.IntValue ] ) ); - if( m_passStencilOpIdx.IntValue != PassStencilOpDefaultValue || m_passStencilOpIdx.Active ) - result += string.Format( "\t\t\tPassFront {0}\n", m_passStencilOpIdx.GetValueOrProperty( StencilOpsValues[ m_passStencilOpIdx.IntValue ] ) ); - if( m_failStencilOpIdx.IntValue != FailStencilOpDefaultValue || m_failStencilOpIdx.Active ) - result += string.Format( "\t\t\tFailFront {0}\n", m_failStencilOpIdx.GetValueOrProperty( StencilOpsValues[ m_failStencilOpIdx.IntValue ] ) ); - if( m_zFailStencilOpIdx.IntValue != ZFailStencilOpDefaultValue || m_zFailStencilOpIdx.Active ) - result += string.Format( "\t\t\tZFailFront {0}\n", m_zFailStencilOpIdx.GetValueOrProperty( StencilOpsValues[ m_zFailStencilOpIdx.IntValue ] ) ); - - if( m_comparisonFunctionBackIdx.IntValue != ComparisonDefaultValue || m_comparisonFunctionBackIdx.Active ) - result += string.Format( "\t\t\tCompBack {0}\n", m_comparisonFunctionBackIdx.GetValueOrProperty( StencilComparisonValues[ m_comparisonFunctionBackIdx.IntValue ] ) ); - if( m_passStencilOpBackIdx.IntValue != PassStencilOpDefaultValue || m_passStencilOpBackIdx.Active ) - result += string.Format( "\t\t\tPassBack {0}\n", m_passStencilOpBackIdx.GetValueOrProperty( StencilOpsValues[ m_passStencilOpBackIdx.IntValue ] ) ); - if( m_failStencilOpBackIdx.IntValue != FailStencilOpDefaultValue || m_failStencilOpBackIdx.Active ) - result += string.Format( "\t\t\tFailBack {0}\n", m_failStencilOpBackIdx.GetValueOrProperty( StencilOpsValues[ m_failStencilOpBackIdx.IntValue ] ) ); - if( m_zFailStencilOpBackIdx.IntValue != ZFailStencilOpDefaultValue || m_zFailStencilOpBackIdx.Active ) - result += string.Format( "\t\t\tZFailBack {0}\n", m_zFailStencilOpBackIdx.GetValueOrProperty( StencilOpsValues[ m_zFailStencilOpBackIdx.IntValue ] ) ); - } - else - { - if( m_comparisonFunctionIdx.IntValue != ComparisonDefaultValue || m_comparisonFunctionIdx.Active ) - result += string.Format( "\t\t\tComp {0}\n", m_comparisonFunctionIdx.GetValueOrProperty( StencilComparisonValues[ m_comparisonFunctionIdx.IntValue ] ) ); - if( m_passStencilOpIdx.IntValue != PassStencilOpDefaultValue || m_passStencilOpIdx.Active ) - result += string.Format( "\t\t\tPass {0}\n", m_passStencilOpIdx.GetValueOrProperty( StencilOpsValues[ m_passStencilOpIdx.IntValue ] ) ); - if( m_failStencilOpIdx.IntValue != FailStencilOpDefaultValue || m_failStencilOpIdx.Active ) - result += string.Format( "\t\t\tFail {0}\n", m_failStencilOpIdx.GetValueOrProperty( StencilOpsValues[ m_failStencilOpIdx.IntValue ] ) ); - if( m_zFailStencilOpIdx.IntValue != ZFailStencilOpDefaultValue || m_zFailStencilOpIdx.Active ) - result += string.Format( "\t\t\tZFail {0}\n", m_zFailStencilOpIdx.GetValueOrProperty( StencilOpsValues[ m_zFailStencilOpIdx.IntValue ] ) ); - } - - - result += "\t\t}\n"; - return result; - } - - public void Draw( UndoParentNode owner ) - { - bool foldoutValue = owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedStencilOptions; - NodeUtils.DrawPropertyGroup( owner, ref foldoutValue, ref m_active, FoldoutLabelStr, () => - { - float cache = EditorGUIUtility.labelWidth; - float cache2 = EditorGUIUtility.fieldWidth; - EditorGUIUtility.labelWidth = 110; - EditorGUIUtility.fieldWidth = 30; - m_refValue.IntSlider( ref owner, ReferenceValueContent, 0, 255 ); - m_readMask.IntSlider( ref owner, ReadMaskContent, 0, 255 ); - m_writeMask.IntSlider( ref owner, WriteMaskContent, 0, 255 ); - //EditorGUIUtility.labelWidth = cache; - EditorGUIUtility.fieldWidth = cache2; - if( ( owner as StandardSurfaceOutputNode ).CurrentCullMode == CullMode.Off ) - { - m_comparisonFunctionIdx.EnumTypePopup( ref owner, ComparisonFrontStr, StencilComparisonLabels ); - m_passStencilOpIdx.EnumTypePopup( ref owner, PassFrontStr, StencilOpsLabels ); - m_failStencilOpIdx.EnumTypePopup( ref owner, FailFrontStr, StencilOpsLabels ); - m_zFailStencilOpIdx.EnumTypePopup( ref owner, ZFailFrontStr, StencilOpsLabels ); - EditorGUILayout.Separator(); - m_comparisonFunctionBackIdx.EnumTypePopup( ref owner, ComparisonBackStr, StencilComparisonLabels ); - m_passStencilOpBackIdx.EnumTypePopup( ref owner, PassBackStr, StencilOpsLabels ); - m_failStencilOpBackIdx.EnumTypePopup( ref owner, FailBackStr, StencilOpsLabels ); - m_zFailStencilOpBackIdx.EnumTypePopup( ref owner, ZFailBackStr, StencilOpsLabels ); - } - else - { - m_comparisonFunctionIdx.EnumTypePopup( ref owner, ComparisonStr, StencilComparisonLabels ); - m_passStencilOpIdx.EnumTypePopup( ref owner, PassFrontStr, StencilOpsLabels ); - m_failStencilOpIdx.EnumTypePopup( ref owner, FailFrontStr, StencilOpsLabels ); - m_zFailStencilOpIdx.EnumTypePopup( ref owner, ZFailFrontStr, StencilOpsLabels ); - } - EditorGUIUtility.labelWidth = cache; - } ); - owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedStencilOptions = foldoutValue; - } - - public void ReadFromString( ref uint index, ref string[] nodeParams ) - { - m_active = Convert.ToBoolean( nodeParams[ index++ ] ); - if( UIUtils.CurrentShaderVersion() > 14501 ) - { - m_refValue.ReadFromString( ref index, ref nodeParams ); - m_readMask.ReadFromString( ref index, ref nodeParams ); - m_writeMask.ReadFromString( ref index, ref nodeParams ); - m_comparisonFunctionIdx.ReadFromString( ref index, ref nodeParams ); - m_passStencilOpIdx.ReadFromString( ref index, ref nodeParams ); - m_failStencilOpIdx.ReadFromString( ref index, ref nodeParams ); - m_zFailStencilOpIdx.ReadFromString( ref index, ref nodeParams ); - } - else - { - m_refValue.IntValue = Convert.ToInt32( nodeParams[ index++ ] ); - m_readMask.IntValue = Convert.ToInt32( nodeParams[ index++ ] ); - m_writeMask.IntValue = Convert.ToInt32( nodeParams[ index++ ] ); - m_comparisonFunctionIdx.IntValue = Convert.ToInt32( nodeParams[ index++ ] ); - m_passStencilOpIdx.IntValue = Convert.ToInt32( nodeParams[ index++ ] ); - m_failStencilOpIdx.IntValue = Convert.ToInt32( nodeParams[ index++ ] ); - m_zFailStencilOpIdx.IntValue = Convert.ToInt32( nodeParams[ index++ ] ); - } - - if( UIUtils.CurrentShaderVersion() > 13203 ) - { - if( UIUtils.CurrentShaderVersion() > 14501 ) - { - m_comparisonFunctionBackIdx.ReadFromString( ref index, ref nodeParams ); - m_passStencilOpBackIdx.ReadFromString( ref index, ref nodeParams ); - m_failStencilOpBackIdx.ReadFromString( ref index, ref nodeParams ); - m_zFailStencilOpBackIdx.ReadFromString( ref index, ref nodeParams ); - } - else - { - m_comparisonFunctionBackIdx.IntValue = Convert.ToInt32( nodeParams[ index++ ] ); - m_passStencilOpBackIdx.IntValue = Convert.ToInt32( nodeParams[ index++ ] ); - m_failStencilOpBackIdx.IntValue = Convert.ToInt32( nodeParams[ index++ ] ); - m_zFailStencilOpBackIdx.IntValue = Convert.ToInt32( nodeParams[ index++ ] ); - } - } - } - - public void WriteToString( ref string nodeInfo ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_active ); - m_refValue.WriteToString( ref nodeInfo ); - m_readMask.WriteToString( ref nodeInfo ); - m_writeMask.WriteToString( ref nodeInfo ); - m_comparisonFunctionIdx.WriteToString( ref nodeInfo ); - m_passStencilOpIdx.WriteToString( ref nodeInfo ); - m_failStencilOpIdx.WriteToString( ref nodeInfo ); - m_zFailStencilOpIdx.WriteToString( ref nodeInfo ); - m_comparisonFunctionBackIdx.WriteToString( ref nodeInfo ); - m_passStencilOpBackIdx.WriteToString( ref nodeInfo ); - m_failStencilOpBackIdx.WriteToString( ref nodeInfo ); - m_zFailStencilOpBackIdx.WriteToString( ref nodeInfo ); - } - - public bool Active - { - get { return m_active; } - set { m_active = value; } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/StencilBufferOpHelper.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/StencilBufferOpHelper.cs.meta deleted file mode 100644 index 6dc55180..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/StencilBufferOpHelper.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 0111d524dc809f14aa95e4e1ab93d37b -timeCreated: 1481126953 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/TerrainDrawInstancedHelper.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/TerrainDrawInstancedHelper.cs deleted file mode 100644 index 751317d1..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/TerrainDrawInstancedHelper.cs +++ /dev/null @@ -1,374 +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.Collections.Generic; - -namespace AmplifyShaderEditor -{ - [Serializable] - public class TerrainDrawInstancedHelper - { -#if UNITY_2018_1_OR_NEWER - private readonly string[] InstancedPragmas = - { - "multi_compile_instancing", - "instancing_options assumeuniformscaling nomatrices nolightprobe nolightmap forwardadd" - }; - - private readonly string[] InstancedGlobalsSRP = - { - "#ifdef UNITY_INSTANCING_ENABLED//ASE Terrain Instancing", - "\tTEXTURE2D(_TerrainHeightmapTexture);//ASE Terrain Instancing", - "\tTEXTURE2D( _TerrainNormalmapTexture);//ASE Terrain Instancing", - "#endif//ASE Terrain Instancing", - "UNITY_INSTANCING_BUFFER_START( Terrain )//ASE Terrain Instancing", - "\tUNITY_DEFINE_INSTANCED_PROP( float4, _TerrainPatchInstanceData )//ASE Terrain Instancing", - "UNITY_INSTANCING_BUFFER_END( Terrain)//ASE Terrain Instancing", - "CBUFFER_START( UnityTerrain)//ASE Terrain Instancing", - "\t#ifdef UNITY_INSTANCING_ENABLED//ASE Terrain Instancing", - "\t\tfloat4 _TerrainHeightmapRecipSize;//ASE Terrain Instancing", - "\t\tfloat4 _TerrainHeightmapScale;//ASE Terrain Instancing", - "\t#endif//ASE Terrain Instancing", - "CBUFFER_END//ASE Terrain Instancing" - }; - - private readonly string[] InstancedGlobalsDefault = - { - "#ifdef UNITY_INSTANCING_ENABLED//ASE Terrain Instancing", - "\tsampler2D _TerrainHeightmapTexture;//ASE Terrain Instancing", - "\tsampler2D _TerrainNormalmapTexture;//ASE Terrain Instancing", - "#endif//ASE Terrain Instancing", - "UNITY_INSTANCING_BUFFER_START( Terrain )//ASE Terrain Instancing", - "\tUNITY_DEFINE_INSTANCED_PROP( float4, _TerrainPatchInstanceData )//ASE Terrain Instancing", - "UNITY_INSTANCING_BUFFER_END( Terrain)//ASE Terrain Instancing", - "CBUFFER_START( UnityTerrain)//ASE Terrain Instancing", - "\t#ifdef UNITY_INSTANCING_ENABLED//ASE Terrain Instancing", - "\t\tfloat4 _TerrainHeightmapRecipSize;//ASE Terrain Instancing", - "\t\tfloat4 _TerrainHeightmapScale;//ASE Terrain Instancing", - "\t#endif//ASE Terrain Instancing", - "CBUFFER_END//ASE Terrain Instancing" - }; - - - private readonly string ApplyMeshModificationInstruction = "{0} = ApplyMeshModification({0});"; - - private readonly string[] ApplyMeshModificationFunctionSRP = - { - /*0 - struct name 1 - var name*/"{0} ApplyMeshModification( {0} {1} )\n", - "{\n", - "#ifdef UNITY_INSTANCING_ENABLED\n", - /* 0 vertex position*/"\tfloat2 patchVertex = {0}.xy;\n", - "\tfloat4 instanceData = UNITY_ACCESS_INSTANCED_PROP( Terrain, _TerrainPatchInstanceData );\n", - "\tfloat2 sampleCoords = ( patchVertex.xy + instanceData.xy ) * instanceData.z;\n", - "\tfloat height = UnpackHeightmap( _TerrainHeightmapTexture.Load( int3( sampleCoords, 0 ) ) );\n", - /*0 - vertex position*/"\t{0}.xz = sampleCoords* _TerrainHeightmapScale.xz;\n", - /*0 - vertex position*/"\t{0}.y = height* _TerrainHeightmapScale.y;\n", - "\t#ifdef ENABLE_TERRAIN_PERPIXEL_NORMAL\n", - /* 0 - vertex normal*/"\t\t{0} = float3(0, 1, 0);\n", - "\t#else\n", - /* 0 - vertex normal*/"\t\t{0} = _TerrainNormalmapTexture.Load(int3(sampleCoords, 0)).rgb* 2 - 1;\n", - "\t#endif\n", - "#ifdef ENABLE_TERRAIN_PERPIXEL_NORMAL\n", - /* 0 - tex coord*/"\t{0}.xy = sampleCoords;\n", - "#else\n", - /* 0 - tex coord*/"\t{0}.xy = sampleCoords* _TerrainHeightmapRecipSize.zw;\n", - "#endif\n", - "#endif\n", - /* 0 - var name*/"\treturn {0};\n", - "}\n" - }; - //{ - // /*0 - struct name 1 - var name*/"{0} ApplyMeshModification( {0} {1} )\n", - // "{\n", - // "#ifdef UNITY_INSTANCING_ENABLED\n", - // /* 0 vertex position*/"\tfloat2 patchVertex = {0}.xy;\n", - // "\t\tfloat4 instanceData = UNITY_ACCESS_INSTANCED_PROP( Terrain, _TerrainPatchInstanceData );\n", - // "\t\tfloat2 sampleCoords = ( patchVertex.xy + instanceData.xy ) * instanceData.z;\n", - // "\t\tfloat height = UnpackHeightmap( _TerrainHeightmapTexture.Load( int3( sampleCoords, 0 ) ) );\n", - // /*0 - vertex position*/"\t\t{0}.xz = sampleCoords* _TerrainHeightmapScale.xz;\n", - // /*0 - vertex position*/"\t\t{0}.y = height* _TerrainHeightmapScale.y;\n", - // "# ifdef ATTRIBUTES_NEED_NORMAL\n", - // /* 0 - vertex normal*/"\t\t{0} = _TerrainNormalmapTexture.Load(int3(sampleCoords, 0)).rgb* 2 - 1;\n", - // "\t#endif\n", - // "\t#if defined(VARYINGS_NEED_TEXCOORD0) || defined(VARYINGS_DS_NEED_TEXCOORD0)\n", - // "\t\t#ifdef ENABLE_TERRAIN_PERPIXEL_NORMAL\n", - // /* 0 - tex coord*/"\t\t\t{0} = sampleCoords;\n", - // "\t\t#else\n", - // /* 0 - tex coord*/"\t\t\t{0}.xy = sampleCoords* _TerrainHeightmapRecipSize.zw;\n", - // "\t\t#endif\n", - // "\t#endif\n", - // "#endif\n", - // "#ifdef ATTRIBUTES_NEED_TANGENT\n", - // /* 0 - tangent 1 - normal*/"\t\t{0}.xyz = cross( {1}, float3(0, 0, 1));\n", - // /*0 - tangent*/"\t{0}.w = -1;\n", - // "#endif\n", - // /* 0 - var name*/"\treturn {0};\n", - // "}\n" - //}; - - - - private readonly string[] ApplyMeshModificationFunctionDefaultTemplate = - { - /* 0 vertex struct */"{0} ApplyMeshModification( {0} {1} )", - "{\n", - "#ifdef UNITY_INSTANCING_ENABLED\n", - /*0 - vertex pos*/"\tfloat2 patchVertex = {0}.xy;\n", - "\tfloat4 instanceData = UNITY_ACCESS_INSTANCED_PROP( Terrain, _TerrainPatchInstanceData );\n", - "\tfloat2 sampleCoords = ( patchVertex.xy + instanceData.xy ) * instanceData.z;\n", - /* 0 - tex coords*/"\t{0} = float4( sampleCoords.xy * _TerrainHeightmapRecipSize.z, 0, 0 );\n", - /* 0 - tex coords*/"\tfloat height = UnpackHeightmap( tex2Dlod( _TerrainHeightmapTexture, {0} ) );\n", - /* 0 - vertex pos*/"\t{0}.xz = sampleCoords * _TerrainHeightmapScale.xz;\n", - /* 0 - vertex pos*/"\t{0}.y = height * _TerrainHeightmapScale.y;\n", - /* 0 - normal 1 - tex coord*/"\t{0} = tex2Dlod( _TerrainNormalmapTexture, {1} ).rgb * 2 - 1;\n", - "#endif\n", - /* var name*/"return {0};\n", - "}\n" - }; - - private readonly string ApplyMeshModificationInstructionStandard = "ApplyMeshModification({0});"; - private readonly string[] ApplyMeshModificationFunctionStandard = - { - "void ApplyMeshModification( inout {0} v )", - "#if defined(UNITY_INSTANCING_ENABLED) && !defined(SHADER_API_D3D11_9X)", - "\tfloat2 patchVertex = v.vertex.xy;", - "\tfloat4 instanceData = UNITY_ACCESS_INSTANCED_PROP(Terrain, _TerrainPatchInstanceData);", - "\t", - "\tfloat4 uvscale = instanceData.z * _TerrainHeightmapRecipSize;", - "\tfloat4 uvoffset = instanceData.xyxy * uvscale;", - "\tuvoffset.xy += 0.5f * _TerrainHeightmapRecipSize.xy;", - "\tfloat2 sampleCoords = (patchVertex.xy * uvscale.xy + uvoffset.xy);", - "\t", - "\tfloat hm = UnpackHeightmap(tex2Dlod(_TerrainHeightmapTexture, float4(sampleCoords, 0, 0)));", - "\tv.vertex.xz = (patchVertex.xy + instanceData.xy) * _TerrainHeightmapScale.xz * instanceData.z;", - "\tv.vertex.y = hm * _TerrainHeightmapScale.y;", - "\tv.vertex.w = 1.0f;", - "\t", - "\tv.texcoord.xy = (patchVertex.xy * uvscale.zw + uvoffset.zw);", - "\tv.texcoord3 = v.texcoord2 = v.texcoord1 = v.texcoord;", - "\t", - "\t#ifdef TERRAIN_INSTANCED_PERPIXEL_NORMAL", - "\t\tv.normal = float3(0, 1, 0);", - "\t\t//data.tc.zw = sampleCoords;", - "\t#else", - "\t\tfloat3 nor = tex2Dlod(_TerrainNormalmapTexture, float4(sampleCoords, 0, 0)).xyz;", - "\t\tv.normal = 2.0f * nor - 1.0f;", - "\t#endif", - "#endif", - }; - private readonly string[] AdditionalUsePasses = - { - "Hidden/Nature/Terrain/Utilities/PICKING", - "Hidden/Nature/Terrain/Utilities/SELECTION" - }; - private readonly string DrawInstancedLabel = "Instanced Terrain"; -#endif - [SerializeField] - private bool m_enable = false; - - public void Draw( UndoParentNode owner ) - { -#if UNITY_2018_1_OR_NEWER - m_enable = owner.EditorGUILayoutToggle( DrawInstancedLabel, m_enable ); -#endif - } - - public void UpdateDataCollectorForTemplates( ref MasterNodeDataCollector dataCollector, ref List<string> vertexInstructions ) - { -#if UNITY_2018_1_OR_NEWER - if( m_enable ) - { - for( int i = 0; i < AdditionalUsePasses.Length; i++ ) - { - dataCollector.AddUsePass( AdditionalUsePasses[ i ], false ); - } - - for( int i = 0; i < InstancedPragmas.Length; i++ ) - { - dataCollector.AddToPragmas( -1, InstancedPragmas[ i ] ); - } - - if( dataCollector.IsSRP ) - { - - TemplateFunctionData functionData = dataCollector.TemplateDataCollectorInstance.CurrentTemplateData.VertexFunctionData; - string uvCoord = dataCollector.TemplateDataCollectorInstance.GetUV( 0, MasterNodePortCategory.Vertex ); - string vertexNormal = dataCollector.TemplateDataCollectorInstance.GetVertexNormal( PrecisionType.Float, false, MasterNodePortCategory.Vertex ); - //string vertexTangent = dataCollector.TemplateDataCollectorInstance.GetVertexTangent( WirePortDataType.FLOAT4, PrecisionType.Float, false, MasterNodePortCategory.Vertex ); - string vertexPos = dataCollector.TemplateDataCollectorInstance.GetVertexPosition( WirePortDataType.OBJECT, PrecisionType.Float, false, MasterNodePortCategory.Vertex ); - - string functionHeader = string.Format( ApplyMeshModificationFunctionSRP[ 0 ], functionData.InVarType, functionData.InVarName ); - - //string functionBody = functionHeader + - // ApplyMeshModificationFunctionSRP[ 1 ] + - // ApplyMeshModificationFunctionSRP[ 2 ] + - // string.Format( ApplyMeshModificationFunctionSRP[ 3 ], vertexPos ) + - // ApplyMeshModificationFunctionSRP[ 4 ] + - // ApplyMeshModificationFunctionSRP[ 5 ] + - // ApplyMeshModificationFunctionSRP[ 6 ] + - // string.Format( ApplyMeshModificationFunctionSRP[ 7 ], vertexPos ) + - // string.Format( ApplyMeshModificationFunctionSRP[ 8 ], vertexPos ) + - // ApplyMeshModificationFunctionSRP[ 9 ] + - // string.Format( ApplyMeshModificationFunctionSRP[ 10 ], vertexNormal ) + - // ApplyMeshModificationFunctionSRP[ 11 ] + - // ApplyMeshModificationFunctionSRP[ 12 ] + - // ApplyMeshModificationFunctionSRP[ 13 ] + - // string.Format( ApplyMeshModificationFunctionSRP[ 14 ], uvCoord ) + - // ApplyMeshModificationFunctionSRP[ 15 ] + - // string.Format( ApplyMeshModificationFunctionSRP[ 16 ], uvCoord ) + - // ApplyMeshModificationFunctionSRP[ 17 ] + - // ApplyMeshModificationFunctionSRP[ 18 ] + - // ApplyMeshModificationFunctionSRP[ 19 ] + - // ApplyMeshModificationFunctionSRP[ 20 ] + - // string.Format( ApplyMeshModificationFunctionSRP[ 21 ], vertexTangent, vertexNormal ) + - // string.Format( ApplyMeshModificationFunctionSRP[ 22 ], vertexTangent ) + - // ApplyMeshModificationFunctionSRP[ 23 ] + - // string.Format( ApplyMeshModificationFunctionSRP[ 24 ], functionData.InVarName ) + - // ApplyMeshModificationFunctionSRP[ 25 ]; - string functionBody = functionHeader + - ApplyMeshModificationFunctionSRP[ 1 ] + - ApplyMeshModificationFunctionSRP[ 2 ] + - string.Format( ApplyMeshModificationFunctionSRP[ 3 ], vertexPos ) + - ApplyMeshModificationFunctionSRP[ 4 ] + - ApplyMeshModificationFunctionSRP[ 5 ] + - ApplyMeshModificationFunctionSRP[ 6 ] + - string.Format( ApplyMeshModificationFunctionSRP[ 7 ], vertexPos ) + - string.Format( ApplyMeshModificationFunctionSRP[ 8 ], vertexPos ) + - ApplyMeshModificationFunctionSRP[ 9 ] + - string.Format( ApplyMeshModificationFunctionSRP[ 10 ], vertexNormal ) + - ApplyMeshModificationFunctionSRP[ 11 ] + - string.Format( ApplyMeshModificationFunctionSRP[ 12 ], vertexNormal ) + - ApplyMeshModificationFunctionSRP[ 13 ] + - ApplyMeshModificationFunctionSRP[ 14 ] + - string.Format( ApplyMeshModificationFunctionSRP[ 15 ], uvCoord ) + - ApplyMeshModificationFunctionSRP[ 16 ] + - string.Format( ApplyMeshModificationFunctionSRP[ 17 ], uvCoord ) + - ApplyMeshModificationFunctionSRP[ 18 ] + - ApplyMeshModificationFunctionSRP[ 19 ] + - string.Format( ApplyMeshModificationFunctionSRP[ 20 ], functionData.InVarName ) + - ApplyMeshModificationFunctionSRP[ 21 ]; - dataCollector.AddFunction( functionHeader, functionBody ); - - for( int i = 0; i < InstancedGlobalsSRP.Length; i++ ) - { - dataCollector.AddToUniforms( -1, InstancedGlobalsSRP[ i ] ); - } - - - string vertexVarName = dataCollector.TemplateDataCollectorInstance.CurrentTemplateData.VertexFunctionData.InVarName; - vertexInstructions.Insert( 0, string.Format( ApplyMeshModificationInstruction, vertexVarName ) ); - } - else - { - TemplateFunctionData functionData = dataCollector.TemplateDataCollectorInstance.CurrentTemplateData.VertexFunctionData; - - string uvCoord = dataCollector.TemplateDataCollectorInstance.GetUV( 0, MasterNodePortCategory.Vertex ); - string vertexNormal = dataCollector.TemplateDataCollectorInstance.GetVertexNormal( PrecisionType.Float, false, MasterNodePortCategory.Vertex ); - string vertexPos = dataCollector.TemplateDataCollectorInstance.GetVertexPosition( WirePortDataType.OBJECT, PrecisionType.Float, false, MasterNodePortCategory.Vertex ); - - string functionHeader = string.Format( ApplyMeshModificationFunctionDefaultTemplate[ 0 ], functionData.InVarType, functionData.InVarName ); - string functionBody = functionHeader + - ApplyMeshModificationFunctionDefaultTemplate[ 1 ] + - ApplyMeshModificationFunctionDefaultTemplate[ 2 ] + - string.Format( ApplyMeshModificationFunctionDefaultTemplate[ 3 ], vertexPos ) + - ApplyMeshModificationFunctionDefaultTemplate[ 4 ] + - ApplyMeshModificationFunctionDefaultTemplate[ 5 ] + - string.Format( ApplyMeshModificationFunctionDefaultTemplate[ 6 ], uvCoord ) + - string.Format( ApplyMeshModificationFunctionDefaultTemplate[ 7 ], uvCoord ) + - string.Format( ApplyMeshModificationFunctionDefaultTemplate[ 8 ], vertexPos ) + - string.Format( ApplyMeshModificationFunctionDefaultTemplate[ 9 ], vertexPos ) + - string.Format( ApplyMeshModificationFunctionDefaultTemplate[ 10 ], vertexNormal, uvCoord ) + - ApplyMeshModificationFunctionDefaultTemplate[ 11 ] + - string.Format( ApplyMeshModificationFunctionDefaultTemplate[ 12 ], functionData.InVarName ) + - ApplyMeshModificationFunctionDefaultTemplate[ 13 ]; - - - dataCollector.AddFunction( functionHeader, functionBody ); - for( int i = 0; i < InstancedGlobalsDefault.Length; i++ ) - { - dataCollector.AddToUniforms( -1, InstancedGlobalsDefault[ i ] ); - } - - - string vertexVarName = dataCollector.TemplateDataCollectorInstance.CurrentTemplateData.VertexFunctionData.InVarName; - vertexInstructions.Insert( 0, string.Format( ApplyMeshModificationInstruction, vertexVarName ) ); - - } - } -#endif - } - - public void UpdateDataCollectorForStandard( ref MasterNodeDataCollector dataCollector ) - { -#if UNITY_2018_1_OR_NEWER - if( m_enable ) - { - for( int i = 0; i < AdditionalUsePasses.Length; i++ ) - { - dataCollector.AddUsePass( AdditionalUsePasses[ i ], false ); - } - - for( int i = 0; i < InstancedPragmas.Length; i++ ) - { - dataCollector.AddToPragmas( -1, InstancedPragmas[ i ] ); - } - string functionBody = string.Empty; - - string functionHeader = string.Format( ApplyMeshModificationFunctionStandard[ 0 ], dataCollector.SurfaceVertexStructure ); - IOUtils.AddFunctionHeader( ref functionBody, functionHeader ); - for( int i = 1; i < ApplyMeshModificationFunctionStandard.Length; i++ ) - { - IOUtils.AddFunctionLine( ref functionBody, ApplyMeshModificationFunctionStandard[ i ] ); - } - IOUtils.CloseFunctionBody( ref functionBody ); - - //string inputName = "input"; - //string uvCoord = "input.texcoord"; - //string vertexNormal = "input.normal"; - //string vertexPos = "input.vertex"; - - //string functionHeader = string.Format( ApplyMeshModificationFunctionDefaultTemplate[ 0 ], dataCollector.SurfaceVertexStructure, inputName ); - //IOUtils.AddFunctionHeader( ref functionBody, functionHeader ); - //IOUtils.AddFunctionLine( ref functionBody, ApplyMeshModificationFunctionDefaultTemplate[ 1 ] ); - //IOUtils.AddFunctionLine( ref functionBody,ApplyMeshModificationFunctionDefaultTemplate[ 2 ] ); - //IOUtils.AddFunctionLine( ref functionBody,string.Format( ApplyMeshModificationFunctionDefaultTemplate[ 3 ], vertexPos ) ); - //IOUtils.AddFunctionLine( ref functionBody,ApplyMeshModificationFunctionDefaultTemplate[ 4 ] ); - //IOUtils.AddFunctionLine( ref functionBody,ApplyMeshModificationFunctionDefaultTemplate[ 5 ] ); - //IOUtils.AddFunctionLine( ref functionBody,string.Format( ApplyMeshModificationFunctionDefaultTemplate[ 6 ], uvCoord ) ); - //IOUtils.AddFunctionLine( ref functionBody,string.Format( ApplyMeshModificationFunctionDefaultTemplate[ 7 ], uvCoord ) ); - //IOUtils.AddFunctionLine( ref functionBody,string.Format( ApplyMeshModificationFunctionDefaultTemplate[ 8 ], vertexPos ) ); - //IOUtils.AddFunctionLine( ref functionBody,string.Format( ApplyMeshModificationFunctionDefaultTemplate[ 9 ], vertexPos ) ); - //IOUtils.AddFunctionLine( ref functionBody,string.Format( ApplyMeshModificationFunctionDefaultTemplate[ 10 ], vertexNormal, uvCoord ) ); - //IOUtils.AddFunctionLine( ref functionBody,ApplyMeshModificationFunctionDefaultTemplate[ 11 ] ); - //IOUtils.AddFunctionLine( ref functionBody,string.Format( ApplyMeshModificationFunctionDefaultTemplate[ 12 ], inputName ) ); - //IOUtils.AddFunctionLine( ref functionBody, ApplyMeshModificationFunctionDefaultTemplate[ 13 ] ); - //IOUtils.CloseFunctionBody( ref functionBody ); - - dataCollector.AddFunction( functionHeader, functionBody ); - for( int i = 0; i < InstancedGlobalsDefault.Length; i++ ) - { - dataCollector.AddToUniforms( -1, InstancedGlobalsDefault[ i ] ); - } - - dataCollector.AddVertexInstruction( string.Format( ApplyMeshModificationInstructionStandard, "v" ) ); - } -#endif - } - - public void ReadFromString( ref uint index, ref string[] nodeParams ) - { - m_enable = Convert.ToBoolean( nodeParams[ index++ ] ); - } - - public void WriteToString( ref string nodeInfo ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_enable ); - } - - public bool Enabled { get { return m_enable; } } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/TerrainDrawInstancedHelper.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/TerrainDrawInstancedHelper.cs.meta deleted file mode 100644 index 9580ad09..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/TerrainDrawInstancedHelper.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 935c69709205e1c4dbd54da410518cc6 -timeCreated: 1548263010 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/TessellationOpHelper.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/TessellationOpHelper.cs deleted file mode 100644 index 38d38f09..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/TessellationOpHelper.cs +++ /dev/null @@ -1,642 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using System.Collections.Generic; -using UnityEngine; -using UnityEditor; - -namespace AmplifyShaderEditor -{ - [Serializable] - public sealed class TessellationOpHelper - { - public const string TessellationPortStr = "Tessellation"; - - - public const string TessSurfParam = "tessellate:tessFunction"; - public const string TessInclude = "Tessellation.cginc"; - //public const string CustomAppData = "\t\tstruct appdata\n" + - // "\t\t{\n" + - // "\t\t\tfloat4 vertex : POSITION;\n" + - // "\t\t\tfloat4 tangent : TANGENT;\n" + - // "\t\t\tfloat3 normal : NORMAL;\n" + - // "\t\t\tfloat4 texcoord : TEXCOORD0;\n" + - // "\t\t\tfloat4 texcoord1 : TEXCOORD1;\n" + - // "\t\t\tfloat4 texcoord2 : TEXCOORD2;\n" + - // "\t\t\tfloat4 texcoord3 : TEXCOORD3;\n" + - // "\t\t\tfixed4 color : COLOR;\n" + - // "\t\t\tUNITY_VERTEX_INPUT_INSTANCE_ID\n" + - // "\t\t};\n\n"; - - - - private const string TessUniformName = "_TessValue"; - private const string TessMinUniformName = "_TessMin"; - private const string TessMaxUniformName = "_TessMax"; - - //private GUIContent EnableTessContent = new GUIContent( "Tessellation", "Activates the use of tessellation which subdivides polygons to increase geometry detail using a set of rules\nDefault: OFF" ); - private GUIContent TessFactorContent = new GUIContent( "Tess", "Tessellation factor\nDefault: 4" ); - private GUIContent TessMinDistanceContent = new GUIContent( "Min", "Minimum tessellation distance\nDefault: 10" ); - private GUIContent TessMaxDistanceContent = new GUIContent( "Max", "Maximum tessellation distance\nDefault: 25" ); - - - private readonly int[] TesselationTypeValues = { 0, 1, 2, 3 }; - private readonly string[] TesselationTypeLabels = { "Distance-based", "Fixed", "Edge Length", "Edge Length Cull" }; - private readonly string TesselationTypeStr = "Type"; - - private const string TessProperty = "_TessValue( \"Max Tessellation\", Range( 1, 32 ) ) = {0}"; - private const string TessMinProperty = "_TessMin( \"Tess Min Distance\", Float ) = {0}"; - private const string TessMaxProperty = "_TessMax( \"Tess Max Distance\", Float ) = {0}"; - - private const string TessFunctionOpen = "\t\tfloat4 tessFunction( appdata_full v0, appdata_full v1, appdata_full v2 )\n\t\t{\n"; - private const string TessFunctionClose = "\t\t}\n"; - - // Custom function - private const string CustomFunctionBody = "\t\t\treturn {0};\n"; - - // Distance based function - private const string DistBasedTessFunctionBody = "\t\t\treturn UnityDistanceBasedTess( v0.vertex, v1.vertex, v2.vertex, _TessMin, _TessMax, _TessValue );\n"; - - // Fixed amount function - private const string FixedAmountTessFunctionOpen = "\t\tfloat4 tessFunction( )\n\t\t{\n"; - private const string FixedAmountTessFunctionBody = "\t\t\treturn _TessValue;\n"; - - // Edge Length - private GUIContent EdgeLengthContent = new GUIContent( "Edge Length", "Tessellation levels ccomputed based on triangle edge length on the screen\nDefault: 4" ); - private const string EdgeLengthTessProperty = "_EdgeLength ( \"Edge length\", Range( 2, 50 ) ) = {0}"; - private const string EdgeLengthTessUniformName = "_EdgeLength"; - - private const string EdgeLengthTessFunctionBody = "\t\t\treturn UnityEdgeLengthBasedTess (v0.vertex, v1.vertex, v2.vertex, _EdgeLength);\n"; - private const string EdgeLengthTessCullFunctionBody = "\t\t\treturn UnityEdgeLengthBasedTessCull (v0.vertex, v1.vertex, v2.vertex, _EdgeLength , _TessMaxDisp );\n"; - - - private const string EdgeLengthTessMaxDispProperty = "_TessMaxDisp( \"Max Displacement\", Float ) = {0}"; - private const string EdgeLengthTessMaxDispUniformName = "_TessMaxDisp"; - private GUIContent EdgeLengthTessMaxDisplacementContent = new GUIContent( "Max Disp.", "Max Displacement" ); - - // Phong - private GUIContent PhongEnableContent = new GUIContent( "Phong", "Modifies positions of the subdivided faces so that the resulting surface follows the mesh normals a bit\nDefault: OFF" ); - private GUIContent PhongStrengthContent = new GUIContent( "Strength", "Strength\nDefault: 0.5" ); - public const string PhongStrengthParam = "tessphong:_TessPhongStrength"; - - private const string PhongStrengthProperty = "_TessPhongStrength( \"Phong Tess Strength\", Range( 0, 1 ) ) = {0}"; - private const string PhongStrengthUniformName = "_TessPhongStrength"; - - [SerializeField] - private bool m_enabled = false; - - //private bool m_expanded = false; - - [SerializeField] - private int m_tessType = 2; - - [SerializeField] - private float m_tessMinDistance = 10f; - - [SerializeField] - private float m_tessMaxDistance = 25f; - - [SerializeField] - private float m_tessFactor = 15f; - - [SerializeField] - private float m_phongStrength = 0.5f; - - [SerializeField] - private bool m_phongEnabled = false; - - [SerializeField] - private string[] m_customData = { string.Empty, string.Empty, string.Empty }; - - [SerializeField] - private bool m_hasCustomFunction = false; - - [SerializeField] - private string m_customFunction = String.Empty; - - [SerializeField] - private string m_additionalData = string.Empty; - - [SerializeField] - private StandardSurfaceOutputNode m_parentSurface; - - private Dictionary<string, bool> m_additionalDataDict = new Dictionary<string, bool>(); - - private int m_masterNodeIndexPort = 0; - private int m_vertexOffsetIndexPort = 0; - //private int m_orderIndex = 1000; - - public void Draw( UndoParentNode owner, GUIStyle toolbarstyle, Material mat, bool connectedInput ) - { - Color cachedColor = GUI.color; - GUI.color = new Color( cachedColor.r, cachedColor.g, cachedColor.b, 0.5f ); - EditorGUILayout.BeginHorizontal( toolbarstyle ); - GUI.color = cachedColor; - EditorGUI.BeginChangeCheck(); - m_parentSurface.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedTesselation = GUILayout.Toggle( m_parentSurface.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedTesselation, " Tessellation", UIUtils.MenuItemToggleStyle, GUILayout.ExpandWidth( true ) ); - if ( EditorGUI.EndChangeCheck() ) - { - EditorPrefs.SetBool( "ExpandedTesselation", m_parentSurface.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedTesselation ); - } - - EditorGUI.BeginChangeCheck(); - m_enabled = owner.EditorGUILayoutToggle( string.Empty, m_enabled, UIUtils.MenuItemEnableStyle, GUILayout.Width( 16 ) ); - if ( EditorGUI.EndChangeCheck() ) - { - if ( m_enabled ) - UpdateToMaterial( mat, !connectedInput ); - - UIUtils.RequestSave(); - } - - EditorGUILayout.EndHorizontal(); - - m_enabled = m_enabled || connectedInput; - - if ( m_parentSurface.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedTesselation ) - { - cachedColor = GUI.color; - GUI.color = new Color( cachedColor.r, cachedColor.g, cachedColor.b, ( EditorGUIUtility.isProSkin ? 0.5f : 0.25f ) ); - EditorGUILayout.BeginVertical( UIUtils.MenuItemBackgroundStyle ); - GUI.color = cachedColor; - - EditorGUILayout.Separator(); - EditorGUI.BeginDisabledGroup( !m_enabled ); - - EditorGUI.indentLevel += 1; - - m_phongEnabled = owner.EditorGUILayoutToggle( PhongEnableContent, m_phongEnabled ); - if ( m_phongEnabled ) - { - EditorGUI.indentLevel += 1; - EditorGUI.BeginChangeCheck(); - m_phongStrength = owner.EditorGUILayoutSlider( PhongStrengthContent, m_phongStrength, 0.0f, 1.0f ); - if ( EditorGUI.EndChangeCheck() && mat != null ) - { - if ( mat.HasProperty( PhongStrengthUniformName ) ) - mat.SetFloat( PhongStrengthUniformName, m_phongStrength ); - } - - EditorGUI.indentLevel -= 1; - } - - bool guiEnabled = GUI.enabled; - GUI.enabled = !connectedInput && m_enabled; - - m_tessType = owner.EditorGUILayoutIntPopup( TesselationTypeStr, m_tessType, TesselationTypeLabels, TesselationTypeValues ); - - switch ( m_tessType ) - { - case 0: - { - EditorGUI.BeginChangeCheck(); - m_tessFactor = owner.EditorGUILayoutSlider( TessFactorContent, m_tessFactor, 1, 32 ); - if ( EditorGUI.EndChangeCheck() && mat != null ) - { - if ( mat.HasProperty( TessUniformName ) ) - mat.SetFloat( TessUniformName, m_tessFactor ); - } - - EditorGUI.BeginChangeCheck(); - m_tessMinDistance = owner.EditorGUILayoutFloatField( TessMinDistanceContent, m_tessMinDistance ); - if ( EditorGUI.EndChangeCheck() && mat != null ) - { - if ( mat.HasProperty( TessMinUniformName ) ) - mat.SetFloat( TessMinUniformName, m_tessMinDistance ); - } - - EditorGUI.BeginChangeCheck(); - m_tessMaxDistance = owner.EditorGUILayoutFloatField( TessMaxDistanceContent, m_tessMaxDistance ); - if ( EditorGUI.EndChangeCheck() && mat != null ) - { - if ( mat.HasProperty( TessMaxUniformName ) ) - mat.SetFloat( TessMaxUniformName, m_tessMaxDistance ); - } - } - break; - case 1: - { - EditorGUI.BeginChangeCheck(); - m_tessFactor = owner.EditorGUILayoutSlider( TessFactorContent, m_tessFactor, 1, 32 ); - if ( EditorGUI.EndChangeCheck() && mat != null ) - { - if ( mat.HasProperty( TessUniformName ) ) - mat.SetFloat( TessUniformName, m_tessFactor ); - } - } - break; - case 2: - { - EditorGUI.BeginChangeCheck(); - m_tessFactor = owner.EditorGUILayoutSlider( EdgeLengthContent, m_tessFactor, 2, 50 ); - if ( EditorGUI.EndChangeCheck() && mat != null ) - { - if ( mat.HasProperty( EdgeLengthTessUniformName ) ) - mat.SetFloat( EdgeLengthTessUniformName, m_tessFactor ); - } - } - break; - case 3: - { - EditorGUI.BeginChangeCheck(); - m_tessFactor = owner.EditorGUILayoutSlider( EdgeLengthContent, m_tessFactor, 2, 50 ); - if ( EditorGUI.EndChangeCheck() && mat != null ) - { - if ( mat.HasProperty( EdgeLengthTessUniformName ) ) - mat.SetFloat( EdgeLengthTessUniformName, m_tessFactor ); - } - - EditorGUI.BeginChangeCheck(); - m_tessMaxDistance = owner.EditorGUILayoutFloatField( EdgeLengthTessMaxDisplacementContent, m_tessMaxDistance ); - if ( EditorGUI.EndChangeCheck() && mat != null ) - { - if ( mat.HasProperty( TessMinUniformName ) ) - mat.SetFloat( TessMinUniformName, m_tessMaxDistance ); - } - } - break; - } - GUI.enabled = guiEnabled; - EditorGUI.indentLevel -= 1; - EditorGUI.EndDisabledGroup(); - EditorGUILayout.Separator(); - EditorGUILayout.EndVertical(); - } - } - - public void UpdateToMaterial( Material mat, bool updateInternals ) - { - if ( mat == null ) - return; - - if ( m_phongEnabled ) - { - if ( mat.HasProperty( PhongStrengthUniformName ) ) - mat.SetFloat( PhongStrengthUniformName, m_phongStrength ); - } - - if ( updateInternals ) - { - switch ( m_tessType ) - { - case 0: - { - if ( mat.HasProperty( TessUniformName ) ) - mat.SetFloat( TessUniformName, m_tessFactor ); - - if ( mat.HasProperty( TessMinUniformName ) ) - mat.SetFloat( TessMinUniformName, m_tessMinDistance ); - - if ( mat.HasProperty( TessMaxUniformName ) ) - mat.SetFloat( TessMaxUniformName, m_tessMaxDistance ); - } - break; - case 1: - { - if ( mat.HasProperty( TessUniformName ) ) - mat.SetFloat( TessUniformName, m_tessFactor ); - } - break; - case 2: - { - - if ( mat.HasProperty( EdgeLengthTessUniformName ) ) - mat.SetFloat( EdgeLengthTessUniformName, m_tessFactor ); - } - break; - case 3: - { - if ( mat.HasProperty( EdgeLengthTessUniformName ) ) - mat.SetFloat( EdgeLengthTessUniformName, m_tessFactor ); - - if ( mat.HasProperty( TessMinUniformName ) ) - mat.SetFloat( TessMinUniformName, m_tessMaxDistance ); - } - break; - } - } - } - public void ReadFromString( ref uint index, ref string[] nodeParams ) - { - m_enabled = Convert.ToBoolean( nodeParams[ index++ ] ); - m_tessType = Convert.ToInt32( nodeParams[ index++ ] ); - m_tessFactor = Convert.ToSingle( nodeParams[ index++ ] ); - m_tessMinDistance = Convert.ToSingle( nodeParams[ index++ ] ); - m_tessMaxDistance = Convert.ToSingle( nodeParams[ index++ ] ); - if ( UIUtils.CurrentShaderVersion() > 3001 ) - { - m_phongEnabled = Convert.ToBoolean( nodeParams[ index++ ] ); - m_phongStrength = Convert.ToSingle( nodeParams[ index++ ] ); - } - } - - public void WriteToString( ref string nodeInfo ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_enabled ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_tessType ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_tessFactor ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_tessMinDistance ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_tessMaxDistance ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_phongEnabled ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_phongStrength ); - } - - public string Uniforms() - { - string uniforms = string.Empty; - switch( m_tessType ) - { - case 0: - { - if( !m_hasCustomFunction ) - { - - //Tess - uniforms += "\t\tuniform " + UIUtils.PrecisionWirePortToCgType( PrecisionType.Float, WirePortDataType.FLOAT ) + " " + TessUniformName + ";\n"; - - //Min - uniforms += "\t\tuniform " + UIUtils.PrecisionWirePortToCgType( PrecisionType.Float, WirePortDataType.FLOAT ) + " " + TessMinUniformName + ";\n"; - - //Max - uniforms += "\t\tuniform " + UIUtils.PrecisionWirePortToCgType( PrecisionType.Float, WirePortDataType.FLOAT ) + " " + TessMaxUniformName + ";\n"; - } - } - break; - case 1: - //Tess - if( !m_hasCustomFunction ) - { - uniforms += "\t\tuniform " + UIUtils.PrecisionWirePortToCgType( PrecisionType.Float, WirePortDataType.FLOAT ) + " " + TessUniformName + ";\n"; - } - break; - } - - if( m_phongEnabled ) - { - uniforms += "\t\tuniform " + UIUtils.PrecisionWirePortToCgType( PrecisionType.Float, WirePortDataType.FLOAT ) + " " + PhongStrengthUniformName + ";\n" ; - } - - return uniforms; - } - - public void AddToDataCollector( ref MasterNodeDataCollector dataCollector, int reorder ) - { - int orderIndex = reorder; - switch ( m_tessType ) - { - case 0: - { - dataCollector.AddToIncludes( -1, TessellationOpHelper.TessInclude ); - if ( !m_hasCustomFunction ) - { - //Tess - dataCollector.AddToProperties( -1, string.Format( TessProperty, m_tessFactor ), orderIndex++ ); - dataCollector.AddToUniforms( -1, "uniform " + UIUtils.PrecisionWirePortToCgType( PrecisionType.Float, WirePortDataType.FLOAT ) + " " + TessUniformName + ";" ); - - //Min - dataCollector.AddToProperties( -1, string.Format( TessMinProperty, m_tessMinDistance ), orderIndex++ ); - dataCollector.AddToUniforms( -1, "uniform " + UIUtils.PrecisionWirePortToCgType( PrecisionType.Float, WirePortDataType.FLOAT ) + " " + TessMinUniformName + ";" ); - - //Max - dataCollector.AddToProperties( -1, string.Format( TessMaxProperty, m_tessMaxDistance ), orderIndex++ ); - dataCollector.AddToUniforms( -1, "uniform " + UIUtils.PrecisionWirePortToCgType( PrecisionType.Float, WirePortDataType.FLOAT ) + " " + TessMaxUniformName + ";" ); - } - } - break; - case 1: - { - //Tess - if ( !m_hasCustomFunction ) - { - dataCollector.AddToProperties( -1, string.Format( TessProperty, m_tessFactor ), orderIndex++ ); - dataCollector.AddToUniforms( -1, "uniform " + UIUtils.PrecisionWirePortToCgType( PrecisionType.Float, WirePortDataType.FLOAT ) + " " + TessUniformName + ";" ); - } - } - break; - case 2: - { - dataCollector.AddToIncludes( -1, TessellationOpHelper.TessInclude ); - - //Tess - if ( !m_hasCustomFunction ) - { - dataCollector.AddToProperties( -1, string.Format( EdgeLengthTessProperty, m_tessFactor ), orderIndex++ ); - dataCollector.AddToUniforms( -1, "uniform " + UIUtils.PrecisionWirePortToCgType( PrecisionType.Float, WirePortDataType.FLOAT ) + " " + EdgeLengthTessUniformName + ";" ); - } - } - break; - case 3: - { - dataCollector.AddToIncludes( -1, TessellationOpHelper.TessInclude ); - - if ( !m_hasCustomFunction ) - { - //Tess - dataCollector.AddToProperties( -1, string.Format( EdgeLengthTessProperty, m_tessFactor ), orderIndex++ ); - dataCollector.AddToUniforms( -1, "uniform " + UIUtils.PrecisionWirePortToCgType( PrecisionType.Float, WirePortDataType.FLOAT ) + " " + EdgeLengthTessUniformName + ";" ); - - //Max Displacement - dataCollector.AddToProperties( -1, string.Format( EdgeLengthTessMaxDispProperty, m_tessMaxDistance ), orderIndex++ ); - dataCollector.AddToUniforms( -1, "uniform " + UIUtils.PrecisionWirePortToCgType( PrecisionType.Float, WirePortDataType.FLOAT ) + " " + EdgeLengthTessMaxDispUniformName + ";" ); - } - } - break; - } - - if ( m_phongEnabled ) - { - dataCollector.AddToProperties( -1, string.Format( PhongStrengthProperty, m_phongStrength ), orderIndex++ ); - dataCollector.AddToUniforms( -1, "uniform " + UIUtils.PrecisionWirePortToCgType( PrecisionType.Float, WirePortDataType.FLOAT ) + " " + PhongStrengthUniformName + ";" ); - } - } - - //ToDo: Optimize material property fetches to use Id instead of string - public void UpdateFromMaterial( Material mat ) - { - if ( m_enabled ) - { - if ( m_phongEnabled ) - { - if ( mat.HasProperty( PhongStrengthUniformName ) ) - m_phongStrength = mat.GetFloat( PhongStrengthUniformName ); - } - - switch ( m_tessType ) - { - case 0: - { - if ( mat.HasProperty( TessUniformName ) ) - m_tessFactor = mat.GetFloat( TessUniformName ); - - if ( mat.HasProperty( TessMinUniformName ) ) - m_tessMinDistance = mat.GetFloat( TessMinUniformName ); - - if ( mat.HasProperty( TessMaxUniformName ) ) - m_tessMaxDistance = mat.GetFloat( TessMaxUniformName ); - } - break; - case 1: - { - if ( mat.HasProperty( TessUniformName ) ) - m_tessFactor = mat.GetFloat( TessUniformName ); - } - break; - case 2: - { - if ( mat.HasProperty( EdgeLengthTessUniformName ) ) - m_tessFactor = mat.GetFloat( EdgeLengthTessUniformName ); - } - break; - case 3: - { - if ( mat.HasProperty( EdgeLengthTessUniformName ) ) - m_tessFactor = mat.GetFloat( EdgeLengthTessUniformName ); - - if ( mat.HasProperty( EdgeLengthTessMaxDispUniformName ) ) - m_tessMaxDistance = mat.GetFloat( EdgeLengthTessMaxDispUniformName ); - } - break; - } - } - } - - public void WriteToOptionalParams( ref string optionalParams ) - { - optionalParams += TessellationOpHelper.TessSurfParam + Constants.OptionalParametersSep; - if ( m_phongEnabled ) - { - optionalParams += TessellationOpHelper.PhongStrengthParam + Constants.OptionalParametersSep; - } - } - - public void Reset() - { - m_hasCustomFunction = false; - m_customFunction = string.Empty; - - m_additionalData = string.Empty; - m_additionalDataDict.Clear(); - switch ( m_tessType ) - { - case 0: - { - m_customData[ 0 ] = TessUniformName; - m_customData[ 1 ] = TessMinUniformName; - m_customData[ 2 ] = TessMaxUniformName; - } - break; - case 1: - { - m_customData[ 0 ] = TessUniformName; - m_customData[ 1 ] = string.Empty; - m_customData[ 2 ] = string.Empty; - } - break; - case 2: - { - m_customData[ 0 ] = EdgeLengthTessUniformName; - m_customData[ 1 ] = string.Empty; - m_customData[ 2 ] = string.Empty; - } - break; - case 3: - { - m_customData[ 0 ] = EdgeLengthTessUniformName; - m_customData[ 1 ] = EdgeLengthTessMaxDispUniformName; - m_customData[ 2 ] = string.Empty; - } - break; - } - } - - public string GetCurrentTessellationFunction - { - get - { - if ( m_hasCustomFunction ) - { - return TessFunctionOpen + - m_customFunction + - TessFunctionClose; - } - - string tessFunction = string.Empty; - switch ( m_tessType ) - { - case 0: - { - tessFunction = TessFunctionOpen + - DistBasedTessFunctionBody + - TessFunctionClose; - } - break; - case 1: - { - tessFunction = FixedAmountTessFunctionOpen + - FixedAmountTessFunctionBody + - TessFunctionClose; - } - break; - case 2: - { - tessFunction = TessFunctionOpen + - EdgeLengthTessFunctionBody + - TessFunctionClose; - } - break; - case 3: - { - tessFunction = TessFunctionOpen + - EdgeLengthTessCullFunctionBody + - TessFunctionClose; - } - break; - } - return tessFunction; - } - } - - public void AddAdditionalData( string data ) - { - if ( !m_additionalDataDict.ContainsKey( data ) ) - { - m_additionalDataDict.Add( data, true ); - m_additionalData += data; - } - } - - public void AddCustomFunction( string returnData ) - { - m_hasCustomFunction = true; - m_customFunction = m_additionalData + string.Format( CustomFunctionBody, returnData ); - } - - public void Destroy() - { - m_additionalDataDict.Clear(); - m_additionalDataDict = null; - } - - public bool IsTessellationPort( int index ) - { - return index == m_masterNodeIndexPort; - } - - public bool EnableTesselation { get { return m_enabled; } } - - public int TessType { get { return m_tessType; } } - public int MasterNodeIndexPort - { - get { return m_masterNodeIndexPort; } - set { m_masterNodeIndexPort = value; } - } - public int VertexOffsetIndexPort - { - get { return m_vertexOffsetIndexPort; } - set { m_vertexOffsetIndexPort = value; } - } - - public StandardSurfaceOutputNode ParentSurface { get { return m_parentSurface; } set { m_parentSurface = value; } } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/TessellationOpHelper.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/TessellationOpHelper.cs.meta deleted file mode 100644 index c4400a8a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/TessellationOpHelper.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: c6fbad94b0fc6b948be3a3dc61232c05 -timeCreated: 1481126959 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/UsePassHelper.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/UsePassHelper.cs deleted file mode 100644 index d6e34adf..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/UsePassHelper.cs +++ /dev/null @@ -1,360 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; -using UnityEditor; -using UnityEditorInternal; - -namespace AmplifyShaderEditor -{ - public enum UsePassLocation - { - Above, - Below - } - - [Serializable] - public class UsePassItem : ScriptableObject - { - public UsePassLocation Location; - public string Value; - public UsePassItem() - { - Location = UsePassLocation.Above; - Value = string.Empty; - } - - public UsePassItem( UsePassLocation location, string name ) - { - Location = location; - Value = name; - } - - } - - [Serializable] - public class UsePassHelper : ScriptableObject - { - private const string UseGrabFormatNewLine = "UsePass \"{0}\"\n"; - private const string UseGrabFormat = "UsePass \"{0}\""; - private const float ShaderKeywordButtonLayoutWidth = 15; - private const string ShaderPoputContext = "CONTEXT/ShaderPopup"; - - [SerializeField] - private List<UsePassItem> m_items = new List<UsePassItem>(); - - [SerializeField] - private UndoParentNode m_owner = null; - - [SerializeField] - protected bool m_isDirty = false; - - [SerializeField] - protected string m_moduleName = string.Empty; - - private ReorderableList m_reordableList = null; - private ReordableAction m_actionType = ReordableAction.None; - private int m_actionIndex = 0; - private GUIStyle m_propertyAdjustment; - - private Material m_dummyMaterial; - private MenuCommand m_dummyCommand; - private int m_currentUsePassIdx = 0; - - public void Init( string moduleName ) - { - hideFlags = HideFlags.HideAndDontSave; - m_moduleName = moduleName; - } - - void DrawButtons() - { - EditorGUILayout.Separator(); - - // Add keyword - if( GUILayout.Button( string.Empty, UIUtils.PlusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) - { - UsePassItem newItem = ScriptableObject.CreateInstance<UsePassItem>(); - newItem.hideFlags = HideFlags.HideAndDontSave; - m_items.Add( newItem ); - EditorGUI.FocusTextInControl( null ); - m_isDirty = true; - } - - //Remove keyword - if( GUILayout.Button( string.Empty, UIUtils.MinusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) - { - if( m_items.Count > 0 ) - { - UsePassItem itemToDelete = m_items[ m_items.Count - 1 ]; - m_items.RemoveAt( m_items.Count - 1 ); - ScriptableObject.DestroyImmediate( itemToDelete ); - EditorGUI.FocusTextInControl( null ); - } - m_isDirty = true; - } - } - - public void Draw( UndoParentNode owner, bool style = true ) - { - if( m_owner == null ) - m_owner = owner; - - if( m_reordableList == null ) - { - m_reordableList = new ReorderableList( m_items, typeof( UsePassItem ), true, false, false, false ) - { - headerHeight = 0, - footerHeight = 0, - showDefaultBackground = false, - drawElementCallback = ( Rect rect, int index, bool isActive, bool isFocused ) => - { - if( m_items[ index ] != null ) - { - float labelWidthMultiplier; - float popUpWidth; - float shaderSelectorMultiplier; - float buttonPlusPosMultiplier; - if( style ) - { - rect.x -= 10; - labelWidthMultiplier = 0.9f; - popUpWidth = 0.31f; - shaderSelectorMultiplier = 1.01f; - buttonPlusPosMultiplier = 0.78f; - } - else - { - rect.x -= 1; - labelWidthMultiplier = 1.01f; - popUpWidth = 0.25f; - shaderSelectorMultiplier = 1.0f; - buttonPlusPosMultiplier = 0.55f; - } - - Rect popupPos = new Rect( rect.x, rect.y + 2, popUpWidth * rect.width, rect.height ); - Rect labelPos = new Rect( rect.x + popupPos.width * labelWidthMultiplier, rect.y, 0.59f * rect.width, rect.height ); - - Rect shaderSelectorPos = new Rect( labelPos.x + labelPos.width* shaderSelectorMultiplier, rect.y, 15, rect.height ); - - Rect buttonPlusPos = new Rect( shaderSelectorPos.x + shaderSelectorPos.width * buttonPlusPosMultiplier, rect.y, ShaderKeywordButtonLayoutWidth, rect.height ); - Rect buttonMinusPos = new Rect( buttonPlusPos.x + buttonPlusPos.width, rect.y, ShaderKeywordButtonLayoutWidth, rect.height ); - - EditorGUI.BeginChangeCheck(); - m_items[ index ].Location = (UsePassLocation)owner.EditorGUIEnumPopup( popupPos, m_items[ index ].Location ); - - if( EditorGUI.EndChangeCheck() && m_items[ index ].Location == UsePassLocation.Below && m_owner != null && m_owner.ContainerGraph.CurrentCanvasMode == NodeAvailability.TemplateShader ) - { - m_items[ index ].Location = UsePassLocation.Above; - UIUtils.ShowMessage( "Below option still not available on templates" ); - } - m_items[ index ].Value = owner.EditorGUITextField( labelPos, string.Empty, m_items[ index ].Value ); - - if( GUI.Button( shaderSelectorPos, string.Empty, UIUtils.InspectorPopdropdownFallback ) ) - { - EditorGUI.FocusTextInControl( null ); - GUI.FocusControl( null ); - m_currentUsePassIdx = index; - DisplayShaderContext( owner, GUILayoutUtility.GetRect( GUIContent.none, EditorStyles.popup ) ); - } - - if( GUI.Button( buttonPlusPos, string.Empty, UIUtils.PlusStyle ) ) - { - m_actionType = ReordableAction.Add; - m_actionIndex = index; - } - - if( GUI.Button( buttonMinusPos, string.Empty, UIUtils.MinusStyle ) ) - { - m_actionType = ReordableAction.Remove; - m_actionIndex = index; - } - } - } - }; - } - - if( m_actionType != ReordableAction.None ) - { - switch( m_actionType ) - { - case ReordableAction.Add: - UsePassItem newItem = ScriptableObject.CreateInstance<UsePassItem>(); - newItem.hideFlags = HideFlags.HideAndDontSave; - m_items.Insert( m_actionIndex + 1, newItem ); - break; - case ReordableAction.Remove: - UsePassItem itemToDelete = m_items[ m_actionIndex ]; - m_items.RemoveAt( m_actionIndex ); - ScriptableObject.DestroyImmediate( itemToDelete ); - break; - } - m_isDirty = true; - m_actionType = ReordableAction.None; - EditorGUI.FocusTextInControl( null ); - } - bool foldoutValue = owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedUsePass; - if( style ) - { - NodeUtils.DrawPropertyGroup( ref foldoutValue, m_moduleName, DrawReordableList, DrawButtons ); - } - else - { - NodeUtils.DrawNestedPropertyGroup( ref foldoutValue, m_moduleName, DrawReordableList, DrawButtons ); - } - owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedUsePass = foldoutValue; - } - - private void DisplayShaderContext( UndoParentNode node, Rect r ) - { - if( m_dummyCommand == null ) - m_dummyCommand = new MenuCommand( this, 0 ); - - if( m_dummyMaterial == null ) - m_dummyMaterial = new Material( Shader.Find( "Hidden/ASESShaderSelectorUnlit" ) ); - -#pragma warning disable 0618 - UnityEditorInternal.InternalEditorUtility.SetupShaderMenu( m_dummyMaterial ); -#pragma warning restore 0618 - EditorUtility.DisplayPopupMenu( r, ShaderPoputContext, m_dummyCommand ); - } - - private void OnSelectedShaderPopup( string command, Shader shader ) - { - if( shader != null ) - { - UIUtils.MarkUndoAction(); - Undo.RecordObject( m_owner, "Selected Use Pass shader" ); - m_items[ m_currentUsePassIdx ].Value = shader.name; - } - } - - void DrawReordableList() - { - if( m_reordableList != null ) - { - if( m_propertyAdjustment == null ) - { - m_propertyAdjustment = new GUIStyle(); - m_propertyAdjustment.padding.left = 17; - } - EditorGUILayout.Space(); - - if( m_items.Count == 0 ) - { - EditorGUILayout.HelpBox( "Your list is Empty!\nUse the plus button to add one.", MessageType.Info ); - } - else - { - m_reordableList.DoLayoutList(); - } - EditorGUILayout.Space(); - } - } - - public void ReadFromString( ref uint index, ref string[] nodeParams ) - { - try - { - int count = Convert.ToInt32( nodeParams[ index++ ] ); - for( int i = 0; i < count; i++ ) - { - string locationValue = nodeParams[ index++ ]; - // REMOVE THIS TEST AFTER A COUPLE OF VERSIONS (curr v1.5.6 r02) - if( locationValue.Equals( "Bellow" ) ) locationValue = "Below"; - - UsePassLocation location = (UsePassLocation)Enum.Parse( typeof( UsePassLocation ), locationValue ); - string name = nodeParams[ index++ ]; - UsePassItem newItem = ScriptableObject.CreateInstance<UsePassItem>(); - newItem.hideFlags = HideFlags.HideAndDontSave; - newItem.Location = location; - newItem.Value = name; - m_items.Add( newItem ); - } - } - catch( Exception e ) - { - Debug.LogException( e ); - } - } - - public void WriteToString( ref string nodeInfo ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_items.Count ); - for( int i = 0; i < m_items.Count; i++ ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_items[ i ].Location ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_items[ i ].Value ); - } - } - - public void BuildUsePassInfo( MasterNodeDataCollector dataCollector, ref string aboveItems, ref string bellowItems, string tabs) - { - int count = 0; - count = dataCollector.AboveUsePassesList.Count; - for( int i = 0; i < count; i++ ) - { - aboveItems += tabs + string.Format( UseGrabFormatNewLine, dataCollector.AboveUsePassesList[ i ].PropertyName ); - } - - count = dataCollector.BelowUsePassesList.Count; - for( int i = 0; i < count; i++ ) - { - bellowItems += tabs + string.Format( UseGrabFormatNewLine, dataCollector.BelowUsePassesList[ i ].PropertyName ); - } - - count = m_items.Count; - for( int i = 0; i < count; i++ ) - { - if( m_items[ i ].Location == UsePassLocation.Above ) - { - aboveItems += tabs + string.Format( UseGrabFormatNewLine, m_items[ i ].Value ); - } - else - { - bellowItems += tabs + string.Format( UseGrabFormatNewLine, m_items[ i ].Value ); - } - } - } - - public void BuildUsePassInfo( MasterNodeDataCollector dataCollector, ref List<PropertyDataCollector> aboveItems, ref List<PropertyDataCollector> bellowItems ) - { - int count = 0; - count = dataCollector.AboveUsePassesList.Count; - for( int i = 0; i < count; i++ ) - { - aboveItems.Add( new PropertyDataCollector( -1, string.Format( UseGrabFormat, dataCollector.AboveUsePassesList[ i ].PropertyName ) ) ); - } - - count = dataCollector.BelowUsePassesList.Count; - for( int i = 0; i < count; i++ ) - { - bellowItems.Add( new PropertyDataCollector( -1, string.Format( UseGrabFormat, dataCollector.BelowUsePassesList[ i ].PropertyName ) ) ); - } - - - count = m_items.Count; - for( int i = 0; i < count; i++ ) - { - if( m_items[ i ].Location == UsePassLocation.Above ) - { - aboveItems.Add( new PropertyDataCollector(-1,string.Format( UseGrabFormat, m_items[ i ].Value ))); - } - else - { - bellowItems.Add( new PropertyDataCollector( -1, string.Format( UseGrabFormat, m_items[ i ].Value ) ) ); - } - } - } - - //public string ModuleName { set { m_moduleName = value; } } - public void Destroy() - { - m_owner = null; - m_items.Clear(); - m_items = null; - m_reordableList = null; - m_dummyMaterial = null; - m_dummyCommand = null; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/UsePassHelper.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/UsePassHelper.cs.meta deleted file mode 100644 index ddf906c5..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/UsePassHelper.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: d818a147712609646b8d6f0f7c2ae731 -timeCreated: 1530179906 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/ZBufferOpHelper.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/ZBufferOpHelper.cs deleted file mode 100644 index d09b8c04..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/ZBufferOpHelper.cs +++ /dev/null @@ -1,272 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; -using UnityEditor; - -namespace AmplifyShaderEditor -{ - public enum ZWriteMode - { - On, - Off - } - - public enum ZTestMode - { - Less, - Greater, - LEqual, - GEqual, - Equal, - NotEqual, - Always - } - - [Serializable] - class ZBufferOpHelper - { - public static readonly string DepthParametersStr = " Depth"; - public static readonly string ZWriteModeStr = "ZWrite Mode"; - public static readonly string ZTestModeStr = "ZTest Mode"; - public static readonly string OffsetStr = "Offset"; - public static readonly string OffsetFactorStr = "Factor"; - public static readonly string OffsetUnitsStr = "Units"; - private const string ExtraDepthPassStr = "Extra Depth Pass"; - private const string DepthZTestStr = "Depth ZTest"; - - public static readonly string[] ZTestModeLabels = - { - "<Default>", - "Less", - "Greater", - "Less or Equal", - "Greater or Equal", - "Equal", - "Not Equal", - "Always" - }; - - public static readonly string[] ZTestModeValues = - { - "<Default>", - "Less", - "Greater", - "LEqual", - "GEqual", - "Equal", - "NotEqual", - "Always" - }; - - public static readonly string[] ZWriteModeValues = - { - "<Default>", - "On", - "Off" - }; - - public static readonly Dictionary<ZTestMode, int> ZTestModeDict = new Dictionary<ZTestMode, int> - { - {ZTestMode.Less,1 }, - {ZTestMode.Greater,2}, - {ZTestMode.LEqual,3}, - {ZTestMode.GEqual,4}, - {ZTestMode.Equal,5}, - {ZTestMode.NotEqual,6}, - {ZTestMode.Always,7} - }; - - public static readonly Dictionary<ZWriteMode, int> ZWriteModeDict = new Dictionary<ZWriteMode, int> - { - { ZWriteMode.On,1}, - { ZWriteMode.Off,2} - }; - - - [SerializeField] - private InlineProperty m_zTestMode = new InlineProperty(); - - [SerializeField] - private InlineProperty m_zWriteMode = new InlineProperty(); - [SerializeField] - private InlineProperty m_offsetFactor = new InlineProperty(); - - [SerializeField] - private InlineProperty m_offsetUnits = new InlineProperty(); - - [SerializeField] - private bool m_offsetEnabled; - - [SerializeField] - private bool m_extraDepthPass; - - [SerializeField] - private int m_extrazTestMode = 0; - - [SerializeField] - private StandardSurfaceOutputNode m_parentSurface; - - public string CreateDepthInfo( bool outlineZWrite, bool outlineZTest ) - { - string result = string.Empty; - if( m_zWriteMode.IntValue != 0 || m_zWriteMode.Active ) - { - MasterNode.AddRenderState( ref result, "ZWrite", m_zWriteMode.GetValueOrProperty( ZWriteModeValues[ m_zWriteMode.IntValue ] ) ); - } - else if( outlineZWrite ) - { - MasterNode.AddRenderState( ref result, "ZWrite", ZWriteModeValues[ 1 ] ); - } - - if( m_zTestMode.IntValue != 0 || m_zTestMode.Active ) - { - MasterNode.AddRenderState( ref result, "ZTest", m_zTestMode.GetValueOrProperty( ZTestModeValues[ m_zTestMode.IntValue ] ) ); - } - else if( outlineZTest ) - { - MasterNode.AddRenderState( ref result, "ZTest", ZTestModeValues[ 3 ] ); - } - - if( m_offsetEnabled ) - { - MasterNode.AddRenderState( ref result, "Offset ", m_offsetFactor.GetValueOrProperty() + " , " + m_offsetUnits.GetValueOrProperty() ); - } - - return result; - } - - public void Draw( UndoParentNode owner, GUIStyle toolbarstyle, bool customBlendAvailable ) - { - Color cachedColor = GUI.color; - GUI.color = new Color( cachedColor.r, cachedColor.g, cachedColor.b, 0.5f ); - EditorGUILayout.BeginHorizontal( toolbarstyle ); - GUI.color = cachedColor; - EditorGUI.BeginChangeCheck(); - m_parentSurface.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedDepth = owner.GUILayoutToggle( m_parentSurface.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedDepth, DepthParametersStr, UIUtils.MenuItemToggleStyle ); - if( EditorGUI.EndChangeCheck() ) - { - EditorPrefs.SetBool( "ExpandedDepth", m_parentSurface.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedDepth ); - } - EditorGUILayout.EndHorizontal(); - - if( m_parentSurface.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedDepth ) - { - cachedColor = GUI.color; - GUI.color = new Color( cachedColor.r, cachedColor.g, cachedColor.b, ( EditorGUIUtility.isProSkin ? 0.5f : 0.25f ) ); - EditorGUILayout.BeginVertical( UIUtils.MenuItemBackgroundStyle ); - GUI.color = cachedColor; - - EditorGUI.indentLevel++; - if( !customBlendAvailable ) - EditorGUILayout.HelpBox( "Depth Writing is only available for Opaque or Custom blend modes", MessageType.Warning ); - - EditorGUILayout.Separator(); - EditorGUI.BeginDisabledGroup( !customBlendAvailable ); - - m_zWriteMode.EnumTypePopup( ref owner, ZWriteModeStr, ZWriteModeValues ); - m_zTestMode.EnumTypePopup( ref owner, ZTestModeStr, ZTestModeLabels ); - //m_zWriteMode = owner.EditorGUILayoutPopup( ZWriteModeStr, m_zWriteMode, ZWriteModeValues ); - //m_zTestMode = owner.EditorGUILayoutPopup( ZTestModeStr, m_zTestMode, ZTestModeLabels ); - m_offsetEnabled = owner.EditorGUILayoutToggle( OffsetStr, m_offsetEnabled ); - if( m_offsetEnabled ) - { - EditorGUI.indentLevel++; - m_offsetFactor.FloatField( ref owner , OffsetFactorStr ); - m_offsetUnits.FloatField( ref owner , OffsetUnitsStr ); - EditorGUI.indentLevel--; - } - - m_extraDepthPass = owner.EditorGUILayoutToggle( ExtraDepthPassStr, m_extraDepthPass ); - if( m_extraDepthPass ) - { - EditorGUI.indentLevel++; - m_extrazTestMode = owner.EditorGUILayoutPopup( DepthZTestStr, m_extrazTestMode, ZTestModeLabels ); - EditorGUI.indentLevel--; - } - EditorGUILayout.Separator(); - EditorGUI.indentLevel--; - EditorGUI.EndDisabledGroup(); - EditorGUILayout.EndVertical(); - } - - EditorGUI.EndDisabledGroup(); - } - - public void DrawExtraDepthPass( ref string shaderBody ) - { - if( m_extraDepthPass ) - { - shaderBody += "\t\tPass\n"; - shaderBody += "\t\t{\n"; - shaderBody += "\t\t\tColorMask 0\n"; - if( m_extrazTestMode != 0 ) - shaderBody += "\t\t\tZTest " + ZTestModeValues[ m_extrazTestMode ] + "\n"; - shaderBody += "\t\t\tZWrite On\n"; - shaderBody += "\t\t}\n\n"; - } - } - - public void ReadFromString( ref uint index, ref string[] nodeParams ) - { - if( UIUtils.CurrentShaderVersion() < 2502 ) - { - string zWriteMode = nodeParams[ index++ ]; - m_zWriteMode.IntValue = zWriteMode.Equals( "Off" ) ? 2 : 0; - - string zTestMode = nodeParams[ index++ ]; - for( int i = 0; i < ZTestModeValues.Length; i++ ) - { - if( zTestMode.Equals( ZTestModeValues[ i ] ) ) - { - m_zTestMode.IntValue = i; - break; - } - } - } - else - { - if( UIUtils.CurrentShaderVersion() > 14501 ) - { - m_zWriteMode.ReadFromString( ref index, ref nodeParams ); - m_zTestMode.ReadFromString( ref index, ref nodeParams ); - } - else - { - m_zWriteMode.IntValue = Convert.ToInt32( nodeParams[ index++ ] ); - m_zTestMode.IntValue = Convert.ToInt32( nodeParams[ index++ ] ); - } - m_offsetEnabled = Convert.ToBoolean( nodeParams[ index++ ] ); - - if( UIUtils.CurrentShaderVersion() > 15303 ) - { - m_offsetFactor.ReadFromString( ref index, ref nodeParams ); - m_offsetUnits.ReadFromString( ref index, ref nodeParams ); - } - else - { - m_offsetFactor.FloatValue = Convert.ToSingle( nodeParams[ index++ ] ); - m_offsetUnits.FloatValue = Convert.ToSingle( nodeParams[ index++ ] ); - } - - if( UIUtils.CurrentShaderVersion() > 14202 ) - { - m_extraDepthPass = Convert.ToBoolean( nodeParams[ index++ ] ); - m_extrazTestMode = Convert.ToInt32( nodeParams[ index++ ] ); - } - } - } - - public void WriteToString( ref string nodeInfo ) - { - m_zWriteMode.WriteToString( ref nodeInfo ); - m_zTestMode.WriteToString( ref nodeInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_offsetEnabled ); - m_offsetFactor.WriteToString( ref nodeInfo ); - m_offsetUnits.WriteToString( ref nodeInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_extraDepthPass ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_extrazTestMode ); - } - public bool IsActive { get { return m_zTestMode.IntValue != 0 || m_zWriteMode.IntValue != 0 || m_offsetEnabled || m_zTestMode.Active || m_zWriteMode.Active; } } - public StandardSurfaceOutputNode ParentSurface { get { return m_parentSurface; } set { m_parentSurface = value; } } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/ZBufferOpHelper.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/ZBufferOpHelper.cs.meta deleted file mode 100644 index edee7bf1..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Master/ZBufferOpHelper.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: f35a3e26a28596b4f9b54a1f2689db06 -timeCreated: 1481126960 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc.meta deleted file mode 100644 index ae40b7c9..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 6371d71bb076e1d47a3854adc59fdb93 -folderAsset: yes -timeCreated: 1481126945 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/AppendNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/AppendNode.cs deleted file mode 100644 index 6318614b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/AppendNode.cs +++ /dev/null @@ -1,254 +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( "[Old]Append", "Vector Operators", "Append channels to create a new component",null,KeyCode.V,true,true,"Append",typeof(DynamicAppendNode))] - public sealed class AppendNode : ParentNode - { - private const string OutputTypeStr = "Output type"; - - [SerializeField] - private WirePortDataType m_selectedOutputType = WirePortDataType.FLOAT4; - - [SerializeField] - private int m_selectedOutputTypeInt = 2; - - [SerializeField] - private float[] m_defaultValues = { 0, 0, 0, 0 }; - private string[] m_defaultValuesStr = { "[0]", "[1]", "[2]", "[3]" }; - - private readonly string[] m_outputValueTypes ={ "Vector2", - "Vector3", - "Vector4", - "Color"}; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT, false, "[0]" ); - AddInputPort( WirePortDataType.FLOAT, false, "[1]" ); - AddInputPort( WirePortDataType.FLOAT, false, "[2]" ); - AddInputPort( WirePortDataType.FLOAT, false, "[3]" ); - AddOutputPort( m_selectedOutputType, Constants.EmptyPortValue ); - m_textLabelWidth = 90; - m_autoWrapProperties = true; - m_previewShaderGUID = "d80ac81aabf643848a4eaa76f2f88d65"; - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - - if ( m_dropdownEditing ) - { - EditorGUI.BeginChangeCheck(); - m_selectedOutputTypeInt = EditorGUIPopup( m_dropdownRect, m_selectedOutputTypeInt, m_outputValueTypes, UIUtils.PropertyPopUp ); - if ( EditorGUI.EndChangeCheck() ) - { - SetupPorts(); - DropdownEditing = false; - } - } - } - - void SetupPorts() - { - switch ( m_selectedOutputTypeInt ) - { - case 0: m_selectedOutputType = WirePortDataType.FLOAT2; break; - case 1: m_selectedOutputType = WirePortDataType.FLOAT3; break; - case 2: m_selectedOutputType = WirePortDataType.FLOAT4; break; - case 3: m_selectedOutputType = WirePortDataType.COLOR; break; - } - - UpdatePorts(); - } - - public override void DrawProperties() - { - base.DrawProperties(); - EditorGUILayout.BeginVertical(); - - EditorGUI.BeginChangeCheck(); - m_selectedOutputTypeInt = EditorGUILayoutPopup( OutputTypeStr, m_selectedOutputTypeInt, m_outputValueTypes ); - if ( EditorGUI.EndChangeCheck() ) - { - SetupPorts(); - } - - int count = 0; - switch ( m_selectedOutputType ) - { - case WirePortDataType.FLOAT4: - case WirePortDataType.COLOR: - { - count = 4; - } - break; - case WirePortDataType.FLOAT3: - { - count = 3; - } - break; - case WirePortDataType.FLOAT2: - { - count = 2; - } - break; - case WirePortDataType.OBJECT: - case WirePortDataType.FLOAT: - case WirePortDataType.INT: - case WirePortDataType.FLOAT3x3: - case WirePortDataType.FLOAT4x4: - { } - break; - } - - for ( int i = 0; i < count; i++ ) - { - if ( !m_inputPorts[ i ].IsConnected ) - m_defaultValues[ i ] = EditorGUILayoutFloatField( m_defaultValuesStr[ i ], m_defaultValues[ i ] ); - } - - EditorGUILayout.EndVertical(); - } - void UpdatePorts() - { - m_sizeIsDirty = true; - ChangeOutputType( m_selectedOutputType, false ); - switch ( m_selectedOutputType ) - { - case WirePortDataType.FLOAT4: - case WirePortDataType.OBJECT: - case WirePortDataType.COLOR: - { - m_inputPorts[ 0 ].Visible = true; - m_inputPorts[ 1 ].Visible = true; - m_inputPorts[ 2 ].Visible = true; - m_inputPorts[ 3 ].Visible = true; - } - break; - case WirePortDataType.FLOAT3: - { - m_inputPorts[ 0 ].Visible = true; - m_inputPorts[ 1 ].Visible = true; - m_inputPorts[ 2 ].Visible = true; - m_inputPorts[ 3 ].Visible = false; - if ( m_inputPorts[ 3 ].IsConnected ) - UIUtils.DeleteConnection( true, UniqueId, 3, false, true ); - } - break; - case WirePortDataType.FLOAT2: - { - m_inputPorts[ 0 ].Visible = true; - m_inputPorts[ 1 ].Visible = true; - m_inputPorts[ 2 ].Visible = false; - if ( m_inputPorts[ 2 ].IsConnected ) - UIUtils.DeleteConnection( true, UniqueId, 2, false, true ); - - m_inputPorts[ 3 ].Visible = false; - if ( m_inputPorts[ 3 ].IsConnected ) - UIUtils.DeleteConnection( true, UniqueId, 3, false, true ); - } - break; - case WirePortDataType.FLOAT: - case WirePortDataType.INT: - case WirePortDataType.FLOAT3x3: - case WirePortDataType.FLOAT4x4: - { } - 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 value = string.Empty; - switch ( m_selectedOutputType ) - { - case WirePortDataType.FLOAT4: - case WirePortDataType.OBJECT: - case WirePortDataType.COLOR: - { - value = "float4( "; - for ( int i = 0; i < 4; i++ ) - { - value += m_inputPorts[ i ].IsConnected ? InputPorts[ i ].GenerateShaderForOutput( ref dataCollector, WirePortDataType.FLOAT, ignoreLocalVar, true ) : m_defaultValues[ i ].ToString(); - if ( i != 3 ) - value += " , "; - } - value += " )"; - } - break; - case WirePortDataType.FLOAT3: - { - value = "float3( "; - for ( int i = 0; i < 3; i++ ) - { - value += m_inputPorts[ i ].IsConnected ? InputPorts[ i ].GenerateShaderForOutput( ref dataCollector, WirePortDataType.FLOAT, ignoreLocalVar, true ) : m_defaultValues[ i ].ToString(); - if ( i != 2 ) - value += " , "; - } - value += " )"; - } - break; - case WirePortDataType.FLOAT2: - { - value = "float2( "; - for ( int i = 0; i < 2; i++ ) - { - value += m_inputPorts[ i ].IsConnected ? InputPorts[ i ].GenerateShaderForOutput( ref dataCollector, WirePortDataType.FLOAT, ignoreLocalVar, true ) : m_defaultValues[ i ].ToString(); - if ( i != 1 ) - value += " , "; - } - value += " )"; - } - break; - case WirePortDataType.FLOAT: - case WirePortDataType.INT: - case WirePortDataType.FLOAT3x3: - case WirePortDataType.FLOAT4x4: - { } - break; - } - - RegisterLocalVariable( 0, value, ref dataCollector, "appendResult" + OutputId ); - return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - m_selectedOutputType = ( WirePortDataType ) Enum.Parse( typeof( WirePortDataType ), GetCurrentParam( ref nodeParams ) ); - switch ( m_selectedOutputType ) - { - case WirePortDataType.FLOAT2: m_selectedOutputTypeInt = 0; break; - case WirePortDataType.FLOAT3: m_selectedOutputTypeInt = 1; break; - case WirePortDataType.FLOAT4: m_selectedOutputTypeInt = 2; break; - case WirePortDataType.COLOR: m_selectedOutputTypeInt = 3; break; - } - for ( int i = 0; i < m_defaultValues.Length; i++ ) - { - m_defaultValues[ i ] = Convert.ToSingle( GetCurrentParam( ref nodeParams ) ); - } - UpdatePorts(); - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_selectedOutputType ); - for ( int i = 0; i < m_defaultValues.Length; i++ ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_defaultValues[ i ] ); - } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/AppendNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/AppendNode.cs.meta deleted file mode 100644 index bd513529..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/AppendNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 688412c534df41444ad49759fa2b6a62 -timeCreated: 1481126956 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/BreakToComponentsNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/BreakToComponentsNode.cs deleted file mode 100644 index 340ae384..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/BreakToComponentsNode.cs +++ /dev/null @@ -1,273 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using UnityEngine; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Break To Components", "Vector Operators", "Breaks the input data into its individual components", null, KeyCode.B, tags: "split" )] - public sealed class BreakToComponentsNode : ParentNode - { - private WirePortDataType m_currentType = WirePortDataType.FLOAT; - private readonly string[] ColorPortNames = { "R", "G", "B", "A" }; - private readonly string[] VectorPortNames = { "X", "Y", "Z", "W" }; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT, false, Constants.EmptyPortValue ); - for( int i = 0; i < 16; i++ ) - { - AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); - m_outputPorts[ i ].IndexPreviewOffset = 1; - if( i != 0 ) - { - m_outputPorts[ i ].Visible = false; - } - } - m_previewShaderGUID = "5f58f74a202ba804daddec838b75207d"; - } - - public override void RenderNodePreview() - { - //Runs at least one time - if( !m_initialized ) - { - // nodes with no preview don't update at all - PreviewIsDirty = false; - return; - } - - if( !PreviewIsDirty ) - return; - - SetPreviewInputs(); - - int count = m_outputPorts.Count; - for( int i = 0; i < count; i++ ) - { - RenderTexture temp = RenderTexture.active; - RenderTexture.active = m_outputPorts[ i ].OutputPreviewTexture; - Graphics.Blit( null, m_outputPorts[ i ].OutputPreviewTexture, PreviewMaterial, Mathf.Min( i, 3 ) ); - RenderTexture.active = temp; - } - - PreviewIsDirty = m_continuousPreviewRefresh; - } - - public override RenderTexture PreviewTexture - { - get - { - return m_inputPorts[ 0 ].InputPreviewTexture( ContainerGraph ); - } - } - - void UpdateOutputs( WirePortDataType newType ) - { - //this only happens when on initial load - if( newType == WirePortDataType.OBJECT ) - return; - - m_currentType = newType; - switch( newType ) - { - case WirePortDataType.OBJECT: - { - m_outputPorts[ 0 ].ChangeProperties( Constants.EmptyPortValue, WirePortDataType.OBJECT, false ); - m_outputPorts[ 0 ].Visible = true; - for( int i = 1; i < m_outputPorts.Count; i++ ) - { - m_outputPorts[ i ].Visible = false; - } - } - break; - case WirePortDataType.FLOAT: - { - m_outputPorts[ 0 ].ChangeProperties( Constants.EmptyPortValue, WirePortDataType.FLOAT, false ); - m_outputPorts[ 0 ].Visible = true; - for( int i = 1; i < m_outputPorts.Count; i++ ) - { - m_outputPorts[ i ].Visible = false; - } - } - break; - case WirePortDataType.FLOAT2: - { - for( int i = 0; i < 2; i++ ) - { - m_outputPorts[ i ].ChangeProperties( VectorPortNames[ i ], WirePortDataType.FLOAT, false ); - m_outputPorts[ i ].Visible = true; - } - for( int i = 2; i < m_outputPorts.Count; i++ ) - { - m_outputPorts[ i ].Visible = false; - } - } - break; - case WirePortDataType.FLOAT3: - { - for( int i = 0; i < 3; i++ ) - { - m_outputPorts[ i ].ChangeProperties( VectorPortNames[ i ], WirePortDataType.FLOAT, false ); - m_outputPorts[ i ].Visible = true; - } - for( int i = 3; i < m_outputPorts.Count; i++ ) - { - m_outputPorts[ i ].Visible = false; - } - } - break; - case WirePortDataType.FLOAT4: - { - for( int i = 0; i < 4; i++ ) - { - m_outputPorts[ i ].ChangeProperties( VectorPortNames[ i ], WirePortDataType.FLOAT, false ); - m_outputPorts[ i ].Visible = true; - } - for( int i = 4; i < m_outputPorts.Count; i++ ) - { - m_outputPorts[ i ].Visible = false; - } - } - break; - case WirePortDataType.FLOAT3x3: - { - for( int i = 0; i < 9; i++ ) - { - m_outputPorts[ i ].ChangeProperties( "[" + (int)( i / 3 ) + "][" + i % 3 + "]", WirePortDataType.FLOAT, false ); - m_outputPorts[ i ].Visible = true; - } - for( int i = 9; i < m_outputPorts.Count; i++ ) - { - m_outputPorts[ i ].Visible = false; - } - } - break; - case WirePortDataType.FLOAT4x4: - { - for( int i = 0; i < 16; i++ ) - { - m_outputPorts[ i ].ChangeProperties( "[" + (int)( i / 4 ) + "][" + i % 4 + "]", WirePortDataType.FLOAT, false ); - m_outputPorts[ i ].Visible = true; - } - } - break; - case WirePortDataType.COLOR: - { - for( int i = 0; i < 4; i++ ) - { - m_outputPorts[ i ].ChangeProperties( ColorPortNames[ i ], WirePortDataType.FLOAT, false ); - m_outputPorts[ i ].Visible = true; - } - for( int i = 4; i < m_outputPorts.Count; i++ ) - { - m_outputPorts[ i ].Visible = false; - } - } - break; - case WirePortDataType.INT: - { - m_outputPorts[ 0 ].Visible = true; - m_outputPorts[ 0 ].ChangeProperties( Constants.EmptyPortValue, WirePortDataType.INT, false ); - for( int i = 1; i < m_outputPorts.Count; i++ ) - { - m_outputPorts[ i ].Visible = false; - } - } - break; - } - m_sizeIsDirty = true; - } - - public override void OnConnectedOutputNodeChanges( int outputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) - { - base.OnConnectedOutputNodeChanges( outputPortId, otherNodeId, otherPortId, name, type ); - m_inputPorts[ 0 ].MatchPortToConnection(); - UpdateOutputs( m_inputPorts[ 0 ].DataType ); - } - - public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) - { - base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); - m_inputPorts[ 0 ].MatchPortToConnection(); - UpdateOutputs( m_inputPorts[ 0 ].DataType ); - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_currentType ); - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - UpdateOutputs( (WirePortDataType)Enum.Parse( typeof( WirePortDataType ), GetCurrentParam( ref nodeParams ) ) ); - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) - { - return ReturnByType( m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ), outputId ); - } - - string value = string.Empty; - value = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - - int channelsUsed = 0; - for( int i = 0; i < m_outputPorts.Count; i++ ) - { - if( m_outputPorts[ i ].IsConnected ) - channelsUsed++; - } - string varName = "break" + OutputId; - if( channelsUsed > 1 ) - { - //RegisterLocalVariable( 0, value, ref dataCollector, varName ); - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, m_inputPorts[ 0 ].DataType, varName, value ); - m_outputPorts[ 0 ].SetLocalValue( varName, dataCollector.PortCategory ); - - - value = varName; - } - - return ReturnByType( value, outputId ); - } - - private string ReturnByType( string value, int outputId ) - { - switch( m_inputPorts[ 0 ].DataType ) - { - case WirePortDataType.OBJECT: - case WirePortDataType.FLOAT: - case WirePortDataType.INT: - { - return value; - } - case WirePortDataType.FLOAT2: - case WirePortDataType.FLOAT3: - case WirePortDataType.FLOAT4: - { - return GetOutputVectorItem( 0, outputId + 1, value ); - } - case WirePortDataType.COLOR: - { - return GetOutputColorItem( 0, outputId + 1, value ); - } - case WirePortDataType.FLOAT3x3: - { - return value + "[ " + ( (int)( outputId / 3 ) ) + " ][ " + ( outputId % 3 ) + " ]"; - } - case WirePortDataType.FLOAT4x4: - { - return value + "[ " + ( (int)( outputId / 4 ) ) + " ][ " + ( outputId % 4 ) + " ]"; - } - } - return value; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/BreakToComponentsNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/BreakToComponentsNode.cs.meta deleted file mode 100644 index 34381d11..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/BreakToComponentsNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: a74e2c0a9306c0048bfcc733cb7d154d -timeCreated: 1481126958 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/CustomExpressionNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/CustomExpressionNode.cs deleted file mode 100644 index 4c792b7f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/CustomExpressionNode.cs +++ /dev/null @@ -1,1625 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using System.Collections.Generic; -using UnityEngine; -using UnityEditor; -using UnityEditorInternal; -using System.Text.RegularExpressions; - -namespace AmplifyShaderEditor -{ - public enum CustomExpressionMode - { - Create, - Call - } - - [Serializable] - public class CustomExpressionInputItem - { - public PrecisionType Precision; - public VariableQualifiers Qualifier; - public WirePortDataType Type; - public string CustomType; - public bool IsVariable; - public bool FoldoutFlag; - public string FoldoutLabel; - - public CustomExpressionInputItem( PrecisionType precision, VariableQualifiers qualifier, string customType, bool isVariable, bool foldoutFlag, string foldoutLabel ) - { - Precision = precision; - Qualifier = qualifier; - CustomType = customType; - FoldoutFlag = foldoutFlag; - FoldoutLabel = foldoutLabel; - IsVariable = isVariable; - } - } - - [Serializable] - public class CustomExpressionDependency - { - public int DependencyArrayIdx; - public int DependencyNodeId; - public CustomExpressionDependency() { DependencyArrayIdx = DependencyNodeId = -1; } - public CustomExpressionDependency( string id ) { DependencyNodeId = Convert.ToInt32( id ); DependencyArrayIdx = -1; } - public void Reset() - { - DependencyArrayIdx = -1; - DependencyNodeId = -1; - } - } - - [Serializable] - [NodeAttributes( "Custom Expression", "Miscellaneous", "Creates a custom expression or function if <b>return</b> is detected in the written code." )] - public sealed class CustomExpressionNode : ParentNode - { - private const float AddRemoveButtonLayoutWidth = 15; - private const float LineAdjust = 1.15f; - private const float IdentationAdjust = 5f; - private const string CustomExpressionInfo = "Creates a custom expression or function according to how code is written on text area.\n\n" + - " - If a return function is detected on Code text area then a function will be created.\n" + - "Also in function mode a ; is expected on the end of each instruction line.\n\n" + - "- If no return function is detected then an expression will be generated and used directly on the vertex/frag body.\n" + - "On Expression mode a ; is not required on the end of an instruction line."; - private const char LineFeedSeparator = '$'; - - private const string ReturnHelper = "return"; - private const double MaxTimestamp = 1; - private const string DefaultExpressionNameStr = "My Custom Expression"; - private const string DefaultInputNameStr = "In"; - private const string CodeTitleStr = "Code"; - private const string OutputTypeStr = "Output Type"; - private const string CustomTypeStr = " "; - private const string IsVariableStr = "Is Variable"; - private const string InputsStr = "Inputs"; - private const string InputNameStr = "Name"; - private const string InputTypeStr = "Type"; - private const string InputValueStr = "Value"; - private const string InputQualifierStr = "Qualifier"; - private const string ExpressionNameLabelStr = "Name"; - private const string FunctionCallModeStr = "Mode"; - private const string GenerateUniqueNameStr = "Set Unique"; - private const string AutoRegisterStr = "Auto-Register"; - private const string DependenciesStr = "Dependencies"; - - private const string VarRegexReplacer = @"\b{0}\b"; - private readonly string[] PrecisionLabelsExtraLocal = { "Float", "Half", "Inherit Local" }; - - private readonly string[] AvailableWireTypesStr = - { - "int", - "float", - "float2", - "float3", - "float4", - "float3x3", - "float4x4", - "sampler1D", - "sampler2D", - "sampler3D", - "samplerCUBE", - "custom"}; - - private readonly string[] AvailableOutputWireTypesStr = - { - "int", - "float", - "float2", - "float3", - "float4", - "float3x3", - "float4x4", - "void", - }; - - private readonly string[] QualifiersStr = - { - "In", - "Out", - "InOut" - }; - - private readonly WirePortDataType[] AvailableWireTypes = - { - WirePortDataType.INT, - WirePortDataType.FLOAT, - WirePortDataType.FLOAT2, - WirePortDataType.FLOAT3, - WirePortDataType.FLOAT4, - WirePortDataType.FLOAT3x3, - WirePortDataType.FLOAT4x4, - WirePortDataType.SAMPLER1D, - WirePortDataType.SAMPLER2D, - WirePortDataType.SAMPLER3D, - WirePortDataType.SAMPLERCUBE, - WirePortDataType.OBJECT - }; - - private readonly WirePortDataType[] AvailableOutputWireTypes = - { - WirePortDataType.INT, - WirePortDataType.FLOAT, - WirePortDataType.FLOAT2, - WirePortDataType.FLOAT3, - WirePortDataType.FLOAT4, - WirePortDataType.FLOAT3x3, - WirePortDataType.FLOAT4x4, - WirePortDataType.OBJECT, - }; - - - private readonly Dictionary<WirePortDataType, int> WireToIdx = new Dictionary<WirePortDataType, int> - { - { WirePortDataType.INT, 0}, - { WirePortDataType.FLOAT, 1}, - { WirePortDataType.FLOAT2, 2}, - { WirePortDataType.FLOAT3, 3}, - { WirePortDataType.FLOAT4, 4}, - { WirePortDataType.FLOAT3x3, 5}, - { WirePortDataType.FLOAT4x4, 6}, - { WirePortDataType.SAMPLER1D, 7}, - { WirePortDataType.SAMPLER2D, 8}, - { WirePortDataType.SAMPLER3D, 9}, - { WirePortDataType.SAMPLERCUBE, 10}, - { WirePortDataType.OBJECT, 11} - }; - - [SerializeField] - private string m_customExpressionName = DefaultExpressionNameStr; - - [SerializeField] - private List<CustomExpressionInputItem> m_items = new List<CustomExpressionInputItem>(); - - [SerializeField] - private string m_code = " "; - - [SerializeField] - private int m_outputTypeIdx = 1; - - [SerializeField] - private bool m_visibleInputsFoldout = true; - - [SerializeField] - private CustomExpressionMode m_mode = CustomExpressionMode.Create; - - [SerializeField] - private bool m_voidMode = false; - - [SerializeField] - private bool m_autoRegisterMode = false; - - [SerializeField] - private bool m_functionMode = false; - - [SerializeField] - private int m_firstAvailablePort = 0; - - [SerializeField] - private string m_uniqueName; - - [SerializeField] - private bool m_generateUniqueName = true; - - [SerializeField] - private bool m_dependenciesFoldout = false; - - [SerializeField] - private List<CustomExpressionDependency> m_dependencies = new List<CustomExpressionDependency>(); - - private const float ButtonLayoutWidth = 15; - - private bool m_repopulateNameDictionary = true; - private Dictionary<string, int> m_usedNames = new Dictionary<string, int>(); - - private double m_lastTimeNameModified = 0; - private bool m_nameModified = false; - - private double m_lastTimeCodeModified = 0; - private bool m_codeModified = false; - - //Title editing - private bool m_isEditing; - private bool m_stopEditing; - private bool m_startEditing; - private double m_clickTime; - private double m_doubleClickTime = 0.3; - private Rect m_titleClickArea; - - //Item Reordable List - private ReordableAction m_actionType = ReordableAction.None; - private int m_actionIndex = 0; - private int m_lastIndex = 0; - - private ReorderableList m_itemReordableList = null; - private ReorderableList m_dependenciesReordableList = null; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT, false, "In0" ); - m_items.Add( new CustomExpressionInputItem( PrecisionType.Inherit, VariableQualifiers.In, string.Empty, false, true, string.Empty/*"[0]"*/ ) ); - AddOutputPort( WirePortDataType.FLOAT, "Out" ); - m_textLabelWidth = 97; - m_customPrecision = true; - } - - protected override void OnUniqueIDAssigned() - { - base.OnUniqueIDAssigned(); - - if( m_mode == CustomExpressionMode.Create ) - UIUtils.CurrentWindow.OutsideGraph.CustomExpressionOnFunctionMode.AddNode( this ); - - SetTitleText( m_customExpressionName ); - - if( m_nodeAttribs != null ) - m_uniqueName = m_nodeAttribs.Name + OutputId; - else - m_uniqueName = "CustomExpression" + OutputId; - } - - public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) - { - base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); - CheckPortConnection( portId ); - } - - public override void OnConnectedOutputNodeChanges( int portId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) - { - base.OnConnectedOutputNodeChanges( portId, otherNodeId, otherPortId, name, type ); - CheckPortConnection( portId ); - } - - void CheckPortConnection( int portId ) - { - if( portId == 0 && ( m_mode == CustomExpressionMode.Call || m_voidMode ) ) - { - m_inputPorts[ 0 ].MatchPortToConnection(); - m_outputPorts[ 0 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); - } - } - - public override void OnNodeLogicUpdate( DrawInfo drawInfo ) - { - base.OnNodeLogicUpdate( drawInfo ); - if( m_nameModified ) - { - if( ( EditorApplication.timeSinceStartup - m_lastTimeNameModified ) > MaxTimestamp ) - { - m_nameModified = false; - m_sizeIsDirty = true; - m_repopulateNameDictionary = true; - } - } - - if( m_repopulateNameDictionary ) - { - m_repopulateNameDictionary = false; - m_usedNames.Clear(); - for( int i = 0; i < m_inputPorts.Count; i++ ) - { - m_usedNames.Add( m_inputPorts[ i ].Name, i ); - } - } - - if( m_codeModified ) - { - if( ( EditorApplication.timeSinceStartup - m_lastTimeCodeModified ) > MaxTimestamp ) - { - m_codeModified = false; - bool functionMode = m_code.Contains( ReturnHelper ); - if( functionMode != m_functionMode ) - { - m_functionMode = functionMode; - CheckCallMode(); - } - } - } - } - - bool CheckCallMode() - { - if( m_functionMode && m_mode == CustomExpressionMode.Call ) - { - Mode = CustomExpressionMode.Create; - m_outputTypeIdx = ( AvailableOutputWireTypesStr.Length - 1 ); - //m_outputPorts[ 0 ].ChangeType( AvailableOutputWireTypes[ m_outputTypeIdx ], false ); - m_outputPorts[ 0 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); - m_voidMode = true; - return true; - } - return false; - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - if( ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD3 ) - { - if( !m_isEditing && ( ( !ContainerGraph.ParentWindow.MouseInteracted && drawInfo.CurrentEventType == EventType.MouseDown && m_titleClickArea.Contains( drawInfo.MousePosition ) ) ) ) - { - if( ( EditorApplication.timeSinceStartup - m_clickTime ) < m_doubleClickTime ) - m_startEditing = true; - else - GUI.FocusControl( null ); - m_clickTime = EditorApplication.timeSinceStartup; - } - else if( m_isEditing && ( ( drawInfo.CurrentEventType == EventType.MouseDown && !m_titleClickArea.Contains( drawInfo.MousePosition ) ) || !EditorGUIUtility.editingTextField ) ) - { - m_stopEditing = true; - } - - if( m_isEditing || m_startEditing ) - { - EditorGUI.BeginChangeCheck(); - GUI.SetNextControlName( m_uniqueName ); - m_customExpressionName = EditorGUITextField( m_titleClickArea, string.Empty, m_customExpressionName, UIUtils.GetCustomStyle( CustomStyle.NodeTitle ) ); - if( EditorGUI.EndChangeCheck() ) - { - SetTimedUpdate( 2 ); - SetTitleText( m_customExpressionName ); - m_sizeIsDirty = true; - m_isDirty = true; - } - - if( m_startEditing ) - EditorGUI.FocusTextInControl( m_uniqueName ); - } - - if( drawInfo.CurrentEventType == EventType.Repaint ) - { - if( m_startEditing ) - { - m_startEditing = false; - m_isEditing = true; - } - - if( m_stopEditing ) - { - m_stopEditing = false; - m_isEditing = false; - GUI.FocusControl( null ); - } - } - } - } - - public override void OnNodeLayout( DrawInfo drawInfo ) - { - base.OnNodeLayout( drawInfo ); - m_titleClickArea = m_titlePos; - m_titleClickArea.height = Constants.NODE_HEADER_HEIGHT; - } - - public override void OnNodeRepaint( DrawInfo drawInfo ) - { - base.OnNodeRepaint( drawInfo ); - if( !m_isVisible ) - return; - - // Fixed Title ( only renders when not editing ) - if( !m_isEditing && !m_startEditing && ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD3 ) - { - GUI.Label( m_titleClickArea, m_content, UIUtils.GetCustomStyle( CustomStyle.NodeTitle ) ); - } - } - - public string GetFirstAvailableName() - { - string name = string.Empty; - for( int i = 0; i < m_inputPorts.Count + 1; i++ ) - { - name = DefaultInputNameStr + i; - if( !m_usedNames.ContainsKey( name ) ) - { - return name; - } - } - Debug.LogWarning( "Could not find valid name" ); - return string.Empty; - } - - public override void DrawProperties() - { - base.DrawProperties(); - NodeUtils.DrawPropertyGroup( ref m_propertiesFoldout, Constants.ParameterLabelStr, DrawBaseProperties ); - //NodeUtils.DrawPropertyGroup( ref m_visibleInputsFoldout, InputsStr, DrawInputs, DrawAddRemoveInputs ); - NodeUtils.DrawPropertyGroup( ref m_visibleInputsFoldout, InputsStr, DrawReordableInputs, DrawItemsAddRemoveInputs ); - - EditorGUILayout.HelpBox( CustomExpressionInfo, MessageType.Info ); - } - - string WrapCodeInFunction( bool isTemplate, string functionName, bool expressionMode ) - { - //Hack to be used util indent is properly used - int currIndent = UIUtils.ShaderIndentLevel; - UIUtils.ShaderIndentLevel = isTemplate ? 0 : 1; - - if( !isTemplate ) UIUtils.ShaderIndentLevel++; - - //string functionName = UIUtils.RemoveInvalidCharacters( m_customExpressionName ); - string returnType = ( m_mode == CustomExpressionMode.Call || m_voidMode ) ? "void" : UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, m_outputPorts[ 0 ].DataType ); - if( expressionMode ) - returnType = "inline " + returnType; - - string functionBody = UIUtils.ShaderIndentTabs + returnType + " " + functionName + "( "; - int count = m_inputPorts.Count - m_firstAvailablePort; - for( int i = 0; i < count; i++ ) - { - int portIdx = i + m_firstAvailablePort; - string qualifier = m_items[ i ].Qualifier == VariableQualifiers.In ? string.Empty : UIUtils.QualifierToCg( m_items[ i ].Qualifier ) + " "; - PrecisionType precision = m_items[ i ].Precision; - if( precision == PrecisionType.Inherit ) - precision = CurrentPrecisionType; - string dataType = ( m_inputPorts[ portIdx ].DataType == WirePortDataType.OBJECT ) ? m_items[ i ].CustomType : UIUtils.PrecisionWirePortToCgType( precision, m_inputPorts[ portIdx ].DataType ); - functionBody += qualifier + dataType + " " + m_inputPorts[ portIdx ].Name; - if( i < ( count - 1 ) ) - { - functionBody += " , "; - } - } - functionBody += " )\n" + UIUtils.ShaderIndentTabs + "{\n"; - UIUtils.ShaderIndentLevel++; - { - if( expressionMode ) - functionBody += UIUtils.ShaderIndentTabs + "return "; - - string[] codeLines = m_code.Split( IOUtils.LINE_TERMINATOR ); - for( int i = 0; i < codeLines.Length; i++ ) - { - if( codeLines[ i ].Length > 0 ) - { - functionBody += ( ( i == 0 && expressionMode ) ? string.Empty : UIUtils.ShaderIndentTabs ) + codeLines[ i ] + ( ( ( i == codeLines.Length - 1 ) && expressionMode ) ? string.Empty : "\n" ); - } - } - if( expressionMode ) - functionBody += ";\n"; - } - UIUtils.ShaderIndentLevel--; - - functionBody += UIUtils.ShaderIndentTabs + "}\n"; - UIUtils.ShaderIndentLevel = currIndent; - return functionBody; - } - - void DrawBaseProperties() - { - EditorGUI.BeginChangeCheck(); - m_customExpressionName = EditorGUILayoutTextField( ExpressionNameLabelStr, m_customExpressionName ); - if( EditorGUI.EndChangeCheck() ) - { - SetTimedUpdate( 2 ); - SetTitleText( m_customExpressionName ); - } - - EditorGUI.BeginChangeCheck(); - Mode = (CustomExpressionMode)EditorGUILayoutEnumPopup( FunctionCallModeStr, m_mode ); - if( EditorGUI.EndChangeCheck() ) - { - if( CheckCallMode() ) - UIUtils.ShowMessage( UniqueId, "Call Mode cannot have return over is code.\nFalling back to Create Mode" ); - SetupCallMode(); - RecalculateInOutOutputPorts(); - } - - EditorGUILayout.LabelField( CodeTitleStr ); - EditorGUI.BeginChangeCheck(); - { - m_code = EditorGUILayoutTextArea( m_code, UIUtils.MainSkin.textArea ); - } - if( EditorGUI.EndChangeCheck() ) - { - m_codeModified = true; - m_lastTimeCodeModified = EditorApplication.timeSinceStartup; - } - - if( m_mode == CustomExpressionMode.Create ) - { - DrawPrecisionProperty(); - - bool guiEnabled = GUI.enabled; - - GUI.enabled = !AutoRegisterMode; - m_generateUniqueName = EditorGUILayoutToggle( GenerateUniqueNameStr, m_generateUniqueName ) && !AutoRegisterMode; - - GUI.enabled = !m_generateUniqueName; - AutoRegisterMode = EditorGUILayoutToggle( AutoRegisterStr, AutoRegisterMode ) && !m_generateUniqueName; - - GUI.enabled = guiEnabled; - - EditorGUI.BeginChangeCheck(); - m_outputTypeIdx = EditorGUILayoutPopup( OutputTypeStr, m_outputTypeIdx, AvailableOutputWireTypesStr ); - if( EditorGUI.EndChangeCheck() ) - { - bool oldVoidValue = m_voidMode; - UpdateVoidMode(); - if( oldVoidValue != m_voidMode ) - { - SetupCallMode(); - RecalculateInOutOutputPorts(); - } - else - { - m_outputPorts[ 0 ].ChangeType( AvailableOutputWireTypes[ m_outputTypeIdx ], false ); - } - } - } - NodeUtils.DrawNestedPropertyGroup( ref m_dependenciesFoldout, "Dependencies", DrawDependencies, DrawDependenciesAddRemoveInputs ); - } - - void UpdateVoidMode() - { - m_voidMode = ( m_outputTypeIdx == ( AvailableOutputWireTypesStr.Length - 1 ) ); - } - - void SetupCallMode() - { - if( m_mode == CustomExpressionMode.Call || m_voidMode ) - { - if( m_firstAvailablePort != 1 ) - { - m_firstAvailablePort = 1; - AddInputPortAt( 0, WirePortDataType.FLOAT, false, DefaultInputNameStr ); - m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT, false ); - } - } - else - { - if( m_firstAvailablePort != 0 ) - { - m_firstAvailablePort = 0; - if( m_inputPorts[ 0 ].IsConnected ) - { - m_containerGraph.DeleteConnection( true, UniqueId, m_inputPorts[ 0 ].PortId, false, true ); - } - DeleteInputPortByArrayIdx( 0 ); - m_outputPorts[ 0 ].ChangeType( AvailableOutputWireTypes[ m_outputTypeIdx ], false ); - } - } - } - - void DrawItemsAddRemoveInputs() - { - if( m_inputPorts.Count == m_firstAvailablePort ) - m_visibleInputsFoldout = false; - - // Add new port - if( GUILayoutButton( string.Empty, UIUtils.PlusStyle, GUILayout.Width( ButtonLayoutWidth ) ) ) - { - AddPortAt( m_inputPorts.Count ); - m_visibleInputsFoldout = true; - EditorGUI.FocusTextInControl( null ); - } - - //Remove port - if( GUILayoutButton( string.Empty, UIUtils.MinusStyle, GUILayout.Width( ButtonLayoutWidth ) ) ) - { - RemovePortAt( m_inputPorts.Count - 1 ); - EditorGUI.FocusTextInControl( null ); - } - } - - void DrawDependenciesAddRemoveInputs() - { - // Add new port - if( GUILayoutButton( string.Empty, UIUtils.PlusStyle, GUILayout.Width( ButtonLayoutWidth ) ) ) - { - m_dependencies.Add( new CustomExpressionDependency() ); - EditorGUI.FocusTextInControl( null ); - } - - //Remove port - if( GUILayoutButton( string.Empty, UIUtils.MinusStyle, GUILayout.Width( ButtonLayoutWidth ) ) ) - { - m_dependencies.RemoveAt( m_dependencies.Count - 1 ); - } - } - - void DrawDependencies() - { - if( m_dependenciesReordableList == null ) - { - m_dependenciesReordableList = new ReorderableList( m_dependencies, typeof( CustomExpressionDependency ), true, false, false, false ) - { - headerHeight = 0, - footerHeight = 0, - showDefaultBackground = false, - drawElementCallback = ( Rect rect, int index, bool isActive, bool isFocused ) => - { - if( m_dependencies[ index ] != null ) - { - rect.xMin -= 1; - - Rect popupPos = new Rect( rect.x, rect.y, rect.width - 2 * Constants.PlusMinusButtonLayoutWidth, EditorGUIUtility.singleLineHeight ); - Rect buttonPlusPos = new Rect( rect.x + rect.width - 2 * Constants.PlusMinusButtonLayoutWidth, rect.y - 2, Constants.PlusMinusButtonLayoutWidth, Constants.PlusMinusButtonLayoutWidth ); - Rect buttonMinusPos = new Rect( rect.x + rect.width - Constants.PlusMinusButtonLayoutWidth, rect.y - 2, Constants.PlusMinusButtonLayoutWidth, Constants.PlusMinusButtonLayoutWidth ); - EditorGUI.BeginChangeCheck(); - m_dependencies[ index ].DependencyArrayIdx = EditorGUIPopup( popupPos, string.Empty, m_dependencies[ index ].DependencyArrayIdx, UIUtils.CurrentWindow.OutsideGraph.CustomExpressionOnFunctionMode.NodesArr ); - if( EditorGUI.EndChangeCheck() ) - { - m_dependencies[ index ].DependencyNodeId = UIUtils.CurrentWindow.OutsideGraph.CustomExpressionOnFunctionMode.GetNode( m_dependencies[ index ].DependencyArrayIdx ).UniqueId; - if( m_dependencies[ index ].DependencyNodeId == UniqueId ) - { - m_dependencies[ index ].Reset(); - } - } - - if( GUI.Button( buttonPlusPos, string.Empty, UIUtils.PlusStyle ) ) - { - m_actionType = ReordableAction.Add; - m_actionIndex = index; - } - - if( GUI.Button( buttonMinusPos, string.Empty, UIUtils.MinusStyle ) ) - { - m_actionType = ReordableAction.Remove; - m_actionIndex = index; - } - } - } - }; - } - - if( m_dependenciesReordableList != null ) - { - EditorGUILayout.Space(); - if( m_dependencies.Count == 0 ) - { - EditorGUILayout.HelpBox( "Your list is Empty!\nUse the plus button to add one.", MessageType.Info ); - } - else - { - m_dependenciesReordableList.DoLayoutList(); - } - EditorGUILayout.Space(); - } - - if( m_actionType != ReordableAction.None ) - { - switch( m_actionType ) - { - case ReordableAction.Add: - m_dependencies.Insert( m_actionIndex + 1, new CustomExpressionDependency() ); - break; - case ReordableAction.Remove: - m_dependencies.RemoveAt( m_actionIndex ); - break; - } - m_isDirty = true; - m_actionType = ReordableAction.None; - EditorGUI.FocusTextInControl( null ); - } - } - - void DrawReordableInputs() - { - if( m_itemReordableList == null ) - { - m_itemReordableList = new ReorderableList( m_items, typeof( CustomExpressionInputItem ), true, false, false, false ) - { - headerHeight = 0, - footerHeight = 0, - showDefaultBackground = false, - elementHeightCallback = ( int index ) => - { - float lineHeight = EditorGUIUtility.singleLineHeight * LineAdjust; - if( m_items[ index ].FoldoutFlag ) - { - float size = 7 * lineHeight; - - // Take Is Variable toggle into account - if( m_mode == CustomExpressionMode.Call ) - size += lineHeight; - - if( m_inputPorts[ m_firstAvailablePort + index ].DataType == WirePortDataType.OBJECT ) - size += lineHeight; - - if( !m_inputPorts[ m_firstAvailablePort + index ].IsConnected ) - { - switch( m_inputPorts[ m_firstAvailablePort + index ].DataType ) - { - case WirePortDataType.INT: - case WirePortDataType.FLOAT: - size += 0;// lineHeight; - break; - case WirePortDataType.FLOAT2: - case WirePortDataType.FLOAT3: - case WirePortDataType.FLOAT4: - size += lineHeight;//2 * lineHeight; - break; - case WirePortDataType.FLOAT3x3: - size += 5 * lineHeight;//6 * lineHeight; - break; - case WirePortDataType.FLOAT4x4: - size += 6 * lineHeight;//8 * lineHeight; - break; - - } - } - - return size; - } - else - { - return lineHeight; - } - }, - - onReorderCallback = ( ReorderableList list ) => - { - int realLastIndex = m_firstAvailablePort + m_lastIndex; - int realCurrIndex = m_firstAvailablePort + list.index; - - InputPort portA = m_inputPorts[ realLastIndex ]; - int originalOutputPortId = CreateOutputId( portA.PortId ); - - SwapInputPorts( realLastIndex, realCurrIndex ); - - if( m_outputPorts.Count > 1 ) - { - if( list.index > m_lastIndex ) - { - for( int i = m_lastIndex; i <= list.index; i++ ) - { - if( m_items[ i ].Qualifier != VariableQualifiers.In ) - { - int portIdx = i + m_firstAvailablePort; - int oldOutputPortId; - if( i < list.index ) - { - int oldinputPortId = m_inputPorts[ portIdx ].PortId + 1; - oldOutputPortId = CreateOutputId( oldinputPortId ); - } - else - { - oldOutputPortId = originalOutputPortId; - } - - m_outputPortsDict[ oldOutputPortId ].ChangePortId( CreateOutputId( m_inputPorts[ portIdx ].PortId ) ); - } - } - } - else - { - for( int i = list.index; i <= m_lastIndex; i++ ) - { - if( m_items[ i ].Qualifier != VariableQualifiers.In ) - { - int portIdx = i + m_firstAvailablePort; - int oldOutputPortId; - if( i > list.index ) - { - int oldinputPortId = m_inputPorts[ portIdx ].PortId - 1; - oldOutputPortId = CreateOutputId( oldinputPortId ); - } - else - { - oldOutputPortId = originalOutputPortId; - } - - m_outputPortsDict[ oldOutputPortId ].ChangePortId( CreateOutputId( m_inputPorts[ portIdx ].PortId ) ); - } - } - } - } - - - m_outputPorts.Sort( ( A, B ) => - { - return A.PortId.CompareTo( B.PortId ); - } ); - - m_outputPortsDict.Clear(); - for( int i = 0; i < m_outputPorts.Count; i++ ) - { - m_outputPortsDict.Add( m_outputPorts[ i ].PortId, m_outputPorts[ i ] ); - } - - }, - onSelectCallback = ( ReorderableList list ) => - { - m_lastIndex = list.index; - }, - drawElementCallback = ( Rect rect, int index, bool isActive, bool isFocused ) => - { - if( m_items[ index ] != null ) - { - float lineHeight = EditorGUIUtility.singleLineHeight; - float lineSpacing = lineHeight * LineAdjust; - - rect.x -= IdentationAdjust; - rect.height = lineHeight; - int portIdx = index + m_firstAvailablePort; - Rect foldoutRect = rect; - if( !m_items[ index ].FoldoutFlag ) - { - foldoutRect.width -= 2 * AddRemoveButtonLayoutWidth; - } - m_items[ index ].FoldoutFlag = EditorGUIFoldout( foldoutRect, m_items[ index ].FoldoutFlag, /*m_items[ index ].FoldoutLabel + " - " +*/ m_inputPorts[ portIdx ].Name ); - if( m_items[ index ].FoldoutFlag ) - { - rect.x += IdentationAdjust; - - //Qualifier - rect.y += lineSpacing; - VariableQualifiers newQualifier = (VariableQualifiers)EditorGUIPopup( rect, InputQualifierStr, (int)m_items[ index ].Qualifier, QualifiersStr ); - if( newQualifier != m_items[ index ].Qualifier ) - { - VariableQualifiers oldQualifier = m_items[ index ].Qualifier; - m_items[ index ].Qualifier = newQualifier; - if( newQualifier == VariableQualifiers.In ) - { - RemoveOutputPort( CreateOutputId( m_inputPorts[ portIdx ].PortId ), false ); - } - else if( oldQualifier == VariableQualifiers.In ) - { - int outputId = CreateOutputId( m_inputPorts[ portIdx ].PortId ); - AddOutputPort( m_inputPorts[ portIdx ].DataType, m_inputPorts[ portIdx ].Name, outputId ); - } - m_inputPorts[ portIdx ].Visible = newQualifier != VariableQualifiers.Out; - m_sizeIsDirty = true; - RecalculateInOutOutputPorts(); - } - - // Precision - rect.y += lineSpacing; - m_items[ index ].Precision = (PrecisionType)EditorGUIPopup( rect, PrecisionContent.text, (int)m_items[ index ].Precision, PrecisionLabelsExtraLocal ); - // Type - rect.y += lineSpacing; - int typeIdx = WireToIdx[ m_inputPorts[ portIdx ].DataType ]; - EditorGUI.BeginChangeCheck(); - { - typeIdx = EditorGUIPopup( rect, InputTypeStr, typeIdx, AvailableWireTypesStr ); - } - - if( EditorGUI.EndChangeCheck() ) - { - m_inputPorts[ portIdx ].ChangeType( AvailableWireTypes[ typeIdx ], false ); - if( typeIdx == 5 || typeIdx == 6 ) - { - m_inputPorts[ portIdx ].Matrix4x4InternalData = Matrix4x4.identity; - } - - if( m_items[ index ].Qualifier != VariableQualifiers.In ) - { - OutputPort currOutPort = GetOutputPortByUniqueId( CreateOutputId( m_inputPorts[ portIdx ].PortId ) ); - currOutPort.ChangeType( AvailableWireTypes[ typeIdx ], false ); - } - } - - if( AvailableWireTypes[ typeIdx ] == WirePortDataType.OBJECT ) - { - rect.y += lineSpacing; - m_items[ index ].CustomType = EditorGUITextField( rect, CustomTypeStr, m_items[ index ].CustomType ); - } - - //Name - rect.y += lineSpacing; - EditorGUI.BeginChangeCheck(); - { - m_inputPorts[ portIdx ].Name = EditorGUITextField( rect, InputNameStr, m_inputPorts[ portIdx ].Name ); - } - if( EditorGUI.EndChangeCheck() ) - { - m_nameModified = true; - m_lastTimeNameModified = EditorApplication.timeSinceStartup; - m_inputPorts[ portIdx ].Name = UIUtils.RemoveInvalidCharacters( m_inputPorts[ portIdx ].Name ); - if( string.IsNullOrEmpty( m_inputPorts[ portIdx ].Name ) ) - { - m_inputPorts[ portIdx ].Name = DefaultInputNameStr + index; - } - - if( m_items[ index ].Qualifier != VariableQualifiers.In ) - { - OutputPort currOutPort = GetOutputPortByUniqueId( CreateOutputId( m_inputPorts[ portIdx ].PortId ) ); - currOutPort.Name = m_inputPorts[ portIdx ].Name; - } - } - - if( m_mode == CustomExpressionMode.Call ) - { - //Is Unique - rect.y += lineSpacing; - m_items[ index ].IsVariable = EditorGUIToggle( rect, IsVariableStr, m_items[ index ].IsVariable ); - } - // Port Data - if( !m_inputPorts[ portIdx ].IsConnected ) - { - rect.y += lineSpacing; - m_inputPorts[ portIdx ].ShowInternalData( rect, this, true, InputValueStr ); - } - - //Buttons - rect.x += rect.width - 2 * AddRemoveButtonLayoutWidth; - rect.y += lineSpacing; - if( !m_inputPorts[ m_firstAvailablePort + index ].IsConnected ) - { - switch( m_inputPorts[ m_firstAvailablePort + index ].DataType ) - { - case WirePortDataType.INT: - case WirePortDataType.FLOAT: - rect.y += 0;// lineSpacing; - break; - case WirePortDataType.FLOAT2: - case WirePortDataType.FLOAT3: - case WirePortDataType.FLOAT4: - rect.y += lineSpacing;//2 * lineSpacing; - break; - case WirePortDataType.FLOAT3x3: - rect.y += 5 * lineSpacing;//6 * lineSpacing; - break; - case WirePortDataType.FLOAT4x4: - rect.y += 6 * lineSpacing;//8 * lineSpacing; - break; - - } - } - rect.width = AddRemoveButtonLayoutWidth; - if( GUI.Button( rect, string.Empty, UIUtils.PlusStyle ) ) - { - m_actionType = ReordableAction.Add; - m_actionIndex = index; - } - rect.x += AddRemoveButtonLayoutWidth; - if( GUI.Button( rect, string.Empty, UIUtils.MinusStyle ) ) - { - m_actionType = ReordableAction.Remove; - m_actionIndex = index; - } - - } - else - { - //Buttons - rect.x += IdentationAdjust + rect.width - 2 * AddRemoveButtonLayoutWidth; - rect.width = AddRemoveButtonLayoutWidth; - if( GUI.Button( rect, string.Empty, UIUtils.PlusStyle ) ) - { - m_actionType = ReordableAction.Add; - m_actionIndex = index; - } - rect.x += AddRemoveButtonLayoutWidth; - if( GUI.Button( rect, string.Empty, UIUtils.MinusStyle ) ) - { - m_actionType = ReordableAction.Remove; - m_actionIndex = index; - } - } - } - } - }; - } - - if( m_itemReordableList != null ) - { - EditorGUILayout.Space(); - if( m_items.Count == 0 ) - { - EditorGUILayout.HelpBox( "Your list is Empty!\nUse the plus button to add one.", MessageType.Info ); - } - else - { - m_itemReordableList.DoLayoutList(); - } - EditorGUILayout.Space(); - } - - if( m_actionType != ReordableAction.None ) - { - switch( m_actionType ) - { - case ReordableAction.Add: - AddPortAt( m_firstAvailablePort + m_actionIndex + 1 ); - break; - case ReordableAction.Remove: - RemovePortAt( m_firstAvailablePort + m_actionIndex ); - break; - } - m_isDirty = true; - m_actionType = ReordableAction.None; - EditorGUI.FocusTextInControl( null ); - } - } - - void RecalculateInOutOutputPorts() - { - m_outputPorts.Sort( ( x, y ) => x.PortId.CompareTo( y.PortId ) ); - - m_outputPortsDict.Clear(); - int count = m_inputPorts.Count - m_firstAvailablePort; - int outputId = 1; - for( int i = 0; i < count; i++ ) - { - int idx = i + m_firstAvailablePort; - if( m_items[ i ].Qualifier != VariableQualifiers.In ) - { - m_outputPorts[ outputId ].ChangeProperties( m_inputPorts[ idx ].Name, m_inputPorts[ idx ].DataType, false ); - m_outputPorts[ outputId ].ChangePortId( CreateOutputId( m_inputPorts[ idx ].PortId ) ); - outputId++; - } - } - - int outCount = m_outputPorts.Count; - for( int i = 0; i < outCount; i++ ) - { - m_outputPortsDict.Add( m_outputPorts[ i ].PortId, m_outputPorts[ i ] ); - } - } - - void AddPortAt( int idx ) - { - AddInputPortAt( idx, WirePortDataType.FLOAT, false, GetFirstAvailableName() ); - m_items.Insert( idx - m_firstAvailablePort, new CustomExpressionInputItem( PrecisionType.Inherit, VariableQualifiers.In, string.Empty, false, true, string.Empty/* "[" + idx + "]"*/ ) ); - m_repopulateNameDictionary = true; - RecalculateInOutOutputPorts(); - } - - void RemovePortAt( int idx ) - { - if( m_inputPorts.Count > m_firstAvailablePort ) - { - int varIdx = idx - m_firstAvailablePort; - if( m_items[ varIdx ].Qualifier != VariableQualifiers.In ) - { - int id = CreateOutputId( m_inputPorts[ idx ].PortId ); - RemoveOutputPort( id, false ); - } - - DeleteInputPortByArrayIdx( idx ); - m_items.RemoveAt( varIdx ); - - m_repopulateNameDictionary = true; - - RecalculateInOutOutputPorts(); - } - } - - public override void OnAfterDeserialize() - { - base.OnAfterDeserialize(); - m_repopulateNameDictionary = true; - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if( string.IsNullOrEmpty( m_code ) ) - { - UIUtils.ShowMessage( UniqueId, "Custom Expression need to have code associated", MessageSeverity.Warning ); - return "0"; - } - - m_code = m_code.Replace( "\r\n", "\n" ); - - bool codeContainsReturn = m_code.Contains( ReturnHelper ); - if( !codeContainsReturn && outputId != 0 && m_mode == CustomExpressionMode.Create && !m_voidMode ) - { - UIUtils.ShowMessage( "Attempting to get value from inexisting inout/out variable", MessageSeverity.Warning ); - return "0"; - } - - int dependenciesCount = m_dependencies.Count; - Dictionary<int, CustomExpressionNode> examinedNodes = new Dictionary<int, CustomExpressionNode>(); - for( int i = 0; i < dependenciesCount; i++ ) - { - CustomExpressionNode node = m_containerGraph.GetNode( m_dependencies[ i ].DependencyNodeId ) as CustomExpressionNode; - if( node == null ) - { - node = UIUtils.CurrentWindow.OutsideGraph.GetNode( m_dependencies[ i ].DependencyNodeId ) as CustomExpressionNode; - } - - if( node != null ) - { - node.CheckDependencies( ref dataCollector, ref examinedNodes ); - } - } - examinedNodes.Clear(); - examinedNodes = null; - - - OutputPort outputPort = GetOutputPortByUniqueId( outputId ); - if( outputPort.IsLocalValue( dataCollector.PortCategory ) ) - return outputPort.LocalValue( dataCollector.PortCategory ); - - string expressionName = UIUtils.RemoveInvalidCharacters( m_customExpressionName ); - string localVarName = "local" + expressionName; - - if( m_generateUniqueName ) - { - expressionName += OutputId; - } - localVarName += OutputId; - - int count = m_inputPorts.Count; - if( count > 0 ) - { - if( m_mode == CustomExpressionMode.Call || m_voidMode ) - { - string mainData = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - RegisterLocalVariable( 0, string.Format( Constants.CodeWrapper, mainData ), ref dataCollector, localVarName ); - } - - if( codeContainsReturn ) - { - string function = WrapCodeInFunction( dataCollector.IsTemplate, expressionName, false ); - string functionCall = expressionName + "( "; - for( int i = m_firstAvailablePort; i < count; i++ ) - { - string inputPortLocalVar = m_inputPorts[ i ].Name + OutputId; - int idx = i - m_firstAvailablePort; - if( m_inputPorts[ i ].DataType != WirePortDataType.OBJECT ) - { - string result = m_inputPorts[ i ].GeneratePortInstructions( ref dataCollector ); - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, m_inputPorts[ i ].DataType, inputPortLocalVar, result ); - } - else - { - string result =( m_inputPorts[ i ].IsConnected )? m_inputPorts[ i ].GeneratePortInstructions( ref dataCollector) : m_inputPorts[ i ].InternalData.ToString(); - string inputLocalVar = string.Format( Constants.CustomTypeLocalValueDecWithoutIdent, m_items[ idx ].CustomType, inputPortLocalVar, result ); - dataCollector.AddLocalVariable( UniqueId, inputLocalVar ); - } - - if( m_items[ idx ].Qualifier != VariableQualifiers.In ) - { - OutputPort currOutputPort = GetOutputPortByUniqueId( CreateOutputId( m_inputPorts[ i ].PortId ) ); - currOutputPort.SetLocalValue( inputPortLocalVar, dataCollector.PortCategory ); - } - functionCall += inputPortLocalVar; - if( i < ( count - 1 ) ) - { - functionCall += " , "; - } - } - functionCall += " )"; - - if( m_mode == CustomExpressionMode.Call || m_voidMode ) - { - dataCollector.AddLocalVariable( 0, functionCall + ";", true ); - } - else - { - RegisterLocalVariable( 0, functionCall, ref dataCollector, localVarName ); - } - - dataCollector.AddFunction( expressionName, function ); - } - else - { - - string localCode = m_code; - if( m_mode == CustomExpressionMode.Call || m_voidMode ) - { - for( int i = m_firstAvailablePort; i < count; i++ ) - { - int idx = i - m_firstAvailablePort; - if( !m_items[ idx ].IsVariable || - m_items[ idx ].Qualifier != VariableQualifiers.In || - !m_inputPorts[ i ].IsConnected - ) - { - string inputPortLocalVar = m_inputPorts[ i ].Name + OutputId; - string nameToReplaceRegex = string.Format( VarRegexReplacer, m_inputPorts[ i ].Name ); - localCode = Regex.Replace( localCode, nameToReplaceRegex, inputPortLocalVar, RegexOptions.Multiline ); - //localCode = localCode.Replace( m_inputPorts[ i ].Name, inputPortLocalVar ); - - if( m_inputPorts[ i ].IsConnected ) - { - string result = m_inputPorts[ i ].GenerateShaderForOutput( ref dataCollector, m_inputPorts[ i ].DataType, true, true ); - if( m_inputPorts[ i ].DataType == WirePortDataType.OBJECT ) - { - dataCollector.AddLocalVariable( UniqueId, m_items[ idx ].CustomType + " " + inputPortLocalVar, result + ";" ); - } - else - { - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, m_inputPorts[ i ].DataType, inputPortLocalVar, result ); - } - } - else - { - if( m_inputPorts[ i ].DataType == WirePortDataType.OBJECT ) - { - dataCollector.AddLocalVariable( UniqueId, m_items[ idx ].CustomType + " " + inputPortLocalVar, m_inputPorts[ i ].WrappedInternalData + ";" ); - } - else - { - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, m_inputPorts[ i ].DataType, inputPortLocalVar, m_inputPorts[ i ].WrappedInternalData ); - } - } - - if( m_items[ idx ].Qualifier != VariableQualifiers.In ) - { - OutputPort currOutputPort = GetOutputPortByUniqueId( CreateOutputId( m_inputPorts[ i ].PortId ) ); - currOutputPort.SetLocalValue( inputPortLocalVar, dataCollector.PortCategory ); - } - } - else - { - // Not Unique - string result = m_inputPorts[ i ].GenerateShaderForOutput( ref dataCollector, m_inputPorts[ i ].DataType, true, true ); - string nameToReplaceRegex = string.Format( VarRegexReplacer, m_inputPorts[ i ].Name ); - localCode = Regex.Replace( localCode, nameToReplaceRegex, result, RegexOptions.Multiline ); - //localCode = localCode.Replace( m_inputPorts[ i ].Name, result ); - } - } - string[] codeLines = localCode.Split( '\n' ); - for( int codeIdx = 0; codeIdx < codeLines.Length; codeIdx++ ) - { - dataCollector.AddLocalVariable( 0, codeLines[ codeIdx ], true ); - } - } - else - { - string function = WrapCodeInFunction( dataCollector.IsTemplate, expressionName, true ); - - string functionCall = expressionName + "( "; - for( int i = m_firstAvailablePort; i < count; i++ ) - { - - string inputPortLocalVar = m_inputPorts[ i ].Name + OutputId; - int idx = i - m_firstAvailablePort; - if( m_inputPorts[ i ].DataType != WirePortDataType.OBJECT ) - { - string result = m_inputPorts[ i ].GeneratePortInstructions( ref dataCollector ); - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, m_inputPorts[ i ].DataType, inputPortLocalVar, result ); - } - else - { - string result = ( m_inputPorts[ i ].IsConnected ) ? m_inputPorts[ i ].GeneratePortInstructions( ref dataCollector ) : m_inputPorts[ i ].InternalData.ToString(); - string inputLocalVar = string.Format( Constants.CustomTypeLocalValueDecWithoutIdent, m_items[ idx ].CustomType, inputPortLocalVar, result ); - dataCollector.AddLocalVariable( UniqueId, inputLocalVar ); - } - - if( m_items[ idx ].Qualifier != VariableQualifiers.In ) - { - OutputPort currOutputPort = GetOutputPortByUniqueId( CreateOutputId( m_inputPorts[ i ].PortId ) ); - currOutputPort.SetLocalValue( inputPortLocalVar, dataCollector.PortCategory ); - } - functionCall += inputPortLocalVar; - if( i < ( count - 1 ) ) - { - functionCall += " , "; - } - } - functionCall += " )"; - RegisterLocalVariable( 0, functionCall, ref dataCollector, localVarName ); - dataCollector.AddFunction( expressionName, function ); - } - } - - return outputPort.LocalValue( dataCollector.PortCategory ); - } - else - { - if( m_code.Contains( ReturnHelper ) ) - { - string function = WrapCodeInFunction( dataCollector.IsTemplate, expressionName, false ); - dataCollector.AddFunction( expressionName, function ); - string functionCall = expressionName + "()"; - RegisterLocalVariable( 0, functionCall, ref dataCollector, localVarName ); - } - else - { - RegisterLocalVariable( 0, string.Format( Constants.CodeWrapper, m_code ), ref dataCollector, localVarName ); - } - - return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); - } - } - - int CreateOutputId( int inputId ) - { - return ( inputId + 1 ); - } - - int CreateInputId( int outputId ) - { - return outputId - 1; - } - - void UpdateOutputPorts() - { - int count = m_inputPorts.Count - m_firstAvailablePort; - for( int i = 0; i < count; i++ ) - { - if( m_items[ i ].Qualifier != VariableQualifiers.In ) - { - int portIdx = i + m_firstAvailablePort; - int outputPortId = CreateOutputId( m_inputPorts[ portIdx ].PortId ); - AddOutputPort( m_inputPorts[ portIdx ].DataType, m_inputPorts[ portIdx ].Name, outputPortId ); - } - } - } - - public override void ReadFromString( ref string[] nodeParams ) - { - // This node is, by default, created with one input port - base.ReadFromString( ref nodeParams ); - m_code = GetCurrentParam( ref nodeParams ); - m_code = m_code.Replace( LineFeedSeparator, '\n' ); - m_code = m_code.Replace( Constants.SemiColonSeparator, ';' ); - m_outputTypeIdx = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - if( m_outputTypeIdx >= AvailableWireTypes.Length ) - { - UIUtils.ShowMessage( UniqueId, "Sampler types were removed as a valid output custom expression type" ); - m_outputTypeIdx = 1; - } - UpdateVoidMode(); - m_outputPorts[ 0 ].ChangeType( AvailableWireTypes[ m_outputTypeIdx ], false ); - - if( UIUtils.CurrentShaderVersion() > 12001 ) - { - bool mode = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - m_mode = mode ? CustomExpressionMode.Call : CustomExpressionMode.Create; - if( m_mode == CustomExpressionMode.Call || m_voidMode ) - { - m_firstAvailablePort = 1; - AddInputPortAt( 0, WirePortDataType.FLOAT, false, DefaultInputNameStr ); - } - } - - if( m_mode == CustomExpressionMode.Call ) - UIUtils.CurrentWindow.OutsideGraph.CustomExpressionOnFunctionMode.RemoveNode( this ); - - int count = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - if( count == 0 ) - { - DeleteInputPortByArrayIdx( m_firstAvailablePort ); - m_items.Clear(); - } - else - { - for( int i = 0; i < count; i++ ) - { - bool foldoutValue = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - string name = GetCurrentParam( ref nodeParams ); - WirePortDataType type = (WirePortDataType)Enum.Parse( typeof( WirePortDataType ), GetCurrentParam( ref nodeParams ) ); - string internalData = GetCurrentParam( ref nodeParams ); - VariableQualifiers qualifier = VariableQualifiers.In; - if( UIUtils.CurrentShaderVersion() > 12001 ) - { - qualifier = (VariableQualifiers)Enum.Parse( typeof( VariableQualifiers ), GetCurrentParam( ref nodeParams ) ); - } - string customType = string.Empty; - if( UIUtils.CurrentShaderVersion() > 15311 ) - { - customType = GetCurrentParam( ref nodeParams ); - } - PrecisionType precision = PrecisionType.Float; - if( UIUtils.CurrentShaderVersion() > 15607 ) - { - precision = (PrecisionType)Enum.Parse( typeof( PrecisionType ), GetCurrentParam( ref nodeParams ) ); - } - bool isVariable = false; - if( UIUtils.CurrentShaderVersion() > 16600 ) - { - isVariable = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - } - int portIdx = i + m_firstAvailablePort; - if( i == 0 ) - { - m_inputPorts[ portIdx ].ChangeProperties( name, type, false ); - m_inputPorts[ portIdx ].Visible = qualifier != VariableQualifiers.Out; - m_items[ 0 ].Qualifier = qualifier; - m_items[ 0 ].FoldoutFlag = foldoutValue; - m_items[ 0 ].CustomType = customType; - m_items[ 0 ].Precision = precision; - m_items[ 0 ].IsVariable = isVariable; - } - else - { - m_items.Add( new CustomExpressionInputItem( precision, qualifier, customType, isVariable, foldoutValue, string.Empty/*"[" + i + "]"*/ ) ); - AddInputPort( type, false, name ); - m_inputPorts[ m_inputPorts.Count - 1 ].Visible = qualifier != VariableQualifiers.Out; - } - m_inputPorts[ i ].InternalData = internalData; - } - } - - if( UIUtils.CurrentShaderVersion() > 7205 ) - { - m_customExpressionName = GetCurrentParam( ref nodeParams ); - SetTitleText( m_customExpressionName ); - } - - if( UIUtils.CurrentShaderVersion() > 14401 ) - { - m_generateUniqueName = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - } - - if( UIUtils.CurrentShaderVersion() > 15102 ) - { - m_autoRegisterMode = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - } - - if( UIUtils.CurrentShaderVersion() > 15403 ) - { - int dependencyCount = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - for( int i = 0; i < dependencyCount; i++ ) - { - m_dependencies.Add( new CustomExpressionDependency( GetCurrentParam( ref nodeParams ) ) ); - } - } - - if( m_mode == CustomExpressionMode.Create ) - { - UIUtils.CurrentWindow.OutsideGraph.CustomExpressionOnFunctionMode.AddNode( this ); - } - UpdateOutputPorts(); - - m_repopulateNameDictionary = true; - m_functionMode = m_code.Contains( ReturnHelper ); - CheckCallMode(); - - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - - m_code = m_code.Replace( "\r\n", "\n" ); - - string parsedCode = m_code.Replace( '\n', LineFeedSeparator ); - parsedCode = parsedCode.Replace( ';', Constants.SemiColonSeparator ); - - IOUtils.AddFieldValueToString( ref nodeInfo, parsedCode ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_outputTypeIdx ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_mode == CustomExpressionMode.Call ); - - int count = m_inputPorts.Count - m_firstAvailablePort; - IOUtils.AddFieldValueToString( ref nodeInfo, count ); - for( int i = 0; i < count; i++ ) - { - int portIdx = m_firstAvailablePort + i; - IOUtils.AddFieldValueToString( ref nodeInfo, m_items[ i ].FoldoutFlag ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_inputPorts[ portIdx ].Name ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_inputPorts[ portIdx ].DataType ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_inputPorts[ portIdx ].InternalData ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_items[ i ].Qualifier ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_items[ i ].CustomType ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_items[ i ].Precision ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_items[ i ].IsVariable ); - } - IOUtils.AddFieldValueToString( ref nodeInfo, m_customExpressionName ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_generateUniqueName ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_autoRegisterMode ); - count = m_dependencies.Count; - IOUtils.AddFieldValueToString( ref nodeInfo, count ); - for( int i = 0; i < count; i++ ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_dependencies[ i ].DependencyNodeId ); - } - } - - public override void Destroy() - { - base.Destroy(); - if( m_mode == CustomExpressionMode.Create ) - { - UIUtils.CurrentWindow.OutsideGraph.CustomExpressionOnFunctionMode.RemoveNode( this ); - } - m_items.Clear(); - m_items = null; - m_dependencies.Clear(); - m_dependencies = null; - m_itemReordableList = null; - } - - public void CheckDependencies( ref MasterNodeDataCollector dataCollector, ref Dictionary<int, CustomExpressionNode> examinedNodes ) - { - if( !examinedNodes.ContainsKey( UniqueId ) && m_mode == CustomExpressionMode.Create && !m_generateUniqueName ) - { - int dependencyCount = m_dependencies.Count; - for( int d = 0; d < dependencyCount; d++ ) - { - if( !examinedNodes.ContainsKey( m_dependencies[ d ].DependencyNodeId ) ) - { - CustomExpressionNode dNode = m_containerGraph.GetNode( m_dependencies[ d ].DependencyNodeId ) as CustomExpressionNode; - - if( dNode == null ) - { - dNode = UIUtils.CurrentWindow.OutsideGraph.GetNode( m_dependencies[ d ].DependencyNodeId ) as CustomExpressionNode; - } - - if( dNode != null ) - { - dNode.CheckDependencies( ref dataCollector, ref examinedNodes ); - } - } - } - dataCollector.AddFunction( ExpressionName, EncapsulatedCode( dataCollector.IsTemplate ) ); - examinedNodes.Add( UniqueId, this ); - } - } - - public string EncapsulatedCode( bool isTemplate ) - { - string functionName = UIUtils.RemoveInvalidCharacters( m_customExpressionName ); - if( m_generateUniqueName ) - { - functionName += OutputId; - } - return WrapCodeInFunction( isTemplate, functionName, false ); - } - - public CustomExpressionMode Mode - { - get { return m_mode; } - set - { - if( m_mode != value ) - { - m_mode = value; - if( m_mode == CustomExpressionMode.Call ) - { - AutoRegisterMode = false; - m_generateUniqueName = false; - UIUtils.CurrentWindow.OutsideGraph.CustomExpressionOnFunctionMode.RemoveNode( this ); - } - else - { - UIUtils.CurrentWindow.OutsideGraph.CustomExpressionOnFunctionMode.AddNode( this ); - } - } - } - } - - public string ExpressionName - { - get - { - string expressionName = UIUtils.RemoveInvalidCharacters( m_customExpressionName ); - - if( m_generateUniqueName ) - { - expressionName += OutputId; - } - return expressionName; - } - } - public override string DataToArray { get { return m_customExpressionName; } } - public bool AutoRegisterMode - { - get { return m_autoRegisterMode; } - set - { - if( value != m_autoRegisterMode ) - { - m_autoRegisterMode = value; - } - } - } - - public override void RefreshExternalReferences() - { - base.RefreshExternalReferences(); - int portCount = m_inputPorts.Count; - for( int i = 0; i < portCount; i++ ) - { - if( m_inputPorts[ i ].DataType == WirePortDataType.COLOR ) - { - m_inputPorts[ i ].ChangeType( WirePortDataType.FLOAT4, false ); ; - } - } - - int dependencyCount = m_dependencies.Count; - for( int i = 0; i < dependencyCount; i++ ) - { - m_dependencies[ i ].DependencyArrayIdx = UIUtils.CurrentWindow.OutsideGraph.CustomExpressionOnFunctionMode.GetNodeRegisterIdx( m_dependencies[ i ].DependencyNodeId ); - } - //Fixing bug where user could set main output port as OBJECT - if( m_outputPorts[ 0 ].DataType == WirePortDataType.OBJECT && ( m_voidMode || m_mode == CustomExpressionMode.Call ) ) - { - m_outputPorts[ 0 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); - } - } - - public override void FireTimedUpdate() - { - UIUtils.CurrentWindow.OutsideGraph.CustomExpressionOnFunctionMode.UpdateDataOnNode( UniqueId, m_customExpressionName ); - } - - public List<CustomExpressionDependency> Dependencies { get { return m_dependencies; } } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/CustomExpressionNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/CustomExpressionNode.cs.meta deleted file mode 100644 index bf377187..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/CustomExpressionNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: f2507a764c07082458e350211d671334 -timeCreated: 1481126960 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/DynamicAppendNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/DynamicAppendNode.cs deleted file mode 100644 index 64cc8ebe..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/DynamicAppendNode.cs +++ /dev/null @@ -1,475 +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.Collections.Generic; - -namespace AmplifyShaderEditor -{ - - public struct AppendData - { - public WirePortDataType PortType; - public int OldPortId; - public int NewPortId; - public AppendData( WirePortDataType portType, int oldPortId, int newPortId ) - { - PortType = portType; - OldPortId = oldPortId; - NewPortId = newPortId; - } - } - - [Serializable] - [NodeAttributes( "Append", "Vector Operators", "Append channels to create a new component", null, KeyCode.V, tags: "combine" )] - public sealed class DynamicAppendNode : ParentNode - { - private const string OutputTypeStr = "Output type"; - private const string OutputFormatStr = "({0}({1}))"; - - [SerializeField] - private WirePortDataType m_selectedOutputType = WirePortDataType.FLOAT4; - - [SerializeField] - private int m_selectedOutputTypeInt = 2; - - private readonly string[] m_outputValueTypes ={ "Vector2", - "Vector3", - "Vector4", - "Color"}; - - [SerializeField] - private int[] m_occupiedChannels = { -1, -1, -1, -1 }; - - [SerializeField] - private int m_maskId; - - [SerializeField] - private Vector4 m_maskValue = Vector4.one; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT, false, Constants.ChannelNamesVector[ 0 ] ); - AddInputPort( WirePortDataType.FLOAT, false, Constants.ChannelNamesVector[ 1 ] ); - AddInputPort( WirePortDataType.FLOAT, false, Constants.ChannelNamesVector[ 2 ] ); - AddInputPort( WirePortDataType.FLOAT, false, Constants.ChannelNamesVector[ 3 ] ); - AddOutputPort( m_selectedOutputType, Constants.EmptyPortValue ); - m_textLabelWidth = 90; - m_autoWrapProperties = true; - m_useInternalPortData = true; - m_hasLeftDropdown = true; - m_previewShaderGUID = "bfcd2919fe75bbf428fbbe583f463a9e"; - } - - public override void OnEnable() - { - base.OnEnable(); - m_maskId = Shader.PropertyToID( "_Mask" ); - } - - void NewUpdateBehaviorConn( int portId, bool onLoading ) - { - InputPort inputPort = GetInputPortByUniqueId( portId ); - int channelsRequired = UIUtils.GetChannelsAmount( onLoading ? inputPort.DataType : inputPort.ConnectionType( 0 ) ); - int availableChannels = UIUtils.GetChannelsAmount( m_selectedOutputType ); - - // Invalidate previously used channels - for( int i = 0; i < availableChannels; i++ ) - { - if( m_occupiedChannels[ i ] == portId ) - { - m_occupiedChannels[ i ] = -1; - m_inputPorts[ i ].Visible = true; - } - } - // Lock available channels to port - int len = Mathf.Min( portId + channelsRequired, availableChannels ); - - int channelsUsed = 0; - for( int i = portId; i < len; i++ ) - { - if( m_occupiedChannels[ i ] == -1 ) - { - m_occupiedChannels[ i ] = portId; - channelsUsed += 1; - } - else - { - break; - } - } - - if( !onLoading ) - inputPort.ChangeType( UIUtils.GetWireTypeForChannelAmount( channelsUsed ), false ); - - if( channelsUsed > 1 && portId < availableChannels - 1 ) - { - channelsUsed -= 1; - int i = portId + 1; - for( ; channelsUsed > 0; i++, --channelsUsed ) - { - m_inputPorts[ i ].Visible = false; - } - - } - m_sizeIsDirty = true; - } - - void NewUpdateBehaviorDisconn( int portId ) - { - int availableChannels = UIUtils.GetChannelsAmount( m_selectedOutputType ); - // Invalidate previously used channels - for( int i = 0; i < availableChannels; i++ ) - { - if( m_occupiedChannels[ i ] == portId ) - { - m_occupiedChannels[ i ] = -1; - m_inputPorts[ i ].Visible = true; - m_inputPorts[ i ].ChangeType( WirePortDataType.FLOAT, false ); - } - } - m_sizeIsDirty = true; - } - - void RenamePorts() - { - int channel = 0; - for( int i = 0; i < 4; i++ ) - { - if( m_inputPorts[ i ].Visible ) - { - string name = string.Empty; - int usedChannels = UIUtils.GetChannelsAmount( m_inputPorts[ i ].DataType ); - bool isColor = ( m_selectedOutputType == WirePortDataType.COLOR ); - for( int j = 0; j < usedChannels; j++ ) - { - if( channel < Constants.ChannelNamesVector.Length ) - name += isColor ? Constants.ChannelNamesColor[ channel++ ] : Constants.ChannelNamesVector[ channel++ ]; - } - m_inputPorts[ i ].Name = name; - } - } - - CalculatePreviewData(); - } - - void UpdatePortTypes() - { - ChangeOutputType( m_selectedOutputType, false ); - int availableChannels = UIUtils.GetChannelsAmount( m_selectedOutputType ); - int usedChannels = 0; - while( usedChannels < availableChannels ) - { - int channelsRequired = m_inputPorts[ usedChannels ].IsConnected ? UIUtils.GetChannelsAmount( m_inputPorts[ usedChannels ].DataType ) : 0; - if( channelsRequired > 0 ) - { - - if( ( usedChannels + channelsRequired ) < availableChannels ) - { - usedChannels += channelsRequired; - } - else - { - m_inputPorts[ usedChannels ].Visible = true; - WirePortDataType newType = UIUtils.GetWireTypeForChannelAmount( availableChannels - usedChannels ); - m_inputPorts[ usedChannels ].ChangeType( newType, false ); - usedChannels = availableChannels; - break; - } - } - else - { - m_occupiedChannels[ usedChannels ] = -1; - m_inputPorts[ usedChannels ].Visible = true; - m_inputPorts[ usedChannels ].ChangeType( WirePortDataType.FLOAT, false ); - usedChannels += 1; - } - } - - for( int i = usedChannels; i < availableChannels; i++ ) - { - m_occupiedChannels[ i ] = -1; - m_inputPorts[ i ].Visible = true; - m_inputPorts[ i ].ChangeType( WirePortDataType.FLOAT, false ); - } - - for( int i = availableChannels; i < 4; i++ ) - { - m_occupiedChannels[ i ] = -1; - m_inputPorts[ i ].Visible = false; - m_inputPorts[ i ].ChangeType( WirePortDataType.FLOAT, false ); - } - m_sizeIsDirty = true; - } - - public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) - { - base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); - - if( ( m_containerGraph.IsLoading || m_isNodeBeingCopied ) && UIUtils.CurrentShaderVersion() < 13206 ) - return; - - NewUpdateBehaviorConn( portId, ( UIUtils.IsLoading|| m_isNodeBeingCopied ) ); - RenamePorts(); - - } - - public override void OnInputPortDisconnected( int portId ) - { - base.OnInputPortDisconnected( portId ); - - if( ( UIUtils.IsLoading || m_isNodeBeingCopied ) && UIUtils.CurrentShaderVersion() < 13206 ) - return; - - NewUpdateBehaviorDisconn( portId ); - RenamePorts(); - } - - public override void OnConnectedOutputNodeChanges( int portId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) - { - base.OnConnectedOutputNodeChanges( portId, otherNodeId, otherPortId, name, type ); - - if( ( UIUtils.IsLoading || m_isNodeBeingCopied ) && UIUtils.CurrentShaderVersion() < 13206 ) - return; - - NewUpdateBehaviorConn( portId, ( UIUtils.IsLoading || m_isNodeBeingCopied ) ); - RenamePorts(); - } - - void SetupPorts() - { - switch( m_selectedOutputTypeInt ) - { - case 0: m_selectedOutputType = WirePortDataType.FLOAT2; break; - case 1: m_selectedOutputType = WirePortDataType.FLOAT3; break; - case 2: m_selectedOutputType = WirePortDataType.FLOAT4; break; - case 3: m_selectedOutputType = WirePortDataType.COLOR; break; - } - UpdatePortTypes(); - RenamePorts(); - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - - if( m_dropdownEditing ) - { - EditorGUI.BeginChangeCheck(); - m_selectedOutputTypeInt = EditorGUIPopup( m_dropdownRect, m_selectedOutputTypeInt, m_outputValueTypes, UIUtils.PropertyPopUp ); - if( EditorGUI.EndChangeCheck() ) - { - SetupPorts(); - DropdownEditing = false; - } - } - } - - public override void DrawProperties() - { - base.DrawProperties(); - EditorGUILayout.BeginVertical(); - - EditorGUI.BeginChangeCheck(); - m_selectedOutputTypeInt = EditorGUILayoutPopup( OutputTypeStr, m_selectedOutputTypeInt, m_outputValueTypes ); - if( EditorGUI.EndChangeCheck() ) - { - SetupPorts(); - } - - EditorGUILayout.EndVertical(); - } - - 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 result = string.Empty; - for( int i = 0; i < 4; i++ ) - { - if( m_inputPorts[ i ].Visible ) - { - if( i > 0 ) - { - result += " , "; - } - result += m_inputPorts[ i ].GeneratePortInstructions( ref dataCollector ); - } - } - - result = string.Format( OutputFormatStr, - UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, m_selectedOutputType ), - result ); - - RegisterLocalVariable( 0, result, ref dataCollector, "appendResult" + OutputId ); - return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - m_selectedOutputType = (WirePortDataType)Enum.Parse( typeof( WirePortDataType ), GetCurrentParam( ref nodeParams ) ); - switch( m_selectedOutputType ) - { - case WirePortDataType.FLOAT2: m_selectedOutputTypeInt = 0; break; - case WirePortDataType.FLOAT3: m_selectedOutputTypeInt = 1; break; - case WirePortDataType.FLOAT4: m_selectedOutputTypeInt = 2; break; - case WirePortDataType.COLOR: m_selectedOutputTypeInt = 3; break; - } - } - - public override void ReadFromDeprecated( ref string[] nodeParams, Type oldType = null ) - { - m_selectedOutputType = (WirePortDataType)Enum.Parse( typeof( WirePortDataType ), GetCurrentParam( ref nodeParams ) ); - switch( m_selectedOutputType ) - { - case WirePortDataType.FLOAT2: m_selectedOutputTypeInt = 0; break; - case WirePortDataType.FLOAT3: m_selectedOutputTypeInt = 1; break; - case WirePortDataType.FLOAT4: m_selectedOutputTypeInt = 2; break; - case WirePortDataType.COLOR: m_selectedOutputTypeInt = 3; break; - } - for( int i = 0; i < 4; i++ ) - { - m_inputPorts[i].FloatInternalData = Convert.ToSingle( GetCurrentParam( ref nodeParams ) ); - } - } - - public override void RefreshExternalReferences() - { - base.RefreshExternalReferences(); - - if( UIUtils.CurrentShaderVersion() < 13206 ) - { - //TODO: MAKE THIS LESS BRUTE FORCE - List<AppendData> reroutes = new List<AppendData>(); - int availableChannel = 0; - for( int i = 0; i < 4 && availableChannel < 4; i++ ) - { - int channelsAmount = UIUtils.GetChannelsAmount( m_inputPorts[ i ].DataType ); - if( m_inputPorts[ i ].IsConnected /*&& availableChannel != i*/ ) - { - reroutes.Add( new AppendData( m_inputPorts[ i ].DataType, i, availableChannel ) ); - } - - availableChannel += channelsAmount; - } - - if( reroutes.Count > 0 ) - { - for( int i = reroutes.Count - 1; i > -1; i-- ) - { - int nodeId = m_inputPorts[ reroutes[ i ].OldPortId ].ExternalReferences[ 0 ].NodeId; - int portId = m_inputPorts[ reroutes[ i ].OldPortId ].ExternalReferences[ 0 ].PortId; - - m_containerGraph.DeleteConnection( true, UniqueId, reroutes[ i ].OldPortId, false, false, false ); - m_containerGraph.CreateConnection( UniqueId, reroutes[ i ].NewPortId, nodeId, portId, false ); - NewUpdateBehaviorConn( reroutes[ i ].NewPortId, true ); - } - } - - availableChannel = UIUtils.GetChannelsAmount( m_selectedOutputType ); - int currChannelIdx = 0; - for( ; currChannelIdx < availableChannel; currChannelIdx++ ) - { - if( m_inputPorts[ currChannelIdx ].Visible ) - { - int channelsAmount = UIUtils.GetChannelsAmount( m_inputPorts[ currChannelIdx ].DataType ); - for( int j = currChannelIdx + 1; j < currChannelIdx + channelsAmount; j++ ) - { - m_inputPorts[ j ].Visible = false; - } - } - } - - for( ; currChannelIdx < 4; currChannelIdx++ ) - { - m_inputPorts[ currChannelIdx ].Visible = false; - } - } - SetupPorts(); - m_sizeIsDirty = true; - } - - - void CalculatePreviewData() - { - switch( m_outputPorts[ 0 ].DataType ) - { - default: m_maskValue = Vector4.zero; break; - case WirePortDataType.INT: - case WirePortDataType.FLOAT: m_maskValue = new Vector4( 1, 0, 0, 0 ); break; - case WirePortDataType.FLOAT2: m_maskValue = new Vector4( 1, 1, 0, 0 ); break; - case WirePortDataType.FLOAT3: m_maskValue = new Vector4( 1, 1, 1, 0 ); break; - case WirePortDataType.FLOAT4: - case WirePortDataType.COLOR: m_maskValue = Vector4.one; break; - } - - m_previewMaterialPassId = -1; - switch( m_inputPorts[ 0 ].DataType ) - { - case WirePortDataType.INT: - case WirePortDataType.FLOAT: - { - switch( m_inputPorts[ 1 ].DataType ) - { - case WirePortDataType.FLOAT: - case WirePortDataType.INT: - { - if( m_inputPorts[ 2 ].DataType == WirePortDataType.FLOAT || - m_inputPorts[ 2 ].DataType == WirePortDataType.INT ) - { - m_previewMaterialPassId = 0; - } - else if( m_inputPorts[ 2 ].DataType == WirePortDataType.FLOAT2 ) - { - m_previewMaterialPassId = 1; - } - } - break; - case WirePortDataType.FLOAT2: m_previewMaterialPassId = 2; break; - case WirePortDataType.FLOAT3: m_previewMaterialPassId = 3; break; - } - - }; break; - case WirePortDataType.FLOAT2: - { - if( m_inputPorts[ 2 ].DataType == WirePortDataType.FLOAT || - m_inputPorts[ 2 ].DataType == WirePortDataType.INT ) - { - m_previewMaterialPassId = 4; - } - else if( m_inputPorts[ 2 ].DataType == WirePortDataType.FLOAT2 ) - { - m_previewMaterialPassId = 5; - } - }; break; - case WirePortDataType.FLOAT3: m_previewMaterialPassId = 6; break; - case WirePortDataType.FLOAT4: - case WirePortDataType.COLOR: m_previewMaterialPassId = 7; break; - } - - if( m_previewMaterialPassId == -1 ) - { - m_previewMaterialPassId = 0; - if( DebugConsoleWindow.DeveloperMode ) - { - UIUtils.ShowMessage( UniqueId, "Could not find pass ID for append" , MessageSeverity.Error ); - } - } - } - - public override void SetPreviewInputs() - { - base.SetPreviewInputs(); - PreviewMaterial.SetVector( m_maskId, m_maskValue ); - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_selectedOutputType ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/DynamicAppendNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/DynamicAppendNode.cs.meta deleted file mode 100644 index c442e367..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/DynamicAppendNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: bc524cd13743b6f49a2e331767646448 -timeCreated: 1500632879 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/FresnelNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/FresnelNode.cs deleted file mode 100644 index 7cb2a329..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/FresnelNode.cs +++ /dev/null @@ -1,393 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> -// http://kylehalladay.com/blog/tutorial/2014/02/18/Fresnel-Shaders-From-The-Ground-Up.html -// http://http.developer.nvidia.com/CgTutorial/cg_tutorial_chapter07.html - -using System; -using UnityEngine; -using UnityEditor; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Fresnel", "Surface Data", "Simple Fresnel effect" )] - public sealed class FresnelNode : ParentNode - { - private const string FresnedFinalVar = "fresnelNode"; - - [SerializeField] - private ViewSpace m_normalSpace = ViewSpace.Tangent; - - enum FresnelType - { - Standard = 0, - Schlick, - SchlickIOR, - } - - enum NormalType - { - WorldNormal = 0, - TangentNormal, - HalfVector, - } - - enum ViewType - { - ViewDir = 0, - LightDir, - } - - [SerializeField] - private FresnelType m_fresnelType = FresnelType.Standard; - - [SerializeField] - private NormalType m_normalType = NormalType.WorldNormal; - - [SerializeField] - private ViewType m_viewType = ViewType.ViewDir; - - [SerializeField] - private bool m_normalizeVectors = false; - - [SerializeField] - private bool m_safePower = false; - - private InputPort m_normalVecPort; - private InputPort m_viewVecPort; - private InputPort m_biasPort; - private InputPort m_scalePort; - private InputPort m_powerPort; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT3, false, "World Normal", -1, MasterNodePortCategory.Fragment, 0 ); - AddInputPort( WirePortDataType.FLOAT3, false, "View Dir", -1, MasterNodePortCategory.Fragment, 4 ); - AddInputPort( WirePortDataType.FLOAT, false, "Bias", -1, MasterNodePortCategory.Fragment, 1 ); - AddInputPort( WirePortDataType.FLOAT, false, "Scale", -1, MasterNodePortCategory.Fragment, 2 ); - AddInputPort( WirePortDataType.FLOAT, false, "Power", -1, MasterNodePortCategory.Fragment, 3 ); - AddOutputPort( WirePortDataType.FLOAT, "Out" ); - - m_normalVecPort = m_inputPorts[ 0 ]; - m_viewVecPort = m_inputPorts[ 1 ]; - m_biasPort = m_inputPorts[ 2 ]; - m_scalePort = m_inputPorts[ 3 ]; - m_powerPort = m_inputPorts[ 4 ]; - - m_biasPort.AutoDrawInternalData = true; - m_scalePort.AutoDrawInternalData = true; - m_powerPort.AutoDrawInternalData = true; - m_autoWrapProperties = true; - m_drawPreviewAsSphere = true; - m_normalVecPort.Vector3InternalData = Vector3.forward; - m_scalePort.FloatInternalData = 1; - m_powerPort.FloatInternalData = 5; - m_previewShaderGUID = "240145eb70cf79f428015012559f4e7d"; - } - - public override void SetPreviewInputs() - { - base.SetPreviewInputs(); - - //m_mate - PreviewMaterial.SetInt( "_FresnelType", (int)m_fresnelType ); - - if( m_normalType == NormalType.TangentNormal && m_normalVecPort.IsConnected ) - m_previewMaterialPassId = 2; - else if( (m_normalType == NormalType.WorldNormal || m_normalType == NormalType.HalfVector ) && m_normalVecPort.IsConnected && !m_viewVecPort.IsConnected ) - m_previewMaterialPassId = 1; - else if( m_normalType == NormalType.HalfVector && !m_normalVecPort.IsConnected && !m_viewVecPort.IsConnected ) - m_previewMaterialPassId = 3; - else if( m_normalVecPort.IsConnected && m_viewVecPort.IsConnected ) - m_previewMaterialPassId = 4; - else if( !m_normalVecPort.IsConnected && !m_viewVecPort.IsConnected && m_viewType == ViewType.LightDir ) - m_previewMaterialPassId = 5; - else if( !m_normalVecPort.IsConnected && m_viewVecPort.IsConnected && m_normalType == NormalType.HalfVector ) - m_previewMaterialPassId = 7; - else if( !m_normalVecPort.IsConnected && m_viewVecPort.IsConnected ) - m_previewMaterialPassId = 6; - else - m_previewMaterialPassId = 0; - } - - public override void DrawProperties() - { - base.DrawProperties(); - - EditorGUI.BeginChangeCheck(); - m_fresnelType = (FresnelType)EditorGUILayoutEnumPopup( "Type", m_fresnelType ); - m_normalType = (NormalType)EditorGUILayoutEnumPopup( "Normal Vector", m_normalType ); - m_viewType = (ViewType)EditorGUILayoutEnumPopup( "View Vector", m_viewType ); - if( EditorGUI.EndChangeCheck() ) - { - UpdatePort(); - } - - if( !m_biasPort.IsConnected && m_biasPort.Visible ) - m_biasPort.FloatInternalData = EditorGUILayoutFloatField( m_biasPort.Name, m_biasPort.FloatInternalData ); - if( !m_scalePort.IsConnected && m_scalePort.Visible ) - m_scalePort.FloatInternalData = EditorGUILayoutFloatField( m_scalePort.Name, m_scalePort.FloatInternalData ); - if( !m_powerPort.IsConnected && m_powerPort.Visible ) - m_powerPort.FloatInternalData = EditorGUILayoutFloatField( m_powerPort.Name, m_powerPort.FloatInternalData ); - - m_normalizeVectors = EditorGUILayoutToggle( "Normalize Vectors", m_normalizeVectors ); - m_safePower = EditorGUILayoutToggle( PowerNode.SafePowerLabel, m_safePower ); - } - - private void UpdatePort() - { - switch( m_normalType ) - { - default: - case NormalType.WorldNormal: - m_normalVecPort.Name = "World Normal"; - break; - case NormalType.TangentNormal: - m_normalVecPort.Name = "Normal"; - break; - case NormalType.HalfVector: - m_normalVecPort.Name = "Half Vector"; - break; - } - - switch( m_viewType ) - { - default: - case ViewType.ViewDir: - m_viewVecPort.Name = "View Dir"; - break; - case ViewType.LightDir: - m_viewVecPort.Name = "Light Dir"; - break; - } - - switch( m_fresnelType ) - { - default: - case FresnelType.Standard: - m_biasPort.Visible = true; - m_biasPort.Name = "Bias"; - m_scalePort.Name = "Scale"; - m_scalePort.Visible = true; - m_powerPort.Visible = true; - break; - case FresnelType.Schlick: - m_biasPort.Visible = true; - m_biasPort.Name = "F0"; - m_scalePort.Visible = false; - m_powerPort.Visible = false; - break; - case FresnelType.SchlickIOR: - m_biasPort.Visible = false; - m_scalePort.Name = "IOR"; - m_scalePort.Visible = true; - m_powerPort.Visible = false; - break; - } - - m_sizeIsDirty = true; - } - - 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 ); - - if( dataCollector.IsFragmentCategory ) - dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_POS ); - - string viewdir = string.Empty; - if( m_viewType == ViewType.ViewDir ) - { - if( m_viewVecPort.IsConnected ) - viewdir = m_viewVecPort.GeneratePortInstructions( ref dataCollector ); - else - viewdir = GeneratorUtils.GenerateViewDirection( ref dataCollector, UniqueId, ViewSpace.World ); - } - else - { - if( m_viewVecPort.IsConnected ) - viewdir = m_viewVecPort.GeneratePortInstructions( ref dataCollector ); - else - viewdir = GeneratorUtils.GenerateWorldLightDirection( ref dataCollector, UniqueId, CurrentPrecisionType ); - } - - string normal = string.Empty; - if( m_normalType == NormalType.WorldNormal || m_normalType == NormalType.TangentNormal ) - { - if( m_normalVecPort.IsConnected ) - { - normal = m_normalVecPort.GeneratePortInstructions( ref dataCollector ); - - if( dataCollector.IsFragmentCategory ) - { - dataCollector.AddToInput( UniqueId, SurfaceInputs.INTERNALDATA, addSemiColon: false ); - - if( m_normalType == NormalType.TangentNormal ) - { - if( dataCollector.IsTemplate ) - { - normal = dataCollector.TemplateDataCollectorInstance.GetWorldNormal( UniqueId, CurrentPrecisionType, normal, OutputId ); - } - else - { - normal = GeneratorUtils.GenerateWorldNormal( ref dataCollector, UniqueId, CurrentPrecisionType, normal, OutputId ); - dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_NORMAL, CurrentPrecisionType ); - dataCollector.ForceNormal = true; - } - } - else - { - if( m_normalizeVectors ) - normal = string.Format( "normalize( {0} )", normal ); - } - } - else - { - if( m_normalType == NormalType.TangentNormal ) - { - string wtMatrix = GeneratorUtils.GenerateWorldToTangentMatrix( ref dataCollector, UniqueId, CurrentPrecisionType ); - normal = "mul( " + normal + "," + wtMatrix + " )"; - } - } - } - else - { - if( dataCollector.IsFragmentCategory ) - { - dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_NORMAL, CurrentPrecisionType ); - if( dataCollector.DirtyNormal ) - dataCollector.AddToInput( UniqueId, SurfaceInputs.INTERNALDATA, addSemiColon: false ); - } - - if( dataCollector.IsTemplate ) - normal = dataCollector.TemplateDataCollectorInstance.GetWorldNormal( CurrentPrecisionType, normalize: ( dataCollector.DirtyNormal && m_normalizeVectors ) ); - else - normal = GeneratorUtils.GenerateWorldNormal( ref dataCollector, UniqueId, ( dataCollector.DirtyNormal && m_normalizeVectors ) ); - - if( dataCollector.DirtyNormal ) - { - dataCollector.ForceNormal = true; - } - } - } - else - { - // generate HV - if( !m_normalVecPort.IsConnected ) - { - string halfView = GeneratorUtils.GenerateViewDirection( ref dataCollector, UniqueId, ViewSpace.World ); - string halfLight = GeneratorUtils.GenerateWorldLightDirection( ref dataCollector, UniqueId, CurrentPrecisionType ); - normal = "halfVector" + OutputId; - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT3, normal, "normalize( " + halfView + " + " + halfLight + " )" ); - } - else - { - normal = m_normalVecPort.GeneratePortInstructions( ref dataCollector ); - if( m_normalizeVectors ) - normal = string.Format( "normalize( {0} )", normal ); - } - } - - string bias = m_biasPort.GeneratePortInstructions( ref dataCollector ); - string scale = m_scalePort.GeneratePortInstructions( ref dataCollector ); - string power = m_powerPort.GeneratePortInstructions( ref dataCollector ); - - string fresnelNDotVLocalValue = "dot( " + normal + ", " + viewdir + " )"; - string fresnelNDotVLocalVar = "fresnelNdotV" + OutputId; - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT, fresnelNDotVLocalVar, fresnelNDotVLocalValue ); - - string fresnelFinalVar = FresnedFinalVar + OutputId; - - string result = string.Empty; - switch( m_fresnelType ) - { - default: - case FresnelType.Standard: - { - string powOp = m_safePower? string.Format( "pow( max( 1.0 - {0} , 0.0001 ), {1} )", fresnelNDotVLocalVar, power ): - string.Format( "pow( 1.0 - {0}, {1} )", fresnelNDotVLocalVar, power ); - result = string.Format( "( {0} + {1} * {2} )", bias, scale, powOp ); - } - break; - case FresnelType.Schlick: - { - string f0VarName = "f0" + OutputId; - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT, f0VarName, bias ); - string powOp = m_safePower? string.Format( "pow( max( 1.0 - {0} , 0.0001 ), 5 )", fresnelNDotVLocalVar ) : - string.Format( "pow( 1.0 - {0}, 5 )", fresnelNDotVLocalVar ); - result = string.Format( "( {0} + ( 1.0 - {0} ) * {1} )", f0VarName, powOp ); - } - break; - case FresnelType.SchlickIOR: - { - string iorVarName = "ior" + OutputId; - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT, iorVarName, scale ); - string iorPowOp = m_safePower? string.Format( "pow( max( ( 1 - {0} ) / ( 1 + {0} ) , 0.0001 ), 2 )", iorVarName ): - string.Format( "pow( ( 1 - {0} ) / ( 1 + {0} ), 2 )", iorVarName ); - - dataCollector.AddLocalVariable( UniqueId, iorVarName +" = "+ iorPowOp + ";"); - - string fresnelPowOp = m_safePower? string.Format( "pow( max( 1.0 - {0} , 0.0001 ), 5 )", fresnelNDotVLocalVar ): - string.Format( "pow( 1.0 - {0}, 5 )", fresnelNDotVLocalVar ); - result = string.Format( "( {0} + ( 1.0 - {0} ) * {1} )", iorVarName, fresnelPowOp ); - } - break; - } - - RegisterLocalVariable( 0, result, ref dataCollector, fresnelFinalVar ); - return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); - } - - public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) - { - base.PropagateNodeData( nodeData, ref dataCollector ); - if( m_normalType == NormalType.TangentNormal && m_normalVecPort.IsConnected ) - dataCollector.DirtyNormal = true; - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - - if( UIUtils.CurrentShaderVersion() > 15305 ) - { - m_fresnelType = (FresnelType)Enum.Parse( typeof( FresnelType ), GetCurrentParam( ref nodeParams ) ); - m_normalType = (NormalType)Enum.Parse( typeof( NormalType ), GetCurrentParam( ref nodeParams ) ); - m_viewType = (ViewType)Enum.Parse( typeof( ViewType ), GetCurrentParam( ref nodeParams ) ); - m_normalizeVectors = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - if( UIUtils.CurrentShaderVersion() > 17502 ) - m_safePower = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - } - else - { - if( UIUtils.CurrentShaderVersion() >= 13202 ) - { - m_normalSpace = (ViewSpace)Enum.Parse( typeof( ViewSpace ), GetCurrentParam( ref nodeParams ) ); - } - else - { - m_normalSpace = ViewSpace.World; - } - - if( m_normalSpace == ViewSpace.World ) - m_normalType = NormalType.WorldNormal; - else - m_normalType = NormalType.TangentNormal; - } - UpdatePort(); - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - - IOUtils.AddFieldValueToString( ref nodeInfo, m_fresnelType ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_normalType ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_viewType ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_normalizeVectors ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_safePower ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/FresnelNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/FresnelNode.cs.meta deleted file mode 100644 index 54876f82..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/FresnelNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 91955bc593b0dc14d90b10cb3eb25355 -timeCreated: 1481126957 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/GetLocalVarNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/GetLocalVarNode.cs deleted file mode 100644 index 7a5b54f2..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/GetLocalVarNode.cs +++ /dev/null @@ -1,430 +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.Collections.Generic; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Get Local Var", "Miscellaneous", "Use a registered local variable", null, KeyCode.G )] - public class GetLocalVarNode : ParentNode - { - [SerializeField] - private int m_referenceId = -1; - - [SerializeField] - private float m_referenceWidth = -1; - - [SerializeField] - private int m_nodeId = -1; - - [SerializeField] - private RegisterLocalVarNode m_currentSelected = null; - - [SerializeField] - private string m_registerLocalVarName = string.Empty; - - private int m_cachedPropertyId = -1; - - private string m_previousLabel = string.Empty; - - private bool m_refSelect = false; - private int m_prevReferenceId = -1; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddOutputPort( WirePortDataType.OBJECT, Constants.EmptyPortValue ); - - // This is needed for infinite loop detection - AddInputPort( WirePortDataType.OBJECT, false, Constants.EmptyPortValue ); - m_inputPorts[ 0 ].Visible = false; - - m_outputPorts[ 0 ].Locked = true; - m_textLabelWidth = 80; - m_autoWrapProperties = true; - m_hasLeftDropdown = true; - m_previewShaderGUID = "f21a6e44c7d7b8543afacd19751d24c6"; - } - - protected override void OnUniqueIDAssigned() - { - base.OnUniqueIDAssigned(); - - if( UniqueId > -1 ) - m_containerGraph.LocalVarNodes.OnReorderEventComplete += OnReorderEventComplete; - } - - private void OnReorderEventComplete() - { - if( m_currentSelected != null ) - { - m_referenceId = m_containerGraph.LocalVarNodes.GetNodeRegisterIdx( m_currentSelected.UniqueId ); - } - } - - public override void SetPreviewInputs() - { - base.SetPreviewInputs(); - - if( m_currentSelected != null ) - { - if( m_drawPreviewAsSphere != m_currentSelected.SpherePreview ) - { - m_drawPreviewAsSphere = m_currentSelected.SpherePreview; - OnNodeChange(); - } - //CheckSpherePreview(); - - if( m_cachedPropertyId == -1 ) - m_cachedPropertyId = Shader.PropertyToID( "_A" ); - - PreviewMaterial.SetTexture( m_cachedPropertyId, m_currentSelected.OutputPorts[ 0 ].OutputPreviewTexture ); - } - } - - public override void DrawProperties() - { - base.DrawProperties(); - EditorGUILayout.BeginHorizontal(); - EditorGUI.BeginChangeCheck(); - m_referenceId = EditorGUILayoutPopup( Constants.AvailableReferenceStr, m_referenceId, UIUtils.LocalVarNodeArr() ); - if( EditorGUI.EndChangeCheck() ) - { - UpdateFromSelected(); - } - - if( GUILayout.Button( "\u25C4", "minibutton", GUILayout.Width( 17 ) ) && m_currentSelected ) - { - UIUtils.FocusOnNode( m_currentSelected, 0, false ); - } - EditorGUILayout.EndHorizontal(); - //EditorGUILayout.LabelField( ConnStatus.ToString() + " " + m_activeConnections ); - } - - public override void Destroy() - { - base.Destroy(); - CurrentSelected = null; - if( UniqueId > -1 ) - m_containerGraph.LocalVarNodes.OnReorderEventComplete -= OnReorderEventComplete; - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - - if( m_dropdownEditing ) - { - EditorGUI.BeginChangeCheck(); - m_referenceId = EditorGUIPopup( m_dropdownRect, m_referenceId, UIUtils.LocalVarNodeArr(), UIUtils.PropertyPopUp ); - if( EditorGUI.EndChangeCheck() ) - { - UpdateFromSelected(); - DropdownEditing = false; - } - } - } - - public override void OnNodeLogicUpdate( DrawInfo drawInfo ) - { - base.OnNodeLogicUpdate( drawInfo ); - UpdateLocalVar(); - } - - public override void OnNodeRepaint( DrawInfo drawInfo ) - { - base.OnNodeRepaint( drawInfo ); - - if( m_isVisible && m_refSelect && !m_selected ) - { - GUI.color = Constants.SpecialGetLocalVarSelectionColor; - GUI.Label( m_globalPosition, string.Empty, UIUtils.GetCustomStyle( CustomStyle.NodeWindowOn ) ); - GUI.color = m_colorBuffer; - } - } - - void CheckForLoops() - { - if( CurrentSelected != null && UIUtils.DetectNodeLoopsFrom( CurrentSelected, new Dictionary<int, int>() ) ) - { - CurrentSelected = UIUtils.GetLocalVarNode( m_prevReferenceId ); - if( CurrentSelected == null || UIUtils.DetectNodeLoopsFrom( CurrentSelected, new Dictionary<int, int>() ) ) - { - m_referenceId = -1; - m_prevReferenceId = -1; - CurrentSelected = null; - m_outputPorts[ 0 ].Locked = true; - SetAdditonalTitleText( "" ); - UIUtils.ShowMessage( "Infinite Loop detected, disabled selection" ); - } - else - { - m_referenceId = m_prevReferenceId; - UIUtils.ShowMessage( "Infinite Loop detected, reverted to previous selection" ); - } - } - } - - void UpdateFromSelected() - { - CurrentSelected = UIUtils.GetLocalVarNode( m_referenceId ); - CheckForLoops(); - - if( m_currentSelected != null ) - { - m_nodeId = m_currentSelected.UniqueId; - m_outputPorts[ 0 ].Locked = false; - m_outputPorts[ 0 ].ChangeType( m_currentSelected.OutputPorts[ 0 ].DataType, false ); - m_drawPreviewAsSphere = m_currentSelected.SpherePreview; - CheckSpherePreview(); - - m_previousLabel = m_currentSelected.DataToArray; - SetAdditonalTitleText( string.Format( Constants.SubTitleVarNameFormatStr, m_currentSelected.DataToArray ) ); - m_referenceWidth = m_currentSelected.Position.width; - } - - m_sizeIsDirty = true; - m_isDirty = true; - m_prevReferenceId = m_referenceId; - } - - void UpdateLocalVar() - { - m_refSelect = false; - if( m_referenceId > -1 ) - { - ParentNode newNode = UIUtils.GetLocalVarNode( m_referenceId ); - if( newNode != null ) - { - if( newNode.UniqueId != m_nodeId ) - { - CurrentSelected = null; - int count = UIUtils.LocalVarNodeAmount(); - for( int i = 0; i < count; i++ ) - { - ParentNode node = UIUtils.GetLocalVarNode( i ); - if( node.UniqueId == m_nodeId ) - { - CurrentSelected = node as RegisterLocalVarNode; - m_referenceId = i; - break; - } - } - } - } - - if( m_currentSelected != null ) - { - if( m_currentSelected.OutputPorts[ 0 ].DataType != m_outputPorts[ 0 ].DataType ) - { - m_outputPorts[ 0 ].Locked = false; - m_outputPorts[ 0 ].ChangeType( m_currentSelected.OutputPorts[ 0 ].DataType, false ); - } - - if( !m_previousLabel.Equals( m_currentSelected.DataToArray ) ) - { - m_previousLabel = m_currentSelected.DataToArray; - SetAdditonalTitleText( string.Format( Constants.SubTitleVarNameFormatStr, m_currentSelected.DataToArray ) ); - } - - if( m_referenceWidth != m_currentSelected.Position.width ) - { - m_referenceWidth = m_currentSelected.Position.width; - m_sizeIsDirty = true; - } - - if( m_currentSelected.Selected ) - m_refSelect = true; - } - else - { - ResetReference(); - } - } - } - - public void ResetReference() - { - m_outputPorts[ 0 ].Locked = true; - m_currentSelected = null; - m_inputPorts[ 0 ].DummyClear(); - m_nodeId = -1; - m_referenceId = -1; - m_referenceWidth = -1; - SetAdditonalTitleText( string.Empty ); - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if( m_currentSelected != null ) - { - return m_currentSelected.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); - } - else - { - UIUtils.ShowMessage( UniqueId, "Get Local Var node without reference. Attempting to access inexistant local variable.", MessageSeverity.Error ); - - return m_outputPorts[ 0 ].ErrorValue; - } - } - - - //public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) - //{ - // base.PropagateNodeData( nodeData, ref dataCollector ); - // if( m_currentSelected != null ) - // { - // m_currentSelected.PropagateNodeData( nodeData, ref dataCollector ); - // } - //} - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - if( UIUtils.CurrentShaderVersion() > 15 ) - { - m_nodeId = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - m_outputPorts[ 0 ].Locked = ( m_nodeId < 0 ); - if( UIUtils.CurrentShaderVersion() > 15500 ) - { - m_registerLocalVarName = GetCurrentParam( ref nodeParams ); - } - } - else - { - m_referenceId = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - m_outputPorts[ 0 ].Locked = ( m_referenceId < 0 ); - } - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - if( m_currentSelected != null ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_currentSelected.UniqueId ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_currentSelected.DataToArray ); - } - else - { - IOUtils.AddFieldValueToString( ref nodeInfo, -1 ); - IOUtils.AddFieldValueToString( ref nodeInfo, string.Empty ); - } - - } - - public override void OnNodeDoubleClicked( Vector2 currentMousePos2D ) - { - if( m_currentSelected != null ) - { - UIUtils.FocusOnNode( m_currentSelected, 0, true ); - } - } - - public override void RefreshExternalReferences() - { - base.RefreshExternalReferences(); - if( UIUtils.CurrentShaderVersion() > 15 ) - { - CurrentSelected = UIUtils.GetNode( m_nodeId ) as RegisterLocalVarNode; - m_referenceId = UIUtils.GetLocalVarNodeRegisterId( m_nodeId ); - if( CurrentSelected == null && UIUtils.CurrentShaderVersion() > 15500 && !string.IsNullOrEmpty( m_registerLocalVarName ) ) - { - CurrentSelected = m_containerGraph.LocalVarNodes.GetNodeByDataToArray( m_registerLocalVarName ); - if( CurrentSelected != null ) - { - m_nodeId = CurrentSelected.UniqueId; - m_referenceId = UIUtils.GetLocalVarNodeRegisterId( m_nodeId ); - } - } - } - else - { - CurrentSelected = UIUtils.GetLocalVarNode( m_referenceId ); - if( m_currentSelected != null ) - { - m_nodeId = m_currentSelected.UniqueId; - } - } - - CheckForLoops(); - - if( m_currentSelected != null ) - { - m_outputPorts[ 0 ].Locked = false; - m_outputPorts[ 0 ].ChangeType( m_currentSelected.OutputPorts[ 0 ].DataType, false ); - } - else - { - m_outputPorts[ 0 ].Locked = true; - } - } - - public override void ActivateNode( int signalGenNodeId, int signalGenPortId, System.Type signalGenNodeType ) - { - base.ActivateNode( signalGenNodeId, signalGenPortId, signalGenNodeType ); - if( m_activeConnections == 1 ) - { - if( m_currentSelected != null ) - { - m_currentSelected.ActivateNode( signalGenNodeId, signalGenPortId, signalGenNodeType ); - } - } - } - - public override void DeactivateNode( int deactivatedPort, bool forceComplete ) - { - forceComplete = forceComplete || ( m_activeConnections == 1 ); - base.DeactivateNode( deactivatedPort, forceComplete ); - if( forceComplete && m_currentSelected != null ) - { - m_currentSelected.DeactivateNode( deactivatedPort, false ); - } - } - - public override void OnNodeSelected( bool value ) - { - base.OnNodeSelected( value ); - if( m_currentSelected != null ) - { - m_currentSelected.CheckReferenceSelection(); - } - } - - public RegisterLocalVarNode CurrentSelected - { - get { return m_currentSelected; } - set - { - // This is needed for infinite loop detection - if( m_inputPorts != null ) - m_inputPorts[ 0 ].DummyClear(); - - if( m_currentSelected != null ) - { - m_currentSelected.UnregisterGetLocalVar( this ); - - //if( m_currentSelected != value ) - m_currentSelected.DeactivateNode( 0, false ); - } - - if( value != null ) - { - value.RegisterGetLocalVar( this ); - if( IsConnected && value != m_currentSelected ) - value.ActivateNode( UniqueId, 0, m_activeType ); - - // This is needed for infinite loop detection - m_inputPorts[ 0 ].DummyAdd( value.UniqueId, 0 ); ; - } - - m_currentSelected = value; - - } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/GetLocalVarNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/GetLocalVarNode.cs.meta deleted file mode 100644 index 9b80adde..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/GetLocalVarNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: efce529ed3c74854b9d0cece836991c3 -timeCreated: 1481126960 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/LayeredBlendNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/LayeredBlendNode.cs deleted file mode 100644 index 21589b00..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/LayeredBlendNode.cs +++ /dev/null @@ -1,61 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEngine; -using System; -using UnityEditor; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Layered Blend", "Miscellaneous", "Mix all channels through interpolation factors", null, KeyCode.None, true )] - public sealed class LayeredBlendNode : WeightedAvgNode - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_inputPorts[ 1 ].Name = "Layer Base"; - AddInputPort( WirePortDataType.FLOAT, false, string.Empty ); - for ( int i = 2; i < m_inputPorts.Count; i++ ) - { - m_inputPorts[ i ].Name = AmountsStr[ i - 2 ]; - } - m_inputData = new string[ 6 ]; - m_minimumSize = 2; - UpdateConnection( 0 ); - m_previewShaderGUID = "48faca2f6506fc44c97adb1e2b79c37d"; - } - - 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 ); - - GetInputData( ref dataCollector, ignoreLocalvar ); - - string result = string.Empty; - string localVarName = "layeredBlendVar" + OutputId; - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, m_inputPorts[ 0 ].DataType, localVarName, m_inputData[ 0 ] ); - - if ( m_activeCount == 1 ) - { - result = m_inputData[ 0 ]; - } - else if ( m_activeCount == 2 ) - { - result += "lerp( " + m_inputData[ 1 ] + "," + m_inputData[ 2 ] + " , " + localVarName + " )"; - } - else - { - result = m_inputData[ 1 ]; - for ( int i = 1; i < m_activeCount; i++ ) - { - result = "lerp( " + result + " , " + m_inputData[ i + 1 ] + " , " + localVarName + Constants.VectorSuffixes[ i - 1 ] + " )"; - } - } - result = UIUtils.AddBrackets( result ); - RegisterLocalVariable( 0, result, ref dataCollector, "layeredBlend" + OutputId ); - return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/LayeredBlendNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/LayeredBlendNode.cs.meta deleted file mode 100644 index bcfcd292..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/LayeredBlendNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 90801da82a0b4f74cae2f9387bd5ad92 -timeCreated: 1481126957 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/LinearDepthNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/LinearDepthNode.cs deleted file mode 100644 index 0193bbc9..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/LinearDepthNode.cs +++ /dev/null @@ -1,97 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using UnityEngine; -using UnityEditor; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Linear Depth", "Miscellaneous", "Converts depth values given on logarithmic space to linear" )] - public sealed class LinearDepthNode : ParentNode - { - private readonly string[] LinearModeLabels = { "Eye Space", "0-1 Space" }; - - private const string LinearEyeFuncFormat = "LinearEyeDepth({0})"; - private const string Linear01FuncFormat = "Linear01Depth({0})"; - private const string LinerValName = "depthToLinear"; - private const string ViewSpaceLabel = "View Space"; - - private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper(); - - [SerializeField] - private int m_currentOption = 0; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT, false, Constants.EmptyPortValue ); - AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); - m_autoWrapProperties = true; - m_hasLeftDropdown = true; - m_previewShaderGUID = "2b0785cc8b854974ab4e45419072705a"; - UpdateFromOption(); - } - - public override void Destroy() - { - base.Destroy(); - m_upperLeftWidget = null; - } - - void UpdateFromOption() - { - m_previewMaterialPassId = m_currentOption; - SetAdditonalTitleText( string.Format( Constants.SubTitleSpaceFormatStr, LinearModeLabels[ m_currentOption ] ) ); - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - EditorGUI.BeginChangeCheck(); - m_currentOption = m_upperLeftWidget.DrawWidget( this, m_currentOption, LinearModeLabels ); - if( EditorGUI.EndChangeCheck() ) - { - UpdateFromOption(); - } - } - - public override void DrawProperties() - { - base.DrawProperties(); - EditorGUI.BeginChangeCheck(); - m_currentOption = EditorGUILayoutPopup( ViewSpaceLabel, m_currentOption, LinearModeLabels ); - if( EditorGUI.EndChangeCheck() ) - { - SetAdditonalTitleText( string.Format( Constants.SubTitleSpaceFormatStr, LinearModeLabels[ m_currentOption ] ) ); - } - } - - 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 ); - - base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); - - string value = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - value = string.Format( (( m_currentOption == 0 ) ? LinearEyeFuncFormat : Linear01FuncFormat), value ); - RegisterLocalVariable( 0, value, ref dataCollector, LinerValName + OutputId ); - return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_currentOption ); - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - int.TryParse( GetCurrentParam( ref nodeParams ), out m_currentOption ); - UpdateFromOption(); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/LinearDepthNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/LinearDepthNode.cs.meta deleted file mode 100644 index 490856d4..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/LinearDepthNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 8b8af65130c9ed64f95976ec67ac1adf -timeCreated: 1546438982 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/MatrixFromVectors.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/MatrixFromVectors.cs deleted file mode 100644 index af6325bc..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/MatrixFromVectors.cs +++ /dev/null @@ -1,215 +0,0 @@ -using UnityEngine; -using UnityEditor; -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Matrix From Vectors", "Matrix Operators", "Matrix From Vectors" )] - public sealed class MatrixFromVectors : ParentNode - { - private const string RowFromVector = "Input to Row"; - [SerializeField] - private WirePortDataType m_selectedOutputType = WirePortDataType.FLOAT3x3; - - [SerializeField] - private int m_selectedOutputTypeInt = 0; - - [SerializeField] - private Vector3[] m_defaultValuesV3 = { Vector3.zero, Vector3.zero, Vector3.zero }; - - [SerializeField] - private Vector4[] m_defaultValuesV4 = { Vector4.zero, Vector4.zero, Vector4.zero, Vector4.zero }; - - [SerializeField] - private bool m_rowsFromVector = true; - - private string[] m_defaultValuesStr = { "[0]", "[1]", "[2]", "[3]" }; - - private readonly string[] _outputValueTypes ={ "Matrix3X3", - "Matrix4X4"}; - - private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper(); - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT4, false, "[0]" ); - AddInputPort( WirePortDataType.FLOAT4, false, "[1]" ); - AddInputPort( WirePortDataType.FLOAT4, false, "[2]" ); - AddInputPort( WirePortDataType.FLOAT4, false, "[3]" ); - AddOutputPort( m_selectedOutputType, Constants.EmptyPortValue ); - m_textLabelWidth = 90; - m_autoWrapProperties = true; - m_hasLeftDropdown = true; - UpdatePorts(); - } - - public override void AfterCommonInit() - { - base.AfterCommonInit(); - if( PaddingTitleLeft == 0 ) - { - PaddingTitleLeft = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; - if( PaddingTitleRight == 0 ) - PaddingTitleRight = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; - } - } - - public override void Destroy() - { - base.Destroy(); - m_upperLeftWidget = null; - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - EditorGUI.BeginChangeCheck(); - m_selectedOutputTypeInt = m_upperLeftWidget.DrawWidget( this, m_selectedOutputTypeInt, _outputValueTypes ); - if( EditorGUI.EndChangeCheck() ) - { - switch( m_selectedOutputTypeInt ) - { - case 0: m_selectedOutputType = WirePortDataType.FLOAT3x3; break; - case 1: m_selectedOutputType = WirePortDataType.FLOAT4x4; break; - } - - UpdatePorts(); - } - } - - public override void DrawProperties() - { - base.DrawProperties(); - - EditorGUI.BeginChangeCheck(); - m_selectedOutputTypeInt = EditorGUILayoutPopup( "Output type", m_selectedOutputTypeInt, _outputValueTypes ); - if( EditorGUI.EndChangeCheck() ) - { - switch( m_selectedOutputTypeInt ) - { - case 0: m_selectedOutputType = WirePortDataType.FLOAT3x3; break; - case 1: m_selectedOutputType = WirePortDataType.FLOAT4x4; break; - } - - UpdatePorts(); - } - - int count = 0; - switch( m_selectedOutputType ) - { - case WirePortDataType.FLOAT3x3: - count = 3; - for( int i = 0; i < count; i++ ) - { - if( !m_inputPorts[ i ].IsConnected ) - m_defaultValuesV3[ i ] = EditorGUILayoutVector3Field( m_defaultValuesStr[ i ], m_defaultValuesV3[ i ] ); - } - break; - case WirePortDataType.FLOAT4x4: - count = 4; - for( int i = 0; i < count; i++ ) - { - if( !m_inputPorts[ i ].IsConnected ) - m_defaultValuesV4[ i ] = EditorGUILayoutVector4Field( m_defaultValuesStr[ i ], m_defaultValuesV4[ i ] ); - } - break; - } - m_rowsFromVector = EditorGUILayoutToggle( RowFromVector, m_rowsFromVector ); - } - - void UpdatePorts() - { - m_sizeIsDirty = true; - ChangeOutputType( m_selectedOutputType, false ); - switch( m_selectedOutputType ) - { - case WirePortDataType.FLOAT3x3: - m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT3, false ); - m_inputPorts[ 1 ].ChangeType( WirePortDataType.FLOAT3, false ); - m_inputPorts[ 2 ].ChangeType( WirePortDataType.FLOAT3, false ); - m_inputPorts[ 3 ].ChangeType( WirePortDataType.FLOAT3, false ); - m_inputPorts[ 3 ].Visible = false; - break; - case WirePortDataType.FLOAT4x4: - m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT4, false ); - m_inputPorts[ 1 ].ChangeType( WirePortDataType.FLOAT4, false ); - m_inputPorts[ 2 ].ChangeType( WirePortDataType.FLOAT4, false ); - m_inputPorts[ 3 ].ChangeType( WirePortDataType.FLOAT4, false ); - m_inputPorts[ 3 ].Visible = true; - break; - } - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); - string result = ""; - switch( m_selectedOutputType ) - { - case WirePortDataType.FLOAT3x3: - if( m_rowsFromVector ) - { - result = "float3x3(" + m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ) + ", " - + m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ) + ", " - + m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ) + ")"; - } - else - { - string vec0 = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - string vec1 = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); - string vec2 = m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ); - result = string.Format( "float3x3({0}.x,{1}.x,{2}.x,{0}.y,{1}.y,{2}.y,{0}.z,{1}.z,{2}.z )", vec0, vec1, vec2 ); - } - break; - case WirePortDataType.FLOAT4x4: - if( m_rowsFromVector ) - { - result = "float4x4(" + m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ) + ", " - + m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ) + ", " - + m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ) + ", " - + m_inputPorts[ 3 ].GeneratePortInstructions( ref dataCollector ) + ")"; - } - else - { - string vec0 = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - string vec1 = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); - string vec2 = m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ); - string vec3 = m_inputPorts[ 3 ].GeneratePortInstructions( ref dataCollector ); - result = string.Format( "float4x4( {0}.x,{1}.x,{2}.x,{3}.x,{0}.y,{1}.y,{2}.y,{3}.y,{0}.z,{1}.z,{2}.z,{3}.z,{0}.w,{1}.w,{2}.w,{3}.w )", vec0, vec1, vec2, vec3 ); - } - break; - } - - return result; - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - m_selectedOutputType = (WirePortDataType)Enum.Parse( typeof( WirePortDataType ), GetCurrentParam( ref nodeParams ) ); - if( UIUtils.CurrentShaderVersion() > 15310 ) - { - m_rowsFromVector = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - } - switch( m_selectedOutputType ) - { - case WirePortDataType.FLOAT3x3: - m_selectedOutputTypeInt = 0; - break; - case WirePortDataType.FLOAT4x4: - m_selectedOutputTypeInt = 1; - break; - } - UpdatePorts(); - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_selectedOutputType ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_rowsFromVector ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/MatrixFromVectors.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/MatrixFromVectors.cs.meta deleted file mode 100644 index 25231848..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/MatrixFromVectors.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: a313774cf0e4d1e4289d7395e8e49067 -timeCreated: 1481126958 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/PosFromTransformMatrix.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/PosFromTransformMatrix.cs deleted file mode 100644 index 41a14788..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/PosFromTransformMatrix.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Position From Transform", "Matrix Operators", "Gets the position vector from a transformation matrix" )] - public sealed class PosFromTransformMatrix : ParentNode - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT4x4, true, Constants.EmptyPortValue ); - AddOutputPort( WirePortDataType.FLOAT4, "XYZW" ); - AddOutputPort( WirePortDataType.FLOAT, "X" ); - AddOutputPort( WirePortDataType.FLOAT, "Y" ); - AddOutputPort( WirePortDataType.FLOAT, "Z" ); - AddOutputPort( WirePortDataType.FLOAT, "W" ); - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) - return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); - - string value = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - string result = string.Format( "float4( {0},{1},{2},{3})", value + "[3][0]", value + "[3][1]", value + "[3][2]", value + "[3][3]" ); - RegisterLocalVariable( 0, result, ref dataCollector, "matrixToPos" + OutputId ); - - return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/PosFromTransformMatrix.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/PosFromTransformMatrix.cs.meta deleted file mode 100644 index 568be07a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/PosFromTransformMatrix.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 7c7321a370f1f1b499d4655cc25f457b -timeCreated: 1481126957 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/RegisterLocalVarNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/RegisterLocalVarNode.cs deleted file mode 100644 index 15bf0313..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/RegisterLocalVarNode.cs +++ /dev/null @@ -1,346 +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.Collections.Generic; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Register Local Var", "Miscellaneous", "Forces a local variable to be written with the given name. Can then be fetched at any place with a <b>Get Local Var</b> node.", null, KeyCode.R )] - public sealed class RegisterLocalVarNode : ParentNode - { - private const double MaxEditingTimestamp = 1; - - private const string LocalDefaultNameStr = "myVarName"; - private const string LocalVarNameStr = "Var Name"; - private const string OrderIndexStr = "Order Index"; - private const string AutoOrderIndexStr = "Auto Order"; - private const string ReferencesStr = "References"; - - private const string GetLocalVarLabel = "( {0} ) Get Local Var"; - private string m_oldName = string.Empty; - private bool m_reRegisterName = false; - private int m_autoOrderIndex = int.MaxValue; - private bool m_forceUpdate = true; - private bool m_refSelect = false; - - private bool m_referencesVisible = false; - - [SerializeField] - private string m_variableName = LocalDefaultNameStr; - - [SerializeField] - private int m_orderIndex = -1; - - [SerializeField] - private bool m_autoIndexActive = true; - - [SerializeField] - private List<GetLocalVarNode> m_registeredGetLocalVars = new List<GetLocalVarNode>(); - - [NonSerialized] - private double m_editingTimestamp; - - [NonSerialized] - private bool m_editingTimestampFlag; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT, false, Constants.EmptyPortValue ); - AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); - m_textLabelWidth = 85; - m_customPrecision = true; - - if( m_containerGraph != null ) - m_variableName += m_containerGraph.LocalVarNodes.NodesList.Count; - - m_oldName = m_variableName; - UpdateTitle(); - m_previewShaderGUID = "5aaa1d3ea9e1fa64781647e035a82334"; - } - - protected override void OnUniqueIDAssigned() - { - base.OnUniqueIDAssigned(); - m_containerGraph.LocalVarNodes.AddNode( this ); - } - - public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) - { - base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); - m_inputPorts[ 0 ].MatchPortToConnection(); - m_outputPorts[ 0 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); - } - - public override void OnConnectedOutputNodeChanges( int outputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) - { - base.OnConnectedOutputNodeChanges( outputPortId, otherNodeId, otherPortId, name, type ); - m_inputPorts[ 0 ].MatchPortToConnection(); - m_outputPorts[ 0 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); - } - - void UpdateTitle() - { - SetAdditonalTitleText( string.Format( Constants.SubTitleVarNameFormatStr, m_variableName ) ); - } - - public override void OnNodeLogicUpdate( DrawInfo drawInfo ) - { - base.OnNodeLogicUpdate( drawInfo ); - if( m_editingTimestampFlag && ( EditorApplication.timeSinceStartup - m_editingTimestamp ) > MaxEditingTimestamp ) - { - m_editingTimestampFlag = false; - CheckAndChangeName(); - } - } - - void DrawMainProperties() - { - EditorGUI.BeginChangeCheck(); - m_variableName = EditorGUILayoutTextField( LocalVarNameStr, m_variableName ); - if( EditorGUI.EndChangeCheck() ) - { - m_editingTimestampFlag = true; - m_editingTimestamp = EditorApplication.timeSinceStartup; - //CheckAndChangeName(); - } - - DrawPrecisionProperty(); - } - - public override void AfterDuplication() - { - base.AfterDuplication(); - CheckAndChangeName(); - } - - void CheckAndChangeName() - { - m_variableName = UIUtils.RemoveInvalidCharacters( m_variableName ); - if( string.IsNullOrEmpty( m_variableName ) ) - { - m_variableName = LocalDefaultNameStr + OutputId; - } - bool isNumericName = UIUtils.IsNumericName( m_variableName ); - bool isLocalVarNameAvailable = m_containerGraph.ParentWindow.DuplicatePrevBufferInstance.IsLocalvariableNameAvailable( m_variableName ); - if( !isNumericName && isLocalVarNameAvailable ) - { - m_containerGraph.ParentWindow.DuplicatePrevBufferInstance.ReleaseLocalVariableName( UniqueId, m_oldName ); - m_containerGraph.ParentWindow.DuplicatePrevBufferInstance.RegisterLocalVariableName( UniqueId, m_variableName ); - m_oldName = m_variableName; - m_containerGraph.LocalVarNodes.UpdateDataOnNode( UniqueId, m_variableName ); - UpdateTitle(); - m_forceUpdate = true; - } - else - { - if( isNumericName ) - { - UIUtils.ShowMessage( UniqueId, string.Format( "Local variable name '{0}' cannot start or be numerical values. Reverting back to '{1}'.", m_variableName, m_oldName ), MessageSeverity.Warning ); - } - else if( !isLocalVarNameAvailable ) - { - UIUtils.ShowMessage( UniqueId, string.Format( "Local variable name '{0}' already being used. Reverting back to '{1}'.", m_variableName, m_oldName ), MessageSeverity.Warning ); - } - - m_variableName = m_oldName; - m_containerGraph.LocalVarNodes.UpdateDataOnNode( UniqueId, m_variableName ); - } - } - - void DrawReferences() - { - int count = m_registeredGetLocalVars.Count; - if( m_registeredGetLocalVars.Count > 0 ) - { - for( int i = 0; i < count; i++ ) - { - EditorGUILayout.BeginHorizontal(); - EditorGUILayout.LabelField( string.Format( GetLocalVarLabel, m_registeredGetLocalVars[ i ].UniqueId ) ); - if( GUILayout.Button( "\u25BA", "minibutton", GUILayout.Width( 17 ) ) ) - { - m_containerGraph.ParentWindow.FocusOnNode( m_registeredGetLocalVars[ i ], 0, false ); - } - EditorGUILayout.EndHorizontal(); - } - - if( GUILayout.Button( "Back" ) ) - { - m_containerGraph.ParentWindow.FocusOnNode( this, 0, false ); - } - } - else - { - EditorGUILayout.HelpBox( "This node is not being referenced by any Get Local Var.", MessageType.Info ); - } - } - - public override void DrawProperties() - { - NodeUtils.DrawPropertyGroup( ref m_propertiesFoldout, Constants.ParameterLabelStr, DrawMainProperties ); - NodeUtils.DrawPropertyGroup( ref m_referencesVisible, ReferencesStr, DrawReferences ); - //EditorGUILayout.LabelField(ConnStatus.ToString()+" "+m_activeConnections); - } - - public override void OnEnable() - { - base.OnEnable(); - m_reRegisterName = true; - } - - public void CheckReferenceSelection() - { - m_refSelect = false; - int count = m_registeredGetLocalVars.Count; - for( int i = 0; i < count; i++ ) - { - if( m_registeredGetLocalVars[ i ].Selected ) - m_refSelect = true; - } - } - - public override void OnNodeRepaint( DrawInfo drawInfo ) - { - base.OnNodeRepaint( drawInfo ); - if( m_isVisible && m_refSelect && !m_selected ) - { - GUI.color = Constants.SpecialRegisterLocalVarSelectionColor; - GUI.Label( m_globalPosition, string.Empty, UIUtils.GetCustomStyle( CustomStyle.NodeWindowOn ) ); - GUI.color = m_colorBuffer; - } - } - - public override void Draw( DrawInfo drawInfo ) - { - - base.Draw( drawInfo ); - if( m_reRegisterName ) - { - m_reRegisterName = false; - m_containerGraph.ParentWindow.DuplicatePrevBufferInstance.RegisterLocalVariableName( UniqueId, m_variableName ); - } - - if( m_forceUpdate ) - { - m_forceUpdate = false; - UpdateTitle(); - } - } - - 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 result = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - if( m_inputPorts[ 0 ].DataType == WirePortDataType.OBJECT ) - m_outputPorts[ 0 ].SetLocalValue( result, dataCollector.PortCategory ); - else - RegisterLocalVariable( 0, result, ref dataCollector, m_variableName + OutputId ); - return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - m_variableName = GetCurrentParam( ref nodeParams ); - m_oldName = m_variableName; - if( UIUtils.CurrentShaderVersion() > 14 ) - m_orderIndex = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - - if( UIUtils.CurrentShaderVersion() > 3106 ) - { - m_autoIndexActive = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - } - else - { - m_autoIndexActive = false; - } - if( !m_isNodeBeingCopied ) - { - m_containerGraph.LocalVarNodes.UpdateDataOnNode( UniqueId, m_variableName ); - m_containerGraph.ParentWindow.DuplicatePrevBufferInstance.ReleaseLocalVariableName( UniqueId, m_oldName ); - m_containerGraph.ParentWindow.DuplicatePrevBufferInstance.RegisterLocalVariableName( UniqueId, m_variableName ); - } - m_forceUpdate = true; - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_variableName ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_orderIndex ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_autoIndexActive ); - } - - public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) - { - if( m_autoOrderIndex < nodeData.OrderIndex ) - { - nodeData.OrderIndex = m_autoOrderIndex - 1; - } - else - { - m_autoOrderIndex = nodeData.OrderIndex; - nodeData.OrderIndex -= 1; - } - - base.PropagateNodeData( nodeData, ref dataCollector ); - } - - public override void ResetNodeData() - { - base.ResetNodeData(); - m_autoOrderIndex = int.MaxValue; - } - - public void RegisterGetLocalVar( GetLocalVarNode node ) - { - if( !m_registeredGetLocalVars.Contains( node ) ) - { - m_registeredGetLocalVars.Add( node ); - CheckReferenceSelection(); - } - } - - public void UnregisterGetLocalVar( GetLocalVarNode node ) - { - if( m_registeredGetLocalVars.Contains( node ) ) - { - m_registeredGetLocalVars.Remove( node ); - CheckReferenceSelection(); - } - } - - public override void Destroy() - { - base.Destroy(); - m_containerGraph.LocalVarNodes.RemoveNode( this ); - m_containerGraph.ParentWindow.DuplicatePrevBufferInstance.ReleaseLocalVariableName( UniqueId, m_variableName ); - - int count = m_registeredGetLocalVars.Count; - for( int i = 0; i < count; i++ ) - { - //GetLocalVarNode node = m_containerGraph.GetNode( m_registeredGetLocalVars[ i ] ) as GetLocalVarNode; - if( m_registeredGetLocalVars[ i ] != null ) - m_registeredGetLocalVars[ i ].ResetReference(); - } - m_registeredGetLocalVars.Clear(); - m_registeredGetLocalVars = null; - - m_containerGraph.LocalVarNodes.RemoveNode( this ); - } - - public override void ActivateNode( int signalGenNodeId, int signalGenPortId, Type signalGenNodeType ) - { - base.ActivateNode( signalGenNodeId, signalGenPortId, signalGenNodeType ); - } - public override string DataToArray { get { return m_variableName; } } - public List<GetLocalVarNode> NodeReferences { get { return m_registeredGetLocalVars; } } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/RegisterLocalVarNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/RegisterLocalVarNode.cs.meta deleted file mode 100644 index 9cda9e54..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/RegisterLocalVarNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: ebd1a3b3014ccdd40b8fa805b4281c6f -timeCreated: 1481126960 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/RelayNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/RelayNode.cs deleted file mode 100644 index ab6df692..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/RelayNode.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System; -using UnityEngine; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Relay", "Miscellaneous", "Relay" )] - public sealed class RelayNode : ParentNode - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.OBJECT, false, Constants.EmptyPortValue ); - AddOutputPort( WirePortDataType.OBJECT, Constants.EmptyPortValue ); - m_previewShaderGUID = "74e4d859fbdb2c0468de3612145f4929"; - } - - public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) - { - base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); - m_inputPorts[ 0 ].MatchPortToConnection(); - m_outputPorts[ 0 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); - } - - public override void OnConnectedOutputNodeChanges( int outputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) - { - base.OnConnectedOutputNodeChanges( outputPortId, otherNodeId, otherPortId, name, type ); - m_inputPorts[ 0 ].MatchPortToConnection(); - m_outputPorts[ 0 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); - return m_inputPorts[ 0 ].GenerateShaderForOutput( ref dataCollector, m_inputPorts[ 0 ].DataType, ignoreLocalvar ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/RelayNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/RelayNode.cs.meta deleted file mode 100644 index 378c2048..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/RelayNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: ef679ba7cdeda594aa3e5c02b25e66df -timeCreated: 1481126960 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/RotateAboutAxisNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/RotateAboutAxisNode.cs deleted file mode 100644 index b9b0a6c2..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/RotateAboutAxisNode.cs +++ /dev/null @@ -1,95 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> -using UnityEditor; -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Rotate About Axis", "Vector Operators", "Rotates a vector around a normalized axis" )] - public class RotateAboutAxisNode : ParentNode - { - private const string FunctionHeader = "float3 RotateAroundAxis( float3 center, float3 original, float3 u, float angle )"; - private const string FunctionCall = "RotateAroundAxis( {0}, {1}, {2}, {3} )"; - private readonly string[] FunctionBody = - { - "float3 RotateAroundAxis( float3 center, float3 original, float3 u, float angle )\n", - "{\n", - "\toriginal -= center;\n", - "\tfloat C = cos( angle );\n", - "\tfloat S = sin( angle );\n", - "\tfloat t = 1 - C;\n", - "\tfloat m00 = t * u.x * u.x + C;\n", - "\tfloat m01 = t * u.x * u.y - S * u.z;\n", - "\tfloat m02 = t * u.x * u.z + S * u.y;\n", - "\tfloat m10 = t * u.x * u.y + S * u.z;\n", - "\tfloat m11 = t * u.y * u.y + C;\n", - "\tfloat m12 = t * u.y * u.z - S * u.x;\n", - "\tfloat m20 = t * u.x * u.z - S * u.y;\n", - "\tfloat m21 = t * u.y * u.z + S * u.x;\n", - "\tfloat m22 = t * u.z * u.z + C;\n", - "\tfloat3x3 finalMatrix = float3x3( m00, m01, m02, m10, m11, m12, m20, m21, m22 );\n", - "\treturn mul( finalMatrix, original ) + center;\n", - "}\n" - }; - - private const string NormalizeAxisLabel = "Rotation Axis"; - private const string NonNormalizeAxisLabel = "Normalized Rotation Axis"; - private const string NormalizeAxisStr = "Normalize Axis"; - - [UnityEngine.SerializeField] - private bool m_normalizeAxis = false; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT3, false, m_normalizeAxis? NormalizeAxisLabel: NonNormalizeAxisLabel ); - AddInputPort( WirePortDataType.FLOAT, false, "Rotation Angle" ); - AddInputPort( WirePortDataType.FLOAT3, false, "Pivot Point" ); - AddInputPort( WirePortDataType.FLOAT3, false, "Position" ); - AddOutputPort( WirePortDataType.FLOAT3, Constants.EmptyPortValue ); - m_useInternalPortData = true; - m_autoWrapProperties = true; - } - - public override void DrawProperties() - { - base.DrawProperties(); - EditorGUI.BeginChangeCheck(); - m_normalizeAxis = EditorGUILayoutToggle( NormalizeAxisStr, m_normalizeAxis ); - if( EditorGUI.EndChangeCheck() ) - { - m_inputPorts[ 0 ].Name = (m_normalizeAxis ? NormalizeAxisLabel : NonNormalizeAxisLabel); - } - } - - 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 normalizeRotAxis = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - if( m_normalizeAxis ) - { - normalizeRotAxis = string.Format( "normalize( {0} )", normalizeRotAxis ); - } - string rotationAngle = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); - string pivotPoint = m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ); - string position = m_inputPorts[ 3 ].GeneratePortInstructions( ref dataCollector ); - dataCollector.AddFunction( FunctionHeader, FunctionBody, false ); - RegisterLocalVariable( 0, string.Format( FunctionCall, pivotPoint, position, normalizeRotAxis, rotationAngle ), ref dataCollector, "rotatedValue" + OutputId ); - return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); - } - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - m_normalizeAxis = 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_normalizeAxis ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/RotateAboutAxisNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/RotateAboutAxisNode.cs.meta deleted file mode 100644 index f5af5b8d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/RotateAboutAxisNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 6190b6c1a4cd29b48bfd36ff9b2ea773 -timeCreated: 1513184612 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/SummedBlendNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/SummedBlendNode.cs deleted file mode 100644 index 735bcd9a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/SummedBlendNode.cs +++ /dev/null @@ -1,56 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEngine; -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Summed Blend", "Miscellaneous", "Mix all channels through weighted sum", null, KeyCode.None, true )] - public sealed class SummedBlendNode : WeightedAvgNode - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_inputData = new string[ 6 ]; - m_previewShaderGUID = "eda18b96e13f78b49bbdaa4da3fead19"; - } - - 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 ); - - GetInputData( ref dataCollector, ignoreLocalvar ); - - string result = string.Empty; - string localVarName = "weightedBlendVar" + OutputId; - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, m_inputPorts[ 0 ].DataType, localVarName, m_inputData[ 0 ] ); - - if ( m_activeCount == 0 ) - { - result = m_inputData[ 0 ]; - } - else if ( m_activeCount == 1 ) - { - result += localVarName + "*" + m_inputData[ 1 ]; - } - else - { - for ( int i = 0; i < m_activeCount; i++ ) - { - result += localVarName + Constants.VectorSuffixes[ i ] + "*" + m_inputData[ i + 1 ]; - if ( i != ( m_activeCount - 1 ) ) - { - result += " + "; - } - } - } - - result = UIUtils.AddBrackets( result ); - RegisterLocalVariable( 0, result, ref dataCollector, "weightedBlend" + OutputId ); - return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/SummedBlendNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/SummedBlendNode.cs.meta deleted file mode 100644 index 102a6f19..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/SummedBlendNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: da71cf021d98a7f468319e56eaefe6f1 -timeCreated: 1484229430 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/SwitchNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/SwitchNode.cs deleted file mode 100644 index ae3d4107..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/SwitchNode.cs +++ /dev/null @@ -1,230 +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( "Debug Switch", "Logical Operators", "Hard Switch between any of its input ports" )] - public class SwitchNode : ParentNode - { - private const string Info = "This is a Debug node which only generates the source for the selected port. This means that no properties are generated for other ports and information might be lost."; - private const string InputPortName = "In "; - - private const string CurrSelectedStr = "Current"; - private const string MaxAmountStr = "Max Amount"; - private const int MaxAllowedAmount = 8; - - [SerializeField] - private string[] m_availableInputsLabels = { "In 0", "In 1" }; - - [SerializeField] - private int[] m_availableInputsValues = { 0, 1 }; - - [SerializeField] - private int m_currentSelectedInput = 0; - - [SerializeField] - private int m_maxAmountInputs = 2; - - private int m_cachedPropertyId = -1; - - private GUIContent m_popContent; - - private Rect m_varRect; - private Rect m_imgRect; - private bool m_editing; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - for( int i = 0; i < MaxAllowedAmount; i++ ) - { - AddInputPort( WirePortDataType.FLOAT, false, InputPortName + i ); - m_inputPorts[ i ].Visible = ( i < 2 ); - } - AddOutputPort( WirePortDataType.FLOAT, " " ); - - m_popContent = new GUIContent(); - m_popContent.image = UIUtils.PopupIcon; - - m_insideSize.Set( 50, 25 ); - m_textLabelWidth = 100; - m_autoWrapProperties = false; - m_previewShaderGUID = "a58e46feaa5e3d14383bfeac24d008bc"; - } - - public override void SetPreviewInputs() - { - base.SetPreviewInputs(); - - if( m_cachedPropertyId == -1 ) - m_cachedPropertyId = Shader.PropertyToID( "_Current" ); - - PreviewMaterial.SetInt( m_cachedPropertyId, m_currentSelectedInput ); - } - - public override void OnConnectedOutputNodeChanges( int inputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) - { - m_inputPorts[ inputPortId ].MatchPortToConnection(); - if( inputPortId == m_currentSelectedInput ) - m_outputPorts[ 0 ].ChangeType( m_inputPorts[ inputPortId ].DataType, false ); - } - - public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) - { - base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); - m_inputPorts[ portId ].MatchPortToConnection(); - if( portId == m_currentSelectedInput ) - m_outputPorts[ 0 ].ChangeType( m_inputPorts[ portId ].DataType, false ); - } - - public void UpdateLabels() - { - m_availableInputsLabels = new string[ m_maxAmountInputs ]; - m_availableInputsValues = new int[ m_maxAmountInputs ]; - - for( int i = 0; i < m_maxAmountInputs; i++ ) - { - m_availableInputsLabels[ i ] = InputPortName + i; - m_availableInputsValues[ i ] = i; - } - } - - //void UpdateOutput() - //{ - // m_outputPorts[ 0 ].ChangeProperties( m_inputPorts[ m_currentSelectedInput ].Name, m_inputPorts[ m_currentSelectedInput ].DataType, false ); - // m_sizeIsDirty = true; - //} - - public override void OnNodeLayout( DrawInfo drawInfo ) - { - base.OnNodeLayout( drawInfo ); - - m_varRect = m_remainingBox; - m_varRect.width = 50 * drawInfo.InvertedZoom; - m_varRect.height = 16 * drawInfo.InvertedZoom; - m_varRect.x = m_remainingBox.xMax - m_varRect.width; - //m_varRect.x += m_remainingBox.width * 0.5f - m_varRect.width * 0.5f; - m_varRect.y += 1 * drawInfo.InvertedZoom; - - m_imgRect = m_varRect; - m_imgRect.x = m_varRect.xMax - 16 * drawInfo.InvertedZoom; - m_imgRect.width = 16 * drawInfo.InvertedZoom; - m_imgRect.height = m_imgRect.width; - } - - public override void DrawGUIControls( DrawInfo drawInfo ) - { - base.DrawGUIControls( drawInfo ); - - if( drawInfo.CurrentEventType != EventType.MouseDown ) - return; - - if( m_varRect.Contains( drawInfo.MousePosition ) ) - { - m_editing = true; - } - else if( m_editing ) - { - m_editing = false; - } - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - - if( m_editing ) - { - EditorGUI.BeginChangeCheck(); - m_currentSelectedInput = EditorGUIIntPopup( m_varRect, m_currentSelectedInput, m_availableInputsLabels, m_availableInputsValues, UIUtils.GraphDropDown ); - if( EditorGUI.EndChangeCheck() ) - { - PreviewIsDirty = true; - m_editing = false; - } - } - } - - public override void OnNodeRepaint( DrawInfo drawInfo ) - { - base.OnNodeRepaint( drawInfo ); - - if( !m_isVisible ) - return; - - if( !m_editing && ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD4 ) - { - GUI.Label( m_varRect, m_availableInputsLabels[ m_currentSelectedInput ], UIUtils.GraphDropDown ); - GUI.Label( m_imgRect, m_popContent, UIUtils.GraphButtonIcon ); - } - } - - public override void DrawProperties() - { - base.DrawProperties(); - NodeUtils.DrawPropertyGroup( ref m_propertiesFoldout, Constants.ParameterLabelStr, DrawDebugOptions ); - - EditorGUILayout.HelpBox( Info, MessageType.Warning ); - } - - void DrawDebugOptions() - { - EditorGUI.BeginChangeCheck(); - m_maxAmountInputs = EditorGUILayoutIntSlider( MaxAmountStr, m_maxAmountInputs, 2, MaxAllowedAmount ); - if( EditorGUI.EndChangeCheck() ) - { - for( int i = 0; i < MaxAllowedAmount; i++ ) - { - m_inputPorts[ i ].Visible = ( i < m_maxAmountInputs ); - } - - if( m_currentSelectedInput >= m_maxAmountInputs ) - { - m_currentSelectedInput = m_maxAmountInputs - 1; - } - - UpdateLabels(); - m_sizeIsDirty = true; - } - - m_currentSelectedInput = EditorGUILayoutIntPopup( CurrSelectedStr, m_currentSelectedInput, m_availableInputsLabels, m_availableInputsValues ); - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - return m_inputPorts[ m_currentSelectedInput ].GeneratePortInstructions( ref dataCollector ); - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - m_currentSelectedInput = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - m_maxAmountInputs = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - - for( int i = 0; i < MaxAllowedAmount; i++ ) - { - m_inputPorts[ i ].Visible = ( i < m_maxAmountInputs ); - } - - if( m_currentSelectedInput >= m_maxAmountInputs ) - { - m_currentSelectedInput = m_maxAmountInputs - 1; - } - - UpdateLabels(); - m_sizeIsDirty = true; - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_currentSelectedInput ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_maxAmountInputs ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/SwitchNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/SwitchNode.cs.meta deleted file mode 100644 index 246aa75c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/SwitchNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: ad88ed9f1b6010a4bb17685dec17a585 -timeCreated: 1483956795 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/SwizzleNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/SwizzleNode.cs deleted file mode 100644 index ec839517..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/SwizzleNode.cs +++ /dev/null @@ -1,441 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> -// -// Custom Node Swizzle -// Donated by Tobias Pott - @ Tobias Pott -// www.tobiaspott.de - -using System; -using UnityEditor; -using UnityEngine; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Swizzle", "Vector Operators", "Swizzle components of vector types", null, KeyCode.Z, true, false, null, null, "Tobias Pott - @TobiasPott" )] - public sealed class SwizzleNode : SingleInputOp - { - - private const string OutputTypeStr = "Output type"; - - [SerializeField] - private WirePortDataType m_selectedOutputType = WirePortDataType.FLOAT4; - - [SerializeField] - private int m_selectedOutputTypeInt = 3; - - [SerializeField] - private int[] m_selectedOutputSwizzleTypes = new int[] { 0, 1, 2, 3 }; - - [SerializeField] - private int m_maskId; - - [SerializeField] - private Vector4 m_maskValue = Vector4.one; - - private readonly string[] SwizzleVectorChannels = { "x", "y", "z", "w" }; - private readonly string[] SwizzleColorChannels = { "r", "g", "b", "a" }; - private readonly string[] SwizzleChannelLabels = { "Channel 0", "Channel 1", "Channel 2", "Channel 3" }; - - private readonly string[] m_outputValueTypes ={ "Float", - "Vector 2", - "Vector 3", - "Vector 4"}; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.FLOAT, - WirePortDataType.FLOAT2, - WirePortDataType.FLOAT3, - WirePortDataType.FLOAT4, - WirePortDataType.COLOR, - WirePortDataType.INT ); - - - m_inputPorts[ 0 ].DataType = WirePortDataType.FLOAT4; - m_outputPorts[ 0 ].DataType = m_selectedOutputType; - m_textLabelWidth = 90; - m_autoWrapProperties = true; - m_autoUpdateOutputPort = false; - m_hasLeftDropdown = true; - m_previewShaderGUID = "d20531704ce28b14bafb296f291f6608"; - SetAdditonalTitleText( "Value( XYZW )" ); - CalculatePreviewData(); - } - - public override void OnEnable() - { - base.OnEnable(); - m_maskId = Shader.PropertyToID( "_Mask" ); - } - - public override void SetPreviewInputs() - { - base.SetPreviewInputs(); - PreviewMaterial.SetVector( m_maskId, m_maskValue ); - } - - void CalculatePreviewData() - { - switch( m_outputPorts[ 0 ].DataType ) - { - default: m_maskValue = Vector4.zero; break; - case WirePortDataType.INT: - case WirePortDataType.FLOAT: m_maskValue = new Vector4( 1, 0, 0, 0 ); break; - case WirePortDataType.FLOAT2: m_maskValue = new Vector4( 1, 1, 0, 0 ); break; - case WirePortDataType.FLOAT3: m_maskValue = new Vector4( 1, 1, 1, 0 ); break; - case WirePortDataType.FLOAT4: - case WirePortDataType.COLOR: m_maskValue = Vector4.one; break; - } - - int inputMaxChannelId = 0; - switch( m_inputPorts[ 0 ].DataType ) - { - case WirePortDataType.FLOAT4: - case WirePortDataType.COLOR: - inputMaxChannelId = 3; - break; - case WirePortDataType.FLOAT3: - inputMaxChannelId = 2; - break; - case WirePortDataType.FLOAT2: - inputMaxChannelId = 1; - break; - case WirePortDataType.INT: - case WirePortDataType.FLOAT: - inputMaxChannelId = 0; - break; - case WirePortDataType.OBJECT: - case WirePortDataType.FLOAT3x3: - case WirePortDataType.FLOAT4x4: - break; - } - - m_previewMaterialPassId = -1; - float passValue = 0; - for( int i = 3; i > -1; i-- ) - { - int currentSwizzle = Mathf.Min( inputMaxChannelId, m_selectedOutputSwizzleTypes[ i ] ); - if( currentSwizzle > 0 ) - { - passValue += Mathf.Pow( 4, 3 - i ) * currentSwizzle; - } - } - - m_previewMaterialPassId = (int)passValue; - - if( m_previewMaterialPassId == -1 ) - { - m_previewMaterialPassId = 0; - if( DebugConsoleWindow.DeveloperMode ) - { - UIUtils.ShowMessage( UniqueId, "Could not find pass ID for swizzle", MessageSeverity.Error ); - } - } - } - - public override void AfterCommonInit() - { - base.AfterCommonInit(); - - if ( PaddingTitleLeft == 0 ) - { - PaddingTitleLeft = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; - if ( PaddingTitleRight == 0 ) - PaddingTitleRight = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; - } - } - - public override void OnConnectedOutputNodeChanges( int outputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) - { - base.OnConnectedOutputNodeChanges( outputPortId, otherNodeId, otherPortId, name, type ); - UpdatePorts(); - } - - public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) - { - base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); - UpdatePorts(); - } - - public override void OnInputPortDisconnected( int portId ) - { - base.OnInputPortDisconnected( portId ); - UpdatePorts(); - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - - if ( m_dropdownEditing ) - { - EditorGUI.BeginChangeCheck(); - m_selectedOutputTypeInt = EditorGUIPopup( m_dropdownRect, m_selectedOutputTypeInt, m_outputValueTypes, UIUtils.PropertyPopUp ); - if ( EditorGUI.EndChangeCheck() ) - { - switch ( m_selectedOutputTypeInt ) - { - case 0: m_selectedOutputType = WirePortDataType.FLOAT; break; - case 1: m_selectedOutputType = WirePortDataType.FLOAT2; break; - case 2: m_selectedOutputType = WirePortDataType.FLOAT3; break; - case 3: m_selectedOutputType = WirePortDataType.FLOAT4; break; - } - - UpdatePorts(); - DropdownEditing = false; - } - } - } - - public override void DrawProperties() - { - - EditorGUILayout.BeginVertical(); - EditorGUI.BeginChangeCheck(); - m_selectedOutputTypeInt = EditorGUILayoutPopup( OutputTypeStr, m_selectedOutputTypeInt, m_outputValueTypes ); - if ( EditorGUI.EndChangeCheck() ) - { - switch ( m_selectedOutputTypeInt ) - { - case 0: m_selectedOutputType = WirePortDataType.FLOAT; break; - case 1: m_selectedOutputType = WirePortDataType.FLOAT2; break; - case 2: m_selectedOutputType = WirePortDataType.FLOAT3; break; - case 3: m_selectedOutputType = WirePortDataType.FLOAT4; break; - } - - UpdatePorts(); - } - EditorGUILayout.EndVertical(); - - // Draw base properties - base.DrawProperties(); - - EditorGUILayout.BeginVertical(); - - int count = 0; - - switch ( m_selectedOutputType ) - { - case WirePortDataType.FLOAT4: - case WirePortDataType.COLOR: - count = 4; - break; - case WirePortDataType.FLOAT3: - count = 3; - break; - case WirePortDataType.FLOAT2: - count = 2; - break; - case WirePortDataType.INT: - case WirePortDataType.FLOAT: - count = 1; - break; - case WirePortDataType.OBJECT: - case WirePortDataType.FLOAT3x3: - case WirePortDataType.FLOAT4x4: - break; - } - - EditorGUI.BeginChangeCheck(); - if ( m_inputPorts[ 0 ].DataType == WirePortDataType.COLOR ) - { - for ( int i = 0; i < count; i++ ) - { - m_selectedOutputSwizzleTypes[ i ] = EditorGUILayoutPopup( SwizzleChannelLabels[ i ], m_selectedOutputSwizzleTypes[ i ], SwizzleColorChannels ); - } - } - else - { - for ( int i = 0; i < count; i++ ) - { - m_selectedOutputSwizzleTypes[ i ] = EditorGUILayoutPopup( SwizzleChannelLabels[ i ], m_selectedOutputSwizzleTypes[ i ], SwizzleVectorChannels ); - } - } - if ( EditorGUI.EndChangeCheck() ) - { - UpdatePorts(); - } - - EditorGUILayout.EndVertical(); - - } - - void UpdatePorts() - { - ChangeOutputType( m_selectedOutputType, false ); - - int count = 0; - switch ( m_selectedOutputType ) - { - case WirePortDataType.FLOAT4: - case WirePortDataType.COLOR: - count = 4; - break; - case WirePortDataType.FLOAT3: - count = 3; - break; - case WirePortDataType.FLOAT2: - count = 2; - break; - case WirePortDataType.INT: - case WirePortDataType.FLOAT: - count = 1; - break; - case WirePortDataType.OBJECT: - case WirePortDataType.FLOAT3x3: - case WirePortDataType.FLOAT4x4: - break; - } - - int inputMaxChannelId = 0; - switch ( m_inputPorts[ 0 ].DataType ) - { - case WirePortDataType.FLOAT4: - case WirePortDataType.COLOR: - inputMaxChannelId = 3; - break; - case WirePortDataType.FLOAT3: - inputMaxChannelId = 2; - break; - case WirePortDataType.FLOAT2: - inputMaxChannelId = 1; - break; - case WirePortDataType.INT: - case WirePortDataType.FLOAT: - inputMaxChannelId = 0; - break; - case WirePortDataType.OBJECT: - case WirePortDataType.FLOAT3x3: - case WirePortDataType.FLOAT4x4: - break; - } - - //for ( int i = 0; i < count; i++ ) - //{ - //m_selectedOutputSwizzleTypes[ i ] = Mathf.Clamp( m_selectedOutputSwizzleTypes[ i ], 0, inputMaxChannelId ); - //} - - // Update Title - string additionalText = string.Empty; - for ( int i = 0; i < count; i++ ) - { - int currentSwizzle = Mathf.Min( inputMaxChannelId, m_selectedOutputSwizzleTypes[ i ] ); - additionalText += GetSwizzleComponentForChannel( currentSwizzle ).ToUpper(); - } - - if ( additionalText.Length > 0 ) - SetAdditonalTitleText( "Value( " + additionalText + " )" ); - else - SetAdditonalTitleText( string.Empty ); - - CalculatePreviewData(); - m_sizeIsDirty = true; - } - - public string GetSwizzleComponentForChannel( int channel ) - { - if ( m_inputPorts[ 0 ].DataType == WirePortDataType.COLOR ) - { - return SwizzleColorChannels[ channel ]; - } - else - { - return SwizzleVectorChannels[ channel ]; - } - } - - 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 value = string.Format( "({0}).", m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ) ); - - int inputMaxChannelId = 0; - switch( m_inputPorts[ 0 ].DataType ) - { - case WirePortDataType.FLOAT4: - case WirePortDataType.COLOR: - inputMaxChannelId = 3; - break; - case WirePortDataType.FLOAT3: - inputMaxChannelId = 2; - break; - case WirePortDataType.FLOAT2: - inputMaxChannelId = 1; - break; - case WirePortDataType.INT: - case WirePortDataType.FLOAT: - inputMaxChannelId = 0; - break; - case WirePortDataType.OBJECT: - case WirePortDataType.FLOAT3x3: - case WirePortDataType.FLOAT4x4: - break; - } - - int count = 0; - switch ( m_selectedOutputType ) - { - case WirePortDataType.FLOAT4: - case WirePortDataType.COLOR: - count = 4; - break; - case WirePortDataType.FLOAT3: - count = 3; - break; - case WirePortDataType.FLOAT2: - count = 2; - break; - case WirePortDataType.INT: - case WirePortDataType.FLOAT: - count = 1; - break; - case WirePortDataType.OBJECT: - case WirePortDataType.FLOAT3x3: - case WirePortDataType.FLOAT4x4: - break; - } - - for ( int i = 0; i < count; i++ ) - { - int currentSwizzle = Mathf.Min( inputMaxChannelId, m_selectedOutputSwizzleTypes[ i ] ); - value += GetSwizzleComponentForChannel( currentSwizzle ); - } - - return CreateOutputLocalVariable( 0, value, ref dataCollector ); - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - m_selectedOutputType = ( WirePortDataType ) Enum.Parse( typeof( WirePortDataType ), GetCurrentParam( ref nodeParams ) ); - switch ( m_selectedOutputType ) - { - case WirePortDataType.FLOAT: m_selectedOutputTypeInt = 0; break; - case WirePortDataType.FLOAT2: m_selectedOutputTypeInt = 1; break; - case WirePortDataType.FLOAT3: m_selectedOutputTypeInt = 2; break; - case WirePortDataType.COLOR: - case WirePortDataType.FLOAT4: m_selectedOutputTypeInt = 3; break; - } - for ( int i = 0; i < m_selectedOutputSwizzleTypes.Length; i++ ) - { - m_selectedOutputSwizzleTypes[ i ] = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - } - - UpdatePorts(); - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_selectedOutputType ); - for ( int i = 0; i < m_selectedOutputSwizzleTypes.Length; i++ ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_selectedOutputSwizzleTypes[ i ] ); - } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/SwizzleNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/SwizzleNode.cs.meta deleted file mode 100644 index 5049f92b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/SwizzleNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 3bb41488b4b3e034d838c73c2eb471f5 -timeCreated: 1481126955 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/ToggleSwitchNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/ToggleSwitchNode.cs deleted file mode 100644 index baa91b53..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/ToggleSwitchNode.cs +++ /dev/null @@ -1,285 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using UnityEditor; -using UnityEngine; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Toggle Switch", "Logical Operators", "Switch between any of its input ports" )] - public class ToggleSwitchNode : PropertyNode - { - private const string InputPortName = "In "; - private const string CurrSelectedStr = "Toggle Value"; - //private const string LerpOp = "lerp({0},{1},{2})"; - private const string LerpOp = "(( {2} )?( {1} ):( {0} ))"; - - [SerializeField] - private string[] AvailableInputsLabels = { "In 0", "In 1" }; - - [SerializeField] - private int[] AvailableInputsValues = { 0, 1 }; - - [SerializeField] - private int m_currentSelectedInput = 0; - - [SerializeField] - private WirePortDataType m_mainDataType = WirePortDataType.FLOAT; - - private int m_cachedPropertyId = -1; - - private GUIContent m_popContent; - - private Rect m_varRect; - private Rect m_imgRect; - private bool m_editing; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( m_mainDataType, false, InputPortName + "0" ); - AddInputPort( m_mainDataType, false, InputPortName + "1" ); - - AddOutputPort( m_mainDataType, " " ); - m_insideSize.Set( 80, 25 ); - m_currentParameterType = PropertyType.Property; - m_customPrefix = "Toggle Switch"; - - m_popContent = new GUIContent(); - m_popContent.image = UIUtils.PopupIcon; - - m_availableAttribs.Clear(); - //Need to maintain this because of retrocompatibility reasons - m_availableAttribs.Add( new PropertyAttributes( "Toggle", "[Toggle]" ) ); - - m_drawAttributes = false; - m_freeType = false; - m_useVarSubtitle = true; - m_useInternalPortData = true; - m_previewShaderGUID = "beeb138daeb592a4887454f81dba2b3f"; - - m_allowPropertyDuplicates = true; - m_showAutoRegisterUI = false; - - m_srpBatcherCompatible = true; - } - - protected override void OnUniqueIDAssigned() - { - base.OnUniqueIDAssigned(); - UIUtils.RegisterPropertyNode( this ); - } - - public override void SetPreviewInputs() - { - base.SetPreviewInputs(); - - if ( m_cachedPropertyId == -1 ) - m_cachedPropertyId = Shader.PropertyToID( "_Current" ); - - PreviewMaterial.SetInt( m_cachedPropertyId, m_currentSelectedInput ); - } - - public override void OnConnectedOutputNodeChanges( int portId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) - { - base.OnConnectedOutputNodeChanges( portId, otherNodeId, otherPortId, name, type ); - UpdateConnection(); - } - - public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) - { - base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); - UpdateConnection(); - } - - public override void OnInputPortDisconnected( int portId ) - { - base.OnInputPortDisconnected( portId ); - UpdateConnection(); - } - - void UpdateConnection() - { - WirePortDataType type1 = WirePortDataType.FLOAT; - if( m_inputPorts[ 0 ].IsConnected ) - type1 = m_inputPorts[ 0 ].GetOutputConnection( 0 ).DataType; - - WirePortDataType type2 = WirePortDataType.FLOAT; - if( m_inputPorts[ 1 ].IsConnected ) - type2 = m_inputPorts[ 1 ].GetOutputConnection( 0 ).DataType; - - m_mainDataType = UIUtils.GetPriority( type1 ) > UIUtils.GetPriority( type2 ) ? type1 : type2; - - m_inputPorts[ 0 ].ChangeType( m_mainDataType, false ); - m_inputPorts[ 1 ].ChangeType( m_mainDataType, false ); - - - //m_outputPorts[ 0 ].ChangeProperties( m_out, m_mainDataType, false ); - m_outputPorts[ 0 ].ChangeType( m_mainDataType, false ); - } - - public override void OnNodeLayout( DrawInfo drawInfo ) - { - base.OnNodeLayout( drawInfo ); - - m_varRect = m_remainingBox; - m_varRect.width = 50 * drawInfo.InvertedZoom; - m_varRect.height = 16 * drawInfo.InvertedZoom; - m_varRect.x = m_remainingBox.xMax - m_varRect.width; - m_varRect.y += 1 * drawInfo.InvertedZoom; - - m_imgRect = m_varRect; - m_imgRect.x = m_varRect.xMax - 16 * drawInfo.InvertedZoom; - m_imgRect.width = 16 * drawInfo.InvertedZoom; - m_imgRect.height = m_imgRect.width; - } - - public override void DrawGUIControls( DrawInfo drawInfo ) - { - base.DrawGUIControls( drawInfo ); - - if ( drawInfo.CurrentEventType != EventType.MouseDown ) - return; - - if ( m_varRect.Contains( drawInfo.MousePosition ) ) - { - m_editing = true; - } - else if ( m_editing ) - { - m_editing = false; - } - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - - if( m_editing ) - { - EditorGUI.BeginChangeCheck(); - m_currentSelectedInput = EditorGUIIntPopup( m_varRect, m_currentSelectedInput, AvailableInputsLabels, AvailableInputsValues, UIUtils.SwitchNodePopUp ); - if ( EditorGUI.EndChangeCheck() ) - { - PreviewIsDirty = true; - UpdateConnection(); - m_requireMaterialUpdate = true; - m_editing = false; - } - } - } - - public override void OnNodeRepaint( DrawInfo drawInfo ) - { - base.OnNodeRepaint( drawInfo ); - - if ( !m_isVisible ) - return; - - if ( !m_editing && ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD4 ) - { - GUI.Label( m_varRect, AvailableInputsLabels[ m_currentSelectedInput ], UIUtils.GraphDropDown ); - GUI.Label( m_imgRect, m_popContent, UIUtils.GraphButtonIcon ); - } - } - - public override void DrawMainPropertyBlock() - { - base.DrawMainPropertyBlock(); - EditorGUILayout.Separator(); - EditorGUI.BeginChangeCheck(); - m_currentSelectedInput = EditorGUILayoutIntPopup( CurrSelectedStr, m_currentSelectedInput, AvailableInputsLabels, AvailableInputsValues ); - if ( EditorGUI.EndChangeCheck() ) - { - UpdateConnection(); - m_requireMaterialUpdate = true; - } - } - - public override void DrawProperties() - { - base.DrawProperties(); - NodeUtils.DrawPropertyGroup( ref m_visibleCustomAttrFoldout, CustomAttrStr, DrawCustomAttributes, DrawCustomAttrAddRemoveButtons ); - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); - m_precisionString = UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, m_outputPorts[ 0 ].DataType ); - - string resultA = m_inputPorts[ 0 ].GenerateShaderForOutput( ref dataCollector, m_mainDataType, ignoreLocalvar, true ); - string resultB = m_inputPorts[ 1 ].GenerateShaderForOutput( ref dataCollector, m_mainDataType, ignoreLocalvar, true ); - return string.Format( LerpOp, resultA, resultB, m_propertyName ); - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - m_currentSelectedInput = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_currentSelectedInput ); - } - - public override void RefreshExternalReferences() - { - base.RefreshExternalReferences(); - m_selectedAttribs.Clear(); - UpdateConnection(); - } - public override string GetPropertyValue() - { - return PropertyAttributes + "[Toggle]" + m_propertyName + "(\"" + m_propertyInspectorName + "\", Float) = " + m_currentSelectedInput; - } - - public override string GetUniformValue() - { - int index = m_containerGraph.IsSRP ? 1 : 0; - return string.Format( Constants.UniformDec[ index ], UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, WirePortDataType.FLOAT ), m_propertyName ); - } - - public override bool GetUniformData( out string dataType, out string dataName, ref bool fullValue ) - { - dataType = UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, WirePortDataType.FLOAT ); - dataName = m_propertyName; - return true; - } - - public override void UpdateMaterial( Material mat ) - { - base.UpdateMaterial( mat ); - if ( UIUtils.IsProperty( m_currentParameterType ) && !InsideShaderFunction ) - { - mat.SetFloat( m_propertyName, ( float ) m_currentSelectedInput ); - } - } - - public override void SetMaterialMode( Material mat , bool fetchMaterialValues ) - { - base.SetMaterialMode( mat , fetchMaterialValues ); - if ( fetchMaterialValues && m_materialMode && UIUtils.IsProperty( m_currentParameterType ) && mat.HasProperty( m_propertyName ) ) - { - m_currentSelectedInput = ( int ) mat.GetFloat( m_propertyName ); - } - } - - public override void ForceUpdateFromMaterial( Material material ) - { - if( UIUtils.IsProperty( m_currentParameterType ) && material.HasProperty( m_propertyName ) ) - { - m_currentSelectedInput = (int)material.GetFloat( m_propertyName ); - PreviewIsDirty = true; - } - } - - public override string GetPropertyValStr() - { - return PropertyName; //return m_currentSelectedInput.ToString(); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/ToggleSwitchNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/ToggleSwitchNode.cs.meta deleted file mode 100644 index 54b20752..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/ToggleSwitchNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: c7f6ffd9a8c958e449321777764784de -timeCreated: 1484213504 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/Transformation.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/Transformation.meta deleted file mode 100644 index 3dcf03fc..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/Transformation.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 2505ed67ae6a9d647a25755a065e350e -folderAsset: yes -timeCreated: 1488205900 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/Transformation/ObjectToWorldTransfNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/Transformation/ObjectToWorldTransfNode.cs deleted file mode 100644 index 48de5fbe..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/Transformation/ObjectToWorldTransfNode.cs +++ /dev/null @@ -1,30 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -namespace AmplifyShaderEditor -{ - [System.Serializable] - [NodeAttributes( "Object To World", "Object Transform", "Transforms input to World Space" )] - public sealed class ObjectToWorldTransfNode : ParentTransfNode - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_matrixName = "unity_ObjectToWorld"; - m_matrixHDName = "GetObjectToWorldMatrix()"; - m_matrixLWName = "GetObjectToWorldMatrix()"; - m_previewShaderGUID = "a4044ee165813654486d0cecd0de478c"; - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - string result = base.GenerateShaderForOutput( 0, ref dataCollector, ignoreLocalvar ); - if( dataCollector.IsTemplate && dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HD && !string.IsNullOrEmpty( m_matrixHDName ) ) - { - dataCollector.AddLocalVariable( UniqueId, string.Format( "{0}.xyz", result ), string.Format( "GetAbsolutePositionWS(({0}).xyz);", result ) ); - } - - return GetOutputVectorItem( 0, outputId, result ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/Transformation/ObjectToWorldTransfNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/Transformation/ObjectToWorldTransfNode.cs.meta deleted file mode 100644 index 40b45c87..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/Transformation/ObjectToWorldTransfNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 545417ad304cea84b9f625a3b6ad4e56 -timeCreated: 1488205951 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/Transformation/ParentTransfNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/Transformation/ParentTransfNode.cs deleted file mode 100644 index 5781e115..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/Transformation/ParentTransfNode.cs +++ /dev/null @@ -1,53 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -namespace AmplifyShaderEditor -{ - [System.Serializable] - public class ParentTransfNode : ParentNode - { - protected string m_matrixName; - protected string m_matrixHDName; - protected string m_matrixLWName; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT4, false, string.Empty ); - AddOutputVectorPorts( WirePortDataType.FLOAT4, "XYZW" ); - m_useInternalPortData = true; - m_inputPorts[ 0 ].Vector4InternalData = new UnityEngine.Vector4( 0, 0, 0, 1 ); - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) - return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); - - string value = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - string matrixName = string.Empty; - if( dataCollector.IsTemplate ) - { - if( dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HD && !string.IsNullOrEmpty( m_matrixHDName ) ) - { - matrixName = m_matrixHDName; - } - else if( dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.Lightweight && !string.IsNullOrEmpty( m_matrixLWName ) ) - { - matrixName = m_matrixLWName; - } - else - { - matrixName = m_matrixName; - } - } - else - { - matrixName = m_matrixName; - } - - RegisterLocalVariable( 0, string.Format( "mul({0},{1})", matrixName, value ),ref dataCollector,"transform"+ OutputId ); - return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/Transformation/ParentTransfNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/Transformation/ParentTransfNode.cs.meta deleted file mode 100644 index 5a714ba2..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/Transformation/ParentTransfNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 11f04432b7f1ffb43b584adb226614c6 -timeCreated: 1488206086 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/Transformation/WorldToObjectTransfNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/Transformation/WorldToObjectTransfNode.cs deleted file mode 100644 index ccc57813..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/Transformation/WorldToObjectTransfNode.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -namespace AmplifyShaderEditor -{ - [System.Serializable] - [NodeAttributes( "World To Object", "Object Transform", "Transforms input to Object Space" )] - public sealed class WorldToObjectTransfNode : ParentTransfNode - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_matrixName = "unity_WorldToObject"; - m_matrixHDName = "GetWorldToObjectMatrix()"; - m_matrixLWName = "GetWorldToObjectMatrix()"; - m_previewShaderGUID = "79a5efd1e3309f54d8ba3e7fdf5e459b"; - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) - return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); - - string value = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - string matrixName = string.Empty; - if( dataCollector.IsTemplate ) - { - if( dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HD && !string.IsNullOrEmpty( m_matrixHDName ) ) - { - string varName = "localWorldVar" + OutputId; - dataCollector.AddLocalVariable( UniqueId, PrecisionType.Float, WirePortDataType.FLOAT4, varName, value ); - dataCollector.AddLocalVariable( UniqueId, string.Format( "({0}).xyz", varName ), string.Format( "GetCameraRelativePositionWS(({0}).xyz);", varName ) ); - value = varName; - matrixName = m_matrixHDName; - } - else if( dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.Lightweight && !string.IsNullOrEmpty( m_matrixLWName ) ) - { - matrixName = m_matrixLWName; - } - else - { - matrixName = m_matrixName; - } - } - else - { - matrixName = m_matrixName; - } - - RegisterLocalVariable( 0, string.Format( "mul({0},{1})", matrixName, value ), ref dataCollector, "transform" + OutputId ); - return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/Transformation/WorldToObjectTransfNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/Transformation/WorldToObjectTransfNode.cs.meta deleted file mode 100644 index 8ad85ca4..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/Transformation/WorldToObjectTransfNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 8a25ccf8973bfae46ae3df2823f58229 -timeCreated: 1488205986 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/VectorFromMatrixNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/VectorFromMatrixNode.cs deleted file mode 100644 index 1095df44..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/VectorFromMatrixNode.cs +++ /dev/null @@ -1,131 +0,0 @@ -using System; -using UnityEngine; -using UnityEditor; - -namespace AmplifyShaderEditor -{ - public enum eVectorFromMatrixMode - { - Row, - Column - } - - [Serializable] - [NodeAttributes( "Vector From Matrix", "Matrix Operators", "Retrieve vector data from a matrix" )] - public sealed class VectorFromMatrixNode : ParentNode - { - private const string IndexStr = "Index"; - private const string ModeStr = "Mode"; - - [SerializeField] - private eVectorFromMatrixMode m_mode = eVectorFromMatrixMode.Row; - - [SerializeField] - private int m_index = 0; - - [SerializeField] - private int m_maxIndex = 3; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT4x4, false, Constants.EmptyPortValue ); - m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.FLOAT3x3, WirePortDataType.FLOAT4x4 ); - AddOutputVectorPorts( WirePortDataType.FLOAT4, "XYZW" ); - m_useInternalPortData = true; - m_autoWrapProperties = true; - } - public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) - { - base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); - UpdatePorts(); - } - - public override void OnConnectedOutputNodeChanges( int inputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) - { - base.OnConnectedOutputNodeChanges( inputPortId, otherNodeId, otherPortId, name, type ); - UpdatePorts(); - } - - void UpdatePorts() - { - m_inputPorts[ 0 ].MatchPortToConnection(); - - if ( m_inputPorts[ 0 ].DataType == WirePortDataType.FLOAT3x3 ) - { - m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT3, false ); - m_outputPorts[ 0 ].Name = "XYZ"; - m_maxIndex = 2; - m_outputPorts[ 4 ].Visible = false; - } - else - { - m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT4, false ); - m_outputPorts[ 0 ].Name = "XYZW"; - m_maxIndex = 3; - m_outputPorts[ 4 ].Visible = true; - } - m_sizeIsDirty = true; - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - string value = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - if ( m_inputPorts[ 0 ].DataType != WirePortDataType.FLOAT4x4 && - m_inputPorts[ 0 ].DataType != WirePortDataType.FLOAT3x3 ) - { - value = UIUtils.CastPortType( ref dataCollector, CurrentPrecisionType, new NodeCastInfo( UniqueId, outputId ), value, m_inputPorts[ 0 ].DataType, WirePortDataType.FLOAT4x4, value ); - } - if ( m_mode == eVectorFromMatrixMode.Row ) - { - value += "[" + m_index + "]"; - } - else - { - string formatStr = value + "[{0}]" + "[" + m_index + "]"; - int count = 4; - if ( m_inputPorts[ 0 ].DataType != WirePortDataType.FLOAT3x3 ) - { - value = "float4( "; - } - else - { - count = 3; - value = "float3( "; - } - - for ( int i = 0; i < count; i++ ) - { - value += string.Format( formatStr, i ); - if ( i != ( count - 1 ) ) - { - value += ","; - } - } - value += " )"; - } - return GetOutputVectorItem( 0, outputId, value ); - } - - public override void DrawProperties() - { - m_mode = (eVectorFromMatrixMode)EditorGUILayoutEnumPopup( ModeStr, m_mode ); - m_index = EditorGUILayoutIntSlider( IndexStr, m_index, 0, m_maxIndex ); - base.DrawProperties(); - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_mode ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_index ); - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - m_mode = ( eVectorFromMatrixMode ) Enum.Parse( typeof( eVectorFromMatrixMode ), GetCurrentParam( ref nodeParams ) ); - m_index = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/VectorFromMatrixNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/VectorFromMatrixNode.cs.meta deleted file mode 100644 index c2e6a9f5..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/VectorFromMatrixNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 31c07015a5f2aa44297aa7cfb80ffdd5 -timeCreated: 1481126954 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/WeightedAvgNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/WeightedAvgNode.cs deleted file mode 100644 index 2ef31bf2..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/WeightedAvgNode.cs +++ /dev/null @@ -1,180 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEngine; -using System; -using UnityEditor; -namespace AmplifyShaderEditor -{ - [Serializable] - - public class WeightedAvgNode : ParentNode - { - protected string[] AmountsStr = { "Layer 1", "Layer 2", "Layer 3", "Layer 4" }; - - [SerializeField] - protected int m_minimumSize = 1; - - [SerializeField] - protected WirePortDataType m_mainDataType = WirePortDataType.FLOAT; - - [SerializeField] - protected string[] m_inputData; - [SerializeField] - protected int m_activeCount = 0; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT, false, "Weights" ); - AddInputPort( WirePortDataType.FLOAT, false, AmountsStr[ 0 ] ); - AddInputPort( WirePortDataType.FLOAT, false, AmountsStr[ 1 ] ); - AddInputPort( WirePortDataType.FLOAT, false, AmountsStr[ 2 ] ); - AddInputPort( WirePortDataType.FLOAT, false, AmountsStr[ 3 ] ); - AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); - - for( int i = 0; i < m_inputPorts.Count; i++ ) - { - m_inputPorts[ i ].AddPortForbiddenTypes( WirePortDataType.FLOAT3x3, - WirePortDataType.FLOAT4x4, - WirePortDataType.SAMPLER1D, - WirePortDataType.SAMPLER2D, - WirePortDataType.SAMPLER3D, - WirePortDataType.SAMPLERCUBE ); - } - UpdateConnection( 0 ); - m_useInternalPortData = true; - } - - 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 ); - } - - void UpdateInputPorts( int activePorts ) - { - int idx = 1; - for ( ; idx < m_minimumSize + activePorts; idx++ ) - { - m_inputPorts[ idx ].Visible = true; - } - - m_activeCount = idx - 1; - - for ( ; idx < m_inputPorts.Count; idx++ ) - { - m_inputPorts[ idx ].Visible = false; - } - } - - protected void UpdateConnection( int portId ) - { - if ( portId == 0 ) - { - if( m_inputPorts[ portId ].IsConnected ) - m_inputPorts[ portId ].MatchPortToConnection(); - - switch ( m_inputPorts[ 0 ].DataType ) - { - case WirePortDataType.INT: - case WirePortDataType.FLOAT: - { - UpdateInputPorts( 1 ); - m_previewMaterialPassId = 0; - } - break; - case WirePortDataType.FLOAT2: - { - UpdateInputPorts( 2 ); - m_previewMaterialPassId = 1; - } - break; - case WirePortDataType.FLOAT3: - { - UpdateInputPorts( 3 ); - m_previewMaterialPassId = 2; - } - break; - case WirePortDataType.COLOR: - case WirePortDataType.FLOAT4: - { - UpdateInputPorts( 4 ); - m_previewMaterialPassId = 3; - } - break; - case WirePortDataType.OBJECT: - case WirePortDataType.FLOAT3x3: - case WirePortDataType.FLOAT4x4: - { - for ( int i = 1; i < m_inputPorts.Count; i++ ) - { - m_inputPorts[ i ].Visible = false; - } - m_activeCount = 0; - } - break; - } - } - //else - //{ - // SetMainOutputType(); - //} - - SetMainOutputType(); - m_sizeIsDirty = true; - } - - protected void SetMainOutputType() - { - m_mainDataType = WirePortDataType.OBJECT; - int count = m_inputPorts.Count; - for ( int i = 1; i < count; i++ ) - { - if ( m_inputPorts[ i ].Visible ) - { - WirePortDataType portType = m_inputPorts[ i ].IsConnected ? m_inputPorts[ i ].ConnectionType() : WirePortDataType.FLOAT; - if ( m_mainDataType != portType && - UIUtils.GetPriority( portType ) > UIUtils.GetPriority( m_mainDataType ) ) - { - m_mainDataType = portType; - } - } - } - - for( int i = 1; i < count; i++ ) - { - if( m_inputPorts[ i ].Visible ) - { - m_inputPorts[ i ].ChangeType( m_mainDataType, false ); - } - } - - m_outputPorts[ 0 ].ChangeType( m_mainDataType, false ); - } - - protected void GetInputData( ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - m_inputData[ 0 ] = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - for ( int i = 1; i < m_inputPorts.Count; i++ ) - { - if ( m_inputPorts[ i ].Visible ) - { - m_inputData[ i ] = m_inputPorts[ i ].GeneratePortInstructions( ref dataCollector ); - } - } - } - - public override void ReadInputDataFromString( ref string[] nodeParams ) - { - base.ReadInputDataFromString( ref nodeParams ); - UpdateConnection( 0 ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/WeightedAvgNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/WeightedAvgNode.cs.meta deleted file mode 100644 index 1faefae2..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/WeightedAvgNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 35c70c67524c86049a25b7ebd0de6ae3 -timeCreated: 1481126954 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/WeightedBlendNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/WeightedBlendNode.cs deleted file mode 100644 index dc5fc1b0..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/WeightedBlendNode.cs +++ /dev/null @@ -1,58 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEngine; -using System; -using UnityEditor; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Weighted Blend", "Miscellaneous", "Mix all channels through weighted average sum", null, KeyCode.None, true )] - public sealed class WeightedBlendNode : WeightedAvgNode - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_inputData = new string[ 6 ]; - m_previewShaderGUID = "6076cbeaa41ebb14c85ff81b58df7d88"; - } - - 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 ); - - GetInputData( ref dataCollector, ignoreLocalvar ); - - string result = string.Empty; - string avgSum = string.Empty; - - string localVarName = "weightedBlendVar" + OutputId; - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, m_inputPorts[ 0 ].DataType, localVarName, m_inputData[ 0 ] ); - - if ( m_activeCount < 2 ) - { - return CreateOutputLocalVariable( 0, m_inputData[ 1 ], ref dataCollector ); - } - else - { - for ( int i = 0; i < m_activeCount; i++ ) - { - result += localVarName + Constants.VectorSuffixes[ i ] + "*" + m_inputData[ i + 1 ]; - avgSum += localVarName + Constants.VectorSuffixes[ i ]; - if ( i != ( m_activeCount - 1 ) ) - { - result += " + "; - avgSum += " + "; - } - } - } - - result = UIUtils.AddBrackets( result ) + "/" + UIUtils.AddBrackets( avgSum ); - result = UIUtils.AddBrackets( result ); - RegisterLocalVariable( 0, result, ref dataCollector, "weightedAvg" + OutputId ); - return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/WeightedBlendNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/WeightedBlendNode.cs.meta deleted file mode 100644 index 744bfd0c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/WeightedBlendNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: b91b2aefbfad5b444b25320e9ed53cac -timeCreated: 1481126958 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/WireNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/WireNode.cs deleted file mode 100644 index 4bcc5005..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/WireNode.cs +++ /dev/null @@ -1,484 +0,0 @@ -using System; -using UnityEngine; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Wire Node", "Miscellaneous", "Wire Node", null, KeyCode.None, false )] - public sealed class WireNode : ParentNode - { - private bool m_markedToDelete = false; - - [SerializeField] - private WirePortDataType m_visualDataType = WirePortDataType.FLOAT; - - bool m_forceVisualDataUpdate = false; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.OBJECT, false, string.Empty ); - AddOutputPort( WirePortDataType.OBJECT, Constants.EmptyPortValue ); - m_tooltipText = string.Empty; - m_drawPreview = false; - m_drawPreviewExpander = false; - m_canExpand = false; - m_previewShaderGUID = "fa1e3e404e6b3c243b5527b82739d682"; - } - - public WirePortDataType GetLastInputDataTypeRecursively() - { - if( m_outputPorts[ 0 ].ExternalReferences.Count > 0 ) - { - WireNode rightWire = m_outputPorts[ 0 ].GetInputNode( 0 ) as WireNode; - if( rightWire != null ) - return rightWire.GetLastInputDataTypeRecursively(); - else - { - return m_outputPorts[ 0 ].GetInputConnection( 0 ).DataType; - } - } - - if( m_containerGraph.ParentWindow.WireReferenceUtils.OutputPortReference.IsValid ) - return m_containerGraph.ParentWindow.WireReferenceUtils.OutputPortReference.DataType; - else - return m_visualDataType; - } - - public override WirePortDataType GetInputPortVisualDataTypeByArrayIdx( int portArrayIdx ) - { - return m_visualDataType; - } - - public override WirePortDataType GetOutputPortVisualDataTypeById( int portId ) - { - return m_visualDataType; - } - - public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) - { - base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); - m_inputPorts[ 0 ].MatchPortToConnection(); - m_outputPorts[ 0 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); - - m_forceVisualDataUpdate = true; - } - - public override void OnOutputPortConnected( int portId, int otherNodeId, int otherPortId ) - { - base.OnOutputPortConnected( portId, otherNodeId, otherPortId ); - - if( m_outputPorts[ portId ].ConnectionCount > 1 ) - { - for( int i = 0; i < m_outputPorts[ portId ].ExternalReferences.Count; i++ ) - { - if( m_outputPorts[ portId ].ExternalReferences[ i ].PortId != otherPortId ) - { - UIUtils.DeleteConnection( true, m_outputPorts[ portId ].ExternalReferences[ i ].NodeId, m_outputPorts[ portId ].ExternalReferences[ i ].PortId, false, true ); - } - } - } - - m_inputPorts[ 0 ].NotifyExternalRefencesOnChange(); - m_forceVisualDataUpdate = true; - } - - public override void OnConnectedInputNodeChanges( int portId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) - { - base.OnConnectedInputNodeChanges( portId, otherNodeId, otherPortId, name, type ); - - m_inputPorts[ 0 ].NotifyExternalRefencesOnChange(); - m_forceVisualDataUpdate = true; - } - - public override void OnConnectedOutputNodeChanges( int outputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) - { - base.OnConnectedOutputNodeChanges( outputPortId, otherNodeId, otherPortId, name, type ); - m_inputPorts[ 0 ].MatchPortToConnection(); - m_outputPorts[ 0 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); - - m_forceVisualDataUpdate = true; - } - - public override void OnInputPortDisconnected( int portId ) - { - base.OnInputPortDisconnected( portId ); - TestIfValid(); - - m_forceVisualDataUpdate = true; - m_outputPorts[ 0 ].NotifyExternalRefencesOnChange(); - } - - public override void OnOutputPortDisconnected( int portId ) - { - base.OnOutputPortDisconnected( portId ); - TestIfValid(); - - m_forceVisualDataUpdate = true; - m_inputPorts[ 0 ].NotifyExternalRefencesOnChange(); - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); - return m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - } - - public override void DrawProperties() - { - if( m_markedToDelete ) - return; - - base.DrawProperties(); - } - - public override void OnNodeLayout( DrawInfo drawInfo ) - { - if( m_firstDraw ) - { - m_firstDraw = false; - AfterCommonInit(); - OnNodeChange(); - } - - if( m_forceVisualDataUpdate ) - { - m_forceVisualDataUpdate = false; - m_visualDataType = GetLastInputDataTypeRecursively(); - } - - if( m_repopulateDictionaries ) - { - m_repopulateDictionaries = false; - - m_inputPortsDict.Clear(); - int inputCount = m_inputPorts.Count; - for( int i = 0; i < inputCount; i++ ) - { - m_inputPortsDict.Add( m_inputPorts[ i ].PortId, m_inputPorts[ i ] ); - } - - m_outputPortsDict.Clear(); - int outputCount = m_outputPorts.Count; - for( int i = 0; i < outputCount; i++ ) - { - m_outputPortsDict.Add( m_outputPorts[ i ].PortId, m_outputPorts[ i ] ); - } - } - - if( m_sizeIsDirty ) - { - m_sizeIsDirty = false; - m_extraSize.Set( 20f, 20f ); - m_position.width = m_extraSize.x + UIUtils.PortsSize.x; - m_position.height = m_extraSize.y + UIUtils.PortsSize.y; - - Vec2Position -= Position.size * 0.5f; - if( OnNodeChangeSizeEvent != null ) - { - OnNodeChangeSizeEvent( this ); - } - - ChangeSizeFinished(); - //ChangeSize(); - } - - CalculatePositionAndVisibility( drawInfo ); - - // Input Ports - { - m_currInputPortPos = m_globalPosition; - m_currInputPortPos.width = drawInfo.InvertedZoom * UIUtils.PortsSize.x; - m_currInputPortPos.height = drawInfo.InvertedZoom * UIUtils.PortsSize.y; - m_currInputPortPos.position = m_globalPosition.center - m_currInputPortPos.size * 0.5f; - int inputCount = m_inputPorts.Count; - - for( int i = 0; i < inputCount; i++ ) - { - if( m_inputPorts[ i ].Visible ) - { - // Button - m_inputPorts[ i ].Position = m_currInputPortPos; - - if( !m_inputPorts[ i ].Locked ) - { - float overflow = 2; - float scaledOverflow = 3 * drawInfo.InvertedZoom; - m_auxRect = m_currInputPortPos; - m_auxRect.yMin -= scaledOverflow + overflow; - m_auxRect.yMax += scaledOverflow + overflow; - m_auxRect.xMin -= Constants.PORT_INITIAL_X * drawInfo.InvertedZoom + scaledOverflow + overflow; - m_auxRect.xMax += m_inputPorts[ i ].LabelSize.x + Constants.PORT_TO_LABEL_SPACE_X * drawInfo.InvertedZoom + scaledOverflow + overflow; - m_inputPorts[ i ].ActivePortArea = m_auxRect; - } - m_currInputPortPos.y += drawInfo.InvertedZoom * ( m_fontHeight + Constants.INPUT_PORT_DELTA_Y ); - } - } - } - - // Output Ports - { - m_currOutputPortPos = m_globalPosition; - m_currOutputPortPos.width = drawInfo.InvertedZoom * UIUtils.PortsSize.x; - m_currOutputPortPos.height = drawInfo.InvertedZoom * UIUtils.PortsSize.y; - m_currOutputPortPos.position = m_globalPosition.center - m_currOutputPortPos.size * 0.5f; - //m_currOutputPortPos.x += ( m_globalPosition.width - drawInfo.InvertedZoom * ( Constants.PORT_INITIAL_X + m_anchorAdjust ) ); - //m_currOutputPortPos.y += drawInfo.InvertedZoom * Constants.PORT_INITIAL_Y;// + m_extraHeaderHeight * drawInfo.InvertedZoom; - int outputCount = m_outputPorts.Count; - - for( int i = 0; i < outputCount; i++ ) - { - if( m_outputPorts[ i ].Visible ) - { - //Button - m_outputPorts[ i ].Position = m_currOutputPortPos; - - if( !m_outputPorts[ i ].Locked ) - { - float overflow = 2; - float scaledOverflow = 3 * drawInfo.InvertedZoom; - m_auxRect = m_currOutputPortPos; - m_auxRect.yMin -= scaledOverflow + overflow; - m_auxRect.yMax += scaledOverflow + overflow; - m_auxRect.xMin -= m_outputPorts[ i ].LabelSize.x + Constants.PORT_TO_LABEL_SPACE_X * drawInfo.InvertedZoom + scaledOverflow + overflow; - m_auxRect.xMax += Constants.PORT_INITIAL_X * drawInfo.InvertedZoom + scaledOverflow + overflow; - m_outputPorts[ i ].ActivePortArea = m_auxRect; - } - m_currOutputPortPos.y += drawInfo.InvertedZoom * ( m_fontHeight + Constants.INPUT_PORT_DELTA_Y ); - } - } - } - } - - public override void OnNodeRepaint( DrawInfo drawInfo ) - { - //base.OnRepaint( drawInfo ); - //return; - if( !m_isVisible ) - return; - - m_colorBuffer = GUI.color; - - // Output Ports - int outputCount = m_outputPorts.Count; - for( int i = 0; i < outputCount; i++ ) - { - if( m_outputPorts[ i ].Visible ) - { - // Output Port Icon - if( ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD4 ) - { - if( m_outputPorts[ i ].Locked ) - GUI.color = Constants.LockedPortColor; - else if( ContainerGraph.ParentWindow.Options.ColoredPorts ) - GUI.color = UIUtils.GetColorForDataType( m_visualDataType, false, false ); - else - GUI.color = m_outputPorts[ i ].HasCustomColor ? m_outputPorts[ i ].CustomColor : UIUtils.GetColorForDataType( m_visualDataType, true, false ); - - GUIStyle style = m_outputPorts[ i ].IsConnected ? UIUtils.GetCustomStyle( CustomStyle.PortFullIcon ) : UIUtils.GetCustomStyle( CustomStyle.PortEmptyIcon ); - GUI.Label( m_outputPorts[ i ].Position, string.Empty, style ); - - GUI.color = m_colorBuffer; - } - - // Output Port Label - if( ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD3 ) - { - if( m_outputPorts[ i ].Locked ) - { - GUI.color = Constants.PortLockedTextColor; - GUI.Label( m_outputPorts[ i ].LabelPosition, m_outputPorts[ i ].Name, UIUtils.OutputPortLabel ); - GUI.color = m_colorBuffer; - } - else - { - GUI.Label( m_outputPorts[ i ].LabelPosition, m_outputPorts[ i ].Name, UIUtils.OutputPortLabel ); - } - } - } - } - - // Selection Box - if( m_selected ) - { - Rect selectionBox = m_globalPosition; - selectionBox.size = Vector2.one * 16 * drawInfo.InvertedZoom + Vector2.one * 4; - selectionBox.center = m_globalPosition.center; - GUI.DrawTexture( selectionBox, UIUtils.WireNodeSelection ); - GUI.color = m_colorBuffer; - } - } - - public override void DrawGUIControls( DrawInfo drawInfo ) - { - //base.DrawGUIControls( drawInfo ); - } - - public override void Draw( DrawInfo drawInfo ) - { - if( m_markedToDelete ) - return; - - if( drawInfo.CurrentEventType == EventType.Repaint ) - OnNodeRepaint( drawInfo ); - //base.Draw( drawInfo ); - - if( drawInfo.CurrentEventType == EventType.Repaint ) - TestIfValid(); - } - - bool TestIfValid() - { - if( !Alive ) - return false; - - bool result = true; - if( !m_inputPorts[ 0 ].IsConnected ) - { - if( !m_containerGraph.ParentWindow.WireReferenceUtils.InputPortReference.IsValid || m_containerGraph.ParentWindow.WireReferenceUtils.InputPortReference.IsValid && m_containerGraph.ParentWindow.WireReferenceUtils.InputPortReference.NodeId != UniqueId ) - { - ContainerGraph.MarkWireNodeSequence( this, true ); - result = false; - } - } - - if( !m_outputPorts[ 0 ].IsConnected ) - { - if( !m_containerGraph.ParentWindow.WireReferenceUtils.OutputPortReference.IsValid || m_containerGraph.ParentWindow.WireReferenceUtils.OutputPortReference.IsValid && m_containerGraph.ParentWindow.WireReferenceUtils.OutputPortReference.NodeId != UniqueId ) - { - ContainerGraph.MarkWireNodeSequence( this, false ); - result = false; - } - } - return result; - } - - public Vector3 TangentDirection - { - get - { - ParentNode otherInputNode = null; - ParentNode otherOutputNode = null; - - //defaults to itself so it can still calculate tangents - WirePort otherInputPort = m_outputPorts[ 0 ]; - WirePort otherOutputPort = m_inputPorts[ 0 ]; - - if( m_outputPorts[ 0 ].ConnectionCount > 0 ) - { - otherInputNode = m_containerGraph.GetNode( m_outputPorts[ 0 ].ExternalReferences[ 0 ].NodeId ); - otherInputPort = otherInputNode.GetInputPortByUniqueId( m_outputPorts[ 0 ].ExternalReferences[ 0 ].PortId ); - } - - if( m_inputPorts[ 0 ].ConnectionCount > 0 ) - { - otherOutputNode = m_containerGraph.GetNode( m_inputPorts[ 0 ].ExternalReferences[ 0 ].NodeId ); - otherOutputPort = otherOutputNode.GetOutputPortByUniqueId( m_inputPorts[ 0 ].ExternalReferences[ 0 ].PortId ); - } - - //TODO: it still generates crooked lines if wire nodes get too close to non-wire nodes (the fix would be to calculate the non-wire nodes magnitude properly) - float mag = Constants.HORIZONTAL_TANGENT_SIZE * ContainerGraph.ParentWindow.CameraDrawInfo.InvertedZoom; - - Vector2 outPos; - if( otherOutputNode != null && otherOutputNode.GetType() != typeof( WireNode ) ) - outPos = otherOutputPort.Position.position + Vector2.right * mag * 0.66f; - else - outPos = otherOutputPort.Position.position; - - Vector2 inPos; - if( otherInputNode != null && otherInputNode.GetType() != typeof( WireNode ) ) - inPos = otherInputPort.Position.position - Vector2.right * mag * 0.66f; - else - inPos = otherInputPort.Position.position; - - Vector2 tangent = ( outPos - inPos ).normalized; - return new Vector3( tangent.x, tangent.y ); - } - } - - public override void RefreshExternalReferences() - { - base.RefreshExternalReferences(); - - m_extraSize.Set( 20f, 20f ); - m_position.width = m_extraSize.x + UIUtils.PortsSize.x; - m_position.height = m_extraSize.y + UIUtils.PortsSize.y; - - Vec2Position += Position.size * 0.5f; - } - - public override void OnAfterDeserialize() - { - base.OnAfterDeserialize(); - m_sizeIsDirty = false; - } - - public WireReference FindNewValidInputNode( WireNode current ) - { - if( current.InputPorts[ 0 ].IsConnected ) - { - ParentNode node = m_containerGraph.GetNode( current.InputPorts[ 0 ].ExternalReferences[ 0 ].NodeId ); - if( node != null ) - { - WireNode wireNode = node as WireNode; - if( wireNode != null && wireNode.MarkToDelete ) - { - return FindNewValidInputNode( wireNode ); - } - else - { - return current.InputPorts[ 0 ].ExternalReferences[ 0 ]; - } - } - } - return null; - } - - public WireReference FindNewValidOutputNode( WireNode current ) - { - if( current.OutputPorts[ 0 ].IsConnected ) - { - ParentNode node = m_containerGraph.GetNode( current.OutputPorts[ 0 ].ExternalReferences[ 0 ].NodeId ); - - if( node != null ) - { - WireNode wireNode = node as WireNode; - if( wireNode != null && wireNode.MarkToDelete ) - { - return FindNewValidOutputNode( wireNode ); - } - else - { - return current.OutputPorts[ 0 ].ExternalReferences[ 0 ]; - } - } - } - return null; - } - - public override void Rewire() - { - //if ( m_inputPorts[ 0 ].ExternalReferences != null && m_inputPorts[ 0 ].ExternalReferences.Count > 0 ) - //{ - //WireReference backPort = m_inputPorts[ 0 ].ExternalReferences[ 0 ]; - //for ( int i = 0; i < m_outputPorts[ 0 ].ExternalReferences.Count; i++ ) - //{ - // UIUtils.CurrentWindow.ConnectInputToOutput( m_outputPorts[ 0 ].ExternalReferences[ i ].NodeId, m_outputPorts[ 0 ].ExternalReferences[ i ].PortId, backPort.NodeId, backPort.PortId ); - //} - //} - MarkToDelete = true; - WireReference outputReference = FindNewValidInputNode( this ); - WireReference inputReference = FindNewValidOutputNode( this ); - if( outputReference != null && inputReference != null ) - { - ContainerGraph.ParentWindow.ConnectInputToOutput( inputReference.NodeId, inputReference.PortId, outputReference.NodeId, outputReference.PortId ); - } - } - - public bool MarkToDelete - { - get { return m_markedToDelete; } - set { m_markedToDelete = value; } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/WireNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/WireNode.cs.meta deleted file mode 100644 index ab597cb9..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Misc/WireNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 7a566d6bf220cd74b8385a91f690b683 -timeCreated: 1481126957 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeAttributes.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeAttributes.cs deleted file mode 100644 index 91e441ea..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeAttributes.cs +++ /dev/null @@ -1,97 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using UnityEngine; - -namespace AmplifyShaderEditor -{ - public enum NodeAvailability - { - SurfaceShader = 1 << 0, - ShaderFunction = 1 << 1, - CustomLighting = 1 << 2, - TemplateShader = 1 << 3 - } - - - [AttributeUsage( AttributeTargets.Class )] - public class NodeAttributes : Attribute - { - - public string Name; - public string Description; - public string Category; - public KeyCode ShortcutKey; - public bool Available; - public System.Type[] CastType; // Type that will be converted to AttribType if dropped on the canvas ... p.e. dropping a texture2d on the canvas will generate a sampler2d node - public bool Deprecated; - public string DeprecatedAlternative; - public System.Type DeprecatedAlternativeType; - public bool FromCommunity; - public string CustomCategoryColor; // Color created via a string containing its hexadecimal representation - public int SortOrderPriority; // to be used when name comparing on sorting - public int NodeAvailabilityFlags;// used to define where this node can be used - private string m_nodeUrl; - public string Community; - public string Tags; - public NodeAttributes( string name, string category, string description, System.Type castType = null, KeyCode shortcutKey = KeyCode.None, bool available = true, bool deprecated = false, string deprecatedAlternative = null, System.Type deprecatedAlternativeType = null, string community = null, string customCategoryColor = null, int sortOrderPriority = -1, int nodeAvailabilityFlags = int.MaxValue, string tags = null ) - { - Name = name; - Description = description; - Category = category; - if( castType != null ) - CastType = new System.Type[] { castType }; - - ShortcutKey = shortcutKey; - Available = available; - Deprecated = deprecated; - DeprecatedAlternative = deprecatedAlternative; - Community = community; - if( string.IsNullOrEmpty( Community ) ) - Community = string.Empty; - else - FromCommunity = true; - - if( !string.IsNullOrEmpty( customCategoryColor ) ) - CustomCategoryColor = customCategoryColor; - - DeprecatedAlternativeType = deprecatedAlternativeType; - SortOrderPriority = sortOrderPriority; - NodeAvailabilityFlags = nodeAvailabilityFlags; - Tags = tags; - if( string.IsNullOrEmpty( tags ) ) - Tags = string.Empty; - //m_nodeUrl = ( FromCommunity ? Constants.CommunityNodeCommonUrl : Constants.NodeCommonUrl ) + UIUtils.UrlReplaceInvalidStrings( Name ); - } - - public NodeAttributes( string name, string category, string description, KeyCode shortcutKey, bool available, int sortOrderPriority, int nodeAvailabilityFlags, params System.Type[] castTypes ) - { - Name = name; - Description = description; - Category = category; - if( castTypes != null && castTypes.Length > 0 ) - { - CastType = castTypes; - } - - ShortcutKey = shortcutKey; - Available = available; - SortOrderPriority = sortOrderPriority; - NodeAvailabilityFlags = nodeAvailabilityFlags; - //m_nodeUrl = ( FromCommunity ? Constants.CommunityNodeCommonUrl : Constants.NodeCommonUrl ) + UIUtils.UrlReplaceInvalidStrings( Name ); - } - - public string NodeUrl - { - get - { - if( string.IsNullOrEmpty( m_nodeUrl ) ) - { - m_nodeUrl = ( FromCommunity ? Constants.CommunityNodeCommonUrl : Constants.NodeCommonUrl ) + UIUtils.UrlReplaceInvalidStrings( Name ); - } - return m_nodeUrl; - } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeAttributes.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeAttributes.cs.meta deleted file mode 100644 index c7a076f4..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeAttributes.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: ec3cfdc3a4d1a7a4cb24c1c079e1750a -timeCreated: 1481126960 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeRestrictions.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeRestrictions.cs deleted file mode 100644 index d68d8eb1..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeRestrictions.cs +++ /dev/null @@ -1,119 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using System.Collections.Generic; -namespace AmplifyShaderEditor -{ - public class NodeRestrictionsData - { - private bool m_allPorts; - private Dictionary<int, bool> m_portRestrictions; - public NodeRestrictionsData() - { - m_portRestrictions = new Dictionary<int, bool>(); - } - - public NodeRestrictionsData( int port ) - { - m_portRestrictions = new Dictionary<int, bool>(); - m_portRestrictions.Add( port, true ); - } - - public void SetAllPortRestiction( bool value ) - { - m_allPorts = value; - } - - public void AddRestriction( int port ) - { - if ( !m_portRestrictions.ContainsKey( port ) ) - m_portRestrictions.Add( port, true ); - else - m_portRestrictions[ port ] = true; - } - - public void RemoveRestriction( int port ) - { - if ( m_portRestrictions.ContainsKey( port ) ) - m_portRestrictions[ port ] = true; - } - - public bool IsPortRestricted( int port ) - { - if ( m_portRestrictions.ContainsKey( port ) ) - return m_portRestrictions[ port ]; - return false; - } - - public void Destroy() - { - m_portRestrictions.Clear(); - m_portRestrictions = null; - } - - public bool AllPortsRestricted - { - get - { - return m_allPorts; - } - } - } - - public class NodeRestrictions - { - private Dictionary<System.Type, NodeRestrictionsData> m_restrictions; - - public NodeRestrictions() - { - m_restrictions = new Dictionary<System.Type, NodeRestrictionsData>(); - } - - public void AddTypeRestriction( System.Type type ) - { - if ( !m_restrictions.ContainsKey( type ) ) - m_restrictions.Add( type, new NodeRestrictionsData() ); - - m_restrictions[ type ].SetAllPortRestiction( true ); - - } - - public void AddPortRestriction( System.Type type, int port ) - { - if ( !m_restrictions.ContainsKey( type ) ) - m_restrictions.Add( type, new NodeRestrictionsData( port ) ); - else - { - m_restrictions[ type ].AddRestriction( port ); - } - } - - public bool GetRestiction( System.Type type, int port ) - { - if ( m_restrictions.Count == 0 || type == null ) - return false; - - if ( m_restrictions.ContainsKey( type ) ) - { - if ( m_restrictions[ type ].AllPortsRestricted ) - return true; - - return m_restrictions[ type ].IsPortRestricted( port ); - } - - return false; - } - - public void Destroy() - { - foreach ( KeyValuePair<System.Type, NodeRestrictionsData> pair in m_restrictions ) - { - pair.Value.Destroy(); - } - - m_restrictions.Clear(); - m_restrictions = null; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeRestrictions.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeRestrictions.cs.meta deleted file mode 100644 index dccb7b31..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeRestrictions.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: bd1aff8475f370d4380918491184aef5 -timeCreated: 1481126958 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeUsageRegister.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeUsageRegister.cs deleted file mode 100644 index 944ce812..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeUsageRegister.cs +++ /dev/null @@ -1,203 +0,0 @@ -using System; -using UnityEngine; -using UnityEditor; -using System.Collections.Generic; - -namespace AmplifyShaderEditor -{ - [Serializable] public class UsageListSamplerNodes : NodeUsageRegister<SamplerNode> { } - [Serializable] public class UsageListFloatIntNodes : NodeUsageRegister<PropertyNode> { } - [Serializable] public class UsageListTexturePropertyNodes : NodeUsageRegister<TexturePropertyNode> { } - [Serializable] public class UsageListTextureArrayNodes : NodeUsageRegister<TextureArrayNode> { } - [Serializable] public class UsageListPropertyNodes : NodeUsageRegister<PropertyNode> { } - [Serializable] public class UsageListScreenColorNodes : NodeUsageRegister<ScreenColorNode> { } - [Serializable] public class UsageListRegisterLocalVarNodes : NodeUsageRegister<RegisterLocalVarNode> { } - [Serializable] public class UsageListFunctionInputNodes : NodeUsageRegister<FunctionInput> { } - [Serializable] public class UsageListFunctionNodes : NodeUsageRegister<FunctionNode> { } - [Serializable] public class UsageListFunctionOutputNodes : NodeUsageRegister<FunctionOutput> { } - [Serializable] public class UsageListFunctionSwitchNodes : NodeUsageRegister<FunctionSwitch> { } - [Serializable] public class UsageListFunctionSwitchCopyNodes : NodeUsageRegister<FunctionSwitch> { } - [Serializable] public class UsageListTemplateMultiPassMasterNodes : NodeUsageRegister<TemplateMultiPassMasterNode> { } - [Serializable] public class UsageListCustomExpressionsOnFunctionMode : NodeUsageRegister<CustomExpressionNode> { } - [Serializable] public class UsageListGlobalArrayNodes : NodeUsageRegister<GlobalArrayNode> { } - [Serializable] public class UsageListStaticSwitchNodes : NodeUsageRegister<StaticSwitch> { } - - [Serializable] - public class NodeUsageRegister<T> where T : ParentNode - { - public delegate void ReorderEvent(); - public event ReorderEvent OnReorderEventComplete; - - [SerializeField] - public bool ReorderOnChange = false; - - // Sampler Nodes registry - [SerializeField] - private List<T> m_nodes; - - [SerializeField] - private string[] m_nodesArr; - - [SerializeField] - private int[] m_nodeIDs; - - [SerializeField] - ParentGraph m_containerGraph; - - public NodeUsageRegister() - { - m_nodesArr = new string[ 0 ]; - m_nodeIDs = new int[ 0 ]; - m_nodes = new List<T>(); - } - - public void Destroy() - { - m_nodes.Clear(); - m_nodes = null; - m_nodesArr = null; - m_nodeIDs = null; - } - - public void Clear() - { - m_nodes.Clear(); - } - - public int AddNode( T node ) - { - if( node == null ) - return -1; - - if( !m_nodes.Contains( node ) ) - { - if( m_containerGraph != null ) - { - Undo.RegisterCompleteObjectUndo( m_containerGraph.ParentWindow, Constants.UndoRegisterNodeId ); - Undo.RegisterCompleteObjectUndo( m_containerGraph, Constants.UndoRegisterNodeId ); - } - m_nodes.Add( node ); - ReorderNodes(); - UpdateNodeArr(); - return m_nodes.Count - 1; - } - else if( node.UniqueId > -1 ) - { - UpdateNodeArr(); - } - - return -1; - } - - public bool HasNode( int uniqueId ) - { - return m_nodes.FindIndex( x => x.UniqueId == uniqueId ) > -1 ? true : false; - } - - public void RemoveNode( T node ) - { - if( node == null ) - return; - - if( m_nodes.Contains( node ) ) - { - if( m_containerGraph != null ) - { - Undo.RegisterCompleteObjectUndo( m_containerGraph.ParentWindow, Constants.UndoUnregisterNodeId ); - Undo.RegisterCompleteObjectUndo( m_containerGraph, Constants.UndoUnregisterNodeId ); - } - - m_nodes.Remove( node ); - ReorderNodes(); - UpdateNodeArr(); - } - } - - public void ReorderNodes() - { - if( ReorderOnChange ) - { - m_nodes.Sort( ( x, y ) => ( x.DataToArray.CompareTo( y.DataToArray ) ) ); - if( OnReorderEventComplete != null ) - { - OnReorderEventComplete(); - } - } - } - - public void UpdateNodeArr() - { - int nodeCount = m_nodes.Count; - if( nodeCount != m_nodesArr.Length ) - { - m_nodesArr = new string[ nodeCount ]; - m_nodeIDs = new int[ nodeCount ]; - } - - for( int i = 0; i < nodeCount; i++ ) - { - m_nodesArr[ i ] = m_nodes[ i ].DataToArray; - m_nodeIDs[ i ] = m_nodes[ i ].UniqueId; - } - } - - public T GetNode( int idx ) - { - if( idx > -1 && idx < m_nodes.Count ) - { - return m_nodes[ idx ]; - } - return null; - } - - public T GetNodeByUniqueId( int uniqueId ) - { - return m_nodes.Find( x => x.UniqueId == uniqueId ); - } - - public T GetNodeByDataToArray( string data ) - { - return m_nodes.Find( x => x.DataToArray.Equals( data )); - } - - public int GetNodeRegisterIdx( int uniqueId ) - { - return m_nodes.FindIndex( x => x.UniqueId == uniqueId ); - } - - public void UpdateDataOnNode( int uniqueId, string data ) - { - if( ReorderOnChange ) - { - ReorderNodes(); - UpdateNodeArr(); - } - else - { - int index = m_nodes.FindIndex( x => x.UniqueId == uniqueId ); - if( index > -1 ) - { - m_nodesArr[ index ] = data; - m_nodeIDs[ index ] = uniqueId; - } - } - } - - public void Dump() - { - string data = string.Empty; - - for( int i = 0; i < m_nodesArr.Length; i++ ) - { - data += m_nodesArr[ i ] + " " + m_nodeIDs[ i ] + '\n'; - } - Debug.Log( data ); - } - - public string[] NodesArr { get { return m_nodesArr; } } - public int[] NodeIds { get { return m_nodeIDs; } } - public List<T> NodesList { get { return m_nodes; } } - public int Count { get { return m_nodes.Count; } } - public ParentGraph ContainerGraph { get { return m_containerGraph; } set { m_containerGraph = value; } } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeUsageRegister.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeUsageRegister.cs.meta deleted file mode 100644 index 9f7511e1..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeUsageRegister.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 2aa06a21e7f64094c91da5dd60ef35cf -timeCreated: 1481126954 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeUtils.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeUtils.cs deleted file mode 100644 index 81219dd4..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeUtils.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; - -namespace AmplifyShaderEditor -{ - public class NodeUtils - { - - public delegate void DrawPropertySection(); - - public static void DrawPropertyGroup( string sectionName, DrawPropertySection DrawSection ) - { - Color cachedColor = GUI.color; - GUI.color = new Color( cachedColor.r, cachedColor.g, cachedColor.b, 0.5f ); - EditorGUILayout.BeginHorizontal( UIUtils.MenuItemToolbarStyle ); - GUI.color = cachedColor; - - GUILayout.Label( sectionName, UIUtils.MenuItemToggleStyle ); - - EditorGUILayout.EndHorizontal(); - - - cachedColor = GUI.color; - GUI.color = new Color( cachedColor.r, cachedColor.g, cachedColor.b, ( EditorGUIUtility.isProSkin ? 0.5f : 0.25f ) ); - EditorGUILayout.BeginVertical( UIUtils.MenuItemBackgroundStyle ); - GUI.color = cachedColor; - DrawSection(); - EditorGUILayout.Separator(); - EditorGUILayout.EndVertical(); - } - - - public static void DrawNestedPropertyGroup( ref bool foldoutValue, string sectionName, DrawPropertySection DrawSection, int horizontalSpacing = 15 ) - { - GUILayout.BeginHorizontal(); - { - GUILayout.Space( horizontalSpacing ); - EditorGUILayout.BeginVertical( EditorStyles.helpBox ); - { - Color cachedColor = GUI.color; - GUI.color = new Color( cachedColor.r, cachedColor.g, cachedColor.b, 0.5f ); - EditorGUILayout.BeginHorizontal(); - { - GUI.color = cachedColor; - bool value = GUILayout.Toggle( foldoutValue, sectionName, UIUtils.MenuItemToggleStyle ); - if( Event.current.button == Constants.FoldoutMouseId ) - { - foldoutValue = value; - } - } - EditorGUILayout.EndHorizontal(); - EditorGUI.indentLevel--; - if( foldoutValue ) - { - cachedColor = GUI.color; - GUI.color = new Color( cachedColor.r, cachedColor.g, cachedColor.b, ( EditorGUIUtility.isProSkin ? 0.5f : 0.25f ) ); - { - EditorGUILayout.BeginVertical( UIUtils.MenuItemBackgroundStyle ); - { - GUI.color = cachedColor; - DrawSection(); - } - EditorGUILayout.EndVertical(); - EditorGUILayout.Separator(); - } - } - EditorGUI.indentLevel++; - } - EditorGUILayout.EndVertical(); - } - GUILayout.EndHorizontal(); - } - - public static void DrawNestedPropertyGroup( ref bool foldoutValue, Rect rect, string sectionName, DrawPropertySection DrawSection, int horizontalSpacing = 15 ) - { - var box = rect; - box.height -= 2; - GUI.Label( box, string.Empty, EditorStyles.helpBox ); - - var tog = rect; -#if UNITY_2019_3_OR_NEWER - tog.y -= ( tog.height - ( EditorGUIUtility.singleLineHeight + 5 ) ) * 0.5f; -#endif - tog.xMin += 2; - tog.xMax -= 2; - tog.yMin += 2; - bool value = GUI.Toggle( tog, foldoutValue, sectionName, UIUtils.MenuItemToggleStyle ); - if( Event.current.button == Constants.FoldoutMouseId ) - { - foldoutValue = value; - } - - if( foldoutValue ) - { - DrawSection(); - } - } - - - public static void DrawNestedPropertyGroup( ref bool foldoutValue, string sectionName, DrawPropertySection DrawSection, DrawPropertySection HeaderSection ) - { - GUILayout.BeginHorizontal(); - { - GUILayout.Space( 15 ); - EditorGUILayout.BeginVertical( EditorStyles.helpBox ); - Color cachedColor = GUI.color; - GUI.color = new Color( cachedColor.r, cachedColor.g, cachedColor.b, 0.5f ); - EditorGUILayout.BeginHorizontal(); - GUI.color = cachedColor; - - bool value = GUILayout.Toggle( foldoutValue, sectionName, UIUtils.MenuItemToggleStyle ); - if( Event.current.button == Constants.FoldoutMouseId ) - { - foldoutValue = value; - } - HeaderSection(); - EditorGUILayout.EndHorizontal(); - EditorGUI.indentLevel--; - if( foldoutValue ) - { - cachedColor = GUI.color; - GUI.color = new Color( cachedColor.r, cachedColor.g, cachedColor.b, ( EditorGUIUtility.isProSkin ? 0.5f : 0.25f ) ); - EditorGUILayout.BeginVertical( UIUtils.MenuItemBackgroundStyle ); - GUI.color = cachedColor; - DrawSection(); - EditorGUILayout.EndVertical(); - EditorGUILayout.Separator(); - } - EditorGUI.indentLevel++; - EditorGUILayout.EndVertical(); - } - GUILayout.EndHorizontal(); - } - - public static void DrawNestedPropertyGroup( UndoParentNode owner, ref bool foldoutValue, ref bool enabledValue, string sectionName, DrawPropertySection DrawSection ) - { - GUILayout.BeginHorizontal(); - { - GUILayout.Space( 15 ); - EditorGUILayout.BeginVertical( EditorStyles.helpBox ); - Color cachedColor = GUI.color; - GUI.color = new Color( cachedColor.r, cachedColor.g, cachedColor.b, 0.5f ); - EditorGUILayout.BeginHorizontal(); - GUI.color = cachedColor; - - bool value = GUILayout.Toggle( foldoutValue, sectionName, UIUtils.MenuItemToggleStyle ); - if( Event.current.button == Constants.FoldoutMouseId ) - { - foldoutValue = value; - } - - value = ( (object)owner != null ) ? owner.GUILayoutToggle( enabledValue, string.Empty,UIUtils.MenuItemEnableStyle, GUILayout.Width( 16 ) ) : - GUILayout.Toggle( enabledValue, string.Empty, UIUtils.MenuItemEnableStyle, GUILayout.Width( 16 ) ); - if( Event.current.button == Constants.FoldoutMouseId ) - { - enabledValue = value; - } - - - EditorGUILayout.EndHorizontal(); - EditorGUI.indentLevel--; - if( foldoutValue ) - { - cachedColor = GUI.color; - GUI.color = new Color( cachedColor.r, cachedColor.g, cachedColor.b, ( EditorGUIUtility.isProSkin ? 0.5f : 0.25f ) ); - EditorGUILayout.BeginVertical( UIUtils.MenuItemBackgroundStyle ); - GUI.color = cachedColor; - DrawSection(); - EditorGUILayout.EndVertical(); - EditorGUILayout.Separator(); - } - EditorGUI.indentLevel++; - EditorGUILayout.EndVertical(); - } - GUILayout.EndHorizontal(); - } - - - public static void DrawPropertyGroup( ref bool foldoutValue, string sectionName, DrawPropertySection DrawSection ) - { - Color cachedColor = GUI.color; - GUI.color = new Color( cachedColor.r, cachedColor.g, cachedColor.b, 0.5f ); - EditorGUILayout.BeginHorizontal( UIUtils.MenuItemToolbarStyle ); - GUI.color = cachedColor; - - bool value = GUILayout.Toggle( foldoutValue, sectionName, UIUtils.MenuItemToggleStyle ); - if( Event.current.button == Constants.FoldoutMouseId ) - { - foldoutValue = value; - } - EditorGUILayout.EndHorizontal(); - - if( foldoutValue ) - { - cachedColor = GUI.color; - GUI.color = new Color( cachedColor.r, cachedColor.g, cachedColor.b, ( EditorGUIUtility.isProSkin ? 0.5f : 0.25f ) ); - EditorGUILayout.BeginVertical( UIUtils.MenuItemBackgroundStyle ); - { - GUI.color = cachedColor; - EditorGUI.indentLevel++; - DrawSection(); - EditorGUI.indentLevel--; - EditorGUILayout.Separator(); - } - EditorGUILayout.EndVertical(); - } - } - - public static void DrawPropertyGroup( ref bool foldoutValue, string sectionName, DrawPropertySection DrawSection, DrawPropertySection HeaderSection ) - { - Color cachedColor = GUI.color; - GUI.color = new Color( cachedColor.r, cachedColor.g, cachedColor.b, 0.5f ); - EditorGUILayout.BeginHorizontal( UIUtils.MenuItemToolbarStyle ); - GUI.color = cachedColor; - - bool value = GUILayout.Toggle( foldoutValue, sectionName, UIUtils.MenuItemToggleStyle ); - if( Event.current.button == Constants.FoldoutMouseId ) - { - foldoutValue = value; - } - HeaderSection(); - EditorGUILayout.EndHorizontal(); - - if( foldoutValue ) - { - cachedColor = GUI.color; - GUI.color = new Color( cachedColor.r, cachedColor.g, cachedColor.b, ( EditorGUIUtility.isProSkin ? 0.5f : 0.25f ) ); - EditorGUILayout.BeginVertical( UIUtils.MenuItemBackgroundStyle ); - { - GUI.color = cachedColor; - EditorGUI.indentLevel++; - DrawSection(); - EditorGUI.indentLevel--; - EditorGUILayout.Separator(); - } - EditorGUILayout.EndVertical(); - } - } - - - public static bool DrawPropertyGroup( UndoParentNode owner, ref bool foldoutValue, ref bool enabledValue, string sectionName, DrawPropertySection DrawSection ) - { - bool enableChanged = false; - Color cachedColor = GUI.color; - GUI.color = new Color( cachedColor.r, cachedColor.g, cachedColor.b, 0.5f ); - EditorGUILayout.BeginHorizontal( UIUtils.MenuItemToolbarStyle ); - GUI.color = cachedColor; - bool value = GUILayout.Toggle( foldoutValue, sectionName, UIUtils.MenuItemToggleStyle, GUILayout.ExpandWidth( true ) ); - if( Event.current.button == Constants.FoldoutMouseId ) - { - foldoutValue = value; - } - EditorGUI.BeginChangeCheck(); - value = ( (object)owner != null ) ? owner.EditorGUILayoutToggle( string.Empty, enabledValue, UIUtils.MenuItemEnableStyle, GUILayout.Width( 16 ) ) : - EditorGUILayout.Toggle( string.Empty, enabledValue, UIUtils.MenuItemEnableStyle, GUILayout.Width( 16 ) ); - if( Event.current.button == Constants.FoldoutMouseId ) - { - enabledValue = value; - } - if( EditorGUI.EndChangeCheck() ) - { - enableChanged = true; - } - - EditorGUILayout.EndHorizontal(); - - if( foldoutValue ) - { - cachedColor = GUI.color; - GUI.color = new Color( cachedColor.r, cachedColor.g, cachedColor.b, ( EditorGUIUtility.isProSkin ? 0.5f : 0.25f ) ); - EditorGUILayout.BeginVertical( UIUtils.MenuItemBackgroundStyle ); - GUI.color = cachedColor; - - EditorGUILayout.Separator(); - EditorGUI.BeginDisabledGroup( !enabledValue ); - - EditorGUI.indentLevel += 1; - - DrawSection(); - - EditorGUI.indentLevel -= 1; - EditorGUI.EndDisabledGroup(); - EditorGUILayout.Separator(); - EditorGUILayout.EndVertical(); - } - - return enableChanged; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeUtils.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeUtils.cs.meta deleted file mode 100644 index f60220a5..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/NodeUtils.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 9eb57a68790e6e343affe131e8a0f860 -timeCreated: 1487688956 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators.meta deleted file mode 100644 index 6d6fbea5..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: f2a66c410f1e56b418ec994b6f57c2eb -folderAsset: yes -timeCreated: 1481126946 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ACosOpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ACosOpNode.cs deleted file mode 100644 index 32fff2c9..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ACosOpNode.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "ACos", "Trigonometry Operators", "Arccosine of scalars and vectors" )] - public sealed class ACosOpNode : SingleInputOp - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_opName = "acos"; - m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, - WirePortDataType.FLOAT , - WirePortDataType.FLOAT2, - WirePortDataType.FLOAT3, - WirePortDataType.FLOAT4, - WirePortDataType.COLOR, - WirePortDataType.INT ); - m_previewShaderGUID = "710f3c0bbd7ba0c4aada6d7dfadd49c2"; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ACosOpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ACosOpNode.cs.meta deleted file mode 100644 index 74fdc7aa..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ACosOpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 8238f389c28938544b56035531b3f1be -timeCreated: 1481126957 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ASinOpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ASinOpNode.cs deleted file mode 100644 index 936e1d19..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ASinOpNode.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "ASin", "Trigonometry Operators", "Arcsine of scalars and vectors" )] - public sealed class ASinOpNode : SingleInputOp - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_opName = "asin"; - m_previewShaderGUID = "2b016c135284add4cb3364d4a0bd0638"; - m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, - WirePortDataType.FLOAT, - WirePortDataType.FLOAT2, - WirePortDataType.FLOAT3, - WirePortDataType.FLOAT4, - WirePortDataType.COLOR, - WirePortDataType.INT ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ASinOpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ASinOpNode.cs.meta deleted file mode 100644 index 0e1aa0ab..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ASinOpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 268ebf76d03c2e84f8c80a375773b46c -timeCreated: 1481126954 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ATan2OpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ATan2OpNode.cs deleted file mode 100644 index 70f9fb73..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ATan2OpNode.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -namespace AmplifyShaderEditor -{ - [System.Serializable] - [NodeAttributes( "ATan2", "Trigonometry Operators", "Arctangent of y/x" )] - public sealed class ATan2OpNode : DynamicTypeNode - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_dynamicOutputType = true; - m_useInternalPortData = true; - m_previewShaderGUID = "02e3ff61784e38840af6313936b6a730"; - } - - public override string BuildResults( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) - return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); - - base.BuildResults( outputId, ref dataCollector, ignoreLocalvar ); - string result = "atan2( " + m_inputA + " , " + m_inputB + " )"; - return CreateOutputLocalVariable( 0, result, ref dataCollector ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ATan2OpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ATan2OpNode.cs.meta deleted file mode 100644 index 9109fe76..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ATan2OpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: f5957d9ac2cc12146bc862cd0c92815a -timeCreated: 1481126960 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ATanOpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ATanOpNode.cs deleted file mode 100644 index c36c599a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ATanOpNode.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "ATan", "Trigonometry Operators", "Arctangent of scalars and vectors" )] - public sealed class ATanOpNode : SingleInputOp - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_opName = "atan"; - m_previewShaderGUID = "7d7f3331a98831241b017364e80625ea"; - m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, - WirePortDataType.FLOAT, - WirePortDataType.FLOAT2, - WirePortDataType.FLOAT3, - WirePortDataType.FLOAT4, - WirePortDataType.COLOR, - WirePortDataType.INT ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ATanOpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ATanOpNode.cs.meta deleted file mode 100644 index a382707b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ATanOpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: d84f7e90e793aaa4891b4c1fe400dc4c -timeCreated: 1481126959 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/AbsOpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/AbsOpNode.cs deleted file mode 100644 index 18adcbd9..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/AbsOpNode.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Abs", "Math Operators", "Absolute value of scalars and vectors" )] - public sealed class AbsOpNode : SingleInputOp - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_opName = "abs"; - m_previewShaderGUID = "cd6d6dfa3df214a479f68a490e177db6"; - m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, - WirePortDataType.FLOAT, - WirePortDataType.FLOAT2, - WirePortDataType.FLOAT3, - WirePortDataType.FLOAT4, - WirePortDataType.COLOR, - WirePortDataType.INT); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/AbsOpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/AbsOpNode.cs.meta deleted file mode 100644 index 50ca8f58..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/AbsOpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 46aea6c13d71ec74da7f23abba3704d6 -timeCreated: 1481126955 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CeilOpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CeilOpNode.cs deleted file mode 100644 index 6767231e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CeilOpNode.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Ceil", "Math Operators", "Smallest integer not less than a scalar or each vector component" )] - public sealed class CeilOpNode : SingleInputOp - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_opName = "ceil"; - m_previewShaderGUID = "ce0588227a766a245a85291977c1f222"; - m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, - WirePortDataType.FLOAT , - WirePortDataType.FLOAT2, - WirePortDataType.FLOAT3, - WirePortDataType.FLOAT4, - WirePortDataType.COLOR , - WirePortDataType.INT); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CeilOpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CeilOpNode.cs.meta deleted file mode 100644 index aba35895..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CeilOpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 555db3754f84db947846519630ea303b -timeCreated: 1481126955 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ClampOpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ClampOpNode.cs deleted file mode 100644 index fe15a01e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ClampOpNode.cs +++ /dev/null @@ -1,103 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Clamp", "Math Operators", "Value clamped to the range [min,max]" )] - public sealed class ClampOpNode : ParentNode - { - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT, false, Constants.EmptyPortValue ); - AddInputPort( WirePortDataType.FLOAT, false, "Min" ); - AddInputPort( WirePortDataType.FLOAT, false, "Max" ); - m_inputPorts[ m_inputPorts.Count - 1 ].FloatInternalData = 1; - AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); - m_useInternalPortData = true; - m_textLabelWidth = 55; - m_previewShaderGUID = "ab6163c4b10bfc84da8e3c486520490a"; - } - - public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) - { - base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); - if ( portId == 0 ) - { - m_inputPorts[ 0 ].MatchPortToConnection(); - m_inputPorts[ 1 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); - m_inputPorts[ 2 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); - - m_outputPorts[ 0 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); - } - //else - //{ - // _inputPorts[ portId ].MatchPortToConnection(); - //} - } - - public override void OnConnectedOutputNodeChanges( int outputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) - { - base.OnConnectedOutputNodeChanges( outputPortId, otherNodeId, otherPortId, name, type ); - if ( outputPortId == 0 ) - { - m_inputPorts[ 0 ].MatchPortToConnection(); - m_inputPorts[ 1 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); - m_inputPorts[ 2 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); - m_outputPorts[ 0 ].ChangeType( m_inputPorts[ 0 ].DataType, 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 ); - - WirePortDataType valueType = m_inputPorts[ 0 ].ConnectionType(); - WirePortDataType minType = m_inputPorts[ 1 ].ConnectionType(); - WirePortDataType maxType = m_inputPorts[ 2 ].ConnectionType(); - - string value = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - string min = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); - if ( minType != valueType ) - { - min = UIUtils.CastPortType( ref dataCollector, CurrentPrecisionType, new NodeCastInfo( UniqueId, outputId ), null, m_inputPorts[ 1 ].DataType, m_inputPorts[ 0 ].DataType, min ); - } - - string max = m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ); - if ( maxType != valueType ) - { - max = UIUtils.CastPortType( ref dataCollector, CurrentPrecisionType, new NodeCastInfo( UniqueId, outputId ), null, m_inputPorts[ 2 ].DataType, m_inputPorts[ 0 ].DataType, max ); - } - - string result = string.Empty; - switch ( valueType ) - { - case WirePortDataType.FLOAT: - case WirePortDataType.FLOAT2: - case WirePortDataType.FLOAT3: - case WirePortDataType.FLOAT4: - case WirePortDataType.INT: - case WirePortDataType.COLOR: - case WirePortDataType.OBJECT: - { - result = "clamp( " + value + " , " + min + " , " + max + " )"; - } - break; - case WirePortDataType.FLOAT3x3: - case WirePortDataType.FLOAT4x4: - { - return UIUtils.InvalidParameter( this ); - } - } - - RegisterLocalVariable( 0, result, ref dataCollector, "clampResult" + OutputId ); - return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); - } - - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ClampOpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ClampOpNode.cs.meta deleted file mode 100644 index dd3c8f70..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ClampOpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 5d7101830aa0c524f9519fef95c90dc3 -timeCreated: 1481126956 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ClipNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ClipNode.cs deleted file mode 100644 index 606cb822..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ClipNode.cs +++ /dev/null @@ -1,123 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Clip", "Miscellaneous", "Conditionally kill a pixel before output" )] - public sealed class ClipNode : ParentNode - { - private const string ClipOpFormat = "clip( {0} );"; - private const string ClipSubOpFormat = "clip( {0} - {1});"; - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT, false, Constants.EmptyPortValue ); - AddInputPort( WirePortDataType.FLOAT, false, "Alpha" ); - AddInputPort( WirePortDataType.FLOAT, false, "Threshold" ); - AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); - m_useInternalPortData = true; - - m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, - WirePortDataType.FLOAT , - WirePortDataType.FLOAT2, - WirePortDataType.FLOAT3, - WirePortDataType.FLOAT4, - WirePortDataType.COLOR , - WirePortDataType.INT); - - m_previewShaderGUID = "1fca7774f364aee4d8c64e8634ef4be4"; - } - - public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) - { - base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); - m_inputPorts[ portId ].MatchPortToConnection(); - UpdatePortConnection( portId ); - } - - public override void OnConnectedOutputNodeChanges( int outputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) - { - base.OnConnectedOutputNodeChanges( outputPortId, otherNodeId, otherPortId, name, type ); - m_inputPorts[ outputPortId ].MatchPortToConnection(); - UpdatePortConnection( outputPortId ); - } - - void UpdatePortConnection( int portId ) - { - if( portId == 0 ) - { - m_outputPorts[ 0 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); - } - else - { - int otherPortId = portId == 1 ? 2 : 1; - if( m_inputPorts[ otherPortId ].IsConnected ) - { - WirePortDataType type1 = m_inputPorts[ portId ].DataType; - WirePortDataType type2 = m_inputPorts[ otherPortId ].DataType; - - WirePortDataType mainType = UIUtils.GetPriority( type1 ) > UIUtils.GetPriority( type2 ) ? type1 : type2; - - m_inputPorts[ portId ].ChangeType( mainType, false ); - m_inputPorts[ otherPortId ].ChangeType( mainType , false ); - } - else - { - m_inputPorts[ otherPortId ].ChangeType( m_inputPorts[ portId ].DataType,false ); - } - } - } - - public override void OnInputPortDisconnected( int portId ) - { - base.OnInputPortDisconnected( portId ); - if( portId == 0 ) - return; - int otherPortId = portId == 1 ? 2 : 1; - if( m_inputPorts[ otherPortId ].IsConnected ) - { - m_inputPorts[ portId ].ChangeType( m_inputPorts[ otherPortId ].DataType, false ); - } - else - { - m_inputPorts[ portId ].ChangeType( WirePortDataType.FLOAT, false ); - m_inputPorts[ otherPortId ].ChangeType( WirePortDataType.FLOAT, false ); - } - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if( dataCollector.PortCategory == MasterNodePortCategory.Vertex || - dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) - { - UIUtils.ShowMessage( UniqueId, "Clip can only be used in fragment functions", MessageSeverity.Warning ); - return GenerateErrorValue(); - } - - string value = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - string alpha = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); - if( m_inputPorts[ 2 ].IsConnected ) - { - string threshold = m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ); - dataCollector.AddLocalVariable( UniqueId, string.Format( ClipSubOpFormat, alpha , threshold) ); - } - else - { - if( m_inputPorts[ 2 ].IsZeroInternalData ) - { - dataCollector.AddLocalVariable( UniqueId, string.Format( ClipOpFormat, alpha ) ); - } - else - { - string threshold = m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ); - dataCollector.AddLocalVariable( UniqueId, string.Format( ClipSubOpFormat, alpha, threshold ) ); - } - } - - return value; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ClipNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ClipNode.cs.meta deleted file mode 100644 index 0d24e6e4..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ClipNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 78e9954f4d587b74fa38ae1dd9922d77 -timeCreated: 1481126957 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ComponentMaskNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ComponentMaskNode.cs deleted file mode 100644 index 3ed727cd..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ComponentMaskNode.cs +++ /dev/null @@ -1,382 +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( "Component Mask", "Vector Operators", "Mask certain channels from vectors/color components", null, KeyCode.K )] - public sealed class ComponentMaskNode : ParentNode - { - private const string OutputLocalVarName = "componentMask"; - [SerializeField] - private bool[] m_selection = { true, true, true, true }; - - [SerializeField] - private int m_outputPortCount = 4; - - [SerializeField] - private string[] m_labels; - - private int m_cachedOrderId = -1; - private int m_cachedSingularId = -1; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT4, false, Constants.EmptyPortValue ); - AddOutputPort( WirePortDataType.FLOAT4, Constants.EmptyPortValue ); - m_useInternalPortData = true; - m_autoWrapProperties = true; - m_selectedLocation = PreviewLocation.TopCenter; - m_labels = new string[] { "X", "Y", "Z", "W" }; - m_previewShaderGUID = "b78e2b295c265cd439c80d218fb3e88e"; - SetAdditonalTitleText( "Value( XYZW )" ); - } - - public override void SetPreviewInputs() - { - base.SetPreviewInputs(); - - Vector4 order = new Vector4(-1,-1,-1,-1); - int lastIndex = 0; - int singularId = -1; - var datatype = m_inputPorts[ 0 ].DataType; - - if( m_selection[ 0 ] ) - { - order.Set( lastIndex, order.y, order.z, order.w ); - lastIndex++; - singularId = 0; - } - if( m_selection[ 1 ] && datatype >= WirePortDataType.FLOAT2 ) - { - order.Set( order.x, lastIndex, order.z, order.w ); - lastIndex++; - singularId = 1; - } - if( m_selection[ 2 ] && datatype >= WirePortDataType.FLOAT3 ) - { - order.Set( order.x, order.y, lastIndex, order.w ); - lastIndex++; - singularId = 2; - } - if( m_selection[ 3 ] && ( datatype == WirePortDataType.FLOAT4 || datatype == WirePortDataType.COLOR ) ) - { - order.Set( order.x, order.y, order.z, lastIndex ); - lastIndex++; - singularId = 3; - } - - if ( lastIndex != 1 ) - singularId = -1; - - if ( m_cachedOrderId == -1 ) - m_cachedOrderId = Shader.PropertyToID( "_Order" ); - - if ( m_cachedSingularId == -1 ) - m_cachedSingularId = Shader.PropertyToID( "_Singular" ); - - PreviewMaterial.SetVector( m_cachedOrderId, order ); - PreviewMaterial.SetFloat( m_cachedSingularId, singularId ); - } - - public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) - { - base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); - UpdatePorts(); - UpdateTitle(); - } - - public override void OnConnectedOutputNodeChanges( int outputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) - { - base.OnConnectedOutputNodeChanges( outputPortId, otherNodeId, otherPortId, name, type ); - UpdatePorts(); - UpdateTitle(); - } - - public override void OnInputPortDisconnected( int portId ) - { - base.OnInputPortDisconnected( portId ); - UpdateTitle(); - } - - void UpdatePorts() - { - m_inputPorts[ 0 ].MatchPortToConnection(); - int count = 0; - switch ( m_inputPorts[ 0 ].DataType ) - { - case WirePortDataType.FLOAT4: - case WirePortDataType.OBJECT: - case WirePortDataType.COLOR: - { - count = 4; - } - break; - case WirePortDataType.FLOAT3: - { - count = 3; - } - break; - case WirePortDataType.FLOAT2: - { - count = 2; - } - break; - case WirePortDataType.FLOAT: - case WirePortDataType.INT: - case WirePortDataType.FLOAT3x3: - case WirePortDataType.FLOAT4x4: - { } - break; - } - - int activeCount = 0; - if ( count > 0 ) - { - for ( int i = 0; i < count; i++ ) - { - if ( m_selection[ i ] ) - activeCount += 1; - } - } - - m_outputPortCount = activeCount; - switch ( activeCount ) - { - case 0: ChangeOutputType( m_inputPorts[ 0 ].DataType, false ); break; - case 1: ChangeOutputType( WirePortDataType.FLOAT, false ); break; - case 2: ChangeOutputType( WirePortDataType.FLOAT2, false ); break; - case 3: ChangeOutputType( WirePortDataType.FLOAT3, false ); break; - case 4: ChangeOutputType( m_inputPorts[ 0 ].DataType, false ); break; - } - - } - - private void UpdateTitle() - { - int count = 0; - string additionalText = string.Empty; - switch ( m_inputPorts[ 0 ].DataType ) - { - case WirePortDataType.FLOAT4: - case WirePortDataType.OBJECT: - case WirePortDataType.COLOR: - { - count = 4; - } - break; - case WirePortDataType.FLOAT3: - { - count = 3; - } - break; - case WirePortDataType.FLOAT2: - { - count = 2; - } - break; - case WirePortDataType.FLOAT: - case WirePortDataType.INT: - { - count = 0; - } - break; - case WirePortDataType.FLOAT3x3: - case WirePortDataType.FLOAT4x4: - { } - break; - } - - if ( count > 0 ) - { - for ( int i = 0; i < count; i++ ) - { - if ( m_selection[ i ] ) - { - additionalText += UIUtils.GetComponentForPosition( i, m_inputPorts[ 0 ].DataType ).ToUpper(); - } - } - } - - if ( additionalText.Length > 0 ) - SetAdditonalTitleText( "Value( " + additionalText + " )" ); - else - SetAdditonalTitleText( string.Empty ); - } - - public override void DrawProperties() - { - base.DrawProperties(); - - EditorGUILayout.BeginVertical(); - - int count = 0; - switch ( m_inputPorts[ 0 ].DataType ) - { - case WirePortDataType.FLOAT4: - case WirePortDataType.OBJECT: - case WirePortDataType.COLOR: - { - count = 4; - } - break; - case WirePortDataType.FLOAT3: - { - count = 3; - } - break; - case WirePortDataType.FLOAT2: - { - count = 2; - } - break; - case WirePortDataType.FLOAT: - case WirePortDataType.INT: - case WirePortDataType.FLOAT3x3: - case WirePortDataType.FLOAT4x4: - { } - break; - } - - int activeCount = 0; - if ( count > 0 ) - { - for ( int i = 0; i < count; i++ ) - { - m_selection[ i ] = EditorGUILayoutToggleLeft( m_labels[i], m_selection[ i ] ); - m_labels[ i ] = UIUtils.GetComponentForPosition( i, m_inputPorts[ 0 ].DataType ).ToUpper(); - if ( m_selection[ i ] ) - { - activeCount += 1; - } - } - } - - if ( activeCount != m_outputPortCount ) - { - m_outputPortCount = activeCount; - switch ( activeCount ) - { - case 0: ChangeOutputType( m_inputPorts[ 0 ].DataType, false ); break; - case 1: ChangeOutputType( WirePortDataType.FLOAT, false ); break; - case 2: ChangeOutputType( WirePortDataType.FLOAT2, false ); break; - case 3: ChangeOutputType( WirePortDataType.FLOAT3, false ); break; - case 4: ChangeOutputType( m_inputPorts[ 0 ].DataType, false ); break; - } - UpdateTitle(); - SetSaveIsDirty(); - } - - EditorGUILayout.EndVertical(); - } - - 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 value = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - - int count = 0; - switch ( m_inputPorts[ 0 ].DataType ) - { - case WirePortDataType.FLOAT4: - case WirePortDataType.OBJECT: - case WirePortDataType.COLOR: - { - count = 4; - } - break; - case WirePortDataType.FLOAT3: - { - count = 3; - } - break; - case WirePortDataType.FLOAT2: - { - count = 2; - } - break; - case WirePortDataType.FLOAT: - case WirePortDataType.INT: - { - count = 0; - } - break; - case WirePortDataType.FLOAT3x3: - case WirePortDataType.FLOAT4x4: - { } - break; - } - - if ( count > 0 ) - { - bool firstElement = true; - value = string.Format("({0})",value); - for ( int i = 0; i < count; i++ ) - { - if ( m_selection[ i ] ) - { - if( firstElement ) - { - firstElement = false; - value += "."; - } - value += UIUtils.GetComponentForPosition( i, m_inputPorts[ 0 ].DataType ); - } - } - } - - return CreateOutputLocalVariable( 0, value, ref dataCollector ); - } - - public string GetComponentForPosition( int i ) - { - switch ( i ) - { - case 0: - { - return ( ( m_outputPorts[ 0 ].DataType == WirePortDataType.COLOR ) ? "r" : "x" ); - } - case 1: - { - return ( ( m_outputPorts[ 0 ].DataType == WirePortDataType.COLOR ) ? "g" : "y" ); - } - case 2: - { - return ( ( m_outputPorts[ 0 ].DataType == WirePortDataType.COLOR ) ? "b" : "z" ); - } - case 3: - { - return ( ( m_outputPorts[ 0 ].DataType == WirePortDataType.COLOR ) ? "a" : "w" ); - } - } - return string.Empty; - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - for ( int i = 0; i < 4; i++ ) - { - m_selection[ i ] = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - } - UpdateTitle(); - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - for ( int i = 0; i < 4; i++ ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_selection[ i ] ); - } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ComponentMaskNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ComponentMaskNode.cs.meta deleted file mode 100644 index fd1be0b3..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ComponentMaskNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 85082b6932d1c9a4f8b64605534ef118 -timeCreated: 1481126957 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CosOpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CosOpNode.cs deleted file mode 100644 index a7f799f9..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CosOpNode.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Cos", "Trigonometry Operators", "Cosine of scalars and vectors" )] - public sealed class CosOpNode : SingleInputOp - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_opName = "cos"; - m_previewShaderGUID = "3dde9e80389196f459eb94137268de4a"; - m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, - WirePortDataType.FLOAT , - WirePortDataType.FLOAT2, - WirePortDataType.FLOAT3, - WirePortDataType.FLOAT4, - WirePortDataType.COLOR , - WirePortDataType.INT); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CosOpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CosOpNode.cs.meta deleted file mode 100644 index 132f1bfa..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CosOpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: ee9c446e7e41d524f8b4c93e6a8886c5 -timeCreated: 1481126960 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CoshOpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CoshOpNode.cs deleted file mode 100644 index 24b6205f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CoshOpNode.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Cosh", "Trigonometry Operators", "Hyperbolic cosine of scalars and vectors" )] - public sealed class CoshOpNode : SingleInputOp - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_opName = "cosh"; - m_previewShaderGUID = "154a4c85fe88657489a54a02416402c0"; - m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, - WirePortDataType.FLOAT, - WirePortDataType.FLOAT2, - WirePortDataType.FLOAT3, - WirePortDataType.FLOAT4, - WirePortDataType.COLOR, - WirePortDataType.INT ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CoshOpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CoshOpNode.cs.meta deleted file mode 100644 index 46ec8178..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CoshOpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 2b50a187f488a004aaa2dabbe558ab3a -timeCreated: 1481126954 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CrossProductOpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CrossProductOpNode.cs deleted file mode 100644 index 354db0d2..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CrossProductOpNode.cs +++ /dev/null @@ -1,35 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using UnityEngine; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Cross", "Vector Operators", "Cross product of two three-component vectors ( A x B )", null, KeyCode.X )] - public sealed class CrossProductOpNode : ParentNode - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT3, false, "Lhs" ); - AddInputPort( WirePortDataType.FLOAT3, false, "Rhs" ); - AddOutputPort( WirePortDataType.FLOAT3, "Out" ); - m_useInternalPortData = true; - m_previewShaderGUID = "65a9be5cc7037654db8e148d669f03ee"; - } - - 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 lhsStr = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - string rhsStr = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); - - string result = "cross( " + lhsStr + " , " + rhsStr + " )"; - return CreateOutputLocalVariable( 0, result, ref dataCollector ); - } - - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CrossProductOpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CrossProductOpNode.cs.meta deleted file mode 100644 index 61758de7..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/CrossProductOpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 283bc0645ce925346b33c024ff5a7dad -timeCreated: 1481126954 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DdxOpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DdxOpNode.cs deleted file mode 100644 index 53b8821d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DdxOpNode.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -namespace AmplifyShaderEditor -{ - [System.Serializable] - [NodeAttributes( "DDX", "Math Operators", "Approximate partial derivative with respect to window-space X" )] - public sealed class DdxOpNode : SingleInputOp - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_opName = "ddx"; - m_previewShaderGUID = "b54ea73d5568b3540977557813eb9c3c"; - m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, - WirePortDataType.FLOAT, - WirePortDataType.FLOAT2, - WirePortDataType.FLOAT3, - WirePortDataType.FLOAT4, - WirePortDataType.COLOR, - WirePortDataType.INT ); - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if( dataCollector.IsFragmentCategory ) - return base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); - else - return m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DdxOpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DdxOpNode.cs.meta deleted file mode 100644 index d83171e8..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DdxOpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 2e14c4a7c0be9f146ac912130c280b15 -timeCreated: 1481126954 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DdyOpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DdyOpNode.cs deleted file mode 100644 index 604a341b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DdyOpNode.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -namespace AmplifyShaderEditor -{ - [System.Serializable] - [NodeAttributes( "DDY", "Math Operators", "Approximate partial derivative with respect to window-space Y" )] - public sealed class DdyOpNode : SingleInputOp - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_opName = "ddy"; - m_previewShaderGUID = "197dcc7f05339da47b6b0e681c475c5e"; - m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, - WirePortDataType.FLOAT, - WirePortDataType.FLOAT2, - WirePortDataType.FLOAT3, - WirePortDataType.FLOAT4, - WirePortDataType.COLOR, - WirePortDataType.INT ); - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if( dataCollector.IsFragmentCategory ) - return base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); - else - return m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DdyOpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DdyOpNode.cs.meta deleted file mode 100644 index d32275f6..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DdyOpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 722a2ad531fefdc4d8782d5c7cdfd012 -timeCreated: 1481126956 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DegreesOpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DegreesOpNode.cs deleted file mode 100644 index 97afc8ba..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DegreesOpNode.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Degrees", "Trigonometry Operators", "Converts values of scalars and vectors from radians to degrees" )] - public sealed class DegreesOpNode : SingleInputOp - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_opName = "degrees"; - m_previewShaderGUID = "2a8eebb5566830c4a9d7c4b9021bb743"; - m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, - WirePortDataType.FLOAT , - WirePortDataType.FLOAT2, - WirePortDataType.FLOAT3, - WirePortDataType.FLOAT4, - WirePortDataType.COLOR , - WirePortDataType.INT); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DegreesOpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DegreesOpNode.cs.meta deleted file mode 100644 index 93e8abe4..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DegreesOpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 3d88a21f3ece742408c7748897a21c79 -timeCreated: 1481126955 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DeterminantOpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DeterminantOpNode.cs deleted file mode 100644 index d48f775d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DeterminantOpNode.cs +++ /dev/null @@ -1,25 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Determinant", "Matrix Operators", "Scalar determinant of a square matrix" )] - public sealed class DeterminantOpNode : SingleInputOp - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_opName = "determinant"; - m_drawPreview = false; - m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.FLOAT3x3, - WirePortDataType.FLOAT4x4 ); - - m_autoUpdateOutputPort = false; - m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT4x4, false ); - m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT, false ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DeterminantOpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DeterminantOpNode.cs.meta deleted file mode 100644 index 16d62ceb..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DeterminantOpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: e5cded78687f09442895bc96cc5b683d -timeCreated: 1481126960 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DistanceOpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DistanceOpNode.cs deleted file mode 100644 index 8e3a6dbc..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DistanceOpNode.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Distance", "Vector Operators", "Euclidean distance between two points" )] - public sealed class DistanceOpNode : DynamicTypeNode - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT4, false ); - m_inputPorts[ 1 ].ChangeType( WirePortDataType.FLOAT4, false ); - m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT, false ); - m_dynamicOutputType = false; - m_useInternalPortData = true; - m_previewShaderGUID = "3be9a95031c0cb740ae982e465dfc242"; - } - - public override string BuildResults( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) - return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); - - base.BuildResults( outputId, ref dataCollector, ignoreLocalvar ); - string result = "distance( " + m_inputA + " , " + m_inputB + " )"; - return CreateOutputLocalVariable( 0, result, ref dataCollector ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DistanceOpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DistanceOpNode.cs.meta deleted file mode 100644 index 3d28c02d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DistanceOpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 4b8bd7fecbc728f4b89d398cef86ada8 -timeCreated: 1481126955 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DotProductOpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DotProductOpNode.cs deleted file mode 100644 index 892ae533..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DotProductOpNode.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using UnityEngine; -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Dot", "Vector Operators", "Scalar dot product of two vectors ( A . B )", null, KeyCode.Period )] - public sealed class DotProductOpNode : DynamicTypeNode - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT4, false ); - m_inputPorts[ 1 ].ChangeType( WirePortDataType.FLOAT4, false ); - m_dynamicOutputType = false; - m_useInternalPortData = true; - m_allowMatrixCheck = true; - m_previewShaderGUID = "85f11fd5cb9bb954c8615a45c57a3784"; - } - - public override string BuildResults( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) - return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); - - base.BuildResults( outputId, ref dataCollector, ignoreLocalvar ); - string result = "dot( " + m_inputA + " , " + m_inputB + " )"; - RegisterLocalVariable( 0, result, ref dataCollector, "dotResult" + OutputId ); - return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DotProductOpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DotProductOpNode.cs.meta deleted file mode 100644 index a84594ff..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/DotProductOpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: c2bf0375fb75ce245b2f30857a111972 -timeCreated: 1481126959 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/Exp2OpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/Exp2OpNode.cs deleted file mode 100644 index b94d5610..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/Exp2OpNode.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Exp2", "Math Operators", "Base-2 exponential of scalars and vectors" )] - public sealed class Exp2OpNode : SingleInputOp - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_opName = "exp2"; - m_previewShaderGUID = "ceb70ed5423a36647a504a41de7dbfe6"; - m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, - WirePortDataType.FLOAT, - WirePortDataType.FLOAT2, - WirePortDataType.FLOAT3, - WirePortDataType.FLOAT4, - WirePortDataType.COLOR, - WirePortDataType.INT ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/Exp2OpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/Exp2OpNode.cs.meta deleted file mode 100644 index edea0de0..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/Exp2OpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: a9881734e0217bc45bb422dc83f6ee1a -timeCreated: 1481126958 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ExpOpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ExpOpNode.cs deleted file mode 100644 index 29bded7b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ExpOpNode.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Exp", "Math Operators", "Base-e exponential of scalars and vectors" )] - public sealed class ExpOpNode : SingleInputOp - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_opName = "exp"; - m_previewShaderGUID = "6416ff506137d97479a7ebde790b45e5"; - m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, - WirePortDataType.FLOAT , - WirePortDataType.FLOAT2, - WirePortDataType.FLOAT3, - WirePortDataType.FLOAT4, - WirePortDataType.COLOR , - WirePortDataType.INT); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ExpOpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ExpOpNode.cs.meta deleted file mode 100644 index f5989769..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ExpOpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 81ef96bc69f897d4e8bc21e2731e065f -timeCreated: 1481126957 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FWidthOpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FWidthOpNode.cs deleted file mode 100644 index 41f14b3f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FWidthOpNode.cs +++ /dev/null @@ -1,25 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -namespace AmplifyShaderEditor -{ - [System.Serializable] - [NodeAttributes( "FWidth", "Math Operators", "Sum of approximate window-space partial derivatives magnitudes" )] - public sealed class FWidthOpNode : SingleInputOp - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_opName = "fwidth"; - m_previewShaderGUID = "81ea481faaef9c8459a555479ba64df7"; - m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, - WirePortDataType.FLOAT , - WirePortDataType.FLOAT2, - WirePortDataType.FLOAT3, - WirePortDataType.FLOAT4, - WirePortDataType.COLOR , - WirePortDataType.INT); - //m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT4, false ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FWidthOpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FWidthOpNode.cs.meta deleted file mode 100644 index f97901e5..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FWidthOpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 2e17448829221b04bb3185bef727b19f -timeCreated: 1481126954 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FloorOpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FloorOpNode.cs deleted file mode 100644 index 5fe190e6..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FloorOpNode.cs +++ /dev/null @@ -1,24 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -namespace AmplifyShaderEditor -{ - [System.Serializable] - [NodeAttributes( "Floor", "Math Operators", "Largest integer not greater than a scalar or each vector component" )] - public sealed class FloorOpNode : SingleInputOp - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_opName = "floor"; - m_previewShaderGUID = "46ae4a72a9a38de40a2d8f20cfccc67d"; - m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, - WirePortDataType.FLOAT , - WirePortDataType.FLOAT2, - WirePortDataType.FLOAT3, - WirePortDataType.FLOAT4, - WirePortDataType.COLOR , - WirePortDataType.INT); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FloorOpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FloorOpNode.cs.meta deleted file mode 100644 index bd8bbdb0..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FloorOpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 176154e86c6c3544fab0d67e098c645d -timeCreated: 1481126953 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FmodOpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FmodOpNode.cs deleted file mode 100644 index 698e3701..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FmodOpNode.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Fmod", "Math Operators", "Floating point remainder of x/y with the same sign as x" )] - public sealed class FmodOpNode : DynamicTypeNode - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_previewShaderGUID = "65083930f9d7812479fd6ff203ad2992"; - } - - public override string BuildResults( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) - return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); - - base.BuildResults( outputId, ref dataCollector, ignoreLocalvar ); - if( m_inputPorts[ 0 ].DataType == WirePortDataType.INT ) - m_inputA = "(float)" + m_inputA; - - - if( m_inputPorts[ 1 ].DataType == WirePortDataType.INT ) - m_inputB = "(float)" + m_inputB; - - - string result = "fmod( " + m_inputA + " , " + m_inputB + " )"; - return CreateOutputLocalVariable( 0, result, ref dataCollector ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FmodOpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FmodOpNode.cs.meta deleted file mode 100644 index c4d07b80..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FmodOpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 599ae67e52ac45f46acc0efd9285b97c -timeCreated: 1481126956 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FractNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FractNode.cs deleted file mode 100644 index 62c54dcb..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FractNode.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Fract", "Math Operators", "Fractional portion of a scalar or each vector component" )] - public sealed class FractNode : SingleInputOp - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_opName = "frac"; - m_previewShaderGUID = "53a335f8f18d4694b8d94e8aee21fdca"; - m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, - WirePortDataType.FLOAT, - WirePortDataType.FLOAT2, - WirePortDataType.FLOAT3, - WirePortDataType.FLOAT4, - WirePortDataType.COLOR, - WirePortDataType.INT ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FractNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FractNode.cs.meta deleted file mode 100644 index 004f9c6c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/FractNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: fd6da00dbcdf3d04cb35a61cda01ae77 -timeCreated: 1481126960 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/GradientSampleNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/GradientSampleNode.cs deleted file mode 100644 index 893521dc..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/GradientSampleNode.cs +++ /dev/null @@ -1,207 +0,0 @@ -using System; -using UnityEngine; -using UnityEditor; -using System.Collections; -using System.Collections.Generic; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Gradient Sample", "Miscellaneous", "Samples a gradient" )] - public sealed class GradientSampleNode : ParentNode - { - private string m_functionHeader = "SampleGradient( {0}, {1} )"; - private string m_functionBody = string.Empty; - - private GradientNode m_gradientNode = null; - private InputPort m_gradPort; - - private Gradient m_blankGrandient = new Gradient(); - - private int m_cachedTimeId = -1; - private int m_cachedTypeId = -1; - private int m_cachedColorNumId = -1; - private int m_cachedAlphaNumId = -1; - - private Vector4 m_auxVec4 = Vector4.zero; - - private string m_functionHeaderStruct = "Gradient( {0} )"; - private string m_functionBodyStruct = string.Empty; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.OBJECT, true, Constants.EmptyPortValue ); - AddInputPort( WirePortDataType.FLOAT, false, "Time" ); - AddOutputColorPorts( "RGBA", true ); - m_gradPort = m_inputPorts[ 0 ]; - m_useInternalPortData = true; - m_autoDrawInternalPortData = true; - m_drawPreviewExpander = false; - m_drawPreview = true; - m_showPreview = true; - m_selectedLocation = PreviewLocation.TopCenter; - m_previewShaderGUID = "8a09124cd6e4aa54a996e7487ec16b90"; - } - - public override void SetPreviewInputs() - { - base.SetPreviewInputs(); - - if( m_cachedTypeId == -1 ) - m_cachedTypeId = Shader.PropertyToID( "_GType" ); - - if( m_cachedTimeId == -1 ) - m_cachedTimeId = Shader.PropertyToID( "_GTime" ); - - if( m_cachedColorNumId == -1 ) - m_cachedColorNumId = Shader.PropertyToID( "_GColorNum" ); - - if( m_cachedAlphaNumId == -1 ) - m_cachedAlphaNumId = Shader.PropertyToID( "_GAlphaNum" ); - - PreviewMaterial.SetTexture( m_cachedTimeId, m_inputPorts[ 1 ].InputPreviewTexture( ContainerGraph ) ); - - Gradient curGrad = m_blankGrandient; - if( m_gradientNode != null ) - curGrad = m_gradientNode.Gradient; - - PreviewMaterial.SetInt( m_cachedTypeId, (int)curGrad.mode ); - PreviewMaterial.SetInt( m_cachedColorNumId, curGrad.colorKeys.Length ); - PreviewMaterial.SetInt( m_cachedAlphaNumId, curGrad.alphaKeys.Length ); - - for( int i = 0; i < 8; i++ ) - { - if( i < curGrad.colorKeys.Length ) - { - m_auxVec4.x = curGrad.colorKeys[ i ].color.r; - m_auxVec4.y = curGrad.colorKeys[ i ].color.g; - m_auxVec4.z = curGrad.colorKeys[ i ].color.b; - m_auxVec4.w = curGrad.colorKeys[ i ].time; - PreviewMaterial.SetVector( "_Col" + i, m_auxVec4 ); - } - else - { - PreviewMaterial.SetVector( "_Col" + i, Vector4.zero ); - } - } - - for( int i = 0; i < 8; i++ ) - { - if( i < curGrad.alphaKeys.Length ) - { - m_auxVec4.x = curGrad.alphaKeys[ i ].alpha; - m_auxVec4.y = curGrad.alphaKeys[ i ].time; - PreviewMaterial.SetVector( "_Alp" + i, m_auxVec4 ); - } - else - { - PreviewMaterial.SetVector( "_Alp" + i, Vector4.zero ); - } - } - } - - public override void OnNodeLogicUpdate( DrawInfo drawInfo ) - { - base.OnNodeLogicUpdate( drawInfo ); - - if( m_gradPort.IsConnected ) - { - m_gradientNode = RecursiveBackCheck( m_gradPort.GetOutputNode( 0 ) ); - } - else - { - m_gradientNode = null; - } - } - - GradientNode RecursiveBackCheck( ParentNode node ) - { - if( node is GradientNode ) - { - return node as GradientNode; - } - else - { - if( node is RelayNode || node is WireNode || node is RegisterLocalVarNode ) - { - return RecursiveBackCheck( node.InputPorts[ 0 ].GetOutputNode( 0 ) ); - } - else if( node is GetLocalVarNode) - { - var gnode = node as GetLocalVarNode; - if( gnode.CurrentSelected != null ) - return RecursiveBackCheck( gnode.CurrentSelected ); - else - return null; - } - else - { - return null; - } - } - - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - m_functionBodyStruct = string.Empty; - if( !dataCollector.IsSRP ) - { - GradientNode.GenerateGradientStruct( ref m_functionBodyStruct ); - dataCollector.AddFunctions( m_functionHeaderStruct, m_functionBodyStruct, "0" ); - } - else - { - dataCollector.AddToIncludes( UniqueId, "Packages/com.unity.shadergraph/ShaderGraphLibrary/Functions.hlsl" ); - } - - GenerateGradientSampler( dataCollector.IsSRP ); - - string gradient = "(Gradient)0"; - if( m_inputPorts[ 0 ].IsConnected && m_gradientNode != null ) - gradient = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - string time = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); - - string functionResult = dataCollector.AddFunctions( m_functionHeader, m_functionBody, gradient, time ); - return GetOutputVectorItem( 0, outputId, functionResult ); - } - - void GenerateGradientSampler( bool isSrp ) - { - m_functionBody = string.Empty; - IOUtils.AddFunctionHeader( ref m_functionBody, "float4 SampleGradient( Gradient gradient, float time )" ); - IOUtils.AddFunctionLine( ref m_functionBody, "float3 color = gradient.colors[0].rgb;" ); - IOUtils.AddFunctionLine( ref m_functionBody, "UNITY_UNROLL" ); - IOUtils.AddFunctionLine( ref m_functionBody, "for (int c = 1; c < 8; c++)" ); - IOUtils.AddFunctionLine( ref m_functionBody, "{" ); - if( isSrp ) - IOUtils.AddFunctionLine( ref m_functionBody, "float colorPos = saturate((time - gradient.colors[c-1].w) / (gradient.colors[c].w - gradient.colors[c-1].w)) * step(c, gradient.colorsLength-1);" ); - else - IOUtils.AddFunctionLine( ref m_functionBody, "float colorPos = saturate((time - gradient.colors[c-1].w) / (gradient.colors[c].w - gradient.colors[c-1].w)) * step(c, (float)gradient.colorsLength-1);" ); - IOUtils.AddFunctionLine( ref m_functionBody, "color = lerp(color, gradient.colors[c].rgb, lerp(colorPos, step(0.01, colorPos), gradient.type));" ); - IOUtils.AddFunctionLine( ref m_functionBody, "}" ); - - IOUtils.AddFunctionLine( ref m_functionBody, "#ifndef UNITY_COLORSPACE_GAMMA" ); - if( isSrp ) - IOUtils.AddFunctionLine( ref m_functionBody, "color = SRGBToLinear(color);" ); - else - IOUtils.AddFunctionLine( ref m_functionBody, "color = half3(GammaToLinearSpaceExact(color.r), GammaToLinearSpaceExact(color.g), GammaToLinearSpaceExact(color.b));" ); - IOUtils.AddFunctionLine( ref m_functionBody, "#endif" ); - - IOUtils.AddFunctionLine( ref m_functionBody, "float alpha = gradient.alphas[0].x;" ); - IOUtils.AddFunctionLine( ref m_functionBody, "UNITY_UNROLL" ); - IOUtils.AddFunctionLine( ref m_functionBody, "for (int a = 1; a < 8; a++)" ); - IOUtils.AddFunctionLine( ref m_functionBody, "{" ); - if( isSrp ) - IOUtils.AddFunctionLine( ref m_functionBody, "float alphaPos = saturate((time - gradient.alphas[a-1].y) / (gradient.alphas[a].y - gradient.alphas[a-1].y)) * step(a, gradient.alphasLength-1);" ); - else - IOUtils.AddFunctionLine( ref m_functionBody, "float alphaPos = saturate((time - gradient.alphas[a-1].y) / (gradient.alphas[a].y - gradient.alphas[a-1].y)) * step(a, (float)gradient.alphasLength-1);" ); - IOUtils.AddFunctionLine( ref m_functionBody, "alpha = lerp(alpha, gradient.alphas[a].x, lerp(alphaPos, step(0.01, alphaPos), gradient.type));" ); - IOUtils.AddFunctionLine( ref m_functionBody, "}" ); - IOUtils.AddFunctionLine( ref m_functionBody, "return float4(color, alpha);" ); - IOUtils.CloseFunctionBody( ref m_functionBody ); - } - - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/GradientSampleNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/GradientSampleNode.cs.meta deleted file mode 100644 index 51d0b9e5..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/GradientSampleNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: b90e416e2fa93a249952fabc78f659c8 -timeCreated: 1562847602 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/InverseOpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/InverseOpNode.cs deleted file mode 100644 index 178fc545..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/InverseOpNode.cs +++ /dev/null @@ -1,138 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> -// 4x4 Invert by DBN in -// http://answers.unity3d.com/questions/218333/shader-inversefloat4x4-function.html?childToView=641391#answer-641391 - -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Inverse", "Matrix Operators", "Inverse matrix of a matrix" )] - public sealed class InverseOpNode : SingleInputOp - { - private string Inverse4x4Header = "Inverse4x4( {0} )"; - - //4x4 - private string[] Inverse4x4Function = - { - "{0}4x4 Inverse4x4({0}4x4 input)\n", - "{\n", - "\t#define minor(a,b,c) determinant({0}3x3(input.a, input.b, input.c))\n", - "\t{0}4x4 cofactors = {0}4x4(\n", - "\tminor( _22_23_24, _32_33_34, _42_43_44 ),\n", - "\t-minor( _21_23_24, _31_33_34, _41_43_44 ),\n", - "\tminor( _21_22_24, _31_32_34, _41_42_44 ),\n", - "\t-minor( _21_22_23, _31_32_33, _41_42_43 ),\n", - "\n", - "\t-minor( _12_13_14, _32_33_34, _42_43_44 ),\n", - "\tminor( _11_13_14, _31_33_34, _41_43_44 ),\n", - "\t-minor( _11_12_14, _31_32_34, _41_42_44 ),\n", - "\tminor( _11_12_13, _31_32_33, _41_42_43 ),\n", - "\n", - "\tminor( _12_13_14, _22_23_24, _42_43_44 ),\n", - "\t-minor( _11_13_14, _21_23_24, _41_43_44 ),\n", - "\tminor( _11_12_14, _21_22_24, _41_42_44 ),\n", - "\t-minor( _11_12_13, _21_22_23, _41_42_43 ),\n", - "\n", - "\t-minor( _12_13_14, _22_23_24, _32_33_34 ),\n", - "\tminor( _11_13_14, _21_23_24, _31_33_34 ),\n", - "\t-minor( _11_12_14, _21_22_24, _31_32_34 ),\n", - "\tminor( _11_12_13, _21_22_23, _31_32_33 ));\n", - "\t#undef minor\n", - "\treturn transpose( cofactors ) / determinant( input );\n", - "}\n" - }; - - private bool[] Inverse4x4FunctionFlags = - { - true, - false, - true, - true, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false, - false - }; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_opName = "inverse"; - m_drawPreview = false; - - m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.FLOAT3x3, - WirePortDataType.FLOAT4x4 ); - m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT4x4, false ); - m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT4x4, 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 precisionString = UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, WirePortDataType.FLOAT ); - string value = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - - if ( m_outputPorts[ 0 ].DataType == WirePortDataType.FLOAT3x3 ) - { - GeneratorUtils.Add3x3InverseFunction( ref dataCollector, precisionString ); - RegisterLocalVariable( 0, string.Format( GeneratorUtils.Inverse3x3Header, value ), ref dataCollector, "invertVal" + OutputId ); - } - else - { - if ( !dataCollector.HasFunction( Inverse4x4Header ) ) - { - //Hack to be used util indent is properly used - int currIndent = UIUtils.ShaderIndentLevel; - - if ( dataCollector.IsTemplate ) - { - UIUtils.ShaderIndentLevel = 0; - } - else - { - UIUtils.ShaderIndentLevel = 1; - UIUtils.ShaderIndentLevel++; - } - - string finalFunction = string.Empty; - for ( int i = 0; i < Inverse4x4Function.Length; i++ ) - { - finalFunction += UIUtils.ShaderIndentTabs + ( Inverse4x4FunctionFlags[ i ] ? string.Format( Inverse4x4Function[ i ], precisionString ) : Inverse4x4Function[ i ] ); - } - - - UIUtils.ShaderIndentLevel = currIndent; - - dataCollector.AddFunction( Inverse4x4Header, finalFunction ); - } - - RegisterLocalVariable( 0, string.Format( Inverse4x4Header, value ), ref dataCollector, "invertVal" + OutputId ); - } - - return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/InverseOpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/InverseOpNode.cs.meta deleted file mode 100644 index bc47ad0f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/InverseOpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 785830160e033d24280df9c5b4cec368 -timeCreated: 1481126957 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/LengthOpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/LengthOpNode.cs deleted file mode 100644 index c67f26b4..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/LengthOpNode.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -namespace AmplifyShaderEditor -{ - [System.Serializable] - [NodeAttributes( "Length", "Vector Operators", "Scalar Euclidean length of a vector" )] - public sealed class LengthOpNode : SingleInputOp - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_opName = "length"; - m_previewShaderGUID = "1c1f6d6512b758942a8b9dd1bea12f34"; - m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, - WirePortDataType.FLOAT , - WirePortDataType.FLOAT2, - WirePortDataType.FLOAT3, - WirePortDataType.FLOAT4, - WirePortDataType.COLOR , - WirePortDataType.INT); - m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT4, false ); - m_autoUpdateOutputPort = false; - } - public override void SetPreviewInputs() - { - base.SetPreviewInputs(); - switch( m_inputPorts[0].DataType ) - { - case WirePortDataType.OBJECT: - case WirePortDataType.INT: - case WirePortDataType.FLOAT: - case WirePortDataType.UINT:m_previewMaterialPassId = 0;break; - case WirePortDataType.FLOAT2:m_previewMaterialPassId = 1;break; - case WirePortDataType.FLOAT3:m_previewMaterialPassId = 2;break; - case WirePortDataType.FLOAT4: - case WirePortDataType.COLOR:m_previewMaterialPassId = 3;break; - } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/LengthOpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/LengthOpNode.cs.meta deleted file mode 100644 index c13dd4f4..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/LengthOpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: bb3fd570e41cfa24d93b53e80eac02d5 -timeCreated: 1481126958 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/LerpOp.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/LerpOp.cs deleted file mode 100644 index 1ec7199d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/LerpOp.cs +++ /dev/null @@ -1,116 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEngine; -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Lerp", "Math Operators", "Linear interpolation of two scalars or vectors based on a weight", null, KeyCode.L )] - public sealed class LerpOp : ParentNode - { - private const string LertOpFormat = "lerp( {0} , {1} , {2})"; - - [UnityEngine.SerializeField] - private WirePortDataType m_mainDataType = WirePortDataType.FLOAT; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_textLabelWidth = 55; - AddInputPort( WirePortDataType.FLOAT, false, "A" ); - AddInputPort( WirePortDataType.FLOAT, false, "B" ); - AddInputPort( WirePortDataType.FLOAT, false, "Alpha" ); - AddOutputPort( WirePortDataType.FLOAT,Constants.EmptyPortValue); - m_useInternalPortData = true; - m_previewShaderGUID = "34d9c4cdcf1fadb49af2de3f90bbc57d"; - } - - public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) - { - base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); - UpdateConnection( portId ); - } - - 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 OnInputPortDisconnected( int portId ) - { - base.OnInputPortDisconnected( portId ); - UpdateConnection( portId ); - } - - void UpdateConnection( int portId ) - { - WirePortDataType type1 = WirePortDataType.FLOAT; - if( m_inputPorts[ 0 ].IsConnected ) - type1 = m_inputPorts[ 0 ].GetOutputConnection( 0 ).DataType; - - WirePortDataType type2 = WirePortDataType.FLOAT; - if( m_inputPorts[ 1 ].IsConnected ) - type2 = m_inputPorts[ 1 ].GetOutputConnection( 0 ).DataType; - - WirePortDataType typealpha = WirePortDataType.FLOAT; - if( m_inputPorts[ 2 ].IsConnected ) - typealpha = m_inputPorts[ 2 ].GetOutputConnection( 0 ).DataType; - - m_mainDataType = UIUtils.GetPriority( type1 ) > UIUtils.GetPriority( type2 ) ? type1 : type2; - - if( !m_inputPorts[ 0 ].IsConnected && !m_inputPorts[ 1 ].IsConnected && m_inputPorts[ 2 ].IsConnected ) - m_mainDataType = m_inputPorts[ 2 ].GetOutputConnection( 0 ).DataType; - - m_inputPorts[ 0 ].ChangeType( m_mainDataType, false ); - - m_inputPorts[ 1 ].ChangeType( m_mainDataType, false ); - if( m_inputPorts[ 2 ].IsConnected && ( typealpha == WirePortDataType.FLOAT || typealpha == WirePortDataType.INT ) ) - m_inputPorts[ 2 ].ChangeType( WirePortDataType.FLOAT, false ); - else - m_inputPorts[ 2 ].ChangeType( m_mainDataType, false ); - - m_outputPorts[ 0 ].ChangeType( m_mainDataType, false ); - } - - //void UpdateDisconnection( int portId ) - //{ - // int otherPortId = ( portId + 1 ) % 2; - // if ( m_inputPorts[ otherPortId ].IsConnected ) - // { - // m_mainDataType = m_inputPorts[ otherPortId ].DataType; - // m_inputPorts[ portId ].ChangeType( m_mainDataType, false ); - // m_outputPorts[ 0 ].ChangeType( m_mainDataType, 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 aValue = m_inputPorts[ 0 ].GenerateShaderForOutput( ref dataCollector, m_mainDataType, ignoreLocalVar, true ); - string bValue = m_inputPorts[ 1 ].GenerateShaderForOutput( ref dataCollector, m_mainDataType, ignoreLocalVar, true ); - string interp = string.Empty; - if( m_inputPorts[ 2 ].DataType == WirePortDataType.FLOAT ) - interp = m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ); - else - interp = m_inputPorts[ 2 ].GenerateShaderForOutput( ref dataCollector, m_mainDataType, ignoreLocalVar,true ); - string result = string.Format( LertOpFormat, aValue,bValue,interp); - - RegisterLocalVariable( 0, result, ref dataCollector, "lerpResult"+OutputId ); - - return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); - } - - //public override void RefreshExternalReferences() - //{ - // if ( m_inputPorts[ 2 ].DataType != WirePortDataType.FLOAT ) - // { - // m_inputPorts[ 2 ].ChangeType( WirePortDataType.FLOAT, false ); - // } - //} - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/LerpOp.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/LerpOp.cs.meta deleted file mode 100644 index 22b8eec4..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/LerpOp.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 1e38abf6e3c7dfa409a5fe40d2ce8a19 -timeCreated: 1481126954 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/Log10OpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/Log10OpNode.cs deleted file mode 100644 index 35914c34..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/Log10OpNode.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Log10", "Math Operators", "Base-10 logarithm of scalars and vectors" )] - public sealed class Log10OpNode : SingleInputOp - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_opName = "log10"; - m_previewShaderGUID = "9e7cfa357dd261f499d0ba8637ff2614"; - m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, - WirePortDataType.FLOAT , - WirePortDataType.FLOAT2, - WirePortDataType.FLOAT3, - WirePortDataType.FLOAT4, - WirePortDataType.COLOR , - WirePortDataType.INT); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/Log10OpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/Log10OpNode.cs.meta deleted file mode 100644 index e9ae3c31..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/Log10OpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: be47a76f1f42fbe47bf2568584c31196 -timeCreated: 1481126959 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/Log2OpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/Log2OpNode.cs deleted file mode 100644 index 614a82a2..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/Log2OpNode.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Log2", "Math Operators", "Base-2 logarithm of scalars and vectors" )] - public sealed class Log2OpNode : SingleInputOp - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_opName = "log2"; - m_previewShaderGUID = "5975a154432d4c64cacd78d015ed08ba"; - m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, - WirePortDataType.FLOAT , - WirePortDataType.FLOAT2, - WirePortDataType.FLOAT3, - WirePortDataType.FLOAT4, - WirePortDataType.COLOR , - WirePortDataType.INT); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/Log2OpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/Log2OpNode.cs.meta deleted file mode 100644 index 9511991b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/Log2OpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: b9489308aad1f794982afc1faf646013 -timeCreated: 1481126958 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/LogOpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/LogOpNode.cs deleted file mode 100644 index ff7d7863..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/LogOpNode.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Log", "Math Operators", "Natural logarithm of scalars and vectors" )] - public sealed class LogOpNode : SingleInputOp - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_opName = "log"; - m_previewShaderGUID = "a3293e0a73834b24682775f5d8ee1e7c"; - m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, - WirePortDataType.FLOAT, - WirePortDataType.FLOAT2, - WirePortDataType.FLOAT3, - WirePortDataType.FLOAT4, - WirePortDataType.COLOR, - WirePortDataType.INT ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/LogOpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/LogOpNode.cs.meta deleted file mode 100644 index 7aab4f70..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/LogOpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 1ed2c12cea61a8c4fa67eebdc10d2a2a -timeCreated: 1481126954 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/MultipleInputOpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/MultipleInputOpNode.cs deleted file mode 100644 index 9cb64e97..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/MultipleInputOpNode.cs +++ /dev/null @@ -1,3 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> -// Deprecated file diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/MultipleInputOpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/MultipleInputOpNode.cs.meta deleted file mode 100644 index 597824ca..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/MultipleInputOpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 8804c7e5888738547b5a704f788fc18b -timeCreated: 1481126957 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/NegateNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/NegateNode.cs deleted file mode 100644 index 00c174dc..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/NegateNode.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Negate", "Math Operators", "Negate or invert an input value" )] - public sealed class NegateNode : ParentNode - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT, false, Constants.EmptyPortValue ); - AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); - m_useInternalPortData = true; - m_previewShaderGUID = "b035bc40da1ac7c4eafad4116382ec79"; - } - - public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) - { - base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); - m_inputPorts[ 0 ].MatchPortToConnection(); - m_outputPorts[ 0 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); - } - - public override void OnConnectedOutputNodeChanges( int outputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) - { - base.OnConnectedOutputNodeChanges( outputPortId, otherNodeId, otherPortId, name, type ); - m_inputPorts[ 0 ].MatchPortToConnection(); - m_outputPorts[ 0 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - string result = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - - if ( result.StartsWith( "-" ) ) - { - return result.Remove( 0, 1 ); - } - else - { - return "-" + result; - } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/NegateNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/NegateNode.cs.meta deleted file mode 100644 index 83f5922e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/NegateNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 01c91005470f6b94eba168a127cecd6c -timeCreated: 1481126953 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/NormalizeNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/NormalizeNode.cs deleted file mode 100644 index 140a1173..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/NormalizeNode.cs +++ /dev/null @@ -1,55 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEngine; -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Normalize", "Vector Operators", "Normalizes a vector", null, KeyCode.N )] - public sealed class NormalizeNode : SingleInputOp - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_selectedLocation = PreviewLocation.TopCenter; - m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT4, false ); - m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.FLOAT, WirePortDataType.FLOAT2, WirePortDataType.FLOAT3, WirePortDataType.FLOAT4, WirePortDataType.COLOR, WirePortDataType.OBJECT, WirePortDataType.INT ); - m_previewShaderGUID = "a51b11dfb6b32884e930595e5f9defa8"; - } - 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 result = string.Empty; - switch ( m_inputPorts[ 0 ].DataType ) - { - case WirePortDataType.FLOAT: - case WirePortDataType.FLOAT2: - case WirePortDataType.FLOAT3: - case WirePortDataType.FLOAT4: - case WirePortDataType.OBJECT: - case WirePortDataType.COLOR: - { - result = "normalize( " + m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ) + " )"; - } - break; - case WirePortDataType.INT: - { - return m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - } - case WirePortDataType.FLOAT3x3: - case WirePortDataType.FLOAT4x4: - { - result = UIUtils.InvalidParameter( this ); - } - break; - } - RegisterLocalVariable( 0, result, ref dataCollector, "normalizeResult" + OutputId ); - - return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/NormalizeNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/NormalizeNode.cs.meta deleted file mode 100644 index 8bec377b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/NormalizeNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: fa6682c371754094f88b3c2a7e96ae26 -timeCreated: 1481126960 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/OneMinusNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/OneMinusNode.cs deleted file mode 100644 index 10792114..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/OneMinusNode.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using UnityEngine; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "One Minus", "Math Operators", "1 - input value", null, KeyCode.O )] - public sealed class OneMinusNode : ParentNode - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT, false, Constants.EmptyPortValue ); - AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); - m_useInternalPortData = true; - m_previewShaderGUID = "bed5300b92e7bb0419d0f4accb853312"; - } - - public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) - { - base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); - m_inputPorts[ 0 ].MatchPortToConnection(); - m_outputPorts[ 0 ].ChangeType( InputPorts[ 0 ].DataType, false ); - } - - public override void OnConnectedOutputNodeChanges( int outputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) - { - base.OnConnectedOutputNodeChanges( outputPortId, otherNodeId, otherPortId, name, type ); - m_inputPorts[ 0 ].MatchPortToConnection(); - m_outputPorts[ 0 ].ChangeType( InputPorts[ 0 ].DataType, 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 result = "( 1.0 - " + m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ) + " )"; - return CreateOutputLocalVariable( 0, result, ref dataCollector ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/OneMinusNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/OneMinusNode.cs.meta deleted file mode 100644 index ff94c53d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/OneMinusNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 727743b66e17d7b4f9c2fbe7dde98bd9 -timeCreated: 1481126956 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/PowerNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/PowerNode.cs deleted file mode 100644 index 82357b67..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/PowerNode.cs +++ /dev/null @@ -1,93 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using UnityEngine; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Power", "Math Operators", "Base to the Exp-th power of scalars and vectors", null, KeyCode.E )] - public sealed class PowerNode : ParentNode - { - public const string SafePowerStr = "max( {0} , 0.0001 )"; - public const string SafePowerLabel = "Safe Power"; - - [SerializeField] - private bool m_safePower = false; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT, false, "Base" ); - AddInputPort( WirePortDataType.FLOAT, false, "Exp" ); - m_inputPorts[ 1 ].FloatInternalData = 1; - AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); - m_useInternalPortData = true; - m_autoWrapProperties = true; - m_textLabelWidth = 85; - m_previewShaderGUID = "758cc2f8b537b4e4b93d9833075d138c"; - } - - public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) - { - base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); - UpdateConnections( portId ); - } - - public override void OnConnectedOutputNodeChanges( int inputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) - { - base.OnConnectedOutputNodeChanges( inputPortId, otherNodeId, otherPortId, name, type ); - UpdateConnections( inputPortId ); - } - - void UpdateConnections( int inputPort ) - { - m_inputPorts[ inputPort ].MatchPortToConnection(); - if ( inputPort == 0 ) - { - m_outputPorts[ 0 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); - } - } - - public override void DrawProperties() - { - base.DrawProperties(); - m_safePower = EditorGUILayoutToggle( SafePowerLabel, m_safePower ); - } - - 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 x = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - if( m_safePower ) - { - string safePowerName = "saferPower" + OutputId; - string safePowerValue = string.Format( SafePowerStr, x ); - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, m_inputPorts[ 0 ].DataType, safePowerName, safePowerValue ); - x = safePowerName; - } - - string y = m_inputPorts[ 1 ].GenerateShaderForOutput( ref dataCollector, m_inputPorts[ 0 ].DataType, ignoreLocalvar, true ); - string result = "pow( " + x + " , " + y + " )"; - - return CreateOutputLocalVariable( 0, result, ref dataCollector ); - } - - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - if( UIUtils.CurrentShaderVersion() > 17502 ) - m_safePower = 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_safePower ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/PowerNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/PowerNode.cs.meta deleted file mode 100644 index bedc464e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/PowerNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 520a55839e863ce47b3558be612f4691 -timeCreated: 1481126955 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RSqrtOpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RSqrtOpNode.cs deleted file mode 100644 index 659c86cd..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RSqrtOpNode.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Rsqrt", "Math Operators", "Reciprocal square root of scalars and vectors" )] - public sealed class RSqrtOpNode : SingleInputOp - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_opName = "rsqrt"; - m_previewShaderGUID = "c58c17cb1f7f6e6429a2c7a6cdaef87d"; - m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, - WirePortDataType.FLOAT , - WirePortDataType.FLOAT2, - WirePortDataType.FLOAT3, - WirePortDataType.FLOAT4, - WirePortDataType.COLOR , - WirePortDataType.INT); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RSqrtOpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RSqrtOpNode.cs.meta deleted file mode 100644 index e124e47a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RSqrtOpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 513de50bd4766d0448bb471ca272608f -timeCreated: 1481126955 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RadiansOpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RadiansOpNode.cs deleted file mode 100644 index 19f478ff..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RadiansOpNode.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Radians", "Trigonometry Operators", "Converts values of scalars and vectors from degrees to radians" )] - public sealed class RadiansOpNode : SingleInputOp - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_opName = "radians"; - m_previewShaderGUID = "d27d189eaf6eeb04fae9913d9617ece5"; - m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, - WirePortDataType.FLOAT, - WirePortDataType.FLOAT2, - WirePortDataType.FLOAT3, - WirePortDataType.FLOAT4, - WirePortDataType.COLOR, - WirePortDataType.INT ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RadiansOpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RadiansOpNode.cs.meta deleted file mode 100644 index f90ec876..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RadiansOpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: b6ca01d5c16f73c42996318c140eddb7 -timeCreated: 1481126958 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ReflectOpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ReflectOpNode.cs deleted file mode 100644 index 1488cb1c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ReflectOpNode.cs +++ /dev/null @@ -1,33 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Reflect", "Vector Operators", "Reflection vector given an incidence vector and a normal vector" )] - public sealed class ReflectOpNode : DynamicTypeNode - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_inputPorts[ 0 ].ChangeProperties( "Incident", WirePortDataType.FLOAT4, false ); - m_inputPorts[ 1 ].ChangeProperties( "Normal", WirePortDataType.FLOAT4, false ); - m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT4, false ); - - m_textLabelWidth = 67; - m_previewShaderGUID = "fb520f2145c0fa0409320a9e6d720758"; - } - - public override string BuildResults( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) - return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); - - base.BuildResults( outputId, ref dataCollector, ignoreLocalvar ); - string result = "reflect( " + m_inputA + " , " + m_inputB + " )"; - return CreateOutputLocalVariable( 0, result, ref dataCollector ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ReflectOpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ReflectOpNode.cs.meta deleted file mode 100644 index 2b7f085f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ReflectOpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: bcd77715f8db1564abc96d502312d476 -timeCreated: 1481126958 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RefractOpVec.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RefractOpVec.cs deleted file mode 100644 index ba59e2ca..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RefractOpVec.cs +++ /dev/null @@ -1,92 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Refract", "Vector Operators", "Computes a refraction vector" )] - public sealed class RefractOpVec : ParentNode - { - [UnityEngine.SerializeField] - private WirePortDataType m_mainDataType = WirePortDataType.FLOAT; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT4, false , "Incident" ); - AddInputPort( WirePortDataType.FLOAT4, false , "Normal" ); - AddInputPort( WirePortDataType.FLOAT, false, "Eta" ); - AddOutputPort( WirePortDataType.FLOAT4, Constants.EmptyPortValue ); - m_textLabelWidth = 67; - m_previewShaderGUID = "5ab44ca484bed8b4884b03b1c00fdc3d"; - } - - public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) - { - base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); - UpdateConnection( portId ); - } - - 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 OnInputPortDisconnected( int portId ) - { - base.OnInputPortDisconnected( portId ); - UpdateConnection( portId ); - } - - void UpdateConnection( int portId ) - { - if( portId == 2 ) - return; - - bool hasConnection = false; - - WirePortDataType type1 = WirePortDataType.FLOAT; - if( m_inputPorts[ 0 ].IsConnected ) - { - type1 = m_inputPorts[ 0 ].GetOutputConnection( 0 ).DataType; - hasConnection = true; - } - WirePortDataType type2 = WirePortDataType.FLOAT; - if( m_inputPorts[ 1 ].IsConnected ) - { - type2 = m_inputPorts[ 1 ].GetOutputConnection( 0 ).DataType; - hasConnection = true; - } - - if( hasConnection ) - { - m_mainDataType = UIUtils.GetPriority( type1 ) > UIUtils.GetPriority( type2 ) ? type1 : type2; - } - else - { - m_mainDataType = WirePortDataType.FLOAT4; - } - - m_inputPorts[ 0 ].ChangeType( m_mainDataType, false ); - m_inputPorts[ 1 ].ChangeType( m_mainDataType, false ); - m_outputPorts[ 0 ].ChangeType( m_mainDataType, 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 incident = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - string normal = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); - string interp = m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ); - string result = "refract( " + incident + " , " + normal + " , " + interp + " )"; - - return CreateOutputLocalVariable( 0, result, ref dataCollector ); - } - - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RefractOpVec.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RefractOpVec.cs.meta deleted file mode 100644 index 58b705a4..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RefractOpVec.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: c5bb608b83cdc894cab572c72baa5f84 -timeCreated: 1481126959 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RoundOpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RoundOpNode.cs deleted file mode 100644 index 95b1dd8f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RoundOpNode.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Round", "Math Operators", "Rounded value of scalars or vectors" )] - public sealed class RoundOpNode : SingleInputOp - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_opName = "round"; - m_previewShaderGUID = "554d561417b207c4bb3cd4a0c86b6907"; - m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, - WirePortDataType.FLOAT , - WirePortDataType.FLOAT2, - WirePortDataType.FLOAT3, - WirePortDataType.FLOAT4, - WirePortDataType.COLOR , - WirePortDataType.INT); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RoundOpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RoundOpNode.cs.meta deleted file mode 100644 index 9b3740db..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/RoundOpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: f7b5f29bc7f6bb844ae4ea698404adc3 -timeCreated: 1481126960 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SaturateNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SaturateNode.cs deleted file mode 100644 index ed91f4d4..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SaturateNode.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Saturate", "Math Operators", "Saturate clamps the input values into the [0,1] range" )] - public sealed class SaturateNode : SingleInputOp - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_opName = "saturate"; - m_previewShaderGUID = "d9e53418dc8b9d34fb395e3ea3c75985"; - m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, - WirePortDataType.FLOAT , - WirePortDataType.FLOAT2, - WirePortDataType.FLOAT3, - WirePortDataType.FLOAT4, - WirePortDataType.COLOR , - WirePortDataType.INT); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SaturateNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SaturateNode.cs.meta deleted file mode 100644 index e199e9cf..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SaturateNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 9d56f68d94c889443af651140ef86948 -timeCreated: 1481126957 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ScaleAndOffsetNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ScaleAndOffsetNode.cs deleted file mode 100644 index 0d79fe81..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ScaleAndOffsetNode.cs +++ /dev/null @@ -1,78 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Scale And Offset", "Math Operators", "Scales and offsets an input value\n( ( <b>Value</b> * <b>Scale</b> ) + <b>Offset</b> )" )] - public sealed class ScaleAndOffsetNode : ParentNode - { - private const string ScaleOffsetOpStr = "({0}*{1} + {2})"; - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT, false, Constants.EmptyPortValue ); - AddInputPort( WirePortDataType.FLOAT, false, "Scale" ); - m_inputPorts[ 1 ].FloatInternalData = 1; - AddInputPort( WirePortDataType.FLOAT, false, "Offset" ); - AddOutputPort( WirePortDataType.FLOAT, " " ); - m_useInternalPortData = true; - m_previewShaderGUID = "a1f1053d4d9c3be439e0382038b74771"; - } - - public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) - { - base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); - UpdateConnection( portId ); - } - - 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 OnInputPortDisconnected( int portId ) - { - base.OnInputPortDisconnected( portId ); - m_inputPorts[ portId ].ChangeType( WirePortDataType.FLOAT, false ); - if( portId == 0 ) - { - m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT, false ); - } - } - - void UpdateConnection( int portId ) - { - if( portId == 0 ) - { - m_inputPorts[ 0 ].MatchPortToConnection(); - m_outputPorts[ 0 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); - } - else - { - WirePortDataType newDataType = m_inputPorts[ portId ].ConnectionType() == WirePortDataType.FLOAT ? WirePortDataType.FLOAT : m_outputPorts[ 0 ].DataType; - m_inputPorts[ portId ].ChangeType( newDataType, 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 value = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - - // If scale or offset ports are floats then there's no need to cast them to any other type since they can be multiplied with everything - WirePortDataType scaleType = ( m_inputPorts[ 1 ].ConnectionType() == WirePortDataType.FLOAT ) ? WirePortDataType.FLOAT : m_outputPorts[ 0 ].DataType; - string scale = m_inputPorts[ 1 ].GenerateShaderForOutput( ref dataCollector, scaleType, ignoreLocalvar , true ); - - WirePortDataType offsetType = ( m_inputPorts[ 2 ].ConnectionType() == WirePortDataType.FLOAT ) ? WirePortDataType.FLOAT : m_outputPorts[ 0 ].DataType; - string offset = m_inputPorts[ 2 ].GenerateShaderForOutput( ref dataCollector, offsetType, ignoreLocalvar, true ); - - string result = string.Format( ScaleOffsetOpStr, value, scale, offset ); - return CreateOutputLocalVariable( 0, result, ref dataCollector ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ScaleAndOffsetNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ScaleAndOffsetNode.cs.meta deleted file mode 100644 index 4a508a82..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ScaleAndOffsetNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: b594feaa69ad03449b563f834fe0c18e -timeCreated: 1484582091 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ScaleNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ScaleNode.cs deleted file mode 100644 index 7445a10d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ScaleNode.cs +++ /dev/null @@ -1,152 +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( "Scale", "Math Operators", "Scales input value by a float factor" )] - public sealed class ScaleNode : ParentNode - { - private const string ScaleFactorStr = "Scale"; - - [SerializeField] - private float m_scaleFactor = 1; - - private int m_cachedPropertyId = -1; - - private const float LabelWidth = 8; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT, false, " " ); - AddOutputPort( WirePortDataType.FLOAT, " " ); - m_insideSize.Set( 50, 10 ); - m_autoWrapProperties = true; - m_previewShaderGUID = "6d8ec9d9dab62c44aa2dcc0e3987760d"; - } - - public override void SetPreviewInputs() - { - base.SetPreviewInputs(); - - if ( m_cachedPropertyId == -1 ) - m_cachedPropertyId = Shader.PropertyToID( "_ScaleFloat" ); - - PreviewMaterial.SetFloat( m_cachedPropertyId, m_scaleFactor ); - } - - public override void DrawProperties() - { - base.DrawProperties(); - m_scaleFactor = EditorGUILayoutFloatField( ScaleFactorStr, m_scaleFactor ); - } - - public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) - { - base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); - m_inputPorts[ 0 ].MatchPortToConnection(); - m_outputPorts[ 0 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); - } - - public override void OnConnectedOutputNodeChanges( int outputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) - { - base.OnConnectedOutputNodeChanges( outputPortId, otherNodeId, otherPortId, name, type ); - m_inputPorts[ 0 ].MatchPortToConnection(); - m_outputPorts[ 0 ].ChangeType( InputPorts[ 0 ].DataType, false ); - } - - public override void OnNodeLayout( DrawInfo drawInfo ) - { - base.OnNodeLayout( drawInfo ); - - m_propertyDrawPos.x = m_remainingBox.x + Constants.FLOAT_WIDTH_SPACING * drawInfo.InvertedZoom * 0.5f; - m_propertyDrawPos.y = m_remainingBox.y + Constants.INPUT_PORT_DELTA_Y * drawInfo.InvertedZoom * 0.5f; - m_propertyDrawPos.width = drawInfo.InvertedZoom * Constants.FLOAT_DRAW_WIDTH_FIELD_SIZE; - m_propertyDrawPos.height = drawInfo.InvertedZoom * Constants.FLOAT_DRAW_HEIGHT_FIELD_SIZE; - } - - public override void DrawGUIControls( DrawInfo drawInfo ) - { - base.DrawGUIControls( drawInfo ); - - if ( drawInfo.CurrentEventType != EventType.MouseDown ) - return; - - Rect hitBox = m_remainingBox; - hitBox.xMin -= LabelWidth * drawInfo.InvertedZoom; - bool insideBox = hitBox.Contains( drawInfo.MousePosition ); - - if ( insideBox ) - { - GUI.FocusControl( null ); - m_isEditingFields = true; - } - else if ( m_isEditingFields && !insideBox ) - { - GUI.FocusControl( null ); - m_isEditingFields = false; - } - } - - private bool m_isEditingFields; - private float m_previousValue; - private string m_fieldText = "0"; - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - - if ( !m_isVisible ) - return; - - if ( m_isEditingFields ) - { - UIUtils.DrawFloat( this, ref m_propertyDrawPos, ref m_scaleFactor, LabelWidth ); - } - else if ( drawInfo.CurrentEventType == EventType.Repaint ) - { - Rect fakeField = m_propertyDrawPos; - fakeField.xMin += LabelWidth * drawInfo.InvertedZoom; - Rect fakeLabel = m_propertyDrawPos; - fakeLabel.xMax = fakeField.xMin; - EditorGUIUtility.AddCursorRect( fakeLabel, MouseCursor.SlideArrow ); - EditorGUIUtility.AddCursorRect( fakeField, MouseCursor.Text ); - - if ( m_previousValue != m_scaleFactor ) - { - m_previousValue = m_scaleFactor; - m_fieldText = m_scaleFactor.ToString(); - } - - GUI.Label( fakeField, m_fieldText, UIUtils.MainSkin.textField ); - } - } - - 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 portResult = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - string result = "( " + portResult + " * " + m_scaleFactor + " )"; - return CreateOutputLocalVariable( 0, result, ref dataCollector ); - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_scaleFactor ); - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - m_scaleFactor = Convert.ToSingle( GetCurrentParam( ref nodeParams ) ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ScaleNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ScaleNode.cs.meta deleted file mode 100644 index 49bd4b82..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/ScaleNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: ec926b11f9c698c458f746e4e55fd7df -timeCreated: 1481126960 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SignOpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SignOpNode.cs deleted file mode 100644 index 90f83dcf..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SignOpNode.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Sign", "Math Operators", "Sign of scalar or each vector component" )] - public sealed class SignOpNode : SingleInputOp - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_opName = "sign"; - m_previewShaderGUID = "3aca80b49aadf5046b7133730818e18f"; - m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, - WirePortDataType.FLOAT , - WirePortDataType.FLOAT2, - WirePortDataType.FLOAT3, - WirePortDataType.FLOAT4, - WirePortDataType.COLOR , - WirePortDataType.INT); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SignOpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SignOpNode.cs.meta deleted file mode 100644 index 1a1d0ff6..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SignOpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 429f407c2b590df45b215f0edfa49b97 -timeCreated: 1481126955 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SimplifiedFModOpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SimplifiedFModOpNode.cs deleted file mode 100644 index 4726b848..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SimplifiedFModOpNode.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Simplified Fmod", "Math Operators", "Floating point remainder of x/y" )] - public sealed class SimplifiedFModOpNode : DynamicTypeNode - { - private const string FmodCustomOp = "frac({0}/{1})*{1}"; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_previewShaderGUID = "2688236fb4f37ce47b81cc818c53321d"; - } - - public override string BuildResults( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if ( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) - { - return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); - } - - base.BuildResults( outputId, ref dataCollector, ignoreLocalvar ); - RegisterLocalVariable( 0, string.Format( FmodCustomOp, m_inputA, m_inputB ), ref dataCollector, ( "fmodResult" + OutputId ) ); - return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SimplifiedFModOpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SimplifiedFModOpNode.cs.meta deleted file mode 100644 index 77efda87..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SimplifiedFModOpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: f186e1b03a8ee2b4b9e45918576e8cf6 -timeCreated: 1484731588 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SinOpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SinOpNode.cs deleted file mode 100644 index 6d0d363b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SinOpNode.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Sin", "Trigonometry Operators", "Sine of scalars and vectors" )] - public sealed class SinOpNode : SingleInputOp - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_opName = "sin"; - m_previewShaderGUID = "bcd9f8749ddd3ac4f94f4c2071c1d0d4"; - m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, - WirePortDataType.FLOAT, - WirePortDataType.FLOAT2, - WirePortDataType.FLOAT3, - WirePortDataType.FLOAT4, - WirePortDataType.COLOR, - WirePortDataType.INT ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SinOpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SinOpNode.cs.meta deleted file mode 100644 index 24e23e66..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SinOpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: be2a11b08ee8cbb458dbcc4c1a61ad1b -timeCreated: 1481126959 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SingleInputOp.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SingleInputOp.cs deleted file mode 100644 index 4af0cba4..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SingleInputOp.cs +++ /dev/null @@ -1,67 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEngine; -using System; - - -namespace AmplifyShaderEditor -{ - [Serializable] - public class SingleInputOp : ParentNode - { - - [SerializeField] - protected string m_opName; - //[SerializeField] - //protected int m_validTypes; - - protected bool m_autoUpdateOutputPort = true; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT, false, Constants.EmptyPortValue ); - AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); - //m_validTypes = 0; - m_useInternalPortData = true; - - } - - public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) - { - base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); - m_inputPorts[ 0 ].MatchPortToConnection(); - if ( m_autoUpdateOutputPort ) - m_outputPorts[ 0 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); - } - - public override void OnConnectedOutputNodeChanges( int outputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) - { - base.OnConnectedOutputNodeChanges( outputPortId, otherNodeId, otherPortId, name, type ); - m_inputPorts[ 0 ].MatchPortToConnection(); - if ( m_autoUpdateOutputPort ) - m_outputPorts[ 0 ].ChangeType( m_inputPorts[ 0 ].DataType, 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 result = "0"; - if ( m_inputPorts[ 0 ].IsConnected ) - { - ParentNode node = m_inputPorts[ 0 ].GetOutputNode(); - int localOutputId = m_inputPorts[ 0 ].ExternalReferences[ 0 ].PortId; - result = m_opName + "( " + node.GenerateShaderForOutput( localOutputId, ref dataCollector, ignoreLocalvar ) + " )"; - } - else - { - result = m_opName + "( " + m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ) + " )"; - } - - return CreateOutputLocalVariable( 0, result, ref dataCollector ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SingleInputOp.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SingleInputOp.cs.meta deleted file mode 100644 index 751db40f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SingleInputOp.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: ed03e964ff9aa274cbf392769b61170b -timeCreated: 1481126960 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SinhOpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SinhOpNode.cs deleted file mode 100644 index f38a192a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SinhOpNode.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Sinh", "Trigonometry Operators", "Hyperbolic sine of scalars and vectors" )] - public sealed class SinhOpNode : SingleInputOp - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_opName = "sinh"; - m_previewShaderGUID = "4e9c00e6dceb4024f80d4e3d7786abad"; - m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, - WirePortDataType.FLOAT, - WirePortDataType.FLOAT2, - WirePortDataType.FLOAT3, - WirePortDataType.FLOAT4, - WirePortDataType.COLOR, - WirePortDataType.INT ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SinhOpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SinhOpNode.cs.meta deleted file mode 100644 index 292ae67c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SinhOpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 52092e3985c556943895f86c585bcd25 -timeCreated: 1481126955 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SmoothstepOpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SmoothstepOpNode.cs deleted file mode 100644 index 09d86cb0..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SmoothstepOpNode.cs +++ /dev/null @@ -1,122 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Smoothstep", "Math Operators", "Returns a smooth Hermite interpolation between 0 and 1, if input is in the range [min, max]." )] - public sealed class SmoothstepOpNode : ParentNode - { - //[UnityEngine.SerializeField] - //private WirePortDataType m_mainDataType = WirePortDataType.FLOAT; - - private int m_alphaPortId = 0; - private int m_minPortId = 0; - private int m_maxPortId = 0; - private const string SmoothstepOpFormat = "smoothstep( {0} , {1} , {2})";//min max alpha - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT, false, Constants.EmptyPortValue, -1, MasterNodePortCategory.Fragment, 0 ); - m_alphaPortId = m_inputPorts.Count - 1; - AddInputPort( WirePortDataType.FLOAT, false, "Min", -1, MasterNodePortCategory.Fragment, 1 ); - m_minPortId = m_inputPorts.Count - 1; - AddInputPort( WirePortDataType.FLOAT, false, "Max", -1, MasterNodePortCategory.Fragment, 2 ); - m_maxPortId = m_inputPorts.Count - 1; - - GetInputPortByUniqueId( m_maxPortId ).FloatInternalData = 1; - - AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); - m_useInternalPortData = true; - m_textLabelWidth = 55; - m_previewShaderGUID = "954cdd40a7a528344a0a4d3ff1db5176"; - } - - public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) - { - base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); - if( portId == 0 ) - { - m_inputPorts[ 0 ].MatchPortToConnection(); - m_inputPorts[ 1 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); - m_inputPorts[ 2 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); - - m_outputPorts[ 0 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); - } - } - - public override void OnConnectedOutputNodeChanges( int outputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) - { - base.OnConnectedOutputNodeChanges( outputPortId, otherNodeId, otherPortId, name, type ); - if( outputPortId == 0 ) - { - m_inputPorts[ 0 ].MatchPortToConnection(); - m_inputPorts[ 1 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); - m_inputPorts[ 2 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); - m_outputPorts[ 0 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); - } - } - - //public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) - //{ - // base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); - // UpdateConnection( portId ); - //} - - //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 OnInputPortDisconnected( int portId ) - //{ - // base.OnInputPortDisconnected( portId ); - // UpdateConnection( portId ); - //} - - //void UpdateConnection( int portId ) - //{ - // WirePortDataType type1 = WirePortDataType.FLOAT; - // if( m_inputPorts[ m_minPortId ].IsConnected ) - // type1 = m_inputPorts[ m_minPortId ].GetOutputConnection( 0 ).DataType; - - // WirePortDataType type2 = WirePortDataType.FLOAT; - // if( m_inputPorts[ m_maxPortId ].IsConnected ) - // type2 = m_inputPorts[ m_maxPortId ].GetOutputConnection( 0 ).DataType; - - // m_mainDataType = UIUtils.GetPriority( type1 ) > UIUtils.GetPriority( type2 ) ? type1 : type2; - - // if( !m_inputPorts[ m_minPortId ].IsConnected && !m_inputPorts[ m_maxPortId ].IsConnected && m_inputPorts[ m_alphaPortId ].IsConnected ) - // m_mainDataType = m_inputPorts[ m_alphaPortId ].GetOutputConnection( 0 ).DataType; - - // m_inputPorts[ m_minPortId ].ChangeType( m_mainDataType, false ); - - // m_inputPorts[ m_maxPortId ].ChangeType( m_mainDataType, false ); - // if( m_inputPorts[ m_alphaPortId ].IsConnected && m_inputPorts[ m_alphaPortId ].GetOutputConnection( 0 ).DataType == WirePortDataType.FLOAT ) - // m_inputPorts[ m_alphaPortId ].ChangeType( WirePortDataType.FLOAT, false ); - // else - // m_inputPorts[ m_alphaPortId ].ChangeType( m_mainDataType, false ); - - // m_outputPorts[ 0 ].ChangeType( m_mainDataType, 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 aValue = m_inputPorts[ m_minPortId ].GeneratePortInstructions( ref dataCollector ); - string bValue = m_inputPorts[ m_maxPortId ].GeneratePortInstructions( ref dataCollector ); - string interp = m_inputPorts[ m_alphaPortId ].GeneratePortInstructions( ref dataCollector ); - - string result = string.Format( SmoothstepOpFormat, aValue, bValue, interp ); - - RegisterLocalVariable( 0, result, ref dataCollector, "smoothstepResult" + OutputId ); - - return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SmoothstepOpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SmoothstepOpNode.cs.meta deleted file mode 100644 index 98387ebd..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SmoothstepOpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 0f64eb769f843a349a0d249beacc6fc3 -timeCreated: 1481126953 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SqrtOpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SqrtOpNode.cs deleted file mode 100644 index e35c1b25..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SqrtOpNode.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Sqrt", "Math Operators", "Square root of scalars and vectors" )] - public sealed class SqrtOpNode : SingleInputOp - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_opName = "sqrt"; - m_previewShaderGUID = "1791e2fbf36af084da7ecfc289e89b6e"; - m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, - WirePortDataType.FLOAT, - WirePortDataType.FLOAT2, - WirePortDataType.FLOAT3, - WirePortDataType.FLOAT4, - WirePortDataType.COLOR, - WirePortDataType.INT ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SqrtOpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SqrtOpNode.cs.meta deleted file mode 100644 index 164b7c59..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/SqrtOpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 4820b591b73a7fe4ab13261deebf76f7 -timeCreated: 1481126955 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/StepOpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/StepOpNode.cs deleted file mode 100644 index ab1a1b86..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/StepOpNode.cs +++ /dev/null @@ -1,24 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Step", "Math Operators", "Step function returning either zero or one" )] - public sealed class StepOpNode : DynamicTypeNode - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_previewShaderGUID = "2c757add7f97ecd4abd9ce6ec4659697"; - } - - public override string BuildResults( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - base.BuildResults( outputId, ref dataCollector, ignoreLocalvar ); - return "step( " + m_inputA + " , " + m_inputB + " )"; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/StepOpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/StepOpNode.cs.meta deleted file mode 100644 index 52155547..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/StepOpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: c4305e64271097249a198b2e8aed3046 -timeCreated: 1481126959 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TFHCRemapNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TFHCRemapNode.cs deleted file mode 100644 index 1b77ed5f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TFHCRemapNode.cs +++ /dev/null @@ -1,64 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> -// -// Custom Node Remap -// Donated by The Four Headed Cat - @fourheadedcat -using UnityEngine; -using System; -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Remap", "Math Operators", "Remap value from old min - max range to new min - max range", null, KeyCode.None, true, false, null, null, "The Four Headed Cat - @fourheadedcat" )] - public sealed class TFHCRemapNode : DynamicTypeNode - { - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_inputPorts[ 0 ].Name = Constants.EmptyPortValue; - m_inputPorts[ 1 ].Name = "Min Old"; - AddInputPort( WirePortDataType.FLOAT, false, "Max Old" ); - m_inputPorts[ 2 ].FloatInternalData = 1; - AddInputPort( WirePortDataType.FLOAT, false, "Min New" ); - AddInputPort( WirePortDataType.FLOAT, false, "Max New" ); - m_inputPorts[ 4 ].FloatInternalData = 1; - m_textLabelWidth = 100; - m_useInternalPortData = true; - m_previewShaderGUID = "72dd1cbea889fa047b929d5191e360c0"; - } - - public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) - { - base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); - UpdateConnections(); - } - - public override void OnConnectedOutputNodeChanges( int outputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) - { - base.OnConnectedOutputNodeChanges( outputPortId, otherNodeId, otherPortId, name, type ); - UpdateConnections(); - } - - void UpdateConnections() - { - m_inputPorts[ 0 ].MatchPortToConnection(); - m_inputPorts[ 1 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); - m_inputPorts[ 2 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); - m_inputPorts[ 3 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); - m_inputPorts[ 4 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); - m_outputPorts[ 0 ].ChangeType( m_inputPorts[ 0 ].DataType, false ); - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - string value = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - string oldMin = m_inputPorts[ 1 ].GenerateShaderForOutput( ref dataCollector, m_inputPorts[ 0 ].DataType, ignoreLocalvar, true ); - string oldMax = m_inputPorts[ 2 ].GenerateShaderForOutput( ref dataCollector, m_inputPorts[ 0 ].DataType, ignoreLocalvar, true ); - string newMin = m_inputPorts[ 3 ].GenerateShaderForOutput( ref dataCollector, m_inputPorts[ 0 ].DataType, ignoreLocalvar, true ); - string newMax = m_inputPorts[ 4 ].GenerateShaderForOutput( ref dataCollector, m_inputPorts[ 0 ].DataType, ignoreLocalvar, true ); - string strout = "(" + newMin + " + (" + value + " - " + oldMin + ") * (" + newMax + " - " + newMin + ") / (" + oldMax + " - " + oldMin + "))"; - - return CreateOutputLocalVariable( 0, strout, ref dataCollector ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TFHCRemapNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TFHCRemapNode.cs.meta deleted file mode 100644 index e255ee66..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TFHCRemapNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 637508d44a97b5449a3d7223c461e58c -timeCreated: 1481126956 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TanOpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TanOpNode.cs deleted file mode 100644 index 409937ea..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TanOpNode.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Tan", "Trigonometry Operators", "Tangent of scalars and vectors" )] - public sealed class TanOpNode : SingleInputOp - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_opName = "tan"; - m_previewShaderGUID = "312e291832cac5749a3626547dfc8607"; - m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, - WirePortDataType.FLOAT, - WirePortDataType.FLOAT2, - WirePortDataType.FLOAT3, - WirePortDataType.FLOAT4, - WirePortDataType.COLOR, - WirePortDataType.INT ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TanOpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TanOpNode.cs.meta deleted file mode 100644 index e78333f8..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TanOpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 535b4367719ca2146bb7ddac217dad94 -timeCreated: 1481126955 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TanhOpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TanhOpNode.cs deleted file mode 100644 index e9f88faf..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TanhOpNode.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Tanh", "Trigonometry Operators", "Hyperbolic tangent of scalars and vectors" )] - public sealed class TanhOpNode : SingleInputOp - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_opName = "tanh"; - m_previewShaderGUID = "52f78d3a1c66d1c489cd63b0a9300b38"; - m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, - WirePortDataType.FLOAT, - WirePortDataType.FLOAT2, - WirePortDataType.FLOAT3, - WirePortDataType.FLOAT4, - WirePortDataType.COLOR, - WirePortDataType.INT ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TanhOpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TanhOpNode.cs.meta deleted file mode 100644 index e2a2ef7f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TanhOpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 792e48b83a6387a4d826d6445417372f -timeCreated: 1481126957 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TransformVectorOpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TransformVectorOpNode.cs deleted file mode 100644 index c4c7e325..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TransformVectorOpNode.cs +++ /dev/null @@ -1,160 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using UnityEngine; - -namespace AmplifyShaderEditor -{ - public enum CoordinateSpaces - { - Tangent, - Local, - World, - View, - Clip, - Screen - } - - [Serializable] - [NodeAttributes( "Transform Vector", "Math Operators", "Transforma a vector into another", null, KeyCode.None, false )] - public sealed class TransformVectorOpNode : ParentNode - { - [SerializeField] - private CoordinateSpaces m_source = CoordinateSpaces.Tangent; - [SerializeField] - private CoordinateSpaces m_destination = CoordinateSpaces.World; - - private const string InputTangentrStr = "float4 tangent: TANGENT"; - private const string ColorValueStr = ".tangent"; - - private const string InputNormalStr = "float3 normal : NORMAL"; - private const string NormalValueStr = ".normal"; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT4, false, Constants.EmptyPortValue ); - AddOutputPort( WirePortDataType.FLOAT4, Constants.EmptyPortValue ); - m_useInternalPortData = true; - } - - void AddTangentInfo( ref MasterNodeDataCollector dataCollector ) - { - dataCollector.AddToInput( UniqueId, InputTangentrStr, true ); - dataCollector.AddToInput( UniqueId, InputTangentrStr, true ); - dataCollector.AddToInput( UniqueId, InputNormalStr, true ); - dataCollector.AddToLocalVariables( UniqueId, "float3 binormal = cross( normalize( v.normal ), normalize( v.tangent.xyz ) ) * v.tangent.w;" ); - dataCollector.AddToLocalVariables( UniqueId, "float3x3 rotation = float3x3( v.tangent.xyz, binormal, v.normal );" ); - - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - - //if ( !InputPorts[ 0 ].IsConnected ) - //{ - // return UIUtils.NoConnection( this ); - //} - - string value = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - - dataCollector.AddToIncludes( UniqueId, Constants.UnityShaderVariables ); - - - - switch ( m_source ) - { - case CoordinateSpaces.Tangent: - { - AddTangentInfo( ref dataCollector ); - switch ( m_destination ) - { - case CoordinateSpaces.Tangent: - { - return value; - } - //case eCoordinateSpaces.Local: - //{ - //} - //case eCoordinateSpaces.World: - //{ - //} - //case eCoordinateSpaces.View: - //{ - //} - } - } - break; - case CoordinateSpaces.Local: - { - switch ( m_destination ) - { - case CoordinateSpaces.Tangent: - { - AddTangentInfo( ref dataCollector ); - return "float4(mul( rotation , " + value + ".xyz ),1)"; - } - case CoordinateSpaces.Local: - { - return value; - } - case CoordinateSpaces.World: - { - return "mul( _Object2World , " + value + " )"; - } - case CoordinateSpaces.View: - { - return "mul( UNITY_MATRIX_MV , " + value + " )"; - } - } - } - break; - case CoordinateSpaces.World: - { - switch ( m_destination ) - { - //case eCoordinateSpaces.Tangent: - //{ - //} - case CoordinateSpaces.Local: - { - return "mul( _World2Object , " + value + " )"; - } - case CoordinateSpaces.World: - { - return value; - } - case CoordinateSpaces.View: - { - return "mul( UNITY_MATRIX_V , " + value + " )"; - } - } - } - break; - case CoordinateSpaces.View: - { - UIUtils.ShowMessage( UniqueId, "View as Source is not supported", MessageSeverity.Warning ); - return value; - } - } - - return UIUtils.UnknownError( this ); - } - - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - m_source = ( CoordinateSpaces ) Enum.Parse( typeof( CoordinateSpaces ), GetCurrentParam( ref nodeParams ) ); - m_destination = ( CoordinateSpaces ) Enum.Parse( typeof( CoordinateSpaces ), GetCurrentParam( ref nodeParams ) ); - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_source ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_destination ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TransformVectorOpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TransformVectorOpNode.cs.meta deleted file mode 100644 index 3169b4e9..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TransformVectorOpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 928c21155a9c1a74b953da2d24269035 -timeCreated: 1481126957 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TransposeOpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TransposeOpNode.cs deleted file mode 100644 index 6e83e512..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TransposeOpNode.cs +++ /dev/null @@ -1,23 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Transpose", "Matrix Operators", "Transpose matrix of a matrix" )] - public sealed class TransposeOpNode : SingleInputOp - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_opName = "transpose"; - m_drawPreview = false; - m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.FLOAT3x3, - WirePortDataType.FLOAT4x4 ); - m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT4x4, false ); - m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT4x4, false ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TransposeOpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TransposeOpNode.cs.meta deleted file mode 100644 index 1df556ee..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TransposeOpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: ba1613dad4af0da4b9f4619b90916cbf -timeCreated: 1481126958 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TruncOpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TruncOpNode.cs deleted file mode 100644 index f190b0c8..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TruncOpNode.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Trunc", "Math Operators", "Largest integer not greater than a scalar or each vector component" )] - public sealed class TruncOpNode : SingleInputOp - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_opName = "trunc"; - m_previewShaderGUID = "c717aaa68f4ac9e469b15763e82933e1"; - m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.OBJECT, - WirePortDataType.FLOAT, - WirePortDataType.FLOAT2, - WirePortDataType.FLOAT3, - WirePortDataType.FLOAT4, - WirePortDataType.COLOR, - WirePortDataType.INT ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TruncOpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TruncOpNode.cs.meta deleted file mode 100644 index 9b873107..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/TruncOpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 5f78e9a796a94d54482caa15d4971feb -timeCreated: 1481126956 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/VariablePortTypeOpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/VariablePortTypeOpNode.cs deleted file mode 100644 index f5610899..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/VariablePortTypeOpNode.cs +++ /dev/null @@ -1,76 +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 -{ - public class VariablePortTypeOpNode : ParentNode - { - private const string InputTypeStr = "Input type"; - - [SerializeField] - protected WirePortDataType m_selectedType = WirePortDataType.FLOAT; - - [SerializeField] - protected WirePortDataType m_lastSelectedType = WirePortDataType.FLOAT; - - [SerializeField] - protected int _inputAmount = 1; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddPorts(); - } - - void AddPorts() - { - for ( int i = 0; i < _inputAmount; i++ ) - { - AddInputPort( m_selectedType, true, i.ToString() ); - } - AddOutputPort( m_selectedType, Constants.EmptyPortValue ); - m_sizeIsDirty = true; - } - - public override void DrawProperties() - { - base.DrawProperties(); - EditorGUILayout.BeginVertical(); - { - EditorGUILayout.LabelField( InputTypeStr ); - m_selectedType = ( WirePortDataType ) EditorGUILayoutEnumPopup( m_selectedType ); - } - EditorGUILayout.EndVertical(); - if ( m_selectedType != m_lastSelectedType ) - { - m_lastSelectedType = m_selectedType; - - DeleteAllInputConnections( true ); - DeleteAllOutputConnections( true ); - - AddPorts(); - - } - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_selectedType ); - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - m_selectedType = ( WirePortDataType ) Enum.Parse( typeof( WirePortDataType ), GetCurrentParam( ref nodeParams ) ); - m_lastSelectedType = m_selectedType; - DeleteAllInputConnections( true ); - DeleteAllOutputConnections( true ); - AddPorts(); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/VariablePortTypeOpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/VariablePortTypeOpNode.cs.meta deleted file mode 100644 index f0328b05..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Operators/VariablePortTypeOpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 97be7adea7b8ae44c9bebb753277e0c2 -timeCreated: 1481126957 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ParentNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ParentNode.cs deleted file mode 100644 index 179413d5..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ParentNode.cs +++ /dev/null @@ -1,3778 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using System.Collections.Generic; -using UnityEditor; -using UnityEngine; - -namespace AmplifyShaderEditor -{ - public enum PreviewLocation - { - Auto, - TopCenter, - BottomCenter, - Left, - Right - } - - public enum NodeMessageType - { - Error, - Warning, - Info - } - - [Serializable] - public class ParentNode : UndoParentNode, ISerializationCallbackReceiver - { - public const int PreviewWidth = 128; - public const int PreviewHeight = 128; - - protected readonly string[] PrecisionLabels = { "Float", "Half" }; - protected readonly string[] PrecisionLabelsExtra = { "Float", "Half", "Inherit" }; - - private const double NodeClickTime = 0.2; - protected GUIContent PrecisionContent = new GUIContent( "Precision", "Changes the precision of internal calculations, using lower types saves some performance\nDefault: Float" ); - private const int MoveCountBuffer = 3;// When testing for stopped movement we need to take Layout and Repaint into account for them not to interfere with tests - private const float MinInsideBoxWidth = 20; - private const float MinInsideBoxHeight = 10; - - private const string WikiLinkStr = "online reference"; - - public delegate void OnNodeEvent( ParentNode node, bool testOnlySelected, InteractionMode interactionMode ); - public delegate void OnNodeGenericEvent( ParentNode node ); - public delegate void OnNodeReOrder( ParentNode node, int index ); - public delegate void DrawPropertySection(); - public delegate void OnSRPAction( int outputId, ref MasterNodeDataCollector dataCollector ); - - [SerializeField] - protected PrecisionType m_currentPrecisionType = PrecisionType.Inherit; - - [SerializeField] - protected bool m_customPrecision = false; - - [SerializeField] - protected InteractionMode m_defaultInteractionMode = InteractionMode.Other; - - public event OnNodeEvent OnNodeStoppedMovingEvent; - public OnNodeGenericEvent OnNodeChangeSizeEvent; - public OnNodeGenericEvent OnNodeDestroyedEvent; - public event OnNodeReOrder OnNodeReOrderEvent; - public OnSRPAction OnLightweightAction; - public OnSRPAction OnHDAction; - - [SerializeField] - private int m_uniqueId; - - [SerializeField] - protected Rect m_position; - - [SerializeField] - protected Rect m_unpreviewedPosition; - - [SerializeField] - protected GUIContent m_content; - - [SerializeField] - protected GUIContent m_additionalContent; - - [SerializeField] - protected bool m_initialized; - - [SerializeField] - protected NodeConnectionStatus m_connStatus; - protected bool m_selfPowered = false; - - [SerializeField] - protected int m_activeConnections; - - [SerializeField] - protected System.Type m_activeType; - - [SerializeField] - protected int m_activePort; - - [SerializeField] - protected int m_activeNode; - - protected NodeRestrictions m_restrictions; - - [SerializeField] - protected Color m_statusColor; - - [SerializeField] - protected Rect m_propertyDrawPos; - - // Ports - [SerializeField] - protected List<InputPort> m_inputPorts = new List<InputPort>(); - - protected Dictionary<int, InputPort> m_inputPortsDict = new Dictionary<int, InputPort>(); - - [SerializeField] - protected List<OutputPort> m_outputPorts = new List<OutputPort>(); - - protected Dictionary<int, OutputPort> m_outputPortsDict = new Dictionary<int, OutputPort>(); - - [SerializeField] - protected Rect m_globalPosition; - - [SerializeField] - protected Rect m_headerPosition; - - //private Vector2 m_tooltipOffset; - - [SerializeField] - protected bool m_sizeIsDirty = false; - - [SerializeField] - protected Vector2 m_extraSize; - - [SerializeField] - protected Vector2 m_insideSize; - - [SerializeField] - protected float m_fontHeight; - - // Editor State save on Play Button - [SerializeField] - protected bool m_isDirty; - - [SerializeField] - private int m_isMoving = 0; - [SerializeField] - private Rect m_lastPosition; - - // Live Shader Gen - [SerializeField] - private bool m_saveIsDirty; - - [SerializeField] - protected bool m_requireMaterialUpdate = false; - - [SerializeField] - protected int m_commentaryParent = -1; - - [SerializeField] - protected int m_depth = -1; - - [SerializeField] - protected bool m_materialMode = false; - - [SerializeField] - protected bool m_showPreview = false; - - [SerializeField] - protected int m_previewMaterialPassId = -1; - - protected bool m_useSquareNodeTitle = false; - - [SerializeField] - protected bool m_continuousPreviewRefresh = false; - private bool m_previewIsDirty = true; - - // Error Box Messages - private Rect m_errorBox; - private bool m_previousErrorMessage = false; - protected bool m_showErrorMessage = false; - protected NodeMessageType m_errorMessageTypeIsError = NodeMessageType.Error; - protected string m_errorMessageTooltip = string.Empty; - - private GUIContent m_errorIcon = new GUIContent(); - private GUIContent m_errorMessage = new GUIContent(); - private GUIStyle m_errorCurrentStyle; - - private const string ErrorTitle = "ERROR"; - private const string WarningTitle = "WARNING"; - private const string InfoTitle = "INFO"; - - // Drawing Node - protected PreviewLocation m_selectedLocation = PreviewLocation.Auto; - private int m_extraHeaderHeight = 0; - protected bool m_isVisible; - protected bool m_selected = false; - protected bool m_rmbIgnore; - protected GUIContent m_sizeContentAux; - - protected uint m_currentReadParamIdx = 1; - protected bool m_reorderLocked = false; - - protected Rect m_cachedPos; - protected Vector2 m_accumDelta = Vector2.zero; - - private bool m_isOnGrid = false; - protected bool m_useInternalPortData = false; - protected bool m_autoDrawInternalPortData = true; - protected DrawOrder m_drawOrder = DrawOrder.Default; - - protected bool m_movingInFrame = false; - protected float m_anchorAdjust = -1; - - protected Color m_headerColor; - - [SerializeField] // needs to be serialized because of Undo - protected Color m_headerColorModifier = Color.white; - - protected bool m_infiniteLoopDetected = false; - protected int m_textLabelWidth = -1; - - private bool m_linkVisibility = false; - [SerializeField] - protected bool m_hasTooltipLink = true; - - protected int m_category = 0; - - protected double m_lastTimeSelected; - private double m_tooltipTimestamp; - protected string m_tooltipText; - - protected Rect m_unscaledRemainingBox; - protected Rect m_remainingBox; - - private int m_visibleInputs = 0; - private int m_visibleOutputs = 0; - - private double m_doubleClickTimestamp; - private const double DoubleClickTime = 0.25; - - protected bool m_canExpand = true; - - protected bool m_firstDraw = true; - - protected int m_matrixId = -1; - - private float m_paddingTitleLeft = 0; - private float m_paddingTitleRight = 0; - - // Preview Fields - private Material m_previewMaterial = null; - private Shader m_previewShader = null; - protected string m_previewShaderGUID = string.Empty; - protected float m_marginPreviewLeft = 0; - protected bool m_globalShowPreview = false; - protected Rect m_unscaledPreviewRect; - protected Rect m_previewRect; - protected bool m_drawPreviewMaskButtons = true; - private int m_channelNumber = 0; - protected bool m_firstPreviewDraw = true; - [SerializeField] - protected bool m_drawPreview = true; - protected bool m_drawPreviewExpander = true; - private bool m_spherePreview = false; - protected bool m_drawPreviewAsSphere = false; - protected bool m_forceDrawPreviewAsPlane = false; - private bool m_finishPreviewRender = false; - - private int m_cachedMainTexId = -1; - private int m_cachedMaskTexId = -1; - private int m_cachedPortsId = -1; - private int m_cachedPortId = -1; - - private int m_cachedDrawSphereId = -1; - private int m_cachedInvertedZoomId = -1; - //private int m_cachedIsLinearId = -1; - - private bool[] m_previewChannels = { true, true, true, false }; - - // Others - protected bool m_hasSubtitle = false; - protected bool m_showSubtitle = true; - protected bool m_hasLeftDropdown = false; - protected bool m_autoWrapProperties = false; - protected bool m_internalDataFoldout = true; - protected bool m_propertiesFoldout = true; - protected bool m_repopulateDictionaries = true; - - protected Vector2 m_lastInputBottomRight = Vector2.zero; - protected Vector2 m_lastOutputBottomLeft = Vector2.zero; - - private Vector4 m_portMask = Vector4.zero; - - private Vector2 m_auxVector2 = Vector4.zero; - protected Rect m_auxRect; - - protected PreviewLocation m_autoLocation; - protected Rect m_titlePos; - protected Rect m_addTitlePos; - protected Rect m_expandRect; - protected Rect m_dropdownRect; - protected Rect m_currInputPortPos; - protected Rect m_currOutputPortPos; - protected Color m_colorBuffer; - - [SerializeField] - protected bool m_docking = false; - - [SerializeField] - protected int m_visiblePorts = 0; - - protected int m_graphDepth = 0; - - protected int m_oldInputCount = -1; - - protected bool m_dropdownEditing = false; - - protected bool m_isNodeBeingCopied = false; - - protected string m_previousTitle = string.Empty; - - protected string m_previousAdditonalTitle = string.Empty; - - private bool m_alive = true; - - private double m_timedUpdateInitialValue; - private double m_timedUpdateInterval; - private bool m_fireTimedUpdateRequest = false; - - public ParentNode() - { - m_position = new Rect( 0, 0, 0, 0 ); - m_content = new GUIContent( GUIContent.none ); - m_additionalContent = new GUIContent( GUIContent.none ); - CommonInit( -1 ); - } - - public ParentNode( int uniqueId, float x, float y, float width, float height ) - { - m_position = new Rect( x, y, width, height ); - m_content = new GUIContent( GUIContent.none ); - m_additionalContent = new GUIContent( GUIContent.none ); - CommonInit( uniqueId ); - } - - public virtual void OnEnable() - { - hideFlags = HideFlags.HideAndDontSave; - if( m_nodeAttribs != null ) - { - if( UIUtils.HasColorCategory( m_nodeAttribs.Category ) ) - { - m_headerColor = UIUtils.GetColorFromCategory( m_nodeAttribs.Category ); - } - else - { - if( !string.IsNullOrEmpty( m_nodeAttribs.CustomCategoryColor ) ) - { - m_headerColor = UIUtils.AddColorCategory( m_nodeAttribs.Category, m_nodeAttribs.CustomCategoryColor ); - } - } - } - - m_tooltipTimestamp = Time.realtimeSinceStartup; - hideFlags = HideFlags.DontSave; - } - - protected virtual void CommonInit( int uniqueId ) - { - m_uniqueId = uniqueId; - - m_isOnGrid = false; - ConnStatus = NodeConnectionStatus.Not_Connected; - m_inputPorts = new List<InputPort>(); - m_inputPortsDict = new Dictionary<int, InputPort>(); - - m_outputPorts = new List<OutputPort>(); - m_outputPortsDict = new Dictionary<int, OutputPort>(); - - System.Reflection.MemberInfo info = this.GetType(); - m_nodeAttribs = info.GetCustomAttributes( true )[ 0 ] as NodeAttributes; - if( m_nodeAttribs != null ) - { - m_content.text = m_nodeAttribs.Name; - //m_content.tooltip = m_nodeAttribs.Description; - m_tooltipText = m_nodeAttribs.Description; - m_selected = false; - } - - m_sizeContentAux = new GUIContent(); - m_extraSize = new Vector2( 0, 0 ); - m_insideSize = new Vector2( 0, 0 ); - m_sizeIsDirty = true; - m_initialized = true; - m_restrictions = new NodeRestrictions(); - - m_propertyDrawPos = new Rect(); - } - - public virtual void AfterCommonInit() - { - if( PreviewShader && !HasPreviewShader ) - { - m_drawPreview = false; - m_drawPreviewExpander = false; - m_canExpand = false; - } - - if( m_drawPreviewExpander || m_hasLeftDropdown ) - { - m_paddingTitleRight += Constants.PreviewExpanderWidth + Constants.IconsLeftRightMargin; - m_paddingTitleLeft = Constants.PreviewExpanderWidth + Constants.IconsLeftRightMargin; - } - } - - public virtual void Destroy() - { - m_alive = false; - if( OnNodeDestroyedEvent != null ) - { - OnNodeDestroyedEvent( this ); - OnNodeDestroyedEvent = null; - } - - OnLightweightAction = null; - OnHDAction = null; - - OnNodeStoppedMovingEvent = null; - OnNodeChangeSizeEvent = null; - OnNodeReOrderEvent = null; - if( m_restrictions != null ) - m_restrictions.Destroy(); - m_restrictions = null; - - if( m_inputPorts != null ) - { - int inputCount = m_inputPorts.Count; - for( int i = 0; i < inputCount; i++ ) - { - m_inputPorts[ i ].Destroy(); - } - m_inputPorts.Clear(); - m_inputPorts = null; - } - - if( m_outputPorts != null ) - { - int outputCount = m_outputPorts.Count; - for( int i = 0; i < outputCount; i++ ) - { - m_outputPorts[ i ].Destroy(); - } - m_outputPorts.Clear(); - m_outputPorts = null; - } - - if( m_inputPortsDict != null ) - m_inputPortsDict.Clear(); - - m_inputPortsDict = null; - - if( m_outputPortsDict != null ) - m_outputPortsDict.Clear(); - - m_outputPortsDict = null; - - if( m_previewMaterial != null ) - DestroyImmediate( m_previewMaterial ); - m_previewMaterial = null; - - m_previewShader = null; - //m_containerGraph = null; - } - - public virtual void Move( Vector2 delta ) - { - if( m_docking ) - return; - - Move( delta, false ); - } - - public virtual void Move( Vector2 delta, bool snap ) - { - if( m_docking ) - return; - - if( m_isMoving == 0 ) - { - m_cachedPos = m_position; - m_accumDelta = Vector2.zero; - } - - m_isMoving = MoveCountBuffer; - m_accumDelta += delta; - - if( snap ) - { - m_position.x = Mathf.Round( ( m_cachedPos.x + m_accumDelta.x ) / 16 ) * 16; - m_position.y = Mathf.Round( ( m_cachedPos.y + m_accumDelta.y ) / 16 ) * 16; - } - else - { - m_position.x += delta.x; - m_position.y += delta.y; - } - //if(Event.current.type == EventType.Layout) - m_movingInFrame = true; - } - - public virtual void UpdateMaterial( Material mat ) - { - m_requireMaterialUpdate = false; - } - - public virtual void SetMaterialMode( Material mat, bool fetchMaterialValues ) - { - m_materialMode = ( mat != null ); - } - - public virtual bool UpdateShaderDefaults( ref Shader shader, ref TextureDefaultsDataColector defaultCol ) { return false; } - public virtual void ForceUpdateFromMaterial( Material material ) { } - public void SetSaveIsDirty() - { - if( m_connStatus == NodeConnectionStatus.Connected ) - { - SaveIsDirty = true; - } - } - - public void ActivateNodeReordering( int index ) - { - if( OnNodeReOrderEvent != null ) - OnNodeReOrderEvent( this, index ); - } - - void RecalculateInputPortIdx() - { - m_inputPortsDict.Clear(); - int count = m_inputPorts.Count; - for( int i = 0; i < count; i++ ) - { - if( m_inputPorts[ i ].IsConnected ) - { - int nodeId = m_inputPorts[ i ].ExternalReferences[ 0 ].NodeId; - int portId = m_inputPorts[ i ].ExternalReferences[ 0 ].PortId; - ParentNode node = UIUtils.GetNode( nodeId ); - if( node != null ) - { - OutputPort outputPort = node.GetOutputPortByUniqueId( portId ); - int outputCount = outputPort.ExternalReferences.Count; - for( int j = 0; j < outputCount; j++ ) - { - if( outputPort.ExternalReferences[ j ].NodeId == m_uniqueId && - outputPort.ExternalReferences[ j ].PortId == m_inputPorts[ i ].PortId ) - { - outputPort.ExternalReferences[ j ].PortId = i; - } - } - } - } - m_inputPorts[ i ].PortId = i; - m_inputPortsDict.Add( i, m_inputPorts[ i ] ); - } - } - - public void SwapInputPorts( int fromIdx, int toIdx ) - { - InputPort port = m_inputPorts[ fromIdx ]; - //if( toIdx > fromIdx ) - // toIdx--; - m_inputPorts.Remove( port ); - m_inputPorts.Insert( toIdx, port ); - RecalculateInputPortIdx(); - SetSaveIsDirty(); - } - - public void RemoveInputPort( int idx ) - { - if( idx < m_inputPorts.Count ) - { - m_inputPortsDict.Remove( m_inputPorts[ idx ].PortId ); - m_inputPorts.RemoveAt( idx ); - SetSaveIsDirty(); - m_sizeIsDirty = true; - } - } - - public void RemoveOutputPort( string name ) - { - int count = m_outputPorts.Count; - for( int i = 0; i < count; i++ ) - { - if( m_outputPorts[ i ].Name.Equals( name ) ) - { - if( m_outputPorts[ i ].IsConnected ) - { - m_containerGraph.DeleteConnection( false, m_uniqueId, m_outputPorts[ i ].PortId, false, true ); - m_outputPortsDict.Remove( m_outputPorts[ i ].PortId ); - m_outputPorts.RemoveAt( i ); - SetSaveIsDirty(); - m_sizeIsDirty = true; - } - } - } - } - - public void RemoveOutputPort( int idx, bool isArrayIndex = true ) - { - if( isArrayIndex ) - { - // idx represents a position on the output port array - if( idx < m_outputPorts.Count ) - { - if( m_outputPorts[ idx ].IsConnected ) - { - m_containerGraph.DeleteConnection( false, m_uniqueId, m_outputPorts[ idx ].PortId, false, true ); - } - - m_outputPortsDict.Remove( m_outputPorts[ idx ].PortId ); - m_outputPorts.RemoveAt( idx ); - SetSaveIsDirty(); - m_sizeIsDirty = true; - } - } - else - { - // idx represents a port unique id - int count = m_outputPorts.Count; - int arrIdx = -1; - for( int i = 0; i < count; i++ ) - { - if( m_outputPorts[ i ].PortId == idx ) - { - arrIdx = i; - break; - } - } - - if( arrIdx >= 0 ) - { - if( m_outputPorts[ arrIdx ].IsConnected ) - { - m_containerGraph.DeleteConnection( false, m_uniqueId, idx, false, true ); - } - - m_outputPortsDict.Remove( idx ); - m_outputPorts.RemoveAt( arrIdx ); - SetSaveIsDirty(); - m_sizeIsDirty = true; - } - } - } - - // Manually add Ports - public InputPort AddInputPort( WirePortDataType type, bool typeLocked, string name, int orderId = -1, MasterNodePortCategory category = MasterNodePortCategory.Fragment, int uniquePortId = -1 ) - { - InputPort port = new InputPort( m_uniqueId, ( uniquePortId < 0 ? m_inputPorts.Count : uniquePortId ), type, name, typeLocked, ( orderId >= 0 ? orderId : m_inputPorts.Count ), category ); - m_inputPorts.Add( port ); - m_inputPortsDict.Add( port.PortId, port ); - SetSaveIsDirty(); - m_sizeIsDirty = true; - return port; - } - - public InputPort AddInputPort( WirePortDataType type, bool typeLocked, string name, string dataName, int orderId = -1, MasterNodePortCategory category = MasterNodePortCategory.Fragment, int uniquePortId = -1 ) - { - InputPort port = new InputPort( m_uniqueId, ( uniquePortId < 0 ? m_inputPorts.Count : uniquePortId ), type, name, dataName, typeLocked, ( orderId >= 0 ? orderId : m_inputPorts.Count ), category ); - m_inputPorts.Add( port ); - m_inputPortsDict.Add( port.PortId, port ); - SetSaveIsDirty(); - m_sizeIsDirty = true; - return port; - } - - public InputPort AddInputPortAt( int idx, WirePortDataType type, bool typeLocked, string name, int orderId = -1, MasterNodePortCategory category = MasterNodePortCategory.Fragment, int uniquePortId = -1 ) - { - InputPort port = new InputPort( m_uniqueId, ( uniquePortId < 0 ? m_inputPorts.Count : uniquePortId ), type, name, typeLocked, ( orderId >= 0 ? orderId : m_inputPorts.Count ), category ); - m_inputPorts.Insert( idx, port ); - m_inputPortsDict.Add( port.PortId, port ); - SetSaveIsDirty(); - m_sizeIsDirty = true; - RecalculateInputPortIdx(); - return port; - } - - public void AddOutputPort( WirePortDataType type, string name, int uniquePortId = -1 ) - { - m_outputPorts.Add( new OutputPort( this, m_uniqueId, ( uniquePortId < 0 ? m_outputPorts.Count : uniquePortId ), type, name ) ); - m_outputPortsDict.Add( m_outputPorts[ m_outputPorts.Count - 1 ].PortId, m_outputPorts[ m_outputPorts.Count - 1 ] ); - SetSaveIsDirty(); - m_sizeIsDirty = true; - } - - public void AddOutputPortAt( int idx, WirePortDataType type, string name, int uniquePortId = -1 ) - { - OutputPort port = new OutputPort( this, m_uniqueId, ( uniquePortId < 0 ? m_outputPorts.Count : uniquePortId ), type, name ); - m_outputPorts.Insert( idx, port ); - m_outputPortsDict.Add( port.PortId, port ); - SetSaveIsDirty(); - m_sizeIsDirty = true; - } - - public void AddOutputVectorPorts( WirePortDataType type, string name ) - { - m_sizeIsDirty = true; - m_outputPorts.Add( new OutputPort( this, m_uniqueId, m_outputPorts.Count, type, name ) ); - m_outputPortsDict.Add( m_outputPorts[ m_outputPorts.Count - 1 ].PortId, m_outputPorts[ m_outputPorts.Count - 1 ] ); - - switch( type ) - { - case WirePortDataType.FLOAT2: - { - m_outputPorts.Add( new OutputPort( this, m_uniqueId, m_outputPorts.Count, WirePortDataType.FLOAT, "X" ) ); - m_outputPortsDict.Add( m_outputPorts[ m_outputPorts.Count - 1 ].PortId, m_outputPorts[ m_outputPorts.Count - 1 ] ); - m_outputPorts.Add( new OutputPort( this, m_uniqueId, m_outputPorts.Count, WirePortDataType.FLOAT, "Y" ) ); - m_outputPortsDict.Add( m_outputPorts[ m_outputPorts.Count - 1 ].PortId, m_outputPorts[ m_outputPorts.Count - 1 ] ); - } - break; - case WirePortDataType.FLOAT3: - { - m_outputPorts.Add( new OutputPort( this, m_uniqueId, m_outputPorts.Count, WirePortDataType.FLOAT, "X" ) ); - m_outputPortsDict.Add( m_outputPorts[ m_outputPorts.Count - 1 ].PortId, m_outputPorts[ m_outputPorts.Count - 1 ] ); - m_outputPorts.Add( new OutputPort( this, m_uniqueId, m_outputPorts.Count, WirePortDataType.FLOAT, "Y" ) ); - m_outputPortsDict.Add( m_outputPorts[ m_outputPorts.Count - 1 ].PortId, m_outputPorts[ m_outputPorts.Count - 1 ] ); - m_outputPorts.Add( new OutputPort( this, m_uniqueId, m_outputPorts.Count, WirePortDataType.FLOAT, "Z" ) ); - m_outputPortsDict.Add( m_outputPorts[ m_outputPorts.Count - 1 ].PortId, m_outputPorts[ m_outputPorts.Count - 1 ] ); - } - break; - case WirePortDataType.FLOAT4: - { - m_outputPorts.Add( new OutputPort( this, m_uniqueId, m_outputPorts.Count, WirePortDataType.FLOAT, "X" ) ); - m_outputPortsDict.Add( m_outputPorts[ m_outputPorts.Count - 1 ].PortId, m_outputPorts[ m_outputPorts.Count - 1 ] ); - m_outputPorts.Add( new OutputPort( this, m_uniqueId, m_outputPorts.Count, WirePortDataType.FLOAT, "Y" ) ); - m_outputPortsDict.Add( m_outputPorts[ m_outputPorts.Count - 1 ].PortId, m_outputPorts[ m_outputPorts.Count - 1 ] ); - m_outputPorts.Add( new OutputPort( this, m_uniqueId, m_outputPorts.Count, WirePortDataType.FLOAT, "Z" ) ); - m_outputPortsDict.Add( m_outputPorts[ m_outputPorts.Count - 1 ].PortId, m_outputPorts[ m_outputPorts.Count - 1 ] ); - m_outputPorts.Add( new OutputPort( this, m_uniqueId, m_outputPorts.Count, WirePortDataType.FLOAT, "W" ) ); - m_outputPortsDict.Add( m_outputPorts[ m_outputPorts.Count - 1 ].PortId, m_outputPorts[ m_outputPorts.Count - 1 ] ); - } - break; - } - SetSaveIsDirty(); - } - - public void SetPreviewDirtyFromOutputs() - { - PreviewIsDirty = true; - } - - public string GetOutputVectorItem( int vectorPortId, int currentPortId, string result ) - { - if( m_outputPorts[ 0 ].DataType == WirePortDataType.COLOR ) - { - switch( currentPortId - vectorPortId ) - { - case 1: result += ".r"; break; - case 2: result += ".g"; break; - case 3: result += ".b"; break; - case 4: result += ".a"; break; - } - } - else - { - switch( currentPortId - vectorPortId ) - { - case 1: result += ".x"; break; - case 2: result += ".y"; break; - case 3: result += ".z"; break; - case 4: result += ".w"; break; - } - } - return result; - } - - public void AddOutputColorPorts( string name, bool addAlpha = true ) - { - m_sizeIsDirty = true; - //Main port - m_outputPorts.Add( new OutputPort( this, m_uniqueId, m_outputPorts.Count, addAlpha ? WirePortDataType.COLOR : WirePortDataType.FLOAT3, name ) ); - m_outputPortsDict.Add( m_outputPorts[ m_outputPorts.Count - 1 ].PortId, m_outputPorts[ m_outputPorts.Count - 1 ] ); - - //Color components port - m_outputPorts.Add( new OutputPort( this, m_uniqueId, m_outputPorts.Count, WirePortDataType.FLOAT, "R" ) ); - m_outputPortsDict.Add( m_outputPorts[ m_outputPorts.Count - 1 ].PortId, m_outputPorts[ m_outputPorts.Count - 1 ] ); - m_outputPorts[ m_outputPorts.Count - 1 ].CustomColor = Color.red; - - m_outputPorts.Add( new OutputPort( this, m_uniqueId, m_outputPorts.Count, WirePortDataType.FLOAT, "G" ) ); - m_outputPortsDict.Add( m_outputPorts[ m_outputPorts.Count - 1 ].PortId, m_outputPorts[ m_outputPorts.Count - 1 ] ); - m_outputPorts[ m_outputPorts.Count - 1 ].CustomColor = Color.green; - - m_outputPorts.Add( new OutputPort( this, m_uniqueId, m_outputPorts.Count, WirePortDataType.FLOAT, "B" ) ); - m_outputPortsDict.Add( m_outputPorts[ m_outputPorts.Count - 1 ].PortId, m_outputPorts[ m_outputPorts.Count - 1 ] ); - m_outputPorts[ m_outputPorts.Count - 1 ].CustomColor = Color.blue; - - if( addAlpha ) - { - m_outputPorts.Add( new OutputPort( this, m_uniqueId, m_outputPorts.Count, WirePortDataType.FLOAT, "A" ) ); - m_outputPortsDict.Add( m_outputPorts[ m_outputPorts.Count - 1 ].PortId, m_outputPorts[ m_outputPorts.Count - 1 ] ); - m_outputPorts[ m_outputPorts.Count - 1 ].CustomColor = Color.white; - } - } - - public void ConvertFromVectorToColorPorts() - { - m_outputPorts[ 0 ].ChangeType( WirePortDataType.COLOR, false ); - - m_outputPorts[ 1 ].Name = "R"; - m_outputPorts[ 1 ].CustomColor = Color.red; - - m_outputPorts[ 2 ].Name = "G"; - m_outputPorts[ 2 ].CustomColor = Color.green; - - m_outputPorts[ 3 ].Name = "B"; - m_outputPorts[ 3 ].CustomColor = Color.blue; - - m_outputPorts[ 4 ].Name = "A"; - m_outputPorts[ 4 ].CustomColor = Color.white; - } - - - public string GetOutputColorItem( int vectorPortId, int currentPortId, string result ) - { - switch( currentPortId - vectorPortId ) - { - case 1: result += ".r"; break; - case 2: result += ".g"; break; - case 3: result += ".b"; break; - case 4: result += ".a"; break; - } - return result; - } - - public void ChangeOutputType( WirePortDataType type, bool invalidateConnections ) - { - int outputCount = m_outputPorts.Count; - for( int i = 0; i < outputCount; i++ ) - { - m_outputPorts[ i ].ChangeType( type, invalidateConnections ); - } - } - - public void ChangeInputType( WirePortDataType type, bool invalidateConnections ) - { - int inputCount = m_inputPorts.Count; - for( int i = 0; i < inputCount; i++ ) - { - m_inputPorts[ i ].ChangeType( type, invalidateConnections ); - } - } - - public void ChangeOutputProperties( int outputID, string newName, WirePortDataType newType, bool invalidateConnections = true ) - { - if( outputID < m_outputPorts.Count ) - { - m_outputPorts[ outputID ].ChangeProperties( newName, newType, invalidateConnections ); - IsDirty = true; - m_sizeIsDirty = true; - SetSaveIsDirty(); - } - } - - public void ChangeOutputName( int outputArrayIdx, string newName ) - { - if( outputArrayIdx < m_outputPorts.Count ) - { - m_outputPorts[ outputArrayIdx ].Name = newName; - IsDirty = true; - m_sizeIsDirty = true; - } - } - - public InputPort CheckInputPortAt( Vector3 pos ) - { - int count = m_inputPorts.Count; - for( int i = 0; i < count; i++ ) - { - if( m_inputPorts[ i ].InsideActiveArea( pos ) ) - return m_inputPorts[ i ]; - } - return null; - } - - public InputPort GetFirstInputPortOfType( WirePortDataType dataType, bool countObjectTypeAsValid ) - { - int count = m_inputPorts.Count; - for( int i = 0; i < count; i++ ) - { - if( ( m_inputPorts[ i ].CheckValidType( dataType ) ) || ( countObjectTypeAsValid && m_inputPorts[ i ].DataType == WirePortDataType.OBJECT ) ) - return m_inputPorts[ i ]; - } - return null; - } - - public OutputPort CheckOutputPortAt( Vector3 pos ) - { - int count = m_outputPorts.Count; - for( int i = 0; i < count; i++ ) - { - if( m_outputPorts[ i ].InsideActiveArea( pos ) ) - return m_outputPorts[ i ]; - } - return null; - } - - public OutputPort GetFirstOutputPortOfType( WirePortDataType dataType, bool checkForCasts ) - { - int count = m_outputPorts.Count; - for( int i = 0; i < count; i++ ) - { - if( ( m_outputPorts[ i ].CheckValidType( dataType ) ) || ( checkForCasts && UIUtils.CanCast( dataType, m_outputPorts[ i ].DataType ) ) ) - return m_outputPorts[ i ]; - } - return null; - } - - virtual protected void ChangeSizeFinished() { m_firstPreviewDraw = true; /*MarkForPreviewUpdate();*/ } - protected void ChangeSize() - { - m_cachedPos = m_position; - //UIUtils.ResetMainSkin(); - - Vector2 inSize = Vector2.zero; - int inputCount = 0; - int inputSize = m_inputPorts.Count; - for( int i = 0; i < inputSize; i++ ) - { - if( m_inputPorts[ i ].Visible ) - { - if( m_inputPorts[ i ].DirtyLabelSize || m_inputPorts[ i ].LabelSize == Vector2.zero ) - { - m_inputPorts[ i ].DirtyLabelSize = false; - m_sizeContentAux.text = m_inputPorts[ i ].Name; - m_inputPorts[ i ].UnscaledLabelSize = UIUtils.UnZoomedInputPortStyle.CalcSize( m_sizeContentAux ); - } - - inSize.x = Mathf.Max( inSize.x, m_inputPorts[ i ].UnscaledLabelSize.x ); - inSize.y = Mathf.Max( inSize.y, m_inputPorts[ i ].UnscaledLabelSize.y ); - inputCount += 1; - } - } - if( inSize.x > 0 ) - inSize.x += UIUtils.PortsSize.x + Constants.PORT_TO_LABEL_SPACE_X * 2; - inSize.x += m_marginPreviewLeft; - inSize.y = Mathf.Max( inSize.y, UIUtils.PortsSize.y ); - - - Vector2 outSize = Vector2.zero; - int outputCount = 0; - int outputSize = m_outputPorts.Count; - for( int i = 0; i < outputSize; i++ ) - { - if( m_outputPorts[ i ].Visible ) - { - if( m_outputPorts[ i ].DirtyLabelSize || m_outputPorts[ i ].LabelSize == Vector2.zero ) - { - m_outputPorts[ i ].DirtyLabelSize = false; - m_sizeContentAux.text = m_outputPorts[ i ].Name; - m_outputPorts[ i ].UnscaledLabelSize = UIUtils.UnZoomedOutputPortPortStyle.CalcSize( m_sizeContentAux ); - } - - outSize.x = Mathf.Max( outSize.x, m_outputPorts[ i ].UnscaledLabelSize.x ); - outSize.y = Mathf.Max( outSize.y, m_outputPorts[ i ].UnscaledLabelSize.y ); - outputCount += 1; - } - } - if( outSize.x > 0 ) - outSize.x += UIUtils.PortsSize.x + Constants.PORT_TO_LABEL_SPACE_X * 2; - outSize.y = Mathf.Max( outSize.y, UIUtils.PortsSize.y ); - - if( m_additionalContent.text.Length > 0 ) - { - m_extraHeaderHeight = (int)Constants.NODE_HEADER_EXTRA_HEIGHT; - m_hasSubtitle = true && m_showSubtitle; - } - else - { - m_extraHeaderHeight = 0; - m_hasSubtitle = false; - } - - float headerWidth = Mathf.Max( UIUtils.UnZoomedNodeTitleStyle.CalcSize( m_content ).x + m_paddingTitleLeft + m_paddingTitleRight, UIUtils.UnZoomedPropertyValuesTitleStyle.CalcSize( m_additionalContent ).x + m_paddingTitleLeft + m_paddingTitleRight ); - m_position.width = Mathf.Max( headerWidth, Mathf.Max( MinInsideBoxWidth, m_insideSize.x ) + inSize.x + outSize.x ) + Constants.NODE_HEADER_LEFTRIGHT_MARGIN * 2; - //m_position.width += m_extraSize.x; - - m_fontHeight = Mathf.Max( inSize.y, outSize.y ); - - m_position.height = Mathf.Max( inputCount, outputCount ) * ( m_fontHeight + Constants.INPUT_PORT_DELTA_Y );// + Constants.INPUT_PORT_DELTA_Y; - m_position.height = Mathf.Max( m_position.height, Mathf.Max( MinInsideBoxHeight, m_insideSize.y ) ); - m_position.height += UIUtils.HeaderMaxHeight + m_extraHeaderHeight + Constants.INPUT_PORT_DELTA_Y;// + m_extraSize.y; - if( m_showErrorMessage ) - m_position.height += 24; - - m_unpreviewedPosition = m_position; - //UIUtils.CurrentWindow.CameraDrawInfo.InvertedZoom = cachedZoom; - if( OnNodeChangeSizeEvent != null ) - { - OnNodeChangeSizeEvent( this ); - } - ChangeSizeFinished(); - } - - public virtual void Reset() { } - public virtual void OnOutputPortConnected( int portId, int otherNodeId, int otherPortId ) { } - - public virtual void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) - { - InputPort port = GetInputPortByUniqueId( portId ); - if( activateNode && m_connStatus == NodeConnectionStatus.Connected ) - { - port.GetOutputNode().ActivateNode( m_activeNode, m_activePort, m_activeType ); - } - - PreviewIsDirty = true; - OnNodeChange(); - SetSaveIsDirty(); - } - - public virtual void OnInputPortDisconnected( int portId ) { PreviewIsDirty = true; OnNodeChange(); } - public virtual void OnOutputPortDisconnected( int portId ) { } - - public virtual void OnNodeChange() - { - CheckSpherePreview(); - int count = m_outputPorts.Count; - for( int i = 0; i < count; i++ ) - { - if( m_outputPorts[ i ].IsConnected ) - { - for( int f = 0; f < m_outputPorts[ i ].ExternalReferences.Count; f++ ) - { - ContainerGraph.GetNode( m_outputPorts[ i ].ExternalReferences[ f ].NodeId ).OnNodeChange(); - } - } - } - } - - public virtual void ActivateNode( int signalGenNodeId, int signalGenPortId, System.Type signalGenNodeType ) - { - if( m_selfPowered ) - return; - - ConnStatus = m_restrictions.GetRestiction( signalGenNodeType, signalGenPortId ) ? NodeConnectionStatus.Error : NodeConnectionStatus.Connected; - m_activeConnections += 1; - - if( m_activeConnections == 1 ) - { - m_activeType = signalGenNodeType; - m_activeNode = signalGenNodeId; - m_activePort = signalGenPortId; - for( int i = 0; i < m_inputPorts.Count; i++ ) - { - if( m_inputPorts[ i ].IsConnected ) - { - m_inputPorts[ i ].GetOutputNode().ActivateNode( signalGenNodeId, signalGenPortId, signalGenNodeType ); - } - } - } - // saveisdirty might be needed, gonna leave this here for now - // SetSaveIsDirty(); - } - - public virtual void DeactivateInputPortNode( int deactivatedPort, bool forceComplete ) - { - GetInputPortByUniqueId( deactivatedPort ).GetOutputNode().DeactivateNode( deactivatedPort, false ); - } - - public virtual void DeactivateNode( int deactivatedPort, bool forceComplete ) - { - if( m_selfPowered ) - return; - - // saveisdirty might be needed, gonna leave this here for now - // SetSaveIsDirty(); - m_activeConnections -= 1; - if( forceComplete || m_activeConnections <= 0 ) - { - m_activeConnections = 0; - ConnStatus = NodeConnectionStatus.Not_Connected; - for( int i = 0; i < m_inputPorts.Count; i++ ) - { - if( m_inputPorts[ i ].IsConnected ) - { - ParentNode node = m_inputPorts[ i ].GetOutputNode(); - if( node != null ) - node.DeactivateNode( deactivatedPort == -1 ? m_inputPorts[ i ].PortId : deactivatedPort, false ); - } - } - } - } - - public Rect GlobalToLocalPosition( DrawInfo drawInfo ) - { - float width = m_globalPosition.width / drawInfo.InvertedZoom; - float height = m_globalPosition.height / drawInfo.InvertedZoom; - - float x = m_globalPosition.x / drawInfo.InvertedZoom - drawInfo.CameraOffset.x; - float y = m_globalPosition.y / drawInfo.InvertedZoom - drawInfo.CameraOffset.y; - return new Rect( x, y, width, height ); - } - - protected void CalculatePositionAndVisibility( DrawInfo drawInfo ) - { - //m_movingInFrame = false; - m_globalPosition = m_position; - m_globalPosition.x = drawInfo.InvertedZoom * ( m_globalPosition.x + drawInfo.CameraOffset.x ); - m_globalPosition.y = drawInfo.InvertedZoom * ( m_globalPosition.y + drawInfo.CameraOffset.y ); - m_globalPosition.width *= drawInfo.InvertedZoom; - m_globalPosition.height *= drawInfo.InvertedZoom; - - m_isVisible = ( m_globalPosition.x + m_globalPosition.width > 0 ) && - ( m_globalPosition.x < drawInfo.CameraArea.width ) && - ( m_globalPosition.y + m_globalPosition.height > 0 ) && - ( m_globalPosition.y < drawInfo.CameraArea.height ); - - if( m_isMoving > 0 && drawInfo.CurrentEventType != EventType.MouseDrag ) - { - float deltaX = Mathf.Abs( m_lastPosition.x - m_position.x ); - float deltaY = Mathf.Abs( m_lastPosition.y - m_position.y ); - if( deltaX < 0.01f && deltaY < 0.01f ) - { - m_isMoving -= 1; - if( m_isMoving == 0 ) - { - OnSelfStoppedMovingEvent(); - } - } - else - { - m_isMoving = MoveCountBuffer; - } - m_lastPosition = m_position; - } - } - - public void FireStoppedMovingEvent( bool testOnlySelected, InteractionMode interactionMode ) - { - if( OnNodeStoppedMovingEvent != null ) - OnNodeStoppedMovingEvent( this, testOnlySelected, interactionMode ); - } - - public virtual void OnSelfStoppedMovingEvent() - { - FireStoppedMovingEvent( true, m_defaultInteractionMode ); - } - - protected void DrawPrecisionProperty( bool withInherit = true ) - { - if( withInherit ) - m_currentPrecisionType = (PrecisionType)EditorGUILayoutPopup( PrecisionContent.text, (int)m_currentPrecisionType, PrecisionLabelsExtra ); - else - m_currentPrecisionType = (PrecisionType)EditorGUILayoutPopup( PrecisionContent.text, (int)m_currentPrecisionType, PrecisionLabels ); - } - - public virtual void DrawTitle( Rect titlePos ) - { - if( ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD3 ) - { - GUI.Label( titlePos, m_content, UIUtils.GetCustomStyle( CustomStyle.NodeTitle ) ); - } - } - - public virtual void DrawPreview( DrawInfo drawInfo, Rect rect ) - { - //if ( !m_drawPreview ) - // return; - - if( m_cachedDrawSphereId == -1 ) - m_cachedDrawSphereId = Shader.PropertyToID( "_DrawSphere" ); - - if( m_cachedInvertedZoomId == -1 ) - m_cachedInvertedZoomId = Shader.PropertyToID( "_InvertedZoom" ); - - m_channelNumber = 0; - Vector4 mask = Vector4.one; - if( m_outputPorts.Count > 0 ) - { - switch( m_outputPorts[ 0 ].DataType ) - { - case WirePortDataType.FLOAT: - m_channelNumber = 1; - mask.Set( 1, 1, 1, 0 ); - break; - case WirePortDataType.FLOAT2: - m_channelNumber = 2; - mask.Set( m_previewChannels[ 0 ] ? 1 : 0, m_previewChannels[ 1 ] ? 1 : 0, 1, 0 ); - break; - case WirePortDataType.COLOR: - case WirePortDataType.FLOAT4: - case WirePortDataType.SAMPLER1D: - case WirePortDataType.SAMPLER2D: - case WirePortDataType.SAMPLER3D: - case WirePortDataType.SAMPLERCUBE: - m_channelNumber = 4; - mask.Set( m_previewChannels[ 0 ] ? 1 : 0, m_previewChannels[ 1 ] ? 1 : 0, m_previewChannels[ 2 ] ? 1 : 0, m_previewChannels[ 3 ] ? 1 : 0 ); - break; - default: - m_channelNumber = 3; - mask.Set( m_previewChannels[ 0 ] ? 1 : 0, m_previewChannels[ 1 ] ? 1 : 0, m_previewChannels[ 2 ] ? 1 : 0, 0 ); - break; - } - } - - UIUtils.LinearMaterial.SetFloat( m_cachedDrawSphereId, ( SpherePreview ? 1 : 0 ) ); - UIUtils.LinearMaterial.SetFloat( m_cachedInvertedZoomId, drawInfo.InvertedZoom ); - UIUtils.LinearMaterial.SetVector( "_Mask", mask ); - - bool cached = GL.sRGBWrite; - GL.sRGBWrite = true; - //EditorGUI.DrawPreviewTexture( rect, PreviewTexture, UIUtils.LinearMaterial ); - int pass = 0; - if( SpherePreview ) - { - if( mask.w == 1 ) - pass = 3; - else - pass = 1; - } - else if( mask.w == 1 ) - pass = 2; - - Graphics.DrawTexture( rect, PreviewTexture, UIUtils.LinearMaterial, pass ); - GL.sRGBWrite = cached; - //Preview buttons - if( m_drawPreviewMaskButtons ) - DrawPreviewMaskButtonsRepaint( drawInfo, rect ); - } - - protected void DrawPreviewMaskButtonsLayout( DrawInfo drawInfo, Rect rect ) - { - if( rect.Contains( drawInfo.MousePosition ) && m_channelNumber > 1 && ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD2 ) - { - Rect buttonRect = rect; - buttonRect.height = 14 * drawInfo.InvertedZoom; - buttonRect.y = rect.yMax - buttonRect.height; - buttonRect.width = 14 * drawInfo.InvertedZoom; - - if( m_channelNumber == 2 ) - { - m_previewChannels[ 0 ] = GUI.Toggle( buttonRect, m_previewChannels[ 0 ], string.Empty, GUIStyle.none ); - buttonRect.x += 14 * drawInfo.InvertedZoom; - m_previewChannels[ 1 ] = GUI.Toggle( buttonRect, m_previewChannels[ 1 ], string.Empty, GUIStyle.none ); - } - else if( m_channelNumber == 3 ) - { - m_previewChannels[ 0 ] = GUI.Toggle( buttonRect, m_previewChannels[ 0 ], string.Empty, GUIStyle.none ); - buttonRect.x += 14 * drawInfo.InvertedZoom; - m_previewChannels[ 1 ] = GUI.Toggle( buttonRect, m_previewChannels[ 1 ], string.Empty, GUIStyle.none ); - buttonRect.x += 14 * drawInfo.InvertedZoom; - m_previewChannels[ 2 ] = GUI.Toggle( buttonRect, m_previewChannels[ 2 ], string.Empty, GUIStyle.none ); - } - else if( m_channelNumber == 4 ) - { - m_previewChannels[ 0 ] = GUI.Toggle( buttonRect, m_previewChannels[ 0 ], string.Empty, GUIStyle.none ); - buttonRect.x += 14 * drawInfo.InvertedZoom; - m_previewChannels[ 1 ] = GUI.Toggle( buttonRect, m_previewChannels[ 1 ], string.Empty, GUIStyle.none ); - buttonRect.x += 14 * drawInfo.InvertedZoom; - m_previewChannels[ 2 ] = GUI.Toggle( buttonRect, m_previewChannels[ 2 ], string.Empty, GUIStyle.none ); - buttonRect.x += 14 * drawInfo.InvertedZoom; - m_previewChannels[ 3 ] = GUI.Toggle( buttonRect, m_previewChannels[ 3 ], string.Empty, GUIStyle.none ); - } - } - } - - protected void DrawPreviewMaskButtonsRepaint( DrawInfo drawInfo, Rect rect ) - { - if( drawInfo.CurrentEventType == EventType.Repaint && ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD2 && rect.Contains( drawInfo.MousePosition ) && m_channelNumber > 1 ) - { - Rect buttonRect = rect; - buttonRect.height = 14 * drawInfo.InvertedZoom; - buttonRect.y = rect.yMax - buttonRect.height; - buttonRect.width = 14 * drawInfo.InvertedZoom; - - if( m_channelNumber == 2 ) - { - UIUtils.MiniButtonTopMid.Draw( buttonRect, "R", false, false, m_previewChannels[ 0 ], false ); - buttonRect.x += 14 * drawInfo.InvertedZoom; - UIUtils.MiniButtonTopRight.Draw( buttonRect, "G", false, false, m_previewChannels[ 1 ], false ); - } - else if( m_channelNumber == 3 ) - { - UIUtils.MiniButtonTopMid.Draw( buttonRect, "R", false, false, m_previewChannels[ 0 ], false ); - buttonRect.x += 14 * drawInfo.InvertedZoom; - UIUtils.MiniButtonTopMid.Draw( buttonRect, "G", false, false, m_previewChannels[ 1 ], false ); - buttonRect.x += 14 * drawInfo.InvertedZoom; - UIUtils.MiniButtonTopRight.Draw( buttonRect, "B", false, false, m_previewChannels[ 2 ], false ); - } - else if( m_channelNumber == 4 ) - { - UIUtils.MiniButtonTopMid.Draw( buttonRect, "R", false, false, m_previewChannels[ 0 ], false ); - buttonRect.x += 14 * drawInfo.InvertedZoom; - UIUtils.MiniButtonTopMid.Draw( buttonRect, "G", false, false, m_previewChannels[ 1 ], false ); - buttonRect.x += 14 * drawInfo.InvertedZoom; - UIUtils.MiniButtonTopMid.Draw( buttonRect, "B", false, false, m_previewChannels[ 2 ], false ); - buttonRect.x += 14 * drawInfo.InvertedZoom; - UIUtils.MiniButtonTopRight.Draw( buttonRect, "A", false, false, m_previewChannels[ 3 ], false ); - } - } - } - - public void SetTimedUpdate( double timerInterval ) - { - m_timedUpdateInitialValue = EditorApplication.timeSinceStartup; - m_timedUpdateInterval = timerInterval; - m_fireTimedUpdateRequest = true; - } - - public virtual void FireTimedUpdate() { } - /// <summary> - /// - /// </summary> - /// <param name="drawInfo"></param> - public virtual void OnNodeLogicUpdate( DrawInfo drawInfo ) - { - if( m_fireTimedUpdateRequest && ( EditorApplication.timeSinceStartup - m_timedUpdateInitialValue ) > m_timedUpdateInterval ) - { - m_fireTimedUpdateRequest = false; - FireTimedUpdate(); - } - - if( m_repopulateDictionaries ) - { - m_repopulateDictionaries = false; - - m_inputPortsDict.Clear(); - int inputCount = m_inputPorts.Count; - for( int i = 0; i < inputCount; i++ ) - { - m_inputPortsDict.Add( m_inputPorts[ i ].PortId, m_inputPorts[ i ] ); - } - - m_outputPortsDict.Clear(); - int outputCount = m_outputPorts.Count; - for( int i = 0; i < outputCount; i++ ) - { - m_outputPortsDict.Add( m_outputPorts[ i ].PortId, m_outputPorts[ i ] ); - } - } - } - - /// <summary> - /// This method should only be called to calculate layouts of elements to be draw later, only runs once per frame and before wires are drawn - /// </summary> - /// <param name="drawInfo"></param> - public virtual void OnNodeLayout( DrawInfo drawInfo ) - { - - if( ContainerGraph.ChangedLightingModel ) - { - m_sizeIsDirty = true; - m_firstPreviewDraw = true; - } - - if( m_firstDraw ) - { - m_firstDraw = false; - AfterCommonInit(); - OnNodeChange(); - } - - if( m_previousErrorMessage != m_showErrorMessage ) - { - m_sizeIsDirty = true; - } - - if( m_sizeIsDirty ) - { - m_sizeIsDirty = false; - ChangeSize(); - } - - CalculatePositionAndVisibility( drawInfo ); - - m_unscaledRemainingBox = m_position; - m_remainingBox = m_globalPosition; - - m_lastInputBottomRight = m_position.position; - m_lastOutputBottomLeft = m_position.position; - m_lastOutputBottomLeft.x += m_position.width; - - m_visibleInputs = 0; - m_visibleOutputs = 0; - - if( m_hasSubtitle ) - m_extraHeaderHeight = (int)Constants.NODE_HEADER_EXTRA_HEIGHT; - else - m_extraHeaderHeight = 0; - - m_lastInputBottomRight.y += UIUtils.HeaderMaxHeight + m_extraHeaderHeight; - m_lastOutputBottomLeft.y += UIUtils.HeaderMaxHeight + m_extraHeaderHeight; - m_unscaledRemainingBox.y += UIUtils.HeaderMaxHeight + m_extraHeaderHeight; - - if( m_isVisible ) - { - // Header - m_headerPosition = m_globalPosition; - m_headerPosition.height = UIUtils.CurrentHeaderHeight + m_extraHeaderHeight * drawInfo.InvertedZoom; - - // Title - m_titlePos = m_globalPosition; - m_titlePos.height = m_headerPosition.height; - if( m_hasSubtitle ) - m_titlePos.yMin += ( 4 * drawInfo.InvertedZoom ); - else - m_titlePos.yMin += ( 7 * drawInfo.InvertedZoom ); - m_titlePos.width -= ( m_paddingTitleLeft + m_paddingTitleRight ) * drawInfo.InvertedZoom; - m_titlePos.x += m_paddingTitleLeft * drawInfo.InvertedZoom; - - // Additional Title - if( m_hasSubtitle ) - { - m_addTitlePos = m_titlePos; - m_addTitlePos.y = m_globalPosition.y; - m_addTitlePos.yMin += ( 19 * drawInfo.InvertedZoom ); - } - - // Left Dropdown - if( m_hasLeftDropdown && ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD4 ) - { - m_dropdownRect = m_headerPosition; - m_dropdownRect.width = Constants.NodeButtonSizeX * drawInfo.InvertedZoom; - m_dropdownRect.x = m_globalPosition.x + ( Constants.IconsLeftRightMargin + 1 ) * drawInfo.InvertedZoom; - m_dropdownRect.height = Constants.NodeButtonSizeY * drawInfo.InvertedZoom; - m_dropdownRect.y = m_globalPosition.y + m_headerPosition.height * 0.5f - 14 * drawInfo.InvertedZoom * 0.5f; - } - - // Expander - if( m_drawPreviewExpander && ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD4 ) - { - m_expandRect = m_globalPosition; - m_expandRect.width = Constants.PreviewExpanderWidth * drawInfo.InvertedZoom; - m_expandRect.x = m_globalPosition.x + m_globalPosition.width - ( Constants.IconsLeftRightMargin + Constants.PreviewExpanderWidth ) * drawInfo.InvertedZoom; //titlePos.x + titlePos.width; - m_expandRect.height = Constants.PreviewExpanderHeight * drawInfo.InvertedZoom; - m_expandRect.y = m_globalPosition.y + m_headerPosition.height * 0.5f - Constants.PreviewExpanderHeight * drawInfo.InvertedZoom * 0.5f; - } - } - - if( m_anchorAdjust < 0 ) - { - m_anchorAdjust = UIUtils.GetCustomStyle( CustomStyle.PortEmptyIcon ).normal.background.width; - } - - m_unscaledRemainingBox.y += Constants.INPUT_PORT_DELTA_Y; - m_lastOutputBottomLeft.y += Constants.INPUT_PORT_DELTA_Y; - m_lastInputBottomRight.y += Constants.INPUT_PORT_DELTA_Y; - - // Input Ports - { - m_currInputPortPos = m_globalPosition; - m_currInputPortPos.width = drawInfo.InvertedZoom * UIUtils.PortsSize.x; - m_currInputPortPos.height = drawInfo.InvertedZoom * UIUtils.PortsSize.y; - - m_currInputPortPos.x += drawInfo.InvertedZoom * Constants.PORT_INITIAL_X; - m_currInputPortPos.y += drawInfo.InvertedZoom * Constants.PORT_INITIAL_Y + m_extraHeaderHeight * drawInfo.InvertedZoom; - int inputCount = m_inputPorts.Count; - - float initialX = m_lastInputBottomRight.x; - - for( int i = 0; i < inputCount; i++ ) - { - if( m_inputPorts[ i ].Visible ) - { - m_visibleInputs++; - // Button - m_inputPorts[ i ].Position = m_currInputPortPos; - - // Label - m_inputPorts[ i ].LabelPosition = m_currInputPortPos; - float deltaX = 1f * drawInfo.InvertedZoom * ( UIUtils.PortsSize.x + Constants.PORT_TO_LABEL_SPACE_X ); - m_auxRect = m_inputPorts[ i ].LabelPosition; - m_auxRect.x += deltaX; - m_inputPorts[ i ].LabelPosition = m_auxRect; - - //if( m_inputPorts[ i ].DirtyLabelSize || m_inputPorts[ i ].LabelSize == Vector2.zero ) - //{ - // m_inputPorts[ i ].DirtyLabelSize = false; - // m_sizeContentAux.text = m_inputPorts[ i ].Name; - // m_inputPorts[ i ].UnscaledLabelSize = UIUtils.UnZoomedInputPortStyle.CalcSize( m_sizeContentAux ); - //} - - m_inputPorts[ i ].LabelSize = m_inputPorts[ i ].UnscaledLabelSize * drawInfo.InvertedZoom; - - m_lastInputBottomRight.x = Mathf.Max( m_lastInputBottomRight.x, initialX + m_inputPorts[ i ].UnscaledLabelSize.x + Constants.PORT_INITIAL_X + Constants.PORT_TO_LABEL_SPACE_X + UIUtils.PortsSize.x ); - - if( !m_inputPorts[ i ].Locked ) - { - float overflow = 2; - float scaledOverflow = 4 * drawInfo.InvertedZoom; - m_auxRect = m_currInputPortPos; - m_auxRect.yMin -= scaledOverflow + overflow; - m_auxRect.yMax += scaledOverflow + overflow; - m_auxRect.xMin -= Constants.PORT_INITIAL_X * drawInfo.InvertedZoom + scaledOverflow + overflow; - if( m_containerGraph.ParentWindow.WireReferenceUtils.OutputPortReference.IsValid ) - m_auxRect.xMax += m_inputPorts[ i ].LabelSize.x + Constants.PORT_TO_LABEL_SPACE_X * drawInfo.InvertedZoom + scaledOverflow + overflow; - else - m_auxRect.xMax += Constants.PORT_TO_LABEL_SPACE_X * drawInfo.InvertedZoom + scaledOverflow + overflow; - m_inputPorts[ i ].ActivePortArea = m_auxRect; - } - m_currInputPortPos.y += drawInfo.InvertedZoom * ( m_fontHeight + Constants.INPUT_PORT_DELTA_Y ); - //GUI.Label( m_inputPorts[ i ].ActivePortArea, string.Empty, UIUtils.Box ); - } - } - if( m_visibleInputs > 0 ) - m_lastInputBottomRight.y += m_fontHeight * m_visibleInputs + Constants.INPUT_PORT_DELTA_Y * ( m_visibleInputs - 1 ); - } - - // Output Ports - { - m_currOutputPortPos = m_globalPosition; - m_currOutputPortPos.width = drawInfo.InvertedZoom * UIUtils.PortsSize.x; - m_currOutputPortPos.height = drawInfo.InvertedZoom * UIUtils.PortsSize.y; - - m_currOutputPortPos.x += ( m_globalPosition.width - drawInfo.InvertedZoom * ( Constants.PORT_INITIAL_X + m_anchorAdjust ) ); - m_currOutputPortPos.y += drawInfo.InvertedZoom * Constants.PORT_INITIAL_Y + m_extraHeaderHeight * drawInfo.InvertedZoom; - int outputCount = m_outputPorts.Count; - - float initialX = m_lastOutputBottomLeft.x; - - for( int i = 0; i < outputCount; i++ ) - { - if( m_outputPorts[ i ].Visible ) - { - m_visibleOutputs++; - //Button - m_outputPorts[ i ].Position = m_currOutputPortPos; - - // Label - m_outputPorts[ i ].LabelPosition = m_currOutputPortPos; - float deltaX = 1f * drawInfo.InvertedZoom * ( UIUtils.PortsSize.x + Constants.PORT_TO_LABEL_SPACE_X ); - m_auxRect = m_outputPorts[ i ].LabelPosition; - m_auxRect.x -= deltaX; - m_outputPorts[ i ].LabelPosition = m_auxRect; - - m_outputPorts[ i ].LabelSize = m_outputPorts[ i ].UnscaledLabelSize * drawInfo.InvertedZoom; - - m_lastOutputBottomLeft.x = Mathf.Min( m_lastOutputBottomLeft.x, initialX - m_outputPorts[ i ].UnscaledLabelSize.x - Constants.PORT_INITIAL_X - Constants.PORT_TO_LABEL_SPACE_X - UIUtils.PortsSize.x ); - - if( !m_outputPorts[ i ].Locked ) - { - float overflow = 2; - float scaledOverflow = 4 * drawInfo.InvertedZoom; - m_auxRect = m_currOutputPortPos; - m_auxRect.yMin -= scaledOverflow + overflow; - m_auxRect.yMax += scaledOverflow + overflow; - if( m_containerGraph.ParentWindow.WireReferenceUtils.InputPortReference.IsValid ) - m_auxRect.xMin -= m_outputPorts[ i ].LabelSize.x + Constants.PORT_TO_LABEL_SPACE_X * drawInfo.InvertedZoom + scaledOverflow + overflow; - else - m_auxRect.xMin -= Constants.PORT_TO_LABEL_SPACE_X * drawInfo.InvertedZoom + scaledOverflow + overflow; - m_auxRect.xMax += Constants.PORT_INITIAL_X * drawInfo.InvertedZoom + scaledOverflow + overflow; - m_outputPorts[ i ].ActivePortArea = m_auxRect; - } - m_currOutputPortPos.y += drawInfo.InvertedZoom * ( m_fontHeight + Constants.INPUT_PORT_DELTA_Y ); - //GUI.Label( m_outputPorts[ i ].ActivePortArea, string.Empty, UIUtils.Box ); - } - } - if( m_visibleOutputs > 0 ) - m_lastOutputBottomLeft.y += m_fontHeight * m_visibleOutputs + Constants.INPUT_PORT_DELTA_Y * ( m_visibleOutputs - 1 ); - } - - m_lastInputBottomRight.x += m_marginPreviewLeft; - - //Vector2 scaledLastOutputBottomLeft = ( m_lastOutputBottomLeft + drawInfo.CameraOffset ) * drawInfo.InvertedZoom; - //GUI.Label( new Rect( scaledLastOutputBottomLeft, Vector2.one * 2 ), string.Empty, UIUtils.CurrentWindow.CustomStylesInstance.Box ); - - m_unscaledRemainingBox.xMin = m_lastInputBottomRight.x; - //m_unscaledRemainingBox.yMin = m_lastInputBottomRight.y; - m_unscaledRemainingBox.xMax = m_lastOutputBottomLeft.x; - m_unscaledRemainingBox.yMax = Mathf.Max( m_lastOutputBottomLeft.y, m_lastInputBottomRight.y ); - - m_remainingBox.position = ( m_unscaledRemainingBox.position + drawInfo.CameraOffset ) * drawInfo.InvertedZoom; - m_remainingBox.size = m_unscaledRemainingBox.size * drawInfo.InvertedZoom; - - //GUI.Label( m_remainingBox, string.Empty, UIUtils.Box ); - - if( m_visibleInputs == 0 ) - { - m_remainingBox.x += Constants.PORT_INITIAL_X * drawInfo.InvertedZoom; - m_remainingBox.width -= Constants.PORT_INITIAL_X * drawInfo.InvertedZoom; - } - - if( m_visibleOutputs == 0 ) - { - m_remainingBox.width -= Constants.PORT_INITIAL_X * drawInfo.InvertedZoom; - } - - if( ContainerGraph.ParentWindow.GlobalPreview != m_globalShowPreview ) - { - m_globalShowPreview = ContainerGraph.ParentWindow.GlobalPreview; - m_sizeIsDirty = true; - ContainerGraph.ParentWindow.RequestRepaint(); - } - - // Generate Proper Preview Rect - float marginAround = 10; - float scaledMarginAround = marginAround * drawInfo.InvertedZoom; - float previewSize = 128; - PreviewLocation m_autoLocation = m_selectedLocation; - if( m_selectedLocation == PreviewLocation.Auto ) - { - if( m_visibleOutputs > m_visibleInputs ) - { - m_autoLocation = PreviewLocation.Left; - } - else if( m_visibleOutputs < m_visibleInputs ) - { - m_autoLocation = PreviewLocation.Right; - } - else if( m_unscaledRemainingBox.width > previewSize ) - { - m_autoLocation = PreviewLocation.TopCenter; - } - else - { - m_autoLocation = PreviewLocation.BottomCenter; - } - } - - if( m_canExpand && ( m_showPreview || m_globalShowPreview ) ) - { - if( m_autoLocation == PreviewLocation.TopCenter ) - { - m_unscaledPreviewRect.y = m_unscaledRemainingBox.y; - m_unscaledPreviewRect.x = m_unscaledRemainingBox.center.x - 0.5f * ( previewSize + 2 * marginAround ); - } - else if( m_autoLocation == PreviewLocation.BottomCenter ) - { - m_unscaledPreviewRect.y = Mathf.Max( m_lastOutputBottomLeft.y, m_lastInputBottomRight.y ); - m_unscaledPreviewRect.x = m_position.x + 0.5f * m_position.width - 0.5f * ( previewSize + 2 * marginAround ); - } - else if( m_autoLocation == PreviewLocation.Left ) - { - m_unscaledPreviewRect.y = m_lastInputBottomRight.y; - m_unscaledPreviewRect.x = m_position.x; - } - else if( m_autoLocation == PreviewLocation.Right ) - { - m_unscaledPreviewRect.y = m_lastOutputBottomLeft.y; - m_unscaledPreviewRect.x = m_lastInputBottomRight.x; - } - if( m_autoLocation == PreviewLocation.BottomCenter ) - m_unscaledPreviewRect.height = previewSize + 2 * marginAround; - else if( m_autoLocation == PreviewLocation.TopCenter ) - m_unscaledPreviewRect.height = previewSize + marginAround; - else - m_unscaledPreviewRect.height = previewSize + ( m_visibleInputs > 0 && m_visibleOutputs > 0 ? 2 * marginAround : marginAround ); - m_unscaledPreviewRect.width = previewSize + 2 * marginAround; - - m_previewRect = m_unscaledPreviewRect; - m_previewRect.position = ( m_previewRect.position + drawInfo.CameraOffset ) * drawInfo.InvertedZoom; - m_auxVector2.Set( previewSize * drawInfo.InvertedZoom, previewSize * drawInfo.InvertedZoom ); - m_previewRect.size = m_auxVector2; - - if( m_autoLocation == PreviewLocation.BottomCenter ) - { - m_auxVector2.Set( m_previewRect.position.x + scaledMarginAround, m_previewRect.position.y + scaledMarginAround ); - m_previewRect.position = m_auxVector2; - } - else if( m_autoLocation == PreviewLocation.TopCenter ) - { - m_auxVector2.Set( m_previewRect.position.x + scaledMarginAround, m_previewRect.position.y ); - m_previewRect.position = m_auxVector2; - } - else - { - m_previewRect.position += new Vector2( scaledMarginAround, ( m_visibleInputs > 0 && m_visibleOutputs > 0 ? scaledMarginAround : 0 ) ); - } - } - - // Adjust node rect after preview - if( m_firstPreviewDraw ) - { - m_firstPreviewDraw = false; - ContainerGraph.ParentWindow.RequestRepaint(); - if( m_canExpand && ( m_showPreview || m_globalShowPreview ) ) - { - if( m_autoLocation == PreviewLocation.TopCenter ) - { - float fillWidth = m_unscaledRemainingBox.width - m_unscaledPreviewRect.width; - m_extraSize.x = Mathf.Max( -fillWidth, 0 ); - float fillHeight = m_position.yMax - m_unscaledPreviewRect.yMax; - m_extraSize.y = Mathf.Max( -fillHeight, 0 ); - } - if( m_autoLocation == PreviewLocation.BottomCenter ) - { - float fillWidth = m_position.width - m_unscaledPreviewRect.width; - m_extraSize.x = Mathf.Max( -fillWidth, 0 ); - float fillHeight = m_position.yMax - m_unscaledPreviewRect.yMax; - m_extraSize.y = Mathf.Max( -fillHeight, 0 ); - } - else if( m_autoLocation == PreviewLocation.Left ) - { - float fillWidth = m_lastOutputBottomLeft.x - m_unscaledPreviewRect.xMax; - m_extraSize.x = Mathf.Max( -fillWidth, 0 ); - float fillHeight = m_position.yMax - m_unscaledPreviewRect.yMax; - m_extraSize.y = Mathf.Max( -fillHeight, 0 ); - } - else if( m_autoLocation == PreviewLocation.Right ) - { - float fillWidth = m_position.xMax - m_unscaledPreviewRect.xMax; - m_extraSize.x = Mathf.Max( -fillWidth, 0 ); - float fillHeight = m_position.yMax - m_unscaledPreviewRect.yMax; - m_extraSize.y = Mathf.Max( -fillHeight, 0 ); - } - - if( m_showErrorMessage ) - m_extraSize.y += 24; - } - else if( m_canExpand ) - { - m_extraSize.y = 0; - m_extraSize.x = 0; - } - - m_position.width = m_unpreviewedPosition.width + m_extraSize.x; - m_position.height = m_unpreviewedPosition.height + m_extraSize.y; - } - - - if( m_showErrorMessage ) - { - m_errorBox = m_globalPosition; - m_errorBox.y = ( m_globalPosition.yMax - 28 * drawInfo.InvertedZoom ) + 3 * drawInfo.InvertedZoom; - m_errorBox.height = 25 * drawInfo.InvertedZoom; - } - - m_previousErrorMessage = m_showErrorMessage; - } - - /// <summary> - /// This method should only be called to draw elements, runs once per frame and after wires are drawn - /// </summary> - /// <param name="drawInfo"></param> - public virtual void OnNodeRepaint( DrawInfo drawInfo ) - { - if( !m_isVisible ) - return; - - m_colorBuffer = GUI.color; - // Background - GUI.color = m_infiniteLoopDetected ? Constants.InfiniteLoopColor : Constants.NodeBodyColor; - if( m_useSquareNodeTitle || ContainerGraph.LodLevel >= ParentGraph.NodeLOD.LOD2 ) - GUI.Label( m_globalPosition, string.Empty, UIUtils.NodeWindowOffSquare ); - else - GUI.Label( m_globalPosition, string.Empty, UIUtils.GetCustomStyle( CustomStyle.NodeWindowOff ) ); - - // Header - //GUI - GUI.color = m_headerColor * m_headerColorModifier; - if( m_useSquareNodeTitle || ContainerGraph.LodLevel >= ParentGraph.NodeLOD.LOD2 ) - GUI.Label( m_headerPosition, string.Empty, UIUtils.NodeHeaderSquare ); - else - GUI.Label( m_headerPosition, string.Empty, UIUtils.GetCustomStyle( CustomStyle.NodeHeader ) ); - GUI.color = m_colorBuffer; - - // Title - DrawTitle( m_titlePos ); - - // Additional Tile - if( m_hasSubtitle && ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD3 ) - GUI.Label( m_addTitlePos, m_additionalContent, UIUtils.GetCustomStyle( CustomStyle.PropertyValuesTitle ) ); - - // Dropdown - if( m_hasLeftDropdown && !m_dropdownEditing && ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD4 ) - GUI.Label( m_dropdownRect, string.Empty, UIUtils.PropertyPopUp ); - - // Expander - if( m_drawPreviewExpander && ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD4 ) - GUI.Label( m_expandRect, string.Empty, ( m_showPreview ? UIUtils.PreviewCollapser : UIUtils.PreviewExpander ) ); - - // Input Ports - int inputCount = m_inputPorts.Count; - - for( int i = 0; i < inputCount; i++ ) - { - if( m_inputPorts[ i ].Visible ) - { - // Input Port Icon - if( ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD4 ) - { - if( m_inputPorts[ i ].Locked ) - GUI.color = Constants.LockedPortColor; - else if( ContainerGraph.ParentWindow.Options.ColoredPorts ) - GUI.color = UIUtils.GetColorForDataType( m_inputPorts[ i ].DataType, false, true ); - else - GUI.color = m_inputPorts[ i ].HasCustomColor ? m_inputPorts[ i ].CustomColor : UIUtils.GetColorForDataType( m_inputPorts[ i ].DataType, true, true ); - - GUIStyle style = m_inputPorts[ i ].IsConnected ? UIUtils.GetCustomStyle( CustomStyle.PortFullIcon ) : UIUtils.GetCustomStyle( CustomStyle.PortEmptyIcon ); - GUI.Label( m_inputPorts[ i ].Position, string.Empty, style ); - - GUI.color = m_colorBuffer; - } - - // Input Port Label - if( ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD3 ) - { - if( m_inputPorts[ i ].Locked ) - { - GUI.color = Constants.PortLockedTextColor; - GUI.Label( m_inputPorts[ i ].LabelPosition, m_inputPorts[ i ].Name, UIUtils.InputPortLabel ); - GUI.color = m_colorBuffer; - } - else - { - if( m_containerGraph.ParentWindow.GlobalShowInternalData && !m_inputPorts[ i ].IsConnected && UIUtils.InternalDataOnPort.fontSize > 1f && ( m_inputPorts[ i ].AutoDrawInternalData || ( m_autoDrawInternalPortData && m_useInternalPortData ) ) && m_inputPorts[ i ].DisplayInternalData.Length > 4 && m_inputPorts[ i ].DataType != WirePortDataType.OBJECT ) - { - GUI.color = Constants.NodeBodyColor/* * new Color( 1f, 1f, 1f, 0.75f )*/; - Rect internalBox = m_inputPorts[ i ].LabelPosition; - m_sizeContentAux.text = m_inputPorts[ i ].DisplayInternalData; - Vector2 portText = UIUtils.InternalDataOnPort.CalcSize( m_sizeContentAux ); - internalBox.width = portText.x; - internalBox.height = portText.y; - internalBox.y = m_inputPorts[ i ].LabelPosition.center.y - internalBox.height * 0.5f; - internalBox.x = GlobalPosition.x - internalBox.width - 4 * drawInfo.InvertedZoom - 1; - Rect backBox = new Rect( internalBox ); - backBox.xMin -= 4 * drawInfo.InvertedZoom; - backBox.xMax += 4 * drawInfo.InvertedZoom; - backBox.yMin -= 2 * drawInfo.InvertedZoom; - backBox.yMax += 2 * drawInfo.InvertedZoom; - GUI.Label( backBox, string.Empty, UIUtils.InternalDataBackground ); - GUI.color *= new Color( 1f, 1f, 1f, 0.5f ); - GUI.Label( internalBox, m_sizeContentAux, UIUtils.InternalDataOnPort ); - GUI.color = m_colorBuffer; - } - GUI.Label( m_inputPorts[ i ].LabelPosition, m_inputPorts[ i ].Name, UIUtils.InputPortLabel ); - } - } - } - } - - // Output Ports - int outputCount = m_outputPorts.Count; - for( int i = 0; i < outputCount; i++ ) - { - if( m_outputPorts[ i ].Visible ) - { - // Output Port Icon - if( ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD4 ) - { - if( m_outputPorts[ i ].Locked ) - GUI.color = Constants.LockedPortColor; - else if( ContainerGraph.ParentWindow.Options.ColoredPorts ) - GUI.color = UIUtils.GetColorForDataType( m_outputPorts[ i ].DataType, false, false ); - else - GUI.color = m_outputPorts[ i ].HasCustomColor ? m_outputPorts[ i ].CustomColor : UIUtils.GetColorForDataType( m_outputPorts[ i ].DataType, true, false ); - - GUIStyle style = m_outputPorts[ i ].IsConnected ? UIUtils.GetCustomStyle( CustomStyle.PortFullIcon ) : UIUtils.GetCustomStyle( CustomStyle.PortEmptyIcon ); - GUI.Label( m_outputPorts[ i ].Position, string.Empty, style ); - - GUI.color = m_colorBuffer; - } - - // Output Port Label - if( ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD3 ) - { - if( m_outputPorts[ i ].Locked ) - { - GUI.color = Constants.PortLockedTextColor; - GUI.Label( m_outputPorts[ i ].LabelPosition, m_outputPorts[ i ].Name, UIUtils.OutputPortLabel ); - GUI.color = m_colorBuffer; - } - else - { - GUI.Label( m_outputPorts[ i ].LabelPosition, m_outputPorts[ i ].Name, UIUtils.OutputPortLabel ); - } - } - } - } - - // Preview - if( ( m_showPreview || m_globalShowPreview ) && m_drawPreview ) - DrawPreview( drawInfo, m_previewRect ); - - // Error and Warning bottom message - if( m_showErrorMessage ) - { - GUI.color = new Color( 0.0f, 0.0f, 0.0f, 0.5f ); - GUI.Label( m_errorBox, string.Empty, UIUtils.Separator ); - GUI.color = m_colorBuffer; - - switch( m_errorMessageTypeIsError ) - { - default: - case NodeMessageType.Error: - { - m_errorMessage.text = ErrorTitle; - m_errorIcon.image = UIUtils.SmallErrorIcon; - m_errorCurrentStyle = UIUtils.BoldErrorStyle; - } - break; - case NodeMessageType.Warning: - { - m_errorMessage.text = WarningTitle; - m_errorIcon.image = UIUtils.SmallWarningIcon; - m_errorCurrentStyle = UIUtils.BoldWarningStyle; - } - break; - case NodeMessageType.Info: - { - m_errorMessage.text = InfoTitle; - m_errorIcon.image = UIUtils.SmallInfoIcon; - m_errorCurrentStyle = UIUtils.BoldInfoStyle; - } - break; - } - - Rect textBox = m_errorBox; - textBox.y += 1 * drawInfo.InvertedZoom; - textBox.height = 24 * drawInfo.InvertedZoom; - - float textWidth = m_errorCurrentStyle.CalcSize( m_errorMessage ).x; - - GUI.Label( textBox, m_errorMessage, m_errorCurrentStyle ); - textBox.x -= textWidth * 0.5f + 12 * drawInfo.InvertedZoom; - GUI.Label( textBox, m_errorIcon, m_errorCurrentStyle ); - textBox.x += textWidth + 24 * drawInfo.InvertedZoom; - GUI.Label( textBox, m_errorIcon, m_errorCurrentStyle ); - } - - // Selection Box - if( m_selected ) - { - GUI.color = Constants.NodeSelectedColor; - if( m_useSquareNodeTitle || ContainerGraph.LodLevel >= ParentGraph.NodeLOD.LOD2 ) - GUI.Label( m_globalPosition, string.Empty, UIUtils.NodeWindowOnSquare ); - else - GUI.Label( m_globalPosition, string.Empty, UIUtils.GetCustomStyle( CustomStyle.NodeWindowOn ) ); - GUI.color = m_colorBuffer; - } - - // Debug Visualizers - //if( FinishPreviewRender || m_continuousPreviewRefresh ) - //{ - // GUI.color = new Color( 0, 1, 0.5f, 1f ); - // Rect r = m_globalPosition; - // r.width = 8; - // r.height = 8; - // r.x -= 5 * drawInfo.InvertedZoom; - // r.y -= 5 * drawInfo.InvertedZoom; - // GUI.Label( r, string.Empty, UIUtils.GetCustomStyle( CustomStyle.PortFullIcon ) ); - // GUI.color = m_colorBuffer; - // FinishPreviewRender = false; - //} - //GUI.Label( m_remainingBox, string.Empty, UIUtils.Box ); - } - - public bool DropdownEditing { get { return m_dropdownEditing; } set { m_dropdownEditing = value; PreviewIsDirty = true; } } - /// <summary> - /// Handles gui controls, runs before node layout - /// </summary> - /// <param name="drawInfo"></param> - public virtual void DrawGUIControls( DrawInfo drawInfo ) - { - if( !m_initialized ) - return; - - if( !m_isVisible ) - return; - - if( drawInfo.CurrentEventType == EventType.MouseDown && drawInfo.LeftMouseButtonPressed ) - { - if( m_expandRect.Contains( drawInfo.MousePosition ) ) - { - m_showPreview = !m_showPreview; - m_sizeIsDirty = true; - ContainerGraph.ParentWindow.MouseInteracted = true; - } - - if( m_hasLeftDropdown && m_dropdownRect.Contains( drawInfo.MousePosition ) ) - { - m_dropdownEditing = true; - } - else if( m_dropdownEditing ) - { - DropdownEditing = false; - } - } - - DrawGuiPorts( drawInfo ); - } - - //public static bool MyRepeatButton( DrawInfo drawInfo, Rect position, string text, GUIStyle style ) - //{ - // if(/* drawInfo.CurrentEventType == EventType.MouseDown &&*/ position.Contains( drawInfo.MousePosition ) ) - // { - // UIUtils.CurrentWindow.MouseInteracted = true; - // return true; - // } - // return false; - //} - - public void DrawGuiPorts( DrawInfo drawInfo ) - { - if( !m_initialized ) - return; - - if( !m_isVisible ) - return; - - if( drawInfo.CurrentEventType == EventType.MouseDown ) - { - int inputCount = m_inputPorts.Count; - int outputCount = m_outputPorts.Count; - - for( int i = 0; i < inputCount; i++ ) - { - if( m_inputPorts[ i ].Visible && !m_inputPorts[ i ].Locked && m_isVisible && m_inputPorts[ i ].ActivePortArea.Contains( drawInfo.MousePosition ) && drawInfo.LeftMouseButtonPressed ) - { - UIUtils.CurrentWindow.MouseInteracted = true; - m_inputPorts[ i ].Click(); - // need to put the mouse button on a hot state so it will detect the Mouse Up event correctly on the Editor Window - int controlID = GUIUtility.GetControlID( FocusType.Passive ); - //int controlID = GUIUtility.GetControlID( "repeatButton".GetHashCode(), FocusType.Passive, m_inputPorts[ i ].ActivePortArea ); - GUIUtility.hotControl = controlID; - - bool saveReference = true; - if( m_inputPorts[ i ].IsConnected ) - { - double doubleTapTime = EditorApplication.timeSinceStartup; - bool doubleTap = ( doubleTapTime - m_doubleClickTimestamp ) < DoubleClickTime; - m_doubleClickTimestamp = doubleTapTime; - - if( doubleTap ) - { - m_containerGraph.DeleteConnection( true, UniqueId, m_inputPorts[ i ].PortId, true, true ); - Event.current.Use(); - } - else - //if ( AppyModifierToPort( _inputPorts[ i ], true ) ) - //{ - //saveReference = false; - //} - if( !ApplyModifierToPort( m_inputPorts[ i ], true ) ) - { - UIUtils.ShowContextOnPick = false; - PickInput( m_inputPorts[ i ] ); - } - saveReference = false; - } - - if( saveReference && !m_containerGraph.ParentWindow.WireReferenceUtils.InputPortReference.IsValid ) - //if ( !modifierApplied && !UIUtils.InputPortReference.IsValid ) - { - m_containerGraph.ParentWindow.WireReferenceUtils.SetInputReference( m_uniqueId, m_inputPorts[ i ].PortId, m_inputPorts[ i ].DataType, m_inputPorts[ i ].TypeLocked ); - } - - IsDirty = true; - inputCount = m_inputPorts.Count; - } - } - - for( int i = 0; i < outputCount; i++ ) - { - if( m_outputPorts[ i ].Visible && m_outputPorts[ i ].ActivePortArea.Contains( drawInfo.MousePosition ) && drawInfo.LeftMouseButtonPressed ) - { - UIUtils.CurrentWindow.MouseInteracted = true; - m_outputPorts[ i ].Click(); - // need to put the mouse button on a hot state so it will detect the Mouse Up event correctly on the Editor Window - int controlID = GUIUtility.GetControlID( FocusType.Passive ); - //int controlID = GUIUtility.GetControlID( "aseRepeatButton".GetHashCode(), FocusType.Passive, m_outputPorts[ i ].ActivePortArea ); - GUIUtility.hotControl = controlID; - - bool saveReference = true; - if( m_outputPorts[ i ].IsConnected ) - { - if( ApplyModifierToPort( m_outputPorts[ i ], false ) ) - { - saveReference = false; - } - } - - if( saveReference && !m_containerGraph.ParentWindow.WireReferenceUtils.OutputPortReference.IsValid ) - { - m_containerGraph.ParentWindow.WireReferenceUtils.SetOutputReference( m_uniqueId, m_outputPorts[ i ].PortId, m_outputPorts[ i ].DataType, false ); - } - - IsDirty = true; - outputCount = m_outputPorts.Count; - } - } - } - - //Preview buttons - if( m_drawPreviewMaskButtons && ( drawInfo.CurrentEventType == EventType.MouseDown || drawInfo.CurrentEventType == EventType.MouseUp ) ) - DrawPreviewMaskButtonsLayout( drawInfo, m_previewRect ); - } - - /// <summary> - /// Can be used to draw an entire node, runs after wires - /// </summary> - /// <param name="drawInfo"></param> - public virtual void Draw( DrawInfo drawInfo ) - { - if( !m_initialized ) - return; - - if( drawInfo.CurrentEventType == EventType.Repaint ) - OnNodeRepaint( drawInfo ); - } - - public virtual void SetPreviewInputs() - { - if( !HasPreviewShader || !m_initialized ) - return; - - int count = m_inputPorts.Count; - for( int i = 0; i < count; i++ ) - { - if( m_inputPorts[ i ].IsConnected && m_inputPorts[ i ].InputNodeHasPreview( ContainerGraph ) ) - { - m_inputPorts[ i ].SetPreviewInputTexture( ContainerGraph ); - } - else - { - m_inputPorts[ i ].SetPreviewInputValue( ContainerGraph ); - } - } - } - - - public bool SafeDraw( DrawInfo drawInfo ) - { - EditorGUI.BeginChangeCheck(); - Draw( drawInfo ); - if( EditorGUI.EndChangeCheck() ) - { - SaveIsDirty = true; - return true; - } - return false; - } - - public bool ShowTooltip( DrawInfo drawInfo ) - { - if( string.IsNullOrEmpty( m_tooltipText ) ) - return false; - - if( m_globalPosition.Contains( drawInfo.MousePosition ) || m_linkVisibility ) - { - if( m_tooltipTimestamp + 0.6f < Time.realtimeSinceStartup || m_linkVisibility ) - { - bool errorTooltip = false; - if( m_showErrorMessage && m_errorBox.Contains( drawInfo.MousePosition ) && !string.IsNullOrEmpty( m_errorMessageTooltip ) ) - errorTooltip = true; - - Rect globalTooltipPos = m_globalPosition; - GUIContent temp = new GUIContent( errorTooltip ? m_errorMessageTooltip : m_tooltipText ); - UIUtils.TooltipBox.wordWrap = false; - Vector2 optimal = UIUtils.TooltipBox.CalcSize( temp ); - if( optimal.x > 300f ) - { - UIUtils.TooltipBox.wordWrap = true; - optimal.x = 300f; - optimal.y = UIUtils.TooltipBox.CalcHeight( temp, 300f ); - } - - globalTooltipPos.width = Mathf.Max( 120, optimal.x ); - globalTooltipPos.height = optimal.y; - globalTooltipPos.center = m_globalPosition.center; - - if( !errorTooltip && m_hasTooltipLink ) - globalTooltipPos.height += 16; - - if( errorTooltip ) - globalTooltipPos.y = 10 + m_globalPosition.yMax; - else - globalTooltipPos.y = m_globalPosition.yMin - 10 - globalTooltipPos.height; - - if ( globalTooltipPos.x < 10 ) - globalTooltipPos.x = 10; - - if( globalTooltipPos.x + globalTooltipPos.width > Screen.width - 10 ) - globalTooltipPos.x = Screen.width - globalTooltipPos.width - 10; - - //UNCOMMENT this for auto adjust tooltip to the top window box - //if( globalTooltipPos.y < 40 ) - // globalTooltipPos.y = 40; - - if( errorTooltip && globalTooltipPos.y + globalTooltipPos.height > Screen.height - 32 ) - globalTooltipPos.y = Screen.height - 32 - globalTooltipPos.height; - - GUI.Label( globalTooltipPos, temp, UIUtils.TooltipBox ); - - if( !errorTooltip && m_hasTooltipLink ) - { - Rect link = globalTooltipPos; - link.y = globalTooltipPos.yMax - 16; - link.height = 16; - link.width = 86; - link.x = globalTooltipPos.center.x - 43; - Rect hover = globalTooltipPos; - hover.yMax += 15;// m_globalPosition.yMax; - m_linkVisibility = hover.Contains( drawInfo.MousePosition ); - if( link.Contains( drawInfo.MousePosition ) ) - { - if( drawInfo.CurrentEventType == EventType.MouseDown ) - { - if( m_tooltipTimestamp + 1.25f < Time.realtimeSinceStartup ) - { - Application.OpenURL( Attributes.NodeUrl ); - } - } - else - { - UIUtils.MainSkin.customStyles[ 52 ].Draw( link, WikiLinkStr, true, false, false, false ); - } - } - else - { - GUI.Label( link, WikiLinkStr, UIUtils.MainSkin.customStyles[ 52 ] ); - } - } - ContainerGraph.ParentWindow.RequestRepaint(); - return true; - } - } - else - { - if( !m_linkVisibility ) - m_tooltipTimestamp = Time.realtimeSinceStartup; - } - - return false; - } - - public virtual bool SafeDrawProperties() - { - EditorGUI.BeginChangeCheck(); - PreDrawProperties(); - if( m_autoWrapProperties ) - { - NodeUtils.DrawPropertyGroup( ref m_propertiesFoldout, Constants.ParameterLabelStr, DrawProperties ); - } - else - { - DrawProperties(); - } - if( EditorGUI.EndChangeCheck() ) - { - PreviewIsDirty = true; - //UIUtils.RecordObject(this); - //MarkForPreviewUpdate(); - return true; - } - return false; - } - - - public void PreDrawProperties() - { - if( m_useInternalPortData && m_autoDrawInternalPortData ) - { - DrawInternalDataGroup(); - } - } - - virtual public void DrawProperties() { } - - protected void DrawInternalDataGroup() - { - bool drawInternalDataUI = false; - int inputCount = m_inputPorts.Count; - if( inputCount > 0 ) - { - for( int i = 0; i < inputCount; i++ ) - { - if( m_inputPorts[ i ].Available && m_inputPorts[ i ].ValidInternalData && !m_inputPorts[ i ].IsConnected /*&& ( m_inputPorts[ i ].AutoDrawInternalData || ( m_autoDrawInternalPortData && m_useInternalPortData ) )*/ /*&& m_inputPorts[ i ].AutoDrawInternalData*/ ) - { - drawInternalDataUI = true; - break; - } - } - } - - if( drawInternalDataUI ) - NodeUtils.DrawPropertyGroup( ref m_internalDataFoldout, Constants.InternalDataLabelStr, () => - { - 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 ].AutoDrawInternalData*/ ) - { - m_inputPorts[ i ].ShowInternalData( this ); - } - } - } ); - } - - protected void PickInput( InputPort port ) - { - WireReference connection = port.GetConnection( 0 ); - OutputPort from = port.GetOutputConnection( 0 ); - - m_containerGraph.ParentWindow.WireReferenceUtils.OutputPortReference.SetReference( from.NodeId, from.PortId, from.DataType, connection.TypeLocked ); - m_containerGraph.DeleteConnection( true, UniqueId, port.PortId, true, true ); - //TODO: check if not necessary - Event.current.Use(); - IsDirty = true; - SetSaveIsDirty(); - } - - protected bool ApplyModifierToPort( WirePort port, bool isInput ) - { - bool modifierApplied = false; - switch( Event.current.modifiers ) - { - case EventModifiers.Alt: - { - m_containerGraph.DeleteConnection( isInput, UniqueId, port.PortId, true, true ); - modifierApplied = true; - m_containerGraph.ParentWindow.InvalidateAlt(); - } - break; - case EventModifiers.Control: - { - //WireReference connection = port.GetConnection( 0 ); - //if ( isInput ) - //{ - // UIUtils.OutputPortReference.SetReference( connection.NodeId, connection.PortId, connection.DataType, connection.TypeLocked ); - //} - //else - //{ - // UIUtils.InputPortReference.SetReference( connection.NodeId, connection.PortId, connection.DataType, connection.TypeLocked ); - //} - - //UIUtils.DeleteConnection( isInput, UniqueId, port.PortId, true ); - //modifierApplied = true; - - if( !isInput ) - { - WireReference connection = port.GetConnection( 0 ); - m_containerGraph.ParentWindow.WireReferenceUtils.InputPortReference.SetReference( connection.NodeId, connection.PortId, connection.DataType, connection.TypeLocked ); - m_containerGraph.DeleteConnection( isInput, UniqueId, port.PortId, true, true ); - modifierApplied = true; - } - } - break; - } - - if( isInput ) - m_containerGraph.ParentWindow.WireReferenceUtils.SwitchPortReference.SetReference( port.NodeId, port.PortId, port.DataType, false ); //always save last connection - else - m_containerGraph.ParentWindow.WireReferenceUtils.SwitchPortReference.SetReference( -1, -1, WirePortDataType.OBJECT, false ); //invalidate connection - - if( modifierApplied ) - { - Event.current.Use(); - IsDirty = true; - SetSaveIsDirty(); - } - return modifierApplied; - } - - public void DeleteAllInputConnections( bool alsoDeletePorts , bool inhibitWireNodeAutoDel = false ) - { - int count = m_inputPorts.Count; - for( int i = 0; i < count; i++ ) - { - if( m_inputPorts[ i ].IsConnected ) - { - ParentNode connNode = null; - if( inhibitWireNodeAutoDel ) - { - connNode = m_inputPorts[ i ].GetOutputNode(); - connNode.Alive = false; - } - m_containerGraph.DeleteConnection( true, UniqueId, m_inputPorts[ i ].PortId, false, true ); - if( inhibitWireNodeAutoDel ) - { - connNode.Alive = true; - } - } - - } - if( alsoDeletePorts ) - { - m_inputPorts.Clear(); - m_inputPortsDict.Clear(); - } - SetSaveIsDirty(); - } - - public void DeleteAllOutputConnections( bool alsoDeletePorts ) - { - int count = m_outputPorts.Count; - for( int i = 0; i < count; i++ ) - { - if( m_outputPorts[ i ].IsConnected ) - m_containerGraph.DeleteConnection( false, UniqueId, m_outputPorts[ i ].PortId, false, true ); - } - - if( alsoDeletePorts ) - { - m_outputPorts.Clear(); - m_outputPortsDict.Clear(); - } - SetSaveIsDirty(); - } - - public void DeleteInputPortByArrayIdx( int arrayIdx ) - { - if( arrayIdx >= m_inputPorts.Count ) - return; - - m_containerGraph.DeleteConnection( true, UniqueId, m_inputPorts[ arrayIdx ].PortId, false, true ); - m_inputPortsDict.Remove( m_inputPorts[ arrayIdx ].PortId ); - m_inputPorts.RemoveAt( arrayIdx ); - - m_sizeIsDirty = true; - SetSaveIsDirty(); - RecalculateInputPortIdx(); - } - - public void DeleteOutputPortByArrayIdx( int portIdx ) - { - if( portIdx >= m_outputPorts.Count ) - return; - - m_containerGraph.DeleteConnection( false, UniqueId, m_outputPorts[ portIdx ].PortId, false, true ); - m_outputPortsDict.Remove( m_outputPorts[ portIdx ].PortId ); - m_outputPorts.RemoveAt( portIdx ); - m_sizeIsDirty = true; - } - - public InputPort GetInputPortByArrayId( int id ) - { - if( id < m_inputPorts.Count ) - return m_inputPorts[ id ]; - - return null; - } - - public OutputPort GetOutputPortByArrayId( int id ) - { - if( id < m_outputPorts.Count ) - return m_outputPorts[ id ]; - - return null; - } - - public InputPort GetInputPortByUniqueId( int id ) - { - if( m_inputPortsDict.ContainsKey( id ) ) - return m_inputPortsDict[ id ]; - - if( m_inputPortsDict.Count != m_inputPorts.Count ) - m_repopulateDictionaries = true; - - int inputCount = m_inputPorts.Count; - for( int i = 0; i < inputCount; i++ ) - { - if( m_inputPorts[ i ].PortId == id ) - { - return m_inputPorts[ i ]; - } - } - return null; - } - - public OutputPort GetOutputPortByUniqueId( int id ) - { - if( m_outputPortsDict.ContainsKey( id ) ) - return m_outputPortsDict[ id ]; - - if( m_outputPortsDict.Count != m_outputPorts.Count ) - m_repopulateDictionaries = true; - - int outputCount = m_outputPorts.Count; - for( int i = 0; i < outputCount; i++ ) - { - if( m_outputPorts[ i ].PortId == id ) - return m_outputPorts[ i ]; - } - return null; - } - - public virtual void AfterDuplication(){} - - public override string ToString() - { - string dump = ""; - dump += ( "Type: " + GetType() ); - dump += ( " Unique Id: " + UniqueId + "\n" ); - dump += ( " Inputs: \n" ); - - int inputCount = m_inputPorts.Count; - int outputCount = m_outputPorts.Count; - - for( int inputIdx = 0; inputIdx < inputCount; inputIdx++ ) - { - dump += ( m_inputPorts[ inputIdx ] + "\n" ); - } - dump += ( "Outputs: \n" ); - for( int outputIdx = 0; outputIdx < outputCount; outputIdx++ ) - { - dump += ( m_outputPorts[ outputIdx ] + "\n" ); - } - return dump; - } - - public string GetValueFromOutputStr( int outputId, WirePortDataType inputPortType, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if( ignoreLocalvar ) - { - return GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); - } - OutputPort outPort = GetOutputPortByUniqueId( outputId ); - if( outPort.IsLocalValue( dataCollector.PortCategory ) ) - { - if( outPort.DataType != WirePortDataType.OBJECT && outPort.DataType != inputPortType ) - { - return UIUtils.CastPortType( ref dataCollector, CurrentPrecisionType, new NodeCastInfo( m_uniqueId, outputId ), null, outPort.DataType, inputPortType, outPort.LocalValue( dataCollector.PortCategory ) ); - } - else - { - return outPort.LocalValue( dataCollector.PortCategory ); - } - } - - string result = GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); - result = CreateOutputLocalVariable( outputId, result, ref dataCollector ); - - if( outPort.DataType != WirePortDataType.OBJECT && outPort.DataType != inputPortType ) - { - result = UIUtils.CastPortType( ref dataCollector, CurrentPrecisionType, new NodeCastInfo( m_uniqueId, outputId ), null, outPort.DataType, inputPortType, result ); - } - return result; - } - - public virtual string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if( dataCollector.IsSRP ) - { - switch( dataCollector.CurrentSRPType ) - { - case TemplateSRPType.HD: if(OnHDAction!=null) OnHDAction( outputId, ref dataCollector ); break; - case TemplateSRPType.Lightweight:if(OnLightweightAction != null) OnLightweightAction( outputId, ref dataCollector ); break; - } - } - return string.Empty; - } - - public string GenerateValueInVertex( ref MasterNodeDataCollector dataCollector, WirePortDataType dataType, string dataValue, string dataName, bool createInterpolator ) - { - - if( !dataCollector.IsFragmentCategory ) - return dataValue; - - //TEMPLATES - if( dataCollector.IsTemplate ) - { - if( createInterpolator && dataCollector.TemplateDataCollectorInstance.HasCustomInterpolatedData( dataName ) ) - return dataName; - - MasterNodePortCategory category = dataCollector.PortCategory; - dataCollector.PortCategory = MasterNodePortCategory.Vertex; - - dataCollector.PortCategory = category; - - if( createInterpolator ) - { - dataCollector.TemplateDataCollectorInstance.RegisterCustomInterpolatedData( dataName, dataType, CurrentPrecisionType, dataValue ); - } - else - { - dataCollector.AddToVertexLocalVariables( -1, CurrentPrecisionType, dataType, dataName, dataValue ); - } - - return dataName; - } - - //SURFACE - { - if( dataCollector.TesselationActive ) - { - UIUtils.ShowMessage( UniqueId, "Unable to use Vertex to Frag when Tessellation is active" ); - return m_outputPorts[ 0 ].ErrorValue; - } - - if( createInterpolator ) - dataCollector.AddToInput( UniqueId, dataName, dataType, CurrentPrecisionType ); - - MasterNodePortCategory portCategory = dataCollector.PortCategory; - dataCollector.PortCategory = MasterNodePortCategory.Vertex; - if( createInterpolator ) - { - dataCollector.AddLocalVariable( UniqueId, Constants.VertexShaderOutputStr + "." + dataName, dataValue + ";" ); - } - else - { - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, dataType, dataName, dataValue ); - } - dataCollector.PortCategory = portCategory; - return createInterpolator ? Constants.InputVarStr + "." + dataName : dataName; - } - } - - public string GenerateInputInVertex( ref MasterNodeDataCollector dataCollector, int inputPortUniqueId, string varName, bool createInterpolator ) - { - InputPort inputPort = GetInputPortByUniqueId( inputPortUniqueId ); - if( !dataCollector.IsFragmentCategory) - return inputPort.GeneratePortInstructions( ref dataCollector ); - - //TEMPLATES - if( dataCollector.IsTemplate ) - { - if( createInterpolator && dataCollector.TemplateDataCollectorInstance.HasCustomInterpolatedData( varName ) ) - return varName; - - MasterNodePortCategory category = dataCollector.PortCategory; - dataCollector.PortCategory = MasterNodePortCategory.Vertex; - //bool dirtyVertexVarsBefore = dataCollector.DirtyVertexVariables; - //ContainerGraph.ResetNodesLocalVariablesIfNot( this, MasterNodePortCategory.Vertex ); - - string data = inputPort.GeneratePortInstructions( ref dataCollector ); - - dataCollector.PortCategory = category; - //if( !dirtyVertexVarsBefore && dataCollector.DirtyVertexVariables ) - //{ - // dataCollector.AddVertexInstruction( dataCollector.VertexLocalVariablesFromList, UniqueId, false ); - // dataCollector.ClearVertexLocalVariables(); - // ContainerGraph.ResetNodesLocalVariablesIfNot( this, MasterNodePortCategory.Vertex ); - //} - - //ContainerGraph.ResetNodesLocalVariablesIfNot( this, MasterNodePortCategory.Fragment ); - - if( createInterpolator ) - { - dataCollector.TemplateDataCollectorInstance.RegisterCustomInterpolatedData( varName, inputPort.DataType, CurrentPrecisionType, data ); - } - else - { - dataCollector.AddToVertexLocalVariables( -1, CurrentPrecisionType, inputPort.DataType, varName, data ); - } - - return varName; - } - - //SURFACE - { - if( dataCollector.TesselationActive ) - { - UIUtils.ShowMessage( UniqueId, "Unable to use Vertex to Frag when Tessellation is active" ); - return m_outputPorts[ 0 ].ErrorValue; - } - - if( createInterpolator ) - dataCollector.AddToInput( UniqueId, varName, inputPort.DataType, CurrentPrecisionType ); - - MasterNodePortCategory portCategory = dataCollector.PortCategory; - dataCollector.PortCategory = MasterNodePortCategory.Vertex; - - //bool dirtyVertexVarsBefore = dataCollector.DirtyVertexVariables; - - //ContainerGraph.ResetNodesLocalVariablesIfNot( this, MasterNodePortCategory.Vertex ); - - string vertexVarValue = inputPort.GeneratePortInstructions( ref dataCollector ); - if( createInterpolator ) - { - dataCollector.AddLocalVariable( UniqueId, Constants.VertexShaderOutputStr + "." + varName, vertexVarValue + ";" ); - } - else - { - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, inputPort.DataType, varName, vertexVarValue ); - } - - dataCollector.PortCategory = portCategory; - - //if( !dirtyVertexVarsBefore && dataCollector.DirtyVertexVariables ) - //{ - // dataCollector.AddVertexInstruction( dataCollector.VertexLocalVariables, UniqueId, false ); - // dataCollector.ClearVertexLocalVariables(); - // ContainerGraph.ResetNodesLocalVariablesIfNot( this, MasterNodePortCategory.Vertex ); - //} - - //ContainerGraph.ResetNodesLocalVariablesIfNot( this, MasterNodePortCategory.Fragment ); - - return createInterpolator ? Constants.InputVarStr + "." + varName : varName; - } - } - - - protected virtual void OnUniqueIDAssigned() { } - - public string CreateOutputLocalVariable( int outputArrayId, string value, ref MasterNodeDataCollector dataCollector ) - { - OutputPort port = GetOutputPortByUniqueId( outputArrayId ); - - if( port.IsLocalValue( dataCollector.PortCategory ) ) - return port.LocalValue( dataCollector.PortCategory ); - - if( port.ConnectionCount > 1 ) - { - RegisterLocalVariable( outputArrayId, value, ref dataCollector ); - return port.LocalValue( dataCollector.PortCategory ); - } - else - { - // revisit later (break to components case) - port.SetLocalValue( value, dataCollector.PortCategory ); - } - - return value; - } - - public void RegisterLocalVariable( int outputArrayId, string value, ref MasterNodeDataCollector dataCollector, string customName = null ) - { - OutputPort port = GetOutputPortByUniqueId( outputArrayId ); - if( (int)port.DataType >= (int)( 1 << 10 ) ) //10 is the flag start of sampler types - { - port.SetLocalValue( value, dataCollector.PortCategory ); - return; - } - - bool vertexMode = dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation; - string localVar = port.ConfigOutputLocalValue( CurrentPrecisionType, value, customName, dataCollector.PortCategory ); - - if( vertexMode ) - { - dataCollector.AddToVertexLocalVariables( m_uniqueId, localVar ); - } - else - { - dataCollector.AddToLocalVariables( m_uniqueId, localVar ); - } - } - - public void InvalidateConnections() - { - int inputCount = m_inputPorts.Count; - int outputCount = m_outputPorts.Count; - - for( int i = 0; i < inputCount; i++ ) - { - m_inputPorts[ i ].InvalidateAllConnections(); - } - - for( int i = 0; i < outputCount; i++ ) - { - m_outputPorts[ i ].InvalidateAllConnections(); - } - } - - public virtual bool OnClick( Vector2 currentMousePos2D ) - { - bool singleClick = true; - if( ( EditorApplication.timeSinceStartup - m_lastTimeSelected ) < NodeClickTime ) - { - OnNodeDoubleClicked( currentMousePos2D ); - singleClick = false; - } - - m_lastTimeSelected = EditorApplication.timeSinceStartup; - return singleClick; - } - - public virtual void OnNodeDoubleClicked( Vector2 currentMousePos2D ) - { - ContainerGraph.ParentWindow.ParametersWindow.IsMaximized = !ContainerGraph.ParentWindow.ParametersWindow.IsMaximized; - } - - public virtual void OnNodeSelected( bool value ) - { - if( !value ) - { - if( m_inputPorts != null ) - { - int count = m_inputPorts.Count; - for( int i = 0; i < count; i++ ) - { - m_inputPorts[ i ].ResetEditing(); - } - } - - if( m_outputPorts != null ) - { - int count = m_outputPorts.Count; - for( int i = 0; i < count; i++ ) - { - m_outputPorts[ i ].ResetEditing(); - } - } - } - } - - public void ResetOutputLocals() - { - int outputCount = m_outputPorts.Count; - for( int i = 0; i < outputCount; i++ ) - { - m_outputPorts[ i ].ResetLocalValue(); - } - } - - - public void ResetOutputLocalsIfNot( MasterNodePortCategory category ) - { - int outputCount = m_outputPorts.Count; - for( int i = 0; i < outputCount; i++ ) - { - //if( !m_outputPorts[ i ].IsLocalOnCategory( category ) ) - // m_outputPorts[ i ].ResetLocalValue(); - m_outputPorts[ i ].ResetLocalValueIfNot( category ); - } - } - - public virtual void Rewire() { } - - //public virtual List<int> NodeReferences { get { return null; } } - - public int UniqueId - { - get { return m_uniqueId; } - - set - { - m_uniqueId = value; - - int inputCount = m_inputPorts.Count; - int outputCount = m_outputPorts.Count; - - for( int inputIdx = 0; inputIdx < inputCount; inputIdx++ ) - { - m_inputPorts[ inputIdx ].NodeId = value; - } - - for( int outputIdx = 0; outputIdx < outputCount; outputIdx++ ) - { - m_outputPorts[ outputIdx ].NodeId = value; - } - OnUniqueIDAssigned(); - } - } - public void SetBaseUniqueId( int uniqueId, bool setOnPorts = false ) - { - m_uniqueId = uniqueId; - if( setOnPorts ) - { - int inputCount = m_inputPorts.Count; - int outputCount = m_outputPorts.Count; - - for( int inputIdx = 0; inputIdx < inputCount; inputIdx++ ) - { - m_inputPorts[ inputIdx ].NodeId = uniqueId; - } - - for( int outputIdx = 0; outputIdx < outputCount; outputIdx++ ) - { - m_outputPorts[ outputIdx ].NodeId = uniqueId; - } - } - } - - public string OutputId - { - get - { - if( ContainerGraph.GraphId > 0 ) - return UniqueId + "_g" + ContainerGraph.GraphId; - else - return UniqueId.ToString(); - } - } - - - public virtual Rect Position { get { return m_position; } } - public Rect TruePosition { get { return m_position; } } - - public Vector2 CenterPosition { get { return new Vector2( m_position.x + m_position.width * 0.5f, m_position.y + m_position.height * 0.5f ); ; } } - - public Rect GlobalPosition { get { return m_globalPosition; } } - - public Vector2 Corner { get { return new Vector2( m_position.x + m_position.width, m_position.y + m_position.height ); } } - public Vector2 Vec2Position - { - get { return new Vector2( m_position.x, m_position.y ); } - - set - { - m_position.x = value.x; - m_position.y = value.y; - } - } - - public Vector3 Vec3Position - { - get { return new Vector3( m_position.x, m_position.y, 0f ); } - - set - { - m_position.x = value.x; - m_position.y = value.y; - } - } - - - public bool Selected - { - get { return m_selected; } - set - { - m_infiniteLoopDetected = false; - m_selected = value; - OnNodeSelected( value ); - } - } - - public List<InputPort> InputPorts { get { return m_inputPorts; } } - - public List<OutputPort> OutputPorts - { - get { return m_outputPorts; } - } - - public bool IsConnected { get { return m_connStatus == NodeConnectionStatus.Connected; } } - public NodeConnectionStatus ConnStatus - { - get { return m_connStatus; } - set - { - if( m_selfPowered ) - { - m_connStatus = NodeConnectionStatus.Connected; - } - else - { - m_connStatus = value; - } - - switch( m_connStatus ) - { - case NodeConnectionStatus.Island: - case NodeConnectionStatus.Not_Connected: m_statusColor = Constants.NodeDefaultColor; break; - case NodeConnectionStatus.Connected: m_statusColor = Constants.NodeConnectedColor; break; - case NodeConnectionStatus.Error: m_statusColor = Constants.NodeErrorColor; break; - } - - } - } - - public bool SelfPowered - { - set - { - m_selfPowered = value; - if( value ) - { - ConnStatus = NodeConnectionStatus.Connected; - } - } - } - - // This is also called when recording on Undo - public virtual void OnBeforeSerialize() { } - public virtual void OnAfterDeserialize() - { - m_selected = false; - m_isOnGrid = false; - for( int i = 0; i < m_inputPorts.Count; i++ ) - { - m_inputPorts[ i ].ResetWireReferenceStatus(); - } - m_repopulateDictionaries = true; - m_sizeIsDirty = true; - } - - public virtual void ReadFromDeprecated( ref string[] nodeParams, Type oldType = null ) { } - - //Inherited classes must call this base method in order to setup id and position - public virtual void ReadFromString( ref string[] nodeParams ) - { - ParentReadFromString( ref nodeParams ); - } - - public void ParentReadFromString( ref string[] nodeParams ) - { - m_currentReadParamIdx = IOUtils.NodeTypeId + 1; - - UniqueId = Convert.ToInt32( nodeParams[ m_currentReadParamIdx++ ] ); - - string[] posCoordinates = nodeParams[ m_currentReadParamIdx++ ].Split( IOUtils.VECTOR_SEPARATOR ); - - m_position.x = Convert.ToSingle( posCoordinates[ 0 ] ); - m_position.y = Convert.ToSingle( posCoordinates[ 1 ] ); - - if( UIUtils.CurrentShaderVersion() > 22 ) - { - string val = GetCurrentParam( ref nodeParams ); - if( m_customPrecision ) - { - if( val.Equals("Fixed") ) - m_currentPrecisionType = PrecisionType.Half; - else - m_currentPrecisionType = (PrecisionType)Enum.Parse( typeof( PrecisionType ), val ); - } - else - { - m_currentPrecisionType = PrecisionType.Inherit; - } - } - - if( UIUtils.CurrentShaderVersion() > 5004 ) - m_showPreview = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - - } - - //should be called after ReadFromString - public virtual void ReadInputDataFromString( ref string[] nodeParams ) - { - int count = 0; - if( UIUtils.CurrentShaderVersion() > 7003 ) - { - try - { - count = Convert.ToInt32( nodeParams[ m_currentReadParamIdx++ ] ); - } - catch( Exception e ) - { - Debug.LogException( e ); - } - } - else - { - count = ( m_oldInputCount < 0 ) ? m_inputPorts.Count : m_oldInputCount; - } - - for( int i = 0; i < count && i < nodeParams.Length && m_currentReadParamIdx < nodeParams.Length; i++ ) - { - if( UIUtils.CurrentShaderVersion() < 5003 ) - { - int newId = VersionConvertInputPortId( i ); - if( UIUtils.CurrentShaderVersion() > 23 ) - { - m_inputPorts[ newId ].DataType = (WirePortDataType)Enum.Parse( typeof( WirePortDataType ), nodeParams[ m_currentReadParamIdx++ ] ); - } - - m_inputPorts[ newId ].InternalData = nodeParams[ m_currentReadParamIdx++ ]; - if( m_inputPorts[ newId ].IsEditable && UIUtils.CurrentShaderVersion() >= 3100 && m_currentReadParamIdx < nodeParams.Length ) - { - m_inputPorts[ newId ].Name = nodeParams[ m_currentReadParamIdx++ ]; - } - m_inputPorts[ newId ].UpdatePreviewInternalData(); - } - else - { - string portIdStr = nodeParams[ m_currentReadParamIdx++ ]; - int portId = -1; - try - { - portId = Convert.ToInt32( portIdStr ); - } - catch( Exception e ) - { - Debug.LogException( e ); - } - - WirePortDataType DataType = (WirePortDataType)Enum.Parse( typeof( WirePortDataType ), nodeParams[ m_currentReadParamIdx++ ] ); - string InternalData = nodeParams[ m_currentReadParamIdx++ ]; - bool isEditable = Convert.ToBoolean( nodeParams[ m_currentReadParamIdx++ ] ); - string Name = string.Empty; - if( isEditable && m_currentReadParamIdx < nodeParams.Length ) - { - Name = nodeParams[ m_currentReadParamIdx++ ]; - } - - InputPort inputPort = GetInputPortByUniqueId( portId ); - if( inputPort != null ) - { - if( UIUtils.IsValidType( DataType ) ) - inputPort.DataType = DataType; - - inputPort.InternalData = InternalData; - if( !string.IsNullOrEmpty( Name ) ) - { - inputPort.Name = Name; - } - inputPort.UpdatePreviewInternalData(); - } - } - } - } - - public virtual void ReadOutputDataFromString( ref string[] nodeParams ) - { - int count = 0; - if( UIUtils.CurrentShaderVersion() > 7003 ) - { - count = Convert.ToInt32( nodeParams[ m_currentReadParamIdx++ ] ); - } - else - { - count = m_outputPorts.Count; - } - - for( int i = 0; i < count && i < nodeParams.Length && m_currentReadParamIdx < nodeParams.Length; i++ ) - { - try - { - WirePortDataType dataType = (WirePortDataType)Enum.Parse( typeof( WirePortDataType ), nodeParams[ m_currentReadParamIdx++ ] ); - int portId = -1; - if( UIUtils.CurrentShaderVersion() > 13903 ) - { - portId = Convert.ToInt32( nodeParams[ m_currentReadParamIdx++ ] ); ; - } - else - { - portId = i; - } - - OutputPort port = GetOutputPortByUniqueId( portId ); - if( port != null && UIUtils.IsValidType( dataType ) ) - { - port.DataType = dataType; - } - - } - catch( Exception e ) - { - Debug.LogException( e ); - } - } - } - - public virtual void ReadAdditionalClipboardData( ref string[] nodeParams ) { } - - protected string GetCurrentParam( ref string[] nodeParams ) - { - if( m_currentReadParamIdx < nodeParams.Length ) - { - return nodeParams[ m_currentReadParamIdx++ ]; - } - - UIUtils.ShowMessage( UniqueId, "Invalid params number in node " + m_uniqueId + " of type " + GetType(), MessageSeverity.Error ); - return string.Empty; - } - - protected string GetCurrentParam( int index, ref string[] nodeParams ) - { - if( m_currentReadParamIdx < nodeParams.Length ) - { - return nodeParams[ index ]; - } - - UIUtils.ShowMessage( UniqueId, "Invalid params number in node " + m_uniqueId + " of type " + GetType(), MessageSeverity.Error ); - return string.Empty; - } - - - public virtual void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - IOUtils.AddTypeToString( ref nodeInfo, IOUtils.NodeParam ); - IOUtils.AddFieldValueToString( ref nodeInfo, GetType() ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_uniqueId ); - IOUtils.AddFieldValueToString( ref nodeInfo, ( m_position.x.ToString() + IOUtils.VECTOR_SEPARATOR + m_position.y.ToString() ) ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_currentPrecisionType ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_showPreview ); - for( int i = 0; i < m_inputPorts.Count; i++ ) - { - m_inputPorts[ i ].WriteToString( ref connectionsInfo ); - } - } - - public virtual void WriteInputDataToString( ref string nodeInfo ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_inputPorts.Count ); - for( int i = 0; i < m_inputPorts.Count; i++ ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_inputPorts[ i ].PortId ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_inputPorts[ i ].DataType ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_inputPorts[ i ].InternalData ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_inputPorts[ i ].IsEditable ); - if( m_inputPorts[ i ].IsEditable ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_inputPorts[ i ].Name ); - } - } - } - - public void WriteOutputDataToString( ref string nodeInfo ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_outputPorts.Count ); - for( int i = 0; i < m_outputPorts.Count; i++ ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_outputPorts[ i ].DataType ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_outputPorts[ i ].PortId ); - } - } - - public virtual void WriteAdditionalClipboardData( ref string nodeInfo ) { } - - public virtual string GetIncludes() { return string.Empty; } - public virtual void OnObjectDropped( UnityEngine.Object obj ) { } - public virtual void SetupFromCastObject( UnityEngine.Object obj ) { } - public virtual bool OnNodeInteraction( ParentNode node ) { return false; } - public virtual void OnConnectedOutputNodeChanges( int portId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) { } - public virtual void OnConnectedInputNodeChanges( int portId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) { } - - public Rect CachedPos { get { return m_cachedPos; } } - - public bool IsOnGrid - { - set { m_isOnGrid = value; } - get { return m_isOnGrid; } - } - - public uint CurrentReadParamIdx - { - get { return m_currentReadParamIdx++; } - set { m_currentReadParamIdx = value; } - } - - public Dictionary<string, InputPort> InputPortsDict - { - get - { - Dictionary<string, InputPort> dict = new Dictionary<string, InputPort>(); - for( int i = 0; i < m_inputPorts.Count; i++ ) - { - dict.Add( m_inputPorts[ i ].Name, m_inputPorts[ i ] ); - } - return dict; - } - } - - public bool IsDirty - { - set { m_isDirty = value && UIUtils.DirtyMask; } - get - { - bool value = m_isDirty; - m_isDirty = false; - return value; - } - } - - public virtual void ResetNodeData() - { - m_category = 0; - m_graphDepth = 0; - } - - public virtual void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) - { - UIUtils.SetCategoryInBitArray( ref m_category, nodeData.Category ); - nodeData.GraphDepth += 1; - if( nodeData.GraphDepth > m_graphDepth ) - { - m_graphDepth = nodeData.GraphDepth; - } - int count = m_inputPorts.Count; - for( int i = 0; i < count; i++ ) - { - if( m_inputPorts[ i ].IsConnected ) - { - m_inputPorts[ i ].GetOutputNode().PropagateNodeData( nodeData, ref dataCollector ); - } - } - } - - public void SetTitleTextOnCallback( string compareTitle, Action<ParentNode, string> callback ) - { - if( !m_previousTitle.Equals( compareTitle ) ) - { - m_previousTitle = compareTitle; - m_sizeIsDirty = true; - callback( this, compareTitle ); - } - } - - public void SetAdditonalTitleTextOnCallback( string compareTitle, Action<ParentNode, string> callback ) - { - if( !m_previousAdditonalTitle.Equals( compareTitle ) ) - { - m_previousAdditonalTitle = compareTitle; - m_sizeIsDirty = true; - callback( this, compareTitle ); - } - } - - public virtual void SetClippedTitle( string newText, int maxSize = 170, string endString = "..." ) - { - m_content.text = GenerateClippedTitle( newText,maxSize,endString ); - m_sizeIsDirty = true; - } - - public virtual void SetClippedAdditionalTitle( string newText, int maxSize = 170, string endString = "..." ) - { - m_additionalContent.text = GenerateClippedTitle( newText, maxSize, endString ); - m_sizeIsDirty = true; - } - - - public void SetTitleText( string newText ) - { - if( !newText.Equals( m_content.text ) ) - { - m_content.text = newText; - m_sizeIsDirty = true; - } - } - - public void SetAdditonalTitleText( string newText ) - { - if( !newText.Equals( m_additionalContent.text ) ) - { - m_additionalContent.text = newText; - m_sizeIsDirty = true; - } - } - - public string GenerateErrorValue( int outputIdx = 0 ) - { - switch( m_outputPorts[ outputIdx ].DataType ) - { - case WirePortDataType.FLOAT2: - { - return "(0).xx"; - } - case WirePortDataType.FLOAT3: - { - return "(0).xxx"; - } - case WirePortDataType.FLOAT4: - case WirePortDataType.COLOR: - { - return "(0).xxxx"; - } - } - return "0"; - } - - //Methods created to take into account new ports added on nodes newer versions - //This way we can convert connections from previous versions to newer ones and not brake shader graph - public virtual int VersionConvertInputPortId( int portId ) { return portId; } - public virtual int VersionConvertOutputPortId( int portId ) { return portId; } - - public virtual string DataToArray { get { return string.Empty; } } - - public bool SaveIsDirty - { - set { m_saveIsDirty = value && UIUtils.DirtyMask; } - get - { - bool value = m_saveIsDirty; - m_saveIsDirty = false; - return value; - } - } - - public GUIContent TitleContent { get { return m_content; } } - public GUIContent AdditonalTitleContent { get { return m_additionalContent; } } - public bool IsVisible { get { return m_isVisible; } } - public NodeAttributes Attributes { get { return m_nodeAttribs; } } - public bool ReorderLocked { get { return m_reorderLocked; } } - public bool RequireMaterialUpdate { get { return m_requireMaterialUpdate; } } - public bool RMBIgnore { get { return m_rmbIgnore; } } - public float TextLabelWidth { get { return m_textLabelWidth; } } - public bool IsMoving { get { return m_isMoving > 0; } } - public bool MovingInFrame { get { return m_movingInFrame; } set { m_movingInFrame = value; } } - public bool SizeIsDirty { get { return m_sizeIsDirty; } set { m_sizeIsDirty = value; } } - public int Category { get { return m_category; } } - public int CommentaryParent - { - get { return m_commentaryParent; } - set { m_commentaryParent = value; } - } - - public int Depth - { - get { return m_depth; } - set { m_depth = value; } - } - - public int MatrixId - { - get { return m_matrixId; } - set { m_matrixId = value; } - } - - public float PaddingTitleRight - { - get { return m_paddingTitleRight; } - set { m_paddingTitleRight += value; } - } - - public float PaddingTitleLeft - { - get { return m_paddingTitleLeft; } - set { m_paddingTitleLeft += value; } - } - - public int CachedPortsId - { - get - { - return m_cachedPortsId; - } - } - - public virtual bool RecursivePreviewUpdate( Dictionary<string,bool> duplicatesDict = null ) - { - if( duplicatesDict == null ) - { - duplicatesDict = ContainerGraph.ParentWindow.VisitedChanged; - } - - for( int i = 0; i < InputPorts.Count; i++ ) - { - ParentNode outNode = null; - if( InputPorts[ i ].ExternalReferences.Count > 0 ) - { - outNode = ContainerGraph.GetNode( InputPorts[ i ].ExternalReferences[ 0 ].NodeId ); - } - if( outNode != null ) - { - if( !duplicatesDict.ContainsKey( outNode.OutputId ) ) - { - bool result = outNode.RecursivePreviewUpdate(); - if( result ) - PreviewIsDirty = true; - } else if( duplicatesDict[ outNode.OutputId ] ) - { - PreviewIsDirty = true; - } - } - } - - bool needsUpdate = PreviewIsDirty; - RenderNodePreview(); - if( !duplicatesDict.ContainsKey( OutputId ) ) - duplicatesDict.Add( OutputId, needsUpdate ); - return needsUpdate; - } - - public virtual void RenderNodePreview() - { - //Runs at least one time - if( !HasPreviewShader || !m_initialized ) - { - // nodes with no preview don't update at all - PreviewIsDirty = false; - return; - } - - if( !PreviewIsDirty && !m_continuousPreviewRefresh ) - return; - - //Debug.Log( "PREVIEW " + this ); - - SetPreviewInputs(); - - if( m_cachedMainTexId == -1 ) - m_cachedMainTexId = Shader.PropertyToID( "_MainTex" ); - - if( m_cachedMaskTexId == -1 ) - m_cachedMaskTexId = Shader.PropertyToID( "_MaskTex" ); - - if( m_cachedPortsId == -1 ) - m_cachedPortsId = Shader.PropertyToID( "_Ports" ); - - if( m_cachedPortId == -1 ) - m_cachedPortId = Shader.PropertyToID( "_Port" ); - - int count = m_outputPorts.Count; - for( int i = 0; i < count; i++ ) - { - if( i == 0 ) - { - RenderTexture temp = RenderTexture.active; - RenderTexture beforeMask = RenderTexture.GetTemporary( PreviewWidth, PreviewHeight, 0, RenderTextureFormat.ARGBFloat, RenderTextureReadWrite.Linear ); - RenderTexture.active = beforeMask; - Graphics.Blit( null, beforeMask, PreviewMaterial, m_previewMaterialPassId ); - - m_portMask.Set( 0, 0, 0, 0 ); - - switch( m_outputPorts[ i ].DataType ) - { - case WirePortDataType.INT: - case WirePortDataType.FLOAT: - m_portMask.Set( 1, 1, 1, 1 ); - break; - case WirePortDataType.FLOAT2: - m_portMask.Set( 1, 1, 0, 0 ); - break; - case WirePortDataType.FLOAT3: - m_portMask.Set( 1, 1, 1, 0 ); - break; - case WirePortDataType.COLOR: - case WirePortDataType.FLOAT4: - m_portMask.Set( 1, 1, 1, 1 ); - break; - default: - m_portMask.Set( 1, 1, 1, 1 ); - break; - } - - if( m_outputPorts[ i ].DataType == WirePortDataType.FLOAT3x3 || m_outputPorts[ i ].DataType == WirePortDataType.FLOAT4x4 ) - { - m_outputPorts[ i ].MaskingMaterial.SetTexture( m_cachedMainTexId, EditorGUIUtility.whiteTexture ); - } - else - { - m_outputPorts[ i ].MaskingMaterial.SetTexture( m_cachedMainTexId, beforeMask ); - } - m_outputPorts[ i ].MaskingMaterial.SetVector( m_cachedPortsId, m_portMask ); - RenderTexture.active = m_outputPorts[ i ].OutputPreviewTexture; - Graphics.Blit( null, m_outputPorts[ i ].OutputPreviewTexture, m_outputPorts[ i ].MaskingMaterial, 0 ); - - RenderTexture.ReleaseTemporary( beforeMask ); - RenderTexture.active = temp; - } - else - { - RenderTexture temp = RenderTexture.active; - m_outputPorts[ i ].MaskingMaterial.SetTexture( m_cachedMaskTexId, PreviewTexture ); - m_outputPorts[ i ].MaskingMaterial.SetFloat( m_cachedPortId, i ); - - RenderTexture.active = m_outputPorts[ i ].OutputPreviewTexture; - Graphics.Blit( null, m_outputPorts[ i ].OutputPreviewTexture, m_outputPorts[ i ].MaskingMaterial, 1 ); - RenderTexture.active = temp; - } - } - - PreviewIsDirty = m_continuousPreviewRefresh; - - FinishPreviewRender = true; - } - - protected void ShowTab( NodeMessageType type, string tooltip ) - { - m_showErrorMessage = true; - m_errorMessageTypeIsError = type; - m_errorMessageTooltip = tooltip; - } - - protected void ShowTab() - { - m_showErrorMessage = true; - } - - protected void HideTab() - { - m_showErrorMessage = false; - } - - public virtual RenderTexture PreviewTexture - { - get - { - if( m_outputPorts.Count > 0 ) - return m_outputPorts[ 0 ].OutputPreviewTexture; - else - return null; - } - } - - public void FullWriteToString( ref string nodesInfo, ref string connectionsInfo ) - { - WriteToString( ref nodesInfo, ref connectionsInfo ); - WriteInputDataToString( ref nodesInfo ); - WriteOutputDataToString( ref nodesInfo ); - } - - public void ClipboardFullWriteToString( ref string nodesInfo, ref string connectionsInfo ) - { - FullWriteToString( ref nodesInfo, ref connectionsInfo ); - WriteAdditionalClipboardData( ref nodesInfo ); - } - - public void FullReadFromString( ref string[] parameters ) - { - try - { - ReadFromString( ref parameters ); - ReadInputDataFromString( ref parameters ); - ReadOutputDataFromString( ref parameters ); - } - catch( Exception e ) - { - Debug.LogException( e ); - } - } - - public void ClipboardFullReadFromString( ref string[] parameters ) - { - try - { - FullReadFromString( ref parameters ); - ReadAdditionalClipboardData( ref parameters ); - } - catch( Exception e ) - { - Debug.LogException( e ); - } - } - - public string GenerateClippedTitle( string original , int maxSize = 170, string endString = "..." ) - { - if( UIUtils.UnZoomedNodeTitleStyle == null ) - return original; - - GUIContent content = new GUIContent( original ); - - string finalTitle = string.Empty; - bool addEllipsis = false; - for( int i = 1; i <= original.Length; i++ ) - { - content.text = original.Substring( 0, i ); - Vector2 titleSize = UIUtils.UnZoomedNodeTitleStyle.CalcSize( content ); - if( titleSize.x > maxSize ) - { - addEllipsis = true; - break; - } - else - { - finalTitle = content.text; - } - } - if( addEllipsis ) - finalTitle += endString; - - return finalTitle; - } - - public virtual void RefreshOnUndo() { } - public virtual void CalculateCustomGraphDepth() { } - public int GraphDepth { get { return m_graphDepth; } } - - public PrecisionType CurrentPrecisionType { get { return m_currentPrecisionType == PrecisionType.Inherit ? ContainerGraph.CurrentPrecision : m_currentPrecisionType; } } - - - public Material PreviewMaterial - { - get - { - if( m_previewMaterial == null ) - { - m_previewMaterial = new Material( PreviewShader ); - } - return m_previewMaterial; - } - } - - public Shader PreviewShader - { - get - { - if( m_previewShader == null ) - { - m_previewShader = AssetDatabase.LoadAssetAtPath<Shader>( AssetDatabase.GUIDToAssetPath( m_previewShaderGUID ) ); - } - - if( m_previewShader == null ) - { - m_previewShader = AssetDatabase.LoadAssetAtPath<Shader>( AssetDatabase.GUIDToAssetPath( "d9ca47581ac157145bff6f72ac5dd73e" ) ); //ranged float guid - } - - if( m_previewShader == null ) - m_previewShader = Shader.Find( "Unlit/Colored Transparent" ); - - return m_previewShader; - } - } - - public bool HasPreviewShader - { - get { return !string.IsNullOrEmpty( m_previewShaderGUID ); } - } - - public void CheckSpherePreview() - { - bool oneIsSphere = false; - - if( m_drawPreviewAsSphere ) - oneIsSphere = true; - int count = m_inputPorts.Count; - for( int i = 0; i < count; i++ ) - { - ParentNode node = null; - if( m_inputPorts[ i ].ExternalReferences.Count > 0) - { - node = ContainerGraph.GetNode( m_inputPorts[ i ].ExternalReferences[ 0 ].NodeId ); - } - if( node != null && node.SpherePreview ) - oneIsSphere = true; - } - - if( m_forceDrawPreviewAsPlane ) - oneIsSphere = false; - - SpherePreview = oneIsSphere; - } - - public bool SpherePreview - { - get { return m_spherePreview; } - set { m_spherePreview = value; } - } - - public bool ShowPreview - { - get { return m_showPreview; } - set { m_showPreview = value; } - } - - public int VisiblePorts - { - get { return m_visiblePorts; } - set { m_visiblePorts = value; } - } - - public bool Docking - { - get { return m_docking; } - set { m_docking = value; } - } - - public bool UseSquareNodeTitle - { - get { return m_useSquareNodeTitle; } - set { m_useSquareNodeTitle = value; } - } - - public bool InsideShaderFunction - { - get { return ContainerGraph != ContainerGraph.ParentWindow.CurrentGraph; } - } - - public virtual void SetContainerGraph( ParentGraph newgraph ) - { - m_containerGraph = newgraph; - } - public virtual void OnMasterNodeReplaced( MasterNode newMasterNode ) { } - public virtual void RefreshExternalReferences() { } - - public Rect DropdownRect { get { return m_dropdownRect; } } - - public virtual bool Contains( Vector2 pos ) { return m_globalPosition.Contains( pos ); } - public virtual bool Contains( Vector3 pos ) { return m_globalPosition.Contains( pos ); } - public bool IsNodeBeingCopied { get { return m_isNodeBeingCopied; } set { m_isNodeBeingCopied = value; } } - - public virtual WirePortDataType GetInputPortVisualDataTypeByArrayIdx( int portArrayIdx ) - { - return m_inputPorts[ portArrayIdx ].DataType; - } - - public virtual WirePortDataType GetOutputPortVisualDataTypeById( int portId ) - { - return GetOutputPortByUniqueId( portId ).DataType; - } - - - public virtual bool CheckFindText( string text ) - { - return TitleContent.text.IndexOf( text, StringComparison.CurrentCultureIgnoreCase ) >= 0; - } - - public virtual float HeightEstimate - { - get - { - float heightEstimate = 0; - heightEstimate = 32 + Constants.INPUT_PORT_DELTA_Y; - for( int i = 0; i < InputPorts.Count; i++ ) - { - if( InputPorts[ i ].Visible ) - heightEstimate += 18 + Constants.INPUT_PORT_DELTA_Y; - } - - return heightEstimate; - // Magic number 18 represents m_fontHeight that might not be set yet - //return Constants.NODE_HEADER_EXTRA_HEIGHT + Mathf.Max( 18 + m_inputPorts.Count, m_outputPorts.Count ) * Constants.INPUT_PORT_DELTA_Y; - } - } - public bool Alive { get { return m_alive;} set { m_alive = value; } } - public string TypeName { get { if( m_nodeAttribs != null ) return m_nodeAttribs.Name;return GetType().ToString(); } } - public bool PreviewIsDirty { set { m_previewIsDirty = value; } get { return m_previewIsDirty; } } - protected bool FinishPreviewRender { get { return m_finishPreviewRender; } set { m_finishPreviewRender = value; } } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ParentNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ParentNode.cs.meta deleted file mode 100644 index c3a66c87..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ParentNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 33e0374f361d5c642a257b9957e4cfa0 -timeCreated: 1481126954 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ReordenatorNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ReordenatorNode.cs deleted file mode 100644 index 8bd85dc4..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ReordenatorNode.cs +++ /dev/null @@ -1,170 +0,0 @@ -using UnityEngine; -using System; -using System.Collections; -using System.Collections.Generic; - -namespace AmplifyShaderEditor -{ - [Serializable] - public class ReordenatorNode : PropertyNode - { - [SerializeField] - private List<PropertyNode> m_propertyList; - - [SerializeField] - private string m_headerTitle = string.Empty; - - [SerializeField] - private bool m_isInside; - - public ReordenatorNode() : base() - { - - } - - public void Init( string entryName, string entryInspectorName, List<PropertyNode> list, bool register = true ) - { - m_propertyName = entryName; - m_propertyInspectorName = entryInspectorName; - - m_propertyList = list; - - if( register ) - UIUtils.RegisterPropertyNode( this ); - } - - public override void Destroy() - { - base.Destroy(); - - m_propertyList.Clear(); - m_propertyList = null; - - UIUtils.UnregisterPropertyNode( this ); - } - - //public List<ParentNode> PropertyList - //{ - // get { return m_propertyList; } - //} - - public int PropertyListCount - { - get { if ( m_propertyList != null ) return m_propertyList.Count; else return -1; } - } - - public string HeaderTitle { get { return m_headerTitle; } set { m_headerTitle = value; } } - - public bool HasTitle { get { return !string.IsNullOrEmpty( m_headerTitle ); } } - - public bool IsInside { get { return m_isInside; } set { m_isInside = value; } } - - public int RecursiveSetOrderOffset( int offset, bool lockit, int order = -1 ) - { - //Debug.Log( Locked + " " + PropertyName ); - - if ( Locked ) - return offset; - - if( order > -1 ) - OrderIndex = order; - - int currentOffset = offset; - - if( m_propertyList != null ) - m_propertyList.Sort( ( x, y ) => { return ( x as PropertyNode ).OrderIndex.CompareTo( ( y as PropertyNode ).OrderIndex ); } ); - - OrderIndexOffset = currentOffset - RawOrderIndex; - currentOffset++; - - if ( m_propertyList != null ) - for ( int i = 0; i < m_propertyList.Count; i++ ) - { - ReordenatorNode rnode = m_propertyList[ i ] as ReordenatorNode; - if ( rnode != null ) - { - currentOffset = rnode.RecursiveSetOrderOffset( currentOffset, false ); - } - else - { - PropertyNode pnode = m_propertyList[ i ] as PropertyNode; - { - pnode.OrderIndexOffset = currentOffset - pnode.RawOrderIndex;// + ( HasTitle ? 1 : 0 ); - } - currentOffset++; - } - } - - if ( lockit ) - Locked = true; - - return currentOffset; - } - - public int RecursiveCount() - { - int amount = 0; - if ( HasTitle ) - amount += 1; - for ( int i = 0; i < m_propertyList.Count; i++ ) - { - if ( ( m_propertyList[ i ] is ReordenatorNode ) ) - amount += ( m_propertyList[ i ] as ReordenatorNode ).RecursiveCount(); - else - amount +=1; - } - return amount; - } - - public void RecursiveLog() - { - Debug.LogWarning( OrderIndex+" HEADER "+ PropertyName ); - for( int i = 0; i < m_propertyList.Count; i++ ) - { - if( ( m_propertyList[ i ] is ReordenatorNode ) ) - ( m_propertyList[ i ] as ReordenatorNode ).RecursiveLog(); - else - Debug.Log( ( m_propertyList[ i ] as PropertyNode ).OrderIndex+" "+( m_propertyList[ i ] as PropertyNode).PropertyName ); - } - } - - public bool Locked = false; - - public void RecursiveClear() - { - Locked = false; - if( m_propertyList != null) - for ( int i = 0; i < m_propertyList.Count; i++ ) - { - ReordenatorNode renode = ( m_propertyList[ i ] as ReordenatorNode ); - if ( renode != null ) - { - renode.RecursiveClear(); - } - } - } - - public bool RecursiveConnectedProperties() - { - bool connected = false; - if ( m_propertyList != null ) - { - for ( int i = 0; i < m_propertyList.Count; i++ ) - { - ReordenatorNode renode = ( m_propertyList[ i ] as ReordenatorNode ); - if ( renode != null ) - { - bool temp = renode.RecursiveConnectedProperties(); - if( temp ) - connected = true; - } else - { - if ( ( m_propertyList[ i ] as PropertyNode ).IsConnected ) - connected = true; - } - } - } - return connected; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ReordenatorNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ReordenatorNode.cs.meta deleted file mode 100644 index 8dc50376..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/ReordenatorNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 91aad2b9cfaf3954c8c450c32d218981 -timeCreated: 1493053838 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP.meta deleted file mode 100644 index 11d8b84b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 7283c593c3b4be64e957cb2b91abe1af -folderAsset: yes -timeCreated: 1556618802 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/BakedGINode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/BakedGINode.cs deleted file mode 100644 index 7a67f480..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/BakedGINode.cs +++ /dev/null @@ -1,107 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -#if UNITY_2018_3_OR_NEWER -using System; -using UnityEngine; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "SRP Baked GI", "Miscellaneous", "Gets Baked GI info." )] - public sealed class BakedGINode : ParentNode - { - private const string HDBakedGIHeader = "ASEBakedGI( {0}, {1}, {2}, {3} )"; - private readonly string[] HDBakedGIBody = - { - "float3 ASEBakedGI( float3 positionWS, float3 normalWS, float2 uvStaticLightmap, float2 uvDynamicLightmap )\n", - "{\n", - "\tfloat3 positionRWS = GetCameraRelativePositionWS( positionWS );\n", - "\treturn SampleBakedGI( positionRWS, normalWS, uvStaticLightmap, uvDynamicLightmap );\n", - "}\n" - }; - - private readonly string LWBakedGIHeader = "ASEBakedGI( {0}, {1}, {2})"; - private readonly string[] LWBakedGIBody = - { - "float3 ASEBakedGI( float3 normalWS, float2 uvStaticLightmap, bool applyScaling )\n", - "{\n", - "#ifdef LIGHTMAP_ON\n", - "\tif( applyScaling )\n", - "\t\tuvStaticLightmap = uvStaticLightmap * unity_LightmapST.xy + unity_LightmapST.zw;\n", - "\treturn SampleLightmap( uvStaticLightmap, normalWS );\n", - "#else\n", - "\treturn SampleSH(normalWS);\n", - "#endif\n", - "}\n" - }; - - private const string ApplyScalingStr = "Apply Scaling"; - - [SerializeField] - private bool m_applyScaling = true; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT3, false, "World Position" ); - AddInputPort( WirePortDataType.FLOAT3, false, "World Normal" ); - AddInputPort( WirePortDataType.FLOAT2, false, "Static UV" ); - AddInputPort( WirePortDataType.FLOAT2, false, "Dynamic UV" ); - AddOutputPort( WirePortDataType.FLOAT3, Constants.EmptyPortValue ); - m_textLabelWidth = 95; - m_autoWrapProperties = true; - } - - public override void DrawProperties() - { - base.DrawProperties(); - m_applyScaling = EditorGUILayoutToggle( ApplyScalingStr, m_applyScaling ); - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if( !dataCollector.IsSRP ) - { - UIUtils.ShowMessage( "Node only intended to use on HD and Lightweight rendering pipelines" ); - return GenerateErrorValue(); - } - - if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) - return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); - - string positionWS = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - string normalWS = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); - string uvStaticLightmap = m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ); - string uvDynamicLightmap = m_inputPorts[ 3 ].GeneratePortInstructions( ref dataCollector ); - string localVarName = "bakedGI" + OutputId; - - if( dataCollector.TemplateDataCollectorInstance.IsHDRP ) - { - dataCollector.AddFunction( HDBakedGIBody[ 0 ], HDBakedGIBody, false ); - RegisterLocalVariable( 0, string.Format( HDBakedGIHeader, positionWS, normalWS, uvStaticLightmap, uvDynamicLightmap ), ref dataCollector, localVarName ); - } - else - { - dataCollector.AddFunction( LWBakedGIBody[ 0 ], LWBakedGIBody, false ); - RegisterLocalVariable( 0, string.Format( LWBakedGIHeader, normalWS, uvStaticLightmap, m_applyScaling?"true":"false" ), ref dataCollector, localVarName ); - } - return localVarName; - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - m_applyScaling = 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_applyScaling ); - } - - - } -} -#endif diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/BakedGINode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/BakedGINode.cs.meta deleted file mode 100644 index e988a134..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/BakedGINode.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 6aacdecbe4e41f44988580058f7e0000 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/MaterialQualityNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/MaterialQualityNode.cs deleted file mode 100644 index b1721938..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/MaterialQualityNode.cs +++ /dev/null @@ -1,85 +0,0 @@ -// Amplify Shader Editor - Visual Shader vEditing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEngine; -using UnityEditor; -using System; - -namespace AmplifyShaderEditor -{ - [NodeAttributes( "Material Quality", "Logical Operators", "Choose between separate branches according to currently selected Quality (SRP only) ", Available = true )] - public class MaterialQualityNode : ParentNode - { - private const string SRPError = "Node intended to be used only on SRP templates as it makes use of keywords defined over that environment."; - - private const string MaxKeyword = "MATERIAL_QUALITY_HIGH"; - private const string MedKeyword = "MATERIAL_QUALITY_MEDIUM"; - private const string MinKeyword = "MATERIAL_QUALITY_LOW"; - private const string MaterialPragmas = "#pragma shader_feature " + MaxKeyword + " " + MedKeyword + " " + MinKeyword; - private readonly string[] MaterialCode = - { - "#if defined("+MaxKeyword+")", - "#elif defined("+MedKeyword+")", - "#else", - "#endif" - }; - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT, false, "High" ); - AddInputPort( WirePortDataType.FLOAT, false, "Medium" ); - AddInputPort( WirePortDataType.FLOAT, false, "Low" ); - AddOutputPort( WirePortDataType.FLOAT, Constants.EmptyPortValue ); - m_errorMessageTypeIsError = NodeMessageType.Error; - m_errorMessageTooltip = SRPError; - } - - public override void OnNodeLogicUpdate( DrawInfo drawInfo ) - { - base.OnNodeLogicUpdate( drawInfo ); - if( !ContainerGraph.IsSRP ) - { - if( !m_showErrorMessage ) - { - m_showErrorMessage = true; - } - } - else - { - if( m_showErrorMessage ) - { - m_showErrorMessage = 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 ); - - dataCollector.AddToDirectives( MaterialPragmas ); - string maxQualityValue = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - string medQualityValue = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); - string minQualityValue = m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ); - string localVarName = "currQuality" + OutputId; - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, m_outputPorts[ 0 ].DataType, localVarName, "0" ); - - //High - dataCollector.AddLocalVariable( UniqueId, MaterialCode[ 0 ], true ); - dataCollector.AddLocalVariable( UniqueId, localVarName, maxQualityValue, false, true ); - - //Medium - dataCollector.AddLocalVariable( UniqueId, MaterialCode[ 1 ], true ); - dataCollector.AddLocalVariable( UniqueId, localVarName, medQualityValue, false, true ); - - //Low - dataCollector.AddLocalVariable( UniqueId, MaterialCode[ 2 ], true ); - dataCollector.AddLocalVariable( UniqueId, localVarName, minQualityValue,false,true ); - m_outputPorts[ 0 ].SetLocalValue( localVarName, dataCollector.PortCategory ); - - dataCollector.AddLocalVariable( UniqueId, MaterialCode[ 3 ], true ); - return localVarName; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/MaterialQualityNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/MaterialQualityNode.cs.meta deleted file mode 100644 index a322f3bb..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SRP/MaterialQualityNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 8245233e0833c884b8a176943d80514b -timeCreated: 1570027418 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SignalGeneratorNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SignalGeneratorNode.cs deleted file mode 100644 index 1e8c6d49..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SignalGeneratorNode.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System; - -namespace AmplifyShaderEditor -{ - public class SignalGeneratorNode : ParentNode, ISignalGenerator - { - public SignalGeneratorNode() : base() { } - public SignalGeneratorNode( int uniqueId, float x, float y, float width, float height ) : base( uniqueId, x, y, width, height ) { } - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - SelfPowered = true; - } - - public void GenerateSignalPropagation() - { - System.Type myType = GetType(); - for ( int i = 0; i < m_inputPorts.Count; i++ ) - { - if ( m_inputPorts[ i ].IsConnected ) - { - m_inputPorts[ i ].GetOutputNode().ActivateNode( UniqueId, i, myType ); - } - } - } - - public void GenerateSignalInibitor() - { - for ( int i = 0; i < m_inputPorts.Count; i++ ) - { - if( m_inputPorts[ i ].IsConnected ) - { - ParentNode node = m_inputPorts[ i ].GetOutputNode(); - if( node != null ) - node.DeactivateNode( i, false ); - } - } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SignalGeneratorNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SignalGeneratorNode.cs.meta deleted file mode 100644 index 92146032..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SignalGeneratorNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 2f92560b009046f4a86504e682834405 -timeCreated: 1481126954 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes.meta deleted file mode 100644 index 4f6f807b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 899b55cb557ca594f926ad64dfa4ad8f -folderAsset: yes -timeCreated: 1481126946 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleAddOpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleAddOpNode.cs deleted file mode 100644 index 463528fd..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleAddOpNode.cs +++ /dev/null @@ -1,58 +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( "Add", "Math Operators", "Addition of two or more values ( A + B + .. )", null, KeyCode.A )] - public sealed class SimpleAddOpNode : DynamicTypeNode - { - private int m_cachedPropertyId = -1; - - protected override void CommonInit( int uniqueId ) - { - m_dynamicRestrictions = new WirePortDataType[] - { - WirePortDataType.OBJECT, - WirePortDataType.FLOAT, - WirePortDataType.FLOAT2, - WirePortDataType.FLOAT3, - WirePortDataType.FLOAT4, - WirePortDataType.COLOR, - WirePortDataType.FLOAT3x3, - WirePortDataType.FLOAT4x4, - WirePortDataType.INT - }; - - base.CommonInit( uniqueId ); - m_extensibleInputPorts = true; - m_previewShaderGUID = "9eb150cbc752cbc458a0a37984b9934a"; - } - - public override void SetPreviewInputs() - { - base.SetPreviewInputs(); - - if ( m_cachedPropertyId == -1 ) - m_cachedPropertyId = Shader.PropertyToID( "_Count" ); - - PreviewMaterial.SetInt( m_cachedPropertyId, m_inputPorts.Count); - } - - public override string BuildResults( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - base.BuildResults( outputId, ref dataCollector, ignoreLocalvar ); - string result = "( " + m_extensibleInputResults[ 0 ]; - for ( int i = 1; i < m_extensibleInputResults.Count; i++ ) - { - result += " + " + m_extensibleInputResults[ i ]; - } - result += " )"; - return result; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleAddOpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleAddOpNode.cs.meta deleted file mode 100644 index c3660959..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleAddOpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 6ca9162ab6c708f40bbc21f0c22909fa -timeCreated: 1481126956 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleDivideOpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleDivideOpNode.cs deleted file mode 100644 index 0cafeb3c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleDivideOpNode.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEngine; -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Divide", "Math Operators", "Division of two values ( A / B )", null, KeyCode.D )] - public sealed class SimpleDivideOpNode : DynamicTypeNode - { - protected override void CommonInit( int uniqueId ) - { - m_dynamicRestrictions = new WirePortDataType[] - { - WirePortDataType.OBJECT, - WirePortDataType.FLOAT, - WirePortDataType.FLOAT2, - WirePortDataType.FLOAT3, - WirePortDataType.FLOAT4, - WirePortDataType.COLOR, - WirePortDataType.FLOAT3x3, - WirePortDataType.FLOAT4x4, - WirePortDataType.INT - }; - - base.CommonInit( uniqueId ); - m_allowMatrixCheck = true; - m_previewShaderGUID = "409f06d00d1094849b0834c52791fa72"; - } - - public override string BuildResults( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - SetExtensibleInputData( outputId, ref dataCollector, ignoreLocalvar ); - string result = "( " + m_extensibleInputResults[ 0 ]; - for ( int i = 1; i < m_extensibleInputResults.Count; i++ ) - { - result += " / " + m_extensibleInputResults[ i ]; - } - result += " )"; - return result; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleDivideOpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleDivideOpNode.cs.meta deleted file mode 100644 index 98e759a8..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleDivideOpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: e80e305761a1e6c4898e401a64b17f84 -timeCreated: 1481126960 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleMaxOpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleMaxOpNode.cs deleted file mode 100644 index fdb3c8ce..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleMaxOpNode.cs +++ /dev/null @@ -1,24 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Max", "Math Operators", "Maximum of two scalars or each respective component of two vectors" )] - public sealed class SimpleMaxOpNode : DynamicTypeNode - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_previewShaderGUID = "79d7f2a11092ac84a95ef6823b34adf2"; - } - - public override string BuildResults( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - base.BuildResults( outputId, ref dataCollector, ignoreLocalvar ); - return "max( " + m_inputA + " , " + m_inputB + " )"; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleMaxOpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleMaxOpNode.cs.meta deleted file mode 100644 index fe8023a1..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleMaxOpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 4ea5a2904ca58164086eeb8ef3084ed2 -timeCreated: 1481126955 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleMinOpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleMinOpNode.cs deleted file mode 100644 index 4b24eb3c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleMinOpNode.cs +++ /dev/null @@ -1,24 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Min", "Math Operators", "Minimum of two scalars or each respective component of two vectors" )] - public sealed class SimpleMinOpNode : DynamicTypeNode - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_previewShaderGUID = "d6033298044f0f14aa9932ca46e58ce6"; - } - - public override string BuildResults( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - base.BuildResults( outputId, ref dataCollector, ignoreLocalvar ); - return "min( " + m_inputA + " , " + m_inputB + " )"; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleMinOpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleMinOpNode.cs.meta deleted file mode 100644 index a92e3e5f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleMinOpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 1b19c8479d7a7a9458a6f556bf6545d5 -timeCreated: 1481126954 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleMultiplyOpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleMultiplyOpNode.cs deleted file mode 100644 index 4a41a775..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleMultiplyOpNode.cs +++ /dev/null @@ -1,175 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEngine; -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Multiply", "Math Operators", "Multiplication of two or more values ( A * B * .. )\nIt also handles Matrices multiplication", null, KeyCode.M )] - public sealed class SimpleMultiplyOpNode : DynamicTypeNode - { - protected override void CommonInit( int uniqueId ) - { - m_dynamicRestrictions = new WirePortDataType[] - { - WirePortDataType.OBJECT, - WirePortDataType.FLOAT, - WirePortDataType.FLOAT2, - WirePortDataType.FLOAT3, - WirePortDataType.FLOAT4, - WirePortDataType.COLOR, - WirePortDataType.FLOAT3x3, - WirePortDataType.FLOAT4x4, - WirePortDataType.INT - }; - - base.CommonInit( uniqueId ); - m_extensibleInputPorts = true; - m_vectorMatrixOps = true; - m_previewShaderGUID = "1ba1e43e86415ff4bbdf4d81dfcf035b"; - } - - public override void SetPreviewInputs() - { - base.SetPreviewInputs(); - - int count = 0; - int inputCount = m_inputPorts.Count; - for( int i = 2; i < inputCount; i++ ) - { - count++; - if( !m_inputPorts[ i ].IsConnected ) - PreviewMaterial.SetTexture( ( "_" + Convert.ToChar( i + 65 ) ), UnityEditor.EditorGUIUtility.whiteTexture ); - } - - m_previewMaterialPassId = count; - } - - public override string BuildResults( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if( m_inputPorts[ 0 ].DataType == WirePortDataType.FLOAT3x3 || - m_inputPorts[ 0 ].DataType == WirePortDataType.FLOAT4x4 || - m_inputPorts[ 1 ].DataType == WirePortDataType.FLOAT3x3 || - m_inputPorts[ 1 ].DataType == WirePortDataType.FLOAT4x4 ) - { - m_inputA = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - m_inputB = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); - - - WirePortDataType autoCast = WirePortDataType.OBJECT; - // Check matrix on first input - if( m_inputPorts[ 0 ].DataType == WirePortDataType.FLOAT3x3 ) - { - switch( m_inputPorts[ 1 ].DataType ) - { - case WirePortDataType.OBJECT: - case WirePortDataType.FLOAT: - case WirePortDataType.INT: - case WirePortDataType.FLOAT2: - case WirePortDataType.FLOAT4: - case WirePortDataType.COLOR: - { - m_inputB = UIUtils.CastPortType( ref dataCollector, CurrentPrecisionType, new NodeCastInfo( UniqueId, outputId ), m_inputB, m_inputPorts[ 1 ].DataType, WirePortDataType.FLOAT3, m_inputB ); - autoCast = WirePortDataType.FLOAT3; - } - break; - case WirePortDataType.FLOAT4x4: - { - m_inputA = UIUtils.CastPortType( ref dataCollector, CurrentPrecisionType, new NodeCastInfo( UniqueId, outputId ), m_inputA, m_inputPorts[ 0 ].DataType, WirePortDataType.FLOAT4x4, m_inputA ); - } - break; - case WirePortDataType.FLOAT3: - case WirePortDataType.FLOAT3x3: break; - } - } - - if( m_inputPorts[ 0 ].DataType == WirePortDataType.FLOAT4x4 ) - { - switch( m_inputPorts[ 1 ].DataType ) - { - case WirePortDataType.OBJECT: - case WirePortDataType.FLOAT: - case WirePortDataType.INT: - case WirePortDataType.FLOAT2: - case WirePortDataType.FLOAT3: - { - m_inputB = UIUtils.CastPortType( ref dataCollector, CurrentPrecisionType, new NodeCastInfo( UniqueId, outputId ), m_inputB, m_inputPorts[ 1 ].DataType, WirePortDataType.FLOAT4, m_inputB ); - autoCast = WirePortDataType.FLOAT4; - } - break; - case WirePortDataType.FLOAT3x3: - { - m_inputB = UIUtils.CastPortType( ref dataCollector, CurrentPrecisionType, new NodeCastInfo( UniqueId, outputId ), m_inputB, m_inputPorts[ 1 ].DataType, WirePortDataType.FLOAT4x4, m_inputB ); - } - break; - case WirePortDataType.FLOAT4x4: - case WirePortDataType.FLOAT4: - case WirePortDataType.COLOR: break; - } - } - - // Check matrix on second input - if( m_inputPorts[ 1 ].DataType == WirePortDataType.FLOAT3x3 ) - { - switch( m_inputPorts[ 0 ].DataType ) - { - case WirePortDataType.OBJECT: - case WirePortDataType.FLOAT: - case WirePortDataType.INT: - case WirePortDataType.FLOAT2: - case WirePortDataType.FLOAT4: - case WirePortDataType.COLOR: - { - m_inputA = UIUtils.CastPortType( ref dataCollector, CurrentPrecisionType, new NodeCastInfo( UniqueId, outputId ), m_inputA, m_inputPorts[ 0 ].DataType, WirePortDataType.FLOAT3, m_inputA ); - autoCast = WirePortDataType.FLOAT3; - } - break; - case WirePortDataType.FLOAT4x4: - case WirePortDataType.FLOAT3: - case WirePortDataType.FLOAT3x3: break; - } - } - - if( m_inputPorts[ 1 ].DataType == WirePortDataType.FLOAT4x4 ) - { - switch( m_inputPorts[ 0 ].DataType ) - { - case WirePortDataType.OBJECT: - case WirePortDataType.FLOAT: - case WirePortDataType.INT: - case WirePortDataType.FLOAT2: - case WirePortDataType.FLOAT3: - { - m_inputA = UIUtils.CastPortType( ref dataCollector, CurrentPrecisionType, new NodeCastInfo( UniqueId, outputId ), m_inputA, m_inputPorts[ 0 ].DataType, WirePortDataType.FLOAT4, m_inputA ); - autoCast = WirePortDataType.FLOAT4; - } - break; - case WirePortDataType.FLOAT3x3: - case WirePortDataType.FLOAT4x4: - case WirePortDataType.FLOAT4: - case WirePortDataType.COLOR: break; - } - } - string result = "mul( " + m_inputA + ", " + m_inputB + " )"; - if( autoCast != WirePortDataType.OBJECT && autoCast != m_outputPorts[ 0 ].DataType ) - { - result = UIUtils.CastPortType( ref dataCollector, CurrentPrecisionType, new NodeCastInfo( UniqueId, outputId ), result, autoCast, m_outputPorts[ 0 ].DataType, result ); - } - return result; - } - else - { - base.BuildResults( outputId, ref dataCollector, ignoreLocalvar ); - string result = "( " + m_extensibleInputResults[ 0 ]; - for( int i = 1; i < m_extensibleInputResults.Count; i++ ) - { - result += " * " + m_extensibleInputResults[ i ]; - } - result += " )"; - return result; - } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleMultiplyOpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleMultiplyOpNode.cs.meta deleted file mode 100644 index 0283ca77..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleMultiplyOpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 647081578ac7f014d98090d36b5b1bc8 -timeCreated: 1481126956 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleRemainderNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleRemainderNode.cs deleted file mode 100644 index 64da4fdf..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleRemainderNode.cs +++ /dev/null @@ -1,62 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Remainder", "Math Operators", "Remainder between two int variables",tags:"modulo fmod" )] - public sealed class SimpleRemainderNode : DynamicTypeNode - { - private const string VertexFragRemainder = "( {0} % {1} )"; - private const string SurfaceRemainder = "fmod( {0} , {1} )"; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_useInternalPortData = true; - m_textLabelWidth = 35; - ChangeInputType( WirePortDataType.INT, false ); - ChangeOutputType( WirePortDataType.INT, false ); - m_useInternalPortData = true; - m_previewShaderGUID = "8fdfc429d6b191c4985c9531364c1a95"; - } - - public override string BuildResults( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) - return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); - - base.BuildResults( outputId, ref dataCollector, ignoreLocalvar ); -#if UNITY_2018_1_OR_NEWER - string opMode = VertexFragRemainder; -#else - string opMode = dataCollector.IsTemplate ? VertexFragRemainder : SurfaceRemainder; -#endif - string result = string.Empty; - switch( m_outputPorts[ 0 ].DataType ) - { - case WirePortDataType.FLOAT: - case WirePortDataType.FLOAT2: - case WirePortDataType.FLOAT3: - case WirePortDataType.FLOAT4: - case WirePortDataType.INT: - case WirePortDataType.COLOR: - case WirePortDataType.OBJECT: - { - result = string.Format( opMode, m_inputA, m_inputB ); - } - break; - case WirePortDataType.FLOAT3x3: - case WirePortDataType.FLOAT4x4: - { - result = UIUtils.InvalidParameter( this ); - } - break; - } - - return CreateOutputLocalVariable( 0, result, ref dataCollector ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleRemainderNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleRemainderNode.cs.meta deleted file mode 100644 index 528ea33f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleRemainderNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 5785c326a26d2ba4ab642fc2bdd41e9a -timeCreated: 1481126955 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleSubtractOpNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleSubtractOpNode.cs deleted file mode 100644 index eaabab20..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleSubtractOpNode.cs +++ /dev/null @@ -1,39 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using UnityEngine; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Subtract", "Math Operators", "Subtraction of two values ( A - B )", null, UnityEngine.KeyCode.S )] - public sealed class SimpleSubtractOpNode : DynamicTypeNode - { - protected override void CommonInit( int uniqueId ) - { - m_dynamicRestrictions = new WirePortDataType[] - { - WirePortDataType.OBJECT, - WirePortDataType.FLOAT, - WirePortDataType.FLOAT2, - WirePortDataType.FLOAT3, - WirePortDataType.FLOAT4, - WirePortDataType.COLOR, - WirePortDataType.FLOAT3x3, - WirePortDataType.FLOAT4x4, - WirePortDataType.INT - }; - - base.CommonInit( uniqueId ); - m_allowMatrixCheck = true; - m_previewShaderGUID = "5725e8300be208449973f771ab6682f2"; - } - - public override string BuildResults( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - base.BuildResults( outputId, ref dataCollector, ignoreLocalvar ); - return "( " + m_inputA + " - " + m_inputB + " )"; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleSubtractOpNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleSubtractOpNode.cs.meta deleted file mode 100644 index a550f19a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SimpleNodes/SimpleSubtractOpNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 204f935dafd0a984297e242583de1da5 -timeCreated: 1481126954 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs.meta deleted file mode 100644 index 4487ca30..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: ddb697d654917eb4aada5b2caeef2db8 -folderAsset: yes -timeCreated: 1481126946 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ColorInputsNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ColorInputsNode.cs deleted file mode 100644 index e4223e1b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ColorInputsNode.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -namespace AmplifyShaderEditor -{ - [System.Serializable] - [NodeAttributes( "Color", "Surface Data", "Interpolated per-vertex color", null, UnityEngine.KeyCode.None, true, true, "Vertex Color", typeof( VertexColorNode ) )] - public sealed class ColorInputsNode : SurfaceShaderINParentNode - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_currentInput = SurfaceInputs.COLOR; - InitialSetup(); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ColorInputsNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ColorInputsNode.cs.meta deleted file mode 100644 index 8f36faf6..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ColorInputsNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: ee44f086d7aa7804ea035860c5735cfb -timeCreated: 1481126960 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/GrabScreenPosition.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/GrabScreenPosition.cs deleted file mode 100644 index 3e2a5117..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/GrabScreenPosition.cs +++ /dev/null @@ -1,118 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using UnityEditor; -using UnityEngine; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Grab Screen Position", "Camera And Screen", "Screen position correctly transformed to be used with Grab Screen Color" )] - public sealed class GrabScreenPosition : ParentNode - { - private readonly string[] m_outputTypeStr = { "Normalized", "Screen" }; - - [SerializeField] - private int m_outputTypeInt = 0; - - private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper(); - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddOutputVectorPorts( WirePortDataType.FLOAT4, "XYZW" ); - m_autoWrapProperties = true; - m_hasLeftDropdown = true; - m_textLabelWidth = 65; - ConfigureHeader(); - } - - public override void AfterCommonInit() - { - base.AfterCommonInit(); - - if( PaddingTitleLeft == 0 ) - { - PaddingTitleLeft = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; - if( PaddingTitleRight == 0 ) - PaddingTitleRight = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; - } - } - - public override void Destroy() - { - base.Destroy(); - m_upperLeftWidget = null; - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - EditorGUI.BeginChangeCheck(); - m_outputTypeInt = m_upperLeftWidget.DrawWidget( this, m_outputTypeInt, m_outputTypeStr ); - if( EditorGUI.EndChangeCheck() ) - { - ConfigureHeader(); - } - } - - public override void DrawProperties() - { - base.DrawProperties(); - - EditorGUI.BeginChangeCheck(); - m_outputTypeInt = EditorGUILayoutPopup( "Type", m_outputTypeInt, m_outputTypeStr ); - if( EditorGUI.EndChangeCheck() ) - { - ConfigureHeader(); - } - } - - void ConfigureHeader() - { - SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, m_outputTypeStr[ m_outputTypeInt ] ) ); - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) - { - if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) - return GetOutputColorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); - - string localVarName = string.Empty; - - if( m_outputTypeInt == 0 ) - localVarName = GeneratorUtils.GenerateGrabScreenPositionNormalized( ref dataCollector, UniqueId, CurrentPrecisionType, !dataCollector.UsingCustomScreenPos ); - else - localVarName = GeneratorUtils.GenerateGrabScreenPosition( ref dataCollector, UniqueId, CurrentPrecisionType, !dataCollector.UsingCustomScreenPos ); - - m_outputPorts[ 0 ].SetLocalValue( localVarName, dataCollector.PortCategory ); - return GetOutputColorItem( 0, outputId, localVarName ); - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - if( UIUtils.CurrentShaderVersion() > 3108 ) - { - if( UIUtils.CurrentShaderVersion() < 6102 ) - { - bool project = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - m_outputTypeInt = project ? 0 : 1; - } - else - { - m_outputTypeInt = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - } - } - - ConfigureHeader(); - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_outputTypeInt ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/GrabScreenPosition.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/GrabScreenPosition.cs.meta deleted file mode 100644 index 5a57543d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/GrabScreenPosition.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 47af62ad6a29d1b409d526d352b5e677 -timeCreated: 1485198163 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/LocalVertexPosNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/LocalVertexPosNode.cs deleted file mode 100644 index 785e39fa..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/LocalVertexPosNode.cs +++ /dev/null @@ -1,50 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using UnityEngine; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "[Deprecated] Local Position", "Surface Data", "Interpolated Vertex Position in Local Space", null, KeyCode.None, true, true, "Vertex Position", typeof( PosVertexDataNode ) )] - public sealed class LocalVertexPosNode : ParentNode - { - private const string VertexVarName = "localVertexPos"; - private readonly string VertexOnFrag = Constants.InputVarStr + "." + VertexVarName; - private readonly string VertexOnVert = Constants.VertexShaderInputStr + ".vertex"; - - - [SerializeField] - private bool m_addInstruction = false; - - public override void Reset() - { - base.Reset(); - m_addInstruction = true; - } - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddOutputVectorPorts( WirePortDataType.FLOAT3, "XYZ" ); - } - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if ( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) - { - return GetOutputVectorItem( 0, outputId, VertexOnVert ); - } - else - { - if ( m_addInstruction ) - { - dataCollector.AddToInput( UniqueId, VertexVarName, WirePortDataType.FLOAT3 ); - dataCollector.AddVertexInstruction( Constants.VertexShaderOutputStr + "." + VertexVarName + " = " + Constants.VertexShaderInputStr + ".vertex.xyz ", UniqueId ); - m_addInstruction = false; - } - - return GetOutputVectorItem( 0, outputId, VertexOnFrag ); - } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/LocalVertexPosNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/LocalVertexPosNode.cs.meta deleted file mode 100644 index 91b6b542..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/LocalVertexPosNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 2528fbf85b5823a4499871c2a6eecc0a -timeCreated: 1481126954 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ScreenColorNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ScreenColorNode.cs deleted file mode 100644 index 60a7f230..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ScreenColorNode.cs +++ /dev/null @@ -1,678 +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( "Grab Screen Color", "Camera And Screen", "Grabed pixel color value from screen" )] - public sealed class ScreenColorNode : PropertyNode - { -#if UNITY_5_6_OR_NEWER - private readonly string[] ASEDeclareMacro = - { - "#if defined(UNITY_STEREO_INSTANCING_ENABLED) || defined(UNITY_STEREO_MULTIVIEW_ENABLED)", - "#define ASE_DECLARE_SCREENSPACE_TEXTURE(tex) UNITY_DECLARE_SCREENSPACE_TEXTURE(tex);", - "#else", - "#define ASE_DECLARE_SCREENSPACE_TEXTURE(tex) UNITY_DECLARE_SCREENSPACE_TEXTURE(tex)", - "#endif" - }; -#endif - private readonly Color ReferenceHeaderColor = new Color( 0.6f, 3.0f, 1.25f, 1.0f ); - - private const string SamplerType = "tex2D"; - private const string GrabTextureDefault = "_GrabTexture"; - private const string ScreenColorStr = "screenColor"; - - [SerializeField] - private TexReferenceType m_referenceType = TexReferenceType.Object; - - [SerializeField] - private int m_referenceArrayId = -1; - - [SerializeField] - private int m_referenceNodeId = -1; - - [SerializeField] - private GUIStyle m_referenceIconStyle = null; - - private ScreenColorNode m_referenceNode = null; - - [SerializeField] - private bool m_normalize = false; - - [SerializeField] - private bool m_useCustomGrab = false; - - [SerializeField] - private float m_referenceWidth = -1; - - //SRP specific code - private const string OpaqueTextureDefine = "REQUIRE_OPAQUE_TEXTURE 1"; - private const string FetchVarName = "fetchOpaqueVal"; - - //private string LWFetchOpaqueTexture = "SAMPLE_TEXTURE2D( _CameraOpaqueTexture, sampler_CameraOpaqueTexture, {0})"; - private string LWFetchOpaqueTexture = "float4( SHADERGRAPH_SAMPLE_SCENE_COLOR( {0} ), 1.0 )"; -#if UNITY_2018_3_OR_NEWER - private const string HDSampleSceneColorHeader5 = "ASEHDSampleSceneColor({0}, {1}, {2})"; - private readonly string[] HDSampleSceneColorFunc5 = - { - "float4 ASEHDSampleSceneColor(float2 uv, float lod, float exposureMultiplier)\n", - "{\n", - "\t#if defined(REQUIRE_OPAQUE_TEXTURE) && defined(_SURFACE_TYPE_TRANSPARENT) && defined(SHADERPASS) && (SHADERPASS != SHADERPASS_LIGHT_TRANSPORT)\n", - "\treturn float4( SampleCameraColor(uv, lod) * exposureMultiplier, 1.0 );\n", - "\t#endif\n", - "\treturn float4(0.0, 0.0, 0.0, 1.0);\n", - "}\n", - }; - - private const string HDSampleSceneColorHeader4 = "ASEHDSampleSceneColor({0})"; - private readonly string[] HDSampleSceneColorFunc4 = - { - "float4 ASEHDSampleSceneColor( float2 uv )\n", - "{\n", - "\t#if defined(REQUIRE_OPAQUE_TEXTURE) && defined(_SURFACE_TYPE_TRANSPARENT) && defined(SHADERPASS) && (SHADERPASS != SHADERPASS_LIGHT_TRANSPORT)\n", - "\treturn float4( SampleCameraColor(uv), 1.0 );\n", - "\t#endif\n", - "\treturn float4(0.0, 0.0, 0.0, 1.0);\n", - "}\n", - }; -#endif - -#if !UNITY_2018_3_OR_NEWER - // Legacy SRP code - private const string DeclareOpaqueTextureObject = "TEXTURE2D( _CameraOpaqueTexture);"; - private const string DeclareOpaqueTextureSampler = "SAMPLER( sampler_CameraOpaqueTexture);"; -#endif - public ScreenColorNode() : base() { } - public ScreenColorNode( int uniqueId, float x, float y, float width, float height ) : base( uniqueId, x, y, width, height ) { } - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - - AddInputPort( WirePortDataType.FLOAT2, false, "UV" ); - AddOutputColorPorts( "RGBA" ); - - m_currentParameterType = PropertyType.Global; - m_underscoredGlobal = true; - m_useVarSubtitle = true; - m_customPrefix = "Grab Screen "; - m_freeType = false; - m_drawAttributes = false; - m_showTitleWhenNotEditing = false; - m_textLabelWidth = 125; - m_showAutoRegisterUI = true; - m_globalDefaultBehavior = false; - m_showVariableMode = true; - } - - protected override void OnUniqueIDAssigned() - { - base.OnUniqueIDAssigned(); - if( m_referenceType == TexReferenceType.Object ) - UIUtils.RegisterScreenColorNode( this ); - - if( UniqueId > -1 ) - ContainerGraph.ScreenColorNodes.OnReorderEventComplete += OnReorderEventComplete; - - } - - private void OnReorderEventComplete() - { - if( m_referenceType == TexReferenceType.Instance && m_referenceNode != null ) - { - m_referenceArrayId = ContainerGraph.ScreenColorNodes.GetNodeRegisterIdx( m_referenceNode.UniqueId ); - } - } - - void UpdateHeaderColor() - { - m_headerColorModifier = ( m_referenceType == TexReferenceType.Object ) ? Color.white : ReferenceHeaderColor; - } - - public override void OnNodeLogicUpdate( DrawInfo drawInfo ) - { - base.OnNodeLogicUpdate( drawInfo ); - if( m_referenceNodeId > -1 && m_referenceNode == null ) - { - m_referenceNode = UIUtils.GetScreenColorNode( m_referenceNodeId ) as ScreenColorNode; - if( m_referenceNode == null ) - { - m_referenceNodeId = -1; - m_referenceArrayId = -1; - m_sizeIsDirty = true; - } - } - - if( m_showSubtitle == m_containerGraph.IsSRP ) - { - m_showSubtitle = !m_containerGraph.IsSRP; - m_sizeIsDirty = true; - } - } - - protected override void ChangeSizeFinished() - { - if( m_referenceType == TexReferenceType.Instance ) - { - m_position.width += 20; - } - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - - CheckReference(); - - if( SoftValidReference ) - { - m_content.text = m_referenceNode.TitleContent.text + Constants.InstancePostfixStr; - SetAdditonalTitleText( m_referenceNode.AdditonalTitleContent.text ); - - if( m_referenceIconStyle == null ) - { - m_referenceIconStyle = UIUtils.GetCustomStyle( CustomStyle.SamplerTextureIcon ); - } - - Rect iconPos = m_globalPosition; - iconPos.width = 19 * drawInfo.InvertedZoom; - iconPos.height = 19 * drawInfo.InvertedZoom; - - iconPos.y += 6 * drawInfo.InvertedZoom; - iconPos.x += m_globalPosition.width - iconPos.width - 7 * drawInfo.InvertedZoom; - - if( GUI.Button( iconPos, string.Empty, m_referenceIconStyle ) ) - { - UIUtils.FocusOnNode( m_referenceNode, 1, true ); - } - } - } - - void CheckReference() - { - if( m_referenceType != TexReferenceType.Instance ) - { - return; - } - - if( m_referenceArrayId > -1 ) - { - ParentNode newNode = UIUtils.GetScreenColorNode( m_referenceArrayId ); - if( newNode == null || newNode.UniqueId != m_referenceNodeId ) - { - m_referenceNode = null; - int count = UIUtils.GetScreenColorNodeAmount(); - for( int i = 0; i < count; i++ ) - { - ParentNode node = UIUtils.GetScreenColorNode( i ); - if( node.UniqueId == m_referenceNodeId ) - { - m_referenceNode = node as ScreenColorNode; - m_referenceArrayId = i; - break; - } - } - } - } - - if( m_referenceNode == null && m_referenceNodeId > -1 ) - { - m_referenceNodeId = -1; - m_referenceArrayId = -1; - } - } - - public override void DrawMainPropertyBlock() - { - EditorGUI.BeginChangeCheck(); - m_referenceType = (TexReferenceType)EditorGUILayoutPopup( Constants.ReferenceTypeStr, (int)m_referenceType, Constants.ReferenceArrayLabels ); - if( EditorGUI.EndChangeCheck() ) - { - m_sizeIsDirty = true; - if( m_referenceType == TexReferenceType.Object ) - { - UIUtils.RegisterScreenColorNode( this ); - m_content.text = m_propertyInspectorName; - } - else - { - UIUtils.UnregisterScreenColorNode( this ); - if( SoftValidReference ) - { - m_content.text = m_referenceNode.TitleContent.text + Constants.InstancePostfixStr; - } - } - UpdateHeaderColor(); - } - - if( m_referenceType == TexReferenceType.Object ) - { - EditorGUI.BeginDisabledGroup( m_containerGraph.IsSRP ); - { - EditorGUI.BeginChangeCheck(); - m_useCustomGrab = EditorGUILayoutToggle( "Custom Grab Pass", m_useCustomGrab ); - EditorGUI.BeginDisabledGroup( !m_useCustomGrab ); - DrawMainPropertyBlockNoPrecision(); - EditorGUI.EndDisabledGroup(); - - m_normalize = EditorGUILayoutToggle( "Normalize", m_normalize ); - if( EditorGUI.EndChangeCheck() ) - { - UpdatePort(); - if( m_useCustomGrab ) - { - BeginPropertyFromInspectorCheck(); - } - } - } - EditorGUI.EndDisabledGroup(); - } - else - { - string[] arr = UIUtils.ScreenColorNodeArr(); - bool guiEnabledBuffer = GUI.enabled; - if( arr != null && arr.Length > 0 ) - { - GUI.enabled = true; - } - else - { - m_referenceArrayId = -1; - GUI.enabled = false; - } - - m_referenceArrayId = EditorGUILayoutPopup( Constants.AvailableReferenceStr, m_referenceArrayId, arr ); - GUI.enabled = guiEnabledBuffer; - EditorGUI.BeginDisabledGroup( m_containerGraph.IsSRP ); - { - EditorGUI.BeginChangeCheck(); - m_normalize = EditorGUILayoutToggle( "Normalize", m_normalize ); - if( EditorGUI.EndChangeCheck() ) - { - UpdatePort(); - } - } - EditorGUI.EndDisabledGroup(); - } - ShowVariableMode(); - ShowAutoRegister(); - } - - private void UpdatePort() - { - if( m_normalize ) - m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT4, false ); - else - m_inputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT2, false ); - } - - public override void DrawTitle( Rect titlePos ) - { - if( !m_isEditing && ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD3 ) - { - GUI.Label( titlePos, "Grab Screen Color", UIUtils.GetCustomStyle( CustomStyle.NodeTitle ) ); - } - - if( m_useCustomGrab || SoftValidReference ) - { - base.DrawTitle( titlePos ); - m_previousAdditonalTitle = m_additionalContent.text; - } - else - if( ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD3 ) - { - SetAdditonalTitleTextOnCallback( GrabTextureDefault, ( instance, newSubTitle ) => instance.AdditonalTitleContent.text = string.Format( Constants.SubTitleVarNameFormatStr, newSubTitle ) ); - //GUI.Label( titlePos, PropertyInspectorName, UIUtils.GetCustomStyle( CustomStyle.NodeTitle ) ); - } - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) - { -#if UNITY_5_6_OR_NEWER - if( !dataCollector.IsTemplate || dataCollector.CurrentSRPType == TemplateSRPType.BuiltIn ) - { - for( int i = 0; i < ASEDeclareMacro.Length; i++ ) - { - dataCollector.AddToDirectives( ASEDeclareMacro[ i ]); - } - } -#endif - -#if !UNITY_2018_3_OR_NEWER - if( dataCollector.IsTemplate && dataCollector.CurrentSRPType == TemplateSRPType.HD ) - { - UIUtils.ShowMessage( UniqueId, "GrabPasses are not supported on Unity HD Scriptable Rendering Pipeline old versions." ); - return GetOutputColorItem( 0, outputId, "(0).xxxx" ); - } -#endif - if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) - return GetOutputColorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); - - string valueName = string.Empty; - if( dataCollector.IsSRP ) - { -#if !UNITY_2018_3_OR_NEWER - dataCollector.AddToUniforms( UniqueId, DeclareOpaqueTextureObject ); - dataCollector.AddToUniforms( UniqueId, DeclareOpaqueTextureSampler ); -#endif - valueName = FetchVarName + OutputId; - dataCollector.AddToDirectives( OpaqueTextureDefine, -1 , AdditionalLineType.Define); - string uvCoords = GetUVCoords( ref dataCollector, ignoreLocalVar, false ); - if( dataCollector.TemplateDataCollectorInstance.IsLWRP ) - { - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT4, valueName, string.Format( LWFetchOpaqueTexture, uvCoords ) ); - } - else - { -#if UNITY_2018_3_OR_NEWER - if( ASEPackageManagerHelper.CurrentHDVersion >= ASESRPVersions.ASE_SRP_5_13_0 ) - { - dataCollector.AddFunction( HDSampleSceneColorFunc5[ 0 ], HDSampleSceneColorFunc5, false ); - dataCollector.AddLocalVariable( UniqueId, m_currentPrecisionType, WirePortDataType.FLOAT4, valueName, string.Format( HDSampleSceneColorHeader5, uvCoords, "0", "GetInverseCurrentExposureMultiplier()" ) ); - } - else - { - dataCollector.AddFunction( HDSampleSceneColorFunc4[ 0 ], HDSampleSceneColorFunc4, false ); - dataCollector.AddLocalVariable( UniqueId, m_currentPrecisionType, WirePortDataType.FLOAT4, valueName, string.Format( HDSampleSceneColorHeader4, uvCoords ) ); - } -#endif - } - } - else - { - base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalVar ); - string propertyName = CurrentPropertyReference; - OnPropertyNameChanged(); - //bool emptyName = string.IsNullOrEmpty( m_propertyInspectorName ) || propertyName == GrabTextureDefault; - bool emptyName = string.IsNullOrEmpty( m_propertyInspectorName ) || !m_useCustomGrab; - dataCollector.AddGrabPass( emptyName ? string.Empty : propertyName ); - valueName = SetFetchedData( ref dataCollector, ignoreLocalVar ); - } - - m_outputPorts[ 0 ].SetLocalValue( valueName, dataCollector.PortCategory ); - return GetOutputColorItem( 0, outputId, valueName ); - } - - - public override void OnPropertyNameChanged() - { - base.OnPropertyNameChanged(); - UIUtils.UpdateScreenColorDataNode( UniqueId, DataToArray ); - } - - public string SetFetchedData( ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) - { - string propertyName = CurrentPropertyReference; - - bool isProjecting = m_normalize; - - if( !m_inputPorts[ 0 ].IsConnected ) // to generate proper screen pos by itself - isProjecting = true; - - if( ignoreLocalVar ) - { - string samplerValue = SamplerType + ( isProjecting ? "proj" : "" ) + "( " + propertyName + ", " + GetUVCoords( ref dataCollector, ignoreLocalVar, isProjecting ) + " )"; - return samplerValue; - } - - if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) - return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); - - string uvValue = GetUVCoords( ref dataCollector, ignoreLocalVar, isProjecting ); -#if UNITY_5_6_OR_NEWER - if( isProjecting ) - { - uvValue = string.Format( "{0}.xy/{0}.w", uvValue ); - } - string samplerOp = string.Format( "UNITY_SAMPLE_SCREENSPACE_TEXTURE({0},{1})", propertyName, uvValue ); -#else - string samplerOp = SamplerType + ( isProjecting ? "proj" : "" ) + "( " + propertyName + ", " + uvValue + " )"; -#endif - dataCollector.AddLocalVariable( UniqueId, UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, m_outputPorts[ 0 ].DataType ) + " " + ScreenColorStr + OutputId + " = " + samplerOp + ";" ); - return ScreenColorStr + OutputId; - } - - private string GetUVCoords( ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar, bool isProjecting ) - { - string result = string.Empty; - - if( m_inputPorts[ 0 ].IsConnected ) - { - result = m_inputPorts[ 0 ].GenerateShaderForOutput( ref dataCollector, ( isProjecting ? WirePortDataType.FLOAT4 : WirePortDataType.FLOAT2 ), ignoreLocalVar, true ); - } - else - { - string customScreenPos = null; - - if( dataCollector.IsTemplate ) - customScreenPos = dataCollector.TemplateDataCollectorInstance.GetScreenPos( CurrentPrecisionType ); - - if( isProjecting ) - result = GeneratorUtils.GenerateGrabScreenPosition( ref dataCollector, UniqueId, CurrentPrecisionType, !dataCollector.UsingCustomScreenPos, customScreenPos ); - else - result = GeneratorUtils.GenerateGrabScreenPositionNormalized( ref dataCollector, UniqueId, CurrentPrecisionType, !dataCollector.UsingCustomScreenPos, customScreenPos ); - } - - if( isProjecting && !dataCollector.IsSRP ) -#if UNITY_5_6_OR_NEWER - return result; -#else - return "UNITY_PROJ_COORD( " + result + " )"; -#endif - else - return result; - } - - public override void Destroy() - { - base.Destroy(); - if( m_referenceType == TexReferenceType.Object ) - { - UIUtils.UnregisterScreenColorNode( this ); - } - if( UniqueId > -1 ) - ContainerGraph.ScreenColorNodes.OnReorderEventComplete -= OnReorderEventComplete; - } - - public bool SoftValidReference - { - get - { - if( m_referenceType == TexReferenceType.Instance && m_referenceArrayId > -1 ) - { - m_referenceNode = UIUtils.GetScreenColorNode( m_referenceArrayId ); - if( m_referenceNode == null ) - { - m_referenceArrayId = -1; - m_referenceWidth = -1; - } - else if( m_referenceWidth != m_referenceNode.Position.width ) - { - m_referenceWidth = m_referenceNode.Position.width; - m_sizeIsDirty = true; - } - return m_referenceNode != null; - } - return false; - } - } - - public string CurrentPropertyReference - { - get - { - string propertyName = string.Empty; - if( m_referenceType == TexReferenceType.Instance && m_referenceArrayId > -1 ) - { - ScreenColorNode node = UIUtils.GetScreenColorNode( m_referenceArrayId ); - propertyName = ( node != null ) ? node.PropertyName : m_propertyName; - } - else if( !m_useCustomGrab ) - { - propertyName = GrabTextureDefault; - } - else - { - propertyName = m_propertyName; - } - return propertyName; - } - } - - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - if( UIUtils.CurrentShaderVersion() > 12 ) - { - m_referenceType = (TexReferenceType)Enum.Parse( typeof( TexReferenceType ), GetCurrentParam( ref nodeParams ) ); - if( UIUtils.CurrentShaderVersion() > 22 ) - { - m_referenceNodeId = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - } - else - { - m_referenceArrayId = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - } - - if( m_referenceType == TexReferenceType.Instance ) - { - UIUtils.UnregisterScreenColorNode( this ); - } - - UpdateHeaderColor(); - } - - if( UIUtils.CurrentShaderVersion() > 12101 ) - { - m_useCustomGrab = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - } - else - { - m_useCustomGrab = true; - } - - if( UIUtils.CurrentShaderVersion() > 14102 ) - { - m_normalize = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - } - - if( !m_isNodeBeingCopied && m_referenceType == TexReferenceType.Object ) - { - ContainerGraph.ScreenColorNodes.UpdateDataOnNode( UniqueId, DataToArray ); - } - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_referenceType ); - IOUtils.AddFieldValueToString( ref nodeInfo, ( ( m_referenceNode != null ) ? m_referenceNode.UniqueId : -1 ) ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_useCustomGrab ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_normalize ); - } - - public override void RefreshExternalReferences() - { - base.RefreshExternalReferences(); - if( m_referenceType == TexReferenceType.Instance ) - { - if( UIUtils.CurrentShaderVersion() > 22 ) - { - m_referenceNode = UIUtils.GetNode( m_referenceNodeId ) as ScreenColorNode; - m_referenceArrayId = UIUtils.GetScreenColorNodeRegisterId( m_referenceNodeId ); - } - else - { - m_referenceNode = UIUtils.GetScreenColorNode( m_referenceArrayId ); - if( m_referenceNode != null ) - { - m_referenceNodeId = m_referenceNode.UniqueId; - } - } - } - - if( UIUtils.CurrentShaderVersion() <= 14102 ) - { - if( m_inputPorts[ 0 ].DataType == WirePortDataType.FLOAT4 ) - m_normalize = true; - else - m_normalize = false; - } - } - - public override string PropertyName - { - get - { - if( m_useCustomGrab ) - return base.PropertyName; - else - return GrabTextureDefault; - } - } - - public override string GetPropertyValStr() - { - return PropertyName; - } - - public override string DataToArray { get { return m_propertyName; } } - - public override string GetUniformValue() - { - if( SoftValidReference ) - { - if( m_referenceNode.IsConnected ) - return string.Empty; - - return m_referenceNode.GetUniformValue(); - } -#if UNITY_5_6_OR_NEWER - return "ASE_DECLARE_SCREENSPACE_TEXTURE( " + PropertyName + " )"; -#else - return "uniform sampler2D " + PropertyName + ";"; -#endif - } - - public override bool GetUniformData( out string dataType, out string dataName, ref bool fullValue ) - { - if( SoftValidReference ) - { - //if ( m_referenceNode.IsConnected ) - //{ - // dataType = string.Empty; - // dataName = string.Empty; - //} - - return m_referenceNode.GetUniformData( out dataType, out dataName, ref fullValue ); - } -#if UNITY_5_6_OR_NEWER - dataName = "ASE_DECLARE_SCREENSPACE_TEXTURE( " + PropertyName + " )"; - dataType = string.Empty; - fullValue = true; -#else - dataType = "sampler2D"; - dataName = PropertyName; -#endif - return true; - } - - public override void CheckIfAutoRegister( ref MasterNodeDataCollector dataCollector ) - { - if( m_autoRegister && m_connStatus != NodeConnectionStatus.Connected ) - { - RegisterProperty( ref dataCollector ); - string propertyName = CurrentPropertyReference; - bool emptyName = string.IsNullOrEmpty( m_propertyInspectorName ) || propertyName == GrabTextureDefault; - dataCollector.AddGrabPass( emptyName ? string.Empty : propertyName ); - } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ScreenColorNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ScreenColorNode.cs.meta deleted file mode 100644 index 2012d503..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ScreenColorNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: b266c7cca236bcb469d6d4f13df55df5 -timeCreated: 1481126958 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ScreenDepthNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ScreenDepthNode.cs deleted file mode 100644 index d08d1c80..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ScreenDepthNode.cs +++ /dev/null @@ -1,173 +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( "Screen Depth", "Camera And Screen", "Given a screen position returns the depth of the scene to the object as seen by the camera" )] - public sealed class ScreenDepthNode : ParentNode - { - [SerializeField] - private bool m_convertToLinear = true; - - [SerializeField] - private int m_viewSpaceInt = 0; - - private const string ConvertToLinearStr = "Convert To Linear"; - - private readonly string[] m_viewSpaceStr = { "Eye Space", "0-1 Space" }; - - private readonly string[] m_vertexNameStr = { "eyeDepth", "clampDepth" }; - - private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper(); - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT4, false, "Pos" ); - AddOutputPort( WirePortDataType.FLOAT, "Depth" ); - m_autoWrapProperties = true; - m_hasLeftDropdown = true; - SetAdditonalTitleText( string.Format( Constants.SubTitleSpaceFormatStr, m_viewSpaceStr[ m_viewSpaceInt ] ) ); - } - - public override void AfterCommonInit() - { - base.AfterCommonInit(); - if( PaddingTitleLeft == 0 ) - { - PaddingTitleLeft = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; - if( PaddingTitleRight == 0 ) - PaddingTitleRight = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; - } - } - - public override void Destroy() - { - base.Destroy(); - m_upperLeftWidget = null; - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - EditorGUI.BeginChangeCheck(); - m_viewSpaceInt = m_upperLeftWidget.DrawWidget( this, m_viewSpaceInt, m_viewSpaceStr ); - if( EditorGUI.EndChangeCheck() ) - { - SetAdditonalTitleText( string.Format( Constants.SubTitleSpaceFormatStr, m_viewSpaceStr[ m_viewSpaceInt ] ) ); - } - } - - public override void DrawProperties() - { - base.DrawProperties(); - EditorGUI.BeginChangeCheck(); - m_viewSpaceInt = EditorGUILayoutPopup( "View Space", m_viewSpaceInt, m_viewSpaceStr ); - if( EditorGUI.EndChangeCheck() ) - { - SetAdditonalTitleText( string.Format( Constants.SubTitleSpaceFormatStr, m_viewSpaceStr[ m_viewSpaceInt ] ) ); - } - - m_convertToLinear = EditorGUILayoutToggle( ConvertToLinearStr, m_convertToLinear ); - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if( dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) - { - UIUtils.ShowNoVertexModeNodeMessage( this ); - return "0"; - } - - if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) - return GetOutputColorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); - - if( !( dataCollector.IsTemplate && dataCollector.IsSRP ) ) - dataCollector.AddToIncludes( UniqueId, Constants.UnityCgLibFuncs ); - - if( !dataCollector.IsTemplate || dataCollector.TemplateDataCollectorInstance.CurrentSRPType != TemplateSRPType.HD ) - { - if( dataCollector.IsTemplate && dataCollector.CurrentSRPType == TemplateSRPType.Lightweight ) - { - //dataCollector.AddToUniforms( UniqueId, Constants.CameraDepthTextureSRPVar ); - //dataCollector.AddToUniforms( UniqueId, Constants.CameraDepthTextureSRPSampler ); - dataCollector.AddToDirectives( Constants.CameraDepthTextureLWEnabler, -1, AdditionalLineType.Define ); - } - else - { - dataCollector.AddToUniforms( UniqueId, Constants.CameraDepthTextureValue ); - } - dataCollector.AddToUniforms( UniqueId, Constants.CameraDepthTextureTexelSize ); - } - - - string screenPosNorm = string.Empty; - if( m_inputPorts[ 0 ].IsConnected ) - screenPosNorm = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - else - { - if( dataCollector.IsTemplate ) - { - if( !dataCollector.TemplateDataCollectorInstance.GetCustomInterpolatedData( TemplateInfoOnSematics.SCREEN_POSITION_NORMALIZED, WirePortDataType.FLOAT4, PrecisionType.Float, ref screenPosNorm, true,MasterNodePortCategory.Fragment ) ) - { - screenPosNorm = GeneratorUtils.GenerateScreenPositionNormalized( ref dataCollector, UniqueId, CurrentPrecisionType, !dataCollector.UsingCustomScreenPos ); - } - } - else - { - screenPosNorm = GeneratorUtils.GenerateScreenPositionNormalized( ref dataCollector, UniqueId, CurrentPrecisionType, !dataCollector.UsingCustomScreenPos ); - } - } - - string screenDepthInstruction = TemplateHelperFunctions.CreateDepthFetch( dataCollector, screenPosNorm ); - - if( m_convertToLinear ) - { - string viewSpace = m_viewSpaceInt == 0 ? "LinearEyeDepth" : "Linear01Depth"; - string formatStr = string.Empty; - if( ( dataCollector.IsTemplate && dataCollector.IsSRP ) ) - formatStr = "(" + screenDepthInstruction + ",_ZBufferParams)"; - else - formatStr = "(" + screenDepthInstruction + ")"; - screenDepthInstruction = viewSpace + formatStr; - } - else - { - if( m_viewSpaceInt == 0 ) - { - screenDepthInstruction = string.Format( "({0}*( _ProjectionParams.z - _ProjectionParams.y ))", screenDepthInstruction ); - } - } - - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT, m_vertexNameStr[ m_viewSpaceInt ] + OutputId, screenDepthInstruction ); - - m_outputPorts[ 0 ].SetLocalValue( m_vertexNameStr[ m_viewSpaceInt ] + OutputId, dataCollector.PortCategory ); - return GetOutputColorItem( 0, outputId, m_vertexNameStr[ m_viewSpaceInt ] + OutputId ); - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - m_viewSpaceInt = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - if( UIUtils.CurrentShaderVersion() >= 13901 ) - { - m_convertToLinear = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - } - - SetAdditonalTitleText( string.Format( Constants.SubTitleSpaceFormatStr, m_viewSpaceStr[ m_viewSpaceInt ] ) ); - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_viewSpaceInt ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_convertToLinear ); - } - } - -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ScreenDepthNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ScreenDepthNode.cs.meta deleted file mode 100644 index 95f77777..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ScreenDepthNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 52266d8a6f7f4fe428dcee2ddb0514ac -timeCreated: 1481126955 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ScreenPosInputsNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ScreenPosInputsNode.cs deleted file mode 100644 index 6acaa57f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ScreenPosInputsNode.cs +++ /dev/null @@ -1,155 +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( "Screen Position", "Camera And Screen", "Screen space position, you can either get the <b>Screen</b> position as is or <b>Normalize</b> it to have it at the [0,1] range" )] - public sealed class ScreenPosInputsNode : SurfaceShaderINParentNode - { - private const string ProjectStr = "Project"; - private const string UVInvertHack = "Scale and Offset"; - private readonly string[] m_outputTypeStr = { "Normalized", "Screen" }; - - [SerializeField] - private int m_outputTypeInt = 0; - - [SerializeField] - private bool m_scaleAndOffset = false; - - private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper(); - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_currentInput = SurfaceInputs.SCREEN_POS; - InitialSetup(); - m_textLabelWidth = 65; - m_autoWrapProperties = true; - - m_hasLeftDropdown = true; - m_previewShaderGUID = "a5e7295278a404175b732f1516fb68a6"; - - if( UIUtils.CurrentWindow != null && UIUtils.CurrentWindow.CurrentGraph != null && UIUtils.CurrentShaderVersion() <= 2400 ) - { - m_outputTypeInt = 1; - m_previewMaterialPassId = m_outputTypeInt; - } - - ConfigureHeader(); - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - EditorGUI.BeginChangeCheck(); - m_outputTypeInt = m_upperLeftWidget.DrawWidget( this, m_outputTypeInt, m_outputTypeStr ); - if( EditorGUI.EndChangeCheck() ) - { - ConfigureHeader(); - } - } - - public override void DrawProperties() - { - //base.DrawProperties(); - - EditorGUI.BeginChangeCheck(); - m_outputTypeInt = EditorGUILayoutPopup( "Type", m_outputTypeInt, m_outputTypeStr ); - if( EditorGUI.EndChangeCheck() ) - { - ConfigureHeader(); - } - } - - void ConfigureHeader() - { - SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, m_outputTypeStr[ m_outputTypeInt ] ) ); - m_previewMaterialPassId = m_outputTypeInt; - } - - public override void Reset() - { - base.Reset(); - } - - public override void Destroy() - { - base.Destroy(); - m_upperLeftWidget = null; - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) - { - if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) - { - return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); - } - m_currentPrecisionType = PrecisionType.Float; - - string screenPos = string.Empty; - if( m_outputTypeInt == 0 ) - { - if( dataCollector.IsTemplate ) - { - screenPos = dataCollector.TemplateDataCollectorInstance.GetScreenPosNormalized( CurrentPrecisionType ); - } - else - { - screenPos = GeneratorUtils.GenerateScreenPositionNormalized( ref dataCollector, UniqueId, CurrentPrecisionType); - } - } - else - { - if( dataCollector.IsTemplate ) - { - screenPos = dataCollector.TemplateDataCollectorInstance.GetScreenPos( CurrentPrecisionType ); - } - else - { - screenPos = GeneratorUtils.GenerateScreenPosition( ref dataCollector, UniqueId, CurrentPrecisionType ); - } - } - - m_outputPorts[ 0 ].SetLocalValue( screenPos, dataCollector.PortCategory ); - return GetOutputVectorItem( 0, outputId, screenPos ); - - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - if( UIUtils.CurrentShaderVersion() > 2400 ) - { - if( UIUtils.CurrentShaderVersion() < 6102 ) - { - bool project = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - m_outputTypeInt = project ? 0 : 1; - } - else - { - m_outputTypeInt = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - } - } - - if( UIUtils.CurrentShaderVersion() > 3107 ) - { - m_scaleAndOffset = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - m_scaleAndOffset = false; - } - - ConfigureHeader(); - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_outputTypeInt ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_scaleAndOffset ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ScreenPosInputsNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ScreenPosInputsNode.cs.meta deleted file mode 100644 index 60d2abbd..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ScreenPosInputsNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 32cea8ff65efa3844a0047477ec789da -timeCreated: 1481126954 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/SurfaceShaderINParentNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/SurfaceShaderINParentNode.cs deleted file mode 100644 index e0f094b0..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/SurfaceShaderINParentNode.cs +++ /dev/null @@ -1,122 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using UnityEngine; - -namespace AmplifyShaderEditor -{ - [Serializable] - public class SurfaceShaderINParentNode : ParentNode - { - [SerializeField] - protected SurfaceInputs m_currentInput; - - [SerializeField] - protected string m_currentInputValueStr; - - [SerializeField] - protected string m_currentInputDecStr; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_currentInput = SurfaceInputs.UV_COORDS; - m_textLabelWidth = 65; - m_customPrecision = true; - } - - public override void DrawProperties() - { - base.DrawProperties(); - DrawPrecisionProperty(); - } - //This needs to be called on the end of the CommonInit on all children - protected void InitialSetup() - { - m_currentInputValueStr = Constants.InputVarStr + "." + UIUtils.GetInputValueFromType( m_currentInput ); - - string outputName = "Out"; - switch ( m_currentInput ) - { - case SurfaceInputs.DEPTH: - { - AddOutputPort( WirePortDataType.FLOAT, outputName ); - } - break; - case SurfaceInputs.UV_COORDS: - { - outputName = "UV"; - AddOutputVectorPorts( WirePortDataType.FLOAT2, outputName ); - } - break; - case SurfaceInputs.UV2_COORDS: - { - outputName = "UV"; - AddOutputVectorPorts( WirePortDataType.FLOAT2, outputName ); - } - break; - case SurfaceInputs.VIEW_DIR: - { - outputName = "XYZ"; - AddOutputVectorPorts( WirePortDataType.FLOAT3, outputName ); - } - break; - case SurfaceInputs.COLOR: - { - outputName = "RGBA"; - AddOutputVectorPorts( WirePortDataType.FLOAT4, outputName ); - } - break; - case SurfaceInputs.SCREEN_POS: - { - outputName = "XYZW"; - AddOutputVectorPorts( WirePortDataType.FLOAT4, outputName ); - } - break; - case SurfaceInputs.WORLD_POS: - { - outputName = "XYZ"; - AddOutputVectorPorts( WirePortDataType.FLOAT3, outputName ); - } - break; - case SurfaceInputs.WORLD_REFL: - { - outputName = "XYZ"; - AddOutputVectorPorts( WirePortDataType.FLOAT3, outputName ); - } - break; - case SurfaceInputs.WORLD_NORMAL: - { - outputName = "XYZ"; - AddOutputVectorPorts( WirePortDataType.FLOAT3, outputName ); - } - break; - } - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) - { - dataCollector.AddToInput( UniqueId, m_currentInput, CurrentPrecisionType ); - switch ( m_currentInput ) - { - case SurfaceInputs.VIEW_DIR: - case SurfaceInputs.WORLD_REFL: - case SurfaceInputs.WORLD_NORMAL: - { - dataCollector.AddToInput( UniqueId, SurfaceInputs.INTERNALDATA, addSemiColon: false ); - } - break; - case SurfaceInputs.WORLD_POS: - case SurfaceInputs.DEPTH: - case SurfaceInputs.UV_COORDS: - case SurfaceInputs.UV2_COORDS: - case SurfaceInputs.COLOR: - case SurfaceInputs.SCREEN_POS: break; - }; - - return GetOutputVectorItem( 0, outputId, m_currentInputValueStr ); - } - - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/SurfaceShaderINParentNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/SurfaceShaderINParentNode.cs.meta deleted file mode 100644 index 92a1e5b1..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/SurfaceShaderINParentNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 71628885b2fde0944bf7dd8e4eb2770f -timeCreated: 1481126956 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/TexelSizeNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/TexelSizeNode.cs deleted file mode 100644 index 2659320f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/TexelSizeNode.cs +++ /dev/null @@ -1,304 +0,0 @@ -using UnityEngine; -using UnityEditor; -using System.Collections.Generic; - -using System; -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Texel Size", "Textures", "Texel Size for a given texture object" )] - public sealed class TexelSizeNode : ParentNode - { - private readonly string[] Dummy = { string.Empty }; - [SerializeField] - private int m_referenceSamplerId = -1; - - [SerializeField] - private int m_referenceNodeId = -1; - - [SerializeField] - private TexturePropertyNode m_inputReferenceNode = null; - - private TexturePropertyNode m_referenceNode = null; - - private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper(); - - private int m_cachedSamplerId = -1; - private int m_cachedSamplerIdArray = -1; - private int m_cachedSamplerIdCube = -1; - private int m_cachedSamplerId3D = -1; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.SAMPLER2D, false, "Tex" ); - m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.SAMPLER1D, WirePortDataType.SAMPLER2D, WirePortDataType.SAMPLER3D, WirePortDataType.SAMPLERCUBE, WirePortDataType.OBJECT ); - AddOutputVectorPorts( WirePortDataType.FLOAT4, Constants.EmptyPortValue ); - ChangeOutputName( 1, "1/Width" ); - ChangeOutputName( 2, "1/Height" ); - ChangeOutputName( 3, "Width" ); - ChangeOutputName( 4, "Height" ); - m_textLabelWidth = 80; - m_autoWrapProperties = true; - m_hasLeftDropdown = true; - m_previewShaderGUID = "6b20226576a059443b58aa2d0b942276"; - } - - public override void AfterCommonInit() - { - base.AfterCommonInit(); - - if( PaddingTitleLeft == 0 ) - { - PaddingTitleLeft = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; - if( PaddingTitleRight == 0 ) - PaddingTitleRight = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; - } - } - - public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) - { - base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); - m_inputReferenceNode = m_inputPorts[ 0 ].GetOutputNodeWhichIsNotRelay() as TexturePropertyNode; - UpdateTitle(); - } - - public override void OnInputPortDisconnected( int portId ) - { - base.OnInputPortDisconnected( portId ); - m_inputReferenceNode = null; - UpdateTitle(); - } - - - void UpdateTitle() - { - if ( m_inputReferenceNode != null ) - { - m_additionalContent.text = string.Format( Constants.PropertyValueLabel, m_inputReferenceNode.PropertyInspectorName ); - } - else if ( m_referenceSamplerId > -1 && m_referenceNode != null ) - { - m_additionalContent.text = string.Format( Constants.PropertyValueLabel, m_referenceNode.PropertyInspectorName ); - } - else - { - m_additionalContent.text = string.Empty; - } - m_sizeIsDirty = true; - } - - public override void DrawProperties() - { - base.DrawProperties(); - bool guiEnabledBuffer = GUI.enabled; - EditorGUI.BeginChangeCheck(); - List<string> arr = new List<string>( UIUtils.TexturePropertyNodeArr() ); - - if( arr != null && arr.Count > 0 ) - { - arr.Insert( 0, "None" ); - GUI.enabled = true && ( !m_inputPorts[ 0 ].IsConnected ); - m_referenceSamplerId = EditorGUILayoutPopup( Constants.AvailableReferenceStr, m_referenceSamplerId + 1, arr.ToArray() ) - 1; - } - else - { - m_referenceSamplerId = -1; - GUI.enabled = false; - EditorGUILayoutPopup( Constants.AvailableReferenceStr, m_referenceSamplerId, Dummy ); - } - - GUI.enabled = guiEnabledBuffer; - if( EditorGUI.EndChangeCheck() ) - { - m_referenceNode = UIUtils.GetTexturePropertyNode( m_referenceSamplerId ); - if( m_referenceNode != null ) - { - m_referenceNodeId = m_referenceNode.UniqueId; - } - else - { - m_referenceNodeId = -1; - m_referenceSamplerId = -1; - } - UpdateTitle(); - } - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); - string texelName = string.Empty; - - if ( m_inputPorts[ 0 ].IsConnected ) - { - texelName = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ) + "_TexelSize"; - } - else if ( m_referenceNode != null ) - { - m_referenceNode.BaseGenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); - texelName = m_referenceNode.PropertyName + "_TexelSize"; - } - else - { - texelName = "_TexelSize"; - UIUtils.ShowMessage( UniqueId, "Please specify a texture sample on the Texel Size node", MessageSeverity.Warning ); - } - - dataCollector.AddToUniforms( UniqueId, "float4 " + texelName + ";", dataCollector.IsSRP ); - - switch ( outputId ) - { - case 0: return texelName; - case 1: return ( texelName + ".x" ); - case 2: return ( texelName + ".y" ); - case 3: return ( texelName + ".z" ); - case 4: return ( texelName + ".w" ); - } - - return string.Empty; - } - - void SetPreviewTexture( Texture newValue ) - { - if( newValue is Cubemap ) - { - m_previewMaterialPassId = 3; - if( m_cachedSamplerIdCube == -1 ) - m_cachedSamplerIdCube = Shader.PropertyToID( "_Cube" ); - - PreviewMaterial.SetTexture( m_cachedSamplerIdCube, newValue as Cubemap ); - } - else if( newValue is Texture2DArray ) - { - - m_previewMaterialPassId = 2; - if( m_cachedSamplerIdArray == -1 ) - m_cachedSamplerIdArray = Shader.PropertyToID( "_Array" ); - - PreviewMaterial.SetTexture( m_cachedSamplerIdArray, newValue as Texture2DArray ); - } - else if( newValue is Texture3D ) - { - m_previewMaterialPassId = 1; - if( m_cachedSamplerId3D == -1 ) - m_cachedSamplerId3D = Shader.PropertyToID( "_Sampler3D" ); - - PreviewMaterial.SetTexture( m_cachedSamplerId3D, newValue as Texture3D ); - } - else - { - m_previewMaterialPassId = 0; - if( m_cachedSamplerId == -1 ) - m_cachedSamplerId = Shader.PropertyToID( "_Sampler" ); - - PreviewMaterial.SetTexture( m_cachedSamplerId, newValue ); - } - } - - public override void SetPreviewInputs() - { - base.SetPreviewInputs(); - if( m_inputPorts[0].IsConnected ) - { - SetPreviewTexture( m_inputPorts[ 0 ].InputPreviewTexture( ContainerGraph ) ); - } - else if( m_referenceNode != null ) - { - if( m_referenceNode.Value != null ) - { - SetPreviewTexture( m_referenceNode.Value ); - } - else - { - SetPreviewTexture( m_referenceNode.PreviewTexture ); - } - } - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - - EditorGUI.BeginChangeCheck(); - { - List<string> arr = new List<string>( UIUtils.TexturePropertyNodeArr() ); - bool guiEnabledBuffer = GUI.enabled; - - if( arr != null && arr.Count > 0 ) - { - arr.Insert( 0, "None" ); - GUI.enabled = true && ( !m_inputPorts[ 0 ].IsConnected ); - m_referenceSamplerId = m_upperLeftWidget.DrawWidget( this, m_referenceSamplerId + 1, arr.ToArray() ) - 1; - } - else - { - m_referenceSamplerId = -1; - GUI.enabled = false; - m_upperLeftWidget.DrawWidget( this, m_referenceSamplerId, Dummy ); - } - GUI.enabled = guiEnabledBuffer; - } - if( EditorGUI.EndChangeCheck() ) - { - m_referenceNode = UIUtils.GetTexturePropertyNode( m_referenceSamplerId ); - if( m_referenceNode != null ) - { - m_referenceNodeId = m_referenceNode.UniqueId; - } - else - { - m_referenceNodeId = -1; - m_referenceSamplerId = -1; - } - UpdateTitle(); - } - } - - public override void RefreshExternalReferences() - { - base.RefreshExternalReferences(); - if ( UIUtils.CurrentShaderVersion() > 2404 ) - { - m_referenceNode = UIUtils.GetNode( m_referenceNodeId ) as TexturePropertyNode; - m_referenceSamplerId = UIUtils.GetTexturePropertyNodeRegisterId( m_referenceNodeId ); - } - else - { - m_referenceNode = UIUtils.GetTexturePropertyNode( m_referenceSamplerId ); - if ( m_referenceNode != null ) - { - m_referenceNodeId = m_referenceNode.UniqueId; - } - } - UpdateTitle(); - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - if ( UIUtils.CurrentShaderVersion() > 2404 ) - { - m_referenceNodeId = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - } - else - { - m_referenceSamplerId = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - } - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_referenceNodeId ); - } - - public override void Destroy() - { - base.Destroy(); - m_referenceNode = null; - m_inputReferenceNode = null; - m_upperLeftWidget = null; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/TexelSizeNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/TexelSizeNode.cs.meta deleted file mode 100644 index 1e6fa013..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/TexelSizeNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 1a23decd88779d24f9af6ae30c3d5a5f -timeCreated: 1481126953 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/UVCoordsParentNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/UVCoordsParentNode.cs deleted file mode 100644 index b259d89f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/UVCoordsParentNode.cs +++ /dev/null @@ -1,112 +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( "[Old]Texture Coordinates", "Surface Data", "Texture UV coordinates set", null, KeyCode.U, false )] -// public sealed class UVCoordsParentNode : ParentNode -// { -// private const string TilingStr = "Tiling"; - -// [SerializeField] -// private int m_textureCoordChannel = 0; - -// [SerializeField] -// private int m_textureCoordSet = 0; - -// [SerializeField] -// private Vector2 m_tiling = new Vector2( 1, 1 ); - -// protected override void CommonInit( int uniqueId ) -// { -// base.CommonInit( uniqueId ); -// AddOutputVectorPorts( WirePortDataType.FLOAT2, Constants.EmptyPortValue ); -// m_textLabelWidth = 75; -// } - -// public override void DrawProperties() -// { -// base.DrawProperties(); -// int newChannel = EditorGUILayoutIntPopup( Constants.AvailableUVChannelLabel, m_textureCoordChannel, Constants.AvailableUVChannelsStr, Constants.AvailableUVChannels ); -// if ( newChannel != m_textureCoordChannel ) -// { -// if ( UIUtils.IsChannelAvailable( newChannel ) ) -// { -// UIUtils.ShowMessage( "Attempting to use an unoccupied used texture channel" ); -// } -// else -// { -// m_textureCoordChannel = newChannel; -// } -// } -// else if ( m_textureCoordChannel > -1 && UIUtils.IsChannelAvailable( m_textureCoordChannel ) ) -// { -// UIUtils.ShowMessage( "Texture Channel " + m_textureCoordChannel + " is unavailable for TextureCoordinate node" ); -// m_textureCoordChannel = -1; -// } - -// m_textureCoordSet = EditorGUILayoutIntPopup( Constants.AvailableUVSetsLabel, m_textureCoordSet, Constants.AvailableUVSetsStr, Constants.AvailableUVSets ); - -// m_tiling = EditorGUILayoutVector2Field( TilingStr, m_tiling ); -// } - -// public override void Draw( DrawInfo drawInfo ) -// { -// base.Draw( drawInfo ); -// if ( m_isVisible ) -// { -// m_propertyDrawPos.x = m_globalPosition.x + Constants.FLOAT_WIDTH_SPACING; -// m_propertyDrawPos.y = m_outputPorts[ 1 ].Position.y; -// m_propertyDrawPos.width = 2.7f * drawInfo.InvertedZoom * Constants.FLOAT_DRAW_WIDTH_FIELD_SIZE; -// m_propertyDrawPos.height = drawInfo.InvertedZoom * Constants.FLOAT_DRAW_HEIGHT_FIELD_SIZE; - -// m_propertyDrawPos.y = m_outputPorts[ 1 ].Position.y; -// UIUtils.DrawFloat( this, ref m_propertyDrawPos, ref m_tiling.x ); - -// m_propertyDrawPos.y = m_outputPorts[ 2 ].Position.y; -// UIUtils.DrawFloat( this, ref m_propertyDrawPos, ref m_tiling.y ); -// } -// } - -// public override void ReadFromString( ref string[] nodeParams ) -// { -// base.ReadFromString( ref nodeParams ); -// m_textureCoordChannel = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); -// m_tiling.x = Convert.ToSingle( GetCurrentParam( ref nodeParams ) ); -// m_tiling.y = Convert.ToSingle( GetCurrentParam( ref nodeParams ) ); -// } - -// public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) -// { -// base.WriteToString( ref nodeInfo, ref connectionsInfo ); -// IOUtils.AddFieldValueToString( ref nodeInfo, m_textureCoordChannel ); -// IOUtils.AddFieldValueToString( ref nodeInfo, m_tiling.x ); -// IOUtils.AddFieldValueToString( ref nodeInfo, m_tiling.y ); -// } - -// public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) -// { -// string uvChannelDeclaration = IOUtils.GetUVChannelDeclaration( UIUtils.GetChannelName( m_textureCoordChannel ), m_textureCoordChannel, m_textureCoordSet ); -// dataCollector.AddToInput( UniqueId, uvChannelDeclaration, true ); - -// if ( dataCollector.GetChannelUsage( m_textureCoordChannel ) != TextureChannelUsage.Used ) -// dataCollector.SetChannelUsage( m_textureCoordChannel, TextureChannelUsage.Required ); - -// string uvTileStr = string.Empty; -// switch ( outputId ) -// { -// case 0: { uvTileStr = "float2( " + m_tiling.x + " , " + m_tiling.y + " )"; } break; -// case 1: { uvTileStr = m_tiling.x.ToString(); } break; -// case 2: { uvTileStr = m_tiling.y.ToString(); } break; -// } -// string uvChannelName = IOUtils.GetUVChannelName( UIUtils.GetChannelName( m_textureCoordChannel ), m_textureCoordSet ); -// return ( uvTileStr + "*" + GetOutputVectorItem( 0, outputId, Constants.InputVarStr + "." + uvChannelName ) ); -// } - -// } -//} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/UVCoordsParentNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/UVCoordsParentNode.cs.meta deleted file mode 100644 index eae8ca56..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/UVCoordsParentNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 73fb18e7d547d514695cb0b83a29f80e -timeCreated: 1481126956 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ViewDirInputsCoordNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ViewDirInputsCoordNode.cs deleted file mode 100644 index e60a359f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ViewDirInputsCoordNode.cs +++ /dev/null @@ -1,167 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> -using System; -using UnityEngine; -using UnityEditor; - -namespace AmplifyShaderEditor -{ - public enum ViewSpace - { - Tangent, - World - } - - [Serializable] - [NodeAttributes( "View Dir", "Camera And Screen", "View direction vector, you can select between <b>World</b> space or <b>Tangent</b> space" )] - public sealed class ViewDirInputsCoordNode : SurfaceShaderINParentNode - { - private const string SpaceStr = "Space"; - private const string WorldDirVarStr = "worldViewDir"; - private const string NormalizeOptionStr = "Safe Normalize"; - - [SerializeField] - private bool m_safeNormalize = false; - - [SerializeField] - private ViewSpace m_viewDirSpace = ViewSpace.World; - - private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper(); - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_currentInput = SurfaceInputs.VIEW_DIR; - InitialSetup(); - m_textLabelWidth = 120; - m_autoWrapProperties = true; - m_drawPreviewAsSphere = true; - m_hasLeftDropdown = true; - UpdateTitle(); - m_previewShaderGUID = "07b57d9823df4bd4d8fe6dcb29fca36a"; - } - - private void UpdateTitle() - { - m_additionalContent.text = string.Format( Constants.SubTitleSpaceFormatStr, m_viewDirSpace.ToString() ); - m_sizeIsDirty = true; - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - m_upperLeftWidget.DrawWidget<ViewSpace>( ref m_viewDirSpace, this, OnWidgetUpdate ); - } - - private readonly Action<ParentNode> OnWidgetUpdate = ( x ) => - { - ( x as ViewDirInputsCoordNode ).UpdateTitle(); - }; - - public override void DrawProperties() - { - //base.DrawProperties(); - EditorGUI.BeginChangeCheck(); - m_viewDirSpace = (ViewSpace)EditorGUILayoutEnumPopup( SpaceStr, m_viewDirSpace ); - if( EditorGUI.EndChangeCheck() ) - { - UpdateTitle(); - } - m_safeNormalize = EditorGUILayoutToggle( NormalizeOptionStr, m_safeNormalize ); - EditorGUILayout.HelpBox( "Having safe normalize ON makes sure your view vector is not zero even if you are using your shader with no cameras.", MessageType.None ); - } - - public override void SetPreviewInputs() - { - base.SetPreviewInputs(); - - if( m_viewDirSpace == ViewSpace.World ) - m_previewMaterialPassId = 0; - else if( m_viewDirSpace == ViewSpace.Tangent ) - m_previewMaterialPassId = 1; - } - - public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) - { - base.PropagateNodeData( nodeData, ref dataCollector ); - if( m_viewDirSpace == ViewSpace.Tangent ) - dataCollector.DirtyNormal = true; - - if( m_safeNormalize ) - dataCollector.SafeNormalizeViewDir = true; - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) - { - if( dataCollector.IsTemplate ) - { - string varName = ( m_viewDirSpace == ViewSpace.World ) ? dataCollector.TemplateDataCollectorInstance.GetViewDir(true,MasterNodePortCategory.Fragment, m_safeNormalize?NormalizeType.Safe:NormalizeType.Regular) : - dataCollector.TemplateDataCollectorInstance.GetTangentViewDir( CurrentPrecisionType, true,MasterNodePortCategory.Fragment, m_safeNormalize ? NormalizeType.Safe : NormalizeType.Regular ); - return GetOutputVectorItem( 0, outputId, varName ); - } - - - if( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) - { - string result = GeneratorUtils.GenerateViewDirection( ref dataCollector, UniqueId, m_viewDirSpace ); - return GetOutputVectorItem( 0, outputId, result ); - } - else - { - if( m_viewDirSpace == ViewSpace.World ) - { - if( dataCollector.DirtyNormal || m_safeNormalize ) - { - dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_POS ); - string result = GeneratorUtils.GenerateViewDirection( ref dataCollector, UniqueId ); - return GetOutputVectorItem( 0, outputId, result ); - } - else - { - dataCollector.AddToInput( UniqueId, SurfaceInputs.VIEW_DIR, PrecisionType.Float ); - return GetOutputVectorItem( 0, outputId, m_currentInputValueStr ); - //return base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalVar ); - } - } - else - { - if( m_safeNormalize ) - { - dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_NORMAL, CurrentPrecisionType ); - dataCollector.AddToInput( UniqueId, SurfaceInputs.INTERNALDATA, addSemiColon: false ); - dataCollector.ForceNormal = true; - dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_POS ); - string result = GeneratorUtils.GenerateViewDirection( ref dataCollector, UniqueId, ViewSpace.Tangent ); - return GetOutputVectorItem( 0, outputId, result ); - } - else - { - dataCollector.ForceNormal = true; - return base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalVar ); - } - } - } - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - if( UIUtils.CurrentShaderVersion() > 2402 ) - m_viewDirSpace = (ViewSpace)Enum.Parse( typeof( ViewSpace ), GetCurrentParam( ref nodeParams ) ); - - if( UIUtils.CurrentShaderVersion() > 15201 ) - { - m_safeNormalize = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - } - - UpdateTitle(); - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_viewDirSpace ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_safeNormalize ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ViewDirInputsCoordNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ViewDirInputsCoordNode.cs.meta deleted file mode 100644 index 32985728..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/ViewDirInputsCoordNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 4755b85e957e31d4b96d341070b156b5 -timeCreated: 1481126955 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldNormalInputsNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldNormalInputsNode.cs deleted file mode 100644 index d179cddb..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldNormalInputsNode.cs +++ /dev/null @@ -1,119 +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( "[Deprecated] World Normal", "Surface Data", "Vertex Normal World", null, KeyCode.None, true, true, "World Normal", typeof( WorldNormalVector ) )] - public sealed class WorldNormalInputsNode : SurfaceShaderINParentNode - { - private const string PerPixelLabelStr = "Per Pixel"; - - [SerializeField] - private bool m_perPixel = true; - - [SerializeField] - private string m_precisionString; - - [SerializeField] - private bool m_addInstruction = false; - - public override void Reset() - { - base.Reset(); - m_addInstruction = true; - } - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_currentInput = SurfaceInputs.WORLD_NORMAL; - InitialSetup(); - //UIUtils.AddNormalDependentCount(); - } - - //public override void Destroy() - //{ - // ContainerGraph.RemoveNormalDependentCount(); - // base.Destroy(); - //} - - public override void DrawProperties() - { - base.DrawProperties(); - m_perPixel = EditorGUILayoutToggleLeft( PerPixelLabelStr, m_perPixel ); - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) - { - if ( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) - { - if ( m_addInstruction ) - { - string precision = UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, WirePortDataType.FLOAT3 ); - dataCollector.AddVertexInstruction( precision + " worldNormal = UnityObjectToWorldNormal(" + Constants.VertexShaderInputStr + ".normal)", UniqueId ); - m_addInstruction = false; - } - - return GetOutputVectorItem( 0, outputId, "worldNormal" ); - } - else - { - dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_NORMAL, CurrentPrecisionType ); - dataCollector.AddToInput( UniqueId, SurfaceInputs.INTERNALDATA, addSemiColon: false ); - if ( dataCollector.PortCategory != MasterNodePortCategory.Debug && m_perPixel && dataCollector.DirtyNormal ) - { - //string result = "WorldNormalVector( " + Constants.InputVarStr + " , float3( 0,0,1 ))"; - m_precisionString = UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, WirePortDataType.FLOAT3 ); - string result = string.Format( Constants.WorldNormalLocalDecStr, m_precisionString ); - int count = 0; - for ( int i = 0; i < m_outputPorts.Count; i++ ) - { - if ( m_outputPorts[ i ].IsConnected ) - { - if ( m_outputPorts[ i ].ConnectionCount > 2 ) - { - count = 2; - break; - } - count += 1; - if ( count > 1 ) - break; - } - } - if ( count > 1 ) - { - string localVarName = "WorldNormal" + OutputId; - dataCollector.AddToLocalVariables( UniqueId, CurrentPrecisionType, m_outputPorts[ 0 ].DataType, localVarName, result ); - return GetOutputVectorItem( 0, outputId, localVarName ); - } - else - { - return GetOutputVectorItem( 0, outputId, result ); - } - } - else - { - return base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalVar ); - } - } - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - if ( UIUtils.CurrentShaderVersion() > 2504 ) - m_perPixel = 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_perPixel ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldNormalInputsNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldNormalInputsNode.cs.meta deleted file mode 100644 index da99f65c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldNormalInputsNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 891e3ffa10c12c54e83a1e40df03df2f -timeCreated: 1481126957 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldNormalVector.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldNormalVector.cs deleted file mode 100644 index 861ee6d2..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldNormalVector.cs +++ /dev/null @@ -1,178 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using UnityEngine; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "World Normal", "Surface Data", "Per pixel world normal vector, accepts a <b>Normal</b> vector in tangent space (ie: normalmap)" )] - public sealed class WorldNormalVector : ParentNode - { - private const string NormalVecValStr = "newWorldNormal"; - private const string NormalVecDecStr = "float3 {0} = {1};"; - - private const string NormalizeOptionStr = "Normalize"; - private const string NormalizeFunc = "normalize( {0} )"; - - [SerializeField] - private bool m_normalize = false; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT3, false, "Normal" ); - AddOutputVectorPorts( WirePortDataType.FLOAT3, "XYZ" ); - m_inputPorts[ 0 ].Vector3InternalData = Vector3.forward; - m_previewShaderGUID = "5f55f4841abb61e45967957788593a9d"; - m_drawPreviewAsSphere = true; - m_autoWrapProperties = true; - m_textLabelWidth = 80; - } - - public override void SetPreviewInputs() - { - base.SetPreviewInputs(); - - if( m_inputPorts[ 0 ].IsConnected ) - m_previewMaterialPassId = 1; - else - m_previewMaterialPassId = 0; - } - - public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) - { - base.PropagateNodeData( nodeData, ref dataCollector ); - if( m_inputPorts[ 0 ].IsConnected ) - dataCollector.DirtyNormal = true; - } - - public override void DrawProperties() - { - base.DrawProperties(); - m_normalize = EditorGUILayoutToggle( NormalizeOptionStr, m_normalize ); - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if( dataCollector.IsTemplate ) - { - if( m_inputPorts[ 0 ].IsConnected ) - { - if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) - return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); - - - string value = dataCollector.TemplateDataCollectorInstance.GetWorldNormal( UniqueId, CurrentPrecisionType, m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ), OutputId ); - if( m_normalize ) - { - value = string.Format( NormalizeFunc, value ); - } - RegisterLocalVariable( 0, value, ref dataCollector, "worldNormal" + OutputId ); - return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); - } - else - { - string value = dataCollector.TemplateDataCollectorInstance.GetWorldNormal( CurrentPrecisionType ); - string name; - if( m_normalize ) - { - name = "normalizedWorldNormal"; - value = string.Format( NormalizeFunc, value ); - RegisterLocalVariable( 0, value, ref dataCollector, name ); - } - else - { - name = value; - } - return GetOutputVectorItem( 0, outputId, name ); - } - } - - if( dataCollector.PortCategory == MasterNodePortCategory.Fragment || dataCollector.PortCategory == MasterNodePortCategory.Debug ) - { - dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_NORMAL, CurrentPrecisionType ); - - string result = string.Empty; - if( m_inputPorts[ 0 ].IsConnected ) - { - dataCollector.AddToInput( UniqueId, SurfaceInputs.INTERNALDATA, addSemiColon: false ); - dataCollector.ForceNormal = true; - - result = "(WorldNormalVector( " + Constants.InputVarStr + " , " + m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ) + " ))"; - if( m_normalize ) - { - result = string.Format( NormalizeFunc, result ); - } - - int connCount = 0; - for( int i = 0; i < m_outputPorts.Count; i++ ) - { - connCount += m_outputPorts[ i ].ConnectionCount; - } - - if( connCount > 1 ) - { - dataCollector.AddToLocalVariables( UniqueId, string.Format( NormalVecDecStr, NormalVecValStr + OutputId, result ) ); - return GetOutputVectorItem( 0, outputId, NormalVecValStr + OutputId ); - } - } - else - { - if( !dataCollector.DirtyNormal ) - { - result = GeneratorUtils.GenerateWorldNormal( ref dataCollector, UniqueId, m_normalize ); - } - else - { - dataCollector.AddToInput( UniqueId, SurfaceInputs.INTERNALDATA, addSemiColon: false ); - result = GeneratorUtils.GenerateWorldNormal( ref dataCollector, UniqueId, m_normalize ); - dataCollector.ForceNormal = true; - } - } - - return GetOutputVectorItem( 0, outputId, result ); - } - else - { - if( m_inputPorts[ 0 ].IsConnected ) - { - string inputTangent = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - - string normal = GeneratorUtils.GenerateWorldNormal( ref dataCollector, UniqueId ); - string tangent = GeneratorUtils.GenerateWorldTangent( ref dataCollector, UniqueId ); - dataCollector.AddToVertexLocalVariables( UniqueId, "float3x3 tangentToWorld = CreateTangentToWorldPerVertex( " + normal + ", " + tangent + ", " + Constants.VertexShaderInputStr + ".tangent.w );" ); - dataCollector.AddToVertexLocalVariables( UniqueId, "float3 tangentNormal" + OutputId + " = " + inputTangent + ";" ); - string result = "(tangentToWorld[0] * tangentNormal" + OutputId + ".x + tangentToWorld[1] * tangentNormal" + OutputId + ".y + tangentToWorld[2] * tangentNormal" + OutputId + ".z)"; - if( m_normalize ) - { - result = string.Format( NormalizeFunc, result ); - } - dataCollector.AddToVertexLocalVariables( UniqueId, "float3 modWorldNormal" + OutputId + " = " + result + ";" ); - return GetOutputVectorItem( 0, outputId, "modWorldNormal" + OutputId ); - } - else - { - string result = GeneratorUtils.GenerateWorldNormal( ref dataCollector, UniqueId, m_normalize ); - return GetOutputVectorItem( 0, outputId, result ); - } - } - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - if( UIUtils.CurrentShaderVersion() > 14202 ) - { - m_normalize = 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_normalize ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldNormalVector.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldNormalVector.cs.meta deleted file mode 100644 index 7646e491..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldNormalVector.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: d61a084db19701c4fb3030ee953ac509 -timeCreated: 1481126959 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldPosInputsNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldPosInputsNode.cs deleted file mode 100644 index 15c0b29f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldPosInputsNode.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using UnityEngine; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "World Position", "Surface Data", "World space position" )] - public sealed class WorldPosInputsNode : SurfaceShaderINParentNode - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_currentInput = SurfaceInputs.WORLD_POS; - m_drawPreviewAsSphere = true; - m_previewShaderGUID = "70d5405009b31a349a4d8285f30cf5d9"; - InitialSetup(); - } - - public override void DrawProperties() { } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) - { - if ( dataCollector.IsTemplate ) - { - string varName = dataCollector.TemplateDataCollectorInstance.GetWorldPos(); - return GetOutputVectorItem( 0, outputId, varName ); - } - - string worldPosition = GeneratorUtils.GenerateWorldPosition( ref dataCollector, UniqueId ); - - return GetOutputVectorItem( 0, outputId, worldPosition ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldPosInputsNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldPosInputsNode.cs.meta deleted file mode 100644 index 91f10c87..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldPosInputsNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 850bb0065928b7f499b869b8adc1ce5c -timeCreated: 1481126957 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldReflInputsNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldReflInputsNode.cs deleted file mode 100644 index 99b49780..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldReflInputsNode.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> -using UnityEngine; - -namespace AmplifyShaderEditor -{ - [System.Serializable] - [NodeAttributes( "[Deprecated] World Reflection", "Surface Data", "World reflection vector", null, KeyCode.None, true, true, "World Reflection", typeof( WorldReflectionVector ) )] - public sealed class WorldReflInputsNode : SurfaceShaderINParentNode - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_currentInput = SurfaceInputs.WORLD_REFL; - InitialSetup(); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldReflInputsNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldReflInputsNode.cs.meta deleted file mode 100644 index 8e4e079d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldReflInputsNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: e4f39f3a52f10644392decce9d1e6790 -timeCreated: 1481126959 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldReflectionVector.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldReflectionVector.cs deleted file mode 100644 index 30953218..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldReflectionVector.cs +++ /dev/null @@ -1,213 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using UnityEngine; -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "World Reflection", "Surface Data", "Per pixel world reflection vector, accepts a <b>Normal</b> vector in tangent space (ie: normalmap)" )] - public sealed class WorldReflectionVector : ParentNode - { - private const string ReflectionVecValStr = "newWorldReflection"; - private const string ReflectionVecDecStr = "float3 {0} = {1};"; - - private const string NormalizeOptionStr = "Normalize"; - private const string NormalizeFunc = "normalize( {0} )"; - - [SerializeField] - private bool m_normalize = false; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT3, false, "Normal" ); - AddOutputVectorPorts( WirePortDataType.FLOAT3, "XYZ" ); - m_drawPreviewAsSphere = true; - m_previewShaderGUID = "8e267e9aa545eeb418585a730f50273e"; - m_autoWrapProperties = true; - m_textLabelWidth = 80; - //UIUtils.AddNormalDependentCount(); - } - - public override void SetPreviewInputs() - { - base.SetPreviewInputs(); - - if( m_inputPorts[ 0 ].IsConnected ) - m_previewMaterialPassId = 1; - else - m_previewMaterialPassId = 0; - } - - public override void DrawProperties() - { - base.DrawProperties(); - m_normalize = EditorGUILayoutToggle( NormalizeOptionStr, m_normalize ); - } - - //public override void Destroy() - //{ - // ContainerGraph.RemoveNormalDependentCount(); - // base.Destroy(); - //} - - public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) - { - base.PropagateNodeData( nodeData, ref dataCollector ); - if( m_inputPorts[ 0 ].IsConnected ) - dataCollector.DirtyNormal = true; - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) - { - if( dataCollector.IsTemplate ) - { - if( m_inputPorts[ 0 ].IsConnected ) - { - if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) - return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); - - - string value = dataCollector.TemplateDataCollectorInstance.GetWorldReflection( CurrentPrecisionType, m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ) ); - if( m_normalize ) - { - value = string.Format( NormalizeFunc, value ); - } - RegisterLocalVariable( 0, value, ref dataCollector, "worldRefl" + OutputId ); - return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); - } - else - { - string name; - string value = dataCollector.TemplateDataCollectorInstance.GetWorldReflection( CurrentPrecisionType ); - if( m_normalize ) - { - name = "normalizedWorldRefl"; - value = string.Format( NormalizeFunc, value ); - RegisterLocalVariable( 0, value, ref dataCollector, name ); - } - else - { - name = value; - } - return GetOutputVectorItem( 0, outputId, name ); - } - } - - bool isVertex = ( dataCollector.PortCategory == MasterNodePortCategory.Tessellation || dataCollector.PortCategory == MasterNodePortCategory.Vertex ); - if( isVertex ) - { - if( m_inputPorts[ 0 ].IsConnected ) - { - if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) - return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); - - string normal = GeneratorUtils.GenerateWorldNormal( ref dataCollector, UniqueId ); - string tangent = GeneratorUtils.GenerateWorldTangent( ref dataCollector, UniqueId ); - dataCollector.AddToVertexLocalVariables( UniqueId, "float3x3 tangentToWorld = CreateTangentToWorldPerVertex( " + normal + ", "+ tangent + ", "+ Constants.VertexShaderInputStr + ".tangent.w );" ); - string inputTangent = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - dataCollector.AddToVertexLocalVariables( UniqueId, "float3 tangentNormal" + OutputId + " = " + inputTangent + ";" ); - - string viewDir = GeneratorUtils.GenerateViewDirection( ref dataCollector, UniqueId ); - dataCollector.AddToVertexLocalVariables( UniqueId, "float3 modWorldNormal" + OutputId + " = ( tangentToWorld[0] * tangentNormal" + OutputId + ".x + tangentToWorld[1] * tangentNormal" + OutputId + ".y + tangentToWorld[2] * tangentNormal" + OutputId + ".z);" ); - - string value = "reflect( -" + viewDir + ", modWorldNormal" + OutputId + " )"; - if( m_normalize ) - { - value = string.Format( NormalizeFunc, value ); - } - - RegisterLocalVariable( 0, value, ref dataCollector, "modReflection" + OutputId ); - return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); - } - else - { - if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) - return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); - - string worldNormal = GeneratorUtils.GenerateWorldNormal( ref dataCollector, UniqueId ); - string viewDir = GeneratorUtils.GenerateViewDirection( ref dataCollector, UniqueId ); - - string value = "reflect( -" + viewDir + ", " + worldNormal + " )"; - if( m_normalize ) - { - value = string.Format( NormalizeFunc, value ); - } - RegisterLocalVariable( 0, value, ref dataCollector, ReflectionVecValStr + OutputId ); - return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); - } - } - else - { - if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) - return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); - - dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_REFL, CurrentPrecisionType ); - - string result = string.Empty; - if( m_inputPorts[ 0 ].IsConnected ) - { - dataCollector.AddToInput( UniqueId, SurfaceInputs.INTERNALDATA, addSemiColon: false ); - dataCollector.ForceNormal = true; - - result = "WorldReflectionVector( " + Constants.InputVarStr + " , " + m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ) + " )"; - if( m_normalize ) - { - result = String.Format( NormalizeFunc, result ); - } - int connCount = 0; - for( int i = 0; i < m_outputPorts.Count; i++ ) - { - connCount += m_outputPorts[ i ].ConnectionCount; - } - - if( connCount > 1 ) - { - dataCollector.AddToLocalVariables( UniqueId, string.Format( ReflectionVecDecStr, ReflectionVecValStr + OutputId, result ) ); - RegisterLocalVariable( 0, result, ref dataCollector, ReflectionVecValStr + OutputId ); - return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); - } - } - else - { - dataCollector.AddToInput( UniqueId, SurfaceInputs.INTERNALDATA, addSemiColon: false ); - result = GeneratorUtils.GenerateWorldReflection( ref dataCollector, UniqueId , m_normalize ); - if( dataCollector.DirtyNormal ) - dataCollector.ForceNormal = true; - } - - return GetOutputVectorItem( 0, outputId, result ); - //RegisterLocalVariable( 0, result, ref dataCollector, "worldrefVec" + OutputId ); - //return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue ); - } - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - if( UIUtils.CurrentShaderVersion() > 14202 ) - { - m_normalize = 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_normalize ); - } - - public override void RefreshExternalReferences() - { - base.RefreshExternalReferences(); - if( UIUtils.CurrentShaderVersion() <= 14202 ) - { - if( !m_inputPorts[ 0 ].IsConnected ) - { - m_normalize = true; - } - } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldReflectionVector.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldReflectionVector.cs.meta deleted file mode 100644 index eb2bf472..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/SurfaceShaderInputs/WorldReflectionVector.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: bd82e1d90bd90fc4d924e97e5fdcc7de -timeCreated: 1481126959 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures.meta deleted file mode 100644 index 263b4f74..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 3ab7ef71451065148bf8221d353c5020 -folderAsset: yes -timeCreated: 1481126945 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/BlendNormalsNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/BlendNormalsNode.cs deleted file mode 100644 index 6c063c65..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/BlendNormalsNode.cs +++ /dev/null @@ -1,99 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using UnityEngine; -using UnityEditor; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Blend Normals", "Textures", "Blend Normals" )] - public class BlendNormalsNode : ParentNode - { - public readonly static string[] ModeListStr = { "Tangent Normals", "Reoriented Tangent Normals", "Reoriented World Normals" }; - public readonly static int[] ModeListInt = { 0, 1, 2 }; - - [SerializeField] - public int m_selectedMode = 0; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT3, false, "Normal A" ); - AddInputPort( WirePortDataType.FLOAT3, false, "Normal B" ); - AddInputPort( WirePortDataType.FLOAT3, false, "Vertex Normal" ); - m_inputPorts[ 2 ].Visible = false; - AddOutputPort( WirePortDataType.FLOAT3, "XYZ" ); - m_useInternalPortData = true; - m_previewShaderGUID = "bcdf750ff5f70444f98b8a3efa50dc6f"; - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if( !( dataCollector.IsTemplate && dataCollector.IsSRP ) ) - dataCollector.AddToIncludes( UniqueId, Constants.UnityStandardUtilsLibFuncs ); - - string _inputA = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - string _inputB = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); - string result = "BlendNormals( " + _inputA + " , " + _inputB + " )"; - - if( dataCollector.IsTemplate && dataCollector.IsSRP ) - { - switch( m_selectedMode ) - { - default: - case 0: - result = "BlendNormal( " + _inputA + " , " + _inputB + " )"; - break; - case 1: - result = "BlendNormalRNM( " + _inputA + " , " + _inputB + " )"; - break; - case 2: - string inputC = m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ); - result = "BlendNormalWorldspaceRNM( " + _inputA + " , " + _inputB + ", " + inputC + " )"; - break; - } - } - return CreateOutputLocalVariable( 0, result, ref dataCollector ); - } - - public override void DrawProperties() - { - base.DrawProperties(); - if( ContainerGraph.IsSRP ) - { - NodeUtils.DrawPropertyGroup( ref m_propertiesFoldout, Constants.ParameterLabelStr, () => - { - EditorGUI.BeginChangeCheck(); - m_selectedMode = EditorGUILayoutIntPopup( "Mode", m_selectedMode, ModeListStr, ModeListInt ); - if( EditorGUI.EndChangeCheck() ) - { - if( m_selectedMode == 2 ) - { - m_inputPorts[ 2 ].Visible = true; - } - else - { - m_inputPorts[ 2 ].Visible = false; - } - m_sizeIsDirty = true; - } - } ); - } - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - if( UIUtils.CurrentShaderVersion() > 14503 ) - m_selectedMode = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_selectedMode ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/BlendNormalsNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/BlendNormalsNode.cs.meta deleted file mode 100644 index b92fa344..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/BlendNormalsNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: eceb6029efe39524d83b45c10a979943 -timeCreated: 1481126960 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/HeightMapBlendNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/HeightMapBlendNode.cs deleted file mode 100644 index fc1744f5..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/HeightMapBlendNode.cs +++ /dev/null @@ -1,53 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> -// -// Custom Node HeightMap Texture Masking -// Donated by Rea - -using UnityEngine; -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "HeightMap Texture Blend", "Textures", "Advanced Texture Blending by using heightMap and splatMask, usefull for texture layering ", null, KeyCode.None, true, false, null, null, "Rea" )] - public sealed class HeightMapBlendNode : ParentNode - { - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT, false, "HeightMap" ); - AddInputPort( WirePortDataType.FLOAT, false, "SplatMask" ); - AddInputPort( WirePortDataType.FLOAT, false, "BlendStrength" ); - AddOutputVectorPorts( WirePortDataType.FLOAT, Constants.EmptyPortValue ); - m_textLabelWidth = 120; - m_useInternalPortData = true; - m_inputPorts[ 2 ].FloatInternalData = 1; - m_previewShaderGUID = "b2ac23d6d5dcb334982b6f31c2e7a734"; - } - - 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 HeightMap = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - string SplatMask = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector); - string Blend = m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ); - - string HeightMask = "saturate(pow(((" + HeightMap + "*" + SplatMask + ")*4)+(" + SplatMask + "*2)," + Blend + "))"; - string varName = "HeightMask" + OutputId; - - RegisterLocalVariable( 0, HeightMask, ref dataCollector , varName ); - return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); - } - /* - A = (heightMap * SplatMask)*4 - B = SplatMask*2 - C = pow(A+B,Blend) - saturate(C) - saturate(pow(((heightMap * SplatMask)*4)+(SplatMask*2),Blend)); - */ - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/HeightMapBlendNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/HeightMapBlendNode.cs.meta deleted file mode 100644 index 62736ab3..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/HeightMapBlendNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: b80a218ca12b89948b83d0dee41fc056 -timeCreated: 1481126958 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/PannerNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/PannerNode.cs deleted file mode 100644 index e20c8c05..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/PannerNode.cs +++ /dev/null @@ -1,110 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEngine; -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Panner", "UV Coordinates", "Pans UV texture coordinates according to its inputs" )] - public sealed class PannerNode : ParentNode - { - private const string _speedXStr = "Speed X"; - private const string _speedYStr = "Speed Y"; - - private int m_cachedUsingEditorId = -1; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT2, false, "UV" ,-1,MasterNodePortCategory.Fragment,0); - AddInputPort( WirePortDataType.FLOAT2, false, "Speed", -1, MasterNodePortCategory.Fragment, 2 ); - AddInputPort( WirePortDataType.FLOAT, false, "Time", -1, MasterNodePortCategory.Fragment, 1 ); - AddOutputPort( WirePortDataType.FLOAT2, "Out" ); - m_textLabelWidth = 70; - m_useInternalPortData = true; - m_previewShaderGUID = "6f89a5d96bdad114b9bbd0c236cac622"; - m_inputPorts[ 2 ].FloatInternalData = 1; - m_continuousPreviewRefresh = true; - } - - public override void SetPreviewInputs() - { - base.SetPreviewInputs(); - - if ( m_cachedUsingEditorId == -1 ) - m_cachedUsingEditorId = Shader.PropertyToID( "_UsingEditor" ); - - PreviewMaterial.SetFloat( m_cachedUsingEditorId, ( m_inputPorts[ 2 ].IsConnected ? 0 : 1 ) ); - } - - public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) - { - base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); - if( portId == 1 ) - { - m_continuousPreviewRefresh = false; - } - } - - public override void OnInputPortDisconnected( int portId ) - { - base.OnInputPortDisconnected( portId ); - if( portId == 1 ) - { - m_continuousPreviewRefresh = true; - } - } - - 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 timePort = m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ); - - if( !m_inputPorts[ 2 ].IsConnected ) - { - if( !( dataCollector.IsTemplate && dataCollector.IsSRP ) ) - dataCollector.AddToIncludes( UniqueId, Constants.UnityShaderVariables ); - timePort += " * _Time.y"; - } - - string speed = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); - string result = "( " + timePort + " * " + speed + " + " + m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ) + ")"; - - RegisterLocalVariable( 0, result, ref dataCollector, "panner" + OutputId ); - return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - if( UIUtils.CurrentShaderVersion() < 13107 ) - { - // The internal data for the new port can be set in here since it didn't existed - // on older shader versions - float speedX = Convert.ToSingle( GetCurrentParam( ref nodeParams ) ); - float speedY = Convert.ToSingle( GetCurrentParam( ref nodeParams ) ); - m_inputPorts[ 1 ].Vector2InternalData = new Vector2( speedX, speedY ); - } - } - - public override void ReadInputDataFromString( ref string[] nodeParams ) - { - base.ReadInputDataFromString( ref nodeParams ); - if( UIUtils.CurrentShaderVersion() < 13107 ) - { - //Time Port must be rewritten after internal data is read - // already existed in previous shaders - m_inputPorts[ 2 ].FloatInternalData = 1; - } - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/PannerNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/PannerNode.cs.meta deleted file mode 100644 index e05e46eb..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/PannerNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 08ddf1dd61719944b9e50d4bc87c0413 -timeCreated: 1481126953 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/RotatorNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/RotatorNode.cs deleted file mode 100644 index 18aa7781..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/RotatorNode.cs +++ /dev/null @@ -1,96 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEngine; -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Rotator", "UV Coordinates", "Rotates UVs or any Vector2 value from an Anchor point for a specified Time value")] - public sealed class RotatorNode : ParentNode - { - private int m_cachedUsingEditorId = -1; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT2, false, "UV" ); - AddInputPort( WirePortDataType.FLOAT2, false, "Anchor" ); - AddInputPort( WirePortDataType.FLOAT, false, "Time" ); - AddOutputPort( WirePortDataType.FLOAT2, "Out" ); - m_useInternalPortData = true; - m_inputPorts[ 2 ].FloatInternalData = 1; - m_textLabelWidth = 50; - m_previewShaderGUID = "e21408a1c7f12f14bbc2652f69bce1fc"; - } - - public override void SetPreviewInputs() - { - base.SetPreviewInputs(); - - if ( m_cachedUsingEditorId == -1 ) - m_cachedUsingEditorId = Shader.PropertyToID( "_UsingEditor" ); - - PreviewMaterial.SetFloat( m_cachedUsingEditorId, (m_inputPorts[ 2 ].IsConnected ? 0 : 1 ) ); - } - - public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) - { - base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); - if( portId == 2 ) - { - m_continuousPreviewRefresh = false; - } - } - - public override void OnInputPortDisconnected( int portId ) - { - base.OnInputPortDisconnected( portId ); - if( portId == 2 ) - { - m_continuousPreviewRefresh = true; - } - } - - - 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 result = string.Empty; - string uv = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - string anchor = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); - - string time = m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ); - if ( !m_inputPorts[ 2 ].IsConnected ) - { - if( !( dataCollector.IsTemplate && dataCollector.IsSRP ) ) - dataCollector.AddToIncludes( UniqueId, Constants.UnityShaderVariables ); - time += " * _Time.y"; - } - - result += uv; - - string cosVar = "cos" + OutputId; - string sinVar = "sin" + OutputId; - dataCollector.AddLocalVariable( UniqueId, "float " + cosVar + " = cos( "+time+" );"); - dataCollector.AddLocalVariable( UniqueId, "float " + sinVar + " = sin( "+time+" );"); - - string value = "mul( " + result + " - " + anchor + " , float2x2( "+cosVar+" , -"+sinVar+" , "+sinVar+" , "+cosVar+" )) + "+anchor; - RegisterLocalVariable( 0, value, ref dataCollector, "rotator" + OutputId ); - - return m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ); - } - - public override void RefreshExternalReferences() - { - base.RefreshExternalReferences(); - if( UIUtils.CurrentShaderVersion() < 13107 ) - { - m_inputPorts[ 2 ].FloatInternalData = 1; - } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/RotatorNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/RotatorNode.cs.meta deleted file mode 100644 index b031237a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/RotatorNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: e228d03a789934a4f90f9587396692e3 -timeCreated: 1481126959 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/SamplerNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/SamplerNode.cs deleted file mode 100644 index 5cf0833c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/SamplerNode.cs +++ /dev/null @@ -1,2091 +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 -{ - // Disabling Substance Deprecated warning - - public enum TexReferenceType - { - Object = 0, - Instance - } - - public enum MipType - { - Auto, - MipLevel, - MipBias, - Derivative - } - - public enum ReferenceState - { - Self, - Connected, - Instance - } - - [Serializable] -#if UNITY_2018_1_OR_NEWER - [NodeAttributes( "Texture Sample", "Textures", "Samples a chosen texture and returns its color values, <b>Texture</b> and <b>UVs</b> can be overriden and you can select different mip modes and levels. It can also unpack and scale textures marked as normalmaps.", KeyCode.T, true, 0, int.MaxValue, typeof( Texture ), typeof( Texture2D ), typeof( Texture3D ), typeof( Cubemap ), typeof( CustomRenderTexture ) )] -#else - - // Disabling Substance Deprecated warning -#pragma warning disable 0618 - [NodeAttributes( "Texture Sample", "Textures", "Samples a chosen texture and returns its color values, <b>Texture</b> and <b>UVs</b> can be overriden and you can select different mip modes and levels. It can also unpack and scale textures marked as normalmaps.", KeyCode.T, true, 0, int.MaxValue, typeof( Texture ), typeof( Texture2D ), typeof( Texture3D ), typeof( Cubemap ), typeof( ProceduralTexture ), typeof( RenderTexture ) -#if UNITY_2017_1_OR_NEWER - ,typeof( CustomRenderTexture ) -#endif - )] -#pragma warning restore 0618 -#endif - public sealed class SamplerNode : TexturePropertyNode - { - private const string MipModeStr = "Mip Mode"; - - private const string DefaultTextureUseSematicsStr = "Use Semantics"; - private const string DefaultTextureIsNormalMapsStr = "Is Normal Map"; - - private const string NormalScaleStr = "Scale"; - - private float InstanceIconWidth = 19; - private float InstanceIconHeight = 19; - - private readonly Color ReferenceHeaderColor = new Color( 2.66f, 1.02f, 0.6f, 1.0f ); - - public readonly static int[] AvailableAutoCast = { 0, 1, 2, 3, 4 }; - public readonly static string[] AvailableAutoCastStr = { "Auto", "Locked To Texture 1D", "Locked To Texture 2D", "Locked To Texture 3D", "Locked To Cube" }; - - [SerializeField] - private int m_textureCoordSet = 0; - - [SerializeField] - private string m_normalMapUnpackMode; - - [SerializeField] - private bool m_autoUnpackNormals = false; - - [SerializeField] - private bool m_useSemantics; - - [SerializeField] - private string m_samplerType; - - [SerializeField] - private MipType m_mipMode = MipType.Auto; - - [SerializeField] - private TexReferenceType m_referenceType = TexReferenceType.Object; - - [SerializeField] - private int m_referenceArrayId = -1; - - [SerializeField] - private int m_referenceNodeId = -1; - - private SamplerNode m_referenceSampler = null; - - [SerializeField] - private GUIStyle m_referenceStyle = null; - - [SerializeField] - private GUIStyle m_referenceIconStyle = null; - - [SerializeField] - private GUIContent m_referenceContent = null; - - [SerializeField] - private float m_referenceWidth = -1; - - [SerializeField] - private SamplerStateAutoGenerator m_samplerStateAutoGenerator = new SamplerStateAutoGenerator(); - - private Vector4Node m_texCoordsHelper; - - private string m_previousAdditionalText = string.Empty; - - private int m_cachedUvsId = -1; - private int m_cachedUnpackId = -1; - private int m_cachedLodId = -1; - - private InputPort m_texPort; - private InputPort m_uvPort; - private InputPort m_lodPort; - private InputPort m_ddxPort; - private InputPort m_ddyPort; - private InputPort m_normalPort; - - private OutputPort m_colorPort; - - private TexturePropertyNode m_previewTextProp = null; - private ReferenceState m_state = ReferenceState.Self; - - private Rect m_iconPos; - - public SamplerNode() : base() { } - public SamplerNode( int uniqueId, float x, float y, float width, float height ) : base( uniqueId, x, y, width, height ) { } - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - if( m_useSamplerArrayIdx < 0 ) - { - m_useSamplerArrayIdx = 0; - } - - m_defaultTextureValue = TexturePropertyValues.white; - AddInputPort( WirePortDataType.SAMPLER2D, false, "Tex" ); - m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.SAMPLER1D, WirePortDataType.SAMPLER2D, WirePortDataType.SAMPLER3D, WirePortDataType.SAMPLERCUBE, WirePortDataType.OBJECT ); - AddInputPort( WirePortDataType.FLOAT2, false, "UV" ); - AddInputPort( WirePortDataType.FLOAT, false, "Level" ); - AddInputPort( WirePortDataType.FLOAT2, false, "DDX" ); - AddInputPort( WirePortDataType.FLOAT2, false, "DDY" ); - AddInputPort( WirePortDataType.FLOAT, false, NormalScaleStr ); - - m_texPort = m_inputPorts[ 0 ]; - m_uvPort = m_inputPorts[ 1 ]; - m_lodPort = m_inputPorts[ 2 ]; - m_ddxPort = m_inputPorts[ 3 ]; - m_ddyPort = m_inputPorts[ 4 ]; - m_normalPort = m_inputPorts[ 5 ]; - m_normalPort.AutoDrawInternalData = true; - m_lodPort.Visible = false; - m_ddxPort.Visible = false; - m_ddyPort.Visible = false; - m_normalPort.Visible = m_autoUnpackNormals; - m_normalPort.FloatInternalData = 1.0f; - - //Remove output port (sampler) - m_outputPortsDict.Remove( m_outputPorts[ 0 ].PortId ); - m_outputPorts.RemoveAt( 0 ); - - AddOutputColorPorts( "RGBA" ); - m_colorPort = m_outputPorts[ 0 ]; - m_currentParameterType = PropertyType.Property; - // m_useCustomPrefix = true; - m_customPrefix = "Texture Sample "; - m_referenceContent = new GUIContent( string.Empty ); - m_freeType = false; - m_useSemantics = true; - m_drawPicker = false; - ConfigTextureData( TextureType.Texture2D ); - m_selectedLocation = PreviewLocation.TopCenter; - m_previewShaderGUID = "7b4e86a89b70ae64993bf422eb406422"; - - m_errorMessageTooltip = "A texture object marked as normal map is connected to this sampler. Please consider turning on the Unpack Normal Map option"; - m_errorMessageTypeIsError = NodeMessageType.Warning; - m_textLabelWidth = 135; - m_customPrecision = false; - } - - public override void SetPreviewInputs() - { - //TODO: rewrite this to be faster - base.SetPreviewInputs(); - - if( m_cachedUvsId == -1 ) - m_cachedUvsId = Shader.PropertyToID( "_CustomUVs" ); - - PreviewMaterial.SetInt( m_cachedUvsId, ( m_uvPort.IsConnected ? 1 : 0 ) ); - - if( m_cachedUnpackId == -1 ) - m_cachedUnpackId = Shader.PropertyToID( "_Unpack" ); - - PreviewMaterial.SetInt( m_cachedUnpackId, m_autoUnpackNormals ? 1 : 0 ); - - if( m_cachedLodId == -1 ) - m_cachedLodId = Shader.PropertyToID( "_LodType" ); - - PreviewMaterial.SetInt( m_cachedLodId, ( m_mipMode == MipType.MipLevel ? 1 : ( m_mipMode == MipType.MipBias ? 2 : 0 ) ) ); - - if( m_typeId == -1 ) - m_typeId = Shader.PropertyToID( "_Type" ); - - bool usingTexture = false; - if( m_texPort.IsConnected ) - { - usingTexture = true; - SetPreviewTexture( m_texPort.InputPreviewTexture( ContainerGraph ) ); - } - else if( SoftValidReference && m_referenceSampler.TextureProperty != null ) - { - if( m_referenceSampler.TextureProperty.Value != null ) - { - usingTexture = true; - SetPreviewTexture( m_referenceSampler.TextureProperty.Value ); - } - else - { - usingTexture = true; - SetPreviewTexture( m_referenceSampler.PreviewTexture ); - } - } - else if( TextureProperty != null ) - { - if( TextureProperty.Value != null ) - { - usingTexture = true; - SetPreviewTexture( TextureProperty.Value ); - } - } - - if( m_defaultId == -1 ) - m_defaultId = Shader.PropertyToID( "_Default" ); - - if( usingTexture ) - { - PreviewMaterial.SetInt( m_defaultId, 0 ); - m_previewMaterialPassId = 1; - } - else - { - PreviewMaterial.SetInt( m_defaultId, ( (int)m_defaultTextureValue ) + 1 ); - m_previewMaterialPassId = 0; - } - } - - protected override void OnUniqueIDAssigned() - { - base.OnUniqueIDAssigned(); - if( m_referenceType == TexReferenceType.Object ) - { - UIUtils.RegisterSamplerNode( this ); - UIUtils.RegisterPropertyNode( this ); - } - m_textureProperty = this; - - if( UniqueId > -1 ) - ContainerGraph.SamplerNodes.OnReorderEventComplete += OnReorderEventComplete; - } - - private void OnReorderEventComplete() - { - if( m_referenceType == TexReferenceType.Instance && m_referenceSampler != null ) - { - m_referenceArrayId = ContainerGraph.SamplerNodes.GetNodeRegisterIdx( m_referenceSampler.UniqueId ); - } - } - - public void ConfigSampler() - { - switch( m_currentType ) - { - case TextureType.Texture1D: - m_samplerType = "tex1D"; - break; - case TextureType.ProceduralTexture: - case TextureType.Texture2D: - m_samplerType = "tex2D"; - break; - case TextureType.Texture3D: - m_samplerType = "tex3D"; - break; - case TextureType.Cube: - m_samplerType = "texCUBE"; - break; - } - } - - public override void DrawSubProperties() - { - ShowDefaults(); - - DrawSamplerOptions(); - - EditorGUI.BeginChangeCheck(); - Type currType = ( m_autocastMode == AutoCastType.Auto ) ? typeof( Texture ) : m_textureType; - m_defaultValue = EditorGUILayoutObjectField( Constants.DefaultValueLabel, m_defaultValue, currType, false ) as Texture; - if( EditorGUI.EndChangeCheck() ) - { - CheckTextureImporter( true ); - SetAdditonalTitleText( string.Format( Constants.PropertyValueLabel, GetPropertyValStr() ) ); - ConfigureInputPorts(); - ConfigureOutputPorts(); - //ResizeNodeToPreview(); - } - } - - public override void DrawMaterialProperties() - { - ShowDefaults(); - - DrawSamplerOptions(); - - EditorGUI.BeginChangeCheck(); - Type currType = ( m_autocastMode == AutoCastType.Auto ) ? typeof( Texture ) : m_textureType; - m_materialValue = EditorGUILayoutObjectField( Constants.MaterialValueLabel, m_materialValue, currType, false ) as Texture; - if( EditorGUI.EndChangeCheck() ) - { - CheckTextureImporter( true ); - SetAdditonalTitleText( string.Format( Constants.PropertyValueLabel, GetPropertyValStr() ) ); - ConfigureInputPorts(); - ConfigureOutputPorts(); - } - } - - new void ShowDefaults() - { - m_defaultTextureValue = (TexturePropertyValues)EditorGUILayoutEnumPopup( DefaultTextureStr, m_defaultTextureValue ); - AutoCastType newAutoCast = (AutoCastType)EditorGUILayoutIntPopup( AutoCastModeStr, (int)m_autocastMode, AvailableAutoCastStr, AvailableAutoCast ); - //AutoCastType newAutoCast = (AutoCastType)EditorGUILayoutEnumPopup( AutoCastModeStr, m_autocastMode ); - if( newAutoCast != m_autocastMode ) - { - m_autocastMode = newAutoCast; - if( m_autocastMode != AutoCastType.Auto ) - { - ConfigTextureData( m_currentType ); - ConfigureInputPorts(); - ConfigureOutputPorts(); - } - } - } - - public override void AdditionalCheck() - { - m_autoUnpackNormals = m_isNormalMap; - ConfigureInputPorts(); - ConfigureOutputPorts(); - } - - - public override void OnConnectedOutputNodeChanges( int portId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) - { - base.OnConnectedOutputNodeChanges( portId, otherNodeId, otherPortId, name, type ); - if( portId == m_texPort.PortId ) - { - m_textureProperty = m_texPort.GetOutputNodeWhichIsNotRelay( 0 ) as TexturePropertyNode; - if( m_textureProperty != null ) - { - m_currentType = m_textureProperty.CurrentType; - ConfigureInputPorts(); - ConfigureOutputPorts(); - } - } - } - - public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) - { - base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); - - if( portId == m_texPort.PortId ) - { - m_textureProperty = m_texPort.GetOutputNodeWhichIsNotRelay( 0 ) as TexturePropertyNode; - - if( m_textureProperty == null ) - { - m_textureProperty = this; - // This cast fails only from within shader functions if connected to a Sampler Input - // and in this case property is set by what is connected to that input - UIUtils.UnregisterPropertyNode( this ); - UIUtils.UnregisterTexturePropertyNode( this ); - } - else - { - //if( m_autocastMode == AutoCastType.Auto ) - //{ - m_currentType = m_textureProperty.CurrentType; - //} - - - //if ( m_textureProperty is VirtualTexturePropertyNode ) - //{ - // AutoUnpackNormals = ( m_textureProperty as VirtualTexturePropertyNode ).Channel == VirtualChannel.Normal; - //} - //else if( m_textureProperty.IsValid ) - //{ - - // AutoUnpackNormals = m_textureProperty.IsNormalMap; - //} - - UIUtils.UnregisterPropertyNode( this ); - UIUtils.UnregisterTexturePropertyNode( this ); - } - - ConfigureInputPorts(); - ConfigureOutputPorts(); - //ResizeNodeToPreview(); - } - - UpdateTitle(); - } - - public override void OnInputPortDisconnected( int portId ) - { - base.OnInputPortDisconnected( portId ); - - if( portId == m_texPort.PortId ) - { - m_textureProperty = this; - - if( m_referenceType == TexReferenceType.Object ) - { - UIUtils.RegisterPropertyNode( this ); - UIUtils.RegisterTexturePropertyNode( this ); - } - - ConfigureOutputPorts(); - //ResizeNodeToPreview(); - } - - UpdateTitle(); - } - - private void ForceInputPortsChange() - { - m_texPort.ChangeType( WirePortDataType.SAMPLER2D, false ); - m_normalPort.ChangeType( WirePortDataType.FLOAT, false ); - switch( m_currentType ) - { - case TextureType.Texture1D: - m_uvPort.ChangeType( WirePortDataType.FLOAT, false ); - m_ddxPort.ChangeType( WirePortDataType.FLOAT, false ); - m_ddyPort.ChangeType( WirePortDataType.FLOAT, false ); - break; - case TextureType.ProceduralTexture: - case TextureType.Texture2D: - m_uvPort.ChangeType( WirePortDataType.FLOAT2, false ); - m_ddxPort.ChangeType( WirePortDataType.FLOAT2, false ); - m_ddyPort.ChangeType( WirePortDataType.FLOAT2, false ); - break; - case TextureType.Texture3D: - case TextureType.Cube: - m_uvPort.ChangeType( WirePortDataType.FLOAT3, false ); - m_ddxPort.ChangeType( WirePortDataType.FLOAT3, false ); - m_ddyPort.ChangeType( WirePortDataType.FLOAT3, false ); - break; - } - } - - public override void ConfigureInputPorts() - { - m_normalPort.Visible = AutoUnpackNormals; - - switch( m_mipMode ) - { - case MipType.Auto: - m_lodPort.Visible = false; - m_ddxPort.Visible = false; - m_ddyPort.Visible = false; - break; - case MipType.MipLevel: - m_lodPort.Name = "Level"; - m_lodPort.Visible = true; - m_ddxPort.Visible = false; - m_ddyPort.Visible = false; - break; - case MipType.MipBias: - m_lodPort.Name = "Bias"; - m_lodPort.Visible = true; - m_ddxPort.Visible = false; - m_ddyPort.Visible = false; - break; - case MipType.Derivative: - m_lodPort.Visible = false; - m_ddxPort.Visible = true; - m_ddyPort.Visible = true; - break; - } - - switch( m_currentType ) - { - case TextureType.Texture1D: - m_uvPort.ChangeType( WirePortDataType.FLOAT, false ); - m_ddxPort.ChangeType( WirePortDataType.FLOAT, false ); - m_ddyPort.ChangeType( WirePortDataType.FLOAT, false ); - break; - case TextureType.ProceduralTexture: - case TextureType.Texture2D: - m_uvPort.ChangeType( WirePortDataType.FLOAT2, false ); - m_ddxPort.ChangeType( WirePortDataType.FLOAT2, false ); - m_ddyPort.ChangeType( WirePortDataType.FLOAT2, false ); - break; - case TextureType.Texture3D: - case TextureType.Cube: - m_uvPort.ChangeType( WirePortDataType.FLOAT3, false ); - m_ddxPort.ChangeType( WirePortDataType.FLOAT3, false ); - m_ddyPort.ChangeType( WirePortDataType.FLOAT3, false ); - break; - } - - m_sizeIsDirty = true; - } - - public override void ConfigureOutputPorts() - { - m_outputPorts[ m_colorPort.PortId + 4 ].Visible = !AutoUnpackNormals; - - if( !AutoUnpackNormals ) - { - m_colorPort.ChangeProperties( "RGBA", WirePortDataType.COLOR, false ); - m_outputPorts[ m_colorPort.PortId + 1 ].ChangeProperties( "R", WirePortDataType.FLOAT, false ); - m_outputPorts[ m_colorPort.PortId + 2 ].ChangeProperties( "G", WirePortDataType.FLOAT, false ); - m_outputPorts[ m_colorPort.PortId + 3 ].ChangeProperties( "B", WirePortDataType.FLOAT, false ); - m_outputPorts[ m_colorPort.PortId + 4 ].ChangeProperties( "A", WirePortDataType.FLOAT, false ); - - } - else - { - m_colorPort.ChangeProperties( "XYZ", WirePortDataType.FLOAT3, false ); - m_outputPorts[ m_colorPort.PortId + 1 ].ChangeProperties( "X", WirePortDataType.FLOAT, false ); - m_outputPorts[ m_colorPort.PortId + 2 ].ChangeProperties( "Y", WirePortDataType.FLOAT, false ); - m_outputPorts[ m_colorPort.PortId + 3 ].ChangeProperties( "Z", WirePortDataType.FLOAT, false ); - } - - m_sizeIsDirty = true; - } - - void UpdateTitle() - { - if( m_referenceType == TexReferenceType.Object ) - { - SetTitleText( m_propertyInspectorName ); - SetAdditonalTitleText( string.Format( Constants.PropertyValueLabel, GetPropertyValStr() ) ); - } - - m_sizeIsDirty = true; - } - - public override void OnObjectDropped( UnityEngine.Object obj ) - { - base.OnObjectDropped( obj ); - ConfigFromObject( obj ); - } - - public override void SetupFromCastObject( UnityEngine.Object obj ) - { - base.SetupFromCastObject( obj ); - ConfigFromObject( obj ); - } - - void UpdateHeaderColor() - { - m_headerColorModifier = ( m_referenceType == TexReferenceType.Object ) ? Color.white : ReferenceHeaderColor; - } - - - - void ShowSamplerUI() - { - if( UIUtils.CurrentWindow.OutsideGraph.IsSRP ) - { - string[] contents = UIUtils.TexturePropertyNodeArr(); - string[] arr = new string[ contents.Length + 1 ]; - arr[ 0 ] = "<None>"; - for( int i = 1; i < contents.Length + 1; i++ ) - { - arr[ i ] = contents[ i - 1 ]; - } - m_useSamplerArrayIdx = EditorGUILayoutPopup( "Reference Sampler", m_useSamplerArrayIdx, arr ); - m_samplerStateAutoGenerator.Draw( this ); - } - } - - public void DrawSamplerOptions() - { - m_textureCoordSet = EditorGUILayoutIntPopup( Constants.AvailableUVSetsLabel, m_textureCoordSet, Constants.AvailableUVSetsStr, Constants.AvailableUVSets ); - - MipType newMipMode = (MipType)EditorGUILayoutEnumPopup( MipModeStr, m_mipMode ); - if( newMipMode != m_mipMode ) - { - m_mipMode = newMipMode; - ConfigureInputPorts(); - ConfigureOutputPorts(); - //ResizeNodeToPreview(); - } - - EditorGUI.BeginChangeCheck(); - m_autoUnpackNormals = EditorGUILayoutToggle( "Unpack Normal Map", m_autoUnpackNormals ); - if( m_autoUnpackNormals && !m_normalPort.IsConnected ) - { - m_normalPort.FloatInternalData = EditorGUILayoutFloatField( NormalScaleStr, m_normalPort.FloatInternalData ); - } - - if( EditorGUI.EndChangeCheck() ) - { - ConfigureInputPorts(); - ConfigureOutputPorts(); - //ResizeNodeToPreview(); - } - ShowSamplerUI(); - if( m_showErrorMessage ) - { - EditorGUILayout.HelpBox( m_errorMessageTooltip, MessageType.Warning ); - } - } - - public override void DrawMainPropertyBlock() - { - EditorGUI.BeginChangeCheck(); - m_referenceType = (TexReferenceType)EditorGUILayoutPopup( Constants.ReferenceTypeStr, (int)m_referenceType, Constants.ReferenceArrayLabels ); - if( EditorGUI.EndChangeCheck() ) - { - if( m_referenceType == TexReferenceType.Object ) - { - UIUtils.RegisterSamplerNode( this ); - UIUtils.RegisterPropertyNode( this ); - if( !m_texPort.IsConnected ) - UIUtils.RegisterTexturePropertyNode( this ); - - SetTitleText( m_propertyInspectorName ); - SetAdditonalTitleText( string.Format( Constants.PropertyValueLabel, GetPropertyValStr() ) ); - m_referenceArrayId = -1; - m_referenceNodeId = -1; - m_referenceSampler = null; - m_textureProperty = m_texPort.IsConnected ? m_texPort.GetOutputNodeWhichIsNotRelay( 0 ) as TexturePropertyNode : this; - - } - else - { - UIUtils.UnregisterSamplerNode( this ); - UIUtils.UnregisterPropertyNode( this ); - if( !m_texPort.IsConnected ) - UIUtils.UnregisterTexturePropertyNode( this ); - } - UpdateHeaderColor(); - } - - if( m_referenceType == TexReferenceType.Object ) - { - EditorGUI.BeginChangeCheck(); - if( m_texPort.IsConnected ) - { - m_drawAttributes = false; - DrawSamplerOptions(); - } - else - { - m_drawAttributes = true; - base.DrawMainPropertyBlock(); - } - if( EditorGUI.EndChangeCheck() ) - { - OnPropertyNameChanged(); - } - } - else - { - m_drawAttributes = true; - string[] arr = UIUtils.SamplerNodeArr(); - bool guiEnabledBuffer = GUI.enabled; - if( arr != null && arr.Length > 0 ) - { - GUI.enabled = true; - } - else - { - m_referenceArrayId = -1; - GUI.enabled = false; - } - - EditorGUI.BeginChangeCheck(); - m_referenceArrayId = EditorGUILayoutPopup( Constants.AvailableReferenceStr, m_referenceArrayId, arr ); - if( EditorGUI.EndChangeCheck() ) - { - m_referenceSampler = ContainerGraph.SamplerNodes.GetNode( m_referenceArrayId ); - if( m_referenceSampler != null ) - { - m_referenceNodeId = m_referenceSampler.UniqueId; - } - else - { - m_referenceArrayId = -1; - m_referenceNodeId = -1; - } - } - GUI.enabled = guiEnabledBuffer; - - DrawSamplerOptions(); - } - } - - public override void OnPropertyNameChanged() - { - base.OnPropertyNameChanged(); - UIUtils.UpdateSamplerDataNode( UniqueId, PropertyName ); - UIUtils.UpdateTexturePropertyDataNode( UniqueId, PropertyName ); - } - - public override void DrawGUIControls( DrawInfo drawInfo ) - { - base.DrawGUIControls( drawInfo ); - - if( m_state != ReferenceState.Self && drawInfo.CurrentEventType == EventType.MouseDown && m_previewRect.Contains( drawInfo.MousePosition ) && drawInfo.LeftMouseButtonPressed ) - { - UIUtils.FocusOnNode( m_previewTextProp, 1, true ); - Event.current.Use(); - } - } - - public override void OnNodeLogicUpdate( DrawInfo drawInfo ) - { - base.OnNodeLogicUpdate( drawInfo ); - CheckReference(); - - if( SoftValidReference ) - { - m_state = ReferenceState.Instance; - m_previewTextProp = m_referenceSampler.TextureProperty; - } - else if( m_texPort.IsConnected ) - { - m_state = ReferenceState.Connected; - m_previewTextProp = TextureProperty; - } - else - { - m_state = ReferenceState.Self; - } - - if( m_previewTextProp == null ) - m_previewTextProp = this; - } - - public override void OnNodeLayout( DrawInfo drawInfo ) - { - base.OnNodeLayout( drawInfo ); - - if( m_drawPreview ) - { - m_iconPos = m_globalPosition; - m_iconPos.width = InstanceIconWidth * drawInfo.InvertedZoom; - m_iconPos.height = InstanceIconHeight * drawInfo.InvertedZoom; - - m_iconPos.y += 10 * drawInfo.InvertedZoom; - m_iconPos.x += m_globalPosition.width - m_iconPos.width - 5 * drawInfo.InvertedZoom; - } - } - - public override void OnNodeRepaint( DrawInfo drawInfo ) - { - base.OnNodeRepaint( drawInfo ); - - if( !m_isVisible ) - return; - - if( drawInfo.CurrentEventType != EventType.Repaint ) - return; - - switch( m_state ) - { - default: - case ReferenceState.Self: - { - m_drawPreview = false; - //SetTitleText( PropertyInspectorName /*m_propertyInspectorName*/ ); - //small optimization, string format or concat on every frame generates garbage - //string tempVal = GetPropertyValStr(); - //if ( !m_previousAdditionalText.Equals( tempVal ) ) - //{ - // m_previousAdditionalText = tempVal; - // m_additionalContent.text = string.Concat( "Value( ", tempVal, " )" ); - //} - - m_drawPicker = true; - } - break; - case ReferenceState.Connected: - { - m_drawPreview = true; - m_drawPicker = false; - - SetTitleText( m_previewTextProp.PropertyInspectorName + " (Input)" ); - m_previousAdditionalText = m_previewTextProp.AdditonalTitleContent.text; - SetAdditonalTitleText( m_previousAdditionalText ); - // Draw chain lock - GUI.Label( m_iconPos, string.Empty, UIUtils.GetCustomStyle( CustomStyle.SamplerTextureIcon ) ); - - // Draw frame around preview - GUI.Label( m_previewRect, string.Empty, UIUtils.GetCustomStyle( CustomStyle.SamplerFrame ) ); - } - break; - case ReferenceState.Instance: - { - m_drawPreview = true; - m_drawPicker = false; - - //SetTitleText( m_previewTextProp.PropertyInspectorName + Constants.InstancePostfixStr ); - //m_previousAdditionalText = m_previewTextProp.AdditonalTitleContent.text; - //SetAdditonalTitleText( m_previousAdditionalText ); - - SetTitleTextOnCallback( m_previewTextProp.PropertyInspectorName, ( instance, newTitle ) => instance.TitleContent.text = newTitle + Constants.InstancePostfixStr ); - SetAdditonalTitleText( m_previewTextProp.AdditonalTitleContent.text ); - - // Draw chain lock - GUI.Label( m_iconPos, string.Empty, UIUtils.GetCustomStyle( CustomStyle.SamplerTextureIcon ) ); - - // Draw frame around preview - GUI.Label( m_previewRect, string.Empty, UIUtils.GetCustomStyle( CustomStyle.SamplerFrame ) ); - } - break; - } - } - - void CheckReference() - { - if( m_referenceType != TexReferenceType.Instance ) - { - return; - } - - if( m_referenceArrayId > -1 ) - { - ParentNode newNode = ContainerGraph.SamplerNodes.GetNode( m_referenceArrayId ); - if( newNode == null || newNode.UniqueId != m_referenceNodeId ) - { - m_referenceSampler = null; - int count = ContainerGraph.SamplerNodes.NodesList.Count; - for( int i = 0; i < count; i++ ) - { - ParentNode node = ContainerGraph.SamplerNodes.GetNode( i ); - if( node.UniqueId == m_referenceNodeId ) - { - m_referenceSampler = node as SamplerNode; - m_referenceArrayId = i; - break; - } - } - } - else - { - // Set References Options - AutoCastType newAutoCast = m_referenceSampler.AutocastMode; - if( newAutoCast != m_autocastMode ) - { - m_autocastMode = newAutoCast; - if( m_autocastMode != AutoCastType.Auto ) - { - ConfigTextureData( m_currentType ); - ConfigureInputPorts(); - ConfigureOutputPorts(); - //ResizeNodeToPreview(); - } - } - } - } - - if( m_referenceSampler == null && m_referenceNodeId > -1 ) - { - m_referenceNodeId = -1; - m_referenceArrayId = -1; - } - } - - public void SetTitleTextDelay( string newText ) - { - if( !newText.Equals( m_content.text ) ) - { - m_content.text = newText; - BeginDelayedDirtyProperty(); - } - } - - public void SetAdditonalTitleTextDelay( string newText ) - { - if( !newText.Equals( m_additionalContent.text ) ) - { - m_additionalContent.text = newText; - BeginDelayedDirtyProperty(); - } - } - - private void DrawTexturePropertyPreview( DrawInfo drawInfo, bool instance ) - { - if( drawInfo.CurrentEventType != EventType.Repaint ) - return; - - Rect newPos = m_previewRect; - - TexturePropertyNode texProp = null; - if( instance ) - texProp = m_referenceSampler.TextureProperty; - else - texProp = TextureProperty; - - if( texProp == null ) - texProp = this; - - float previewSizeX = PreviewSizeX; - float previewSizeY = PreviewSizeY; - newPos.width = previewSizeX * drawInfo.InvertedZoom; - newPos.height = previewSizeY * drawInfo.InvertedZoom; - - SetTitleText( texProp.PropertyInspectorName + ( instance ? Constants.InstancePostfixStr : " (Input)" ) ); - SetAdditonalTitleText( texProp.AdditonalTitleContent.text ); - - if( m_referenceStyle == null ) - { - m_referenceStyle = UIUtils.GetCustomStyle( CustomStyle.SamplerTextureRef ); - } - - if( m_referenceIconStyle == null || m_referenceIconStyle.normal == null ) - { - m_referenceIconStyle = UIUtils.GetCustomStyle( CustomStyle.SamplerTextureIcon ); - if( m_referenceIconStyle != null && m_referenceIconStyle.normal != null && m_referenceIconStyle.normal.background != null ) - { - InstanceIconWidth = m_referenceIconStyle.normal.background.width; - InstanceIconHeight = m_referenceIconStyle.normal.background.height; - } - } - - Rect iconPos = m_globalPosition; - iconPos.width = InstanceIconWidth * drawInfo.InvertedZoom; - iconPos.height = InstanceIconHeight * drawInfo.InvertedZoom; - - iconPos.y += 10 * drawInfo.InvertedZoom; - iconPos.x += m_globalPosition.width - iconPos.width - 5 * drawInfo.InvertedZoom; - - //if ( GUI.Button( newPos, string.Empty, UIUtils.GetCustomStyle( CustomStyle.SamplerTextureRef )/* m_referenceStyle */) || - // GUI.Button( iconPos, string.Empty, m_referenceIconStyle ) - // ) - //{ - // UIUtils.FocusOnNode( texProp, 1, true ); - //} - - if( texProp.Value != null ) - { - DrawPreview( drawInfo, m_previewRect ); - GUI.Label( newPos, string.Empty, UIUtils.GetCustomStyle( CustomStyle.SamplerFrame ) ); - //UIUtils.GetCustomStyle( CustomStyle.SamplerButton ).fontSize = ( int )Mathf.Round( 9 * drawInfo.InvertedZoom ); - } - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) - { - if( dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) - { - UIUtils.ShowMessage( UniqueId, m_nodeAttribs.Name + " cannot be used on Master Node Tessellation port" ); - return "(-1)"; - } - - OnPropertyNameChanged(); - - ConfigSampler(); - - string portProperty = string.Empty; - if( m_texPort.IsConnected ) - portProperty = m_texPort.GenerateShaderForOutput( ref dataCollector, true ); - - if( SoftValidReference ) - { - OrderIndex = m_referenceSampler.RawOrderIndex; - if( m_referenceSampler.TexPort.IsConnected ) - { - portProperty = m_referenceSampler.TexPort.GeneratePortInstructions( ref dataCollector ); - } - else - { - m_referenceSampler.RegisterProperty( ref dataCollector ); - } - } - - if( m_autoUnpackNormals ) - { - bool isScaledNormal = false; - if( m_normalPort.IsConnected ) - { - isScaledNormal = true; - } - else - { - if( m_normalPort.FloatInternalData != 1 ) - { - isScaledNormal = true; - } - } - - string scaleValue = isScaledNormal ? m_normalPort.GeneratePortInstructions( ref dataCollector ) : "1.0f"; - m_normalMapUnpackMode = TemplateHelperFunctions.CreateUnpackNormalStr( dataCollector, isScaledNormal, scaleValue ); - - if( isScaledNormal ) - { - if( !( dataCollector.IsTemplate && dataCollector.IsSRP ) ) - { - dataCollector.AddToIncludes( UniqueId, Constants.UnityStandardUtilsLibFuncs ); - } - } - - } - if( IsObject && ( !m_texPort.IsConnected || portProperty == "0.0" ) ) - base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalVar ); - - string valueName = SetFetchedData( ref dataCollector, ignoreLocalVar, outputId, portProperty ); - if( TextureProperty is VirtualTextureObject ) - { - return valueName; - } - else - { - - return GetOutputColorItem( 0, outputId, valueName ); - } - } - - public string SampleVirtualTexture( VirtualTextureObject node, string coord ) - { - string sampler = string.Empty; - switch( node.Channel ) - { - default: - case VirtualChannel.Albedo: - case VirtualChannel.Base: - sampler = "VTSampleAlbedo( " + coord + " )"; - break; - case VirtualChannel.Normal: - case VirtualChannel.Height: - case VirtualChannel.Occlusion: - case VirtualChannel.Displacement: - sampler = "VTSampleNormal( " + coord + " )"; - break; - case VirtualChannel.Specular: - case VirtualChannel.SpecMet: - case VirtualChannel.Material: - sampler = "VTSampleSpecular( " + coord + " )"; - break; - } - return sampler; - } - - public string SampleTexture( ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar, string portProperty, MipType currMipMode, string propertyName ) - { - string samplerValue = string.Empty; - string uvCoords = GetUVCoords( ref dataCollector, ignoreLocalVar, portProperty ); - bool useMacros = false; - - ParentGraph outsideGraph = UIUtils.CurrentWindow.OutsideGraph; - - if( outsideGraph.SamplingThroughMacros ) - { - if( outsideGraph.IsSRP ) - { - useMacros = Constants.TexSampleSRPMacros.ContainsKey( m_currentType ); - } - else - { - useMacros = Constants.TexSampleStandardMacros.ContainsKey( m_currentType ); - } - } - - if( useMacros ) - { - string suffix = string.Empty; - if( m_lodPort.IsConnected ) - { - switch( currMipMode ) - { - default: - case MipType.Auto: break; - case MipType.MipLevel: suffix = "_LOD"; break; - case MipType.MipBias: suffix = "_BIAS"; break; - case MipType.Derivative: suffix = "_GRAD"; break; - } - } - else - { - switch( currMipMode ) - { - default: - case MipType.MipLevel: - case MipType.MipBias: - case MipType.Auto: break; - case MipType.Derivative: suffix = "_GRAD"; break; - } - } - string samplerToUse = string.Empty; - if( m_useSamplerArrayIdx > 0 ) - { - TexturePropertyNode samplerNode = UIUtils.GetTexturePropertyNode( m_useSamplerArrayIdx - 1 ); - if( samplerNode != null ) - { - if( samplerNode.IsConnected ) - { - samplerToUse = samplerNode.CurrentPropertyReference; - } - else - { - UIUtils.ShowMessage( UniqueId, string.Format( "{0} attempting to use sampler from unconnected {1} node. Reference Sampler nodes must be in use for their samplers to be created.", m_propertyName, samplerNode.PropertyName ), MessageSeverity.Warning ); - dataCollector.AddToUniforms( UniqueId, string.Format( Constants.SamplerDeclarationSRPMacros[ m_currentType ], propertyName ) ); - samplerToUse = propertyName; - } - } - else - { - UIUtils.ShowMessage( UniqueId, m_propertyName + " attempting to use sampler from invalid node.", MessageSeverity.Warning ); - dataCollector.AddToUniforms( UniqueId, string.Format( Constants.SamplerDeclarationSRPMacros[ m_currentType ], propertyName ) ); - samplerToUse = propertyName; - } - } - else - { - if( HasPropertyReference ) - dataCollector.AddToUniforms( UniqueId, string.Format( Constants.SamplerDeclarationSRPMacros[ m_currentType ], propertyName ) ); - - samplerToUse = propertyName; - } - - if( outsideGraph.IsSRP ) - { - samplerValue = string.Format( Constants.TexSampleSRPMacros[ m_currentType ], suffix, propertyName, samplerToUse, uvCoords ); - } - else - { - GeneratorUtils.AddCustomStandardSamplingMacros( ref dataCollector ); - - samplerValue = string.Format( Constants.TexSampleStandardMacros[ m_currentType ], suffix, propertyName, uvCoords ); - } - } - else - { - string mipType = ""; - if( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) - { - mipType = "lod"; - } - - if( m_lodPort.IsConnected ) - { - switch( currMipMode ) - { - case MipType.Auto: - break; - case MipType.MipLevel: - mipType = "lod"; - break; - case MipType.MipBias: - mipType = "bias"; - break; - case MipType.Derivative: - break; - } - } - samplerValue = m_samplerType + mipType + "( " + propertyName + ", " + uvCoords + " )"; - } - - return samplerValue; - } - - public string SetFetchedData( ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar, int outputId, string portProperty = null ) - { - m_precisionString = UIUtils.PrecisionWirePortToCgType( CurrentPrecisionType, m_colorPort.DataType ); - string propertyName = CurrentPropertyReference; - if( !string.IsNullOrEmpty( portProperty ) && portProperty != "0.0" ) - { - propertyName = portProperty; - } - MipType currMipMode = m_mipMode; - //string mipType = ""; - //if( m_lodPort.IsConnected ) - //{ - // switch( m_mipMode ) - // { - // case MipType.Auto: - // break; - // case MipType.MipLevel: - // mipType = "lod"; - // break; - // case MipType.MipBias: - // mipType = "bias"; - // break; - // case MipType.Derivative: - // break; - // } - //} - //string uvCoords = string.Empty; - //bool useMacros = false; - if( ignoreLocalVar ) - { - if( TextureProperty is VirtualTextureObject ) - Debug.Log( "TODO" ); - - if( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) - { - //mipType = "lod"; - currMipMode = MipType.MipLevel; - } - - string samplerValue = SampleTexture( ref dataCollector, ignoreLocalVar, portProperty, currMipMode, propertyName ); - //string samplerValue = string.Empty; - //uvCoords = GetUVCoords( ref dataCollector, ignoreLocalVar, portProperty ); - //useMacros = m_containerGraph.SamplingThroughMacros && !mipType.Equals( "bias" ) && Constants.TexSampleStandardMacros.ContainsKey( m_currentType ); - //if( useMacros ) - //{ - // bool addLodPrefix = mipType.Equals( "lod" ); - // samplerValue = string.Format( Constants.TexSampleStandardMacros[ m_currentType ], addLodPrefix ? Constants.TexSampleLODPrefix : string.Empty, propertyName, uvCoords ); - //} - //else - //{ - // samplerValue = m_samplerType + mipType + "( " + propertyName + ", " + uvCoords + " )"; - //} - AddNormalMapTag( ref samplerValue ); - return samplerValue; - } - - VirtualTextureObject vtex = ( TextureProperty as VirtualTextureObject ); - - if( vtex != null ) - { - string atPathname = AssetDatabase.GUIDToAssetPath( Constants.ATSharedLibGUID ); - if( string.IsNullOrEmpty( atPathname ) ) - { - UIUtils.ShowMessage( UniqueId, "Could not find Amplify Texture on your project folder. Please install it and re-compile the shader.", MessageSeverity.Error ); - } - else - { - //Need to see if the asset really exists because AssetDatabase.GUIDToAssetPath() can return a valid path if - // the asset was previously imported and deleted after that - UnityEngine.Object obj = AssetDatabase.LoadAssetAtPath<UnityEngine.Object>( atPathname ); - if( obj == null ) - { - UIUtils.ShowMessage( UniqueId, "Could not find Amplify Texture on your project folder. Please install it and re-compile the shader.", MessageSeverity.Error ); - } - else - { - if( m_colorPort.IsLocalValue( dataCollector.PortCategory ) ) - return m_colorPort.LocalValue( dataCollector.PortCategory ); - - //string remapPortR = ".r"; - //string remapPortG = ".g"; - //string remapPortB = ".b"; - //string remapPortA = ".a"; - - //if ( vtex.Channel == VirtualChannel.Occlusion ) - //{ - // remapPortR = ".r"; remapPortG = ".r"; remapPortB = ".r"; remapPortA = ".r"; - //} - //else if ( vtex.Channel == VirtualChannel.SpecMet && ( ContainerGraph.CurrentStandardSurface != null && ContainerGraph.CurrentStandardSurface.CurrentLightingModel == StandardShaderLightModel.Standard ) ) - //{ - // remapPortR = ".r"; remapPortG = ".r"; remapPortB = ".r"; - //} - //else if ( vtex.Channel == VirtualChannel.Height || vtex.Channel == VirtualChannel.Displacement ) - //{ - // remapPortR = ".b"; remapPortG = ".b"; remapPortB = ".b"; remapPortA = ".b"; - //} - - dataCollector.AddToPragmas( UniqueId, IOUtils.VirtualTexturePragmaHeader ); - dataCollector.AddToIncludes( UniqueId, atPathname ); - - string lodBias = string.Empty; - if( dataCollector.IsFragmentCategory ) - { - lodBias = m_mipMode == MipType.MipLevel ? "Lod" : m_mipMode == MipType.MipBias ? "Bias" : ""; - } - else - { - lodBias = "Lod"; - } - - int virtualCoordId = dataCollector.GetVirtualCoordinatesId( UniqueId, GetVirtualUVCoords( ref dataCollector, ignoreLocalVar, portProperty ), lodBias ); - string virtualSampler = SampleVirtualTexture( vtex, Constants.VirtualCoordNameStr + virtualCoordId ); - string virtualVariable = dataCollector.AddVirtualLocalVariable( UniqueId, "virtualNode" + OutputId, virtualSampler ); - - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT4, virtualVariable, virtualSampler ); - - AddNormalMapTag( ref virtualVariable ); - - switch( vtex.Channel ) - { - default: - case VirtualChannel.Albedo: - case VirtualChannel.Base: - case VirtualChannel.Normal: - case VirtualChannel.Specular: - case VirtualChannel.SpecMet: - case VirtualChannel.Material: - virtualVariable = GetOutputColorItem( 0, outputId, virtualVariable ); - break; - case VirtualChannel.Displacement: - case VirtualChannel.Height: - { - if( outputId > 0 ) - virtualVariable += ".b"; - else - { - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT4, "virtual_cast_" + OutputId, virtualVariable + ".b" ); - virtualVariable = "virtual_cast_" + OutputId; - } - //virtualVariable = UIUtils.CastPortType( dataCollector.PortCategory, m_currentPrecisionType, new NodeCastInfo( UniqueId, outputId ), virtualVariable, WirePortDataType.FLOAT, WirePortDataType.FLOAT4, virtualVariable ); - } - break; - case VirtualChannel.Occlusion: - { - if( outputId > 0 ) - virtualVariable += ".r"; - else - { - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT4, "virtual_cast_" + OutputId, virtualVariable + ".r" ); - virtualVariable = "virtual_cast_" + OutputId; - } - } - break; - } - - //for ( int i = 0; i < m_outputPorts.Count; i++ ) - //{ - // if ( m_outputPorts[ i ].IsConnected ) - // { - - // //TODO: make the sampler not generate local variables at all times - // m_textureFetchedValue = "virtualNode" + OutputId; - // m_isTextureFetched = true; - - // //dataCollector.AddToLocalVariables( m_uniqueId, m_precisionString + " " + m_textureFetchedValue + " = " + virtualSampler + ";" ); - // if ( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) - // dataCollector.AddToVertexLocalVariables( UniqueId, m_precisionString + " " + m_textureFetchedValue + " = " + virtualSampler + ";" ); - // else - // dataCollector.AddToLocalVariables( UniqueId, m_precisionString + " " + m_textureFetchedValue + " = " + virtualSampler + ";" ); - - // m_colorPort.SetLocalValue( m_textureFetchedValue ); - // m_outputPorts[ m_colorPort.PortId + 1 ].SetLocalValue( m_textureFetchedValue + remapPortR ); - // m_outputPorts[ m_colorPort.PortId + 2 ].SetLocalValue( m_textureFetchedValue + remapPortG ); - // m_outputPorts[ m_colorPort.PortId + 3 ].SetLocalValue( m_textureFetchedValue + remapPortB ); - // m_outputPorts[ m_colorPort.PortId + 4 ].SetLocalValue( m_textureFetchedValue + remapPortA ); - // return m_textureFetchedValue; - // } - //} - - return virtualVariable; - } - } - } - - if( m_colorPort.IsLocalValue( dataCollector.PortCategory ) ) - return m_colorPort.LocalValue( dataCollector.PortCategory ); - - if( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) - { - currMipMode = MipType.MipLevel; - //mipType = "lod"; - } - - string samplerOp = SampleTexture( ref dataCollector, ignoreLocalVar, portProperty, currMipMode, propertyName ); - //string samplerOp = string.Empty; - //uvCoords = GetUVCoords( ref dataCollector, ignoreLocalVar, portProperty ); - //useMacros = m_containerGraph.SamplingThroughMacros && !mipType.Equals( "bias" ) && Constants.TexSampleStandardMacros.ContainsKey( m_currentType ); - //if( useMacros ) - //{ - // bool addLodPrefix = mipType.Equals( "lod" ); - // samplerOp = string.Format( Constants.TexSampleStandardMacros[ m_currentType ], addLodPrefix ? Constants.TexSampleLODPrefix : string.Empty, propertyName, uvCoords ); - //} - //else - //{ - // samplerOp = m_samplerType + mipType + "( " + propertyName + ", " + uvCoords + " )"; - //} - - AddNormalMapTag( ref samplerOp ); - - int connectedPorts = 0; - for( int i = 0; i < m_outputPorts.Count; i++ ) - { - if( m_outputPorts[ i ].IsConnected ) - { - connectedPorts += 1; - if( connectedPorts > 1 || m_outputPorts[ i ].ConnectionCount > 1 ) - { - // Create common local var and mark as fetched - string textureFetchedValue = m_samplerType + "Node" + OutputId; - - if( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) - dataCollector.AddToVertexLocalVariables( UniqueId, m_precisionString + " " + textureFetchedValue + " = " + samplerOp + ";" ); - else - dataCollector.AddToLocalVariables( UniqueId, m_precisionString + " " + textureFetchedValue + " = " + samplerOp + ";" ); - - - m_colorPort.SetLocalValue( textureFetchedValue, dataCollector.PortCategory ); - m_outputPorts[ m_colorPort.PortId + 1 ].SetLocalValue( textureFetchedValue + ".r", dataCollector.PortCategory ); - m_outputPorts[ m_colorPort.PortId + 2 ].SetLocalValue( textureFetchedValue + ".g", dataCollector.PortCategory ); - m_outputPorts[ m_colorPort.PortId + 3 ].SetLocalValue( textureFetchedValue + ".b", dataCollector.PortCategory ); - m_outputPorts[ m_colorPort.PortId + 4 ].SetLocalValue( textureFetchedValue + ".a", dataCollector.PortCategory ); - return textureFetchedValue; - } - } - } - return samplerOp; - } - - private void AddNormalMapTag( ref string value ) - { - if( m_autoUnpackNormals ) - { - value = string.Format( m_normalMapUnpackMode, value ); - } - } - - public override void ReadOutputDataFromString( ref string[] nodeParams ) - { - base.ReadOutputDataFromString( ref nodeParams ); - ConfigureOutputPorts(); - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - string defaultTextureGUID = GetCurrentParam( ref nodeParams ); - if( UIUtils.CurrentShaderVersion() > 14101 ) - { - m_defaultValue = AssetDatabase.LoadAssetAtPath<Texture>( AssetDatabase.GUIDToAssetPath( defaultTextureGUID ) ); - string materialTextureGUID = GetCurrentParam( ref nodeParams ); - m_materialValue = AssetDatabase.LoadAssetAtPath<Texture>( AssetDatabase.GUIDToAssetPath( materialTextureGUID ) ); - } - else - { - m_defaultValue = AssetDatabase.LoadAssetAtPath<Texture>( defaultTextureGUID ); - } - m_useSemantics = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - m_textureCoordSet = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - m_isNormalMap = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - m_defaultTextureValue = (TexturePropertyValues)Enum.Parse( typeof( TexturePropertyValues ), GetCurrentParam( ref nodeParams ) ); - m_autocastMode = (AutoCastType)Enum.Parse( typeof( AutoCastType ), GetCurrentParam( ref nodeParams ) ); - m_autoUnpackNormals = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - - if( UIUtils.CurrentShaderVersion() > 12 ) - { - m_referenceType = (TexReferenceType)Enum.Parse( typeof( TexReferenceType ), GetCurrentParam( ref nodeParams ) ); - if( UIUtils.CurrentShaderVersion() > 22 ) - { - m_referenceNodeId = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - } - else - { - m_referenceArrayId = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - } - - if( m_referenceType == TexReferenceType.Instance ) - { - UIUtils.UnregisterSamplerNode( this ); - UIUtils.UnregisterPropertyNode( this ); - } - UpdateHeaderColor(); - } - if( UIUtils.CurrentShaderVersion() > 2406 ) - m_mipMode = (MipType)Enum.Parse( typeof( MipType ), GetCurrentParam( ref nodeParams ) ); - - - if( UIUtils.CurrentShaderVersion() > 3201 ) - m_currentType = (TextureType)Enum.Parse( typeof( TextureType ), GetCurrentParam( ref nodeParams ) ); - - if( m_defaultValue == null ) - { - ConfigureInputPorts(); - ConfigureOutputPorts(); - //ResizeNodeToPreview(); - } - else - { - if( m_materialValue == null ) - { - ConfigFromObject( m_defaultValue, false, false ); - } - else - { - CheckTextureImporter( false, false ); - } - ConfigureInputPorts(); - ConfigureOutputPorts(); - } - - if( !m_isNodeBeingCopied && m_referenceType == TexReferenceType.Object ) - { - ContainerGraph.SamplerNodes.UpdateDataOnNode( UniqueId, DataToArray ); - } - } - - public override void RefreshExternalReferences() - { - base.RefreshExternalReferences(); - ForceInputPortsChange(); - - if( m_useSamplerArrayIdx > -1 ) - { - m_useSamplerArrayIdx = UIUtils.GetTexturePropertyNodeRegisterId( m_useSamplerArrayIdx ) + 1; - } - else - { - m_useSamplerArrayIdx = 0; - } - - EditorGUI.BeginChangeCheck(); - if( m_referenceType == TexReferenceType.Instance ) - { - if( UIUtils.CurrentShaderVersion() > 22 ) - { - - - m_referenceSampler = ContainerGraph.GetNode( m_referenceNodeId ) as SamplerNode; - m_referenceArrayId = ContainerGraph.SamplerNodes.GetNodeRegisterIdx( m_referenceNodeId ); - } - else - { - m_referenceSampler = ContainerGraph.SamplerNodes.GetNode( m_referenceArrayId ); - if( m_referenceSampler != null ) - { - m_referenceNodeId = m_referenceSampler.UniqueId; - } - } - } - - if( EditorGUI.EndChangeCheck() ) - { - OnPropertyNameChanged(); - } - } - - public override void ReadAdditionalData( ref string[] nodeParams ) { } - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, ( m_defaultValue != null ) ? AssetDatabase.AssetPathToGUID( AssetDatabase.GetAssetPath( m_defaultValue ) ) : Constants.NoStringValue ); - IOUtils.AddFieldValueToString( ref nodeInfo, ( m_materialValue != null ) ? AssetDatabase.AssetPathToGUID( AssetDatabase.GetAssetPath( m_materialValue ) ) : Constants.NoStringValue ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_useSemantics.ToString() ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_textureCoordSet.ToString() ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_isNormalMap.ToString() ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_defaultTextureValue ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_autocastMode ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_autoUnpackNormals ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_referenceType ); - IOUtils.AddFieldValueToString( ref nodeInfo, ( ( m_referenceSampler != null ) ? m_referenceSampler.UniqueId : -1 ) ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_mipMode ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_currentType ); - } - - public override void WriteAdditionalToString( ref string nodeInfo, ref string connectionsInfo ) { } - - public string GetVirtualUVCoords( ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar, string portProperty ) - { - string bias = ""; - if( !dataCollector.IsFragmentCategory || m_mipMode == MipType.MipBias || m_mipMode == MipType.MipLevel ) - { - string lodLevel = m_lodPort.GeneratePortInstructions( ref dataCollector ); - bias += ", " + lodLevel; - } - - if( m_uvPort.IsConnected ) - { - string uvs = m_uvPort.GeneratePortInstructions( ref dataCollector ); - return uvs + bias; - } - else - { - string propertyName = CurrentPropertyReference; - if( !string.IsNullOrEmpty( portProperty ) ) - { - propertyName = portProperty; - } - string uvChannelName = IOUtils.GetUVChannelName( propertyName, m_textureCoordSet ); - - - string uvCoord = string.Empty; - if( dataCollector.IsTemplate ) - { - string uvName = string.Empty; - if( dataCollector.TemplateDataCollectorInstance.HasUV( m_textureCoordSet ) ) - { - uvName = dataCollector.TemplateDataCollectorInstance.GetUVName( m_textureCoordSet, m_uvPort.DataType ); - } - else - { - uvName = dataCollector.TemplateDataCollectorInstance.RegisterUV( m_textureCoordSet, m_uvPort.DataType ); - } - - string attr = GetPropertyValue(); - - if( attr.IndexOf( "[NoScaleOffset]" ) > -1 ) - { - dataCollector.AddLocalVariable( UniqueId, PrecisionType.Float, WirePortDataType.FLOAT2, uvChannelName, uvName ); - } - else - { - dataCollector.AddToUniforms( UniqueId, "uniform float4 " + propertyName + "_ST;" ); - dataCollector.AddLocalVariable( UniqueId, PrecisionType.Float, WirePortDataType.FLOAT2, uvChannelName, uvName + " * " + propertyName + "_ST.xy + " + propertyName + "_ST.zw" ); - } - uvCoord = uvChannelName; - } - else - { - if( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) - { - uvCoord = Constants.VertexShaderInputStr + ".texcoord"; - if( m_textureCoordSet > 0 ) - { - uvCoord += m_textureCoordSet.ToString(); - } - } - else - { - propertyName = CurrentPropertyReference; - if( !string.IsNullOrEmpty( portProperty ) && portProperty != "0.0" ) - { - propertyName = portProperty; - } - uvChannelName = IOUtils.GetUVChannelName( propertyName, m_textureCoordSet ); - - string dummyPropUV = "_texcoord" + ( m_textureCoordSet > 0 ? ( m_textureCoordSet + 1 ).ToString() : "" ); - string dummyUV = "uv" + ( m_textureCoordSet > 0 ? ( m_textureCoordSet + 1 ).ToString() : "" ) + dummyPropUV; - - dataCollector.AddToProperties( UniqueId, "[HideInInspector] " + dummyPropUV + "( \"\", 2D ) = \"white\" {}", 100 ); - dataCollector.AddToInput( UniqueId, dummyUV, WirePortDataType.FLOAT2 ); - - string attr = GetPropertyValue(); - - if( attr.IndexOf( "[NoScaleOffset]" ) > -1 ) - { - dataCollector.AddToLocalVariables( UniqueId, PrecisionType.Float, WirePortDataType.FLOAT2, uvChannelName, Constants.InputVarStr + "." + dummyUV ); - } - else - { - dataCollector.AddToUniforms( UniqueId, "uniform float4 " + propertyName + "_ST;" ); - dataCollector.AddToLocalVariables( UniqueId, PrecisionType.Float, WirePortDataType.FLOAT2, uvChannelName, Constants.InputVarStr + "." + dummyUV + " * " + propertyName + "_ST.xy + " + propertyName + "_ST.zw" ); - } - uvCoord = uvChannelName; - } - } - return uvCoord + bias; - } - } - - public string GetUVCoords( ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar, string portProperty ) - { - bool isVertex = ( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation ); - - // make sure the final result is always a float4 with empty 0's in the middle - string uvAppendix = ", "; - int coordSize = 3; - if( m_uvPort.DataType == WirePortDataType.FLOAT2 ) - { - uvAppendix = ", 0, "; - coordSize = 2; - } - else if( m_uvPort.DataType == WirePortDataType.FLOAT ) - { - uvAppendix = ", 0, 0, "; - coordSize = 1; - } - - string uvs = m_uvPort.GeneratePortInstructions( ref dataCollector ); - - // generate automatic UVs if not connected - if( !m_uvPort.IsConnected ) - { - string propertyName = CurrentPropertyReference; - - // check for references - if( !string.IsNullOrEmpty( portProperty ) && portProperty != "0.0" ) - propertyName = portProperty; - - int coordSet = ( ( m_textureCoordSet < 0 ) ? 0 : m_textureCoordSet ); - string uvName = IOUtils.GetUVChannelName( propertyName, coordSet ); - string dummyPropUV = "_tex" + ( coordSize != 2 ? "" + coordSize : "" ) + "coord" + ( coordSet > 0 ? ( coordSet + 1 ).ToString() : "" ); - string dummyUV = "uv" + ( coordSet > 0 ? ( coordSet + 1 ).ToString() : "" ) + dummyPropUV; - - string attr = GetPropertyValue(); - bool scaleOffset = true; - if( attr.IndexOf( "[NoScaleOffset]" ) > -1 ) - scaleOffset = false; - - string texCoordsST = string.Empty; - if( scaleOffset ) - { - if( m_texCoordsHelper == null ) - { - m_texCoordsHelper = CreateInstance<Vector4Node>(); - m_texCoordsHelper.ContainerGraph = ContainerGraph; - m_texCoordsHelper.SetBaseUniqueId( UniqueId, true ); - m_texCoordsHelper.RegisterPropertyOnInstancing = false; - m_texCoordsHelper.AddGlobalToSRPBatcher = true; - } - - if( UIUtils.CurrentWindow.OutsideGraph.IsInstancedShader ) - { - m_texCoordsHelper.CurrentParameterType = PropertyType.InstancedProperty; - } - else - { - m_texCoordsHelper.CurrentParameterType = PropertyType.Global; - } - m_texCoordsHelper.ResetOutputLocals(); - m_texCoordsHelper.SetRawPropertyName( propertyName + "_ST" ); - texCoordsST = m_texCoordsHelper.GenerateShaderForOutput( 0, ref dataCollector, false ); - } - - string coordInput = string.Empty; - if( !dataCollector.IsTemplate && coordSet > 3 ) - { - coordInput = GeneratorUtils.GenerateAutoUVs( ref dataCollector, UniqueId, coordSet, null, WirePortDataType.FLOAT2 ); - } - else - { - dataCollector.AddToProperties( UniqueId, "[HideInInspector] " + dummyPropUV + "( \"\", 2D ) = \"white\" {}", 9999 ); - if( isVertex ) - { - coordInput = Constants.VertexShaderInputStr + ".texcoord"; - if( coordSet > 0 ) - coordInput += coordSet.ToString(); - } - else - { - coordInput = Constants.InputVarStr + "." + dummyUV; - dataCollector.AddToInput( UniqueId, dummyUV, m_uvPort.DataType ); - } - } - - if( dataCollector.MasterNodeCategory == AvailableShaderTypes.Template ) - { - if( dataCollector.TemplateDataCollectorInstance.HasUV( m_textureCoordSet ) ) - coordInput = dataCollector.TemplateDataCollectorInstance.GetUVName( m_textureCoordSet, m_uvPort.DataType ); - else - coordInput = dataCollector.TemplateDataCollectorInstance.RegisterUV( m_textureCoordSet, m_uvPort.DataType ); - } - - if( !scaleOffset ) - uvName += OutputId; - - if( coordSize > 2 ) - { - uvName += coordSize; - dataCollector.UsingHigherSizeTexcoords = true; - dataCollector.AddLocalVariable( UniqueId, "float" + coordSize + " " + uvName + " = " + coordInput + ";" ); - if( scaleOffset ) - dataCollector.AddLocalVariable( UniqueId, uvName + ".xy = " + coordInput + ".xy * " + texCoordsST + ".xy + " + texCoordsST + ".zw;" ); - } - else - { - if( coordSize == 1 ) - uvName += coordSize; - - if( scaleOffset ) - dataCollector.AddLocalVariable( UniqueId, PrecisionType.Float, m_uvPort.DataType, uvName, coordInput + " * " + texCoordsST + ".xy + " + texCoordsST + ".zw" ); - else - dataCollector.AddLocalVariable( UniqueId, PrecisionType.Float, m_uvPort.DataType, uvName, coordInput ); - } - - uvs = uvName; - } - - ParentGraph outsideGraph = UIUtils.CurrentWindow.OutsideGraph; - if( isVertex ) - { - string lodLevel = m_lodPort.GeneratePortInstructions( ref dataCollector ); - if( outsideGraph.SamplingThroughMacros ) - return uvs + "," + lodLevel; - else - return UIUtils.PrecisionWirePortToCgType( PrecisionType.Float, WirePortDataType.FLOAT4 ) + "( " + uvs + uvAppendix + lodLevel + ")"; - } - else - { - if( ( m_mipMode == MipType.MipLevel || m_mipMode == MipType.MipBias ) && m_lodPort.IsConnected ) - { - string lodLevel = m_lodPort.GeneratePortInstructions( ref dataCollector ); - if( outsideGraph.SamplingThroughMacros ) - return uvs + "," + lodLevel; - else - return UIUtils.PrecisionWirePortToCgType( PrecisionType.Float, WirePortDataType.FLOAT4 ) + "( " + uvs + uvAppendix + lodLevel + ")"; - } - else if( m_mipMode == MipType.Derivative ) - { - string ddx = m_ddxPort.GeneratePortInstructions( ref dataCollector ); - string ddy = m_ddyPort.GeneratePortInstructions( ref dataCollector ); - - return uvs + ", " + ddx + ", " + ddy; - } - else - { - return uvs; - } - } - } - - - - public override int VersionConvertInputPortId( int portId ) - { - int newPort = portId; - //change normal scale port to last - if( UIUtils.CurrentShaderVersion() < 2407 ) - { - if( portId == 1 ) - newPort = 4; - } - - if( UIUtils.CurrentShaderVersion() < 2408 ) - { - newPort = newPort + 1; - } - - return newPort; - } - - public override void Destroy() - { - base.Destroy(); - - //Not calling m_texCoordsHelper.Destroy() on purpose so UIUtils does not incorrectly unregister stuff - if( m_texCoordsHelper != null ) - { - DestroyImmediate( m_texCoordsHelper ); - m_texCoordsHelper = null; - } - - m_samplerStateAutoGenerator.Destroy(); - m_samplerStateAutoGenerator = null; - m_defaultValue = null; - m_materialValue = null; - m_referenceSampler = null; - m_referenceStyle = null; - m_referenceContent = null; - m_texPort = null; - m_uvPort = null; - m_lodPort = null; - m_ddxPort = null; - m_ddyPort = null; - m_normalPort = null; - m_colorPort = null; - - if( m_referenceType == TexReferenceType.Object ) - { - UIUtils.UnregisterSamplerNode( this ); - UIUtils.UnregisterPropertyNode( this ); - } - if( UniqueId > -1 ) - ContainerGraph.SamplerNodes.OnReorderEventComplete -= OnReorderEventComplete; - } - - public override string GetPropertyValStr() - { - return m_materialMode ? ( m_materialValue != null ? m_materialValue.name : IOUtils.NO_TEXTURES ) : ( m_defaultValue != null ? m_defaultValue.name : IOUtils.NO_TEXTURES ); - } - - public TexturePropertyNode TextureProperty - { - get - { - if( m_referenceSampler != null ) - { - m_textureProperty = m_referenceSampler as TexturePropertyNode; - } - else if( m_texPort.IsConnected ) - { - m_textureProperty = m_texPort.GetOutputNodeWhichIsNotRelay( 0 ) as TexturePropertyNode; - } - - if( m_textureProperty == null ) - return this; - - return m_textureProperty; - } - } - - public override string GetPropertyValue() - { - if( SoftValidReference ) - { - if( m_referenceSampler.TexPort.IsConnected ) - { - return string.Empty; - } - else - { - return m_referenceSampler.TextureProperty.GetPropertyValue(); - } - } - else - if( m_texPort.IsConnected && ( m_texPort.GetOutputNodeWhichIsNotRelay( 0 ) as TexturePropertyNode ) != null ) - { - return TextureProperty.GetPropertyValue(); - } - - switch( m_currentType ) - { - case TextureType.Texture1D: - { - return PropertyAttributes + GetTexture1DPropertyValue(); - } - case TextureType.ProceduralTexture: - case TextureType.Texture2D: - { - return PropertyAttributes + GetTexture2DPropertyValue(); - } - case TextureType.Texture3D: - { - return PropertyAttributes + GetTexture3DPropertyValue(); - } - case TextureType.Cube: - { - return PropertyAttributes + GetCubePropertyValue(); - } - } - return string.Empty; - } - - public override string GetUniformValue() - { - - if( SoftValidReference ) - { - if( m_referenceSampler.TexPort.IsConnected ) - return string.Empty; - else - return m_referenceSampler.TextureProperty.GetUniformValue(); - } - else if( m_texPort.IsConnected && ( m_texPort.GetOutputNodeWhichIsNotRelay( 0 ) as TexturePropertyNode ) != null ) - { - return TextureProperty.GetUniformValue(); - } - - return base.GetUniformValue(); - } - - public override bool GetUniformData( out string dataType, out string dataName, ref bool fullValue ) - { - if( SoftValidReference ) - { - if( m_referenceSampler.TexPort.IsConnected ) - { - base.GetUniformData( out dataType, out dataName, ref fullValue ); - return false; - } - else - return m_referenceSampler.TextureProperty.GetUniformData( out dataType, out dataName, ref fullValue ); - } - else if( m_texPort.IsConnected && ( m_texPort.GetOutputNodeWhichIsNotRelay( 0 ) as TexturePropertyNode ) != null ) - { - return TextureProperty.GetUniformData( out dataType, out dataName, ref fullValue ); - - } - - return base.GetUniformData( out dataType, out dataName, ref fullValue ); - } - - public string UVCoordsName { get { return Constants.InputVarStr + "." + IOUtils.GetUVChannelName( CurrentPropertyReference, m_textureCoordSet ); } } - public bool HasPropertyReference - { - get - { - if( m_referenceType == TexReferenceType.Instance && m_referenceArrayId > -1 ) - { - SamplerNode node = ContainerGraph.SamplerNodes.GetNode( m_referenceArrayId ); - if( node != null ) - return true; - } - - if( m_texPort.IsConnected ) - { - return true; - } - - return false; - } - } - - public override string CurrentPropertyReference - { - get - { - string propertyName = string.Empty; - if( m_referenceType == TexReferenceType.Instance && m_referenceArrayId > -1 ) - { - SamplerNode node = ContainerGraph.SamplerNodes.GetNode( m_referenceArrayId ); - propertyName = ( node != null ) ? node.TextureProperty.PropertyName : PropertyName; - } - else if( m_texPort.IsConnected && ( m_texPort.GetOutputNodeWhichIsNotRelay( 0 ) as TexturePropertyNode ) != null ) - { - propertyName = TextureProperty.PropertyName; - } - else - { - propertyName = PropertyName; - } - return propertyName; - } - } - - public bool SoftValidReference - { - get - { - if( m_referenceType == TexReferenceType.Instance && m_referenceArrayId > -1 ) - { - m_referenceSampler = ContainerGraph.SamplerNodes.GetNode( m_referenceArrayId ); - - m_texPort.Locked = true; - - if( m_referenceContent == null ) - m_referenceContent = new GUIContent(); - - - if( m_referenceSampler != null ) - { - m_referenceContent.image = m_referenceSampler.Value; - if( m_referenceWidth != m_referenceSampler.Position.width ) - { - m_referenceWidth = m_referenceSampler.Position.width; - m_sizeIsDirty = true; - } - } - else - { - m_referenceArrayId = -1; - m_referenceWidth = -1; - } - - return m_referenceSampler != null; - } - m_texPort.Locked = false; - return false; - } - } - public override void ForceUpdateFromMaterial( Material material ) - { - if( UIUtils.IsProperty( m_currentParameterType ) && material.HasProperty( PropertyName ) ) - { - m_materialValue = material.GetTexture( PropertyName ); - CheckTextureImporter( true ); - PreviewIsDirty = true; - } - - } - public override void SetContainerGraph( ParentGraph newgraph ) - { - base.SetContainerGraph( newgraph ); - m_textureProperty = m_texPort.GetOutputNodeWhichIsNotRelay( 0 ) as TexturePropertyNode; - if( m_textureProperty == null ) - { - m_textureProperty = this; - } - } - - public bool AutoUnpackNormals - { - get { return m_autoUnpackNormals; } - set - { - if( value != m_autoUnpackNormals ) - { - m_autoUnpackNormals = value; - if( !UIUtils.IsLoading ) - { - m_defaultTextureValue = value ? TexturePropertyValues.bump : TexturePropertyValues.white; - } - } - } - } - - public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) - { - base.PropagateNodeData( nodeData, ref dataCollector ); - if( dataCollector.IsTemplate ) - { - if( !m_texPort.IsConnected ) - dataCollector.TemplateDataCollectorInstance.SetUVUsage( m_textureCoordSet, m_uvPort.DataType ); - } - else if( m_textureCoordSet > 3 ) - { - dataCollector.AddCustomAppData( string.Format( TemplateHelperFunctions.TexUVFullSemantic, m_textureCoordSet ) ); - } - } - - private InputPort TexPort { get { return m_texPort; } } - public bool IsObject { get { return ( m_referenceType == TexReferenceType.Object ) || ( m_referenceSampler == null ); } } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/SamplerNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/SamplerNode.cs.meta deleted file mode 100644 index 87957e47..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/SamplerNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 057d23b232d9c044cbf3f1d0b1a06909 -timeCreated: 1481126953 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/SubstanceSamplerNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/SubstanceSamplerNode.cs deleted file mode 100644 index cc93bf0e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/SubstanceSamplerNode.cs +++ /dev/null @@ -1,1330 +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.Collections.Generic; -#if !UNITY_2018_1_OR_NEWER -namespace AmplifyShaderEditor -{ - // Disabling Substance Deprecated warning -#pragma warning disable 0618 - [Serializable] - [NodeAttributes( "Substance Sample", "Textures", "Samples a procedural material", KeyCode.None, true, 0, int.MaxValue, typeof( SubstanceArchive ), typeof( ProceduralMaterial ) )] - public sealed class SubstanceSamplerNode : PropertyNode - { - private const string GlobalVarDecStr = "uniform sampler2D {0};"; - private const string PropertyDecStr = "{0}(\"{0}\", 2D) = \"white\""; - - private const string AutoNormalStr = "Auto-Normal"; - private const string SubstanceStr = "Substance"; - - private float TexturePreviewSizeX = 128; - private float TexturePreviewSizeY = 128; - - private float PickerPreviewWidthAdjust = 18; - - private bool m_editing; - - private CacheNodeConnections m_cacheNodeConnections; - - [SerializeField] - private int m_firstOutputConnected = 0; - - [SerializeField] - private ProceduralMaterial m_proceduralMaterial; - - [SerializeField] - private int m_textureCoordSet = 0; - - [SerializeField] - private ProceduralOutputType[] m_textureTypes; - - [SerializeField] - private bool m_autoNormal = true; - - private System.Type m_type; - - private Texture[] m_textures = new Texture[] { }; - - private List<int> m_outputConns = new List<int>(); - - private Rect m_previewArea; - - private Rect m_pickerArea; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT2, false, "UV" ); - AddOutputPort( WirePortDataType.COLOR, Constants.EmptyPortValue ); - m_insideSize.Set( TexturePreviewSizeX + PickerPreviewWidthAdjust, TexturePreviewSizeY + 10 ); - m_type = typeof( ProceduralMaterial ); - m_currentParameterType = PropertyType.Property; - m_freeType = false; - m_freeName = false; - m_autoWrapProperties = true; - m_customPrefix = "Substance Sample "; - m_drawPrecisionUI = false; - m_showPreview = true; - m_drawPreviewExpander = false; - m_selectedLocation = PreviewLocation.TopCenter; - m_cacheNodeConnections = new CacheNodeConnections(); - m_previewShaderGUID = "6f322c1da33f1e744941aafcb0ad1a2d"; - m_showAutoRegisterUI = false; - } - - public override void RenderNodePreview() - { - //Runs at least one time - if( !m_initialized ) - { - // nodes with no preview don't update at all - PreviewIsDirty = false; - return; - } - - if( !PreviewIsDirty ) - return; - - SetPreviewInputs(); - - PreviewMaterial.SetInt( "_CustomUVs", m_inputPorts[ 0 ].IsConnected ? 1 : 0 ); - - if( m_proceduralMaterial == null ) - return; - - Texture[] texs = m_proceduralMaterial.GetGeneratedTextures(); - int count = m_outputPorts.Count; - for( int i = 0; i < count; i++ ) - { - RenderTexture temp = RenderTexture.active; - RenderTexture.active = m_outputPorts[ i ].OutputPreviewTexture; - - PreviewMaterial.SetTexture( "_GenTex", texs[ i ] ); - - if( m_autoNormal && m_textureTypes[ i ] == ProceduralOutputType.Normal ) - Graphics.Blit( null, m_outputPorts[ i ].OutputPreviewTexture, PreviewMaterial, 1 ); - else - Graphics.Blit( null, m_outputPorts[ i ].OutputPreviewTexture, PreviewMaterial, 0 ); - RenderTexture.active = temp; - } - - PreviewIsDirty = m_continuousPreviewRefresh; - } - - public override void OnOutputPortConnected( int portId, int otherNodeId, int otherPortId ) - { - base.OnOutputPortConnected( portId, otherNodeId, otherPortId ); - m_firstOutputConnected = -1; - } - - public override void OnOutputPortDisconnected( int portId ) - { - base.OnOutputPortDisconnected( portId ); - m_firstOutputConnected = -1; - } - - void CalculateFirstOutputConnected() - { - m_outputConns.Clear(); - int count = m_outputPorts.Count; - bool connectionsAvailable = false; - for( int i = 0; i < count; i++ ) - { - if( m_outputPorts[ i ].IsConnected ) - { - connectionsAvailable = true; - } - } - - for( int i = 0; i < count; i++ ) - { - if( connectionsAvailable ) - { - if( m_outputPorts[ i ].IsConnected ) - { - if( m_firstOutputConnected < 0 ) - m_firstOutputConnected = i; - - m_outputConns.Add( i ); - } - } - else - { - m_outputConns.Add( i ); - } - } - - if( m_firstOutputConnected < 0 ) - m_firstOutputConnected = 0; - } - - public override void OnNodeLayout( DrawInfo drawInfo ) - { - base.OnNodeLayout( drawInfo ); - - m_previewArea = m_remainingBox; - m_previewArea.width = TexturePreviewSizeX * drawInfo.InvertedZoom; - m_previewArea.height = TexturePreviewSizeY * drawInfo.InvertedZoom; - m_previewArea.x += 0.5f * m_remainingBox.width - 0.5f * m_previewArea.width; - m_pickerArea = m_previewArea; - m_pickerArea.width = 40 * drawInfo.InvertedZoom; - m_pickerArea.x = m_previewArea.xMax - m_pickerArea.width - 2; - m_pickerArea.height = 14 * drawInfo.InvertedZoom; - m_pickerArea.y = m_previewArea.yMax - m_pickerArea.height - 2; - } - - public override void DrawGUIControls( DrawInfo drawInfo ) - { - base.DrawGUIControls( drawInfo ); - - if( !( drawInfo.CurrentEventType == EventType.MouseDown || drawInfo.CurrentEventType == EventType.MouseUp || drawInfo.CurrentEventType == EventType.ExecuteCommand || drawInfo.CurrentEventType == EventType.DragPerform ) ) - return; - - bool insideBox = m_previewArea.Contains( drawInfo.MousePosition ); - - if( insideBox ) - { - m_editing = true; - } - else if( m_editing && !insideBox && drawInfo.CurrentEventType != EventType.ExecuteCommand ) - { - GUI.FocusControl( null ); - m_editing = false; - } - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - - if( m_editing ) - { - m_textures = m_proceduralMaterial != null ? m_proceduralMaterial.GetGeneratedTextures() : null; - if( GUI.Button( m_pickerArea, string.Empty, GUIStyle.none ) ) - { - int controlID = EditorGUIUtility.GetControlID( FocusType.Passive ); - EditorGUIUtility.ShowObjectPicker<ProceduralMaterial>( m_proceduralMaterial, false, "", controlID ); - } - - string commandName = Event.current.commandName; - UnityEngine.Object newValue = null; - if( commandName == "ObjectSelectorUpdated" ) - { - newValue = EditorGUIUtility.GetObjectPickerObject(); - if( newValue != (UnityEngine.Object)m_proceduralMaterial ) - { - PreviewIsDirty = true; - UndoRecordObject( "Changing value EditorGUIObjectField on node Substance Sample" ); - - m_proceduralMaterial = newValue != null ? (ProceduralMaterial)newValue : null; - m_textures = m_proceduralMaterial != null ? m_proceduralMaterial.GetGeneratedTextures() : null; - OnNewSubstanceSelected( m_textures ); - } - } - else if( commandName == "ObjectSelectorClosed" ) - { - newValue = EditorGUIUtility.GetObjectPickerObject(); - if( newValue != (UnityEngine.Object)m_proceduralMaterial ) - { - PreviewIsDirty = true; - UndoRecordObject( "Changing value EditorGUIObjectField on node Substance Sample" ); - - m_proceduralMaterial = newValue != null ? (ProceduralMaterial)newValue : null; - m_textures = m_proceduralMaterial != null ? m_proceduralMaterial.GetGeneratedTextures() : null; - OnNewSubstanceSelected( m_textures ); - } - m_editing = false; - } - - if( GUI.Button( m_previewArea, string.Empty, GUIStyle.none ) ) - { - if( m_proceduralMaterial != null ) - { - Selection.activeObject = m_proceduralMaterial; - EditorGUIUtility.PingObject( Selection.activeObject ); - } - m_editing = false; - } - } - - if( drawInfo.CurrentEventType == EventType.Repaint ) - { - if( !m_editing ) - m_textures = m_proceduralMaterial != null ? m_proceduralMaterial.GetGeneratedTextures() : null; - - if( m_textures != null ) - { - if( m_firstOutputConnected < 0 ) - { - CalculateFirstOutputConnected(); - } - else if( m_textures.Length != m_textureTypes.Length ) - { - OnNewSubstanceSelected( m_textures ); - } - - int texCount = m_outputConns.Count; - Rect individuals = m_previewArea; - individuals.height /= texCount; - - for( int i = 0; i < texCount; i++ ) - { - EditorGUI.DrawPreviewTexture( individuals, m_textures[ m_outputConns[ i ] ], null, ScaleMode.ScaleAndCrop ); - individuals.y += individuals.height; - } - } - else - { - GUI.Label( m_previewArea, string.Empty, UIUtils.ObjectFieldThumb ); - } - - if( ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD2 ) - { - Rect smallButton = m_previewArea; - smallButton.height = 14 * drawInfo.InvertedZoom; - smallButton.y = m_previewArea.yMax - smallButton.height - 2; - smallButton.width = 40 * drawInfo.InvertedZoom; - smallButton.x = m_previewArea.xMax - smallButton.width - 2; - if( m_textures == null ) - { - GUI.Label( m_previewArea, "None (Procedural Material)", UIUtils.ObjectFieldThumbOverlay ); - } - GUI.Label( m_pickerArea, "Select", UIUtils.GetCustomStyle( CustomStyle.SamplerButton ) ); - } - - GUI.Label( m_previewArea, string.Empty, UIUtils.GetCustomStyle( CustomStyle.SamplerFrame ) ); - } - } - - void OnNewSubstanceSelected( Texture[] textures ) - { - CacheCurrentSettings(); - ConfigPortsFromMaterial( true, textures ); - ConnectFromCache(); - m_requireMaterialUpdate = true; - CalculateFirstOutputConnected(); - ContainerGraph.ParentWindow.RequestRepaint(); - } - - public override void DrawProperties() - { - base.DrawProperties(); - EditorGUI.BeginChangeCheck(); - m_proceduralMaterial = EditorGUILayoutObjectField( SubstanceStr, m_proceduralMaterial, m_type, false ) as ProceduralMaterial; - if( EditorGUI.EndChangeCheck() ) - { - Texture[] textures = m_proceduralMaterial != null ? m_proceduralMaterial.GetGeneratedTextures() : null; - if( textures != null ) - { - OnNewSubstanceSelected( textures ); - } - } - - m_textureCoordSet = EditorGUILayoutIntPopup( Constants.AvailableUVSetsLabel, m_textureCoordSet, Constants.AvailableUVSetsStr, Constants.AvailableUVSets ); - EditorGUI.BeginChangeCheck(); - m_autoNormal = EditorGUILayoutToggle( AutoNormalStr, m_autoNormal ); - if( EditorGUI.EndChangeCheck() ) - { - for( int i = 0; i < m_textureTypes.Length; i++ ) - { - WirePortDataType portType = ( m_autoNormal && m_textureTypes[ i ] == ProceduralOutputType.Normal ) ? WirePortDataType.FLOAT3 : WirePortDataType.COLOR; - if( m_outputPorts[ i ].DataType != portType ) - { - m_outputPorts[ i ].ChangeType( portType, false ); - } - } - } - } - - private void CacheCurrentSettings() - { - m_cacheNodeConnections.Clear(); - for( int portId = 0; portId < m_outputPorts.Count; portId++ ) - { - if( m_outputPorts[ portId ].IsConnected ) - { - int connCount = m_outputPorts[ portId ].ConnectionCount; - for( int connIdx = 0; connIdx < connCount; connIdx++ ) - { - WireReference connection = m_outputPorts[ portId ].GetConnection( connIdx ); - m_cacheNodeConnections.Add( m_outputPorts[ portId ].Name, new NodeCache( connection.NodeId, connection.PortId ) ); - } - } - } - } - - private void ConnectFromCache() - { - for( int i = 0; i < m_outputPorts.Count; i++ ) - { - List<NodeCache> connections = m_cacheNodeConnections.GetList( m_outputPorts[ i ].Name ); - if( connections != null ) - { - int count = connections.Count; - for( int connIdx = 0; connIdx < count; connIdx++ ) - { - UIUtils.SetConnection( connections[ connIdx ].TargetNodeId, connections[ connIdx ].TargetPortId, UniqueId, i ); - } - } - } - } - - - private void ConfigPortsFromMaterial( bool invalidateConnections = false, Texture[] newTextures = null ) - { - SetAdditonalTitleText( ( m_proceduralMaterial != null ) ? string.Format( Constants.PropertyValueLabel, m_proceduralMaterial.name ) : "Value( <None> )" ); - - Texture[] textures = newTextures != null ? newTextures : ( ( m_proceduralMaterial != null ) ? m_proceduralMaterial.GetGeneratedTextures() : null ); - if( textures != null ) - { - m_firstOutputConnected = -1; - string nameToRemove = m_proceduralMaterial.name + "_"; - m_textureTypes = new ProceduralOutputType[ textures.Length ]; - for( int i = 0; i < textures.Length; i++ ) - { - ProceduralTexture procTex = textures[ i ] as ProceduralTexture; - m_textureTypes[ i ] = procTex.GetProceduralOutputType(); - - WirePortDataType portType = ( m_autoNormal && m_textureTypes[ i ] == ProceduralOutputType.Normal ) ? WirePortDataType.FLOAT3 : WirePortDataType.COLOR; - string newName = textures[ i ].name.Replace( nameToRemove, string.Empty ); - char firstLetter = Char.ToUpper( newName[ 0 ] ); - newName = firstLetter.ToString() + newName.Substring( 1 ); - if( i < m_outputPorts.Count ) - { - m_outputPorts[ i ].ChangeProperties( newName, portType, false ); - if( invalidateConnections ) - { - m_outputPorts[ i ].FullDeleteConnections(); - } - } - else - { - AddOutputPort( portType, newName ); - } - } - - if( textures.Length < m_outputPorts.Count ) - { - int itemsToRemove = m_outputPorts.Count - textures.Length; - for( int i = 0; i < itemsToRemove; i++ ) - { - int idx = m_outputPorts.Count - 1; - if( m_outputPorts[ idx ].IsConnected ) - { - m_outputPorts[ idx ].ForceClearConnection(); - } - RemoveOutputPort( idx ); - } - } - } - else - { - int itemsToRemove = m_outputPorts.Count - 1; - m_outputPorts[ 0 ].ChangeProperties( Constants.EmptyPortValue, WirePortDataType.COLOR, false ); - m_outputPorts[ 0 ].ForceClearConnection(); - - for( int i = 0; i < itemsToRemove; i++ ) - { - int idx = m_outputPorts.Count - 1; - if( m_outputPorts[ idx ].IsConnected ) - { - m_outputPorts[ idx ].ForceClearConnection(); - } - RemoveOutputPort( idx ); - } - } - - m_sizeIsDirty = true; - m_isDirty = true; - } - - private void ConfigFromObject( UnityEngine.Object obj ) - { - ProceduralMaterial newMat = AssetDatabase.LoadAssetAtPath<ProceduralMaterial>( AssetDatabase.GetAssetPath( obj ) ); - if( newMat != null ) - { - m_proceduralMaterial = newMat; - ConfigPortsFromMaterial(); - } - } - - public override void OnObjectDropped( UnityEngine.Object obj ) - { - ConfigFromObject( obj ); - } - - public override void SetupFromCastObject( UnityEngine.Object obj ) - { - ConfigFromObject( obj ); - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if( m_proceduralMaterial == null ) - { - return "(0).xxxx"; - } - - if( m_outputPorts[ outputId ].IsLocalValue( dataCollector.PortCategory ) ) - { - return m_outputPorts[ outputId ].LocalValue( dataCollector.PortCategory ); - } - - Texture[] textures = m_proceduralMaterial.GetGeneratedTextures(); - - string uvPropertyName = string.Empty; - for( int i = 0; i < m_outputPorts.Count; i++ ) - { - if( m_outputPorts[ i ].HasConnectedNode ) - { - uvPropertyName = textures[ i ].name; - break; - } - } - - string name = textures[ outputId ].name + OutputId; - dataCollector.AddToUniforms( UniqueId, string.Format( GlobalVarDecStr, textures[ outputId ].name ) ); - dataCollector.AddToProperties( UniqueId, string.Format( PropertyDecStr, textures[ outputId ].name ) + "{}", -1 ); - bool isVertex = ( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation ); - string value = string.Format( "tex2D{0}({1}, {2})", ( isVertex ? "lod" : string.Empty ), textures[ outputId ].name, GetUVCoords( ref dataCollector, ignoreLocalvar, uvPropertyName ) ); - if( m_autoNormal && m_textureTypes[ outputId ] == ProceduralOutputType.Normal ) - { - value = string.Format( TemplateHelperFunctions.CreateUnpackNormalStr( dataCollector,false,"1.0"), value ); - } - - dataCollector.AddPropertyNode( this ); - RegisterLocalVariable( outputId, value, ref dataCollector, name ); - - return m_outputPorts[ outputId ].LocalValue( dataCollector.PortCategory ); - } - - public string GetUVCoords( ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar, string propertyName ) - { - bool isVertex = ( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation ); - if( m_inputPorts[ 0 ].IsConnected ) - { - return m_inputPorts[ 0 ].GenerateShaderForOutput( ref dataCollector, isVertex ? WirePortDataType.FLOAT4 : WirePortDataType.FLOAT2, ignoreLocalVar, true ); - } - else - { - string uvChannelName = IOUtils.GetUVChannelName( propertyName, m_textureCoordSet ); - - if( dataCollector.IsTemplate ) - { - string propertyHelperVar = propertyName + "_ST"; - dataCollector.AddToUniforms( UniqueId, "float4", propertyHelperVar, dataCollector.IsSRP ); - string uvName = string.Empty; - if( dataCollector.TemplateDataCollectorInstance.HasUV( m_textureCoordSet ) ) - { - uvName = dataCollector.TemplateDataCollectorInstance.GetUVName( m_textureCoordSet ); - } - else - { - uvName = dataCollector.TemplateDataCollectorInstance.RegisterUV( m_textureCoordSet ); - } - - uvChannelName = "uv" + propertyName; - if( isVertex ) - { - string value = string.Format( Constants.TilingOffsetFormat, uvName, propertyHelperVar + ".xy", propertyHelperVar + ".zw" ); - string lodLevel = "0"; - - value = "float4( " + value + ", 0 , " + lodLevel + " )"; - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT4, uvChannelName, value ); - } - else - { - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, WirePortDataType.FLOAT2, uvChannelName, string.Format( Constants.TilingOffsetFormat, uvName, propertyHelperVar + ".xy", propertyHelperVar + ".zw" ) ); - } - } - else - { - string vertexCoords = Constants.VertexShaderInputStr + ".texcoord"; - if( m_textureCoordSet > 0 ) - { - vertexCoords += m_textureCoordSet.ToString(); - } - - - string dummyPropUV = "_texcoord" + ( m_textureCoordSet > 0 ? ( m_textureCoordSet + 1 ).ToString() : "" ); - string dummyUV = "uv" + ( m_textureCoordSet > 0 ? ( m_textureCoordSet + 1 ).ToString() : "" ) + dummyPropUV; - - dataCollector.AddToUniforms( UniqueId, "uniform float4 " + propertyName + "_ST;" ); - dataCollector.AddToProperties( UniqueId, "[HideInInspector] " + dummyPropUV + "( \"\", 2D ) = \"white\" {}", 100 ); - dataCollector.AddToInput( UniqueId, dummyUV, WirePortDataType.FLOAT2 ); - - if( isVertex ) - { - dataCollector.AddToVertexLocalVariables( UniqueId, "float4 " + uvChannelName + " = float4(" + vertexCoords + " * " + propertyName + "_ST.xy + " + propertyName + "_ST.zw, 0 ,0);" ); - return uvChannelName; - } - else - dataCollector.AddToLocalVariables( UniqueId, PrecisionType.Float, WirePortDataType.FLOAT2, uvChannelName, Constants.InputVarStr + "." + dummyUV + " * " + propertyName + "_ST.xy + " + propertyName + "_ST.zw" ); - - } - - return uvChannelName; - } - } - - public override void UpdateMaterial( Material mat ) - { - base.UpdateMaterial( mat ); - if( m_proceduralMaterial != null ) - { - Texture[] textures = m_proceduralMaterial.GetGeneratedTextures(); - for( int i = 0; i < textures.Length; i++ ) - { - if( mat.HasProperty( textures[ i ].name ) && !InsideShaderFunction ) - { - mat.SetTexture( textures[ i ].name, textures[ i ] ); - } - } - } - } - - public override bool UpdateShaderDefaults( ref Shader shader, ref TextureDefaultsDataColector defaultCol ) - { - if( m_proceduralMaterial != null ) - { - Texture[] textures = m_proceduralMaterial.GetGeneratedTextures(); - for( int i = 0; i < textures.Length; i++ ) - { - defaultCol.AddValue( textures[ i ].name, textures[ i ] ); - } - } - return true; - } - - public override void Destroy() - { - base.Destroy(); - m_textures = null; - m_proceduralMaterial = null; - m_cacheNodeConnections.Clear(); - m_cacheNodeConnections = null; - m_outputConns.Clear(); - m_outputConns = null; - } - - public override string GetPropertyValStr() - { - return m_proceduralMaterial ? m_proceduralMaterial.name : string.Empty; - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - string guid = GetCurrentParam( ref nodeParams ); - m_textureCoordSet = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - m_autoNormal = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - if( guid.Length > 1 ) - { - m_proceduralMaterial = AssetDatabase.LoadAssetAtPath<ProceduralMaterial>( AssetDatabase.GUIDToAssetPath( guid ) ); - if( m_proceduralMaterial != null ) - { - ConfigPortsFromMaterial(); - } - else - { - UIUtils.ShowMessage( UniqueId, "Substance not found ", MessageSeverity.Error ); - } - } - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - string guid = ( m_proceduralMaterial != null ) ? AssetDatabase.AssetPathToGUID( AssetDatabase.GetAssetPath( m_proceduralMaterial ) ) : "0"; - IOUtils.AddFieldValueToString( ref nodeInfo, guid ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_textureCoordSet ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_autoNormal ); - } - - } -#pragma warning restore 0618 -} -#elif SUBSTANCE_PLUGIN_ENABLED - -using Substance.Game; - -namespace AmplifyShaderEditor -{ - public enum ASEProceduralOutputType - { - Color, - Normal, - } - // Disabling Substance Deprecated warning -#pragma warning disable 0618 - [Serializable] - [NodeAttributes( "Substance Sample", "Textures", "Samples a procedural material", KeyCode.None, true, 0, int.MaxValue, typeof( SubstanceGraph ), typeof( Substance.Game.Substance ) )] - public sealed class SubstanceSamplerNode : PropertyNode - { - private const string NormalMapCheck = "_normal"; - private const string GlobalVarDecStr = "uniform sampler2D {0};"; - private const string PropertyDecStr = "{0}(\"{1}\", 2D) = \"white\""; - - private const string AutoNormalStr = "Auto-Normal"; - private const string SubstanceStr = "Substance"; - - private float TexturePreviewSizeX = 128; - private float TexturePreviewSizeY = 128; - - private float PickerPreviewWidthAdjust = 18; - - private bool m_editing; - - private CacheNodeConnections m_cacheNodeConnections; - - [SerializeField] - private int m_firstOutputConnected = 0; - - [SerializeField] - private Substance.Game.SubstanceGraph m_substanceGraph; - [SerializeField] - private string m_substanceGUID = string.Empty; - - [SerializeField] - private int m_textureCoordSet = 0; - - [SerializeField] - private ASEProceduralOutputType[] m_textureTypes; - - [SerializeField] - private bool m_autoNormal = true; - - private System.Type m_type; - - private List<Texture2D> m_textures = new List<Texture2D>(); - - private List<int> m_outputConns = new List<int>(); - - private Rect m_previewArea; - - private Rect m_pickerArea; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT2, false, "UV" ); - AddOutputPort( WirePortDataType.COLOR, Constants.EmptyPortValue ); - m_insideSize.Set( TexturePreviewSizeX + PickerPreviewWidthAdjust, TexturePreviewSizeY + 10 ); - m_type = typeof( Substance.Game.Substance ); - m_currentParameterType = PropertyType.Property; - m_freeType = false; - m_freeName = false; - m_autoWrapProperties = true; - m_customPrefix = "Substance Sample "; - m_drawPrecisionUI = false; - m_showPreview = true; - m_drawPreviewExpander = false; - m_selectedLocation = PreviewLocation.TopCenter; - m_cacheNodeConnections = new CacheNodeConnections(); - m_previewShaderGUID = "6f322c1da33f1e744941aafcb0ad1a2d"; - m_showAutoRegisterUI = false; - } - - public override void RenderNodePreview() - { - if( !m_initialized ) - return; - - SetPreviewInputs(); - PreviewMaterial.SetInt( "_CustomUVs", m_inputPorts[ 0 ].IsConnected ? 1 : 0 ); - - if( m_substanceGraph == null ) - return; - - List<Texture2D> texs = m_substanceGraph.generatedTextures; - int count = m_outputPorts.Count; - for( int i = 0; i < count; i++ ) - { - RenderTexture temp = RenderTexture.active; - RenderTexture.active = m_outputPorts[ i ].OutputPreviewTexture; - - PreviewMaterial.SetTexture( "_GenTex", texs[ i ] ); - - if( m_autoNormal && m_textureTypes[ i ] == ASEProceduralOutputType.Normal ) - Graphics.Blit( null, m_outputPorts[ i ].OutputPreviewTexture, PreviewMaterial, 1 ); - else - Graphics.Blit( null, m_outputPorts[ i ].OutputPreviewTexture, PreviewMaterial, 0 ); - RenderTexture.active = temp; - } - } - - public override void OnOutputPortConnected( int portId, int otherNodeId, int otherPortId ) - { - base.OnOutputPortConnected( portId, otherNodeId, otherPortId ); - m_firstOutputConnected = -1; - } - - public override void OnOutputPortDisconnected( int portId ) - { - base.OnOutputPortDisconnected( portId ); - m_firstOutputConnected = -1; - } - - void CalculateFirstOutputConnected() - { - m_outputConns.Clear(); - int count = m_outputPorts.Count; - bool connectionsAvailable = false; - for( int i = 0; i < count; i++ ) - { - if( m_outputPorts[ i ].IsConnected ) - { - connectionsAvailable = true; - } - } - - for( int i = 0; i < count; i++ ) - { - if( connectionsAvailable ) - { - if( m_outputPorts[ i ].IsConnected ) - { - if( m_firstOutputConnected < 0 ) - m_firstOutputConnected = i; - - m_outputConns.Add( i ); - } - } - else - { - m_outputConns.Add( i ); - } - } - - if( m_firstOutputConnected < 0 ) - m_firstOutputConnected = 0; - } - - public override void OnNodeLayout( DrawInfo drawInfo ) - { - base.OnNodeLayout( drawInfo ); - - m_previewArea = m_remainingBox; - m_previewArea.width = TexturePreviewSizeX * drawInfo.InvertedZoom; - m_previewArea.height = TexturePreviewSizeY * drawInfo.InvertedZoom; - m_previewArea.x += 0.5f * m_remainingBox.width - 0.5f * m_previewArea.width; - m_pickerArea = m_previewArea; - m_pickerArea.width = 40 * drawInfo.InvertedZoom; - m_pickerArea.x = m_previewArea.xMax - m_pickerArea.width - 2; - m_pickerArea.height = 14 * drawInfo.InvertedZoom; - m_pickerArea.y = m_previewArea.yMax - m_pickerArea.height - 2; - } - - public override void DrawGUIControls( DrawInfo drawInfo ) - { - base.DrawGUIControls( drawInfo ); - - if( !( drawInfo.CurrentEventType == EventType.MouseDown || drawInfo.CurrentEventType == EventType.MouseUp || drawInfo.CurrentEventType == EventType.ExecuteCommand || drawInfo.CurrentEventType == EventType.DragPerform ) ) - return; - - bool insideBox = m_previewArea.Contains( drawInfo.MousePosition ); - - if( insideBox ) - { - m_editing = true; - } - else if( m_editing && !insideBox && drawInfo.CurrentEventType != EventType.ExecuteCommand ) - { - GUI.FocusControl( null ); - m_editing = false; - } - } - - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - - if( m_editing ) - { - m_textures = m_substanceGraph != null ? m_substanceGraph.generatedTextures : null; - if( GUI.Button( m_pickerArea, string.Empty, GUIStyle.none ) ) - { - int controlID = EditorGUIUtility.GetControlID( FocusType.Passive ); - EditorGUIUtility.ShowObjectPicker<SubstanceGraph>( m_substanceGraph, false, "", controlID ); - } - - string commandName = Event.current.commandName; - UnityEngine.Object newValue = null; - if( commandName == "ObjectSelectorUpdated" ) - { - newValue = EditorGUIUtility.GetObjectPickerObject(); - if( newValue != (UnityEngine.Object)m_substanceGraph ) - { - UndoRecordObject( "Changing value EditorGUIObjectField on node Substance Sample" ); - - SubstanceGraph = newValue != null ? (SubstanceGraph)newValue : null; - m_textures = m_substanceGraph != null ? m_substanceGraph.generatedTextures : null; - OnNewSubstanceSelected( m_textures ); - } - } - else if( commandName == "ObjectSelectorClosed" ) - { - newValue = EditorGUIUtility.GetObjectPickerObject(); - if( newValue != (UnityEngine.Object)m_substanceGraph ) - { - UndoRecordObject( "Changing value EditorGUIObjectField on node Substance Sample" ); - - SubstanceGraph = newValue != null ? (SubstanceGraph)newValue : null; - m_textures = m_substanceGraph != null ? m_substanceGraph.generatedTextures : null; - OnNewSubstanceSelected( m_textures ); - } - m_editing = false; - } - - if( GUI.Button( m_previewArea, string.Empty, GUIStyle.none ) ) - { - if( m_substanceGraph != null ) - { - Selection.activeObject = m_substanceGraph; - EditorGUIUtility.PingObject( Selection.activeObject ); - } - m_editing = false; - } - } - - if( drawInfo.CurrentEventType == EventType.Repaint ) - { - if( !m_editing ) - m_textures = m_substanceGraph != null ? m_substanceGraph.generatedTextures : null; - - if( m_textures != null ) - { - if( m_firstOutputConnected < 0 ) - { - CalculateFirstOutputConnected(); - } - else if( m_textures.Count != m_textureTypes.Length ) - { - OnNewSubstanceSelected( m_textures ); - } - - int texCount = m_outputConns.Count; - Rect individuals = m_previewArea; - individuals.height /= texCount; - - for( int i = 0; i < texCount; i++ ) - { - EditorGUI.DrawPreviewTexture( individuals, m_textures[ m_outputConns[ i ] ], null, ScaleMode.ScaleAndCrop ); - individuals.y += individuals.height; - } - } - else - { - GUI.Label( m_previewArea, string.Empty, UIUtils.ObjectFieldThumb ); - } - - if( ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD2 ) - { - Rect smallButton = m_previewArea; - smallButton.height = 14 * drawInfo.InvertedZoom; - smallButton.y = m_previewArea.yMax - smallButton.height - 2; - smallButton.width = 40 * drawInfo.InvertedZoom; - smallButton.x = m_previewArea.xMax - smallButton.width - 2; - if( m_textures == null ) - { - GUI.Label( m_previewArea, "None (Procedural Material)", UIUtils.ObjectFieldThumbOverlay ); - } - GUI.Label( m_pickerArea, "Select", UIUtils.GetCustomStyle( CustomStyle.SamplerButton ) ); - } - - GUI.Label( m_previewArea, string.Empty, UIUtils.GetCustomStyle( CustomStyle.SamplerFrame ) ); - } - } - - void OnNewSubstanceSelected( List<Texture2D> textures ) - { - CacheCurrentSettings(); - ConfigPortsFromMaterial( true, textures ); - ConnectFromCache(); - m_requireMaterialUpdate = true; - CalculateFirstOutputConnected(); - ContainerGraph.ParentWindow.RequestRepaint(); - } - - public override void DrawProperties() - { - base.DrawProperties(); - EditorGUI.BeginChangeCheck(); - SubstanceGraph = EditorGUILayoutObjectField( SubstanceStr, m_substanceGraph, m_type, false ) as SubstanceGraph; - if( EditorGUI.EndChangeCheck() ) - { - List<Texture2D> textures = m_substanceGraph != null ? m_substanceGraph.generatedTextures : null; - if( textures != null ) - { - OnNewSubstanceSelected( textures ); - } - } - - m_textureCoordSet = EditorGUILayoutIntPopup( Constants.AvailableUVSetsLabel, m_textureCoordSet, Constants.AvailableUVSetsStr, Constants.AvailableUVSets ); - EditorGUI.BeginChangeCheck(); - m_autoNormal = EditorGUILayoutToggle( AutoNormalStr, m_autoNormal ); - if( EditorGUI.EndChangeCheck() ) - { - for( int i = 0; i < m_textureTypes.Length; i++ ) - { - WirePortDataType portType = ( m_autoNormal && m_textureTypes[ i ] == ASEProceduralOutputType.Normal ) ? WirePortDataType.FLOAT3 : WirePortDataType.COLOR; - if( m_outputPorts[ i ].DataType != portType ) - { - m_outputPorts[ i ].ChangeType( portType, false ); - } - } - } - } - - private void CacheCurrentSettings() - { - m_cacheNodeConnections.Clear(); - for( int portId = 0; portId < m_outputPorts.Count; portId++ ) - { - if( m_outputPorts[ portId ].IsConnected ) - { - int connCount = m_outputPorts[ portId ].ConnectionCount; - for( int connIdx = 0; connIdx < connCount; connIdx++ ) - { - WireReference connection = m_outputPorts[ portId ].GetConnection( connIdx ); - m_cacheNodeConnections.Add( m_outputPorts[ portId ].Name, new NodeCache( connection.NodeId, connection.PortId ) ); - } - } - } - } - - private void ConnectFromCache() - { - for( int i = 0; i < m_outputPorts.Count; i++ ) - { - List<NodeCache> connections = m_cacheNodeConnections.GetList( m_outputPorts[ i ].Name ); - if( connections != null ) - { - int count = connections.Count; - for( int connIdx = 0; connIdx < count; connIdx++ ) - { - UIUtils.SetConnection( connections[ connIdx ].TargetNodeId, connections[ connIdx ].TargetPortId, UniqueId, i ); - } - } - } - } - - - private void ConfigPortsFromMaterial( bool invalidateConnections = false, List<Texture2D> newTextures = null ) - { - SetAdditonalTitleText( ( m_substanceGraph != null ) ? string.Format( Constants.PropertyValueLabel, m_substanceGraph.name ) : "Value( <None> )" ); - - List<Texture2D> textures = newTextures != null ? newTextures : ( ( m_substanceGraph != null ) ? m_substanceGraph.generatedTextures : null ); - if( textures != null ) - { - m_firstOutputConnected = -1; - string nameToRemove = m_substanceGraph.graphLabel + "_"; - m_textureTypes = new ASEProceduralOutputType[ textures.Count ]; - for( int i = 0; i < textures.Count; i++ ) - { - //TODO: Replace for a more efficient test as soon as Laurent gives more infos - m_textureTypes[ i ] = textures[ i ].name.EndsWith( NormalMapCheck )?ASEProceduralOutputType.Normal:ASEProceduralOutputType.Color; - - WirePortDataType portType = ( m_autoNormal && m_textureTypes[ i ] == ASEProceduralOutputType.Normal ) ? WirePortDataType.FLOAT3 : WirePortDataType.COLOR; - string newName = textures[ i ].name.Replace( nameToRemove, string.Empty ); - char firstLetter = Char.ToUpper( newName[ 0 ] ); - newName = firstLetter.ToString() + newName.Substring( 1 ); - if( i < m_outputPorts.Count ) - { - m_outputPorts[ i ].ChangeProperties( newName, portType, false ); - if( invalidateConnections ) - { - m_outputPorts[ i ].FullDeleteConnections(); - } - } - else - { - AddOutputPort( portType, newName ); - } - } - - if( textures.Count < m_outputPorts.Count ) - { - int itemsToRemove = m_outputPorts.Count - textures.Count; - for( int i = 0; i < itemsToRemove; i++ ) - { - int idx = m_outputPorts.Count - 1; - if( m_outputPorts[ idx ].IsConnected ) - { - m_outputPorts[ idx ].ForceClearConnection(); - } - RemoveOutputPort( idx ); - } - } - } - else - { - int itemsToRemove = m_outputPorts.Count - 1; - m_outputPorts[ 0 ].ChangeProperties( Constants.EmptyPortValue, WirePortDataType.COLOR, false ); - m_outputPorts[ 0 ].ForceClearConnection(); - - for( int i = 0; i < itemsToRemove; i++ ) - { - int idx = m_outputPorts.Count - 1; - if( m_outputPorts[ idx ].IsConnected ) - { - m_outputPorts[ idx ].ForceClearConnection(); - } - RemoveOutputPort( idx ); - } - } - - m_sizeIsDirty = true; - m_isDirty = true; - } - - private void ConfigFromObject( UnityEngine.Object obj ) - { - SubstanceGraph newGraph = obj as SubstanceGraph;// AssetDatabase.LoadAssetAtPath<SubstanceGraph>( AssetDatabase.GetAssetPath( obj ) ); - if( newGraph != null ) - { - SubstanceGraph = newGraph; - ConfigPortsFromMaterial(); - } - - Substance.Game.Substance newSubstance = obj as Substance.Game.Substance;// AssetDatabase.LoadAssetAtPath<SubstanceGraph>( AssetDatabase.GetAssetPath( obj ) ); - if( newSubstance != null && newSubstance.graphs.Count > 0 ) - { - SubstanceGraph = newSubstance.graphs[0]; - ConfigPortsFromMaterial(); - } - - } - - public override void OnObjectDropped( UnityEngine.Object obj ) - { - ConfigFromObject( obj ); - } - - public override void SetupFromCastObject( UnityEngine.Object obj ) - { - ConfigFromObject( obj ); - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if( m_substanceGraph == null ) - { - return "(0).xxxx"; - } - - if( m_outputPorts[ outputId ].IsLocalValue( dataCollector.PortCategory ) ) - { - return m_outputPorts[ outputId ].LocalValue( dataCollector.PortCategory ); - } - - List<Texture2D> textures = m_substanceGraph.generatedTextures; - - string uvPropertyName = string.Empty; - for( int i = 0; i < m_outputPorts.Count; i++ ) - { - if( m_outputPorts[ i ].HasConnectedNode ) - { - uvPropertyName = UIUtils.GeneratePropertyName( textures[ i ].name , PropertyType.Property ); - break; - } - } - - string propertyName = UIUtils.GeneratePropertyName( textures[ outputId ].name, PropertyType.Property ); - string name = propertyName + OutputId; - dataCollector.AddToUniforms( UniqueId, string.Format( GlobalVarDecStr, propertyName ) ); - dataCollector.AddToProperties( UniqueId, string.Format( PropertyDecStr, propertyName, textures[ outputId ].name ) + "{}", -1 ); - bool isVertex = ( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation ); - string value = string.Format( "tex2D{0}({1}, {2})", ( isVertex ? "lod" : string.Empty ), propertyName, GetUVCoords( ref dataCollector, ignoreLocalvar, uvPropertyName ) ); - if( m_autoNormal && m_textureTypes[ outputId ] == ASEProceduralOutputType.Normal ) - { - value = string.Format( TemplateHelperFunctions.CreateUnpackNormalStr( dataCollector, false, "1.0" ), value ); - } - - dataCollector.AddPropertyNode( this ); - RegisterLocalVariable( outputId, value, ref dataCollector, name ); - - return m_outputPorts[ outputId ].LocalValue( dataCollector.PortCategory ); - } - - public string GetUVCoords( ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar, string propertyName ) - { - bool isVertex = ( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation ); - if( m_inputPorts[ 0 ].IsConnected ) - { - return m_inputPorts[ 0 ].GenerateShaderForOutput( ref dataCollector, isVertex ? WirePortDataType.FLOAT4 : WirePortDataType.FLOAT2, ignoreLocalVar, true ); - } - else - { - string uvChannelName = IOUtils.GetUVChannelName( propertyName, m_textureCoordSet ); - - if( dataCollector.IsTemplate ) - { - string propertyHelperVar = propertyName + "_ST"; - dataCollector.AddToUniforms( UniqueId, "float4", propertyHelperVar, dataCollector.IsSRP ); - string uvName = string.Empty; - if( dataCollector.TemplateDataCollectorInstance.HasUV( m_textureCoordSet ) ) - { - uvName = dataCollector.TemplateDataCollectorInstance.GetUVName( m_textureCoordSet ); - } - else - { - uvName = dataCollector.TemplateDataCollectorInstance.RegisterUV( m_textureCoordSet ); - } - - uvChannelName = "uv" + propertyName; - if( isVertex ) - { - string value = string.Format( Constants.TilingOffsetFormat, uvName, propertyHelperVar + ".xy", propertyHelperVar + ".zw" ); - string lodLevel = "0"; - - value = "float4( " + value + ", 0 , " + lodLevel + " )"; - dataCollector.AddLocalVariable( UniqueId, m_currentPrecisionType, WirePortDataType.FLOAT4, uvChannelName, value ); - } - else - { - dataCollector.AddLocalVariable( UniqueId, m_currentPrecisionType, WirePortDataType.FLOAT2, uvChannelName, string.Format( Constants.TilingOffsetFormat, uvName, propertyHelperVar + ".xy", propertyHelperVar + ".zw" ) ); - } - } - else - { - string vertexCoords = Constants.VertexShaderInputStr + ".texcoord"; - if( m_textureCoordSet > 0 ) - { - vertexCoords += m_textureCoordSet.ToString(); - } - - - string dummyPropUV = "_texcoord" + ( m_textureCoordSet > 0 ? ( m_textureCoordSet + 1 ).ToString() : "" ); - string dummyUV = "uv" + ( m_textureCoordSet > 0 ? ( m_textureCoordSet + 1 ).ToString() : "" ) + dummyPropUV; - - dataCollector.AddToUniforms( UniqueId, "uniform float4 " + propertyName + "_ST;" ); - dataCollector.AddToProperties( UniqueId, "[HideInInspector] " + dummyPropUV + "( \"\", 2D ) = \"white\" {}", 100 ); - dataCollector.AddToInput( UniqueId, dummyUV, WirePortDataType.FLOAT2 ); - - if( isVertex ) - { - dataCollector.AddToVertexLocalVariables( UniqueId, "float4 " + uvChannelName + " = float4(" + vertexCoords + " * " + propertyName + "_ST.xy + " + propertyName + "_ST.zw, 0 ,0);" ); - return uvChannelName; - } - else - dataCollector.AddToLocalVariables( UniqueId, PrecisionType.Float, WirePortDataType.FLOAT2, uvChannelName, Constants.InputVarStr + "." + dummyUV + " * " + propertyName + "_ST.xy + " + propertyName + "_ST.zw" ); - - } - - return uvChannelName; - } - } - - public override void UpdateMaterial( Material mat ) - { - base.UpdateMaterial( mat ); - if( m_substanceGraph != null ) - { - List<Texture2D> textures = m_substanceGraph.generatedTextures; - for( int i = 0; i < textures.Count; i++ ) - { - string textureName = UIUtils.GeneratePropertyName( textures[ i ].name, PropertyType.Property ); - if( mat.HasProperty( textureName ) && !InsideShaderFunction ) - { - mat.SetTexture( textureName, textures[ i ] ); - } - } - } - } - - public override bool UpdateShaderDefaults( ref Shader shader, ref TextureDefaultsDataColector defaultCol ) - { - if( m_substanceGraph != null ) - { - List<Texture2D> textures = m_substanceGraph.generatedTextures; - for( int i = 0; i < textures.Count; i++ ) - { - defaultCol.AddValue( UIUtils.GeneratePropertyName( textures[ i ].name, PropertyType.Property ), textures[ i ] ); - } - } - return true; - } - - public override void OnNodeLogicUpdate( DrawInfo drawInfo ) - { - base.OnNodeLogicUpdate( drawInfo ); - if( m_substanceGraph == null && !string.IsNullOrEmpty( m_substanceGUID ) ) - { - SubstanceGraph = AssetDatabase.LoadAssetAtPath<SubstanceGraph>( AssetDatabase.GUIDToAssetPath( m_substanceGUID ) ); - if( m_substanceGraph == null ) - { - m_substanceGUID = string.Empty; - } - } - } - - public override void Destroy() - { - base.Destroy(); - m_textures = null; - m_substanceGraph = null; - m_substanceGUID = string.Empty; - m_cacheNodeConnections.Clear(); - m_cacheNodeConnections = null; - m_outputConns.Clear(); - m_outputConns = null; - } - - public override string GetPropertyValStr() - { - return m_substanceGraph ? m_substanceGraph.name : string.Empty; - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - string guid = GetCurrentParam( ref nodeParams ); - m_textureCoordSet = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - m_autoNormal = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - if( guid.Length > 1 ) - { - SubstanceGraph = AssetDatabase.LoadAssetAtPath<SubstanceGraph>( AssetDatabase.GUIDToAssetPath( guid ) ); - if( m_substanceGraph != null ) - { - ConfigPortsFromMaterial(); - } - else - { - UIUtils.ShowMessage( "Substance not found ", MessageSeverity.Error ); - } - } - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - string guid = ( m_substanceGraph != null ) ? AssetDatabase.AssetPathToGUID( AssetDatabase.GetAssetPath( m_substanceGraph ) ) : "0"; - IOUtils.AddFieldValueToString( ref nodeInfo, guid ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_textureCoordSet ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_autoNormal ); - } - - public SubstanceGraph SubstanceGraph - { - set - { - m_substanceGraph = value; - if( value != null ) - { - m_substanceGUID = AssetDatabase.AssetPathToGUID( AssetDatabase.GetAssetPath( value ) ); - } - else - { - m_substanceGUID = string.Empty; - } - } - get { return m_substanceGraph; } - } - } -#pragma warning restore 0618 -} -#endif diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/SubstanceSamplerNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/SubstanceSamplerNode.cs.meta deleted file mode 100644 index 02886b0f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/SubstanceSamplerNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 7323b6020278e034b9e4c670cbc61361 -timeCreated: 1486640033 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TFHCFlipBookUVAnimation.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TFHCFlipBookUVAnimation.cs deleted file mode 100644 index 3735c3ad..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TFHCFlipBookUVAnimation.cs +++ /dev/null @@ -1,238 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> -// -// Custom Node Flipbook UV Animation -// Donated by The Four Headed Cat - @fourheadedcat - -using UnityEngine; -using UnityEditor; -using System; - -namespace AmplifyShaderEditor -{ - - [Serializable] - [NodeAttributes( "Flipbook UV Animation", "UV Coordinates", "Animate a Flipbook Texture Modifying UV Coordinates.", null, KeyCode.None, true, false, null, null, "The Four Headed Cat - @fourheadedcat" )] - public sealed class TFHCFlipBookUVAnimation : ParentNode - - { - - private const string TextureVerticalDirectionStr = "Texture Direction"; - private const string NegativeSpeedBehaviorStr = "If Negative Speed"; - - [SerializeField] - private int m_selectedTextureVerticalDirection = 0; - - [SerializeField] - private int m_negativeSpeedBehavior = 0; - - [SerializeField] - private readonly string[] m_textureVerticalDirectionValues = { "Top To Bottom", "Bottom To Top" }; - - [SerializeField] - private readonly string[] m_negativeSpeedBehaviorValues = { "Switch to Positive", "Reverse Animation" }; - - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT2, false, "UV" ); - AddInputPort( WirePortDataType.FLOAT, false, "Columns" ); - AddInputPort( WirePortDataType.FLOAT, false, "Rows" ); - AddInputPort( WirePortDataType.FLOAT, false, "Speed" ); - AddInputPort( WirePortDataType.FLOAT, false, "Start Frame" ); - AddInputPort( WirePortDataType.FLOAT, false, "Time" ); - - AddOutputVectorPorts( WirePortDataType.FLOAT2, "UV" ); - m_outputPorts[ 1 ].Name = "U"; - m_outputPorts[ 2 ].Name = "V"; - m_textLabelWidth = 125; - m_useInternalPortData = true; - m_autoWrapProperties = true; - m_previewShaderGUID = "04fe24be792bfd5428b92132d7cf0f7d"; - } - - public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) - { - base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); - if( portId == 5 ) - { - m_previewMaterialPassId = 1; - } - } - - public override void OnInputPortDisconnected( int portId ) - { - base.OnInputPortDisconnected( portId ); - if( portId == 5 ) - { - m_previewMaterialPassId = 0; - } - } - - public override void DrawProperties() - { - base.DrawProperties(); - EditorGUILayout.BeginVertical(); - m_selectedTextureVerticalDirection = EditorGUILayoutPopup( TextureVerticalDirectionStr, m_selectedTextureVerticalDirection, m_textureVerticalDirectionValues ); - m_negativeSpeedBehavior = EditorGUILayoutPopup( NegativeSpeedBehaviorStr, m_negativeSpeedBehavior, m_negativeSpeedBehaviorValues ); - EditorGUILayout.EndVertical(); - EditorGUILayout.HelpBox( "Flipbook UV Animation:\n\n - UV: Texture Coordinates to Flipbook.\n - Columns: number of Columns (X) of the Flipbook Texture.\n - Rows: number of Rows (Y) of the Flipbook Textures.\n - Speed: speed of the animation.\n - Texture Direction: set the vertical order of the texture tiles.\n - If Negative Speed: set the behavior when speed is negative.\n\n - Out: UV Coordinates.", MessageType.None ); - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - m_selectedTextureVerticalDirection = ( int ) int.Parse( GetCurrentParam( ref nodeParams ) ); - m_negativeSpeedBehavior = ( int ) int.Parse( GetCurrentParam( ref nodeParams ) ); - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_selectedTextureVerticalDirection ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_negativeSpeedBehavior ); - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - // OPTIMIZATION NOTES - // - // round( fmod( x, y ) ) can be replaced with a faster - // floor( frac( x / y ) * y + 0.5 ) => div can be muls with 1/y, almost always static/constant - // - if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) - return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); - - string uv = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - string columns = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); - - if ( !m_inputPorts[ 1 ].IsConnected ) - columns = ( float.Parse( columns ) == 0f ? "1" : columns ); - - string rows = m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ); - if ( !m_inputPorts[ 2 ].IsConnected ) - rows = ( float.Parse( rows ) == 0f ? "1" : rows ); - - string speed = m_inputPorts[ 3 ].GeneratePortInstructions( ref dataCollector ); - string startframe = m_inputPorts[ 4 ].GeneratePortInstructions( ref dataCollector ); - string timer = m_inputPorts[ 5 ].IsConnected ? m_inputPorts[ 5 ].GeneratePortInstructions( ref dataCollector ) : "_Time[ 1 ]"; - - string vcomment1 = "// *** BEGIN Flipbook UV Animation vars ***"; - string vcomment2 = "// Total tiles of Flipbook Texture"; - string vtotaltiles = "float fbtotaltiles" + OutputId + " = " + columns + " * " + rows + ";"; - string vcomment3 = "// Offsets for cols and rows of Flipbook Texture"; - string vcolsoffset = "float fbcolsoffset" + OutputId + " = 1.0f / " + columns + ";"; - string vrowssoffset = "float fbrowsoffset" + OutputId + " = 1.0f / " + rows + ";"; - string vcomment4 = "// Speed of animation"; - - string vspeed = string.Format( "float fbspeed{0} = {1} * {2};", OutputId,timer,speed); - string vcomment5 = "// UV Tiling (col and row offset)"; - string vtiling = "float2 fbtiling" + OutputId + " = float2(fbcolsoffset" + OutputId + ", fbrowsoffset" + OutputId + ");"; - string vcomment6 = "// UV Offset - calculate current tile linear index, and convert it to (X * coloffset, Y * rowoffset)"; - string vcomment7 = "// Calculate current tile linear index"; - //float fbcurrenttileindex1 = round( fmod( fbspeed1 + _Float0, fbtotaltiles1 ) ); - string vcurrenttileindex = "float fbcurrenttileindex" + OutputId + " = round( fmod( fbspeed" + OutputId + " + " + startframe + ", fbtotaltiles" + OutputId + ") );"; - string vcurrenttileindex1 = "fbcurrenttileindex" + OutputId + " += ( fbcurrenttileindex" + OutputId + " < 0) ? fbtotaltiles" + OutputId + " : 0;"; - //fbcurrenttileindex1 += ( fbcurrenttileindex1 < 0 ) ? fbtotaltiles1 : 0; - //string vcurrenttileindex = "int fbcurrenttileindex" + m_uniqueId + " = (int)fmod( fbspeed" + m_uniqueId + ", fbtotaltiles" + m_uniqueId + ") + " + startframe + ";"; - string vcomment8 = "// Obtain Offset X coordinate from current tile linear index"; - - //float fblinearindextox1 = round( fmod( fbcurrenttileindex1, 5.0 ) ); - //string voffsetx1 = "int fblinearindextox" + m_uniqueId + " = fbcurrenttileindex" + m_uniqueId + " % (int)" + columns + ";"; - string voffsetx1 = "float fblinearindextox" + OutputId + " = round ( fmod ( fbcurrenttileindex" + OutputId + ", " + columns + " ) );"; - string vcomment9 = String.Empty; - string voffsetx2 = String.Empty; - if ( m_negativeSpeedBehavior != 0 ) - { - vcomment9 = "// Reverse X animation if speed is negative"; - voffsetx2 = "fblinearindextox" + OutputId + " = (" + speed + " > 0 ? fblinearindextox" + OutputId + " : (int)" + columns + " - fblinearindextox" + OutputId + ");"; - } - string vcomment10 = "// Multiply Offset X by coloffset"; - string voffsetx3 = "float fboffsetx" + OutputId + " = fblinearindextox" + OutputId + " * fbcolsoffset" + OutputId + ";"; - string vcomment11 = "// Obtain Offset Y coordinate from current tile linear index"; - //float fblinearindextoy1 = round( fmod( ( fbcurrenttileindex1 - fblinearindextox1 ) / 5.0, 5.0 ) ); - string voffsety1 = "float fblinearindextoy" + OutputId + " = round( fmod( ( fbcurrenttileindex" + OutputId + " - fblinearindextox" + OutputId + " ) / " + columns + ", " + rows + " ) );"; - //string voffsety1 = "int fblinearindextoy" + m_uniqueId + " = (int)( ( fbcurrenttileindex" + m_uniqueId + " - fblinearindextox" + m_uniqueId + " ) / " + columns + " ) % (int)" + rows + ";"; - //string vcomment10 = "// Reverse Y to get from Top to Bottom"; - //string voffsety2 = "fblinearindextoy" + m_uniqueId + " = (int)" + rows + " - fblinearindextoy" + m_uniqueId + ";"; - string vcomment12 = String.Empty; - string voffsety2 = String.Empty; - if ( m_negativeSpeedBehavior == 0 ) - { - if ( m_selectedTextureVerticalDirection == 0 ) - { - vcomment12 = "// Reverse Y to get tiles from Top to Bottom"; - voffsety2 = "fblinearindextoy" + OutputId + " = (int)(" + rows + "-1) - fblinearindextoy" + OutputId + ";"; - } - } - else - { - string reverseanimationoperator = String.Empty; - if ( m_selectedTextureVerticalDirection == 0 ) - { - vcomment12 = "// Reverse Y to get tiles from Top to Bottom and Reverse Y animation if speed is negative"; - reverseanimationoperator = " < "; - } - else - { - vcomment12 = "// Reverse Y animation if speed is negative"; - reverseanimationoperator = " > "; - } - voffsety2 = "fblinearindextoy" + OutputId + " = (" + speed + reverseanimationoperator + " 0 ? fblinearindextoy" + OutputId + " : (int)" + rows + " - fblinearindextoy" + OutputId + ");"; - } - string vcomment13 = "// Multiply Offset Y by rowoffset"; - string voffsety3 = "float fboffsety" + OutputId + " = fblinearindextoy" + OutputId + " * fbrowsoffset" + OutputId + ";"; - string vcomment14 = "// UV Offset"; - string voffset = "float2 fboffset" + OutputId + " = float2(fboffsetx" + OutputId + ", fboffsety" + OutputId + ");"; - //string voffset = "float2 fboffset" + m_uniqueId + " = float2( ( ( (int)fmod( fbspeed" + m_uniqueId + " , fbtotaltiles" + m_uniqueId + ") % (int)" + columns + " ) * fbcolsoffset" + m_OutputId + " ) , ( ( (int)" + rows + " - ( (int)( ( (int)fmod( fbspeed" + m_uniqueId + " , fbtotaltiles" + m_uniqueId + " ) - ( (int)fmod( fbspeed" + m_uniqueId + " , fbtotaltiles" + m_uniqueId + " ) % (int)" + columns + " ) ) / " + columns + " ) % (int)" + rows + " ) ) * fbrowsoffset" + m_uniqueId + " ) );"; - string vcomment15 = "// Flipbook UV"; - string vfbuv = "half2 fbuv" + OutputId + " = " + uv + " * fbtiling" + OutputId + " + fboffset" + OutputId + ";"; - string vcomment16 = "// *** END Flipbook UV Animation vars ***"; - string result = "fbuv" + OutputId; - - dataCollector.AddLocalVariable( UniqueId, vcomment1 ); - dataCollector.AddLocalVariable( UniqueId, vcomment2 ); - dataCollector.AddLocalVariable( UniqueId, vtotaltiles ); - dataCollector.AddLocalVariable( UniqueId, vcomment3 ); - dataCollector.AddLocalVariable( UniqueId, vcolsoffset ); - dataCollector.AddLocalVariable( UniqueId, vrowssoffset ); - dataCollector.AddLocalVariable( UniqueId, vcomment4 ); - dataCollector.AddLocalVariable( UniqueId, vspeed ); - dataCollector.AddLocalVariable( UniqueId, vcomment5 ); - dataCollector.AddLocalVariable( UniqueId, vtiling ); - dataCollector.AddLocalVariable( UniqueId, vcomment6 ); - dataCollector.AddLocalVariable( UniqueId, vcomment7 ); - dataCollector.AddLocalVariable( UniqueId, vcurrenttileindex ); - dataCollector.AddLocalVariable( UniqueId, vcurrenttileindex1 ); - dataCollector.AddLocalVariable( UniqueId, vcomment8 ); - dataCollector.AddLocalVariable( UniqueId, voffsetx1 ); - if ( m_negativeSpeedBehavior != 0 ) - { - dataCollector.AddLocalVariable( UniqueId, vcomment9 ); - dataCollector.AddLocalVariable( UniqueId, voffsetx2 ); - } - dataCollector.AddLocalVariable( UniqueId, vcomment10 ); - dataCollector.AddLocalVariable( UniqueId, voffsetx3 ); - dataCollector.AddLocalVariable( UniqueId, vcomment11 ); - dataCollector.AddLocalVariable( UniqueId, voffsety1 ); - if ( m_selectedTextureVerticalDirection == 0 || m_negativeSpeedBehavior != 0 ) - { - dataCollector.AddLocalVariable( UniqueId, vcomment12 ); - dataCollector.AddLocalVariable( UniqueId, voffsety2 ); - } - dataCollector.AddLocalVariable( UniqueId, vcomment13 ); - dataCollector.AddLocalVariable( UniqueId, voffsety3 ); - dataCollector.AddLocalVariable( UniqueId, vcomment14 ); - dataCollector.AddLocalVariable( UniqueId, voffset ); - dataCollector.AddLocalVariable( UniqueId, vcomment15 ); - dataCollector.AddLocalVariable( UniqueId, vfbuv ); - dataCollector.AddLocalVariable( UniqueId, vcomment16 ); - - m_outputPorts[ 0 ].SetLocalValue( result, dataCollector.PortCategory ); - - return GetOutputVectorItem( 0, outputId, result ); - - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TFHCFlipBookUVAnimation.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TFHCFlipBookUVAnimation.cs.meta deleted file mode 100644 index cf165fe3..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TFHCFlipBookUVAnimation.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 38b8c76e7f2dc294581195a669942706 -timeCreated: 1481126954 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TFHCPixelate.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TFHCPixelate.cs deleted file mode 100644 index 3d778d9c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TFHCPixelate.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> -// -// Custom Node Pixelate UV -// Donated by The Four Headed Cat - @fourheadedcat - -using UnityEngine; -using UnityEditor; -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Pixelate UV", "UV Coordinates", "Pixelate Texture Modifying UV.", null, KeyCode.None, true, false, null, null, "The Four Headed Cat - @fourheadedcat" )] - public sealed class TFHCPixelate : ParentNode - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT2, true, "UV" ); - AddInputPort( WirePortDataType.FLOAT, false, "Pixels X" ); - AddInputPort( WirePortDataType.FLOAT, false, "Pixels Y" ); - AddOutputPort( WirePortDataType.FLOAT2, "Out" ); - m_useInternalPortData = true; - m_previewShaderGUID = "e2f7e3c513ed18340868b8cbd0d85cfb"; - } - - public override void DrawProperties() - { - base.DrawProperties (); - EditorGUILayout.HelpBox ("Pixelate UV.\n\n - UV is the Texture Coordinates to pixelate.\n - Pixels X is the number of horizontal pixels\n - Pixels Y is the number of vertical pixels.", MessageType.None); - - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - string uv = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - string PixelCount_X = m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ); - string PixelCount_Y = m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ); - - string pixelWidth = "float pixelWidth" + OutputId + " = 1.0f / " + PixelCount_X + ";"; - string pixelHeight = "float pixelHeight" + OutputId + " = 1.0f / " + PixelCount_Y + ";"; - string pixelatedUV = "half2 pixelateduv" + OutputId + " = half2((int)(" + uv + ".x / pixelWidth" + OutputId + ") * pixelWidth" + OutputId + ", (int)(" + uv + ".y / pixelHeight" + OutputId + ") * pixelHeight" + OutputId + ");"; - string result = "pixelateduv" + OutputId; - - dataCollector.AddLocalVariable( UniqueId, pixelWidth ); - dataCollector.AddLocalVariable( UniqueId, pixelHeight ); - dataCollector.AddLocalVariable( UniqueId, pixelatedUV ); - - return GetOutputVectorItem( 0, outputId, result); - - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TFHCPixelate.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TFHCPixelate.cs.meta deleted file mode 100644 index fc01dd0a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TFHCPixelate.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 72a1a810ace8ea440ba20d4a4f9086ce -timeCreated: 1481126956 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TextureCoordinatesNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TextureCoordinatesNode.cs deleted file mode 100644 index fc7b1801..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TextureCoordinatesNode.cs +++ /dev/null @@ -1,588 +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.Collections.Generic; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Texture Coordinates", "UV Coordinates", "Texture UV coordinates set, if <b>Tex</b> is connected to a texture object it will use that texture scale factors, otherwise uses <b>Tilling</b> and <b>Offset</b> port values", null, KeyCode.U, tags: "uv" )] - public sealed class TextureCoordinatesNode : ParentNode - { - - private const string DummyPropertyDec = "[HideInInspector] _DummyTex{0}( \"\", 2D ) = \"white\""; - private const string DummyUniformDec = "uniform sampler2D _DummyTex{0};"; - private const string DummyTexCoordDef = "uv{0}_DummyTex{0}"; - private const string DummyTexCoordSurfDef = "float2 texCoordDummy{0} = {1}.uv{2}_DummyTex{2}*{3} + {4};"; - private const string DummyTexCoordSurfVar = "texCoordDummy{0}"; - - private readonly string[] Dummy = { string.Empty }; - - private const string TilingStr = "Tiling"; - private const string OffsetStr = "Offset"; - private const string TexCoordStr = "texcoord_"; - - [SerializeField] - private int m_referenceArrayId = -1; - - [SerializeField] - private int m_referenceNodeId = -1; - - [SerializeField] - private int m_textureCoordChannel = 0; - - //[SerializeField] - //private int m_texcoordId = -1; - - [SerializeField] - private int m_texcoordSize = 2; - - [SerializeField] - private string m_surfaceTexcoordName = string.Empty; - - [SerializeField] - private TexturePropertyNode m_inputReferenceNode = null; - - private Vector4Node m_texCoordsHelper; - - private TexturePropertyNode m_referenceNode = null; - - private InputPort m_texPort = null; - private InputPort m_tilingPort = null; - private InputPort m_offsetPort = null; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.SAMPLER2D, false, "Tex", -1, MasterNodePortCategory.Fragment, 2 ); - m_texPort = m_inputPorts[ m_inputPorts.Count - 1 ]; - m_texPort.CreatePortRestrictions( WirePortDataType.SAMPLER1D, WirePortDataType.SAMPLER2D, WirePortDataType.SAMPLER3D, WirePortDataType.SAMPLERCUBE, WirePortDataType.OBJECT ); - - AddInputPort( WirePortDataType.FLOAT2, false, "Tiling", -1, MasterNodePortCategory.Fragment, 0 ); - m_tilingPort = m_inputPorts[ m_inputPorts.Count - 1 ]; - m_tilingPort.Vector2InternalData = new Vector2( 1, 1 ); - AddInputPort( WirePortDataType.FLOAT2, false, "Offset", -1, MasterNodePortCategory.Fragment, 1 ); - m_offsetPort = m_inputPorts[ m_inputPorts.Count - 1 ]; - - - AddOutputVectorPorts( WirePortDataType.FLOAT2, "UV" ); - m_outputPorts[ 1 ].Name = "U"; - m_outputPorts[ 2 ].Name = "V"; - AddOutputPort( WirePortDataType.FLOAT, "W" ); - AddOutputPort( WirePortDataType.FLOAT, "T" ); - m_textLabelWidth = 90; - m_useInternalPortData = true; - m_autoWrapProperties = true; - m_tilingPort.Category = MasterNodePortCategory.Vertex; - m_offsetPort.Category = MasterNodePortCategory.Vertex; - UpdateOutput(); - m_previewShaderGUID = "085e462b2de441a42949be0e666cf5d2"; - } - - public override void Reset() - { - m_surfaceTexcoordName = string.Empty; - } - - public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) - { - base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); - if( portId == 2 ) - { - m_inputReferenceNode = m_texPort.GetOutputNodeWhichIsNotRelay() as TexturePropertyNode; - UpdatePorts(); - } - UpdateTitle(); - } - - public override void OnInputPortDisconnected( int portId ) - { - base.OnInputPortDisconnected( portId ); - if( portId == 2 ) - { - m_inputReferenceNode = null; - UpdatePorts(); - } - UpdateTitle(); - } - - void UpdateTitle() - { - if( m_inputReferenceNode != null ) - { - m_additionalContent.text = string.Format( "Value( {0} )", m_inputReferenceNode.PropertyInspectorName ); - } - else if( m_referenceArrayId > -1 && m_referenceNode != null ) - { - m_additionalContent.text = string.Format( "Value( {0} )", m_referenceNode.PropertyInspectorName ); - } - else - { - m_additionalContent.text = string.Empty; - } - m_sizeIsDirty = true; - } - - void UpdatePorts() - { - if( m_inputReferenceNode != null || m_texPort.IsConnected ) - { - m_tilingPort.Locked = true; - m_offsetPort.Locked = true; - } - else if( m_referenceArrayId > -1 ) - { - m_tilingPort.Locked = true; - m_offsetPort.Locked = true; - } - else - { - m_tilingPort.Locked = false; - m_offsetPort.Locked = false; - } - } - - public override void DrawProperties() - { - bool guiEnabledBuffer = GUI.enabled; - - EditorGUI.BeginChangeCheck(); - List<string> arr = new List<string>( UIUtils.TexturePropertyNodeArr() ); - if( arr != null && arr.Count > 0 ) - { - arr.Insert( 0, "None" ); - GUI.enabled = true && ( !m_texPort.IsConnected ); - m_referenceArrayId = EditorGUILayoutPopup( Constants.AvailableReferenceStr, m_referenceArrayId + 1, arr.ToArray() ) - 1; - } - else - { - m_referenceArrayId = -1; - GUI.enabled = false; - EditorGUILayoutPopup( Constants.AvailableReferenceStr, 0, Dummy ); - } - - GUI.enabled = guiEnabledBuffer; - if( EditorGUI.EndChangeCheck() ) - { - m_referenceNode = UIUtils.GetTexturePropertyNode( m_referenceArrayId ); - if( m_referenceNode != null ) - { - m_referenceNodeId = m_referenceNode.UniqueId; - } - else - { - m_referenceNodeId = -1; - m_referenceArrayId = -1; - } - - UpdateTitle(); - UpdatePorts(); - } - - EditorGUI.BeginChangeCheck(); - m_texcoordSize = EditorGUILayoutIntPopup( Constants.AvailableUVSizesLabel, m_texcoordSize, Constants.AvailableUVSizesStr, Constants.AvailableUVSizes ); - if( EditorGUI.EndChangeCheck() ) - { - UpdateOutput(); - } - - m_textureCoordChannel = EditorGUILayoutIntPopup( Constants.AvailableUVSetsLabel, m_textureCoordChannel, Constants.AvailableUVSetsStr, Constants.AvailableUVSets ); - - - if( m_referenceArrayId > -1 ) - GUI.enabled = false; - - base.DrawProperties(); - - GUI.enabled = guiEnabledBuffer; - } - - private void UpdateOutput() - { - if( m_texcoordSize == 3 ) - { - m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT3, false ); - m_outputPorts[ 0 ].Name = "UVW"; - m_outputPorts[ 3 ].Visible = true; - m_outputPorts[ 4 ].Visible = false; - } - else if( m_texcoordSize == 4 ) - { - m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT4, false ); - m_outputPorts[ 0 ].Name = "UVWT"; - m_outputPorts[ 3 ].Visible = true; - m_outputPorts[ 4 ].Visible = true; - } - else - { - m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT2, false ); - m_outputPorts[ 0 ].Name = "UV"; - m_outputPorts[ 3 ].Visible = false; - m_outputPorts[ 4 ].Visible = false; - } - m_sizeIsDirty = true; - } - - public override void OnNodeLogicUpdate( DrawInfo drawInfo ) - { - base.OnNodeLogicUpdate( drawInfo ); - CheckReference(); - } - - //public override void Draw( DrawInfo drawInfo ) - //{ - // base.Draw( drawInfo ); - // //CheckReference(); - //} - - void CheckReference() - { - if( m_referenceArrayId > -1 ) - { - ParentNode newNode = UIUtils.GetTexturePropertyNode( m_referenceArrayId ); - if( newNode == null || newNode.UniqueId != m_referenceNodeId ) - { - m_referenceNode = null; - int count = UIUtils.GetTexturePropertyNodeAmount(); - for( int i = 0; i < count; i++ ) - { - ParentNode node = UIUtils.GetTexturePropertyNode( i ); - if( node.UniqueId == m_referenceNodeId ) - { - m_referenceNode = node as TexturePropertyNode; - m_referenceArrayId = i; - break; - } - } - } - } - - if( m_referenceNode == null && m_referenceNodeId > -1 ) - { - m_referenceNodeId = -1; - m_referenceArrayId = -1; - UpdateTitle(); - UpdatePorts(); - } - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - m_textureCoordChannel = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - if( UIUtils.CurrentShaderVersion() > 2402 ) - { - if( UIUtils.CurrentShaderVersion() > 2404 ) - { - m_referenceNodeId = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - } - else - { - m_referenceArrayId = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - } - } - - if( UIUtils.CurrentShaderVersion() > 5001 ) - { - m_texcoordSize = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - UpdateOutput(); - } - } - - - public override void RefreshExternalReferences() - { - base.RefreshExternalReferences(); - if( UIUtils.CurrentShaderVersion() > 2402 ) - { - if( UIUtils.CurrentShaderVersion() > 2404 ) - { - m_referenceNode = UIUtils.GetNode( m_referenceNodeId ) as TexturePropertyNode; - if( m_referenceNodeId > -1 ) - m_referenceArrayId = UIUtils.GetTexturePropertyNodeRegisterId( m_referenceNodeId ); - } - else - { - m_referenceNode = UIUtils.GetTexturePropertyNode( m_referenceArrayId ); - if( m_referenceNode != null ) - { - m_referenceNodeId = m_referenceNode.UniqueId; - } - } - UpdateTitle(); - UpdatePorts(); - } - } - - public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) - { - if( dataCollector != null && dataCollector.TesselationActive ) - { - base.PropagateNodeData( nodeData, ref dataCollector ); - return; - } - - if( dataCollector.IsTemplate ) - { - dataCollector.TemplateDataCollectorInstance.SetUVUsage( m_textureCoordChannel, m_texcoordSize ); - } - else if( m_textureCoordChannel > 3 ) - { - dataCollector.AddCustomAppData( string.Format( TemplateHelperFunctions.TexUVFullSemantic, m_textureCoordChannel ) ); - } - UIUtils.SetCategoryInBitArray( ref m_category, nodeData.Category ); - - MasterNodePortCategory propagateCategory = ( nodeData.Category != MasterNodePortCategory.Vertex && nodeData.Category != MasterNodePortCategory.Tessellation ) ? MasterNodePortCategory.Vertex : nodeData.Category; - nodeData.Category = propagateCategory; - nodeData.GraphDepth += 1; - if( nodeData.GraphDepth > m_graphDepth ) - { - m_graphDepth = nodeData.GraphDepth; - } - - int count = m_inputPorts.Count; - for( int i = 0; i < count; i++ ) - { - if( m_inputPorts[ i ].IsConnected ) - { - //m_inputPorts[ i ].GetOutputNode().PropagateNodeCategory( category ); - m_inputPorts[ i ].GetOutputNode().PropagateNodeData( nodeData, ref dataCollector ); - } - } - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_textureCoordChannel ); - IOUtils.AddFieldValueToString( ref nodeInfo, ( ( m_referenceNode != null ) ? m_referenceNode.UniqueId : -1 ) ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_texcoordSize ); - } - - string GetValidPropertyName() - { - string propertyName = string.Empty; - if( m_inputReferenceNode != null ) - { - propertyName = m_inputReferenceNode.PropertyName; - } - else if( m_referenceArrayId > -1 ) - { - m_referenceNode = UIUtils.GetTexturePropertyNode( m_referenceArrayId ); - if( m_referenceNode != null ) - { - propertyName = m_referenceNode.PropertyName; - } - } - - return propertyName; - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) - { - if( dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) - { - UIUtils.ShowMessage( UniqueId, m_nodeAttribs.Name + " cannot be used on Master Node Tessellation port" ); - return "-1"; - } - - //bool isVertex = ( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation ); - - string tiling = string.Empty; - string offset = string.Empty; - - string portProperty = string.Empty; - if( m_texPort.IsConnected ) - { - portProperty = m_texPort.GeneratePortInstructions( ref dataCollector ); - } - else if( m_referenceArrayId > -1 ) - { - TexturePropertyNode temp = UIUtils.GetTexturePropertyNode( m_referenceArrayId ); - if( temp != null ) - { - portProperty = temp.BaseGenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalVar ); - } - } - - //TEMPLATES - if( dataCollector.MasterNodeCategory == AvailableShaderTypes.Template ) - { - if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) - return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); - - string uvName = string.Empty; - if( dataCollector.TemplateDataCollectorInstance.HasUV( m_textureCoordChannel ) ) - { - uvName = dataCollector.TemplateDataCollectorInstance.GetUVName( m_textureCoordChannel, m_outputPorts[ 0 ].DataType ); - } - else - { - uvName = dataCollector.TemplateDataCollectorInstance.RegisterUV( m_textureCoordChannel, m_outputPorts[ 0 ].DataType ); - } - string currPropertyName = GetValidPropertyName(); - if( !string.IsNullOrEmpty( portProperty ) && portProperty != "0.0" ) - { - currPropertyName = portProperty; - } - if( !string.IsNullOrEmpty( currPropertyName ) ) - { - string finalTexCoordName = "uv" + m_textureCoordChannel + currPropertyName; - string dummyPropertyTexcoords = currPropertyName + "_ST"; - - if( m_texCoordsHelper == null ) - { - m_texCoordsHelper = CreateInstance<Vector4Node>(); - m_texCoordsHelper.ContainerGraph = ContainerGraph; - m_texCoordsHelper.SetBaseUniqueId( UniqueId, true ); - m_texCoordsHelper.RegisterPropertyOnInstancing = false; - m_texCoordsHelper.AddGlobalToSRPBatcher = true; - } - - if( UIUtils.CurrentWindow.OutsideGraph.IsInstancedShader ) - { - m_texCoordsHelper.CurrentParameterType = PropertyType.InstancedProperty; - } - else - { - m_texCoordsHelper.CurrentParameterType = PropertyType.Global; - } - m_texCoordsHelper.ResetOutputLocals(); - m_texCoordsHelper.SetRawPropertyName( dummyPropertyTexcoords ); - dummyPropertyTexcoords = m_texCoordsHelper.GenerateShaderForOutput( 0, ref dataCollector, false ); - - if( m_texcoordSize > 2 ) - { - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, m_outputPorts[ 0 ].DataType, finalTexCoordName, uvName ); - dataCollector.AddLocalVariable( UniqueId, finalTexCoordName + ".xy", string.Format( Constants.TilingOffsetFormat, uvName + ".xy", dummyPropertyTexcoords + ".xy", dummyPropertyTexcoords + ".zw" ) + ";" ); - m_outputPorts[ 0 ].SetLocalValue( finalTexCoordName, dataCollector.PortCategory ); - } - else - { - RegisterLocalVariable( 0, string.Format( Constants.TilingOffsetFormat, uvName, dummyPropertyTexcoords + ".xy", dummyPropertyTexcoords + ".zw" ), ref dataCollector, finalTexCoordName ); - } - //RegisterLocalVariable( 0, string.Format( Constants.TilingOffsetFormat, uvName, dummyPropertyTexcoords+".xy", dummyPropertyTexcoords+".zw" ), ref dataCollector, finalTexCoordName ); - } - else - { - string finalTexCoordName = "uv" + m_textureCoordChannel + OutputId; - tiling = m_tilingPort.GeneratePortInstructions( ref dataCollector ); - offset = m_offsetPort.GeneratePortInstructions( ref dataCollector ); - - if( m_texcoordSize > 2 ) - { - dataCollector.AddLocalVariable( UniqueId, CurrentPrecisionType, m_outputPorts[ 0 ].DataType, finalTexCoordName, uvName ); - dataCollector.AddLocalVariable( UniqueId, finalTexCoordName + ".xy", string.Format( Constants.TilingOffsetFormat, uvName + ".xy", tiling, offset ) + ";" ); - m_outputPorts[ 0 ].SetLocalValue( finalTexCoordName, dataCollector.PortCategory ); - } - else - { - RegisterLocalVariable( 0, string.Format( Constants.TilingOffsetFormat, uvName, tiling, offset ), ref dataCollector, finalTexCoordName ); - } - //RegisterLocalVariable( 0, string.Format( Constants.TilingOffsetFormat, uvName, tiling, offset ), ref dataCollector, finalTexCoordName ); - } - return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); - } - - //SURFACE - string propertyName = GetValidPropertyName(); - if( !string.IsNullOrEmpty( portProperty ) && portProperty != "0.0" ) - { - propertyName = portProperty; - } - - if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) - return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); - - if( !m_tilingPort.IsConnected && m_tilingPort.Vector2InternalData == Vector2.one ) - tiling = null; - else - tiling = m_tilingPort.GeneratePortInstructions( ref dataCollector ); - - if( !m_offsetPort.IsConnected && m_offsetPort.Vector2InternalData == Vector2.zero ) - offset = null; - else - offset = m_offsetPort.GeneratePortInstructions( ref dataCollector ); - - if( !string.IsNullOrEmpty( propertyName ) /*m_referenceArrayId > -1*/ ) - { - m_surfaceTexcoordName = GeneratorUtils.GenerateAutoUVs( ref dataCollector, UniqueId, m_textureCoordChannel, propertyName, m_outputPorts[ 0 ].DataType, tiling, offset, OutputId ); - } - else - { - m_surfaceTexcoordName = GeneratorUtils.GenerateAutoUVs( ref dataCollector, UniqueId, m_textureCoordChannel, null, m_outputPorts[ 0 ].DataType, tiling, offset, OutputId ); - } - - m_outputPorts[ 0 ].SetLocalValue( m_surfaceTexcoordName, dataCollector.PortCategory ); - return GetOutputVectorItem( 0, outputId, m_outputPorts[ 0 ].LocalValue( dataCollector.PortCategory ) ); - } - - public override void ReadInputDataFromString( ref string[] nodeParams ) - { - if( UIUtils.CurrentShaderVersion() > 7003 ) - { - base.ReadInputDataFromString( ref nodeParams ); - } - else - { - for( int i = 0; i < 2 && i < nodeParams.Length && m_currentReadParamIdx < nodeParams.Length; i++ ) - { - if( UIUtils.CurrentShaderVersion() < 5003 ) - { - int newId = VersionConvertInputPortId( i ) + 1; - if( UIUtils.CurrentShaderVersion() > 23 ) - { - m_inputPorts[ newId ].DataType = (WirePortDataType)Enum.Parse( typeof( WirePortDataType ), nodeParams[ m_currentReadParamIdx++ ] ); - } - - m_inputPorts[ newId ].InternalData = nodeParams[ m_currentReadParamIdx++ ]; - if( m_inputPorts[ newId ].IsEditable && UIUtils.CurrentShaderVersion() >= 3100 && m_currentReadParamIdx < nodeParams.Length ) - { - m_inputPorts[ newId ].Name = nodeParams[ m_currentReadParamIdx++ ]; - } - } - else - { - int portId = Convert.ToInt32( nodeParams[ m_currentReadParamIdx++ ] ); - WirePortDataType DataType = (WirePortDataType)Enum.Parse( typeof( WirePortDataType ), nodeParams[ m_currentReadParamIdx++ ] ); - string InternalData = nodeParams[ m_currentReadParamIdx++ ]; - bool isEditable = Convert.ToBoolean( nodeParams[ m_currentReadParamIdx++ ] ); - string Name = string.Empty; - if( isEditable && m_currentReadParamIdx < nodeParams.Length ) - { - Name = nodeParams[ m_currentReadParamIdx++ ]; - } - - InputPort inputPort = GetInputPortByUniqueId( portId ); - if( inputPort != null ) - { - inputPort.DataType = DataType; - inputPort.InternalData = InternalData; - if( !string.IsNullOrEmpty( Name ) ) - { - inputPort.Name = Name; - } - } - } - } - } - } - - public override void Destroy() - { - base.Destroy(); - m_referenceNode = null; - - if( m_texCoordsHelper != null ) - { - //Not calling m_texCoordsHelper.Destroy() on purpose so UIUtils does not incorrectly unregister stuff - DestroyImmediate( m_texCoordsHelper ); - m_texCoordsHelper = null; - } - } - - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TextureCoordinatesNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TextureCoordinatesNode.cs.meta deleted file mode 100644 index be9e1184..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TextureCoordinatesNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 872b1da17041cd64482c826cbfd9c8c6 -timeCreated: 1481126957 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TexturePropertyNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TexturePropertyNode.cs deleted file mode 100644 index 6f3e1016..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TexturePropertyNode.cs +++ /dev/null @@ -1,1175 +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 -{ - public enum TexturePropertyValues - { - white, - black, - gray, - bump - } - - public enum TextureType - { - Texture1D, - Texture2D, - Texture3D, - Cube, - Texture2DArray, - ProceduralTexture - } - - public enum AutoCastType - { - Auto = 0, - LockedToTexture1D, - LockedToTexture2D, - LockedToTexture3D, - LockedToCube, - LockedToTexture2DArray - } - - - [Serializable] - [NodeAttributes( "Texture Object", "Textures", "Represents a Texture Asset. Can be used in samplers <b>Tex</b> inputs or shader function inputs to reuse the same texture multiple times.", SortOrderPriority = 1 )] - public class TexturePropertyNode : PropertyNode - { - private const string ObjectSelectorCmdStr = "ObjectSelectorClosed"; - - protected readonly string[] AvailablePropertyTypeLabels = { PropertyType.Property.ToString(), PropertyType.Global.ToString() }; - protected readonly int[] AvailablePropertyTypeValues = { (int)PropertyType.Property, (int)PropertyType.Global }; - - protected const int OriginalFontSizeUpper = 9; - protected const int OriginalFontSizeLower = 9; - - protected const string DefaultTextureStr = "Default Texture"; - protected const string AutoCastModeStr = "Auto-Cast Mode"; - - protected const string AutoUnpackNormalsStr = "Normal"; - - [SerializeField] - protected Texture m_defaultValue; - - [SerializeField] - protected Texture m_materialValue; - - [SerializeField] - protected TexturePropertyValues m_defaultTextureValue; - - [SerializeField] - protected bool m_isNormalMap; - - [SerializeField] - protected System.Type m_textureType = typeof( Texture2D ); - - [SerializeField] - protected int m_useSamplerArrayIdx = -1; - - //[SerializeField] - //protected bool m_isTextureFetched; - - //[SerializeField] - //protected string m_textureFetchedValue; - - [SerializeField] - protected TextureType m_currentType = TextureType.Texture2D; - - [SerializeField] - protected AutoCastType m_autocastMode = AutoCastType.Auto; - - protected int PreviewSizeX = 128; - protected int PreviewSizeY = 128; - - protected bool m_linearTexture; - - protected TexturePropertyNode m_textureProperty = null; - - protected bool m_drawPicker; - - protected bool m_drawAutocast = true; - - protected int m_cachedSamplerId = -1; - protected int m_cachedSamplerIdArray = -1; - protected int m_cachedSamplerIdCube = -1; - protected int m_cachedSamplerId3D = -1; - protected int m_defaultId = -1; - protected int m_typeId = -1; - - private TextureType m_previousType = TextureType.Texture2D; - private string m_labelText = "None (Texture2D)"; - - protected bool m_isEditingPicker; - - public TexturePropertyNode() : base() { } - public TexturePropertyNode( int uniqueId, float x, float y, float width, float height ) : base( uniqueId, x, y, width, height ) { } - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - GlobalTypeWarningText = string.Format( GlobalTypeWarningText, "Texture" ); - m_defaultTextureValue = TexturePropertyValues.white; - m_insideSize.Set( PreviewSizeX, PreviewSizeY + 5 ); - AddOutputPort( WirePortDataType.SAMPLER2D, "Tex" ); - m_outputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.SAMPLER1D, WirePortDataType.SAMPLER2D, WirePortDataType.SAMPLER3D, WirePortDataType.SAMPLERCUBE, WirePortDataType.OBJECT ); - m_currentParameterType = PropertyType.Property; - m_customPrefix = "Texture "; - m_drawPrecisionUI = false; - m_showVariableMode = true; - m_freeType = false; - m_drawPicker = true; - m_hasLeftDropdown = true; - m_textLabelWidth = 115; - m_longNameSize = 225; - m_availableAttribs.Add( new PropertyAttributes( "No Scale Offset", "[NoScaleOffset]" ) ); - m_availableAttribs.Add( new PropertyAttributes( "Normal", "[Normal]" ) ); - m_availableAttribs.Add( new PropertyAttributes( "Single Line Texture", "[SingleLineTexture]" ) ); - m_showPreview = true; - m_drawPreviewExpander = false; - m_drawPreview = false; - m_drawPreviewMaskButtons = false; - m_previewShaderGUID = "e53988745ec6e034694ee2640cd3d372"; - } - - public override void AfterCommonInit() - { - base.AfterCommonInit(); - m_hasLeftDropdown = true; - } - - protected void SetPreviewTexture( Texture newValue ) - { - if( newValue is Cubemap ) - { - PreviewMaterial.SetInt( m_typeId, 3 ); - - if( m_cachedSamplerIdCube == -1 ) - m_cachedSamplerIdCube = Shader.PropertyToID( "_Cube" ); - - PreviewMaterial.SetTexture( m_cachedSamplerIdCube, newValue as Cubemap ); - } - else if( newValue is Texture2DArray ) - { - PreviewMaterial.SetInt( m_typeId, 4 ); - - if( m_cachedSamplerIdArray == -1 ) - m_cachedSamplerIdArray = Shader.PropertyToID( "_Array" ); - - PreviewMaterial.SetTexture( m_cachedSamplerIdArray, newValue as Texture2DArray ); - } - else if( newValue is Texture3D ) - { - PreviewMaterial.SetInt( m_typeId, 2 ); - - if( m_cachedSamplerId3D == -1 ) - m_cachedSamplerId3D = Shader.PropertyToID( "_Sampler3D" ); - - PreviewMaterial.SetTexture( m_cachedSamplerId3D, newValue as Texture3D ); - } - else - { - PreviewMaterial.SetInt( m_typeId, 1 ); - - if( m_cachedSamplerId == -1 ) - m_cachedSamplerId = Shader.PropertyToID( "_Sampler" ); - - PreviewMaterial.SetTexture( m_cachedSamplerId, newValue ); - } - } - - public override void SetPreviewInputs() - { - base.SetPreviewInputs(); - - if( Value == null ) - { - if( m_defaultId == -1 ) - m_defaultId = Shader.PropertyToID( "_Default" ); - - PreviewMaterial.SetInt( m_defaultId, ( (int)m_defaultTextureValue ) + 1 ); - m_previewMaterialPassId = 0; - } - else - { - if( m_defaultId == -1 ) - m_defaultId = Shader.PropertyToID( "_Default" ); - - PreviewMaterial.SetInt( m_defaultId, 0 ); - - if( m_typeId == -1 ) - m_typeId = Shader.PropertyToID( "_Type" ); - - m_previewMaterialPassId = 1; - SetPreviewTexture( Value ); - //if( Value is Cubemap ) - //{ - // PreviewMaterial.SetInt( m_typeId, 3 ); - - // if( m_cachedSamplerIdCube == -1 ) - // m_cachedSamplerIdCube = Shader.PropertyToID( "_Cube" ); - - // PreviewMaterial.SetTexture( m_cachedSamplerIdCube, Value as Cubemap ); - //} - //else if( Value is Texture2DArray ) - //{ - // PreviewMaterial.SetInt( m_typeId, 4 ); - - // if( m_cachedSamplerIdArray == -1 ) - // m_cachedSamplerIdArray = Shader.PropertyToID( "_Array" ); - - // PreviewMaterial.SetTexture( m_cachedSamplerIdArray, Value as Texture2DArray ); - //} - //else if( Value is Texture3D ) - //{ - // PreviewMaterial.SetInt( m_typeId, 2 ); - - // if( m_cachedSamplerId3D == -1 ) - // m_cachedSamplerId3D = Shader.PropertyToID( "_Sampler3D" ); - - // PreviewMaterial.SetTexture( m_cachedSamplerId3D, Value as Texture3D ); - //} - //else - //{ - // PreviewMaterial.SetInt( m_typeId, 1 ); - - // if( m_cachedSamplerId == -1 ) - // m_cachedSamplerId = Shader.PropertyToID( "_Sampler" ); - - // PreviewMaterial.SetTexture( m_cachedSamplerId, Value ); - //} - } - } - - protected override void OnUniqueIDAssigned() - { - base.OnUniqueIDAssigned(); - m_textureProperty = this; - UIUtils.RegisterPropertyNode( this ); - UIUtils.RegisterTexturePropertyNode( this ); - } - - protected void ConfigTextureData( TextureType type ) - { - switch( m_autocastMode ) - { - case AutoCastType.Auto: - { - m_currentType = type; - } - break; - case AutoCastType.LockedToTexture1D: - { - m_currentType = TextureType.Texture1D; - } - break; - case AutoCastType.LockedToTexture2DArray: - { - m_currentType = TextureType.Texture2DArray; - } - break; - case AutoCastType.LockedToTexture2D: - { - m_currentType = TextureType.Texture2D; - } - break; - case AutoCastType.LockedToTexture3D: - { - m_currentType = TextureType.Texture3D; - } - break; - case AutoCastType.LockedToCube: - { - m_currentType = TextureType.Cube; - } - break; - } - - ConfigTextureType(); - } - - protected void ConfigTextureType() - { - switch( m_currentType ) - { - case TextureType.Texture1D: - { - m_textureType = typeof( Texture ); - } - break; - case TextureType.Texture2DArray: - { - m_textureType = typeof( Texture2DArray ); - } - break; - case TextureType.Texture2D: - { - m_textureType = typeof( Texture2D ); - } - break; - case TextureType.Texture3D: - { - m_textureType = typeof( Texture3D ); - } - break; - case TextureType.Cube: - { - m_textureType = typeof( Cubemap ); - } - break; -#if !UNITY_2018_1_OR_NEWER - // Disabling Substance Deprecated warning -#pragma warning disable 0618 - case TextureType.ProceduralTexture: - { - m_textureType = typeof( ProceduralTexture ); - } - break; -#pragma warning restore 0618 -#endif - - } - } - - protected void DrawTexturePropertyType() - { - PropertyType parameterType = (PropertyType)EditorGUILayoutIntPopup( ParameterTypeStr, (int)m_currentParameterType, AvailablePropertyTypeLabels, AvailablePropertyTypeValues ); - if( parameterType != m_currentParameterType ) - { - ChangeParameterType( parameterType ); - } - } - - // Texture1D - public string GetTexture1DPropertyValue() - { - return PropertyName + "(\"" + m_propertyInspectorName + "\", 2D) = \"" + m_defaultTextureValue + "\" {}"; - } - - public string GetTexture1DUniformValue() - { - return "uniform sampler1D " + PropertyName + ";"; - } - - // Texture2D - public string GetTexture2DPropertyValue() - { - return PropertyName + "(\"" + m_propertyInspectorName + "\", 2D) = \"" + m_defaultTextureValue + "\" {}"; - } - - public string GetTexture2DUniformValue() - { - ParentGraph outsideGraph = UIUtils.CurrentWindow.OutsideGraph; - if( outsideGraph.SamplingThroughMacros ) - { - if( outsideGraph.IsSRP ) - { - if( m_useSamplerArrayIdx == 0 ) - return string.Format( Constants.TexDeclarationSRPMacros[ TextureType.Texture2D ], PropertyName ); - else - return string.Format( Constants.TexDeclarationNoSamplerSRPMacros[ TextureType.Texture2D ], PropertyName ); - } - else - { - if( m_useSamplerArrayIdx == 0 ) - return string.Format( Constants.TexDeclarationStandardMacros[ TextureType.Texture2D ], PropertyName ); - else - return string.Format( Constants.TexDeclarationNoSamplerStandardMacros[ TextureType.Texture2D ], PropertyName ); - } - - } - - if( PropertyName == "_CameraDepthTexture" ) - return Constants.CameraDepthTextureValue; - else - return "uniform sampler2D " + PropertyName + ";"; - } - - //Texture3D - public string GetTexture3DPropertyValue() - { - return PropertyName + "(\"" + m_propertyInspectorName + "\", 3D) = \"" + m_defaultTextureValue + "\" {}"; - } - - public string GetTexture3DUniformValue() - { - ParentGraph outsideGraph = UIUtils.CurrentWindow.OutsideGraph; - if( outsideGraph.SamplingThroughMacros ) - { - if( outsideGraph.IsSRP ) - { - if( m_useSamplerArrayIdx == 0 ) - return string.Format( Constants.TexDeclarationSRPMacros[ TextureType.Texture3D ], PropertyName ); - else - return string.Format( Constants.TexDeclarationNoSamplerSRPMacros[ TextureType.Texture3D ], PropertyName ); - } - else - { - if( m_useSamplerArrayIdx == 0 ) - return string.Format( Constants.TexDeclarationStandardMacros[ TextureType.Texture3D ], PropertyName ); - else - return string.Format( Constants.TexDeclarationNoSamplerStandardMacros[ TextureType.Texture3D ], PropertyName ); - } - } - return "uniform sampler3D " + PropertyName + ";"; - } - - // Cube - public string GetCubePropertyValue() - { - return PropertyName + "(\"" + m_propertyInspectorName + "\", CUBE) = \"" + m_defaultTextureValue + "\" {}"; - } - - public string GetCubeUniformValue() - { - ParentGraph outsideGraph = UIUtils.CurrentWindow.OutsideGraph; - if( outsideGraph.SamplingThroughMacros ) - { - if( outsideGraph.IsSRP ) - { - if( m_useSamplerArrayIdx == 0 ) - return string.Format( Constants.TexDeclarationSRPMacros[ TextureType.Cube ], PropertyName ); - else - return string.Format( Constants.TexDeclarationNoSamplerSRPMacros[ TextureType.Cube ], PropertyName ); - } - else - { - if( m_useSamplerArrayIdx == 0 ) - return string.Format( Constants.TexDeclarationStandardMacros[ TextureType.Cube ], PropertyName ); - else - return string.Format( Constants.TexDeclarationNoSamplerStandardMacros[ TextureType.Cube ], PropertyName ); - } - } - - return "uniform samplerCUBE " + PropertyName + ";"; - } - - // Texture2DArray - public string GetTexture2DArrayPropertyValue() - { - return PropertyName + "(\"" + m_propertyInspectorName + "\", 2DArray) = \"" + m_defaultTextureValue + "\" {}"; - } - - public string GetTexture2DArrayUniformValue() - { - ParentGraph outsideGraph = UIUtils.CurrentWindow.OutsideGraph; - if( outsideGraph.SamplingThroughMacros ) - { - if( outsideGraph.IsSRP ) - { - if( m_useSamplerArrayIdx == 0 ) - return string.Format( Constants.TexDeclarationSRPMacros[ TextureType.Texture2DArray ], PropertyName ); - else - return string.Format( Constants.TexDeclarationNoSamplerSRPMacros[ TextureType.Texture2DArray ], PropertyName ); - } - else - { - if( m_useSamplerArrayIdx == 0 ) - return string.Format( Constants.TexDeclarationStandardMacros[ TextureType.Texture2DArray ], PropertyName ); - else - return string.Format( Constants.TexDeclarationNoSamplerStandardMacros[ TextureType.Texture2DArray ], PropertyName ); - } - } - - return "uniform TEXTURE2D_ARRAY( " + PropertyName + " );" + "\nuniform SAMPLER( sampler" + PropertyName + " );"; - } - - public override void DrawMainPropertyBlock() - { - DrawTexturePropertyType(); - base.DrawMainPropertyBlock(); - } - - public override void DrawSubProperties() - { - ShowDefaults(); - - - EditorGUI.BeginChangeCheck(); - Type currType = ( m_autocastMode == AutoCastType.Auto ) ? typeof( Texture ) : m_textureType; - m_defaultValue = EditorGUILayoutObjectField( Constants.DefaultValueLabel, m_defaultValue, currType, false ) as Texture; - if( EditorGUI.EndChangeCheck() ) - { - CheckTextureImporter( true ); - SetAdditonalTitleText( string.Format( Constants.PropertyValueLabel, GetPropertyValStr() ) ); - } - } - - public override void DrawMaterialProperties() - { - ShowDefaults(); - - EditorGUI.BeginChangeCheck(); - Type currType = ( m_autocastMode == AutoCastType.Auto ) ? typeof( Texture ) : m_textureType; - m_materialValue = EditorGUILayoutObjectField( Constants.MaterialValueLabel, m_materialValue, currType, false ) as Texture; - if( EditorGUI.EndChangeCheck() ) - { - CheckTextureImporter( true ); - SetAdditonalTitleText( string.Format( Constants.PropertyValueLabel, GetPropertyValStr() ) ); - } - } - - new void ShowDefaults() - { - m_defaultTextureValue = (TexturePropertyValues)EditorGUILayoutEnumPopup( DefaultTextureStr, m_defaultTextureValue ); - - if( !m_drawAutocast ) - return; - - AutoCastType newAutoCast = (AutoCastType)EditorGUILayoutEnumPopup( AutoCastModeStr, m_autocastMode ); - if( newAutoCast != m_autocastMode ) - { - m_autocastMode = newAutoCast; - if( m_autocastMode != AutoCastType.Auto ) - { - ConfigTextureData( m_currentType ); - ConfigureInputPorts(); - ConfigureOutputPorts(); - } - } - } - - private void ConfigurePortsFromReference() - { - m_sizeIsDirty = true; - } - - public virtual void ConfigureOutputPorts() - { - switch( m_currentType ) - { - case TextureType.Texture1D: - m_outputPorts[ 0 ].ChangeType( WirePortDataType.SAMPLER1D, false ); - break; - case TextureType.ProceduralTexture: - case TextureType.Texture2D: - m_outputPorts[ 0 ].ChangeType( WirePortDataType.SAMPLER2D, false ); - break; - case TextureType.Texture3D: - m_outputPorts[ 0 ].ChangeType( WirePortDataType.SAMPLER3D, false ); - break; - case TextureType.Cube: - m_outputPorts[ 0 ].ChangeType( WirePortDataType.SAMPLERCUBE, false ); - break; - case TextureType.Texture2DArray: - m_outputPorts[ 0 ].ChangeType( WirePortDataType.SAMPLER2D, false ); - break; - } - - m_sizeIsDirty = true; - } - - public virtual void ConfigureInputPorts() - { - } - - public virtual void AdditionalCheck() - { - } - - public virtual void CheckTextureImporter( bool additionalCheck, bool writeDefault = true ) - { - m_requireMaterialUpdate = true; - Texture texture = m_materialMode ? m_materialValue : m_defaultValue; - TextureImporter importer = AssetImporter.GetAtPath( AssetDatabase.GetAssetPath( texture ) ) as TextureImporter; - if( importer != null ) - { - -#if UNITY_5_5_OR_NEWER - m_isNormalMap = importer.textureType == TextureImporterType.NormalMap; -#else - m_isNormalMap = importer.normalmap; -#endif - if( writeDefault && !UIUtils.IsLoading ) - { - if( m_defaultTextureValue == TexturePropertyValues.bump && !m_isNormalMap ) - m_defaultTextureValue = TexturePropertyValues.white; - else if( m_isNormalMap ) - m_defaultTextureValue = TexturePropertyValues.bump; - } - - if( additionalCheck ) - AdditionalCheck(); - m_linearTexture = !importer.sRGBTexture; - } - - if( ( texture as Texture2DArray ) != null ) - { - ConfigTextureData( TextureType.Texture2DArray ); - } - else if( ( texture as Texture2D ) != null ) - { - ConfigTextureData( TextureType.Texture2D ); - } - else if( ( texture as Texture3D ) != null ) - { - ConfigTextureData( TextureType.Texture3D ); - } - else if( ( texture as Cubemap ) != null ) - { - ConfigTextureData( TextureType.Cube ); - } -#if !UNITY_2018_1_OR_NEWER - // Disabling Substance Deprecated warning -#pragma warning disable 0618 - else if( ( texture as ProceduralTexture ) != null ) - { - ConfigTextureData( TextureType.ProceduralTexture ); - } -#pragma warning restore 0618 -#endif - - ConfigureInputPorts(); - ConfigureOutputPorts(); - } - - public override void OnObjectDropped( UnityEngine.Object obj ) - { - base.OnObjectDropped( obj ); - ConfigFromObject( obj ); - } - - public override void SetupFromCastObject( UnityEngine.Object obj ) - { - base.SetupFromCastObject( obj ); - ConfigFromObject( obj ); - } - - protected void ConfigFromObject( UnityEngine.Object obj, bool writeDefault = true, bool additionalCheck = true ) - { - Texture texture = obj as Texture; - if( texture ) - { - m_materialValue = texture; - m_defaultValue = texture; - CheckTextureImporter( additionalCheck, writeDefault ); - } - } - - - - public override void DrawGUIControls( DrawInfo drawInfo ) - { - base.DrawGUIControls( drawInfo ); - - if( !( drawInfo.CurrentEventType == EventType.MouseDown || drawInfo.CurrentEventType == EventType.MouseUp || drawInfo.CurrentEventType == EventType.ExecuteCommand || drawInfo.CurrentEventType == EventType.DragPerform ) ) - return; - - bool insideBox = m_previewRect.Contains( drawInfo.MousePosition ); - - bool closePicker = false; - if( insideBox ) - { - m_isEditingPicker = true; - } - else if( m_isEditingPicker && !insideBox && drawInfo.CurrentEventType != EventType.ExecuteCommand ) - { - closePicker = true; - } - - if( m_isEditingPicker && drawInfo.CurrentEventType == EventType.ExecuteCommand && - Event.current.commandName.Equals( ObjectSelectorCmdStr ) ) - { - closePicker = true; - } - - if( closePicker ) - { - GUI.FocusControl( null ); - m_isEditingPicker = false; - } - - } - - public override void OnNodeLayout( DrawInfo drawInfo ) - { - base.OnNodeLayout( drawInfo ); - ConfigTextureType(); - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - if( m_dropdownEditing ) - { - PropertyType parameterType = (PropertyType)EditorGUIIntPopup( m_dropdownRect, (int)m_currentParameterType, AvailablePropertyTypeLabels, AvailablePropertyTypeValues, UIUtils.PropertyPopUp ); - if( parameterType != m_currentParameterType ) - { - ChangeParameterType( parameterType ); - DropdownEditing = false; - } - } - - if( m_isEditingPicker && m_drawPicker && m_currentParameterType != PropertyType.Global ) - { - Rect hitRect = m_previewRect; - hitRect.height = 14 * drawInfo.InvertedZoom; - hitRect.y = m_previewRect.yMax - hitRect.height; - hitRect.width = 4 * 14 * drawInfo.InvertedZoom; - - bool restoreMouse = false; - if( Event.current.type == EventType.MouseDown && hitRect.Contains( drawInfo.MousePosition ) ) - { - restoreMouse = true; - Event.current.type = EventType.Ignore; - } - - EditorGUI.BeginChangeCheck(); - m_colorBuffer = GUI.color; - GUI.color = Color.clear; - Type currType = ( m_autocastMode == AutoCastType.Auto ) ? typeof( Texture ) : m_textureType; - if( m_materialMode ) - { - m_materialValue = EditorGUIObjectField( m_previewRect, m_materialValue, currType, false ) as Texture; - } - else - { - m_defaultValue = EditorGUIObjectField( m_previewRect, m_defaultValue, currType, false ) as Texture; - } - GUI.color = m_colorBuffer; - - if( EditorGUI.EndChangeCheck() ) - { - CheckTextureImporter( true ); - SetTitleText( m_propertyInspectorName ); - SetAdditonalTitleText( string.Format( Constants.PropertyValueLabel, GetPropertyValStr() ) ); - ConfigureInputPorts(); - ConfigureOutputPorts(); - BeginDelayedDirtyProperty(); - PreviewIsDirty = true; - } - //else if( drawInfo.CurrentEventType == EventType.ExecuteCommand ) - //{ - // GUI.FocusControl( null ); - // m_isEditingPicker = false; - //} - - if( restoreMouse ) - { - Event.current.type = EventType.MouseDown; - } - - if( ( drawInfo.CurrentEventType == EventType.MouseDown || drawInfo.CurrentEventType == EventType.MouseUp ) ) - DrawPreviewMaskButtonsLayout( drawInfo, m_previewRect ); - } - - if( !m_drawPicker ) - return; - - if( drawInfo.CurrentEventType == EventType.Repaint ) - { - DrawTexturePicker( drawInfo ); - } - } - - - - protected void DrawTexturePicker( DrawInfo drawInfo ) - { - Rect newRect = m_previewRect; - Texture currentValue = m_materialMode ? m_materialValue : m_defaultValue; - - //??? - //m_showPreview = true; - bool showButtons = m_currentParameterType != PropertyType.Global; - - if( currentValue == null ) - GUI.Label( newRect, string.Empty, UIUtils.ObjectFieldThumb ); - else - DrawPreview( drawInfo, m_previewRect ); - - if( ContainerGraph.LodLevel <= ParentGraph.NodeLOD.LOD2 ) - { - Rect butRect = m_previewRect; - butRect.y -= 1; - butRect.x += 1; - - Rect smallButton = newRect; - smallButton.height = 14 * drawInfo.InvertedZoom; - smallButton.y = newRect.yMax - smallButton.height - 2; - smallButton.width = 40 * drawInfo.InvertedZoom; - smallButton.x = newRect.xMax - smallButton.width - 2; - if( currentValue == null ) - { - if( m_previousType != m_currentType ) - { - m_previousType = m_currentType; - m_labelText = "None (" + m_currentType.ToString() + ")"; - } - - GUI.Label( newRect, m_labelText, UIUtils.ObjectFieldThumbOverlay ); - } - else if( showButtons ) - { - DrawPreviewMaskButtonsRepaint( drawInfo, butRect ); - } - - if( showButtons ) - GUI.Label( smallButton, "Select", UIUtils.GetCustomStyle( CustomStyle.SamplerButton ) ); - } - - GUI.Label( newRect, string.Empty, UIUtils.GetCustomStyle( CustomStyle.SamplerFrame ) ); - } - - public string BaseGenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) - { - base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalVar ); - return PropertyName; - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) - { - return BaseGenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalVar ); - } - - public override void UpdateMaterial( Material mat ) - { - base.UpdateMaterial( mat ); - if( UIUtils.IsProperty( m_currentParameterType ) && !InsideShaderFunction ) - { - OnPropertyNameChanged(); - if( mat.HasProperty( PropertyName ) ) - { - mat.SetTexture( PropertyName, m_materialValue ); - } - } - } - - public override void SetMaterialMode( Material mat, bool fetchMaterialValues ) - { - base.SetMaterialMode( mat, fetchMaterialValues ); - if( fetchMaterialValues && m_materialMode && UIUtils.IsProperty( m_currentParameterType ) ) - { - if( mat.HasProperty( PropertyName ) ) - { - m_materialValue = mat.GetTexture( PropertyName ); - CheckTextureImporter( false, false ); - } - } - } - - public override void ForceUpdateFromMaterial( Material material ) - { - if( UIUtils.IsProperty( m_currentParameterType ) && material.HasProperty( PropertyName ) ) - { - m_materialValue = material.GetTexture( PropertyName ); - CheckTextureImporter( false, false ); - PreviewIsDirty = true; - } - } - - public override bool UpdateShaderDefaults( ref Shader shader, ref TextureDefaultsDataColector defaultCol/* ref string metaStr */) - { - if( m_defaultValue != null ) - { - defaultCol.AddValue( PropertyName, m_defaultValue ); - } - - return true; - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - ReadAdditionalData( ref nodeParams ); - if( UIUtils.CurrentShaderVersion() > 17101 ) - { - m_useSamplerArrayIdx = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - } - } - - public virtual void ReadAdditionalData( ref string[] nodeParams ) - { - string defaultTextureGUID = GetCurrentParam( ref nodeParams ); - //m_defaultValue = AssetDatabase.LoadAssetAtPath<Texture>( textureName ); - if( UIUtils.CurrentShaderVersion() > 14101 ) - { - m_defaultValue = AssetDatabase.LoadAssetAtPath<Texture>( AssetDatabase.GUIDToAssetPath( defaultTextureGUID ) ); - string materialTextureGUID = GetCurrentParam( ref nodeParams ); - m_materialValue = AssetDatabase.LoadAssetAtPath<Texture>( AssetDatabase.GUIDToAssetPath( materialTextureGUID ) ); - } - else - { - m_defaultValue = AssetDatabase.LoadAssetAtPath<Texture>( defaultTextureGUID ); - } - - m_isNormalMap = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - m_defaultTextureValue = (TexturePropertyValues)Enum.Parse( typeof( TexturePropertyValues ), GetCurrentParam( ref nodeParams ) ); - m_autocastMode = (AutoCastType)Enum.Parse( typeof( AutoCastType ), GetCurrentParam( ref nodeParams ) ); - if( UIUtils.CurrentShaderVersion() > 15306 ) - { - m_currentType = (TextureType)Enum.Parse( typeof( TextureType ), GetCurrentParam( ref nodeParams ) ); - } - else - { - m_currentType = TextureType.Texture2D; - } - - ConfigTextureData( m_currentType ); - - //ConfigFromObject( m_defaultValue ); - if( m_materialValue == null ) - { - ConfigFromObject( m_defaultValue ); - } - else - { - CheckTextureImporter( true, true ); - } - ConfigureInputPorts(); - ConfigureOutputPorts(); - } - - public override void ReadAdditionalClipboardData( ref string[] nodeParams ) - { - base.ReadAdditionalClipboardData( ref nodeParams ); - string textureName = GetCurrentParam( ref nodeParams ); - m_materialValue = AssetDatabase.LoadAssetAtPath<Texture>( textureName ); - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - WriteAdditionalToString( ref nodeInfo, ref connectionsInfo ); - if( m_useSamplerArrayIdx > 0 ) - { - TexturePropertyNode samplerNode = UIUtils.GetTexturePropertyNode( m_useSamplerArrayIdx - 1 ); - IOUtils.AddFieldValueToString( ref nodeInfo, ( samplerNode != null ? samplerNode.UniqueId : -1 ) ); - } - else - { - IOUtils.AddFieldValueToString( ref nodeInfo, -1 ); - } - } - - public virtual void WriteAdditionalToString( ref string nodeInfo, ref string connectionsInfo ) - { - //IOUtils.AddFieldValueToString( ref nodeInfo, ( m_defaultValue != null ) ? AssetDatabase.GetAssetPath( m_defaultValue ) : Constants.NoStringValue ); - IOUtils.AddFieldValueToString( ref nodeInfo, ( m_defaultValue != null ) ? AssetDatabase.AssetPathToGUID( AssetDatabase.GetAssetPath( m_defaultValue ) ) : Constants.NoStringValue ); - IOUtils.AddFieldValueToString( ref nodeInfo, ( m_materialValue != null ) ? AssetDatabase.AssetPathToGUID( AssetDatabase.GetAssetPath( m_materialValue ) ) : Constants.NoStringValue ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_isNormalMap.ToString() ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_defaultTextureValue ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_autocastMode ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_currentType ); - } - - public override void WriteAdditionalClipboardData( ref string nodeInfo ) - { - base.WriteAdditionalClipboardData( ref nodeInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, ( m_materialValue != null ) ? AssetDatabase.GetAssetPath( m_materialValue ) : Constants.NoStringValue ); - } - - public override void Destroy() - { - base.Destroy(); - m_defaultValue = null; - m_materialValue = null; - m_textureProperty = null; - UIUtils.UnregisterPropertyNode( this ); - UIUtils.UnregisterTexturePropertyNode( this ); - } - - public override string GetPropertyValStr() - { - return m_materialMode ? ( m_materialValue != null ? m_materialValue.name : IOUtils.NO_TEXTURES ) : ( m_defaultValue != null ? m_defaultValue.name : IOUtils.NO_TEXTURES ); - } - - public override string GetPropertyValue() - { - switch( m_currentType ) - { - case TextureType.Texture1D: - { - return PropertyAttributes + GetTexture1DPropertyValue(); - } - case TextureType.ProceduralTexture: - case TextureType.Texture2D: - { - return PropertyAttributes + GetTexture2DPropertyValue(); - } - case TextureType.Texture3D: - { - return PropertyAttributes + GetTexture3DPropertyValue(); - } - case TextureType.Cube: - { - return PropertyAttributes + GetCubePropertyValue(); - } - case TextureType.Texture2DArray: - { - return PropertyAttributes + GetTexture2DArrayPropertyValue(); - } - } - return string.Empty; - } - - public override string GetUniformValue() - { - switch( m_currentType ) - { - case TextureType.Texture1D: - { - return GetTexture1DUniformValue(); - } - case TextureType.ProceduralTexture: - case TextureType.Texture2D: - { - return GetTexture2DUniformValue(); - } - case TextureType.Texture3D: - { - return GetTexture3DUniformValue(); - } - case TextureType.Cube: - { - return GetCubeUniformValue(); - } - case TextureType.Texture2DArray: - { - return GetTexture2DArrayUniformValue(); - } - } - - return string.Empty; - } - - public override bool GetUniformData( out string dataType, out string dataName, ref bool fullValue ) - { - m_excludeUniform = false; - ParentGraph outsideGraph = UIUtils.CurrentWindow.OutsideGraph; - if( outsideGraph.SamplingThroughMacros ) - { - if( outsideGraph.IsSRP ) - { - if( Constants.TexDeclarationSRPMacros.ContainsKey( m_currentType ) ) - { - if( m_useSamplerArrayIdx == 0 ) - dataName = string.Format( Constants.TexDeclarationSRPMacros[ m_currentType ], PropertyName ); - else - dataName = string.Format( Constants.TexDeclarationNoSamplerSRPMacros[ m_currentType ], PropertyName ); - dataType = string.Empty; - fullValue = true; - return true; - } - } - else if( Constants.TexDeclarationStandardMacros.ContainsKey( m_currentType ) ) - { - if( m_useSamplerArrayIdx == 0 ) - dataName = string.Format( Constants.TexDeclarationStandardMacros[ m_currentType ], PropertyName ); - else - dataName = string.Format( Constants.TexDeclarationNoSamplerStandardMacros[ m_currentType ], PropertyName ); - dataType = string.Empty; - fullValue = true; - return true; - } - } - - if( PropertyName == "_CameraDepthTexture" ) - { - m_excludeUniform = true; - dataType = "UNITY_DECLARE_DEPTH_TEXTURE("; - dataName = m_propertyName + " )"; - return true; - } - - if( m_currentType == TextureType.Texture2DArray ) - { - MasterNode masterNode = UIUtils.CurrentWindow.OutsideGraph.CurrentMasterNode; - if( masterNode.CurrentDataCollector.IsTemplate && masterNode.CurrentDataCollector.IsSRP ) - { - dataType = "TEXTURE2D_ARRAY( " + PropertyName + ""; - dataName = ");\nuniform SAMPLER( sampler" + PropertyName + " )"; - return true; - } - dataType = "UNITY_DECLARE_TEX2DARRAY("; - dataName = m_propertyName + " )"; - return true; - } - - - dataType = UIUtils.TextureTypeToCgType( m_currentType ); - dataName = m_propertyName; - return true; - } - - public virtual string CurrentPropertyReference - { - get - { - string propertyName = string.Empty; - propertyName = PropertyName; - return propertyName; - } - } - - public Texture Value - { - get { return m_materialMode ? m_materialValue : m_defaultValue; } - set - { - if( m_materialMode ) - m_materialValue = value; - else - m_defaultValue = value; - } - } - - public Texture MaterialValue - { - get { return m_materialValue; } - set { m_materialValue = value; } - } - - public Texture DefaultValue - { - get { return m_defaultValue; } - set { m_defaultValue = value; } - } - - public void SetInspectorName( string newName ) - { - m_propertyInspectorName = newName; - } - - public void SetPropertyName( string newName ) - { - m_propertyName = newName; - } - - public bool IsValid { get { return m_materialMode ? ( m_materialValue != null ) : ( m_defaultValue != null ); } } - - public virtual bool IsNormalMap { get { return m_isNormalMap; } } - public bool IsLinearTexture { get { return m_linearTexture; } } - - public override void OnPropertyNameChanged() - { - base.OnPropertyNameChanged(); - UIUtils.UpdateTexturePropertyDataNode( UniqueId, PropertyName ); - } - - public override void SetGlobalValue() { Shader.SetGlobalTexture( m_propertyName, m_defaultValue ); } - public override void FetchGlobalValue() { m_materialValue = Shader.GetGlobalTexture( m_propertyName ); } - public override string DataToArray { get { return PropertyName; } } - public TextureType CurrentType { get { return m_currentType; } } - - public bool DrawAutocast - { - get { return m_drawAutocast; } - set { m_drawAutocast = value; } - } - - public TexturePropertyValues DefaultTextureValue - { - get { return m_defaultTextureValue; } - set { m_defaultTextureValue = value; } - } - - public AutoCastType AutocastMode - { - get { return m_autocastMode; } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TexturePropertyNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TexturePropertyNode.cs.meta deleted file mode 100644 index 721cc6df..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TexturePropertyNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: c1210b3dd22dafe418c5a998df2c3443 -timeCreated: 1481126959 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TextureTransformNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TextureTransformNode.cs deleted file mode 100644 index c35e550d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TextureTransformNode.cs +++ /dev/null @@ -1,355 +0,0 @@ -using UnityEngine; -using UnityEditor; -using System; -using System.Collections.Generic; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Texture Transform", "Textures", "Gives access to texture tiling and offset as set on the material inspector" )] - public sealed class TextureTransformNode : ParentNode - { - private readonly string[] Dummy = { string.Empty }; - private const string InstancedLabelStr = "Instanced"; - - [SerializeField] - private bool m_instanced = false; - - [SerializeField] - private int m_referenceSamplerId = -1; - - [SerializeField] - private int m_referenceNodeId = -1; - - [SerializeField] - private TexturePropertyNode m_inputReferenceNode = null; - - private TexturePropertyNode m_referenceNode = null; - - private Vector4Node m_texCoordsHelper; - - private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper(); - - private int m_cachedSamplerId = -1; - private int m_cachedSamplerIdArray = -1; - private int m_cachedSamplerIdCube = -1; - private int m_cachedSamplerId3D = -1; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.SAMPLER2D, false, "Tex" ); - m_inputPorts[ 0 ].CreatePortRestrictions( WirePortDataType.SAMPLER1D, WirePortDataType.SAMPLER2D, WirePortDataType.SAMPLER3D, WirePortDataType.SAMPLERCUBE, WirePortDataType.OBJECT ); - AddOutputPort( WirePortDataType.FLOAT2, "Tiling" ); - AddOutputPort( WirePortDataType.FLOAT2, "Offset" ); - m_textLabelWidth = 80; - m_autoWrapProperties = true; - m_hasLeftDropdown = true; - m_previewShaderGUID = "25ba2903568b00343ae06788994cab54"; - } - - public override void AfterCommonInit() - { - base.AfterCommonInit(); - - if( PaddingTitleLeft == 0 ) - { - PaddingTitleLeft = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; - if( PaddingTitleRight == 0 ) - PaddingTitleRight = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; - } - } - - public override void RenderNodePreview() - { - //Runs at least one time - if( !m_initialized ) - { - // nodes with no preview don't update at all - PreviewIsDirty = false; - return; - } - - if( !PreviewIsDirty ) - return; - - SetPreviewInputs(); - - RenderTexture temp = RenderTexture.active; - - RenderTexture.active = m_outputPorts[ 0 ].OutputPreviewTexture; - PreviewMaterial.SetInt( "_PreviewID", 0 ); - Graphics.Blit( null, m_outputPorts[ 0 ].OutputPreviewTexture, PreviewMaterial, m_previewMaterialPassId ); - - RenderTexture.active = m_outputPorts[ 1 ].OutputPreviewTexture; - PreviewMaterial.SetInt( "_PreviewID", 1 ); - Graphics.Blit( null, m_outputPorts[ 1 ].OutputPreviewTexture, PreviewMaterial, m_previewMaterialPassId ); - RenderTexture.active = temp; - - PreviewIsDirty = m_continuousPreviewRefresh; - - FinishPreviewRender = true; - } - - void SetPreviewTexture( Texture newValue ) - { - if( newValue is Cubemap ) - { - m_previewMaterialPassId = 3; - if( m_cachedSamplerIdCube == -1 ) - m_cachedSamplerIdCube = Shader.PropertyToID( "_Cube" ); - - PreviewMaterial.SetTexture( m_cachedSamplerIdCube, newValue as Cubemap ); - } - else if( newValue is Texture2DArray ) - { - - m_previewMaterialPassId = 2; - if( m_cachedSamplerIdArray == -1 ) - m_cachedSamplerIdArray = Shader.PropertyToID( "_Array" ); - - PreviewMaterial.SetTexture( m_cachedSamplerIdArray, newValue as Texture2DArray ); - } - else if( newValue is Texture3D ) - { - m_previewMaterialPassId = 1; - if( m_cachedSamplerId3D == -1 ) - m_cachedSamplerId3D = Shader.PropertyToID( "_Sampler3D" ); - - PreviewMaterial.SetTexture( m_cachedSamplerId3D, newValue as Texture3D ); - } - else - { - m_previewMaterialPassId = 0; - if( m_cachedSamplerId == -1 ) - m_cachedSamplerId = Shader.PropertyToID( "_Sampler" ); - - PreviewMaterial.SetTexture( m_cachedSamplerId, newValue ); - } - } - - public override void SetPreviewInputs() - { - base.SetPreviewInputs(); - if( m_inputPorts[ 0 ].IsConnected ) - { - SetPreviewTexture( m_inputPorts[ 0 ].InputPreviewTexture( ContainerGraph ) ); - } - else if( m_referenceNode != null ) - { - if( m_referenceNode.Value != null ) - { - SetPreviewTexture( m_referenceNode.Value ); - } - else - { - SetPreviewTexture( m_referenceNode.PreviewTexture ); - } - } - } - - public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) - { - base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); - m_inputReferenceNode = m_inputPorts[ 0 ].GetOutputNodeWhichIsNotRelay() as TexturePropertyNode; - UpdateTitle(); - - } - - - public override void OnInputPortDisconnected( int portId ) - { - base.OnInputPortDisconnected( portId ); - m_inputReferenceNode = null; - UpdateTitle(); - } - - - void UpdateTitle() - { - if( m_inputReferenceNode != null ) - { - m_additionalContent.text = string.Format( Constants.PropertyValueLabel, m_inputReferenceNode.PropertyInspectorName ); - } - else if( m_referenceSamplerId > -1 && m_referenceNode != null ) - { - m_additionalContent.text = string.Format( Constants.PropertyValueLabel, m_referenceNode.PropertyInspectorName ); - } - else - { - m_additionalContent.text = string.Empty; - } - m_sizeIsDirty = true; - } - - public override void DrawProperties() - { - base.DrawProperties(); - bool guiEnabledBuffer = GUI.enabled; - EditorGUI.BeginChangeCheck(); - List<string> arr = new List<string>( UIUtils.TexturePropertyNodeArr() ); - - if( arr != null && arr.Count > 0 ) - { - arr.Insert( 0, "None" ); - GUI.enabled = true && ( !m_inputPorts[ 0 ].IsConnected ); - m_referenceSamplerId = EditorGUILayoutPopup( Constants.AvailableReferenceStr, m_referenceSamplerId + 1, arr.ToArray() ) - 1; - } - else - { - m_referenceSamplerId = -1; - GUI.enabled = false; - EditorGUILayoutPopup( Constants.AvailableReferenceStr, m_referenceSamplerId, Dummy ); - } - - GUI.enabled = guiEnabledBuffer; - if( EditorGUI.EndChangeCheck() ) - { - m_referenceNode = UIUtils.GetTexturePropertyNode( m_referenceSamplerId ); - if( m_referenceNode != null ) - { - m_referenceNodeId = m_referenceNode.UniqueId; - } - else - { - m_referenceNodeId = -1; - m_referenceSamplerId = -1; - } - UpdateTitle(); - } - - m_instanced = EditorGUILayoutToggle( InstancedLabelStr, m_instanced ); - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if( !m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) - { - base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); - string texTransform = string.Empty; - - if( m_inputPorts[ 0 ].IsConnected ) - { - texTransform = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ) + "_ST"; - } - else if( m_referenceNode != null ) - { - m_referenceNode.BaseGenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalvar ); - texTransform = m_referenceNode.PropertyName + "_ST"; - } - else - { - texTransform = "_ST"; - UIUtils.ShowMessage( UniqueId, "Please specify a texture sample on the Texture Transform Size node", MessageSeverity.Warning ); - } - - //bool excludeUniformKeyword = UIUtils.CurrentWindow.OutsideGraph.IsInstancedShader || UIUtils.CurrentWindow.OutsideGraph.IsSRP; - //string uniformRegister = UIUtils.GenerateUniformName( excludeUniformKeyword, WirePortDataType.FLOAT4, texTransform ); - //dataCollector.AddToUniforms( UniqueId, uniformRegister, true ); - if( m_texCoordsHelper == null ) - { - m_texCoordsHelper = CreateInstance<Vector4Node>(); - m_texCoordsHelper.ContainerGraph = ContainerGraph; - m_texCoordsHelper.SetBaseUniqueId( UniqueId, true ); - m_texCoordsHelper.RegisterPropertyOnInstancing = false; - m_texCoordsHelper.AddGlobalToSRPBatcher = true; - } - - if( m_instanced ) - { - m_texCoordsHelper.CurrentParameterType = PropertyType.InstancedProperty; - } - else - { - m_texCoordsHelper.CurrentParameterType = PropertyType.Global; - } - m_texCoordsHelper.ResetOutputLocals(); - m_texCoordsHelper.SetRawPropertyName( texTransform ); - texTransform = m_texCoordsHelper.GenerateShaderForOutput( 0, ref dataCollector, false ); - - m_outputPorts[ 0 ].SetLocalValue( texTransform+ ".xy", dataCollector.PortCategory ); - m_outputPorts[ 1 ].SetLocalValue( texTransform + ".zw", dataCollector.PortCategory ); - } - - return m_outputPorts[ outputId ].LocalValue( dataCollector.PortCategory ); - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - - EditorGUI.BeginChangeCheck(); - { - List<string> arr = new List<string>( UIUtils.TexturePropertyNodeArr() ); - bool guiEnabledBuffer = GUI.enabled; - - if( arr != null && arr.Count > 0 ) - { - arr.Insert( 0, "None" ); - GUI.enabled = true && ( !m_inputPorts[ 0 ].IsConnected ); - m_referenceSamplerId = m_upperLeftWidget.DrawWidget( this, m_referenceSamplerId + 1, arr.ToArray() ) - 1; - } - else - { - m_referenceSamplerId = -1; - GUI.enabled = false; - m_upperLeftWidget.DrawWidget( this, m_referenceSamplerId, Dummy ); - } - GUI.enabled = guiEnabledBuffer; - } - if( EditorGUI.EndChangeCheck() ) - { - m_referenceNode = UIUtils.GetTexturePropertyNode( m_referenceSamplerId ); - if( m_referenceNode != null ) - { - m_referenceNodeId = m_referenceNode.UniqueId; - } - else - { - m_referenceNodeId = -1; - m_referenceSamplerId = -1; - } - UpdateTitle(); - } - } - - public override void RefreshExternalReferences() - { - base.RefreshExternalReferences(); - m_referenceNode = UIUtils.GetNode( m_referenceNodeId ) as TexturePropertyNode; - m_referenceSamplerId = UIUtils.GetTexturePropertyNodeRegisterId( m_referenceNodeId ); - UpdateTitle(); - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - m_referenceNodeId = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - if( UIUtils.CurrentShaderVersion() > 17200 ) - { - m_instanced = 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_referenceNodeId ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_instanced ); - } - - public override void Destroy() - { - base.Destroy(); - m_referenceNode = null; - m_inputReferenceNode = null; - m_upperLeftWidget = null; - if( m_texCoordsHelper != null ) - { - //Not calling m_texCoordsHelper.Destroy() on purpose so UIUtils does not incorrectly unregister stuff - DestroyImmediate( m_texCoordsHelper ); - m_texCoordsHelper = null; - } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TextureTransformNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TextureTransformNode.cs.meta deleted file mode 100644 index be1ce29d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/TextureTransformNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 4f9ca941b3f5014448e530c761a418d9 -timeCreated: 1512045037 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/UnpackScaleNormalNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/UnpackScaleNormalNode.cs deleted file mode 100644 index 364cfcca..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/UnpackScaleNormalNode.cs +++ /dev/null @@ -1,68 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -namespace AmplifyShaderEditor -{ - [NodeAttributes( "Unpack Scale Normal", "Textures", "Applies UnpackNormal/UnpackScaleNormal function" )] - [Serializable] - public class UnpackScaleNormalNode : ParentNode - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT4, false, "Value" ); - AddInputPort( WirePortDataType.FLOAT, false, "Scale" ); - m_inputPorts[ 1 ].FloatInternalData = 1; - AddOutputVectorPorts( WirePortDataType.FLOAT3, "XYZ" ); - m_useInternalPortData = true; - m_previewShaderGUID = "8b0ae05e25d280c45af81ded56f8012e"; - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - string src = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - - - bool isScaledNormal = false; - if ( m_inputPorts[ 1 ].IsConnected ) - { - isScaledNormal = true; - } - else - { - if ( m_inputPorts[ 1 ].FloatInternalData != 1 ) - { - isScaledNormal = true; - } - } - - string normalMapUnpackMode = string.Empty; - string scaleValue = isScaledNormal?m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ):"1.0"; - normalMapUnpackMode = string.Format( TemplateHelperFunctions.CreateUnpackNormalStr( dataCollector, isScaledNormal, scaleValue ), src); - if( isScaledNormal && !( dataCollector.IsTemplate && dataCollector.IsSRP ) ) - { - dataCollector.AddToIncludes( UniqueId, Constants.UnityStandardUtilsLibFuncs ); - } - - int outputUsage = 0; - for ( int i = 0; i < m_outputPorts.Count; i++ ) - { - if ( m_outputPorts[ i ].IsConnected ) - outputUsage += 1; - } - - - if ( outputUsage > 1 ) - { - string varName = "localUnpackNormal" + OutputId; - dataCollector.AddLocalVariable( UniqueId, "float3 " + varName + " = " + normalMapUnpackMode + ";" ); - return GetOutputVectorItem( 0, outputId, varName ); - } - else - { - return GetOutputVectorItem( 0, outputId, normalMapUnpackMode ); - } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/UnpackScaleNormalNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/UnpackScaleNormalNode.cs.meta deleted file mode 100644 index 270e519f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/UnpackScaleNormalNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: ad04713692e9f124e86030d792c3e648 -timeCreated: 1481126958 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/VirtualTextureObject.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/VirtualTextureObject.cs deleted file mode 100644 index 339cdc24..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/VirtualTextureObject.cs +++ /dev/null @@ -1,296 +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 -{ - public enum VirtualPreset - { - Unity_Legacy, - Unity5, - Alloy, - UBER, - Skyshop, - Lux - } - - public enum VirtualChannel - { - Albedo = 0, - Base, - Normal, - Height, - Occlusion, - Displacement, - Specular, - SpecMet, - Material, - } - - [Serializable] - [NodeAttributes( "Virtual Texture Object", "Textures", "Represents a Virtual Texture Asset", SortOrderPriority = 1 )] - public class VirtualTextureObject : TexturePropertyNode - { - protected const string VirtualPresetStr = "Layout Preset"; - protected const string VirtualChannelStr = "Virtual Layer"; - - private const string VirtualTextureObjectInfo = "Can only be used alongside a Texture Sample node by connecting to its Tex Input Port.\n" + - "\nProperty name must match the value set on your Virtual Texture.\n" + - "Default e.g Albedo = _MainTex\n" + - "\nName your node according to the respective channel property in your Virtual Texture. The Albedo must be set to _MainTex ( temporary requirement )."; - private readonly string[] ChannelTypeStr = { - "Albedo - D.RGBA", - "Base - D.RGBA", - "Normal - N.GA", - "Height - N.B", - "Occlusion - N.R", - "Displacement - N.B", - "Specular - S.RGBA", - "Specular|Metallic - S.RGBA", - "Material - S.RGBA",}; - - private readonly string[] Dummy = { string.Empty }; - private string[] m_channelTypeStr; - - [SerializeField] - protected VirtualPreset m_virtualPreset = VirtualPreset.Unity5; - - [SerializeField] - protected VirtualChannel m_virtualChannel = VirtualChannel.Albedo; - - [SerializeField] - private int m_selectedChannelInt = 0; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - ChangeChannels(); - } - - protected override void OnUniqueIDAssigned() - { - base.OnUniqueIDAssigned(); - if ( UniqueId != -1 ) - UIUtils.AddVirtualTextureCount(); - } - - public override void DrawSubProperties() - { - ShowDefaults(); - - base.DrawSubProperties(); - } - - public override void DrawMaterialProperties() - { - ShowDefaults(); - - base.DrawMaterialProperties(); - } - - new void ShowDefaults() - { - EditorGUI.BeginChangeCheck(); - m_virtualPreset = ( VirtualPreset ) EditorGUILayoutEnumPopup( VirtualPresetStr, m_virtualPreset ); - if ( EditorGUI.EndChangeCheck() ) - { - ChangeChannels(); - } - - EditorGUI.BeginChangeCheck(); - m_selectedChannelInt = EditorGUILayoutPopup( VirtualChannelStr, m_selectedChannelInt, m_channelTypeStr ); - if ( EditorGUI.EndChangeCheck() ) - { - m_virtualChannel = GetChannel( m_selectedChannelInt ); - } - } - - public override void DrawProperties() - { - base.DrawProperties(); - EditorGUILayout.HelpBox( VirtualTextureObjectInfo, MessageType.Info ); - } - - private VirtualChannel GetChannel( int popupInt ) - { - int remapInt = 0; - switch ( m_virtualPreset ) - { - case VirtualPreset.Unity_Legacy: - remapInt = popupInt == 0 ? 1 : popupInt == 1 ? 2 : popupInt == 2 ? 4 : popupInt == 3 ? 5 : 0; - break; - default: - case VirtualPreset.Unity5: - case VirtualPreset.UBER: - remapInt = popupInt == 0 ? 0 : popupInt == 1 ? 7 : popupInt == 2 ? 2 : popupInt == 3 ? 3 : popupInt == 4 ? 4 : 0; - break; - case VirtualPreset.Alloy: - remapInt = popupInt == 0 ? 1 : popupInt == 1 ? 2 : popupInt == 2 ? 8 : popupInt == 3 ? 3 : 0; - break; - case VirtualPreset.Skyshop: - case VirtualPreset.Lux: - remapInt = popupInt == 0 ? 1 : popupInt == 1 ? 2 : popupInt == 2 ? 6 : 0; - break; - } - - return ( VirtualChannel ) remapInt; - } - - private void ChangeChannels() - { - m_channelTypeStr = Dummy; - switch ( m_virtualPreset ) - { - case VirtualPreset.Unity_Legacy: - m_channelTypeStr = new string[] { ChannelTypeStr[ 1 ], ChannelTypeStr[ 2 ], ChannelTypeStr[ 4 ], ChannelTypeStr[ 5 ] }; - break; - default: - case VirtualPreset.Unity5: - case VirtualPreset.UBER: - m_channelTypeStr = new string[] { ChannelTypeStr[ 0 ], ChannelTypeStr[ 7 ], ChannelTypeStr[ 2 ], ChannelTypeStr[ 3 ], ChannelTypeStr[ 4 ] }; - break; - case VirtualPreset.Alloy: - m_channelTypeStr = new string[] { ChannelTypeStr[ 1 ], ChannelTypeStr[ 2 ], ChannelTypeStr[ 8 ], ChannelTypeStr[ 3 ] }; - break; - case VirtualPreset.Skyshop: - case VirtualPreset.Lux: - m_channelTypeStr = new string[] { ChannelTypeStr[ 1 ], ChannelTypeStr[ 2 ], ChannelTypeStr[ 6 ] }; - break; - } - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) - { - base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalVar ); - dataCollector.AddToProperties( UniqueId, "[HideInInspector] _VTInfoBlock( \"VT( auto )\", Vector ) = ( 0, 0, 0, 0 )", -1 ); - - return PropertyName; - } - - public override string GetPropertyValue() - { - string propertyValue = string.Empty; - switch ( m_virtualChannel ) - { - default: - case VirtualChannel.Albedo: - case VirtualChannel.Base: - propertyValue = PropertyName + "(\"" + m_propertyInspectorName + "\", 2D) = \"" + m_defaultTextureValue + "\" {}"; - break; - case VirtualChannel.Normal: - propertyValue = PropertyName + "(\"" + m_propertyInspectorName + "\", 2D) = \"" + m_defaultTextureValue + "\" {}"; - break; - case VirtualChannel.SpecMet: - propertyValue = PropertyName + "(\"" + m_propertyInspectorName + "\", 2D) = \"" + m_defaultTextureValue + "\" {}"; - break; - } - return PropertyAttributes + propertyValue; - } - - public override string GetUniformValue() - { - return "uniform sampler2D " + PropertyName + ";"; - } - - public override bool GetUniformData( out string dataType, out string dataName, ref bool fullValue ) - { - dataType = "sampler2D"; - dataName = PropertyName; - return true; - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - string defaultTextureGUID = GetCurrentParam( ref nodeParams ); - //m_defaultValue = AssetDatabase.LoadAssetAtPath<Texture>( textureName ); - if( UIUtils.CurrentShaderVersion() > 14101 ) - { - m_defaultValue = AssetDatabase.LoadAssetAtPath<Texture>( AssetDatabase.GUIDToAssetPath( defaultTextureGUID ) ); - string materialTextureGUID = GetCurrentParam( ref nodeParams ); - m_materialValue = AssetDatabase.LoadAssetAtPath<Texture>( AssetDatabase.GUIDToAssetPath( materialTextureGUID ) ); - } - else - { - m_defaultValue = AssetDatabase.LoadAssetAtPath<Texture>( defaultTextureGUID ); - } - m_isNormalMap = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - m_defaultTextureValue = ( TexturePropertyValues ) Enum.Parse( typeof( TexturePropertyValues ), GetCurrentParam( ref nodeParams ) ); - m_autocastMode = ( AutoCastType ) Enum.Parse( typeof( AutoCastType ), GetCurrentParam( ref nodeParams ) ); - m_virtualPreset = ( VirtualPreset ) Enum.Parse( typeof( VirtualPreset ), GetCurrentParam( ref nodeParams ) ); - m_selectedChannelInt = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - ChangeChannels(); - m_virtualChannel = GetChannel( m_selectedChannelInt ); - - //m_forceNodeUpdate = true; - - //ConfigFromObject( m_defaultValue ); - if( m_materialValue == null ) - { - ConfigFromObject( m_defaultValue ); - } - else - { - CheckTextureImporter( true, true ); - } - ConfigureInputPorts(); - ConfigureOutputPorts(); - } - - public override void ReadAdditionalData( ref string[] nodeParams ) { } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - //IOUtils.AddFieldValueToString( ref nodeInfo, ( m_defaultValue != null ) ? AssetDatabase.GetAssetPath( m_defaultValue ) : Constants.NoStringValue ); - IOUtils.AddFieldValueToString( ref nodeInfo, ( m_defaultValue != null ) ? AssetDatabase.AssetPathToGUID( AssetDatabase.GetAssetPath( m_defaultValue ) ) : Constants.NoStringValue ); - IOUtils.AddFieldValueToString( ref nodeInfo, ( m_materialValue != null ) ? AssetDatabase.AssetPathToGUID( AssetDatabase.GetAssetPath( m_materialValue ) ) : Constants.NoStringValue ); - - IOUtils.AddFieldValueToString( ref nodeInfo, m_isNormalMap.ToString() ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_defaultTextureValue ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_autocastMode ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_virtualPreset ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_selectedChannelInt ); - } - - public override void WriteAdditionalToString( ref string nodeInfo, ref string connectionsInfo ) { } - - //public override string PropertyName - //{ - // get - // { - // string propertyName = string.Empty; - // switch ( m_virtualChannel ) - // { - // default: - // case VirtualChannel.Albedo: - // case VirtualChannel.Base: - // propertyName = "_MainTex"; - // break; - // case VirtualChannel.Normal: - // propertyName = "_BumpMap"; - // break; - // case VirtualChannel.SpecMet: - // propertyName = "_MetallicGlossMap"; - // break; - // case VirtualChannel.Occlusion: - // propertyName = "_OcclusionMap"; - // break; - // } - // return propertyName; - // } - //} - - public override void Destroy() - { - base.Destroy(); - UIUtils.RemoveVirtualTextureCount(); - } - - public override bool IsNormalMap { get { return m_isNormalMap || m_virtualChannel == VirtualChannel.Normal; } } - public VirtualChannel Channel { get { return m_virtualChannel; } } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/VirtualTextureObject.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/VirtualTextureObject.cs.meta deleted file mode 100644 index f2719119..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Textures/VirtualTextureObject.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: bacb12043c5bc504aa49e0a5a9bbc534 -timeCreated: 1481126958 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/UndoParentNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/UndoParentNode.cs deleted file mode 100644 index 4b6dc9af..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/UndoParentNode.cs +++ /dev/null @@ -1,692 +0,0 @@ -using UnityEditor; -using UnityEngine; -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - public class UndoParentNode : ScriptableObject - { - private const string MessageFormat = "Changing value {0} on node {1}"; - - [SerializeField] - protected NodeAttributes m_nodeAttribs; - - [SerializeField] - protected ParentGraph m_containerGraph; - - public void UndoRecordObject( string name ) - { - UIUtils.MarkUndoAction(); - Undo.RegisterCompleteObjectUndo( UIUtils.CurrentWindow, name ); - Undo.RecordObject( this, name ); - } - - public virtual void RecordObject( string Id ) - { - Undo.RecordObject( this, Id ); - } - public virtual void RecordObjectOnDestroy( string Id ) - { - Undo.RecordObject( this, Id ); - } - - public string EditorGUILayoutStringField( string name, string value, params GUILayoutOption[] options ) - { - string newValue = EditorGUILayout.TextField( name, value, options ); - if( !newValue.Equals( value ) ) - { - UndoRecordObject( string.Format( MessageFormat, "EditorGUILayoutStringField", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } - - public string EditorGUILayoutTextField( GUIContent label, string text, params GUILayoutOption[] options ) - { - string newValue = EditorGUILayout.TextField( label, text, options ); - if( !text.Equals( newValue ) ) - { - UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } - - public string EditorGUILayoutTextField( string label, string text, params GUILayoutOption[] options ) - { - string newValue = EditorGUILayout.TextField( label, text, options ); - if( !text.Equals( newValue ) ) - { - UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } - - public Enum EditorGUILayoutEnumPopup( GUIContent label, Enum selected, params GUILayoutOption[] options ) - { - Enum newValue = EditorGUILayout.EnumPopup( label, selected, options ); - if( !newValue.ToString().Equals( selected.ToString() ) ) - { - UndoRecordObject( string.Concat( "Changing value ", label, " on node ", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - //UndoRecordObject(string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } - - public Enum EditorGUILayoutEnumPopup( string label, Enum selected, params GUILayoutOption[] options ) - { - Enum newValue = EditorGUILayout.EnumPopup( label, selected, options ); - if( !newValue.ToString().Equals( selected.ToString() ) ) - { - UndoRecordObject( string.Concat( "Changing value ", label, " on node ", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - //UndoRecordObject(string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } - - public Enum EditorGUILayoutEnumPopup( Enum selected, params GUILayoutOption[] options ) - { - Enum newValue = EditorGUILayout.EnumPopup( selected, options ); - if( !newValue.ToString().Equals( selected.ToString() ) ) - { - UndoRecordObject( string.Concat( "Changing value EditorGUILayoutEnumPopup on node ", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - //UndoRecordObject(string.Format( MessageFormat, "EditorGUILayoutEnumPopup", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } - - public int EditorGUILayoutIntPopup( string label, int selectedValue, string[] displayedOptions, int[] optionValues, params GUILayoutOption[] options ) - { - int newValue = EditorGUILayout.IntPopup( label, selectedValue, displayedOptions, optionValues, options ); - if( newValue != selectedValue ) - { - UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } - - - public int EditorGUILayoutPopup( string label, int selectedIndex, string[] displayedOptions, GUIStyle style, params GUILayoutOption[] options ) - { - int newValue = EditorGUILayout.Popup( label, selectedIndex, displayedOptions, style, options ); - if( newValue != selectedIndex ) - { - UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } - - - public int EditorGUILayoutPopup( GUIContent label, int selectedIndex, GUIContent[] displayedOptions, params GUILayoutOption[] options ) - { - int newValue = EditorGUILayout.Popup( label, selectedIndex, displayedOptions, options ); - if( newValue != selectedIndex ) - { - UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } - - public int EditorGUILayoutPopup( GUIContent label, int selectedIndex, GUIContent[] displayedOptions, GUIStyle style, params GUILayoutOption[] options ) - { - int newValue = EditorGUILayout.Popup( label, selectedIndex, displayedOptions, style, options ); - if( newValue != selectedIndex ) - { - UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } - - public int EditorGUILayoutPopup( int selectedIndex, string[] displayedOptions, params GUILayoutOption[] options ) - { - int newValue = EditorGUILayout.Popup( selectedIndex, displayedOptions, options ); - if( newValue != selectedIndex ) - { - UndoRecordObject( string.Format( MessageFormat, "EditorGUILayoutPopup", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } - - public int EditorGUILayoutPopup( string label, int selectedIndex, string[] displayedOptions, params GUILayoutOption[] options ) - { - int newValue = EditorGUILayout.Popup( label, selectedIndex, displayedOptions, options ); - if( newValue != selectedIndex ) - { - UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } - - public bool EditorGUILayoutToggle( GUIContent label, bool value, params GUILayoutOption[] options ) - { - bool newValue = EditorGUILayout.Toggle( label, value, options ); - if( newValue != value ) - { - UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } - - public bool EditorGUILayoutToggle( string label, bool value, params GUILayoutOption[] options ) - { - bool newValue = EditorGUILayout.Toggle( label, value, options ); - if( newValue != value ) - { - UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } - - public bool EditorGUILayoutToggle( string label, bool value, GUIStyle style, params GUILayoutOption[] options ) - { - bool newValue = EditorGUILayout.Toggle( label, value, style, options ); - if( newValue != value ) - { - UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } - - public int EditorGUILayoutIntField( int value, params GUILayoutOption[] options ) - { - int newValue = EditorGUILayout.IntField( value, options ); - if( newValue != value ) - { - UndoRecordObject( string.Format( MessageFormat, "EditorGUILayoutIntField", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } - - public int EditorGUILayoutIntField( GUIContent label, int value, params GUILayoutOption[] options ) - { - int newValue = EditorGUILayout.IntField( label, value, options ); - if( newValue != value ) - { - UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } - - public int EditorGUILayoutIntField( string label, int value, params GUILayoutOption[] options ) - { - int newValue = EditorGUILayout.IntField( label, value, options ); - if( newValue != value ) - { - UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } - - public float EditorGUILayoutFloatField( GUIContent label, float value, params GUILayoutOption[] options ) - { - float newValue = EditorGUILayout.FloatField( label, value, options ); - if( newValue != value ) - { - UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } - - public float EditorGUILayoutFloatField( string label, float value, params GUILayoutOption[] options ) - { - float newValue = EditorGUILayout.FloatField( label, value, options ); - if( newValue != value ) - { - UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } - - public float EditorGUILayoutRangedFloatField( string label, float value, float min, float max, params GUILayoutOption[] options ) - { - float newValue = Mathf.Clamp( EditorGUILayout.FloatField( label, value, options ), min, max ); - if( newValue != value ) - { - UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } - - public Color EditorGUILayoutColorField( string label, Color value, params GUILayoutOption[] options ) - { - Color newValue = EditorGUILayout.ColorField( label, value, options ); - if( newValue != value ) - { - UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } -#if UNITY_2018_1_OR_NEWER - public Color EditorGUILayoutColorField( GUIContent label, Color value, bool showEyedropper, bool showAlpha, bool hdr, params GUILayoutOption[] options ) - { - Color newValue = EditorGUILayout.ColorField( label, value, showEyedropper, showAlpha, hdr, options ); - if( newValue != value ) - { - UndoRecordObject(string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } -#else - public Color EditorGUILayoutColorField( GUIContent label, Color value, bool showEyedropper, bool showAlpha, bool hdr, ColorPickerHDRConfig hdrConfig, params GUILayoutOption[] options ) - { - Color newValue = EditorGUILayout.ColorField( label, value, showEyedropper, showAlpha, hdr, hdrConfig, options ); - if( newValue != value ) - { - UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } -#endif - public float EditorGUILayoutSlider( string label, float value, float leftValue, float rightValue, params GUILayoutOption[] options ) - { - float newValue = EditorGUILayout.Slider( label, value, leftValue, rightValue, options ); - if( newValue != value ) - { - UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } - - public float EditorGUILayoutSlider( GUIContent label, float value, float leftValue, float rightValue, params GUILayoutOption[] options ) - { - float newValue = EditorGUILayout.Slider( label, value, leftValue, rightValue, options ); - if( newValue != value ) - { - UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } - public UnityEngine.Object EditorGUILayoutObjectField( string label, UnityEngine.Object obj, System.Type objType, bool allowSceneObjects, params GUILayoutOption[] options ) - { - UnityEngine.Object newValue = EditorGUILayout.ObjectField( label, obj, objType, allowSceneObjects, options ); - if( newValue != obj ) - { - UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } - - public Vector2 EditorGUIVector2Field( Rect position, string label, Vector2 value ) - { - Vector2 newValue = EditorGUI.Vector2Field( position, label, value ); - if( newValue != value ) - { - UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } - - - public Vector2 EditorGUILayoutVector2Field( string label, Vector2 value, params GUILayoutOption[] options ) - { - Vector2 newValue = EditorGUILayout.Vector2Field( label, value, options ); - if( newValue != value ) - { - UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } - - public Vector3 EditorGUIVector3Field( Rect position, string label, Vector3 value ) - { - Vector3 newValue = EditorGUI.Vector3Field( position, label, value ); - if( newValue != value ) - { - UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } - - public Vector3 EditorGUILayoutVector3Field( string label, Vector3 value, params GUILayoutOption[] options ) - { - Vector3 newValue = EditorGUILayout.Vector3Field( label, value, options ); - if( newValue != value ) - { - UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } - - public Vector4 EditorGUIVector4Field( Rect position, string label, Vector4 value ) - { - Vector4 newValue = EditorGUI.Vector4Field( position, label, value ); - if( newValue != value ) - { - UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } - - public Vector4 EditorGUILayoutVector4Field( string label, Vector4 value, params GUILayoutOption[] options ) - { - Vector4 newValue = EditorGUILayout.Vector4Field( label, value, options ); - if( newValue != value ) - { - UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } - - public int EditorGUILayoutIntSlider( GUIContent label, int value, int leftValue, int rightValue, params GUILayoutOption[] options ) - { - int newValue = EditorGUILayout.IntSlider( label, value, leftValue, rightValue, options ); - if( newValue != value ) - { - UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } - - public int EditorGUILayoutIntSlider( string label, int value, int leftValue, int rightValue, params GUILayoutOption[] options ) - { - int newValue = EditorGUILayout.IntSlider( label, value, leftValue, rightValue, options ); - if( newValue != value ) - { - UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } - - public bool EditorGUILayoutToggleLeft( string label, bool value, params GUILayoutOption[] options ) - { - bool newValue = EditorGUILayout.ToggleLeft( label, value, options ); - if( newValue != value ) - { - UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } - - public bool EditorGUILayoutToggleLeft( GUIContent label, bool value, params GUILayoutOption[] options ) - { - bool newValue = EditorGUILayout.ToggleLeft( label, value, options ); - if( newValue != value ) - { - UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } - - public string EditorGUILayoutTextArea( string text, GUIStyle style, params GUILayoutOption[] options ) - { - string newValue = EditorGUILayout.TextArea( text, style, options ); - if( !newValue.Equals( text ) ) - { - UndoRecordObject( string.Format( MessageFormat, "EditorGUILayoutTextArea", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } - - public bool EditorGUILayoutFoldout( bool foldout, string content ) - { - bool newValue = EditorGUILayout.Foldout( foldout, content ); - if( newValue != foldout ) - { - UndoRecordObject( string.Format( MessageFormat, "EditorGUILayoutFoldout", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } - - public bool EditorGUIFoldout( Rect position, bool foldout, string content ) - { - bool newValue = EditorGUI.Foldout( position, foldout, content ); - if( newValue != foldout ) - { - UndoRecordObject( string.Format( MessageFormat, "EditorGUIFoldout", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } - - public string EditorGUITextField( Rect position, string label, string text ) - { - string newValue = EditorGUI.TextField( position, label, text ); - if( !newValue.Equals( text ) ) - { - UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } - - public string EditorGUITextField( Rect position, string label, string text, [UnityEngine.Internal.DefaultValue( "EditorStyles.textField" )] GUIStyle style ) - { - string newValue = EditorGUI.TextField( position, label, text, style ); - if( !newValue.Equals( text ) ) - { - UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } -#if UNITY_2018_1_OR_NEWER - public Color EditorGUIColorField( Rect position, GUIContent label, Color value, bool showEyedropper, bool showAlpha, bool hdr ) - { - Color newValue = EditorGUI.ColorField( position, label, value, showEyedropper, showAlpha, hdr ); - if( newValue != value ) - { - UndoRecordObject(string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } -#else - public Color EditorGUIColorField( Rect position, GUIContent label, Color value, bool showEyedropper, bool showAlpha, bool hdr, ColorPickerHDRConfig hdrConfig ) - { - Color newValue = EditorGUI.ColorField( position, label, value, showEyedropper, showAlpha, hdr, hdrConfig ); - if( newValue != value ) - { - UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } -#endif - public Color EditorGUIColorField( Rect position, string label, Color value ) - { - Color newValue = EditorGUI.ColorField( position, label, value ); - if( newValue != value ) - { - UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } - - - public int EditorGUIIntField( Rect position, string label, int value ) - { - int newValue = EditorGUI.IntField( position, label, value ); - if( newValue != value ) - { - UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } - - public int EditorGUIIntField( Rect position, string label, int value, [UnityEngine.Internal.DefaultValue( "EditorStyles.numberField" )] GUIStyle style ) - { - int newValue = EditorGUI.IntField( position, label, value, style ); - if( newValue != value ) - { - UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } - - public float EditorGUIFloatField( Rect position, string label, float value ) - { - float newValue = EditorGUI.FloatField( position, label, value ); - if( newValue != value ) - { - UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } - - public float EditorGUIFloatField( Rect position, string label, float value, [UnityEngine.Internal.DefaultValue( "EditorStyles.numberField" )] GUIStyle style ) - { - float newValue = EditorGUI.FloatField( position, label, value, style ); - if( newValue != value ) - { - UndoRecordObject( string.Format( MessageFormat, label, ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } - - public float EditorGUIFloatField( Rect position, float value, [UnityEngine.Internal.DefaultValue( "EditorStyles.numberField" )] GUIStyle style ) - { - float newValue = EditorGUI.FloatField( position, value, style ); - if( newValue != value ) - { - UndoRecordObject( string.Format( MessageFormat, "EditorGUIFloatField", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } - - public float GUIHorizontalSlider( Rect position, float value, float leftValue, float rightValue, GUIStyle slider, GUIStyle thumb ) - { - float newValue = GUI.HorizontalSlider( position, value, leftValue, rightValue, slider, thumb ); - if( newValue != value ) - { - UndoRecordObject( string.Format( MessageFormat, "GUIHorizontalSlider", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } - - public Enum EditorGUIEnumPopup( Rect position, Enum selected ) - { - Enum newValue = EditorGUI.EnumPopup( position, selected ); - if( !newValue.ToString().Equals( selected.ToString() ) ) - { - UndoRecordObject( string.Concat( "Changing value EditorGUIEnumPopup on node ", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - //UndoRecordObject(string.Format( MessageFormat, "EditorGUIEnumPopup", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } - - public Enum EditorGUIEnumPopup( Rect position, Enum selected, [UnityEngine.Internal.DefaultValue( "EditorStyles.popup" )] GUIStyle style ) - { - Enum newValue = EditorGUI.EnumPopup( position, selected, style ); - if( !newValue.ToString().Equals( selected.ToString() ) ) - { - UndoRecordObject( string.Concat( "Changing value EditorGUIEnumPopup on node ", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - //UndoRecordObject(string.Format( MessageFormat, "EditorGUIEnumPopup", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } - - public int EditorGUIIntPopup( Rect position, int selectedValue, GUIContent[] displayedOptions, int[] optionValues, [UnityEngine.Internal.DefaultValue( "EditorStyles.popup" )] GUIStyle style ) - { - int newValue = EditorGUI.IntPopup( position, selectedValue, displayedOptions, optionValues, style ); - if( newValue != selectedValue ) - { - UndoRecordObject( string.Format( MessageFormat, "EditorGUIIntEnumPopup", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } - - public int EditorGUIPopup( Rect position, string label, int selectedIndex, string[] displayedOptions ) - { - int newValue = EditorGUI.Popup( position, label, selectedIndex, displayedOptions ); - if( newValue != selectedIndex ) - { - UndoRecordObject( string.Format( MessageFormat, "EditorGUIEnumPopup", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } - - public int EditorGUIPopup( Rect position, int selectedIndex, GUIContent[] displayedOptions, [UnityEngine.Internal.DefaultValue( "EditorStyles.popup" )] GUIStyle style ) - { - int newValue = EditorGUI.Popup( position, selectedIndex, displayedOptions, style ); - if( newValue != selectedIndex ) - { - UndoRecordObject( string.Format( MessageFormat, "EditorGUIEnumPopup", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } - - public int EditorGUIPopup( Rect position, int selectedIndex, string[] displayedOptions, [UnityEngine.Internal.DefaultValue( "EditorStyles.popup" )] GUIStyle style ) - { - int newValue = EditorGUI.Popup( position, selectedIndex, displayedOptions, style ); - if( newValue != selectedIndex ) - { - UndoRecordObject( string.Format( MessageFormat, "EditorGUIEnumPopup", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } - - public UnityEngine.Object EditorGUIObjectField( Rect position, UnityEngine.Object obj, System.Type objType, bool allowSceneObjects ) - { - UnityEngine.Object newValue = EditorGUI.ObjectField( position, obj, objType, allowSceneObjects ); - if( newValue != obj ) - { - UndoRecordObject( string.Format( MessageFormat, "EditorGUIObjectField", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } - public int EditorGUIIntPopup( Rect position, int selectedValue, string[] displayedOptions, int[] optionValues, [UnityEngine.Internal.DefaultValue( "EditorStyles.popup" )] GUIStyle style ) - { - int newValue = EditorGUI.IntPopup( position, selectedValue, displayedOptions, optionValues, style ); - if( newValue != selectedValue ) - { - UndoRecordObject( string.Format( MessageFormat, "EditorGUIIntPopup", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } - - public bool EditorGUIToggle( Rect position, bool value ) - { - bool newValue = EditorGUI.Toggle( position, value ); - if( newValue != value ) - { - UndoRecordObject( string.Format( MessageFormat, "EditorGUIToggle", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } - - public bool EditorGUIToggle( Rect position, string text, bool value ) - { - bool newValue = EditorGUI.Toggle( position,text, value ); - if( newValue != value ) - { - UndoRecordObject( string.Format( MessageFormat, "EditorGUIToggle", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } - - public string GUITextField( Rect position, string text, GUIStyle style ) - { - string newValue = GUI.TextField( position, text, style ); - if( !newValue.Equals( text ) ) - { - UndoRecordObject( string.Format( MessageFormat, "GUITextfield", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } - - - public bool GUILayoutToggle( bool value, string text, GUIStyle style, params GUILayoutOption[] options ) - { - bool newValue = GUILayout.Toggle( value, text, style, options ); - if( newValue != value ) - { - UndoRecordObject( string.Format( MessageFormat, "GUILayoutToggle", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return newValue; - } - - public bool GUILayoutButton( string text, GUIStyle style, params GUILayoutOption[] options ) - { - bool value = GUILayout.Button( text, style, options ); - if( value ) - { - UndoRecordObject( string.Format( MessageFormat, "GUILayoutButton", ( ( m_nodeAttribs != null ) ? m_nodeAttribs.Name : GetType().ToString() ) ) ); - } - return value; - } - - /// <summary> - /// It's the graph the node exists in, this is set after node creation and it's not available on CommonInit - /// </summary> - public ParentGraph ContainerGraph - { - get { return m_containerGraph; } - set { m_containerGraph = value; } - } - } -} - diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/UndoParentNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/UndoParentNode.cs.meta deleted file mode 100644 index f320dc17..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/UndoParentNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: bcc69b2f388d45f43a9157ce814b5aae -timeCreated: 1490183752 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex.meta deleted file mode 100644 index 9c22229c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 579ecde4d9d1a0e45a655588b39f457a -folderAsset: yes -timeCreated: 1481126945 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/BillboardNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/BillboardNode.cs deleted file mode 100644 index 0cb8787a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/BillboardNode.cs +++ /dev/null @@ -1,123 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using UnityEngine; -using UnityEditor; -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Billboard", "Miscellaneous", "Calculates new Vertex positions and normals to achieve a billboard effect." )] - public sealed class BillboardNode : ParentNode - { - private const string ErrorMessage = "Billboard node should only be connected to vertex ports."; - private const string WarningMessage = "This node is a bit different from all others as it injects the necessary code into the vertex body and writes directly on the vertex position and normal.\nIt outputs a value of 0 so it can be connected directly to a vertex port.\n[Only if that port is a relative vertex offset]."; - - [SerializeField] - private BillboardType m_billboardType = BillboardType.Cylindrical; - - [SerializeField] - private bool m_rotationIndependent = false; - - private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper(); - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddOutputPort( WirePortDataType.FLOAT3, "Out" ); - m_textLabelWidth = 115; - m_hasLeftDropdown = true; - SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, m_billboardType ) ); - } - - public override void Destroy() - { - base.Destroy(); - m_upperLeftWidget = null; - } - - public override void AfterCommonInit() - { - base.AfterCommonInit(); - - if( PaddingTitleLeft == 0 ) - { - PaddingTitleLeft = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; - if( PaddingTitleRight == 0 ) - PaddingTitleRight = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; - } - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - m_upperLeftWidget.DrawWidget<BillboardType>( ref m_billboardType, this, OnWidgetUpdate ); - } - - private readonly Action<ParentNode> OnWidgetUpdate = ( x ) => - { - x.SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, ( x as BillboardNode ).Type ) ); - }; - - public override void DrawProperties() - { - base.DrawProperties(); - NodeUtils.DrawPropertyGroup( ref m_propertiesFoldout, Constants.ParameterLabelStr, () => - { - EditorGUI.BeginChangeCheck(); - m_billboardType = (BillboardType)EditorGUILayoutEnumPopup( BillboardOpHelper.BillboardTypeStr, m_billboardType ); - if( EditorGUI.EndChangeCheck() ) - { - SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, m_billboardType ) ); - } - m_rotationIndependent = EditorGUILayoutToggle( BillboardOpHelper.BillboardRotIndStr, m_rotationIndependent ); - } ); - EditorGUILayout.HelpBox( WarningMessage, MessageType.Warning ); - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if( dataCollector.IsFragmentCategory ) - { - UIUtils.ShowMessage( UniqueId, ErrorMessage,MessageSeverity.Error ); - return m_outputPorts[0].ErrorValue; - } - if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) - return m_outputPorts[ 0 ].ErrorValue; - - m_outputPorts[ 0 ].SetLocalValue( "0", dataCollector.PortCategory ); - string vertexPosValue = dataCollector.IsTemplate ? dataCollector.TemplateDataCollectorInstance.GetVertexPosition( WirePortDataType.OBJECT, CurrentPrecisionType ) : "v.vertex"; - string vertexNormalValue = dataCollector.IsTemplate ? dataCollector.TemplateDataCollectorInstance.GetVertexNormal( CurrentPrecisionType ) : "v.normal"; - bool vertexIsFloat3 = false; - if( dataCollector.IsTemplate ) - { - InterpDataHelper info = dataCollector.TemplateDataCollectorInstance.GetInfo( TemplateInfoOnSematics.POSITION ); - if( info != null ) - { - vertexIsFloat3 = info.VarType == WirePortDataType.FLOAT3; - } - } - - BillboardOpHelper.FillDataCollector( ref dataCollector, m_billboardType, m_rotationIndependent, vertexPosValue, vertexNormalValue, vertexIsFloat3 ); - - return "0"; - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - m_billboardType = (BillboardType)Enum.Parse( typeof( BillboardType ), GetCurrentParam( ref nodeParams ) ); - m_rotationIndependent = 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_billboardType ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_rotationIndependent ); - SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, m_billboardType ) ); - } - - public BillboardType Type { get { return m_billboardType; } } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/BillboardNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/BillboardNode.cs.meta deleted file mode 100644 index 7b2c540b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/BillboardNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 08fd3dd8f623aca42b7eb9962a89753d -timeCreated: 1501161489 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/BitangentVertexDataNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/BitangentVertexDataNode.cs deleted file mode 100644 index 828a4993..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/BitangentVertexDataNode.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -namespace AmplifyShaderEditor -{ - [System.Serializable] - [NodeAttributes( "Vertex Bitangent", "Vertex Data", "Calculated bitangent vector in object space, can be used in both local vertex offset and fragment outputs. Already has tangent sign and object transform into account" )] - public sealed class BitangentVertexDataNode : ParentNode - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddOutputVectorPorts( WirePortDataType.FLOAT3, "XYZ" ); - m_drawPreviewAsSphere = true; - m_previewShaderGUID = "76873532ab67d2947beaf07151383cbe"; - } - - public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) - { - base.PropagateNodeData( nodeData, ref dataCollector ); - dataCollector.DirtyNormal = true; - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) - { - if ( dataCollector.PortCategory == MasterNodePortCategory.Fragment || dataCollector.PortCategory == MasterNodePortCategory.Debug ) - { - dataCollector.ForceNormal = true; - dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_NORMAL, CurrentPrecisionType ); - dataCollector.AddToInput( UniqueId, SurfaceInputs.INTERNALDATA, addSemiColon: false ); - } - - string vertexBitangent = GeneratorUtils.GenerateVertexBitangent( ref dataCollector, UniqueId, CurrentPrecisionType ); - return GetOutputVectorItem( 0, outputId, vertexBitangent ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/BitangentVertexDataNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/BitangentVertexDataNode.cs.meta deleted file mode 100644 index 1c5ff97a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/BitangentVertexDataNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 839ecbdfc8ed4fd4d8a08ec07f7159fa -timeCreated: 1481126958 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/ColorVertexDataNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/ColorVertexDataNode.cs deleted file mode 100644 index 0cea1618..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/ColorVertexDataNode.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEngine; -namespace AmplifyShaderEditor -{ - [System.Serializable] - [NodeAttributes( "[VS] Vertex Color", "Vertex Data", "Vertex color. Only works on Vertex Shaders ports ( p.e. Local Vertex Offset Port ).", null,KeyCode.None,true,true,"Vertex Color",typeof(VertexColorNode))] - public sealed class ColorVertexDataNode : VertexDataNode - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_currentVertexData = "color"; - ConvertFromVectorToColorPorts(); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/ColorVertexDataNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/ColorVertexDataNode.cs.meta deleted file mode 100644 index b8990fe9..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/ColorVertexDataNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: ca76669baa9fa204b8ce5200eb07c1db -timeCreated: 1481126959 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/NormalVertexDataNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/NormalVertexDataNode.cs deleted file mode 100644 index b5fc4b5f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/NormalVertexDataNode.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -namespace AmplifyShaderEditor -{ - [System.Serializable] - [NodeAttributes( "Vertex Normal", "Vertex Data", "Vertex normal vector in object space, can be used in both local vertex offset and fragment outputs" )] - public sealed class NormalVertexDataNode : VertexDataNode - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_currentVertexData = "normal"; - ChangeOutputProperties( 0, "XYZ", WirePortDataType.FLOAT3 ); - m_outputPorts[ 4 ].Visible = false; - m_drawPreviewAsSphere = true; - m_previewShaderGUID = "6b24b06c33f9fe84c8a2393f13ab5406"; - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) - { - string vertexNormal = string.Empty; - - if( dataCollector.MasterNodeCategory == AvailableShaderTypes.Template ) - { - vertexNormal = dataCollector.TemplateDataCollectorInstance.GetVertexNormal( CurrentPrecisionType ); - return GetOutputVectorItem( 0, outputId, vertexNormal ); - } - - if( dataCollector.PortCategory == MasterNodePortCategory.Fragment || dataCollector.PortCategory == MasterNodePortCategory.Debug ) - { - dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_NORMAL, CurrentPrecisionType ); - if( dataCollector.DirtyNormal ) - { - dataCollector.AddToInput( UniqueId, SurfaceInputs.INTERNALDATA, addSemiColon: false ); - dataCollector.ForceNormal = true; - } - } - - vertexNormal = GeneratorUtils.GenerateVertexNormal( ref dataCollector, UniqueId, CurrentPrecisionType ); - return GetOutputVectorItem( 0, outputId, vertexNormal ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/NormalVertexDataNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/NormalVertexDataNode.cs.meta deleted file mode 100644 index 62b8c9d6..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/NormalVertexDataNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 4c7b60515f9cf6043bf8d03531d268f9 -timeCreated: 1481126955 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/ObjectScaleNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/ObjectScaleNode.cs deleted file mode 100644 index 6dd1b8d3..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/ObjectScaleNode.cs +++ /dev/null @@ -1,75 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using UnityEngine; -using UnityEditor; -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Object Scale", "Vertex Data", "Object Scale extracted directly from its transform matrix" )] - public class ObjectScaleNode : ParentNode - { - private const string RotationIndependentScaleStr = "Rotation Independent Scale"; - - [SerializeField] - private bool m_rotationIndependentScale = false; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddOutputVectorPorts( WirePortDataType.FLOAT3, "XYZ" ); - m_drawPreviewAsSphere = true; - m_previewShaderGUID = "5540033c6c52f51468938c1a42bd2730"; - m_textLabelWidth = 180; - UpdateMaterialPass(); - m_autoWrapProperties = true; - } - - public override void DrawProperties() - { - base.DrawProperties(); - EditorGUI.BeginChangeCheck(); - m_rotationIndependentScale = EditorGUILayoutToggle( RotationIndependentScaleStr, m_rotationIndependentScale ); - if( EditorGUI.EndChangeCheck() ) - { - UpdateMaterialPass(); - } - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - string objectScale = m_rotationIndependentScale ? GeneratorUtils.GenerateRotationIndependentObjectScale( ref dataCollector, UniqueId ): - GeneratorUtils.GenerateObjectScale( ref dataCollector, UniqueId ); - - return GetOutputVectorItem( 0, outputId, objectScale ); - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - if( UIUtils.CurrentShaderVersion() < 17402 ) - { - m_rotationIndependentScale = false; - } - else - { - m_rotationIndependentScale = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - } - UpdateMaterialPass(); - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_rotationIndependentScale ); - } - - void UpdateMaterialPass() - { - m_previewMaterialPassId = m_rotationIndependentScale ? 1 : 0; - PreviewIsDirty = true; - } - - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/ObjectScaleNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/ObjectScaleNode.cs.meta deleted file mode 100644 index 7103bef2..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/ObjectScaleNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: ef1fe46d0cc472e45ad13ac737db2c1e -timeCreated: 1493993914 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/OutlineNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/OutlineNode.cs deleted file mode 100644 index cec8fb39..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/OutlineNode.cs +++ /dev/null @@ -1,366 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; - -using UnityEngine; -using UnityEditor; -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Outline", "Miscellaneous", "Uses vertices to simulate an outline around the object" )] - public sealed class OutlineNode : ParentNode - { - enum OutlineAlphaModes - { - None = 0, - Masked, - Transparent, - AlphaPremultiplied - }; - - private const string CullModePortNameStr = "Cull Mode"; - private const string AlphaModePortNameStr = "Alpha"; - private const string MaskedModePortNamStr = "Opacity Mask"; - private const string OutlineAlphaModeStr = "Alpha Mode"; - private const string OpacityMaskClipValueStr = "Mask Clip Value"; - private const string ErrorMessage = "Outline node should only be connected to vertex ports."; - - [SerializeField] - private bool m_noFog = true; - - [SerializeField] - private string[] AvailableOutlineModes = { "Vertex Offset", "Vertex Scale", "Custom" }; - - [SerializeField] - private int[] AvailableOutlineValues = { 0, 1, 2 }; - - [SerializeField] - private int m_currentSelectedMode = 0; - - [SerializeField] - private OutlineAlphaModes m_currentAlphaMode = OutlineAlphaModes.None; - - private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper(); - - [NonSerialized] - private StandardSurfaceOutputNode m_masterNode = null; - - [SerializeField] - private int m_zTestMode = 0; - - [SerializeField] - private int m_zWriteMode = 0; - - [SerializeField] - private CullMode m_cullMode = CullMode.Front; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - - AddOutputPort( WirePortDataType.FLOAT3, "Out" ); - - AddInputPort( WirePortDataType.FLOAT3, false, "Color", -1, MasterNodePortCategory.Fragment, 0 ); - AddInputPort( WirePortDataType.FLOAT, false, "Alpha", -1, MasterNodePortCategory.Fragment, 2 ); - AddInputPort( WirePortDataType.FLOAT, false, "Width", -1, MasterNodePortCategory.Fragment, 1 ); - GetInputPortByUniqueId( 2 ).Visible = false; - m_textLabelWidth = 115; - m_hasLeftDropdown = true; - SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, AvailableOutlineModes[ m_currentSelectedMode ] ) ); - } - - public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) - { - base.PropagateNodeData( nodeData, ref dataCollector ); - if( GetInputPortByUniqueId( 0 ).IsConnected ) - dataCollector.UsingCustomOutlineColor = true; - - if( GetInputPortByUniqueId( 1 ).IsConnected ) - dataCollector.UsingCustomOutlineWidth = true; - - if( GetInputPortByUniqueId( 2 ).IsConnected ) - dataCollector.UsingCustomOutlineAlpha = true; - - if( !dataCollector.IsTemplate ) - { - UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.ZWriteMode = m_zWriteMode; - UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.OffsetMode = m_currentSelectedMode; - } - } - - public override void AfterCommonInit() - { - base.AfterCommonInit(); - - if( PaddingTitleLeft == 0 ) - { - PaddingTitleLeft = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; - if( PaddingTitleRight == 0 ) - PaddingTitleRight = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; - } - } - - public override void Destroy() - { - base.Destroy(); - m_upperLeftWidget = null; - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - EditorGUI.BeginChangeCheck(); - m_currentSelectedMode = m_upperLeftWidget.DrawWidget( this, m_currentSelectedMode, AvailableOutlineModes ); - if( EditorGUI.EndChangeCheck() ) - { - SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, AvailableOutlineModes[ m_currentSelectedMode ] ) ); - UpdatePorts(); - } - } - - void CheckAlphaPortVisibility() - { - InputPort alphaPort = GetInputPortByUniqueId( 2 ); - if( m_currentAlphaMode != OutlineAlphaModes.None ) - { - if( !alphaPort.Visible ) - alphaPort.Visible = true; - - if( m_currentAlphaMode == OutlineAlphaModes.Masked ) - { - GetInputPortByUniqueId( 2 ).Name = MaskedModePortNamStr; - } - else - { - GetInputPortByUniqueId( 2 ).Name = AlphaModePortNameStr; - } - m_sizeIsDirty = true; - } - - if( m_currentAlphaMode == OutlineAlphaModes.None && alphaPort.Visible ) - { - alphaPort.Visible = false; - m_sizeIsDirty = true; - } - } - - public override void DrawProperties() - { - base.DrawProperties(); - NodeUtils.DrawPropertyGroup( ref m_propertiesFoldout, Constants.ParameterLabelStr, () => - { - EditorGUI.BeginChangeCheck(); - m_currentSelectedMode = EditorGUILayoutIntPopup( "Type", m_currentSelectedMode, AvailableOutlineModes, AvailableOutlineValues ); - if( EditorGUI.EndChangeCheck() ) - { - SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, AvailableOutlineModes[ m_currentSelectedMode ] ) ); - UpdatePorts(); - } - - EditorGUI.BeginChangeCheck(); - m_currentAlphaMode = (OutlineAlphaModes)EditorGUILayoutEnumPopup( OutlineAlphaModeStr, m_currentAlphaMode ); - if( EditorGUI.EndChangeCheck() ) - { - CheckAlphaPortVisibility(); - } - - if( m_currentAlphaMode == OutlineAlphaModes.Masked ) - { - if( m_masterNode == null ) - { - m_masterNode = UIUtils.CurrentWindow.OutsideGraph.CurrentMasterNode as StandardSurfaceOutputNode; - } - - if( m_masterNode != null ) - { - m_masterNode.ShowOpacityMaskValueUI(); - } - } - - m_cullMode = (CullMode)EditorGUILayoutEnumPopup( CullModePortNameStr, m_cullMode ); - m_zWriteMode = EditorGUILayoutPopup( ZBufferOpHelper.ZWriteModeStr, m_zWriteMode, ZBufferOpHelper.ZWriteModeValues ); - m_zTestMode = EditorGUILayoutPopup( ZBufferOpHelper.ZTestModeStr, m_zTestMode, ZBufferOpHelper.ZTestModeLabels ); - m_noFog = EditorGUILayoutToggle( "No Fog", m_noFog ); - - } ); - } - - void UpdatePorts() - { - if( m_currentSelectedMode == 2 ) //custom mode - { - GetInputPortByUniqueId( 1 ).ChangeProperties( "Offset", WirePortDataType.FLOAT3, false ); - } - else - { - GetInputPortByUniqueId( 1 ).ChangeProperties( "Width", WirePortDataType.FLOAT, false ); - } - - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if( dataCollector.IsTemplate ) - return m_outputPorts[0].ErrorValue; - - if( dataCollector.IsFragmentCategory ) - { - UIUtils.ShowMessage( UniqueId, ErrorMessage ); - return m_outputPorts[ 0 ].ErrorValue; - } - - if( m_outputPorts[ 0 ].IsLocalValue( dataCollector.PortCategory ) ) - return m_outputPorts[ 0 ].ErrorValue; - - m_outputPorts[ 0 ].SetLocalValue( "0", dataCollector.PortCategory ); - - StandardSurfaceOutputNode masterNode = UIUtils.CurrentWindow.OutsideGraph.CurrentMasterNode as StandardSurfaceOutputNode; - - MasterNodeDataCollector outlineDataCollector = new MasterNodeDataCollector(); - outlineDataCollector.IsOutlineDataCollector = true; - outlineDataCollector.DirtyNormal = true; - InputPort colorPort = GetInputPortByUniqueId( 0 ); - InputPort alphaPort = GetInputPortByUniqueId( 2 ); - InputPort vertexPort = GetInputPortByUniqueId( 1 ); - - if( vertexPort.IsConnected ) - { - outlineDataCollector.PortCategory = MasterNodePortCategory.Vertex; - string outlineWidth = vertexPort.GenerateShaderForOutput( ref outlineDataCollector, vertexPort.DataType, true, true ); - outlineDataCollector.AddToVertexLocalVariables( UniqueId, PrecisionType.Float, vertexPort.DataType, "outlineVar", outlineWidth ); - - outlineDataCollector.AddVertexInstruction( outlineDataCollector.SpecialLocalVariables, UniqueId, false ); - outlineDataCollector.ClearSpecialLocalVariables(); - - outlineDataCollector.AddVertexInstruction( outlineDataCollector.VertexLocalVariables, UniqueId, false ); - outlineDataCollector.ClearVertexLocalVariables(); - - // need to check whether this breaks other outputs or not - UIUtils.CurrentWindow.OutsideGraph.ResetNodesLocalVariables(); - } - - outlineDataCollector.PortCategory = MasterNodePortCategory.Fragment; - string outlineColor = colorPort.GeneratePortInstructions( ref outlineDataCollector );// "\to.Emission = " + colorPort.GeneratePortInstructions( ref outlineDataCollector ) + ";"; - string alphaValue = alphaPort.Visible ? alphaPort.GeneratePortInstructions( ref outlineDataCollector ) : string.Empty; - - bool addTabs = outlineDataCollector.DirtySpecialLocalVariables || alphaPort.Available; - outlineDataCollector.AddInstructions( "\t" + outlineDataCollector.SpecialLocalVariables.TrimStart( '\t' ) ); - outlineDataCollector.ClearSpecialLocalVariables(); - outlineDataCollector.AddInstructions( ( addTabs ? "\t\t\t" : "" ) + "o.Emission = " + outlineColor + ";" ); - if( alphaPort.Visible ) - { - if( m_currentAlphaMode == OutlineAlphaModes.Masked ) - { - float maskClipValue = 0.5f; - - if( masterNode != null ) - maskClipValue = masterNode.OpacityMaskClipValue; - - if( masterNode.InlineOpacityMaskClipValue.IsValid ) - { - RangedFloatNode fnode = UIUtils.GetNode( masterNode.InlineOpacityMaskClipValue.NodeId ) as RangedFloatNode; - if( fnode != null ) - { - outlineDataCollector.AddToProperties( fnode.UniqueId, fnode.GetPropertyValue(), fnode.OrderIndex ); - outlineDataCollector.AddToUniforms( fnode.UniqueId, fnode.GetUniformValue() ); - } - else - { - IntNode inode = UIUtils.GetNode( masterNode.InlineOpacityMaskClipValue.NodeId ) as IntNode; - outlineDataCollector.AddToProperties( inode.UniqueId, inode.GetPropertyValue(), inode.OrderIndex ); - outlineDataCollector.AddToUniforms( inode.UniqueId, inode.GetUniformValue() ); - } - } - else - { - outlineDataCollector.AddToProperties( -1, string.Format( IOUtils.MaskClipValueProperty, OpacityMaskClipValueStr, maskClipValue ), -1 ); - outlineDataCollector.AddToUniforms( -1, string.Format( IOUtils.MaskClipValueUniform, maskClipValue ) ); - } - - outlineDataCollector.AddInstructions( ( addTabs ? "\n\t\t\t" : "" ) + "clip( " + alphaValue + " - " + masterNode.InlineOpacityMaskClipValue.GetValueOrProperty( IOUtils.MaskClipValueName, false ) + " );" ); - } - else - { - outlineDataCollector.AddInstructions( ( addTabs ? "\n\t\t\t" : "" ) + "o.Alpha = " + alphaValue + ";" ); - } - } - - if( outlineDataCollector.UsingWorldNormal ) - outlineDataCollector.AddInstructions( ( addTabs ? "\n\t\t\t" : "" ) + "o.Normal = float3(0,0,-1);" ); - - if( masterNode != null ) - { - //masterNode.AdditionalIncludes.AddToDataCollector( ref outlineDataCollector ); - //masterNode.AdditionalPragmas.AddToDataCollector( ref outlineDataCollector ); - //masterNode.AdditionalDefines.AddToDataCollector( ref outlineDataCollector ); - masterNode.AdditionalDirectives.AddAllToDataCollector( ref outlineDataCollector ); - } - - UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.InputList = outlineDataCollector.InputList; - UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.Inputs = outlineDataCollector.Inputs; - UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.DirtyInput = outlineDataCollector.DirtyInputs; - UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.Includes = outlineDataCollector.Includes; - UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.Pragmas = outlineDataCollector.Pragmas; - UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.Defines = outlineDataCollector.Defines; - UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.Uniforms = outlineDataCollector.Uniforms; - UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.InstancedProperties = outlineDataCollector.InstancedProperties; - UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.GrabPasses = outlineDataCollector.GrabPass; - UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.UniformList = outlineDataCollector.UniformsList; - UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.InstancedPropertiesList = outlineDataCollector.InstancedPropertiesList; - UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.VertexData = outlineDataCollector.VertexData; - UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.Instructions = outlineDataCollector.Instructions; - UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.Functions = outlineDataCollector.Functions; - UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.LocalFunctions = outlineDataCollector.LocalFunctions; - UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.OutlineCullMode = m_cullMode; - UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.ZTestMode = m_zTestMode; - UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.ZWriteMode = m_zWriteMode; - UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.OffsetMode = m_currentSelectedMode; - UIUtils.CurrentWindow.OutsideGraph.CurrentStandardSurface.OutlineHelper.CustomNoFog = m_noFog; - dataCollector.CustomOutlineSelectedAlpha = (int)m_currentAlphaMode; - - for( int i = 0; i < outlineDataCollector.PropertiesList.Count; i++ ) - { - dataCollector.AddToProperties( UniqueId, outlineDataCollector.PropertiesList[ i ].PropertyName, outlineDataCollector.PropertiesList[ i ].OrderIndex ); - } - - UIUtils.CurrentWindow.OutsideGraph.ResetNodesLocalVariablesIfNot( MasterNodePortCategory.Vertex ); - return "0"; - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - m_currentSelectedMode = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - m_noFog = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - if( UIUtils.CurrentShaderVersion() > 14202 ) - m_currentAlphaMode = (OutlineAlphaModes)Enum.Parse( typeof( OutlineAlphaModes ), GetCurrentParam( ref nodeParams ) ); - - if( UIUtils.CurrentShaderVersion() > 14302 ) - { - m_zWriteMode = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - m_zTestMode = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - } - - if( UIUtils.CurrentShaderVersion() > 15304 ) - { - m_cullMode = (CullMode)Enum.Parse( typeof( CullMode ), GetCurrentParam( ref nodeParams ) ); - } - - SetAdditonalTitleText( string.Format( Constants.SubTitleTypeFormatStr, AvailableOutlineModes[ m_currentSelectedMode ] ) ); - UpdatePorts(); - CheckAlphaPortVisibility(); - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_currentSelectedMode ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_noFog ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_currentAlphaMode ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_zWriteMode ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_zTestMode ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_cullMode ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/OutlineNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/OutlineNode.cs.meta deleted file mode 100644 index 60f49a8e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/OutlineNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 24f267627c002964badad2901309c96a -timeCreated: 1501161489 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/PosVertexDataNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/PosVertexDataNode.cs deleted file mode 100644 index a71ed207..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/PosVertexDataNode.cs +++ /dev/null @@ -1,138 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using UnityEngine; -using UnityEditor; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Vertex Position", "Vertex Data", "Vertex position vector in object space, can be used in both local vertex offset and fragment outputs" )] - public sealed class PosVertexDataNode : VertexDataNode - { - private const string PropertyLabel = "Size"; - private readonly string[] SizeLabels = { "XYZ", "XYZW" }; - - [SerializeField] - private int m_sizeOption = 0; - - private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper(); - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_currentVertexData = "vertex"; - ChangeOutputProperties( 0, "XYZ", WirePortDataType.FLOAT3 ); - m_drawPreviewAsSphere = true; - m_outputPorts[ 4 ].Visible = false; - m_hasLeftDropdown = true; - m_autoWrapProperties = true; - m_previewShaderGUID = "a5c14f759dd021b4b8d4b6eeb85ac227"; - } - - public override void Destroy() - { - base.Destroy(); - m_upperLeftWidget = null; - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - EditorGUI.BeginChangeCheck(); - m_sizeOption = m_upperLeftWidget.DrawWidget( this, m_sizeOption, SizeLabels ); - if( EditorGUI.EndChangeCheck() ) - { - UpdatePorts(); - } - } - - public override void DrawProperties() - { - EditorGUI.BeginChangeCheck(); - m_sizeOption = EditorGUILayoutPopup( PropertyLabel, m_sizeOption, SizeLabels ); - if ( EditorGUI.EndChangeCheck() ) - { - UpdatePorts(); - } - } - - void UpdatePorts() - { - if ( m_sizeOption == 0 ) - { - ChangeOutputProperties( 0, SizeLabels[ 0 ], WirePortDataType.FLOAT3, false ); - m_outputPorts[ 4 ].Visible = false; - } - else - { - ChangeOutputProperties( 0, SizeLabels[ 1 ], WirePortDataType.FLOAT4, false ); - m_outputPorts[ 4 ].Visible = true; - } - } - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) - { - - if ( dataCollector.MasterNodeCategory == AvailableShaderTypes.Template ) - { - string vertexPos = dataCollector.TemplateDataCollectorInstance.GetVertexPosition( ( m_sizeOption == 0 ) ? WirePortDataType.FLOAT3 : WirePortDataType.FLOAT4, CurrentPrecisionType ); - return GetOutputVectorItem( 0, outputId, vertexPos ); - } - - - if ( dataCollector.PortCategory == MasterNodePortCategory.Fragment || dataCollector.PortCategory == MasterNodePortCategory.Debug ) - base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalVar ); - - WirePortDataType sizeType = m_sizeOption == 0 ? WirePortDataType.FLOAT3 : WirePortDataType.FLOAT4; - - string vertexPosition = GeneratorUtils.GenerateVertexPosition( ref dataCollector, UniqueId, sizeType ); - return GetOutputVectorItem( 0, outputId, vertexPosition ); - - //if ( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) - //{ - // string vertexVar = base.GenerateShaderForOutput( 0, ref dataCollector, ignoreLocalVar ); - // if ( outputId != 0 ) - // { - // return GetOutputVectorItem( 0, outputId, vertexVar ); - // } - // else if ( m_sizeOption == 0 ) - // { - // vertexVar += ".xyz"; - // } - - // return vertexVar; - //} - //else - //{ - - // string vertexVar = GeneratorUtils.GenerateVertexPositionOnFrag( ref dataCollector, UniqueId, m_currentPrecisionType ); - // if ( outputId != 0 ) - // { - // return GetOutputVectorItem( 0, outputId, vertexVar ); - // } - // else if ( m_sizeOption == 0 ) - // { - // vertexVar += ".xyz"; - // } - // return GetOutputVectorItem( 0, outputId, vertexVar ); - //} - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - if ( UIUtils.CurrentShaderVersion() > 7101 ) - { - m_sizeOption = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - UpdatePorts(); - } - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_sizeOption ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/PosVertexDataNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/PosVertexDataNode.cs.meta deleted file mode 100644 index 9ff223e8..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/PosVertexDataNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: fc77801277f0faf4ca0be33f565b5604 -timeCreated: 1481126960 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TangentSignVertexDataNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TangentSignVertexDataNode.cs deleted file mode 100644 index f9beb05c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TangentSignVertexDataNode.cs +++ /dev/null @@ -1,23 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -namespace AmplifyShaderEditor -{ - [System.Serializable] - [NodeAttributes( "Vertex Tangent Sign", "Vertex Data", "Vertex tangent sign in object space, return the W value of tangent vector that contains only the sign of the tangent" )] - public sealed class TangentSignVertexDataNode : ParentNode - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddOutputVectorPorts( WirePortDataType.FLOAT, "Sign" ); - m_drawPreviewAsSphere = true; - m_previewShaderGUID = "f5466d126f4bb1f49917eac88b1cb6af"; - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) - { - return GeneratorUtils.GenerateVertexTangentSign( ref dataCollector, UniqueId, CurrentPrecisionType ); ; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TangentSignVertexDataNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TangentSignVertexDataNode.cs.meta deleted file mode 100644 index c07ffb6c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TangentSignVertexDataNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 1f79f23d5c10c9e4fb6a59c1ef70f6fc -timeCreated: 1481126958 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TangentVertexDataNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TangentVertexDataNode.cs deleted file mode 100644 index da6d25ff..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TangentVertexDataNode.cs +++ /dev/null @@ -1,120 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> -using System; -using UnityEditor; -using UnityEngine; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Vertex Tangent", "Vertex Data", "Vertex tangent vector in object space, can be used in both local vertex offset and fragment outputs" )] - public sealed class TangentVertexDataNode : VertexDataNode - { - private const string PropertyLabel = "Size"; - private readonly string[] SizeLabels = { "XYZ", "XYZW" }; - - [SerializeField] - private int m_sizeOption = 0; - - private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper(); - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_currentVertexData = "tangent"; - ChangeOutputProperties( 0, "XYZ", WirePortDataType.FLOAT3 ); - m_outputPorts[ 4 ].Visible = false; - m_drawPreviewAsSphere = true; - m_hasLeftDropdown = true; - m_previewShaderGUID = "0a44bb521d06d6143a4acbc3602037f8"; - } - - public override void Destroy() - { - base.Destroy(); - m_upperLeftWidget = null; - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - EditorGUI.BeginChangeCheck(); - m_sizeOption = m_upperLeftWidget.DrawWidget( this, m_sizeOption, SizeLabels ); - if( EditorGUI.EndChangeCheck() ) - { - UpdatePorts(); - } - } - - public override void DrawProperties() - { - EditorGUI.BeginChangeCheck(); - m_sizeOption = EditorGUILayoutPopup( PropertyLabel, m_sizeOption, SizeLabels ); - if( EditorGUI.EndChangeCheck() ) - { - UpdatePorts(); - } - } - - void UpdatePorts() - { - if( m_sizeOption == 0 ) - { - ChangeOutputProperties( 0, SizeLabels[ 0 ], WirePortDataType.FLOAT3, false ); - m_outputPorts[ 4 ].Visible = false; - } - else - { - ChangeOutputProperties( 0, SizeLabels[ 1 ], WirePortDataType.FLOAT4, false ); - m_outputPorts[ 4 ].Visible = true; - } - } - - public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) - { - base.PropagateNodeData( nodeData, ref dataCollector ); - dataCollector.DirtyNormal = true; - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) - { - string vertexTangent = string.Empty; - if ( dataCollector.MasterNodeCategory == AvailableShaderTypes.Template ) - { - vertexTangent = dataCollector.TemplateDataCollectorInstance.GetVertexTangent( WirePortDataType.FLOAT4, CurrentPrecisionType ); - if( m_sizeOption == 0 ) - vertexTangent += ".xyz"; - - return GetOutputVectorItem( 0, outputId, vertexTangent ); - } - - if ( dataCollector.PortCategory == MasterNodePortCategory.Fragment || dataCollector.PortCategory == MasterNodePortCategory.Debug ) - { - dataCollector.ForceNormal = true; - dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_NORMAL, CurrentPrecisionType ); - dataCollector.AddToInput( UniqueId, SurfaceInputs.INTERNALDATA, addSemiColon: false ); - } - - WirePortDataType sizeType = m_sizeOption == 0 ? WirePortDataType.FLOAT3 : WirePortDataType.FLOAT4; - - vertexTangent = GeneratorUtils.GenerateVertexTangent( ref dataCollector, UniqueId, CurrentPrecisionType, sizeType ); - return GetOutputVectorItem( 0, outputId, vertexTangent ); - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - if( UIUtils.CurrentShaderVersion() > 16100 ) - { - m_sizeOption = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - UpdatePorts(); - } - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_sizeOption ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TangentVertexDataNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TangentVertexDataNode.cs.meta deleted file mode 100644 index 2ce6f77a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TangentVertexDataNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: b544118f39abfe84581b8249973d52c5 -timeCreated: 1481126958 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation.meta deleted file mode 100644 index 89948ec8..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 518d8e72c2385b9488817fee5368f56c -folderAsset: yes -timeCreated: 1482150091 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/DistanceBasedTessNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/DistanceBasedTessNode.cs deleted file mode 100644 index c49df07f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/DistanceBasedTessNode.cs +++ /dev/null @@ -1,30 +0,0 @@ - -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - - -namespace AmplifyShaderEditor -{ - [System.Serializable] - [NodeAttributes( "Distance-based Tessellation", "Miscellaneous", "Calculates tessellation based on distance from camera" )] - public sealed class DistanceBasedTessNode : TessellationParentNode - { - private const string FunctionBody = "UnityDistanceBasedTess( v0.vertex, v1.vertex, v2.vertex, {0},{1},{2})"; - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT, false,"Factor"); - AddInputPort( WirePortDataType.FLOAT, false, "Min Dist" ); - AddInputPort( WirePortDataType.FLOAT, false, "Max Dist" ); - AddOutputPort( WirePortDataType.FLOAT4, Constants.EmptyPortValue ); - } - - protected override string BuildTessellationFunction( ref MasterNodeDataCollector dataCollector ) - { - return string.Format( FunctionBody, - m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ), - m_inputPorts[ 2 ].GeneratePortInstructions( ref dataCollector ), - m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ) ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/DistanceBasedTessNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/DistanceBasedTessNode.cs.meta deleted file mode 100644 index 18016c1b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/DistanceBasedTessNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 5a83fb450d164d34bb756f46b3f4290e -timeCreated: 1482150091 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/EdgeLengthCullTessNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/EdgeLengthCullTessNode.cs deleted file mode 100644 index 48c5db07..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/EdgeLengthCullTessNode.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - - -namespace AmplifyShaderEditor -{ - [System.Serializable] - [NodeAttributes( "Edge Length Tessellation With Cull", "Miscellaneous", "Tessellation level computed based on triangle edge length on the screen with patch frustum culling" )] - public sealed class EdgeLengthCullTessNode : TessellationParentNode - { - private const string FunctionBody = "UnityEdgeLengthBasedTessCull( v0.vertex, v1.vertex, v2.vertex, {0},{1})"; - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT, false, "Edge Length" ); - AddInputPort( WirePortDataType.FLOAT, false, "Max Disp." ); - AddOutputPort( WirePortDataType.FLOAT4, Constants.EmptyPortValue ); - } - - protected override string BuildTessellationFunction( ref MasterNodeDataCollector dataCollector ) - { - return string.Format( FunctionBody, - m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ), - m_inputPorts[ 1 ].GeneratePortInstructions( ref dataCollector ) ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/EdgeLengthCullTessNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/EdgeLengthCullTessNode.cs.meta deleted file mode 100644 index 20d4dd27..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/EdgeLengthCullTessNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 4b09c64ce2fd06a4cb4036d8cc0f8b2a -timeCreated: 1482150962 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/EdgeLengthTessNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/EdgeLengthTessNode.cs deleted file mode 100644 index f4905bf1..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/EdgeLengthTessNode.cs +++ /dev/null @@ -1,23 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -namespace AmplifyShaderEditor -{ - [System.Serializable] - [NodeAttributes( "Edge Length Tessellation", "Miscellaneous", "Tessellation level computed based on triangle edge length on the screen" )] - public sealed class EdgeLengthTessNode : TessellationParentNode - { - private const string FunctionBody = "UnityEdgeLengthBasedTess (v0.vertex, v1.vertex, v2.vertex, {0})"; - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddInputPort( WirePortDataType.FLOAT, false, "Edge Length" ); - AddOutputPort( WirePortDataType.FLOAT4, Constants.EmptyPortValue ); - } - - protected override string BuildTessellationFunction( ref MasterNodeDataCollector dataCollector ) - { - return string.Format( FunctionBody, m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ) ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/EdgeLengthTessNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/EdgeLengthTessNode.cs.meta deleted file mode 100644 index 2c936ef7..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/EdgeLengthTessNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: abe3e8fa4d49c9742a95ac801fd14d7d -timeCreated: 1482150962 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/TessellationParentNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/TessellationParentNode.cs deleted file mode 100644 index be14febc..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/TessellationParentNode.cs +++ /dev/null @@ -1,29 +0,0 @@ -namespace AmplifyShaderEditor -{ - public class TessellationParentNode : ParentNode - { - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_useInternalPortData = true; - } - - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if ( dataCollector.PortCategory != MasterNodePortCategory.Tessellation ) - { - UIUtils.ShowMessage( UniqueId, m_nodeAttribs.Name + " can only be used on Master Node Tessellation port" ); - return "(-1)"; - } - - return BuildTessellationFunction( ref dataCollector ); - } - - protected virtual string BuildTessellationFunction( ref MasterNodeDataCollector dataCollector ) - { - return string.Empty; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/TessellationParentNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/TessellationParentNode.cs.meta deleted file mode 100644 index 0799224c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/Tessellation/TessellationParentNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 79c24faef1fec884d937e74bdc9209da -timeCreated: 1482162387 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TexCoord1VertexDataNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TexCoord1VertexDataNode.cs deleted file mode 100644 index 5297ac7d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TexCoord1VertexDataNode.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -namespace AmplifyShaderEditor -{ - [System.Serializable] - [NodeAttributes( "[VS] Vertex TexCoord1", "Vertex Data", "Second set of vertex texture coordinates. Only works on Vertex Shaders ports ( p.e. Local Vertex Offset Port )." ,null,UnityEngine.KeyCode.None,true,true, "[VS] Vertex TexCoord" )] - public sealed class TexCoord1VertexDataNode : VertexDataNode - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_currentVertexData = "texcoord1"; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TexCoord1VertexDataNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TexCoord1VertexDataNode.cs.meta deleted file mode 100644 index 68529273..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TexCoord1VertexDataNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: ebd7eb3a7f6149e4e9dacbcda2d8089f -timeCreated: 1481126960 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TexCoordVertexDataNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TexCoordVertexDataNode.cs deleted file mode 100644 index 832b02a2..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TexCoordVertexDataNode.cs +++ /dev/null @@ -1,235 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using UnityEngine; -using UnityEditor; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Vertex TexCoord", "Vertex Data", "Vertex texture coordinates, can be used in both local vertex offset and fragment outputs", tags: "uv" )] - public sealed class TexCoordVertexDataNode : VertexDataNode - { - [SerializeField] - private int m_texcoordSize = 2; - - [SerializeField] - private int m_index = 0; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_currentVertexData = "texcoord"; - ChangeOutputProperties( 0, "UV", WirePortDataType.FLOAT2, false ); - m_outputPorts[ 1 ].Name = "U"; - m_outputPorts[ 2 ].Name = "V"; - m_outputPorts[ 3 ].Visible = false; - m_outputPorts[ 4 ].Visible = false; - m_outputPorts[ 3 ].Name = "W"; - m_outputPorts[ 4 ].Name = "T"; - m_autoWrapProperties = true; - m_hasLeftDropdown = true; - m_previewShaderGUID = "6c1bee77276896041bbb73b1b9e7f8ac"; - } - - public override void DrawProperties() - { - base.DrawProperties(); - EditorGUI.BeginChangeCheck(); - m_texcoordSize = EditorGUILayoutIntPopup( Constants.AvailableUVSizesLabel, m_texcoordSize, Constants.AvailableUVSizesStr, Constants.AvailableUVSizes ); - if( EditorGUI.EndChangeCheck() ) - { - UpdateOutput(); - } - - EditorGUI.BeginChangeCheck(); - m_index = EditorGUILayoutIntPopup( Constants.AvailableUVChannelLabel, m_index, Constants.AvailableUVSetsStr, Constants.AvailableUVChannels ); - if( EditorGUI.EndChangeCheck() ) - { - m_currentVertexData = ( m_index == 0 ) ? "texcoord" : "texcoord" + Constants.AvailableUVChannelsStr[ m_index ]; - } - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - - if( m_dropdownEditing ) - { - EditorGUI.BeginChangeCheck(); - m_texcoordSize = EditorGUIIntPopup( m_dropdownRect, m_texcoordSize, Constants.AvailableUVSizesStr, Constants.AvailableUVSizes, UIUtils.PropertyPopUp ); - if( EditorGUI.EndChangeCheck() ) - { - UpdateOutput(); - DropdownEditing = false; - } - } - } - - private void UpdateOutput() - { - if( m_texcoordSize == 3 ) - { - m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT3, false ); - m_outputPorts[ 0 ].Name = "UVW"; - m_outputPorts[ 3 ].Visible = true; - m_outputPorts[ 4 ].Visible = false; - } - else if( m_texcoordSize == 4 ) - { - m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT4, false ); - m_outputPorts[ 0 ].Name = "UVWT"; - m_outputPorts[ 3 ].Visible = true; - m_outputPorts[ 4 ].Visible = true; - } - else - { - m_texcoordSize = 2; - m_outputPorts[ 0 ].ChangeType( WirePortDataType.FLOAT2, false ); - m_outputPorts[ 0 ].Name = "UV"; - m_outputPorts[ 3 ].Visible = false; - m_outputPorts[ 4 ].Visible = false; - } - m_sizeIsDirty = true; - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) - { - if( dataCollector.IsTemplate ) - { - if( !dataCollector.TemplateDataCollectorInstance.HasUV( m_index ) ) - { - dataCollector.TemplateDataCollectorInstance.RegisterUV( m_index, m_outputPorts[ 0 ].DataType ); - } - - if( dataCollector.TemplateDataCollectorInstance.HasUV( m_index ) ) - { - InterpDataHelper info = dataCollector.TemplateDataCollectorInstance.GetUVInfo( m_index ); - if( outputId == 0 ) - { - return dataCollector.TemplateDataCollectorInstance.GetUVName( m_index, m_outputPorts[ 0 ].DataType ); - } - else if( outputId <= TemplateHelperFunctions.DataTypeChannelUsage[ info.VarType ] ) - { - return GetOutputVectorItem( 0, outputId, info.VarName ); - } - Debug.LogWarning( "Attempting to access inexisting UV channel" ); - } - else - { - Debug.LogWarning( "Attempting to access non-registered UV" ); - } - return "0"; - } - - if( dataCollector.PortCategory == MasterNodePortCategory.Fragment || dataCollector.PortCategory == MasterNodePortCategory.Debug ) - { - if( m_texcoordSize > 2 ) - dataCollector.UsingHigherSizeTexcoords = true; - } - - WirePortDataType size = (WirePortDataType)( 1 << ( m_texcoordSize + 1 ) ); - string texcoords = GeneratorUtils.GenerateAutoUVs( ref dataCollector, UniqueId, m_index, null, size ); - return GetOutputVectorItem( 0, outputId, texcoords ); - } - - /// <summary> - /// Generates UV properties and uniforms and returns the varible name to use in the fragment shader - /// </summary> - /// <param name="dataCollector"></param> - /// <param name="uniqueId"></param> - /// <param name="index"></param> - /// <returns>frag variable name</returns> - static public string GenerateFragUVs( ref MasterNodeDataCollector dataCollector, int uniqueId, int index, string propertyName = null, WirePortDataType size = WirePortDataType.FLOAT2 ) - { - string dummyPropUV = "_texcoord" + ( index > 0 ? ( index + 1 ).ToString() : "" ); - string dummyUV = "uv" + ( index > 0 ? ( index + 1 ).ToString() : "" ) + dummyPropUV; - - dataCollector.AddToProperties( uniqueId, "[HideInInspector] " + dummyPropUV + "( \"\", 2D ) = \"white\" {}", 100 ); - dataCollector.AddToInput( uniqueId, dummyUV, size ); - - string result = Constants.InputVarStr + "." + dummyUV; - if( !string.IsNullOrEmpty( propertyName ) ) - { - dataCollector.AddToUniforms( uniqueId, "uniform float4 " + propertyName + "_ST;" ); - dataCollector.AddToLocalVariables( uniqueId, PrecisionType.Float, size, "uv" + propertyName, result + " * " + propertyName + "_ST.xy + " + propertyName + "_ST.zw" ); - result = "uv" + propertyName; - } - - return result; - } - - static public string GenerateVertexUVs( ref MasterNodeDataCollector dataCollector, int uniqueId, int index, string propertyName = null, WirePortDataType size = WirePortDataType.FLOAT2 ) - { - - string result = Constants.VertexShaderInputStr + ".texcoord"; - if( index > 0 ) - { - result += index.ToString(); - } - - switch( size ) - { - default: - case WirePortDataType.FLOAT2: - { - result += ".xy"; - } - break; - case WirePortDataType.FLOAT3: - { - result += ".xyz"; - } - break; - case WirePortDataType.FLOAT4: break; - } - - if( !string.IsNullOrEmpty( propertyName ) ) - { - dataCollector.AddToUniforms( uniqueId, "uniform float4 " + propertyName + "_ST;" ); - dataCollector.AddToVertexLocalVariables( uniqueId, UIUtils.WirePortToCgType( size ) + " uv" + propertyName + " = " + Constants.VertexShaderInputStr + ".texcoord" + ( index > 0 ? index.ToString() : string.Empty ) + " * " + propertyName + "_ST.xy + " + propertyName + "_ST.zw;" ); - result = "uv" + propertyName; - } - - return result; - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - if( UIUtils.CurrentShaderVersion() > 2502 ) - { - m_index = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - } - - if( UIUtils.CurrentShaderVersion() > 5111 ) - { - m_texcoordSize = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - UpdateOutput(); - } - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_index ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_texcoordSize ); - } - - public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) - { - base.PropagateNodeData( nodeData, ref dataCollector ); - if( dataCollector.IsTemplate ) - { - dataCollector.TemplateDataCollectorInstance.SetUVUsage( m_index, m_texcoordSize ); - } - else if( m_index > 3 ) - { - dataCollector.AddCustomAppData( string.Format( TemplateHelperFunctions.TexUVFullSemantic, m_index ) ); - } - } - - - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TexCoordVertexDataNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TexCoordVertexDataNode.cs.meta deleted file mode 100644 index 54fd39ff..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/TexCoordVertexDataNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: b865968ce22b9d949993e5e60126eb11 -timeCreated: 1481126958 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexBinormalNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexBinormalNode.cs deleted file mode 100644 index 70a7d7b5..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexBinormalNode.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> -// -// Custom Node Vertex Binormal World -// Donated by Community Member Kebrus - -using UnityEngine; -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "World Bitangent", "Surface Data", "Per pixel world bitangent vector", null, KeyCode.None, true, false, null, null, "kebrus" )] - public sealed class VertexBinormalNode : ParentNode - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddOutputVectorPorts( WirePortDataType.FLOAT3, "XYZ" ); - m_drawPreviewAsSphere = true; - m_previewShaderGUID = "76873532ab67d2947beaf07151383cbe"; - } - - public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) - { - base.PropagateNodeData( nodeData, ref dataCollector ); - dataCollector.DirtyNormal = true; - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if ( dataCollector.IsTemplate ) - return GetOutputVectorItem( 0, outputId, dataCollector.TemplateDataCollectorInstance.GetWorldBinormal( CurrentPrecisionType ) ); - - if( dataCollector.PortCategory == MasterNodePortCategory.Fragment || dataCollector.PortCategory == MasterNodePortCategory.Debug ) - { - dataCollector.ForceNormal = true; - - dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_NORMAL, CurrentPrecisionType ); - dataCollector.AddToInput( UniqueId, SurfaceInputs.INTERNALDATA, addSemiColon: false ); - } - - string worldBitangent = GeneratorUtils.GenerateWorldBitangent( ref dataCollector, UniqueId ); - - return GetOutputVectorItem( 0, outputId, worldBitangent ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexBinormalNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexBinormalNode.cs.meta deleted file mode 100644 index b990b9a0..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexBinormalNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 8ae297dac4e208f4e86c8f7a022fc5bd -timeCreated: 1481126957 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexColorNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexColorNode.cs deleted file mode 100644 index 53ef5763..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexColorNode.cs +++ /dev/null @@ -1,47 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -namespace AmplifyShaderEditor -{ - [System.Serializable] - [NodeAttributes( "Vertex Color", "Vertex Data", "Vertex color interpolated on fragment" )] - public sealed class VertexColorNode : VertexDataNode - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_currentVertexData = "color"; - m_outputPorts[ 0 ].Name = "RGBA"; - ConvertFromVectorToColorPorts(); - m_drawPreviewAsSphere = true; - m_previewShaderGUID = "ca1d22db6470c5f4d9f93a9873b4f5bc"; - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) - { - if( dataCollector.MasterNodeCategory == AvailableShaderTypes.Template ) - { - string color = dataCollector.TemplateDataCollectorInstance.GetVertexColor( CurrentPrecisionType ); - return GetOutputColorItem( 0, outputId, color ); - } - - if( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) - { - return base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalVar ); - } - else - { - dataCollector.AddToInput( UniqueId, SurfaceInputs.COLOR ); - string result = Constants.InputVarStr + "." + Constants.ColorVariable; - switch( outputId ) - { - case 1: result += ".r"; break; - case 2: result += ".g"; break; - case 3: result += ".b"; break; - case 4: result += ".a"; break; - } - return result; - } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexColorNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexColorNode.cs.meta deleted file mode 100644 index ac1eee78..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexColorNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 6271f602b9ab61e4c9a96a91e473c1e0 -timeCreated: 1481126956 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexDataNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexDataNode.cs deleted file mode 100644 index 9fa8cffd..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexDataNode.cs +++ /dev/null @@ -1,50 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEngine; -using System; - -namespace AmplifyShaderEditor -{ - //public enum VertexData - //{ - // vertex = 0, - // tangent, - // normal, - // texcoord, - // texcoord1, - // color - //} - - [Serializable] - public class VertexDataNode : ParentNode - { - [SerializeField] - protected string m_currentVertexData; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_currentVertexData = "vertex"; - -// Type type = typeof( StandardSurfaceOutputNode ); - //m_restictions.AddPortRestriction( type, 0 ); - //m_restictions.AddPortRestriction( type, 2 ); - //m_restictions.AddPortRestriction( type, 3 ); - //m_restictions.AddPortRestriction( type, 4 ); - //m_restictions.AddPortRestriction( type, 5 ); - //m_restictions.AddPortRestriction( type, 6 ); - //m_restictions.AddPortRestriction( type, 7 ); - //m_restictions.AddPortRestriction( type, 8 ); - //m_restictions.AddPortRestriction( type, 9 ); - //m_restictions.AddPortRestriction( type, 10 ); - AddOutputVectorPorts( WirePortDataType.FLOAT4, "Out" ); - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) - { - base.GenerateShaderForOutput( outputId, ref dataCollector, ignoreLocalVar ); - return GetOutputVectorItem( 0, outputId, Constants.VertexShaderInputStr + "." + m_currentVertexData ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexDataNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexDataNode.cs.meta deleted file mode 100644 index 66737ecd..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexDataNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: e5f8fa23e49e4be478b283a704459767 -timeCreated: 1481126960 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexTangentNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexTangentNode.cs deleted file mode 100644 index b4e6064f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexTangentNode.cs +++ /dev/null @@ -1,50 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> -// -// Custom Node Vertex Tangent World -// Donated by Community Member Kebrus - -using UnityEngine; -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "World Tangent", "Surface Data", "Per pixel world tangent vector", null, KeyCode.None, true, false, null, null, "kebrus" )] - public sealed class VertexTangentNode : ParentNode - { - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddOutputVectorPorts( WirePortDataType.FLOAT3, "XYZ" ); - m_drawPreviewAsSphere = true; - m_previewShaderGUID = "61f0b80493c9b404d8c7bf56d59c3f81"; - } - - public override void PropagateNodeData( NodeData nodeData, ref MasterNodeDataCollector dataCollector ) - { - base.PropagateNodeData( nodeData , ref dataCollector ); - dataCollector.DirtyNormal = true; - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if ( dataCollector.IsTemplate ) - { - return GetOutputVectorItem( 0, outputId, dataCollector.TemplateDataCollectorInstance.GetWorldTangent( CurrentPrecisionType ) ); - } - - if( dataCollector.PortCategory == MasterNodePortCategory.Fragment || dataCollector.PortCategory == MasterNodePortCategory.Debug ) - { - dataCollector.ForceNormal = true; - - dataCollector.AddToInput( UniqueId, SurfaceInputs.WORLD_NORMAL, CurrentPrecisionType ); - dataCollector.AddToInput( UniqueId, SurfaceInputs.INTERNALDATA, addSemiColon: false ); - } - - string worldTangent = GeneratorUtils.GenerateWorldTangent( ref dataCollector, UniqueId ); - - return GetOutputVectorItem( 0, outputId, worldTangent ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexTangentNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexTangentNode.cs.meta deleted file mode 100644 index d3f0bbf2..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexTangentNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 3aca1dfe55df44d4cbaf99d5a40f7470 -timeCreated: 1481126955 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexToFragmentNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexToFragmentNode.cs deleted file mode 100644 index 844675f4..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexToFragmentNode.cs +++ /dev/null @@ -1,120 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> -// -// Custom Node Vertex To Fragment -// Donated by Jason Booth - http://u3d.as/DND - -using UnityEngine; - -namespace AmplifyShaderEditor -{ - [System.Serializable] - [NodeAttributes( "Vertex To Fragment", "Miscellaneous", "Pass vertex data to the pixel shader", null, KeyCode.None, true, false, null, null, "Jason Booth - http://u3d.as/DND" )] - public sealed class VertexToFragmentNode : SingleInputOp - { - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_inputPorts[ 0 ].AddPortForbiddenTypes( WirePortDataType.FLOAT3x3, - WirePortDataType.FLOAT4x4, - WirePortDataType.SAMPLER1D, - WirePortDataType.SAMPLER2D, - WirePortDataType.SAMPLER3D, - WirePortDataType.SAMPLERCUBE ); - m_inputPorts[ 0 ].Name = "(VS) In"; - m_outputPorts[ 0 ].Name = "Out"; - m_useInternalPortData = false; - m_previewShaderGUID = "74e4d859fbdb2c0468de3612145f4929"; - } - - 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 varName = GenerateInputInVertex( ref dataCollector, 0, "vertexToFrag" + OutputId,true ); - m_outputPorts[ 0 ].SetLocalValue( varName, dataCollector.PortCategory ); - - return varName; - - ////TEMPLATES - //if( dataCollector.IsTemplate ) - //{ - // if( !dataCollector.IsFragmentCategory ) - // return m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - - // string varName = "vertexToFrag" + OutputId; - // if( dataCollector.TemplateDataCollectorInstance.HasCustomInterpolatedData( varName ) ) - // return varName; - - // MasterNodePortCategory category = dataCollector.PortCategory; - // dataCollector.PortCategory = MasterNodePortCategory.Vertex; - // bool dirtyVertexVarsBefore = dataCollector.DirtyVertexVariables; - // ContainerGraph.ResetNodesLocalVariablesIfNot( this, MasterNodePortCategory.Vertex ); - - // string data = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - - // dataCollector.PortCategory = category; - // if( !dirtyVertexVarsBefore && dataCollector.DirtyVertexVariables ) - // { - // dataCollector.AddVertexInstruction( dataCollector.VertexLocalVariables, UniqueId, false ); - // dataCollector.ClearVertexLocalVariables(); - // ContainerGraph.ResetNodesLocalVariablesIfNot( this, MasterNodePortCategory.Vertex ); - // } - - // ContainerGraph.ResetNodesLocalVariablesIfNot( this, MasterNodePortCategory.Fragment ); - - // dataCollector.TemplateDataCollectorInstance.RegisterCustomInterpolatedData( varName, m_inputPorts[ 0 ].DataType, m_currentPrecisionType, data ); - // //return varName; - - // m_outputPorts[ 0 ].SetLocalValue( varName ); - // return m_outputPorts[ 0 ].LocalValue; - //} - - ////SURFACE - //{ - // if( !dataCollector.IsFragmentCategory ) - // { - // return m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - // } - - // if( dataCollector.TesselationActive ) - // { - // UIUtils.ShowMessage( "Unable to use Vertex to Frag when Tessellation is active" ); - // return m_outputPorts[ 0 ].ErrorValue; - // } - - - // string interpName = "data" + OutputId; - // dataCollector.AddToInput( UniqueId, interpName, m_inputPorts[ 0 ].DataType, m_currentPrecisionType ); - - // MasterNodePortCategory portCategory = dataCollector.PortCategory; - // dataCollector.PortCategory = MasterNodePortCategory.Vertex; - - // bool dirtyVertexVarsBefore = dataCollector.DirtyVertexVariables; - - // ContainerGraph.ResetNodesLocalVariablesIfNot( this, MasterNodePortCategory.Vertex ); - - // string vertexVarValue = m_inputPorts[ 0 ].GeneratePortInstructions( ref dataCollector ); - // dataCollector.AddLocalVariable( UniqueId, Constants.VertexShaderOutputStr + "." + interpName, vertexVarValue + ";" ); - - // dataCollector.PortCategory = portCategory; - - // if( !dirtyVertexVarsBefore && dataCollector.DirtyVertexVariables ) - // { - // dataCollector.AddVertexInstruction( dataCollector.VertexLocalVariables, UniqueId, false ); - // dataCollector.ClearVertexLocalVariables(); - // ContainerGraph.ResetNodesLocalVariablesIfNot( this, MasterNodePortCategory.Vertex ); - // } - - // ContainerGraph.ResetNodesLocalVariablesIfNot( this, MasterNodePortCategory.Fragment ); - - // //return Constants.InputVarStr + "." + interpName; - - // m_outputPorts[ 0 ].SetLocalValue( Constants.InputVarStr + "." + interpName ); - // return m_outputPorts[ 0 ].LocalValue; - //} - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexToFragmentNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexToFragmentNode.cs.meta deleted file mode 100644 index 0131f745..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Nodes/Vertex/VertexToFragmentNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 9ecea5c13558ad4499dd4bc558670b8e -timeCreated: 1481126958 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/PreMadeShaders.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/PreMadeShaders.cs deleted file mode 100644 index e6fd5c67..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/PreMadeShaders.cs +++ /dev/null @@ -1,47 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEngine; - -using System.Collections.Generic; -namespace AmplifyShaderEditor -{ - public class PreMadeShaders - { - public static readonly string FlatColorSequenceId = "Flat Color"; - private Dictionary<string, ActionSequence> m_actionLib; - public PreMadeShaders() - { - m_actionLib = new Dictionary<string, ActionSequence>(); - ActionSequence sequence = new ActionSequence( FlatColorSequenceId ); - sequence.AddToSequence( new CreateNodeActionData( 1, typeof( ColorNode ), new Vector2( -250, 125 ) ) ); - sequence.AddToSequence( new CreateConnectionActionData( 0, 4, 1, 0 ) ); - m_actionLib.Add( sequence.Name, sequence ); - } - - public ActionSequence GetSequence( string name ) - { - if ( m_actionLib.ContainsKey( name ) ) - { - return m_actionLib[ name ]; - } - return null; - } - - public void Destroy() - { - var items = m_actionLib.GetEnumerator(); - while ( items.MoveNext() ) - { - items.Current.Value.Destroy(); - } - m_actionLib.Clear(); - m_actionLib = null; - } - - public ActionSequence FlatColorSequence - { - get { return m_actionLib[ FlatColorSequenceId ]; } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/PreMadeShaders.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/PreMadeShaders.cs.meta deleted file mode 100644 index 745f6389..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/PreMadeShaders.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: b4e28cbcd41f3b04ca36fc1b34d2c10f -timeCreated: 1481126958 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates.meta deleted file mode 100644 index d2ecd461..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: c1807893b16b7724e840f3d8099a6394 -folderAsset: yes -timeCreated: 1481126944 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalDefinesHelper.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalDefinesHelper.cs deleted file mode 100644 index fb4d7569..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalDefinesHelper.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - public class TemplateAdditionalDefinesHelper : TemplateAdditionalParentHelper - { - public TemplateAdditionalDefinesHelper() : base( "Additional Defines" ) - { - m_helpBoxMessage = "Please add your defines without the #define keywords"; - } - - public override void AddToDataCollector( ref MasterNodeDataCollector dataCollector, TemplateIncludePragmaContainter nativesContainer ) - { - for( int i = 0; i < m_additionalItems.Count; i++ ) - { - if( !string.IsNullOrEmpty( m_additionalItems[ i ] ) && !nativesContainer.HasDefine( m_additionalItems[ i ] ) ) - dataCollector.AddToDefines( -1, m_additionalItems[ i ] ); - } - - for( int i = 0; i < m_outsideItems.Count; i++ ) - { - if( !string.IsNullOrEmpty( m_outsideItems[ i ] ) && !nativesContainer.HasDefine( m_outsideItems[ i ] ) ) - dataCollector.AddToDefines( -1, m_outsideItems[ i ] ); - } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalDefinesHelper.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalDefinesHelper.cs.meta deleted file mode 100644 index 3194a2ab..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalDefinesHelper.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 35a7fdfdb9a6b0048aa322a9fe58a371 -timeCreated: 1520275148 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalDirectivesHelper.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalDirectivesHelper.cs deleted file mode 100644 index 31c03b59..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalDirectivesHelper.cs +++ /dev/null @@ -1,837 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using System.IO; -using System.Collections.Generic; -using UnityEditor; -using UnityEngine; -using UnityEditorInternal; - -namespace AmplifyShaderEditor -{ - public enum AdditionalLineType - { - Include, - Define, - Pragma, - Custom - } - - public enum AdditionalContainerOrigin - { - Native, - ShaderFunction, - Custom - } - - - [Serializable] - public class AdditionalDirectiveContainerSaveItem - { - public AdditionalLineType LineType = AdditionalLineType.Include; - public string LineValue = string.Empty; - public bool GUIDToggle = false; - public string GUIDValue = string.Empty; - public AdditionalContainerOrigin Origin = AdditionalContainerOrigin.Custom; - public AdditionalDirectiveContainerSaveItem( AdditionalLineType lineType, string lineValue, bool guidToggle, string guidValue, AdditionalContainerOrigin origin ) - { - LineType = lineType; - LineValue = lineValue; - GUIDToggle = guidToggle; - GUIDValue = guidValue; - Origin = origin; - } - - public AdditionalDirectiveContainerSaveItem( AdditionalDirectiveContainer container ) - { - LineType = container.LineType; - LineValue = container.LineValue; - GUIDToggle = container.GUIDToggle; - GUIDValue = container.GUIDValue; - Origin = container.Origin; - } - } - - [Serializable] - public class AdditionalDirectiveContainer : ScriptableObject - { - public AdditionalLineType LineType = AdditionalLineType.Include; - public string LineValue = string.Empty; - public bool GUIDToggle = false; - public string GUIDValue = string.Empty; - public AdditionalContainerOrigin Origin = AdditionalContainerOrigin.Custom; - public TextAsset LibObject = null; - public string OwnerId = string.Empty; - - public void Init( string ownerId, AdditionalDirectiveContainer item ) - { - LineType = item.LineType; - LineValue = item.LineValue; - GUIDToggle = item.GUIDToggle; - GUIDValue = item.GUIDValue; - Origin = item.Origin; - LibObject = item.LibObject; - OwnerId = ownerId; - } - - public void Init( AdditionalDirectiveContainerSaveItem item ) - { - LineType = item.LineType; - LineValue = item.LineValue; - GUIDToggle = item.GUIDToggle; - GUIDValue = item.GUIDValue; - Origin = item.Origin; - if( GUIDToggle ) - { - LibObject = AssetDatabase.LoadAssetAtPath<TextAsset>( AssetDatabase.GUIDToAssetPath( GUIDValue ) ); - } - } - - public void OnDestroy() - { - //Debug.Log( "Destoying directives" ); - LibObject = null; - } - - public string Value - { - get - { - switch( LineType ) - { - case AdditionalLineType.Include: - { - if( GUIDToggle ) - { - string shaderPath = AssetDatabase.GUIDToAssetPath( GUIDValue ); - if( !string.IsNullOrEmpty( shaderPath ) ) - return shaderPath; - } - return LineValue; - } - case AdditionalLineType.Define: return LineValue; - case AdditionalLineType.Pragma: return LineValue; - } - return LineValue; - } - } - - public string FormattedValue - { - get - { - switch( LineType ) - { - case AdditionalLineType.Include: - { - if( GUIDToggle ) - { - string shaderPath = AssetDatabase.GUIDToAssetPath( GUIDValue ); - if( !string.IsNullOrEmpty( shaderPath ) ) - return string.Format( Constants.IncludeFormat, shaderPath ); - } - - return string.Format( Constants.IncludeFormat, LineValue ); - } - case AdditionalLineType.Define: - return string.Format( Constants.DefineFormat, LineValue ); - case AdditionalLineType.Pragma: - return string.Format( Constants.PragmaFormat, LineValue ); - } - return LineValue; - } - } - } - - - - public enum ReordableAction - { - None, - Add, - Remove - } - - [Serializable] - public sealed class TemplateAdditionalDirectivesHelper : TemplateModuleParent - { - private string NativeFoldoutStr = "Native"; - - [SerializeField] - private List<AdditionalDirectiveContainer> m_additionalDirectives = new List<AdditionalDirectiveContainer>(); - - [SerializeField] - private List<AdditionalDirectiveContainer> m_shaderFunctionDirectives = new List<AdditionalDirectiveContainer>(); - - [SerializeField] - private List<string> m_nativeDirectives = new List<string>(); - - [SerializeField] - private int m_nativeDirectivesIndex = -1; - - [SerializeField] - private bool m_nativeDirectivesFoldout = false; - - //ONLY USED BY SHADER FUNCTIONS - // Since AdditionalDirectiveContainer must be a ScriptableObject because of serialization shenanigans it will not serialize the info correctly into the shader function when saving it into a file ( it only saves the id ) - // For it to properly work, each AdditionalDirectiveContainer should be added to the SF asset, but that would make it to have children ( which are seen on the project inspector ) - // Must revisit this later on and come up with a proper solution - [SerializeField] - private List<AdditionalDirectiveContainerSaveItem> m_directivesSaveItems = new List<AdditionalDirectiveContainerSaveItem>(); - - - private ReordableAction m_actionType = ReordableAction.None; - private int m_actionIndex = 0; - private ReorderableList m_reordableList = null; - private GUIStyle m_propertyAdjustment; - private UndoParentNode m_currOwner; - private Rect m_nativeRect = Rect.zero; - - public TemplateAdditionalDirectivesHelper( string moduleName ) : base( moduleName ) { } - - //public void AddShaderFunctionItem( AdditionalLineType type, string item ) - //{ - // UpdateShaderFunctionDictionary(); - // string id = type + item; - // if( !m_shaderFunctionDictionary.ContainsKey( id ) ) - // { - // AdditionalDirectiveContainer newItem = ScriptableObject.CreateInstance<AdditionalDirectiveContainer>(); - // newItem.LineType = type; - // newItem.LineValue = item; - // newItem.hideFlags = HideFlags.HideAndDontSave; - // m_shaderFunctionDirectives.Add( newItem ); - // m_shaderFunctionDictionary.Add( id, newItem ); - // } - //} - - public void AddShaderFunctionItems( string ownerOutputId, List<AdditionalDirectiveContainer> functionList ) - { - RemoveShaderFunctionItems( ownerOutputId ); - if( functionList.Count > 0 ) - { - for( int i = 0; i < functionList.Count; i++ ) - { - AdditionalDirectiveContainer item = ScriptableObject.CreateInstance<AdditionalDirectiveContainer>(); - item.Init( ownerOutputId, functionList[ i ] ); - m_shaderFunctionDirectives.Add( item ); - } - } - //if( functionList.Count > 0 ) - //{ - - // m_shaderFunctionDirectives.AddRange( functionList ); - //} - } - - public void RemoveShaderFunctionItems( string ownerOutputId/*, List<AdditionalDirectiveContainer> functionList */) - { - List<AdditionalDirectiveContainer> list = m_shaderFunctionDirectives.FindAll( ( x ) => x.OwnerId.Equals( ownerOutputId )); - for( int i = 0; i < list.Count; i++ ) - { - m_shaderFunctionDirectives.Remove( list[ i ] ); - ScriptableObject.DestroyImmediate( list[ i ] ); - } - list.Clear(); - list = null; - - //for( int i = 0; i < functionList.Count; i++ ) - //{ - // m_shaderFunctionDirectives.Remove( functionList[ i ] ); - //} - } - - //public void RemoveShaderFunctionItem( AdditionalLineType type, string item ) - //{ - // m_shaderFunctionDirectives.RemoveAll( x => x.LineType == type && x.LineValue.Equals( item ) ); - //} - - public void AddItems( AdditionalLineType type, List<string> items ) - { - int count = items.Count; - for( int i = 0; i < count; i++ ) - { - AdditionalDirectiveContainer newItem = ScriptableObject.CreateInstance<AdditionalDirectiveContainer>(); - newItem.LineType = type; - newItem.LineValue = items[ i ]; - newItem.hideFlags = HideFlags.HideAndDontSave; - m_additionalDirectives.Add( newItem ); - } - UpdateNativeIndex(); - } - - public void AddNativeContainer() - { - if( m_nativeDirectives.Count > 0 ) - { - if( m_additionalDirectives.FindIndex( x => x.Origin.Equals( AdditionalContainerOrigin.Native ) ) == -1 ) - { - AdditionalDirectiveContainer newItem = ScriptableObject.CreateInstance<AdditionalDirectiveContainer>(); - newItem.Origin = AdditionalContainerOrigin.Native; - newItem.hideFlags = HideFlags.HideAndDontSave; - //m_additionalDirectives.Add( newItem ); - //m_nativeDirectivesIndex = m_additionalDirectives.Count - 1; - m_additionalDirectives.Insert( 0, newItem ); - m_nativeDirectivesIndex = 0; - } - } - } - - public void FillNativeItems( List<string> nativeItems ) - { - m_nativeDirectives.Clear(); - m_nativeDirectives.AddRange( nativeItems ); - AddNativeContainer(); - } - - void DrawNativeItems() - { - EditorGUILayout.Separator(); - EditorGUI.indentLevel++; - int count = m_nativeDirectives.Count; - for( int i = 0; i < count; i++ ) - { - EditorGUILayout.LabelField( m_nativeDirectives[ i ] ); - } - EditorGUI.indentLevel--; - EditorGUILayout.Separator(); - } - - void DrawNativeItemsRect() - { - int count = m_nativeDirectives.Count; - m_nativeRect.y += EditorGUIUtility.singleLineHeight; - for( int i = 0; i < count; i++ ) - { - EditorGUI.LabelField( m_nativeRect, m_nativeDirectives[ i ] ); - m_nativeRect.y += EditorGUIUtility.singleLineHeight; - } - } - - void DrawButtons() - { - EditorGUILayout.Separator(); - - // Add keyword - if( GUILayout.Button( string.Empty, UIUtils.PlusStyle, GUILayout.Width( Constants.PlusMinusButtonLayoutWidth ) ) ) - { - AdditionalDirectiveContainer newItem = ScriptableObject.CreateInstance<AdditionalDirectiveContainer>(); - newItem.hideFlags = HideFlags.HideAndDontSave; - m_additionalDirectives.Add( newItem ); - UpdateNativeIndex(); - EditorGUI.FocusTextInControl( null ); - m_isDirty = true; - } - - //Remove keyword - if( GUILayout.Button( string.Empty, UIUtils.MinusStyle, GUILayout.Width( Constants.PlusMinusButtonLayoutWidth ) ) ) - { - if( m_additionalDirectives.Count > 0 ) - { - AdditionalDirectiveContainer itemToDelete = m_additionalDirectives[ m_additionalDirectives.Count - 1 ]; - m_additionalDirectives.RemoveAt( m_additionalDirectives.Count - 1 ); - ScriptableObject.DestroyImmediate( itemToDelete ); - EditorGUI.FocusTextInControl( null ); - } - m_isDirty = true; - } - } - - public override void Draw( UndoParentNode currOwner, bool style = true ) - { - m_currOwner = currOwner; - if( m_reordableList == null ) - { - m_reordableList = new ReorderableList( m_additionalDirectives, typeof( AdditionalDirectiveContainer ), true, false, false, false ) - { - headerHeight = 0, - footerHeight = 0, - showDefaultBackground = false, - elementHeightCallback = ( index ) => - { - if( m_additionalDirectives[ index ].Origin == AdditionalContainerOrigin.Native && m_nativeDirectivesFoldout ) - { - return ( m_nativeDirectives.Count + 1 ) * ( EditorGUIUtility.singleLineHeight ) + 5; - } - - return EditorGUIUtility.singleLineHeight + 5; - }, - drawElementCallback = ( Rect rect, int index, bool isActive, bool isFocused ) => - { - if( m_additionalDirectives[ index ].Origin == AdditionalContainerOrigin.Native && m_nativeDirectivesFoldout ) - { - rect.height = ( m_nativeDirectives.Count + 1 ) * ( EditorGUIUtility.singleLineHeight ) + 5; - } - - if( m_additionalDirectives[ index ] != null ) - { - float labelWidthStyleAdjust = 0; - if( style ) - { - rect.xMin -= 10; - labelWidthStyleAdjust = 15; - } - else - { - rect.xMin -= 1; - } - - float popUpWidth = style ? 75 : 60f; - float widthAdjust = m_additionalDirectives[ index ].LineType == AdditionalLineType.Include ? -14 : 0; - Rect popupPos = new Rect( rect.x, rect.y, popUpWidth, EditorGUIUtility.singleLineHeight ); - Rect GUIDTogglePos = m_additionalDirectives[ index ].LineType == AdditionalLineType.Include ? new Rect( rect.x + rect.width - 3 * Constants.PlusMinusButtonLayoutWidth, rect.y, Constants.PlusMinusButtonLayoutWidth, Constants.PlusMinusButtonLayoutWidth ) : new Rect(); - Rect buttonPlusPos = new Rect( rect.x + rect.width - 2 * Constants.PlusMinusButtonLayoutWidth, rect.y - 2, Constants.PlusMinusButtonLayoutWidth, Constants.PlusMinusButtonLayoutWidth ); - Rect buttonMinusPos = new Rect( rect.x + rect.width - Constants.PlusMinusButtonLayoutWidth, rect.y - 2, Constants.PlusMinusButtonLayoutWidth, Constants.PlusMinusButtonLayoutWidth ); - float labelWidthBuffer = EditorGUIUtility.labelWidth; - Rect labelPos = new Rect( rect.x + popupPos.width - labelWidthStyleAdjust, rect.y, labelWidthStyleAdjust + rect.width - popupPos.width - buttonPlusPos.width - buttonMinusPos.width + widthAdjust, EditorGUIUtility.singleLineHeight ); - - if( m_additionalDirectives[ index ].Origin == AdditionalContainerOrigin.Native ) - { - m_nativeRect = rect; -#if UNITY_2019_3_OR_NEWER - m_nativeRect.y -= ( m_nativeRect.height - ( EditorGUIUtility.singleLineHeight + 5 ) ) * 0.5f; -#endif - m_nativeRect.xMin += 2; - m_nativeRect.xMax -= 2; - m_nativeRect.yMax -= 2; - - NodeUtils.DrawNestedPropertyGroup( ref m_nativeDirectivesFoldout, rect, NativeFoldoutStr, DrawNativeItemsRect, 4 ); - return; - } - - m_additionalDirectives[ index ].LineType = (AdditionalLineType)m_currOwner.EditorGUIEnumPopup( popupPos, m_additionalDirectives[ index ].LineType ); - - if( m_additionalDirectives[ index ].LineType == AdditionalLineType.Include ) - { - if( m_additionalDirectives[ index ].GUIDToggle ) - { - //if( m_additionalDirectives[ index ].LibObject == null && !string.IsNullOrEmpty( m_additionalDirectives[ index ].GUIDValue ) ) - //{ - // m_additionalDirectives[ index ].LibObject = AssetDatabase.LoadAssetAtPath<TextAsset>( AssetDatabase.GUIDToAssetPath( m_additionalDirectives[ index ].GUIDValue ) ); - //} - - EditorGUI.BeginChangeCheck(); - TextAsset obj = m_currOwner.EditorGUIObjectField( labelPos, m_additionalDirectives[ index ].LibObject, typeof( TextAsset ), false ) as TextAsset; - if( EditorGUI.EndChangeCheck() ) - { - string pathName = AssetDatabase.GetAssetPath( obj ); - string extension = Path.GetExtension( pathName ); - extension = extension.ToLower(); - if( extension.Equals( ".cginc" ) || extension.Equals( ".hlsl" ) ) - { - m_additionalDirectives[ index ].LibObject = obj; - m_additionalDirectives[ index ].GUIDValue = AssetDatabase.AssetPathToGUID( pathName ); - } - } - } - else - { - m_additionalDirectives[ index ].LineValue = m_currOwner.EditorGUITextField( labelPos, string.Empty, m_additionalDirectives[ index ].LineValue ); - } - - if( GUI.Button( GUIDTogglePos, m_additionalDirectives[ index ].GUIDToggle ? UIUtils.FloatIntIconOFF : UIUtils.FloatIntIconON, UIUtils.FloatIntPickerONOFF ) ) - m_additionalDirectives[ index ].GUIDToggle = !m_additionalDirectives[ index ].GUIDToggle; - } - else - { - m_additionalDirectives[ index ].LineValue = m_currOwner.EditorGUITextField( labelPos, string.Empty, m_additionalDirectives[ index ].LineValue ); - } - - if( GUI.Button( buttonPlusPos, string.Empty, UIUtils.PlusStyle ) ) - { - m_actionType = ReordableAction.Add; - m_actionIndex = index; - } - - if( GUI.Button( buttonMinusPos, string.Empty, UIUtils.MinusStyle ) ) - { - m_actionType = ReordableAction.Remove; - m_actionIndex = index; - } - } - }, - onReorderCallback = ( ReorderableList list ) => - { - UpdateNativeIndex(); - } - }; - } - - if( m_actionType != ReordableAction.None ) - { - switch( m_actionType ) - { - case ReordableAction.Add: - { - AdditionalDirectiveContainer newItem = ScriptableObject.CreateInstance<AdditionalDirectiveContainer>(); - newItem.hideFlags = HideFlags.HideAndDontSave; - m_additionalDirectives.Insert( m_actionIndex + 1, newItem ); - } - break; - case ReordableAction.Remove: - AdditionalDirectiveContainer itemToDelete = m_additionalDirectives[ m_actionIndex ]; - m_additionalDirectives.RemoveAt( m_actionIndex ); - ScriptableObject.DestroyImmediate( itemToDelete ); - break; - } - m_isDirty = true; - m_actionType = ReordableAction.None; - EditorGUI.FocusTextInControl( null ); - } - bool foldoutValue = currOwner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedAdditionalDirectives; - if( style ) - { - NodeUtils.DrawPropertyGroup( ref foldoutValue, m_moduleName, DrawReordableList, DrawButtons ); - } - else - { - NodeUtils.DrawNestedPropertyGroup( ref foldoutValue, m_moduleName, DrawReordableList, DrawButtons ); - } - currOwner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedAdditionalDirectives = foldoutValue; - } - - void DrawReordableList() - { - if( m_reordableList != null ) - { - if( m_propertyAdjustment == null ) - { - m_propertyAdjustment = new GUIStyle(); - m_propertyAdjustment.padding.left = 17; - } - //EditorGUILayout.BeginVertical( m_propertyAdjustment ); - EditorGUILayout.Space(); - if( m_nativeDirectives.Count > 0 ) - { - //NodeUtils.DrawNestedPropertyGroup( ref m_nativeDirectivesFoldout, NativeFoldoutStr, DrawNativeItems, 4 ); - } - if( m_additionalDirectives.Count == 0 ) - { - EditorGUILayout.HelpBox( "Your list is Empty!\nUse the plus button to add one.", MessageType.Info ); - } - else - { - m_reordableList.DoLayoutList(); - } - EditorGUILayout.Space(); - //EditorGUILayout.EndVertical(); - } - } - - public void AddAllToDataCollector( ref MasterNodeDataCollector dataCollector, TemplateIncludePragmaContainter nativesContainer ) - { - //List<AdditionalDirectiveContainer> list = m_additionalDirectives; - //int count = list.FindIndex( x => x.Origin.Equals( AdditionalContainerOrigin.Native ) ); - //for( int i = 0; i < count; i++ ) - //{ - // switch( list[ i ].LineType ) - // { - // case AdditionalLineType.Include: - // { - // string value = list[ i ].Value; - // if( !string.IsNullOrEmpty( value ) && - // !nativesContainer.HasInclude( value ) ) - // { - // dataCollector.AddToMisc( list[ i ].FormattedValue ); - // } - // } - // break; - // case AdditionalLineType.Define: - // { - // if( !string.IsNullOrEmpty( list[ i ].LineValue ) && - // !nativesContainer.HasDefine( list[ i ].LineValue ) ) - // { - // dataCollector.AddToMisc( list[ i ].FormattedValue ); - // } - // } - // break; - // case AdditionalLineType.Pragma: - // { - // if( !string.IsNullOrEmpty( list[ i ].LineValue ) && - // !nativesContainer.HasPragma( list[ i ].LineValue ) ) - // { - // dataCollector.AddToMisc( list[ i ].FormattedValue ); - // } - // } - // break; - // default: - // case AdditionalLineType.Custom: - // dataCollector.AddToMisc( list[ i ].LineValue ); - // break; - // } - //} - - AddToDataCollector( ref dataCollector, nativesContainer, false ); - AddToDataCollector( ref dataCollector, nativesContainer, true ); - } - - public void AddAllToDataCollector( ref MasterNodeDataCollector dataCollector ) - { - AddToDataCollector( ref dataCollector, false ); - AddToDataCollector( ref dataCollector, true ); - } - - void AddToDataCollector( ref MasterNodeDataCollector dataCollector, TemplateIncludePragmaContainter nativesContainer, bool fromSF ) - { - List<AdditionalDirectiveContainer> list = fromSF ? m_shaderFunctionDirectives : m_additionalDirectives; - int count = list.Count; - for( int i = 0; i < count; i++ ) - { - int orderIdx = fromSF ? 1 : ( i > m_nativeDirectivesIndex ? 1 : -1 ); - switch( list[ i ].LineType ) - { - case AdditionalLineType.Include: - { - string value = list[ i ].Value; - if( !string.IsNullOrEmpty( value ) && - !nativesContainer.HasInclude( value ) ) - { - dataCollector.AddToDirectives( list[ i ].FormattedValue, orderIdx ); - } - } - break; - case AdditionalLineType.Define: - { - if( !string.IsNullOrEmpty( list[ i ].LineValue ) && - !nativesContainer.HasDefine( list[ i ].LineValue ) ) - { - dataCollector.AddToDirectives( list[ i ].FormattedValue, orderIdx ); - } - } - break; - case AdditionalLineType.Pragma: - { - if( !string.IsNullOrEmpty( list[ i ].LineValue ) && - !nativesContainer.HasPragma( list[ i ].LineValue ) ) - { - dataCollector.AddToDirectives( list[ i ].FormattedValue, orderIdx ); - } - } - break; - default: - case AdditionalLineType.Custom: - dataCollector.AddToDirectives( list[ i ].LineValue, orderIdx ); - break; - } - } - } - - void AddToDataCollector( ref MasterNodeDataCollector dataCollector, bool fromSF ) - { - List<AdditionalDirectiveContainer> list = fromSF ? m_shaderFunctionDirectives : m_additionalDirectives; - int orderIdx = 1; - int count = list.Count; - for( int i = 0; i < count; i++ ) - { - switch( list[ i ].LineType ) - { - case AdditionalLineType.Include: - { - string value = list[ i ].FormattedValue; - if( !string.IsNullOrEmpty( value ) ) - { - dataCollector.AddToDirectives( value, orderIdx ); - } - } - break; - case AdditionalLineType.Define: - { - if( !string.IsNullOrEmpty( list[ i ].LineValue ) ) - { - dataCollector.AddToDirectives( list[ i ].FormattedValue, orderIdx ); - } - } - break; - case AdditionalLineType.Pragma: - { - if( !string.IsNullOrEmpty( list[ i ].LineValue ) ) - { - dataCollector.AddToDirectives( list[ i ].FormattedValue, orderIdx ); - } - } - break; - default: - case AdditionalLineType.Custom: - dataCollector.AddToDirectives( list[ i ].LineValue, orderIdx ); - break; - } - } - } - - public override void ReadFromString( ref uint index, ref string[] nodeParams ) - { - try - { - m_nativeDirectivesIndex = -1; - int count = Convert.ToInt32( nodeParams[ index++ ] ); - m_additionalDirectives.Clear(); - for( int i = 0; i < count; i++ ) - { - AdditionalLineType lineType = (AdditionalLineType)Enum.Parse( typeof( AdditionalLineType ), nodeParams[ index++ ] ); - string lineValue = nodeParams[ index++ ]; - AdditionalDirectiveContainer newItem = ScriptableObject.CreateInstance<AdditionalDirectiveContainer>(); - newItem.hideFlags = HideFlags.HideAndDontSave; - newItem.LineType = lineType; - newItem.LineValue = lineValue.Replace( Constants.SemiColonSeparator, ';' ); - if( UIUtils.CurrentShaderVersion() > 15607 ) - { - newItem.GUIDToggle = Convert.ToBoolean( nodeParams[ index++ ] ); - newItem.GUIDValue = nodeParams[ index++ ]; - if( newItem.GUIDToggle ) - { - newItem.LibObject = AssetDatabase.LoadAssetAtPath<TextAsset>( AssetDatabase.GUIDToAssetPath( newItem.GUIDValue ) ); - if( newItem.LibObject == null ) - { - Debug.LogWarning( "Include file not found with GUID " + newItem.GUIDValue ); - } - } - } - AdditionalContainerOrigin origin = AdditionalContainerOrigin.Custom; - if( UIUtils.CurrentShaderVersion() > 16902 ) - { - origin = (AdditionalContainerOrigin)Enum.Parse( typeof( AdditionalContainerOrigin ), nodeParams[ index++ ] ); - newItem.Origin = origin; - } - - m_additionalDirectives.Add( newItem ); - - if( origin == AdditionalContainerOrigin.Native ) - { - m_nativeDirectivesIndex = i; - } - } - AddNativeContainer(); - } - catch( Exception e ) - { - Debug.LogException( e ); - } - } - - public override void WriteToString( ref string nodeInfo ) - { - if( m_additionalDirectives.Count == 1 && m_additionalDirectives[ 0 ].Origin == AdditionalContainerOrigin.Native ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, 0 ); - return; - } - - IOUtils.AddFieldValueToString( ref nodeInfo, m_additionalDirectives.Count ); - for( int i = 0; i < m_additionalDirectives.Count; i++ ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_additionalDirectives[ i ].LineType ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_additionalDirectives[ i ].LineValue.Replace( ';', Constants.SemiColonSeparator ) ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_additionalDirectives[ i ].GUIDToggle ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_additionalDirectives[ i ].GUIDValue ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_additionalDirectives[ i ].Origin ); - } - } - - // read comment on m_directivesSaveItems declaration - public void UpdateSaveItemsFromDirectives() - { - bool foundNull = false; - m_directivesSaveItems.Clear(); - for( int i = 0; i < m_additionalDirectives.Count; i++ ) - { - if( m_additionalDirectives[ i ] != null ) - { - m_directivesSaveItems.Add( new AdditionalDirectiveContainerSaveItem( m_additionalDirectives[ i ] ) ); - } - else - { - foundNull = true; - } - } - - if( foundNull ) - { - m_additionalDirectives.RemoveAll( item => item == null ); - } - } - - public void CleanNullDirectives() - { - m_additionalDirectives.RemoveAll( item => item == null ); - } - - public void ResetDirectivesOrigin() - { - for( int i = 0; i < m_directivesSaveItems.Count; i++ ) - { - m_directivesSaveItems[ i ].Origin = AdditionalContainerOrigin.Custom; - } - } - - // read comment on m_directivesSaveItems declaration - public void UpdateDirectivesFromSaveItems() - { - if( m_directivesSaveItems.Count > 0 ) - { - for( int i = 0; i < m_additionalDirectives.Count; i++ ) - { - if( m_additionalDirectives[ i ] != null ) - ScriptableObject.DestroyImmediate( m_additionalDirectives[ i ] ); - } - - m_additionalDirectives.Clear(); - - for( int i = 0; i < m_directivesSaveItems.Count; i++ ) - { - AdditionalDirectiveContainer newItem = ScriptableObject.CreateInstance<AdditionalDirectiveContainer>(); - newItem.hideFlags = HideFlags.HideAndDontSave; - newItem.Init( m_directivesSaveItems[ i ] ); - m_additionalDirectives.Add( newItem ); - } - UpdateNativeIndex(); - //m_directivesSaveItems.Clear(); - } - } - - void UpdateNativeIndex() - { - m_nativeDirectivesIndex = -1; - int count = m_additionalDirectives.Count; - for( int i = 0; i < count; i++ ) - { - if( m_additionalDirectives[ i ].Origin == AdditionalContainerOrigin.Native ) - { - m_nativeDirectivesIndex = i; - break; - } - } - } - - public override void Destroy() - { - base.Destroy(); - - m_nativeDirectives.Clear(); - m_nativeDirectives = null; - - for( int i = 0; i < m_additionalDirectives.Count; i++ ) - { - ScriptableObject.DestroyImmediate( m_additionalDirectives[ i ] ); - } - - m_additionalDirectives.Clear(); - m_additionalDirectives = null; - - for( int i = 0; i < m_shaderFunctionDirectives.Count; i++ ) - { - ScriptableObject.DestroyImmediate( m_shaderFunctionDirectives[ i ] ); - } - - m_shaderFunctionDirectives.Clear(); - m_shaderFunctionDirectives = null; - - - m_propertyAdjustment = null; - m_reordableList = null; - } - - - public List<AdditionalDirectiveContainer> DirectivesList { get { return m_additionalDirectives; } } - public bool IsValid { get { return m_validData; } set { m_validData = value; } } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalDirectivesHelper.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalDirectivesHelper.cs.meta deleted file mode 100644 index 43fdc898..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalDirectivesHelper.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: c6b57deeb826a674f9715fab4dfb4cb1 -timeCreated: 1528278077 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalIncludesHelper.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalIncludesHelper.cs deleted file mode 100644 index 7d58666b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalIncludesHelper.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - public class TemplateAdditionalIncludesHelper : TemplateAdditionalParentHelper - { - public TemplateAdditionalIncludesHelper() : base( "Additional Includes" ) - { - m_helpBoxMessage = "Please add your includes without the #include \"\" keywords"; - } - - public override void AddToDataCollector( ref MasterNodeDataCollector dataCollector , TemplateIncludePragmaContainter nativesContainer ) - { - for( int i = 0; i < m_additionalItems.Count; i++ ) - { - if( !string.IsNullOrEmpty( m_additionalItems[ i ] ) && !nativesContainer.HasInclude( m_additionalItems[ i ] ) ) - dataCollector.AddToIncludes( -1, m_additionalItems[ i ] ); - } - - for( int i = 0; i < m_outsideItems.Count; i++ ) - { - if( !string.IsNullOrEmpty( m_outsideItems[ i ] ) && !nativesContainer.HasInclude( m_outsideItems[ i ] ) ) - dataCollector.AddToIncludes( -1, m_outsideItems[ i ] ); - } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalIncludesHelper.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalIncludesHelper.cs.meta deleted file mode 100644 index 9a454744..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalIncludesHelper.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 0ab4c474dfddce2429da08f56e651ed4 -timeCreated: 1520275148 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalParentHelper.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalParentHelper.cs deleted file mode 100644 index da765cca..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalParentHelper.cs +++ /dev/null @@ -1,193 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using System.Collections.Generic; -using UnityEditor; -using UnityEngine; - -namespace AmplifyShaderEditor -{ - [Serializable] - public class TemplateAdditionalParentHelper : TemplateModuleParent - { - private string NativeFoldoutStr = "Native"; - - protected string m_helpBoxMessage = string.Empty; - private const float ShaderKeywordButtonLayoutWidth = 15; - private ParentNode m_currentOwner; - - [SerializeField] - protected List<string> m_nativeItems = new List<string>(); - - [SerializeField] - protected bool m_nativeItemsFoldout = false; - - [SerializeField] - protected List<string> m_additionalItems = new List<string>(); - - [SerializeField] - protected List<string> m_outsideItems = new List<string>(); - - public TemplateAdditionalParentHelper( string moduleName ) : base( moduleName ) { } - public bool IsValid { set{ m_validData = value; } get{ return m_validData; } } - - public void FillNativeItems( List<string> nativeItems ) - { - m_nativeItems.Clear(); - m_nativeItems.AddRange( nativeItems ); - } - - public void Draw( ParentNode owner ) - { - m_currentOwner = owner; - bool foldout = owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedAdditionalDefines; - NodeUtils.DrawNestedPropertyGroup( ref foldout, m_moduleName, DrawMainBody, DrawButtons ); - owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedAdditionalDefines = foldout; - } - - public void CopyFrom( TemplateAdditionalParentHelper other ) - { - m_additionalItems.Clear(); - m_outsideItems.Clear(); - int otherAdditionalItemsCount = other.ItemsList.Count; - for( int i = 0; i < otherAdditionalItemsCount; i++ ) - { - m_additionalItems.Add( other.ItemsList[ i ] ); - } - - int otherOusideItemsCount = other.OutsideList.Count; - for( int i = 0; i < otherOusideItemsCount; i++ ) - { - m_outsideItems.Add( other.OutsideList[ i ] ); - } - } - - void DrawButtons() - { - EditorGUILayout.Separator(); - - // Add keyword - if( GUILayout.Button( string.Empty, UIUtils.PlusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) - { - m_additionalItems.Add( string.Empty ); - EditorGUI.FocusTextInControl( null ); - m_isDirty = true; - } - - //Remove keyword - if( GUILayout.Button( string.Empty, UIUtils.MinusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) - { - if( m_additionalItems.Count > 0 ) - { - m_additionalItems.RemoveAt( m_additionalItems.Count - 1 ); - EditorGUI.FocusTextInControl( null ); - } - m_isDirty = true; - } - } - void DrawNativeItems() - { - EditorGUILayout.Separator(); - EditorGUI.indentLevel++; - int count = m_nativeItems.Count; - for ( int i = 0; i < count; i++ ) - { - EditorGUILayout.LabelField( m_nativeItems[i] ); - } - EditorGUI.indentLevel--; - EditorGUILayout.Separator(); - } - void DrawMainBody() - { - EditorGUILayout.Separator(); - - if( m_nativeItems.Count > 0 ) - { - NodeUtils.DrawNestedPropertyGroup( ref m_nativeItemsFoldout, NativeFoldoutStr, DrawNativeItems ,4); - } - - int itemCount = m_additionalItems.Count; - int markedToDelete = -1; - for( int i = 0; i < itemCount; i++ ) - { - EditorGUILayout.BeginHorizontal(); - { - EditorGUI.BeginChangeCheck(); - m_additionalItems[ i ] = EditorGUILayout.TextField( m_additionalItems[ i ] ); - if( EditorGUI.EndChangeCheck() ) - { - m_additionalItems[ i ] = UIUtils.RemoveShaderInvalidCharacters( m_additionalItems[ i ] ); - m_isDirty = true; - } - - // Add new port - if( m_currentOwner.GUILayoutButton( string.Empty, UIUtils.PlusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) - { - m_additionalItems.Insert( i + 1, string.Empty ); - EditorGUI.FocusTextInControl( null ); - m_isDirty = true; - } - - //Remove port - if( m_currentOwner.GUILayoutButton( string.Empty, UIUtils.MinusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) - { - markedToDelete = i; - m_isDirty = true; - } - } - EditorGUILayout.EndHorizontal(); - } - - if( markedToDelete > -1 ) - { - if( m_additionalItems.Count > markedToDelete ) - { - m_additionalItems.RemoveAt( markedToDelete ); - EditorGUI.FocusTextInControl( null ); - } - } - EditorGUILayout.Separator(); - EditorGUILayout.HelpBox( m_helpBoxMessage, MessageType.Info ); - } - - public override void ReadFromString( ref uint index, ref string[] nodeParams ) - { - try - { - int count = Convert.ToInt32( nodeParams[ index++ ] ); - for( int i = 0; i < count; i++ ) - { - m_additionalItems.Add( nodeParams[ index++ ] ); - } - } - catch( Exception e ) - { - Debug.LogException( e ); - } - } - - public override void WriteToString( ref string nodeInfo ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_additionalItems.Count ); - for( int i = 0; i < m_additionalItems.Count; i++ ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_additionalItems[ i ] ); - } - } - - public virtual void AddToDataCollector( ref MasterNodeDataCollector dataCollector , TemplateIncludePragmaContainter nativesContainer ) { } - - public override void Destroy() - { - m_additionalItems.Clear(); - m_additionalItems = null; - m_currentOwner = null; - m_nativeItems.Clear(); - m_nativeItems = null; - } - - public List<string> ItemsList { get { return m_additionalItems; } set { m_additionalItems = value; } } - public List<string> OutsideList { get { return m_outsideItems; } set { m_outsideItems = value; } } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalParentHelper.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalParentHelper.cs.meta deleted file mode 100644 index 6d0983fe..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalParentHelper.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 5360ba11600eeb44786246ca70212e25 -timeCreated: 1520332262 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalPragmasHelper.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalPragmasHelper.cs deleted file mode 100644 index 3c08f1a0..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalPragmasHelper.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - public class TemplateAdditionalPragmasHelper : TemplateAdditionalParentHelper - { - public TemplateAdditionalPragmasHelper() : base( "Additional Pragmas" ) - { - m_helpBoxMessage = "Please add your pragmas without the #pragma keywords"; - } - - public override void AddToDataCollector( ref MasterNodeDataCollector dataCollector, TemplateIncludePragmaContainter nativesContainer ) - { - for( int i = 0; i < m_additionalItems.Count; i++ ) - { - if( !string.IsNullOrEmpty( m_additionalItems[ i ] ) && !nativesContainer.HasPragma( m_additionalItems[ i ] )) - dataCollector.AddToPragmas( -1, m_additionalItems[ i ] ); - } - - for( int i = 0; i < m_outsideItems.Count; i++ ) - { - if( !string.IsNullOrEmpty( m_outsideItems[ i ] ) && !nativesContainer.HasPragma( m_outsideItems[ i ] ) ) - dataCollector.AddToPragmas( -1, m_outsideItems[ i ] ); - } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalPragmasHelper.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalPragmasHelper.cs.meta deleted file mode 100644 index 4abd0233..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateAdditionalPragmasHelper.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: de89b62c2bd8eec4b915a0decba936fb -timeCreated: 1520275148 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateCodeSnippetBase.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateCodeSnippetBase.cs deleted file mode 100644 index ea717e62..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateCodeSnippetBase.cs +++ /dev/null @@ -1,102 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using UnityEngine; -using System.Collections.Generic; - -namespace AmplifyShaderEditor -{ - public enum TemplateCodeSnippetType - { - Toggle - }; - - - public enum TemplateCodeSnippetInfoIdx - { - Name = 0, - Type - }; - - [Serializable] - public class TemplateCodeSnippetElement - { - public string Id; - public string Snippet; - public TemplateCodeSnippetElement( string id, string snippet ) - { - Id = id; - Snippet = snippet; - } - } - - [Serializable] - public class TemplateCodeSnippetBase : ScriptableObject - { - [SerializeField] - private string m_nameId; - - [SerializeField] - private TemplateCodeSnippetType m_type; - - [SerializeField] - private List<TemplateCodeSnippetElement> m_elements = new List<TemplateCodeSnippetElement>(); - - public void Init( string nameId, TemplateCodeSnippetType type ) - { - m_nameId = nameId; - m_type = type; - } - - public void AddSnippet( TemplateCodeSnippetElement element ) - { - m_elements.Add( element ); - } - - public void Destroy() - { - for ( int i = 0; i < m_elements.Count; i++ ) - { - m_elements[ i ].Snippet = null; - } - m_elements.Clear(); - m_elements = null; - } - - public virtual void DrawProperties( ParentNode owner ) { } - public virtual bool CheckSnippet() { return true; } - - public void InsertSnippet( ref string shaderBody ) - { - bool insertSnippet = CheckSnippet(); - for ( int i = 0; i < m_elements.Count; i++ ) - { - shaderBody = shaderBody.Replace( m_elements[ i ].Id, ( insertSnippet ? m_elements[ i ].Snippet : string.Empty ) ); - } - } - public string NameId { get { return m_nameId; } } - public TemplateCodeSnippetType Type { get { return m_type; } } - public List<TemplateCodeSnippetElement> Elements { get { return m_elements; } } - } - - [Serializable] - public class TemplateCodeSnippetToggle : TemplateCodeSnippetBase - { - private const string Label = "Activate"; - [SerializeField] - private bool m_value = false; - - - public override bool CheckSnippet() - { - return m_value; - } - - public override void DrawProperties( ParentNode owner ) - { - m_value = owner.EditorGUILayoutToggle( Label, m_value ); - } - } - -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateCodeSnippetBase.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateCodeSnippetBase.cs.meta deleted file mode 100644 index 612a5536..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateCodeSnippetBase.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 5fc48fb872ce5e74aa913f987a025ea4 -timeCreated: 1495113330 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateColorMaskModule.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateColorMaskModule.cs deleted file mode 100644 index 31739972..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateColorMaskModule.cs +++ /dev/null @@ -1,184 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> -using System; -using UnityEngine; -using UnityEditor; - -namespace AmplifyShaderEditor -{ - [Serializable] - public class TemplateColorMaskModule : TemplateModuleParent - { - private const string ColorMaskOp = "ColorMask "; - private const string ColorMaskOff = "ColorMask RGBA"; - private GUIContent ColorMaskContent = new GUIContent( "Color Mask", "Sets color channel writing mask, turning all off makes the object completely invisible\nDefault: RGBA" ); - private readonly char[] m_colorMaskChar = { 'R', 'G', 'B', 'A' }; - - private GUIStyle m_leftToggleColorMask; - private GUIStyle m_middleToggleColorMask; - private GUIStyle m_rightToggleColorMask; - - public TemplateColorMaskModule() : base( "Color Mask" ) { } - - [SerializeField] - private bool[] m_colorMask = { true, true, true, true }; - - [SerializeField] - private InlineProperty m_inlineColorMask = new InlineProperty(); - - public void CopyFrom( TemplateColorMaskModule other, bool allData ) - { - if( allData ) - m_independentModule = other.IndependentModule; - - for( int i = 0; i < m_colorMask.Length; i++ ) - { - m_colorMask[ i ] = other.ColorMask[ i ]; - } - m_inlineColorMask.CopyFrom( other.InlineColorMask ); - } - - public void ConfigureFromTemplateData( TemplateColorMaskData data ) - { - bool newValidData = ( data.DataCheck == TemplateDataCheck.Valid ); - if( newValidData && m_validData != newValidData ) - { - m_independentModule = data.IndependentModule; - if( string.IsNullOrEmpty( data.InlineData ) ) - { - for( int i = 0; i < 4; i++ ) - { - m_colorMask[ i ] = data.ColorMaskData[ i ]; - } - m_inlineColorMask.ResetProperty(); - } - else - { - m_inlineColorMask.SetInlineByName( data.InlineData ); - } - } - - m_validData = newValidData; - } - - public override void Draw( UndoParentNode owner, bool style = true ) - { - EditorGUI.BeginChangeCheck(); - { - m_inlineColorMask.CustomDrawer( ref owner, DrawColorMaskControls, ColorMaskContent.text ); - } - - if( EditorGUI.EndChangeCheck() ) - { - m_isDirty = true; - } - } - - private void DrawColorMaskControls( UndoParentNode owner ) - { - if( m_leftToggleColorMask == null || m_leftToggleColorMask.normal.background == null ) - { - m_leftToggleColorMask = GUI.skin.GetStyle( "ButtonLeft" ); - } - - if( m_middleToggleColorMask == null || m_middleToggleColorMask.normal.background == null ) - { - m_middleToggleColorMask = GUI.skin.GetStyle( "ButtonMid" ); - } - - if( m_rightToggleColorMask == null || m_rightToggleColorMask.normal.background == null ) - { - m_rightToggleColorMask = GUI.skin.GetStyle( "ButtonRight" ); - } - - EditorGUILayout.BeginHorizontal(); - EditorGUILayout.LabelField( ColorMaskContent, GUILayout.Width( 90 ) ); - - m_colorMask[ 0 ] = owner.GUILayoutToggle( m_colorMask[ 0 ], "R", m_leftToggleColorMask ); - m_colorMask[ 1 ] = owner.GUILayoutToggle( m_colorMask[ 1 ], "G", m_middleToggleColorMask ); - m_colorMask[ 2 ] = owner.GUILayoutToggle( m_colorMask[ 2 ], "B", m_middleToggleColorMask ); - m_colorMask[ 3 ] = owner.GUILayoutToggle( m_colorMask[ 3 ], "A", m_rightToggleColorMask ); - - EditorGUILayout.EndHorizontal(); - } - - public override string GenerateShaderData( bool isSubShader ) - { - if( m_inlineColorMask.IsValid ) - return ColorMaskOp + m_inlineColorMask.GetValueOrProperty(); - - int count = 0; - string colorMask = string.Empty; - for( int i = 0; i < m_colorMask.Length; i++ ) - { - if( m_colorMask[ i ] ) - { - count++; - colorMask += m_colorMaskChar[ i ]; - } - } - - if( count != m_colorMask.Length ) - { - return ColorMaskOp + ( ( count == 0 ) ? "0" : colorMask ); - } - - return ColorMaskOff; - } - - public override void ReadFromString( ref uint index, ref string[] nodeParams ) - { - bool validDataOnMeta = m_validData; - if( UIUtils.CurrentShaderVersion() > TemplatesManager.MPShaderVersion ) - { - validDataOnMeta = Convert.ToBoolean( nodeParams[ index++ ] ); - } - - if( validDataOnMeta ) - { - for( int i = 0; i < m_colorMask.Length; i++ ) - { - m_colorMask[ i ] = Convert.ToBoolean( nodeParams[ index++ ] ); - } - - if( UIUtils.CurrentShaderVersion() > 15303 ) - { - m_inlineColorMask.ReadFromString( ref index, ref nodeParams ); - } - } - } - - public override void WriteToString( ref string nodeInfo ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_validData ); - if( m_validData ) - { - for( int i = 0; i < m_colorMask.Length; i++ ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_colorMask[ i ] ); - } - m_inlineColorMask.WriteToString( ref nodeInfo ); - } - } - - public bool[] ColorMask - { - get { return m_colorMask; } - set - { - m_colorMask = value; - m_inlineColorMask.Active = false; - } - } - - public override void Destroy() - { - m_leftToggleColorMask = null; - m_middleToggleColorMask = null; - m_rightToggleColorMask = null; - m_inlineColorMask = null; - } - - public InlineProperty InlineColorMask { get { return m_inlineColorMask; } } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateColorMaskModule.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateColorMaskModule.cs.meta deleted file mode 100644 index 8cb1fbbb..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateColorMaskModule.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: e1d9e34bd7946e247aa6d28b2859c6b1 -timeCreated: 1511259305 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateCullModeModule.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateCullModeModule.cs deleted file mode 100644 index fed77dc0..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateCullModeModule.cs +++ /dev/null @@ -1,125 +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] - public sealed class TemplateCullModeModule : TemplateModuleParent - { - private const string CullModeFormatStr = "Cull "; - - public TemplateCullModeModule() : base("Cull Mode"){ } - - private static readonly string CullModeStr = "Cull Mode"; - - [SerializeField] - private CullMode m_cullMode = CullMode.Back; - - [SerializeField] - private InlineProperty m_inlineCullMode = new InlineProperty(); - - public void CopyFrom( TemplateCullModeModule other , bool allData ) - { - if( allData ) - m_independentModule = other.IndependentModule; - - m_cullMode = other.CurrentCullMode; - m_inlineCullMode.CopyFrom( other.CullInlineProperty ); - } - - public void ConfigureFromTemplateData( TemplateCullModeData data ) - { - bool newValidData = ( data.DataCheck == TemplateDataCheck.Valid ); - - if( newValidData && m_validData != newValidData ) - { - m_independentModule = data.IndependentModule; - if( string.IsNullOrEmpty( data.InlineData ) ) - { - m_cullMode = data.CullModeData; - m_inlineCullMode.IntValue = (int)m_cullMode; - m_inlineCullMode.ResetProperty(); - } - else - { - m_inlineCullMode.SetInlineByName( data.InlineData ); - } - } - - m_validData = newValidData; - } - - public override void Draw( UndoParentNode owner, bool style = true ) - { - EditorGUI.BeginChangeCheck(); - //m_cullMode = (CullMode)owner.EditorGUILayoutEnumPopup( CullModeStr, m_cullMode ); - m_inlineCullMode.CustomDrawer( ref owner, ( x ) => { m_cullMode = (CullMode)owner.EditorGUILayoutEnumPopup( CullModeStr, m_cullMode ); }, CullModeStr ); - if( EditorGUI.EndChangeCheck() ) - { - m_inlineCullMode.IntValue = (int)m_cullMode; - m_isDirty = true; - } - } - - public override void ReadFromString( ref uint index, ref string[] nodeParams ) - { - bool validDataOnMeta = m_validData; - if( UIUtils.CurrentShaderVersion() > TemplatesManager.MPShaderVersion ) - { - validDataOnMeta = Convert.ToBoolean( nodeParams[ index++ ] ); - } - - if( validDataOnMeta ) - { - if( UIUtils.CurrentShaderVersion() < 15304 ) - { - m_cullMode = (CullMode)Enum.Parse( typeof( CullMode ), nodeParams[ index++ ] ); - m_inlineCullMode.IntValue = (int)m_cullMode; - } - else - { - m_inlineCullMode.ReadFromString( ref index, ref nodeParams ); - m_cullMode = (CullMode)m_inlineCullMode.IntValue; - } - } - } - - public override void WriteToString( ref string nodeInfo ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_validData ); - if( m_validData ) - { - //IOUtils.AddFieldValueToString( ref nodeInfo, m_cullMode ); - m_inlineCullMode.WriteToString( ref nodeInfo ); - } - } - - public override string GenerateShaderData( bool isSubShader ) - { - //return CullModeFormatStr + m_cullMode.ToString(); - return CullModeFormatStr + m_inlineCullMode.GetValueOrProperty( m_cullMode.ToString()); - } - - public override void Destroy() - { - base.Destroy(); - m_inlineCullMode = null; - } - - public CullMode CurrentCullMode - { - get { return m_cullMode; } - set - { - m_cullMode = value; - m_inlineCullMode.IntValue = (int)value; - m_inlineCullMode.Active = false; - } - } - public InlineProperty CullInlineProperty { get { return m_inlineCullMode; } } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateCullModeModule.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateCullModeModule.cs.meta deleted file mode 100644 index 7b3fa309..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateCullModeModule.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: dcbce53ba2eeecd4a8f2c7f5f9a43b7a -timeCreated: 1511186525 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateData.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateData.cs deleted file mode 100644 index f3c7b895..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateData.cs +++ /dev/null @@ -1,1178 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -// THIS FILE IS DEPRECATED AND SHOULD NOT BE USED - -using System; -using UnityEngine; -using UnityEditor; -using System.Collections.Generic; -using System.Text.RegularExpressions; - -namespace AmplifyShaderEditor -{ - [Serializable] - public class TemplateDataContainer - { - public int UNITY_VERSION = -1; - public TemplateData TemplateDataRef; - } - - [Serializable] - public class VertexDataContainer - { - [SerializeField] - private List<TemplateVertexData> m_vertexData; - - [SerializeField] - private string m_vertexDataId = string.Empty; - - [SerializeField] - private int m_vertexDataStartIdx = -1; - - public void Reload() - { - if( m_vertexData != null ) - { - m_vertexData.Clear(); - } - } - - public void Destroy() - { - if( m_vertexData != null ) - { - m_vertexData.Clear(); - m_vertexData = null; - } - } - - - public List<TemplateVertexData> VertexData { get { return m_vertexData; } set { m_vertexData = value; } } - public string VertexDataId { get { return m_vertexDataId; } set { m_vertexDataId = value; } } - public int VertexDataStartIdx { get { return m_vertexDataStartIdx; } set { m_vertexDataStartIdx = value; } } - } - - [Serializable] - public sealed class TemplateData : TemplateDataParent - { - [SerializeField] - private string m_templateBody = string.Empty; - - [SerializeField] - private string m_shaderNameId = string.Empty; - - [SerializeField] - private List<TemplateProperty> m_propertyList = new List<TemplateProperty>(); - private Dictionary<string, TemplateProperty> m_propertyDict = new Dictionary<string, TemplateProperty>(); - - [SerializeField] - private List<TemplateInputData> m_inputDataList = new List<TemplateInputData>(); - private Dictionary<int, TemplateInputData> m_inputDataDict = new Dictionary<int, TemplateInputData>(); - - //[SerializeField] - //private List<TemplateCodeSnippetBase> m_snippetElementsList = new List<TemplateCodeSnippetBase>(); - //private Dictionary<string, TemplateCodeSnippetBase> m_snippetElementsDict = new Dictionary<string, TemplateCodeSnippetBase>(); - - [SerializeField] - private List<TemplateLocalVarData> m_localVarsList = new List<TemplateLocalVarData>(); - - [SerializeField] - private VertexDataContainer m_vertexDataContainer = new VertexDataContainer(); - - [SerializeField] - private TemplateInterpData m_interpolatorDataContainer; - - [SerializeField] - private List<TemplateShaderPropertyData> m_availableShaderProperties = new List<TemplateShaderPropertyData>(); - - [SerializeField] - private TemplateFunctionData m_vertexFunctionData; - - [SerializeField] - private TemplateFunctionData m_fragmentFunctionData; - - [SerializeField] - private TemplateBlendData m_blendData = new TemplateBlendData(); - - [SerializeField] - private TemplateCullModeData m_cullModeData = new TemplateCullModeData(); - - [SerializeField] - private TemplateColorMaskData m_colorMaskData = new TemplateColorMaskData(); - - [SerializeField] - private TemplateStencilData m_stencilData = new TemplateStencilData(); - - [SerializeField] - private TemplateDepthData m_depthData = new TemplateDepthData(); - - [SerializeField] - private TemplateTagsModuleData m_tagData = new TemplateTagsModuleData(); - - public TemplateData() - { - m_templateType = TemplateDataType.LegacySinglePass; - } - - public TemplateData( string name ) - { - m_templateType = TemplateDataType.LegacySinglePass; - Name = name; - } - - public TemplateData( string name, string guid ) - { - m_templateType = TemplateDataType.LegacySinglePass; - m_communityTemplate = false; - if( !string.IsNullOrEmpty( guid ) ) - { - string datapath = AssetDatabase.GUIDToAssetPath( guid ); - if( string.IsNullOrEmpty( datapath ) ) - { - m_isValid = false; - return; - } - - string body = string.Empty; - try - { - body = IOUtils.LoadTextFileFromDisk( datapath ); - } - catch( Exception e ) - { - Debug.LogException( e ); - m_isValid = false; - return; - } - - if( !string.IsNullOrEmpty( body ) ) - { - LoadTemplateBody( body ); - Name = string.IsNullOrEmpty( name ) ? m_defaultShaderName : name; - m_guid = guid; - } - } - } - - public TemplateData( string name, string guid, string body ) - { - m_templateType = TemplateDataType.LegacySinglePass; - m_communityTemplate = true; - if( !string.IsNullOrEmpty( body ) ) - { - LoadTemplateBody( body ); - Name = string.IsNullOrEmpty( name ) ? m_defaultShaderName : name; - m_guid = guid; - } - } - - public override bool Reload() - { - if( m_vertexDataContainer != null ) - { - m_vertexDataContainer.Reload(); - } - - if( m_interpolatorDataContainer != null ) - { - m_interpolatorDataContainer.Destroy(); - } - - if( m_availableShaderProperties != null ) - { - m_availableShaderProperties.Clear(); - } - - if( m_propertyDict != null ) - { - m_propertyDict.Clear(); - } - - if( m_propertyList != null ) - { - m_propertyList.Clear(); - } - - if( m_inputDataDict != null ) - { - m_inputDataDict.Clear(); - } - - if( m_inputDataList != null ) - { - m_inputDataList.Clear(); - } - - if( m_localVarsList != null ) - { - m_localVarsList.Clear(); - } - - //if( m_snippetElementsDict != null ) - //{ - // m_snippetElementsDict.Clear(); - //} - - //if( m_snippetElementsList != null ) - //{ - // for( int i = 0; i < m_snippetElementsList.Count; i++ ) - // { - // GameObject.DestroyImmediate( m_snippetElementsList[ i ] ); - // m_snippetElementsList[ i ] = null; - // } - // m_snippetElementsList.Clear(); - //} - - string datapath = AssetDatabase.GUIDToAssetPath( m_guid ); - string body = string.Empty; - try - { - body = IOUtils.LoadTextFileFromDisk( datapath ); - body = body.Replace( "\r\n", "\n" ); - } - catch( Exception e ) - { - Debug.LogException( e ); - m_isValid = false; - } - LoadTemplateBody( body ); - if( m_communityTemplate ) - { - Name = m_defaultShaderName; - } - return true; - } - - void LoadTemplateBody( string body ) - { - - m_templateBody = body.Replace( "\r\n", "\n" ); ; - - if( m_templateBody.IndexOf( TemplatesManager.TemplateShaderNameBeginTag ) < 0 ) - { - m_isValid = false; - return; - } - - //Fetching common tags - FetchCommonTags(); - - //Fetch function code areas - FetchCodeAreas( TemplatesManager.TemplateVertexCodeBeginArea, MasterNodePortCategory.Vertex ); - FetchCodeAreas( TemplatesManager.TemplateFragmentCodeBeginArea, MasterNodePortCategory.Fragment ); - - //Fetching inputs - FetchInputs( MasterNodePortCategory.Fragment ); - FetchInputs( MasterNodePortCategory.Vertex ); - - - //Fetch local variables must be done after fetching code areas as it needs them to see is variable is on vertex or fragment - TemplateHelperFunctions.FetchLocalVars( m_templateBody, ref m_localVarsList, m_vertexFunctionData, m_fragmentFunctionData ); - - //Fetch snippets - } - - void FetchSubShaderProperties() - { - Match match = Regex.Match( m_templateBody, @"Pass\s*{" ); - if( match.Groups.Count == 0 ) - { - return; - } - - int beginSubShader = m_templateBody.IndexOf( "SubShader" ); - int endSubShader = match.Groups[ 0 ].Index; - if( beginSubShader > 0 && endSubShader > 0 && endSubShader > beginSubShader ) - { - // ADD A PLACE TO INSERT GRAB PASSES - int passIndex = m_templateBody.IndexOf( TemplatesManager.TemplatePassTag ); - if( passIndex < 0 ) - { - int currIdx = endSubShader - 1; - string identation = string.Empty; - for( ; currIdx > 0; currIdx-- ) - { - if( m_templateBody[ currIdx ] != '\n' ) - { - identation = m_templateBody[ currIdx ] + identation; - } - else - { - identation = m_templateBody[ currIdx ] + identation; - break; - } - } - if( currIdx > 0 ) - { - m_templateBody = m_templateBody.Insert( currIdx, identation + TemplatesManager.TemplatePassTag ); - } - } - - // GET ALL THE MODULES - string subBody = m_templateBody.Substring( beginSubShader, endSubShader - beginSubShader ); - //CULL MODE - { - int cullIdx = subBody.IndexOf( "Cull" ); - if( cullIdx > 0 ) - { - int end = subBody.IndexOf( TemplatesManager.TemplateNewLine, cullIdx ); - string cullParams = subBody.Substring( cullIdx, end - cullIdx ); - m_cullModeData.CullModeId = cullParams; - TemplateHelperFunctions.CreateCullMode( cullParams, ref m_cullModeData ); - if( m_cullModeData.DataCheck == TemplateDataCheck.Valid ) - AddId( cullParams, false, string.Empty ); - } - } - //COLOR MASK - { - int colorMaskIdx = subBody.IndexOf( "ColorMask" ); - if( colorMaskIdx > 0 ) - { - int end = subBody.IndexOf( TemplatesManager.TemplateNewLine, colorMaskIdx ); - string colorMaskParams = subBody.Substring( colorMaskIdx, end - colorMaskIdx ); - m_colorMaskData.ColorMaskId = colorMaskParams; - TemplateHelperFunctions.CreateColorMask( colorMaskParams, ref m_colorMaskData ); - if( m_colorMaskData.DataCheck == TemplateDataCheck.Valid ) - AddId( colorMaskParams, false ); - } - } - //BlEND MODE - { - int blendModeIdx = subBody.IndexOf( "Blend" ); - if( blendModeIdx > 0 ) - { - int end = subBody.IndexOf( TemplatesManager.TemplateNewLine, blendModeIdx ); - string blendParams = subBody.Substring( blendModeIdx, end - blendModeIdx ); - m_blendData.BlendModeId = blendParams; - TemplateHelperFunctions.CreateBlendMode( blendParams, ref m_blendData ); - if( m_blendData.ValidBlendMode ) - { - AddId( blendParams, false ); - } - } - } - //BLEND OP - { - int blendOpIdx = subBody.IndexOf( "BlendOp" ); - if( blendOpIdx > 0 ) - { - int end = subBody.IndexOf( TemplatesManager.TemplateNewLine, blendOpIdx ); - string blendOpParams = subBody.Substring( blendOpIdx, end - blendOpIdx ); - BlendData.BlendOpId = blendOpParams; - TemplateHelperFunctions.CreateBlendOp( blendOpParams, ref m_blendData ); - if( m_blendData.ValidBlendOp ) - { - AddId( blendOpParams, false ); - } - } - - m_blendData.DataCheck = ( m_blendData.ValidBlendMode || m_blendData.ValidBlendOp ) ? TemplateDataCheck.Valid : TemplateDataCheck.Invalid; - } - - //STENCIL - { - int stencilIdx = subBody.IndexOf( "Stencil" ); - if( stencilIdx > -1 ) - { - int stencilEndIdx = subBody.IndexOf( "}", stencilIdx ); - if( stencilEndIdx > 0 ) - { - string stencilParams = subBody.Substring( stencilIdx, stencilEndIdx + 1 - stencilIdx ); - m_stencilData.StencilBufferId = stencilParams; - TemplateHelperFunctions.CreateStencilOps( stencilParams, ref m_stencilData ); - if( m_stencilData.DataCheck == TemplateDataCheck.Valid ) - { - AddId( stencilParams, true ); - } - } - } - } - - //ZWRITE - { - int zWriteOpIdx = subBody.IndexOf( "ZWrite" ); - if( zWriteOpIdx > -1 ) - { - int zWriteEndIdx = subBody.IndexOf( TemplatesManager.TemplateNewLine, zWriteOpIdx ); - if( zWriteEndIdx > 0 ) - { - m_depthData.ZWriteModeId = subBody.Substring( zWriteOpIdx, zWriteEndIdx + 1 - zWriteOpIdx ); - TemplateHelperFunctions.CreateZWriteMode( m_depthData.ZWriteModeId, ref m_depthData ); - if( m_depthData.DataCheck == TemplateDataCheck.Valid ) - { - AddId( m_depthData.ZWriteModeId, true ); - } - } - } - } - - //ZTEST - { - int zTestOpIdx = subBody.IndexOf( "ZTest" ); - if( zTestOpIdx > -1 ) - { - int zTestEndIdx = subBody.IndexOf( TemplatesManager.TemplateNewLine, zTestOpIdx ); - if( zTestEndIdx > 0 ) - { - m_depthData.ZTestModeId = subBody.Substring( zTestOpIdx, zTestEndIdx + 1 - zTestOpIdx ); - TemplateHelperFunctions.CreateZTestMode( m_depthData.ZTestModeId, ref m_depthData ); - if( m_depthData.DataCheck == TemplateDataCheck.Valid ) - { - AddId( m_depthData.ZTestModeId, true ); - } - } - } - } - - //ZOFFSET - { - int zOffsetIdx = subBody.IndexOf( "Offset" ); - if( zOffsetIdx > -1 ) - { - int zOffsetEndIdx = subBody.IndexOf( TemplatesManager.TemplateNewLine, zOffsetIdx ); - if( zOffsetEndIdx > 0 ) - { - m_depthData.OffsetId = subBody.Substring( zOffsetIdx, zOffsetEndIdx + 1 - zOffsetIdx ); - TemplateHelperFunctions.CreateZOffsetMode( m_depthData.OffsetId, ref m_depthData ); - if( m_depthData.DataCheck == TemplateDataCheck.Valid ) - { - AddId( m_depthData.OffsetId, true ); - } - } - } - - m_depthData.SetDataCheck(); - } - - //TAGS - { - int tagsIdx = subBody.IndexOf( "Tags" ); - if( tagsIdx > -1 ) - { - int tagsEndIdx = subBody.IndexOf( "}", tagsIdx ); - if( tagsEndIdx > -1 ) - { - m_tagData.Reset(); - m_tagData.TagsId = subBody.Substring( tagsIdx, tagsEndIdx + 1 - tagsIdx ); - TemplateHelperFunctions.CreateTags( ref m_tagData, true ); - m_tagData.DataCheck = TemplateDataCheck.Valid; - AddId( m_tagData.TagsId, false ); - } - else - { - m_tagData.DataCheck = TemplateDataCheck.Invalid; - } - } - else - { - m_tagData.DataCheck = TemplateDataCheck.Invalid; - } - } - } - } - - void FetchCommonTags() - { - // Name - try - { - int nameBegin = m_templateBody.IndexOf( TemplatesManager.TemplateShaderNameBeginTag ); - if( nameBegin < 0 ) - { - // Not a template - return; - } - - int nameEnd = m_templateBody.IndexOf( TemplatesManager.TemplateFullEndTag, nameBegin ); - int defaultBegin = nameBegin + TemplatesManager.TemplateShaderNameBeginTag.Length; - int defaultLength = nameEnd - defaultBegin; - m_defaultShaderName = m_templateBody.Substring( defaultBegin, defaultLength ); - int[] nameIdx = m_defaultShaderName.AllIndexesOf( "\"" ); - nameIdx[ 0 ] += 1; // Ignore the " character from the string - m_defaultShaderName = m_defaultShaderName.Substring( nameIdx[ 0 ], nameIdx[ 1 ] - nameIdx[ 0 ] ); - m_shaderNameId = m_templateBody.Substring( nameBegin, nameEnd + TemplatesManager.TemplateFullEndTag.Length - nameBegin ); - AddId( m_shaderNameId, false ); - - } - catch( Exception e ) - { - Debug.LogException( e ); - m_isValid = false; - } - - FetchSubShaderProperties(); - // Vertex Data - { - int vertexDataTagBegin = m_templateBody.IndexOf( TemplatesManager.TemplateVertexDataTag ); - if( vertexDataTagBegin > -1 ) - { - m_vertexDataContainer.VertexDataStartIdx = vertexDataTagBegin; - int vertexDataTagEnd = m_templateBody.IndexOf( TemplatesManager.TemplateEndOfLine, vertexDataTagBegin ); - m_vertexDataContainer.VertexDataId = m_templateBody.Substring( vertexDataTagBegin, vertexDataTagEnd + TemplatesManager.TemplateEndOfLine.Length - vertexDataTagBegin ); - int dataBeginIdx = m_templateBody.LastIndexOf( '{', vertexDataTagBegin, vertexDataTagBegin ); - string vertexData = m_templateBody.Substring( dataBeginIdx + 1, vertexDataTagBegin - dataBeginIdx ); - - int parametersBegin = vertexDataTagBegin + TemplatesManager.TemplateVertexDataTag.Length; - string parameters = m_templateBody.Substring( parametersBegin, vertexDataTagEnd - parametersBegin ); - m_vertexDataContainer.VertexData = TemplateHelperFunctions.CreateVertexDataList( vertexData, parameters ); - AddId( m_vertexDataContainer.VertexDataId ); - } - } - - // Available interpolators - try - { - int interpDataBegin = m_templateBody.IndexOf( TemplatesManager.TemplateInterpolatorBeginTag ); - if( interpDataBegin > -1 ) - { - int interpDataEnd = m_templateBody.IndexOf( TemplatesManager.TemplateEndOfLine, interpDataBegin ); - string interpDataId = m_templateBody.Substring( interpDataBegin, interpDataEnd + TemplatesManager.TemplateEndOfLine.Length - interpDataBegin ); - - int dataBeginIdx = m_templateBody.LastIndexOf( '{', interpDataBegin, interpDataBegin ); - string interpData = m_templateBody.Substring( dataBeginIdx + 1, interpDataBegin - dataBeginIdx ); - - m_interpolatorDataContainer = TemplateHelperFunctions.CreateInterpDataList( interpData, interpDataId, 8 ); - m_interpolatorDataContainer.InterpDataId = interpDataId; - m_interpolatorDataContainer.InterpDataStartIdx = interpDataBegin; - AddId( interpDataId ); - } - } - catch( Exception e ) - { - Debug.LogException( e ); - m_isValid = false; - } - - - try - { - Dictionary<string, TemplateShaderPropertyData> duplicatesHelper = new Dictionary<string, TemplateShaderPropertyData>(); - m_availableShaderProperties = new List<TemplateShaderPropertyData>(); - - // Common Tags - for( int i = 0; i < TemplatesManager.CommonTags.Length; i++ ) - { - int idx = m_templateBody.IndexOf( TemplatesManager.CommonTags[ i ].Id ); - if( idx > -1 ) - { - string currentId = TemplatesManager.CommonTags[ i ].Id; - - TemplateCommonTagId commonTagId = (TemplateCommonTagId)i; - switch( commonTagId ) - { - // Properties - case TemplateCommonTagId.Property: - { - TemplateHelperFunctions.CreateShaderPropertiesList( m_templateBody.Substring( 0, idx + TemplatesManager.CommonTags[ i ].Id.Length ), ref m_availableShaderProperties, ref duplicatesHelper ); - } - break; - // Globals - case TemplateCommonTagId.Global: - { - TemplateHelperFunctions.CreateShaderGlobalsList( m_templateBody.Substring( 0, idx + TemplatesManager.CommonTags[ i ].Id.Length ), ref m_availableShaderProperties, ref duplicatesHelper ); - } - break; - - //Tags - //case TemplateCommonTagId.Tag: - //{ - // m_propertyList[ m_propertyList.Count - 1 ].Indentation = " "; - //} - //break; - //case TemplateCommonTagId.CullMode: - //{ - // int newId = idx + TemplatesManager.CommonTags[ i ].Id.Length; - // int end = m_templateBody.IndexOf( TemplatesManager.TemplateNewLine, newId ); - // string cullParams = m_templateBody.Substring( newId, end - newId ); - // currentId = m_templateBody.Substring( idx, end - idx ); - // m_cullModeData.CullModeId = currentId; - // TemplateHelperFunctions.CreateCullMode( cullParams, ref m_cullModeData ); - //} - //break; - //Blend Mode - //case TemplateCommonTagId.BlendMode: - //{ - // int newId = idx + TemplatesManager.CommonTags[ i ].Id.Length; - // int end = m_templateBody.IndexOf( TemplatesManager.TemplateNewLine, newId ); - // string blendParams = m_templateBody.Substring( newId, end - newId ); - // currentId = m_templateBody.Substring( idx, end - idx ); - // m_blendData.BlendModeId = currentId; - // TemplateHelperFunctions.CreateBlendMode( blendParams, ref m_blendData ); - //}break; - //case TemplateCommonTagId.BlendOp: - //{ - // int newId = idx + TemplatesManager.CommonTags[ i ].Id.Length; - // int end = m_templateBody.IndexOf( TemplatesManager.TemplateNewLine, newId ); - // currentId = m_templateBody.Substring( idx, end - idx ); - // BlendData.BlendOpId = currentId; - // TemplateHelperFunctions.CreateBlendOp( m_templateBody.Substring( newId, end - newId ), ref m_blendData ); - //}break; - //case TemplateCommonTagId.ColorMask: - //{ - // int newId = idx + TemplatesManager.CommonTags[ i ].Id.Length; - // int end = m_templateBody.IndexOf( TemplatesManager.TemplateNewLine, newId ); - // string colorMaskParams = m_templateBody.Substring( newId, end - newId ); - // currentId = m_templateBody.Substring( idx, end - idx ); - // m_colorMaskData.ColorMaskId = currentId; - // TemplateHelperFunctions.CreateColorMask( colorMaskParams, ref m_colorMaskData ); - //} - //break; - //case TemplateCommonTagId.StencilOp: - //{ - // int id = m_templateBody.LastIndexOf( "Stencil" ); - // if( id > -1 ) - // { - // string stencilParams = m_templateBody.Substring( id, idx - id ); - // currentId = stencilParams + TemplatesManager.TemplateStencilOpTag; - // m_stencilData.StencilBufferId = currentId; - // TemplateHelperFunctions.CreateStencilOps( stencilParams, ref m_stencilData ); - // } - - //} - //break; - default: - break; - } - - //AddId( TemplatesManager.CommonTags[ i ] ); - AddId( currentId, TemplatesManager.CommonTags[ i ].SearchIndentation, TemplatesManager.CommonTags[ i ].CustomIndentation ); - } - } - - duplicatesHelper.Clear(); - duplicatesHelper = null; - } - catch( Exception e ) - { - Debug.LogException( e ); - m_isValid = false; - } - } - - void FetchCodeAreas( string begin, MasterNodePortCategory category ) - { - int areaBeginIndexes = m_templateBody.IndexOf( begin ); - - if( areaBeginIndexes > -1 ) - { - int beginIdx = areaBeginIndexes + begin.Length; - int endIdx = m_templateBody.IndexOf( TemplatesManager.TemplateEndOfLine, beginIdx ); - int length = endIdx - beginIdx; - - string parameters = m_templateBody.Substring( beginIdx, length ); - - string[] parametersArr = parameters.Split( IOUtils.FIELD_SEPARATOR ); - - string id = m_templateBody.Substring( areaBeginIndexes, endIdx + TemplatesManager.TemplateEndOfLine.Length - areaBeginIndexes ); - string inParameters = parametersArr[ 0 ]; - string outParameters = ( parametersArr.Length > 1 ) ? parametersArr[ 1 ] : string.Empty; - if( category == MasterNodePortCategory.Fragment ) - { - m_fragmentFunctionData = new TemplateFunctionData(-1, string.Empty, id, areaBeginIndexes, inParameters, outParameters, category ); - } - else - { - m_vertexFunctionData = new TemplateFunctionData( -1, string.Empty,id, areaBeginIndexes, inParameters, outParameters, category ); - } - AddId( id, true ); - } - } - - void FetchInputs( MasterNodePortCategory portCategory ) - { - string beginTag = ( portCategory == MasterNodePortCategory.Fragment ) ? TemplatesManager.TemplateInputsFragBeginTag : TemplatesManager.TemplateInputsVertBeginTag; - int[] inputBeginIndexes = m_templateBody.AllIndexesOf( beginTag ); - if( inputBeginIndexes != null && inputBeginIndexes.Length > 0 ) - { - for( int i = 0; i < inputBeginIndexes.Length; i++ ) - { - int inputEndIdx = m_templateBody.IndexOf( TemplatesManager.TemplateEndSectionTag, inputBeginIndexes[ i ] ); - int defaultValueBeginIdx = inputEndIdx + TemplatesManager.TemplateEndSectionTag.Length; - int endLineIdx = m_templateBody.IndexOf( TemplatesManager.TemplateFullEndTag, defaultValueBeginIdx ); - - string defaultValue = m_templateBody.Substring( defaultValueBeginIdx, endLineIdx - defaultValueBeginIdx ); - string tagId = m_templateBody.Substring( inputBeginIndexes[ i ], endLineIdx + TemplatesManager.TemplateFullEndTag.Length - inputBeginIndexes[ i ] ); - - int beginIndex = inputBeginIndexes[ i ] + beginTag.Length; - int length = inputEndIdx - beginIndex; - string inputData = m_templateBody.Substring( beginIndex, length ); - string[] inputDataArray = inputData.Split( IOUtils.FIELD_SEPARATOR ); - if( inputDataArray != null && inputDataArray.Length > 0 ) - { - try - { - string portName = inputDataArray[ (int)TemplatePortIds.Name ]; - WirePortDataType dataType = (WirePortDataType)Enum.Parse( typeof( WirePortDataType ), inputDataArray[ (int)TemplatePortIds.DataType ].ToUpper() ); - - int portUniqueIDArrIdx = (int)TemplatePortIds.UniqueId; - int portUniqueId = ( portUniqueIDArrIdx < inputDataArray.Length ) ? Convert.ToInt32( inputDataArray[ portUniqueIDArrIdx ] ) : -1; - if( portUniqueId < 0 ) - portUniqueId = m_inputDataList.Count; - - int portOrderArrayIdx = (int)TemplatePortIds.OrderId; - int portOrderId = ( portOrderArrayIdx < inputDataArray.Length ) ? Convert.ToInt32( inputDataArray[ portOrderArrayIdx ] ) : -1; - if( portOrderId < 0 ) - portOrderId = m_inputDataList.Count; - - AddInput( inputBeginIndexes[ i ], tagId, portName, defaultValue, dataType, portCategory, portUniqueId, portOrderId ); - } - catch( Exception e ) - { - Debug.LogException( e ); - } - } - } - } - } - - //void FetchSnippets() - //{ - // int[] codeSnippetAttribBeginIndexes = m_templateBody.AllIndexesOf( TemplatesManager.TemplateCodeSnippetAttribBegin ); - // int[] codeSnippetAttribEndIndexes = m_templateBody.AllIndexesOf( TemplatesManager.TemplateCodeSnippetAttribEnd ); - // int[] codeSnippetEndIndexes = m_templateBody.AllIndexesOf( TemplatesManager.TemplateCodeSnippetEnd ); - - // if( codeSnippetAttribBeginIndexes != null && codeSnippetAttribBeginIndexes.Length > 0 && - // codeSnippetAttribEndIndexes != null && codeSnippetAttribEndIndexes.Length > 0 && - // codeSnippetEndIndexes != null && codeSnippetEndIndexes.Length > 0 && - // codeSnippetEndIndexes.Length == codeSnippetAttribBeginIndexes.Length && - // codeSnippetAttribBeginIndexes.Length == codeSnippetAttribEndIndexes.Length ) - // { - // for( int i = 0; i < codeSnippetAttribBeginIndexes.Length; i++ ) - // { - // // get attributes - // int startAttribIndex = codeSnippetAttribBeginIndexes[ i ] + TemplatesManager.TemplateCodeSnippetAttribBegin.Length; - // int lengthAttrib = codeSnippetAttribEndIndexes[ i ] - startAttribIndex; - // string snippetAttribs = m_templateBody.Substring( startAttribIndex, lengthAttrib ); - // string[] snippetAttribsArr = snippetAttribs.Split( IOUtils.FIELD_SEPARATOR ); - // if( snippetAttribsArr != null && snippetAttribsArr.Length > 0 ) - // { - // string attribName = snippetAttribsArr[ (int)TemplateCodeSnippetInfoIdx.Name ]; - // TemplateCodeSnippetType attribType = (TemplateCodeSnippetType)Enum.Parse( typeof( TemplateCodeSnippetType ), snippetAttribsArr[ (int)TemplateCodeSnippetInfoIdx.Type ] ); - // if( m_snippetElementsDict.ContainsKey( attribName ) ) - // { - // if( m_snippetElementsDict[ attribName ].Type != attribType ) - // { - // if( DebugConsoleWindow.DeveloperMode ) - // Debug.LogWarning( "Found incompatible types for snippet " + attribName ); - // } - // } - // else - // { - // switch( attribType ) - // { - // case TemplateCodeSnippetType.Toggle: - // { - // //Register must be done by first instantiang the correct type and register it on both containers - // //Overrides don't work if we use the container reference into the other - // TemplateCodeSnippetToggle newSnippet = ScriptableObject.CreateInstance<TemplateCodeSnippetToggle>(); - // newSnippet.Init( attribName, attribType ); - // m_snippetElementsDict.Add( attribName, newSnippet ); - // m_snippetElementsList.Add( newSnippet ); - // } - // break; - // } - - // } - // // Add initial tag indentation - // int indentationIndex = codeSnippetAttribBeginIndexes[ i ]; - // int lengthAdjust = 0; - // for( ; indentationIndex > 0; indentationIndex--, lengthAdjust++ ) - // { - // if( m_templateBody[ indentationIndex ] == TemplatesManager.TemplateNewLine ) - // { - // indentationIndex += 1; - // lengthAdjust -= 1; - // break; - // } - // } - - // if( indentationIndex > 0 ) - // { - // string snippetId = m_templateBody.Substring( indentationIndex, - // codeSnippetEndIndexes[ i ] + TemplatesManager.TemplateCodeSnippetEnd.Length - codeSnippetAttribBeginIndexes[ i ] + lengthAdjust ); - - // int snippetCodeStart = codeSnippetAttribEndIndexes[ i ] + TemplatesManager.TemplateCodeSnippetAttribEnd.Length; - // int snippetCodeLength = codeSnippetEndIndexes[ i ] - snippetCodeStart; - // //Remove possible identation characters present between tag and last instruction - // if( m_templateBody[ snippetCodeStart + snippetCodeLength - 1 ] != TemplatesManager.TemplateNewLine ) - // { - // for( ; snippetCodeLength > 0; snippetCodeLength-- ) - // { - // if( m_templateBody[ snippetCodeStart + snippetCodeLength - 1 ] == TemplatesManager.TemplateNewLine ) - // break; - // } - // } - - // if( snippetCodeLength > 0 ) - // { - // string snippetCode = m_templateBody.Substring( snippetCodeStart, snippetCodeLength ); - // TemplateCodeSnippetElement element = new TemplateCodeSnippetElement( snippetId, snippetCode ); - // m_snippetElementsDict[ attribName ].AddSnippet( element ); - // } - // } - // } - // } - // } - //} - - //void RefreshSnippetInfo() - //{ - // if( m_snippetElementsDict == null ) - // { - // m_snippetElementsDict = new Dictionary<string, TemplateCodeSnippetBase>(); - // } - - // if( m_snippetElementsDict.Count != m_snippetElementsList.Count ) - // { - // m_snippetElementsDict.Clear(); - // for( int i = 0; i < m_snippetElementsList.Count; i++ ) - // { - // m_snippetElementsDict.Add( m_snippetElementsList[ i ].NameId, m_snippetElementsList[ i ] ); - // } - // } - //} - - //public void DrawSnippetProperties( ParentNode owner ) - //{ - // for( int i = 0; i < m_snippetElementsList.Count; i++ ) - // { - // m_snippetElementsList[ i ].DrawProperties( owner ); - // } - //} - - //public void InsertSnippets( ref string shaderBody ) - //{ - // for( int i = 0; i < m_snippetElementsList.Count; i++ ) - // { - // m_snippetElementsList[ i ].InsertSnippet( ref shaderBody ); - // } - //} - - public void AddId( string ID, bool searchIndentation = true ) - { - AddId( ID, searchIndentation, string.Empty ); - } - - public void AddId( string ID, bool searchIndentation, string customIndentation ) - { - int propertyIndex = m_templateBody.IndexOf( ID ); - if( propertyIndex > -1 ) - { - if( searchIndentation ) - { - int indentationIndex = -1; - for( int i = propertyIndex; i > 0; i-- ) - { - if( m_templateBody[ i ] == TemplatesManager.TemplateNewLine ) - { - indentationIndex = i + 1; - break; - } - } - if( indentationIndex > -1 ) - { - int length = propertyIndex - indentationIndex; - string indentation = ( length > 0 ) ? m_templateBody.Substring( indentationIndex, length ) : string.Empty; - m_propertyList.Add( new TemplateProperty( ID, indentation, false ) ); - } - } - else - { - m_propertyList.Add( new TemplateProperty( ID, customIndentation, true ) ); - } - } - } - - void BuildInfo() - { - if( m_propertyDict == null ) - { - m_propertyDict = new Dictionary<string, TemplateProperty>(); - } - - if( m_propertyList.Count != m_propertyDict.Count ) - { - m_propertyDict.Clear(); - for( int i = 0; i < m_propertyList.Count; i++ ) - { - m_propertyDict.Add( m_propertyList[ i ].Id, m_propertyList[ i ] ); - } - } - } - - public void ResetTemplateUsageData() - { - BuildInfo(); - for( int i = 0; i < m_propertyList.Count; i++ ) - { - m_propertyList[ i ].Used = false; - } - } - - public void AddInput( int tagStartIdx, string tagId, string portName, string defaultValue, WirePortDataType dataType, MasterNodePortCategory portCategory, int portUniqueId, int portOrderId ) - { - TemplateInputData inputData = new TemplateInputData( tagStartIdx, tagStartIdx, tagId, portName, defaultValue, dataType, portCategory, portUniqueId, portOrderId, string.Empty ); - m_inputDataList.Add( inputData ); - m_inputDataDict.Add( inputData.PortUniqueId, inputData ); - AddId( tagId, false ); - } - - public override void Destroy() - { - if( m_vertexDataContainer != null ) - { - m_vertexDataContainer.Destroy(); - m_vertexDataContainer = null; - } - - if( m_interpolatorDataContainer != null ) - { - m_interpolatorDataContainer.Destroy(); - m_interpolatorDataContainer = null; - } - - if( m_availableShaderProperties != null ) - { - m_availableShaderProperties.Clear(); - m_availableShaderProperties = null; - } - - if( m_propertyDict != null ) - { - m_propertyDict.Clear(); - m_propertyDict = null; - } - - if( m_propertyList != null ) - { - m_propertyList.Clear(); - m_propertyList = null; - } - - if( m_inputDataDict != null ) - { - m_inputDataDict.Clear(); - m_inputDataDict = null; - } - - if( m_inputDataList != null ) - { - m_inputDataList.Clear(); - m_inputDataList = null; - } - - if( m_localVarsList != null ) - { - m_localVarsList.Clear(); - m_localVarsList = null; - } - //if( m_snippetElementsDict != null ) - //{ - // m_snippetElementsDict.Clear(); - // m_snippetElementsDict = null; - //} - - //if( m_snippetElementsList != null ) - //{ - // for( int i = 0; i < m_snippetElementsList.Count; i++ ) - // { - // GameObject.DestroyImmediate( m_snippetElementsList[ i ] ); - // m_snippetElementsList[ i ] = null; - // } - // m_snippetElementsList.Clear(); - // m_snippetElementsList = null; - //} - - m_cullModeData = null; - m_blendData = null; - m_colorMaskData = null; - m_stencilData = null; - if( m_tagData != null ) - { - m_tagData.Destroy(); - m_tagData = null; - } - } - - public void FillEmptyTags( ref string body ) - { - body = body.Replace( TemplatesManager.TemplateLocalVarTag, string.Empty ); - for( int i = 0; i < m_propertyList.Count; i++ ) - { - if( !m_propertyList[ i ].Used ) - { - if( m_propertyList[ i ].UseCustomIndentation ) - { - body = body.Replace( m_propertyList[ i ].Id, string.Empty ); - } - else - { - body = body.Replace( m_propertyList[ i ].Indentation + m_propertyList[ i ].Id, string.Empty ); - } - } - } - } - - public bool FillVertexInstructions( ref string body, params string[] values ) - { - if( m_vertexFunctionData != null && !string.IsNullOrEmpty( m_vertexFunctionData.Id ) ) - { - return FillTemplateBody( m_vertexFunctionData.Id, ref body, values ); - } - - if( values.Length > 0 ) - { - UIUtils.ShowMessage( "Attemping to add vertex instructions on a template with no assigned vertex code area", MessageSeverity.Error ); - return false; - } - return true; - } - - public bool FillFragmentInstructions( ref string body, params string[] values ) - { - if( m_fragmentFunctionData != null && !string.IsNullOrEmpty( m_fragmentFunctionData.Id ) ) - { - return FillTemplateBody( m_fragmentFunctionData.Id, ref body, values ); - } - - if( values.Length > 0 ) - { - UIUtils.ShowMessage( "Attemping to add fragment instructions on a template with no assigned vertex code area", MessageSeverity.Error ); - return false; - } - return true; - } - - // values must be unindented an without line feed - public bool FillTemplateBody( string id, ref string body, params string[] values ) - { - if( values.Length == 0 ) - { - return true; - } - - BuildInfo(); - - if( m_propertyDict.ContainsKey( id ) ) - { - string finalValue = string.Empty; - for( int i = 0; i < values.Length; i++ ) - { - - if( m_propertyDict[ id ].AutoLineFeed ) - { - string[] valuesArr = values[ i ].Split( '\n' ); - for( int j = 0; j < valuesArr.Length; j++ ) - { - //first value will be automatically indented by the string replace - finalValue += ( ( i == 0 && j == 0 ) ? string.Empty : m_propertyDict[ id ].Indentation ) + valuesArr[ j ]; - finalValue += TemplatesManager.TemplateNewLine; - } - - } - else - { - //first value will be automatically indented by the string replace - finalValue += ( i == 0 ? string.Empty : m_propertyDict[ id ].Indentation ) + values[ i ]; - } - } - - body = body.Replace( id, finalValue ); - m_propertyDict[ id ].Used = true; - return true; - } - - if( values.Length > 1 || !string.IsNullOrEmpty( values[ 0 ] ) ) - { - UIUtils.ShowMessage( string.Format( "Attempting to write data into inexistant tag {0}. Please review the template {1} body and consider adding the missing tag.", id, m_name ), MessageSeverity.Error ); - return false; - } - - return true; - - } - - public bool FillTemplateBody( string id, ref string body, List<PropertyDataCollector> values ) - { - if( values.Count == 0 ) - { - return true; - } - - string[] array = new string[ values.Count ]; - for( int i = 0; i < values.Count; i++ ) - { - array[ i ] = values[ i ].PropertyName; - } - return FillTemplateBody( id, ref body, array ); - } - - public TemplateInputData InputDataFromId( int id ) - { - if( m_inputDataDict == null ) - m_inputDataDict = new Dictionary<int, TemplateInputData>(); - - if( m_inputDataDict.Count != m_inputDataList.Count ) - { - m_inputDataDict.Clear(); - for( int i = 0; i < m_inputDataList.Count; i++ ) - { - m_inputDataDict.Add( m_inputDataList[ i ].PortUniqueId, m_inputDataList[ i ] ); - } - } - - if( m_inputDataDict.ContainsKey( id ) ) - return m_inputDataDict[ id ]; - - return null; - } - - public string GetVertexData( TemplateInfoOnSematics info ) - { - int count = m_vertexDataContainer.VertexData.Count; - for( int i = 0; i < count; i++ ) - { - if( m_vertexDataContainer.VertexData[ i ].DataInfo == info ) - { - return string.Format( TemplateHelperFunctions.TemplateVarFormat, m_vertexFunctionData.InVarName, m_vertexDataContainer.VertexData[ i ].VarName ); - } - } - return string.Empty; - } - - public string GetInterpolatedData( TemplateInfoOnSematics info ) - { - int count = m_interpolatorDataContainer.Interpolators.Count; - for( int i = 0; i < count; i++ ) - { - if( m_interpolatorDataContainer.Interpolators[ i ].DataInfo == info ) - { - return string.Format( TemplateHelperFunctions.TemplateVarFormat, m_fragmentFunctionData.InVarName, m_interpolatorDataContainer.Interpolators[ i ].VarName ); - } - } - return string.Empty; - } - - public string InterpDataId { get { return m_interpolatorDataContainer.InterpDataId; } } - public string VertexDataId { get { return m_vertexDataContainer.VertexDataId; } } - public string ShaderNameId { get { return m_shaderNameId; } set { m_shaderNameId = value; } } - public string TemplateBody { get { return m_templateBody; } set { m_templateBody = value; } } - public List<TemplateInputData> InputDataList { get { return m_inputDataList; } set { m_inputDataList = value; } } - public List<TemplateLocalVarData> LocalVarsList { get { return m_localVarsList; } } - public List<TemplateVertexData> VertexDataList { get { return m_vertexDataContainer.VertexData; } } - public TemplateInterpData InterpolatorData { get { return m_interpolatorDataContainer; } } - public TemplateFunctionData VertexFunctionData { get { return m_vertexFunctionData; } set { m_vertexFunctionData = value; } } - public TemplateFunctionData FragmentFunctionData { get { return m_fragmentFunctionData; } set { m_fragmentFunctionData = value; } } - public List<TemplateShaderPropertyData> AvailableShaderProperties { get { return m_availableShaderProperties; } set { m_availableShaderProperties = value; } } - public TemplateBlendData BlendData { get { return m_blendData; } set { m_blendData = value; } } - public TemplateCullModeData CullModeData { get { return m_cullModeData; } set { m_cullModeData = value; } } - public TemplateColorMaskData ColorMaskData { get { return m_colorMaskData; } set { m_colorMaskData = value; } } - public TemplateStencilData StencilData { get { return m_stencilData; } set { m_stencilData = value; } } - public TemplateDepthData DepthData { get { return m_depthData; } set { m_depthData = value; } } - public TemplateTagsModuleData TagData { get { return m_tagData; } set { m_tagData = value; } } - private List<TemplateProperty> PropertyList { get { return m_propertyList; } set { m_propertyList = value; } } - public VertexDataContainer VertexDataContainer { get { return m_vertexDataContainer; } set { m_vertexDataContainer = value; } } - public TemplateInterpData InterpolatorDataContainer { get { return m_interpolatorDataContainer; } set { m_interpolatorDataContainer = value; } } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateData.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateData.cs.meta deleted file mode 100644 index 2002009f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateData.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: b03340e569366ae4dbd502e14c62e225 -timeCreated: 1493904667 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateDataCollector.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateDataCollector.cs deleted file mode 100644 index bc772311..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateDataCollector.cs +++ /dev/null @@ -1,2056 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEngine; -using System.Collections.Generic; -using System.Text.RegularExpressions; -using System; - -namespace AmplifyShaderEditor -{ - public enum NormalizeType - { - Off, - Regular, - Safe - } - - public class InterpDataHelper - { - public string VarName; - public WirePortDataType VarType; - public bool IsSingleComponent; - public bool SetAtCompileTime; - public InterpDataHelper( WirePortDataType varType, string varName, bool isSingleComponent = true , bool setAtCompileTime = false ) - { - VarName = varName; - VarType = varType; - IsSingleComponent = isSingleComponent; - SetAtCompileTime = setAtCompileTime; - } - } - - public class TemplateCustomData - { - public WirePortDataType DataType; - public string Name; - public bool IsVertex; - public bool IsFragment; - public TemplateCustomData( string name, WirePortDataType dataType ) - { - name = Name; - DataType = dataType; - IsVertex = false; - IsFragment = false; - } - } - - public class TemplateInputParameters - { - public WirePortDataType Type; - public string Name; - public string Declaration; - public TemplateSemantics Semantic; - public TemplateInputParameters( WirePortDataType type, PrecisionType precision, string name, TemplateSemantics semantic, string custom = null ) - { - Type = type; - Name = name; - Semantic = semantic; - Declaration = string.Format( "{0} {1} : {2}", UIUtils.PrecisionWirePortToCgType( precision, type ), Name, Semantic ); - if( !string.IsNullOrEmpty( custom ) ) - Declaration = custom; - } - } - - public class TemplateDataCollector - { -#if UNITY_2018_2_OR_NEWER - private const int MaxUV = 8; - private int[] m_UVUsage = { 0, 0, 0, 0, 0, 0, 0, 0 }; -#else - private const int MaxUV = 4; - private int[] m_UVUsage = { 0, 0, 0, 0 }; -#endif - private int m_multipassSubshaderIdx = 0; - private int m_multipassPassIdx = 0; - private TemplateMultiPass m_currentTemplate; - private TemplateSRPType m_currentSRPType = TemplateSRPType.BuiltIn; - - private Dictionary<string, TemplateCustomData> m_customInterpolatedData; - private Dictionary<string, TemplateVertexData> m_registeredVertexData; - - private Dictionary<TemplateInfoOnSematics, InterpDataHelper> m_availableFragData; - private Dictionary<TemplateInfoOnSematics, InterpDataHelper> m_availableVertData; - private TemplateInterpData m_interpolatorData; - private Dictionary<TemplateSemantics, TemplateVertexData> m_vertexDataDict; - private TemplateData m_currentTemplateData; - private MasterNodeDataCollector m_currentDataCollector; - public Dictionary<TemplateSemantics, TemplateInputParameters> m_vertexInputParams; - public Dictionary<TemplateSemantics, TemplateInputParameters> m_fragmentInputParams; - - private Dictionary<TemplateInfoOnSematics, TemplateLocalVarData> m_specialVertexLocalVars; - private Dictionary<TemplateInfoOnSematics, TemplateLocalVarData> m_specialFragmentLocalVars; - - private List<PropertyDataCollector> m_lateDirectivesList = new List<PropertyDataCollector>(); - private Dictionary<string, PropertyDataCollector> m_lateDirectivesDict = new Dictionary<string, PropertyDataCollector>(); - - private List<PropertyDataCollector> m_srpBatcherPropertiesList = new List<PropertyDataCollector>(); - private List<PropertyDataCollector> m_fullSrpBatcherPropertiesList = new List<PropertyDataCollector>(); - private Dictionary<string, PropertyDataCollector> m_srpBatcherPropertiesDict = new Dictionary<string, PropertyDataCollector>(); - - public void CopySRPPropertiesFromDataCollector( int nodeId, TemplateDataCollector dataCollector ) - { - for( int i = 0; i < dataCollector.SrpBatcherPropertiesList.Count; i++ ) - { - AddSRPBatcherProperty( nodeId, dataCollector.SrpBatcherPropertiesList[ i ].PropertyName ); - } - } - - public void AddSRPBatcherProperty( int nodeID, string property ) - { - if( !m_srpBatcherPropertiesDict.ContainsKey( property ) ) - { - PropertyDataCollector newValue = new PropertyDataCollector( nodeID, property ); - m_srpBatcherPropertiesDict.Add( property, newValue ); - m_srpBatcherPropertiesList.Add( newValue ); - } - } - - public void SetUVUsage( int uv, WirePortDataType type ) - { - if( uv >= 0 && uv < MaxUV ) - { - m_UVUsage[ uv ] = Mathf.Max( m_UVUsage[ uv ], TemplateHelperFunctions.DataTypeChannelUsage[ type ] ); - } - } - - public void SetUVUsage( int uv, int size ) - { - if( uv >= 0 && uv < MaxUV ) - { - m_UVUsage[ uv ] = Mathf.Max( m_UVUsage[ uv ], size ); - } - } - - public void CloseLateDirectives() - { - if( m_lateDirectivesList.Count > 0 ) - { - m_lateDirectivesList.Add( new PropertyDataCollector( -1, string.Empty ) ); - } - } - - public void AddHDLightInfo() - { -#if !UNITY_2018_3_OR_NEWER - AddLateDirective( AdditionalLineType.Custom, "#if (SHADERPASS != SHADERPASS_FORWARD) //On forward this info is already included" ); - AddLateDirective( AdditionalLineType.Include, "HDRP/Lighting/LightDefinition.cs.hlsl" ); - AddLateDirective( AdditionalLineType.Include, "HDRP/Lighting/LightLoop/Shadow.hlsl" ); - AddLateDirective( AdditionalLineType.Include, "HDRP/Lighting/LightLoop/LightLoopDef.hlsl" ); - AddLateDirective( AdditionalLineType.Custom, "#endif // End of light info includes" ); -#endif - } - - public void AddLateDirective( AdditionalLineType type, string value ) - { - - if( !m_lateDirectivesDict.ContainsKey( value ) ) - { - string formattedValue = string.Empty; - switch( type ) - { - case AdditionalLineType.Include: formattedValue = string.Format( Constants.IncludeFormat, value ); break; - case AdditionalLineType.Define: formattedValue = string.Format( Constants.DefineFormat, value ); break; - case AdditionalLineType.Pragma: formattedValue = string.Format( Constants.PragmaFormat, value ); break; - case AdditionalLineType.Custom: formattedValue = value; break; - } - PropertyDataCollector property = new PropertyDataCollector( -1, formattedValue ); - m_lateDirectivesDict.Add( value, property ); - m_lateDirectivesList.Add( property ); - } - } - - public void SetMultipassInfo( TemplateMultiPass currentTemplate, int subShaderIdx, int passIdx, TemplateSRPType currentSRPType ) - { - m_currentTemplate = currentTemplate; - m_multipassSubshaderIdx = subShaderIdx; - m_multipassPassIdx = passIdx; - m_currentSRPType = currentSRPType; - } - - public bool HasDirective( AdditionalLineType type, string value ) - { - switch( type ) - { - case AdditionalLineType.Include: - { - return m_currentTemplate.SubShaders[ m_multipassSubshaderIdx ].Modules.IncludePragmaContainer.HasInclude( value ) || - m_currentTemplate.SubShaders[ m_multipassSubshaderIdx ].Passes[ m_multipassPassIdx ].Modules.IncludePragmaContainer.HasInclude( value ); - } - case AdditionalLineType.Define: - { - return m_currentTemplate.SubShaders[ m_multipassSubshaderIdx ].Modules.IncludePragmaContainer.HasDefine( value ) || - m_currentTemplate.SubShaders[ m_multipassSubshaderIdx ].Passes[ m_multipassPassIdx ].Modules.IncludePragmaContainer.HasDefine( value ); - } - case AdditionalLineType.Pragma: - { - return m_currentTemplate.SubShaders[ m_multipassSubshaderIdx ].Modules.IncludePragmaContainer.HasPragma( value ) || - m_currentTemplate.SubShaders[ m_multipassSubshaderIdx ].Passes[ m_multipassPassIdx ].Modules.IncludePragmaContainer.HasPragma( value ); - } - } - - return false; - } - - public void FillSpecialVariables( TemplatePass currentPass ) - { - m_specialVertexLocalVars = new Dictionary<TemplateInfoOnSematics, TemplateLocalVarData>(); - m_specialFragmentLocalVars = new Dictionary<TemplateInfoOnSematics, TemplateLocalVarData>(); - int localVarAmount = currentPass.LocalVarsList.Count; - for( int i = 0; i < localVarAmount; i++ ) - { - if( currentPass.LocalVarsList[ i ].IsSpecialVar ) - { - if( currentPass.LocalVarsList[ i ].Category == MasterNodePortCategory.Vertex ) - { - m_specialVertexLocalVars.Add( currentPass.LocalVarsList[ i ].SpecialVarType, currentPass.LocalVarsList[ i ] ); - } - else - { - m_specialFragmentLocalVars.Add( currentPass.LocalVarsList[ i ].SpecialVarType, currentPass.LocalVarsList[ i ] ); - } - } - } - } - - public void BuildFromTemplateData( MasterNodeDataCollector dataCollector, TemplateData templateData ) - { - m_registeredVertexData = new Dictionary<string, TemplateVertexData>(); - m_customInterpolatedData = new Dictionary<string, TemplateCustomData>(); - - - m_currentDataCollector = dataCollector; - m_currentTemplateData = templateData; - - m_vertexDataDict = new Dictionary<TemplateSemantics, TemplateVertexData>(); - if( templateData.VertexDataList != null ) - { - for( int i = 0; i < templateData.VertexDataList.Count; i++ ) - { - m_vertexDataDict.Add( templateData.VertexDataList[ i ].Semantics, new TemplateVertexData( templateData.VertexDataList[ i ] ) ); - } - } - - m_availableFragData = new Dictionary<TemplateInfoOnSematics, InterpDataHelper>(); - if( templateData.InterpolatorData != null && templateData.FragmentFunctionData != null ) - { - m_interpolatorData = new TemplateInterpData( templateData.InterpolatorData ); - int fragCount = templateData.InterpolatorData.Interpolators.Count; - for( int i = 0; i < fragCount; i++ ) - { - string varName = string.Empty; - if( templateData.InterpolatorData.Interpolators[ i ].ExcludeStructPrefix ) - { - varName = templateData.InterpolatorData.Interpolators[ i ].VarName; - } - else if( templateData.InterpolatorData.Interpolators[ i ].IsSingleComponent ) - { - varName = string.Format( TemplateHelperFunctions.TemplateVarFormat, - templateData.FragmentFunctionData.InVarName, - templateData.InterpolatorData.Interpolators[ i ].VarNameWithSwizzle ); - } - else - { - varName = string.Format( templateData.InterpolatorData.Interpolators[ i ].VarNameWithSwizzle, templateData.FragmentFunctionData.InVarName ); - } - - m_availableFragData.Add( templateData.InterpolatorData.Interpolators[ i ].DataInfo, - new InterpDataHelper( templateData.InterpolatorData.Interpolators[ i ].SwizzleType, - varName, - templateData.InterpolatorData.Interpolators[ i ].IsSingleComponent ) ); - } - } - - - m_availableVertData = new Dictionary<TemplateInfoOnSematics, InterpDataHelper>(); - if( templateData.VertexFunctionData != null && templateData.VertexDataList != null ) - { - int vertCount = templateData.VertexDataList.Count; - for( int i = 0; i < vertCount; i++ ) - { - string varName = string.Empty; - if( templateData.VertexDataList[ i ].ExcludeStructPrefix ) - { - varName = templateData.VertexDataList[ i ].VarName; - } - else - { - varName = string.Format( TemplateHelperFunctions.TemplateVarFormat, templateData.VertexFunctionData.InVarName, templateData.VertexDataList[ i ].VarNameWithSwizzle ); - } - - m_availableVertData.Add( templateData.VertexDataList[ i ].DataInfo, - new InterpDataHelper( templateData.VertexDataList[ i ].SwizzleType, - varName, - templateData.VertexDataList[ i ].IsSingleComponent ) ); - } - } - } - - public void RegisterFragInputParams( WirePortDataType type, PrecisionType precision, string name, TemplateSemantics semantic, string custom ) - { - if( m_fragmentInputParams == null ) - m_fragmentInputParams = new Dictionary<TemplateSemantics, TemplateInputParameters>(); - - m_fragmentInputParams.Add( semantic, new TemplateInputParameters( type, precision, name, semantic, custom ) ); - } - - public void RegisterFragInputParams( WirePortDataType type, PrecisionType precision, string name, TemplateSemantics semantic ) - { - if( m_fragmentInputParams == null ) - m_fragmentInputParams = new Dictionary<TemplateSemantics, TemplateInputParameters>(); - - m_fragmentInputParams.Add( semantic, new TemplateInputParameters( type, precision, name, semantic ) ); - } - - public void RegisterVertexInputParams( WirePortDataType type, PrecisionType precision, string name, TemplateSemantics semantic ) - { - if( m_vertexInputParams == null ) - m_vertexInputParams = new Dictionary<TemplateSemantics, TemplateInputParameters>(); - - m_vertexInputParams.Add( semantic, new TemplateInputParameters( type, precision, name, semantic ) ); - } - - public string GetVertexId() - { - var precision = PrecisionType.Float; - bool useMasterNodeCategory = true; - MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment; - - WirePortDataType type = WirePortDataType.UINT; - if( HasInfo( TemplateInfoOnSematics.VERTEXID, useMasterNodeCategory, customCategory ) ) - { - InterpDataHelper info = GetInfo( TemplateInfoOnSematics.VERTEXID, useMasterNodeCategory, customCategory ); - return TemplateHelperFunctions.AutoSwizzleData( info.VarName, info.VarType, type, true ); - } - else - { - MasterNodePortCategory portCategory = useMasterNodeCategory ? m_currentDataCollector.PortCategory : customCategory; - string name = "ase_vertexID"; - return RegisterInfoOnSemantic( portCategory, TemplateInfoOnSematics.VERTEXID, TemplateSemantics.SV_VertexID, name, WirePortDataType.UINT, precision, true ); - } - - // need to review this later - //if( m_vertexInputParams != null && m_vertexInputParams.ContainsKey( TemplateSemantics.SV_VertexID ) ) - //{ - // if( m_currentDataCollector.PortCategory == MasterNodePortCategory.Vertex ) - // return m_vertexInputParams[ TemplateSemantics.SV_VertexID ].Name; - //} - //else - //{ - // RegisterVertexInputParams( WirePortDataType.UINT, PrecisionType.Float, TemplateHelperFunctions.SemanticsDefaultName[ TemplateSemantics.SV_VertexID ], TemplateSemantics.SV_VertexID ); - //} - - //if( m_currentDataCollector.PortCategory != MasterNodePortCategory.Vertex ) - // RegisterCustomInterpolatedData( m_vertexInputParams[ TemplateSemantics.SV_VertexID ].Name, WirePortDataType.INT, PrecisionType.Float, m_vertexInputParams[ TemplateSemantics.SV_VertexID ].Name ); - - //return m_vertexInputParams[ TemplateSemantics.SV_VertexID ].Name; - } -#if UNITY_EDITOR_WIN - public string GetPrimitiveId() - { - if( m_fragmentInputParams != null && m_fragmentInputParams.ContainsKey( TemplateSemantics.SV_PrimitiveID ) ) - return m_fragmentInputParams[ TemplateSemantics.SV_PrimitiveID ].Name; - - RegisterFragInputParams( WirePortDataType.UINT, PrecisionType.Half, TemplateHelperFunctions.SemanticsDefaultName[ TemplateSemantics.SV_PrimitiveID ], TemplateSemantics.SV_PrimitiveID ); - return m_fragmentInputParams[ TemplateSemantics.SV_PrimitiveID ].Name; - } -#endif - public string GetVFace( int uniqueId ) - { - #if UNITY_2018_3_OR_NEWER - if( IsHDRP && ASEPackageManagerHelper.CurrentHDVersion >= ASESRPVersions.ASE_SRP_6_9_0 ) - { - string result = string.Empty; - if( GetCustomInterpolatedData( TemplateInfoOnSematics.VFACE, WirePortDataType.FLOAT, PrecisionType.Float, ref result, true, MasterNodePortCategory.Fragment ) ) - { - m_currentDataCollector.AddToDirectives( "#if !defined(ASE_NEED_CULLFACE)" ); - m_currentDataCollector.AddToDirectives( "#define ASE_NEED_CULLFACE 1" ); - m_currentDataCollector.AddToDirectives( "#endif //ASE_NEED_CULLFACE" ); - return result; - } - else - { - if( m_fragmentInputParams != null && m_fragmentInputParams.ContainsKey( TemplateSemantics.VFACE ) ) - return m_fragmentInputParams[ TemplateSemantics.VFACE ].Name; - - string custom = "FRONT_FACE_TYPE "+ TemplateHelperFunctions.SemanticsDefaultName[ TemplateSemantics.VFACE ] + " : FRONT_FACE_SEMANTIC"; - RegisterFragInputParams( WirePortDataType.FLOAT, PrecisionType.Half, TemplateHelperFunctions.SemanticsDefaultName[ TemplateSemantics.VFACE ], TemplateSemantics.VFACE, custom ); - return m_fragmentInputParams[ TemplateSemantics.VFACE ].Name; - } - } - else - #endif - { - if( m_fragmentInputParams != null && m_fragmentInputParams.ContainsKey( TemplateSemantics.VFACE ) ) - return m_fragmentInputParams[ TemplateSemantics.VFACE ].Name; - - RegisterFragInputParams( WirePortDataType.FLOAT, PrecisionType.Half, TemplateHelperFunctions.SemanticsDefaultName[ TemplateSemantics.VFACE ], TemplateSemantics.VFACE ); - return m_fragmentInputParams[ TemplateSemantics.VFACE ].Name; - } - } - - public string GetShadowCoords( int uniqueId, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) - { - // overriding precision - var precision = PrecisionType.Float; - - string worldPos = GetWorldPos( false, m_currentDataCollector.PortCategory ); - - string result = string.Empty; - if( GetCustomInterpolatedData( TemplateInfoOnSematics.SHADOWCOORDS, WirePortDataType.FLOAT4, precision, ref result, useMasterNodeCategory, customCategory ) ) - { - return result; - } - - string varName = GeneratorUtils.ShadowCoordsStr; - if( HasCustomInterpolatedData( varName, useMasterNodeCategory, customCategory ) ) - return varName; - - - string shadowCoordsValue = string.Format( "TransformWorldToShadowCoord({0})", worldPos ); - if( m_currentDataCollector.PortCategory == MasterNodePortCategory.Fragment ) - { - worldPos = GetWorldPos( false, MasterNodePortCategory.Vertex ); - m_currentDataCollector.AddLocalVariable( uniqueId, "#if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR) //la" ); - RegisterCustomInterpolatedData( varName, WirePortDataType.FLOAT4, precision, string.Format( "TransformWorldToShadowCoord({0})", worldPos ), false, MasterNodePortCategory.Fragment ); - m_currentDataCollector.AddLocalVariable( uniqueId, "#elif defined(MAIN_LIGHT_CALCULATE_SHADOWS) //la" ); - m_currentDataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT4, varName, shadowCoordsValue ); - m_currentDataCollector.AddLocalVariable( uniqueId, "#else //la" ); - m_currentDataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT4, varName, "0" ); - m_currentDataCollector.AddLocalVariable( uniqueId, "#endif //la" ); - } else - { - m_currentDataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT4, varName, shadowCoordsValue ); - } - return varName; - } - - public bool HasUV( int uvChannel ) - { - return ( m_currentDataCollector.PortCategory == MasterNodePortCategory.Fragment ) ? m_availableFragData.ContainsKey( TemplateHelperFunctions.IntToUVChannelInfo[ uvChannel ] ) : m_availableVertData.ContainsKey( TemplateHelperFunctions.IntToUVChannelInfo[ uvChannel ] ); - } - - public string GetUVName( int uvChannel, WirePortDataType dataType = WirePortDataType.FLOAT2 ) - { - InterpDataHelper info = ( m_currentDataCollector.PortCategory == MasterNodePortCategory.Fragment ) ? m_availableFragData[ TemplateHelperFunctions.IntToUVChannelInfo[ uvChannel ] ] : m_availableVertData[ TemplateHelperFunctions.IntToUVChannelInfo[ uvChannel ] ]; - if( dataType != info.VarType ) - return info.VarName + UIUtils.GetAutoSwizzle( dataType ); - else - return info.VarName; - } - - public string GetTextureCoord( int uvChannel, string propertyName, int uniqueId, PrecisionType precisionType ) - { - bool isVertex = ( m_currentDataCollector.PortCategory == MasterNodePortCategory.Vertex || m_currentDataCollector.PortCategory == MasterNodePortCategory.Tessellation ); - string uvChannelName = string.Empty; - string propertyHelperVar = propertyName + "_ST"; - m_currentDataCollector.AddToUniforms( uniqueId, "float4", propertyHelperVar, IsSRP ); - string uvName = string.Empty; - if( m_currentDataCollector.TemplateDataCollectorInstance.HasUV( uvChannel ) ) - { - uvName = m_currentDataCollector.TemplateDataCollectorInstance.GetUVName( uvChannel ); - } - else - { - uvName = m_currentDataCollector.TemplateDataCollectorInstance.RegisterUV( uvChannel ); - } - - uvChannelName = "uv" + propertyName; - if( isVertex ) - { - string value = string.Format( Constants.TilingOffsetFormat, uvName, propertyHelperVar + ".xy", propertyHelperVar + ".zw" ); - string lodLevel = "0"; - - value = "float4( " + value + ", 0 , " + lodLevel + " )"; - m_currentDataCollector.AddLocalVariable( uniqueId, precisionType, WirePortDataType.FLOAT4, uvChannelName, value ); - } - else - { - m_currentDataCollector.AddLocalVariable( uniqueId, precisionType, WirePortDataType.FLOAT2, uvChannelName, string.Format( Constants.TilingOffsetFormat, uvName, propertyHelperVar + ".xy", propertyHelperVar + ".zw" ) ); - } - return uvChannelName; - } - - public string GenerateAutoUVs( int uvChannel, WirePortDataType size = WirePortDataType.FLOAT2 ) - { - string uvName = string.Empty; - if( HasUV( uvChannel ) ) - { - uvName = GetUVName( uvChannel, size ); - } - else - { - uvName = RegisterUV( uvChannel, size ); - } - return uvName; - } - - public string GetUV( int uvChannel, MasterNodePortCategory category = MasterNodePortCategory.Fragment, WirePortDataType size = WirePortDataType.FLOAT4 ) - { - if( !HasUV( uvChannel ) ) - { - RegisterUV( uvChannel, size ); - } - - InterpDataHelper info = ( category == MasterNodePortCategory.Fragment ) ? m_availableFragData[ TemplateHelperFunctions.IntToUVChannelInfo[ uvChannel ] ] : m_availableVertData[ TemplateHelperFunctions.IntToUVChannelInfo[ uvChannel ] ]; - return info.VarName; - } - - public InterpDataHelper GetUVInfo( int uvChannel ) - { - return ( m_currentDataCollector.PortCategory == MasterNodePortCategory.Fragment ) ? m_availableFragData[ TemplateHelperFunctions.IntToUVChannelInfo[ uvChannel ] ] : m_availableVertData[ TemplateHelperFunctions.IntToUVChannelInfo[ uvChannel ] ]; - } - - public string RegisterUV( int UVChannel, WirePortDataType size = WirePortDataType.FLOAT2 ) - { - int channelsSize = TemplateHelperFunctions.DataTypeChannelUsage[ size ]; - if( m_UVUsage[ UVChannel ] > channelsSize ) - { - size = TemplateHelperFunctions.ChannelToDataType[ m_UVUsage[ UVChannel ] ]; - } - - if( m_currentDataCollector.PortCategory == MasterNodePortCategory.Vertex ) - { - TemplateSemantics semantic = TemplateHelperFunctions.IntToSemantic[ UVChannel ]; - - if( m_vertexDataDict.ContainsKey( semantic ) ) - { - return m_vertexDataDict[ semantic ].VarName; - } - - string varName = TemplateHelperFunctions.BaseInterpolatorName + ( ( UVChannel > 0 ) ? UVChannel.ToString() : string.Empty ); - m_availableVertData.Add( TemplateHelperFunctions.IntToUVChannelInfo[ UVChannel ], - new InterpDataHelper( WirePortDataType.FLOAT4, - string.Format( TemplateHelperFunctions.TemplateVarFormat, - m_currentTemplateData.VertexFunctionData.InVarName, - varName ) ) ); - - m_currentDataCollector.AddToVertexInput( - string.Format( TemplateHelperFunctions.TexFullSemantic, - varName, - semantic ) ); - RegisterOnVertexData( semantic, size, varName ); - string finalVarName = m_availableVertData[ TemplateHelperFunctions.IntToUVChannelInfo[ UVChannel ] ].VarName; - switch( size ) - { - case WirePortDataType.FLOAT: - case WirePortDataType.INT: - case WirePortDataType.UINT: - finalVarName += ".x"; - break; - case WirePortDataType.FLOAT2: - finalVarName += ".xy"; - break; - case WirePortDataType.FLOAT3: - finalVarName += ".xyz"; - break; - case WirePortDataType.FLOAT4: - case WirePortDataType.COLOR: - case WirePortDataType.OBJECT: - case WirePortDataType.FLOAT4x4: - case WirePortDataType.SAMPLER1D: - case WirePortDataType.SAMPLER2D: - case WirePortDataType.SAMPLER3D: - case WirePortDataType.SAMPLERCUBE: - case WirePortDataType.FLOAT3x3: - default: - break; - } - return finalVarName; - } - else - { - //search if the correct vertex data is set ... - TemplateInfoOnSematics info = TemplateHelperFunctions.IntToInfo[ UVChannel ]; - TemplateSemantics vertexSemantics = TemplateSemantics.NONE; - foreach( KeyValuePair<TemplateSemantics, TemplateVertexData> kvp in m_vertexDataDict ) - { - if( kvp.Value.DataInfo == info ) - { - vertexSemantics = kvp.Key; - break; - } - } - - // if not, add vertex data and create interpolator - if( vertexSemantics == TemplateSemantics.NONE ) - { - vertexSemantics = TemplateHelperFunctions.IntToSemantic[ UVChannel ]; - - if( !m_vertexDataDict.ContainsKey( vertexSemantics ) ) - { - string varName = TemplateHelperFunctions.BaseInterpolatorName + ( ( UVChannel > 0 ) ? UVChannel.ToString() : string.Empty ); - m_availableVertData.Add( TemplateHelperFunctions.IntToUVChannelInfo[ UVChannel ], - new InterpDataHelper( WirePortDataType.FLOAT4, - string.Format( TemplateHelperFunctions.TemplateVarFormat, - m_currentTemplateData.VertexFunctionData.InVarName, - varName ) ) ); - - m_currentDataCollector.AddToVertexInput( - string.Format( TemplateHelperFunctions.TexFullSemantic, - varName, - vertexSemantics ) ); - RegisterOnVertexData( vertexSemantics, size, varName ); - } - } - - // either way create interpolator - TemplateVertexData availableInterp = RequestNewInterpolator( size, false ); - if( availableInterp != null ) - { - bool isPosition = vertexSemantics == TemplateSemantics.POSITION || vertexSemantics == TemplateSemantics.POSITION; - - string interpVarName = m_currentTemplateData.VertexFunctionData.OutVarName + "." + availableInterp.VarNameWithSwizzle; - InterpDataHelper vertInfo = m_availableVertData[ TemplateHelperFunctions.IntToUVChannelInfo[ UVChannel ] ]; - string interpDecl = string.Format( TemplateHelperFunctions.TemplateVariableDecl, interpVarName, TemplateHelperFunctions.AutoSwizzleData( vertInfo.VarName, vertInfo.VarType, size , isPosition ) ); - m_currentDataCollector.AddToVertexInterpolatorsDecl( interpDecl ); - string finalVarName = m_currentTemplateData.FragmentFunctionData.InVarName + "." + availableInterp.VarNameWithSwizzle; - m_availableFragData.Add( TemplateHelperFunctions.IntToUVChannelInfo[ UVChannel ], new InterpDataHelper( size, finalVarName ) ); - return finalVarName; - } - } - return string.Empty; - } - //////////////////////////////////////////////////////////////////////////////////////////////// - bool IsSemanticUsedOnInterpolator( TemplateSemantics semantics ) - { - for( int i = 0; i < m_interpolatorData.Interpolators.Count; i++ ) - { - if( m_interpolatorData.Interpolators[ i ].Semantics == semantics ) - { - return true; - } - } - return false; - } - - public bool HasInfo( TemplateInfoOnSematics info, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) - { - MasterNodePortCategory category = useMasterNodeCategory ? m_currentDataCollector.PortCategory : customCategory; - return ( category == MasterNodePortCategory.Fragment ) ? m_availableFragData.ContainsKey( info ) : m_availableVertData.ContainsKey( info ); - } - - public InterpDataHelper GetInfo( TemplateInfoOnSematics info, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) - { - MasterNodePortCategory category = useMasterNodeCategory ? m_currentDataCollector.PortCategory : customCategory; - if( category == MasterNodePortCategory.Fragment ) - { - if( !m_availableFragData[ info ].SetAtCompileTime ) - { - string defineValue = string.Empty; - if( TemplateHelperFunctions.InfoToDefineFrag.TryGetValue( info, out defineValue ) ) - m_currentDataCollector.AddToDefines( -1, defineValue ); - } - return m_availableFragData[ info ]; - } - else - { - if( !m_availableVertData[ info ].SetAtCompileTime ) - { - string defineValue = string.Empty; - if( TemplateHelperFunctions.InfoToDefineVertex.TryGetValue( info, out defineValue ) ) - m_currentDataCollector.AddToDefines( -1, defineValue ); - } - return m_availableVertData[ info ]; - } - } - - public string RegisterInfoOnSemantic( TemplateInfoOnSematics info, TemplateSemantics semantic, string name, WirePortDataType dataType, PrecisionType precisionType, bool requestNewInterpolator, string dataName = null ) - { - return RegisterInfoOnSemantic( m_currentDataCollector.PortCategory, info, semantic, name, dataType, precisionType, requestNewInterpolator, dataName ); - } - // This should only be used to semantics outside the text coord set - public string RegisterInfoOnSemantic( MasterNodePortCategory portCategory, TemplateInfoOnSematics info, TemplateSemantics semantic, string name, WirePortDataType dataType, PrecisionType precisionType, bool requestNewInterpolator, string dataName = null ) - { - if( portCategory == MasterNodePortCategory.Vertex ) - { - if( m_vertexDataDict.ContainsKey( semantic ) ) - { - return m_vertexDataDict[ semantic ].VarName; - } - - m_availableVertData.Add( info, - new InterpDataHelper( dataType, - string.Format( TemplateHelperFunctions.TemplateVarFormat, - m_currentTemplateData.VertexFunctionData.InVarName, - name ),true,true ) ); - - string vertInputVarType = UIUtils.PrecisionWirePortToCgType( precisionType, dataType ); - m_currentDataCollector.AddToVertexInput( - string.Format( TemplateHelperFunctions.InterpFullSemantic, - vertInputVarType, - name, - semantic ) ); - RegisterOnVertexData( semantic, dataType, name ); - return m_availableVertData[ info ].VarName; - } - else - { - //search if the correct vertex data is set ... - TemplateSemantics vertexSemantics = TemplateSemantics.NONE; - foreach( KeyValuePair<TemplateSemantics, TemplateVertexData> kvp in m_vertexDataDict ) - { - if( kvp.Value.DataInfo == info ) - { - vertexSemantics = kvp.Key; - break; - } - } - - // if not, add vertex data and create interpolator - if( vertexSemantics == TemplateSemantics.NONE ) - { - vertexSemantics = semantic; - - if( !m_vertexDataDict.ContainsKey( vertexSemantics ) ) - { - m_availableVertData.Add( info, - new InterpDataHelper( dataType, - string.Format( TemplateHelperFunctions.TemplateVarFormat, - m_currentTemplateData.VertexFunctionData.InVarName, - name ),true,true ) ); - - string vertInputVarType = UIUtils.PrecisionWirePortToCgType( precisionType, dataType ); - m_currentDataCollector.AddToVertexInput( - string.Format( TemplateHelperFunctions.InterpFullSemantic, - vertInputVarType, - name, - vertexSemantics ) ); - RegisterOnVertexData( vertexSemantics, dataType, name ); - } - } - - // either way create interpolator - - TemplateVertexData availableInterp = null; - if( requestNewInterpolator || IsSemanticUsedOnInterpolator( semantic ) ) - { - availableInterp = RequestNewInterpolator( dataType, false, dataName ); - } - else - { - availableInterp = RegisterOnInterpolator( semantic, dataType, dataName ); - } - - if( availableInterp != null ) - { - bool isPosition = vertexSemantics == TemplateSemantics.POSITION || vertexSemantics == TemplateSemantics.POSITION; - - string interpVarName = m_currentTemplateData.VertexFunctionData.OutVarName + "." + availableInterp.VarNameWithSwizzle; - string interpDecl = string.Format( TemplateHelperFunctions.TemplateVariableDecl, interpVarName, TemplateHelperFunctions.AutoSwizzleData( m_availableVertData[ info ].VarName, m_availableVertData[ info ].VarType, dataType, isPosition ) ); - m_currentDataCollector.AddToVertexInterpolatorsDecl( interpDecl ); - string finalVarName = m_currentTemplateData.FragmentFunctionData.InVarName + "." + availableInterp.VarNameWithSwizzle; - m_availableFragData.Add( info, new InterpDataHelper( dataType, finalVarName ) ); - return finalVarName; - } - } - return string.Empty; - } - - TemplateVertexData RegisterOnInterpolator( TemplateSemantics semantics, WirePortDataType dataType, string vertexDataName = null ) - { - if( vertexDataName == null ) - { - if( TemplateHelperFunctions.SemanticsDefaultName.ContainsKey( semantics ) ) - { - vertexDataName = TemplateHelperFunctions.SemanticsDefaultName[ semantics ]; - } - else - { - vertexDataName = string.Empty; - Debug.LogError( "No valid name given to vertex data" ); - } - } - - TemplateVertexData data = new TemplateVertexData( semantics, dataType, vertexDataName ); - m_interpolatorData.Interpolators.Add( data ); - string interpolator = string.Format( TemplateHelperFunctions.InterpFullSemantic, UIUtils.WirePortToCgType( dataType ), data.VarName, data.Semantics ); - m_currentDataCollector.AddToInterpolators( interpolator ); - return data; - } - - public void RegisterOnVertexData( TemplateSemantics semantics, WirePortDataType dataType, string varName ) - { - m_vertexDataDict.Add( semantics, new TemplateVertexData( semantics, dataType, varName ) ); - } - - public TemplateVertexData RequestMacroInterpolator( string varName ) - { - if( varName != null && m_registeredVertexData.ContainsKey( varName ) ) - { - return m_registeredVertexData[ varName ]; - } - - for( int i = 0; i < m_interpolatorData.AvailableInterpolators.Count; i++ ) - { - if( !m_interpolatorData.AvailableInterpolators[ i ].IsFull ) - { - TemplateVertexData data = m_interpolatorData.AvailableInterpolators[ i ].RequestChannels( WirePortDataType.FLOAT4, false, varName ); - if( data != null ) - { - if( !m_registeredVertexData.ContainsKey( data.VarName ) ) - { - m_registeredVertexData.Add( data.VarName, data ); - } - if( m_interpolatorData.AvailableInterpolators[ i ].Usage == 1 ) - { - string interpolator = string.Format( TemplateHelperFunctions.InterpMacro, varName, TemplateHelperFunctions.SemanticToInt[ data.Semantics ] ); - m_currentDataCollector.AddToInterpolators( interpolator ); - } - return data; - } - } - } - return null; - } - - public bool HasRawInterpolatorOfName( string name ) - { - return m_interpolatorData.HasRawInterpolatorOfName( name ); - } - - public TemplateVertexData RequestNewInterpolator( WirePortDataType dataType, bool isColor, string varName = null ) - { - if( varName != null && m_registeredVertexData.ContainsKey( varName ) ) - { - return m_registeredVertexData[ varName ]; - } - - for( int i = 0; i < m_interpolatorData.AvailableInterpolators.Count; i++ ) - { - if( !m_interpolatorData.AvailableInterpolators[ i ].IsFull ) - { - TemplateVertexData data = m_interpolatorData.AvailableInterpolators[ i ].RequestChannels( dataType, isColor, varName ); - if( data != null ) - { - if( !m_registeredVertexData.ContainsKey( data.VarName ) ) - { - m_registeredVertexData.Add( data.VarName, data ); - } - - if( m_interpolatorData.AvailableInterpolators[ i ].Usage == 1 ) - { - // First time using this interpolator, so we need to register it - string interpolator = string.Format( TemplateHelperFunctions.TexFullSemantic, - data.VarName, data.Semantics ); - m_currentDataCollector.AddToInterpolators( interpolator ); - } - return data; - } - } - } - - // This area is reached if max available interpolators from shader model is reached - // Nevertheless, we register all new interpolators to that list so no imediate compilation errors are thrown - // A warning message is then thrown to warn the user about this - int newInterpId = 1 + TemplateHelperFunctions.SemanticToInt[ m_interpolatorData.AvailableInterpolators[ m_interpolatorData.AvailableInterpolators.Count - 1 ].Semantic ]; - if( TemplateHelperFunctions.IntToSemantic.ContainsKey( newInterpId ) ) - { - TemplateInterpElement item = new TemplateInterpElement( TemplateHelperFunctions.IntToSemantic[ newInterpId ] ); - m_interpolatorData.AvailableInterpolators.Add( item ); - TemplateVertexData data = item.RequestChannels( dataType, isColor, varName ); - if( data != null ) - { - if( !m_registeredVertexData.ContainsKey( data.VarName ) ) - { - m_registeredVertexData.Add( data.VarName, data ); - } - - if( item.Usage == 1 ) - { - string interpolator = string.Format( TemplateHelperFunctions.TexFullSemantic, data.VarName, data.Semantics ); - m_currentDataCollector.AddToInterpolators( interpolator ); - } - return data; - } - } - - UIUtils.ShowMessage( "Maximum amount of interpolators exceeded", MessageSeverity.Error ); - return null; - } - - // Unused channels in interpolators must be set to something so the compiler doesn't generate warnings - public List<string> GetInterpUnusedChannels() - { - List<string> resetInstrucctions = new List<string>(); - - if( m_interpolatorData != null ) - { - for( int i = 0; i < m_interpolatorData.AvailableInterpolators.Count; i++ ) - { - if( m_interpolatorData.AvailableInterpolators[ i ].Usage > 0 && !m_interpolatorData.AvailableInterpolators[ i ].IsFull ) - { - string channels = string.Empty; - bool[] availableChannels = m_interpolatorData.AvailableInterpolators[ i ].AvailableChannels; - for( int j = 0; j < availableChannels.Length; j++ ) - { - if( availableChannels[ j ] ) - { - channels += TemplateHelperFunctions.VectorSwizzle[ j ]; - } - } - - resetInstrucctions.Add( string.Format( "{0}.{1}.{2} = 0;", m_currentTemplateData.VertexFunctionData.OutVarName, m_interpolatorData.AvailableInterpolators[ i ].Name, channels ) ); - } - } - } - - if( resetInstrucctions.Count > 0 ) - { - resetInstrucctions.Insert( 0, "\n//setting value to unused interpolator channels and avoid initialization warnings" ); - } - - return resetInstrucctions; - } - - public bool GetCustomInterpolatedData( TemplateInfoOnSematics info, WirePortDataType type, PrecisionType precisionType, ref string result, bool useMasterNodeCategory, MasterNodePortCategory customCategory ) - { - bool isPosition = info == TemplateInfoOnSematics.POSITION || - info == TemplateInfoOnSematics.CLIP_POS || - info == TemplateInfoOnSematics.SCREEN_POSITION || - info == TemplateInfoOnSematics.SCREEN_POSITION_NORMALIZED || - info == TemplateInfoOnSematics.WORLD_POSITION || - info == TemplateInfoOnSematics.RELATIVE_WORLD_POS; - - - MasterNodePortCategory category = useMasterNodeCategory ? m_currentDataCollector.PortCategory : customCategory; - if( category == MasterNodePortCategory.Vertex ) - { - if( m_specialVertexLocalVars.ContainsKey( info ) ) - { - result = m_specialVertexLocalVars[ info ].LocalVarName; - if( m_specialVertexLocalVars[ info ].DataType != type ) - { - result = TemplateHelperFunctions.AutoSwizzleData( result, m_specialVertexLocalVars[ info ].DataType, type , isPosition ); - } - - string defineValue = string.Empty; - if( TemplateHelperFunctions.InfoToDefineVertex.TryGetValue( info, out defineValue ) ) - m_currentDataCollector.AddToDefines( -1, defineValue ); - - return true; - } - } - - if( category == MasterNodePortCategory.Fragment ) - { - if( m_specialFragmentLocalVars.ContainsKey( info ) ) - { - result = m_specialFragmentLocalVars[ info ].LocalVarName; - if( m_specialFragmentLocalVars[ info ].DataType != type ) - { - result = TemplateHelperFunctions.AutoSwizzleData( result, m_specialFragmentLocalVars[ info ].DataType, type, isPosition ); - } - - string defineValue = string.Empty; - if( TemplateHelperFunctions.InfoToDefineFrag.TryGetValue( info, out defineValue )) - m_currentDataCollector.AddToDefines( -1, defineValue ); - return true; - } - - if( m_availableFragData.ContainsKey( info ) ) - { - if( m_availableFragData[ info ].IsSingleComponent ) - { - result = m_availableFragData[ info ].VarName; - if( m_availableFragData[ info ].VarType != type ) - { - result = TemplateHelperFunctions.AutoSwizzleData( result, m_availableFragData[ info ].VarType, type, isPosition ); - } - return true; - } - else if( TemplateHelperFunctions.InfoToLocalVar.ContainsKey( info ) && TemplateHelperFunctions.InfoToWirePortType.ContainsKey( info ) ) - { - result = TemplateHelperFunctions.InfoToLocalVar[ info ]; - m_currentDataCollector.AddLocalVariable( -1, precisionType, TemplateHelperFunctions.InfoToWirePortType[ info ], result, m_availableFragData[ info ].VarName ); - return true; - } - } - } - return false; - } - - public string GetVertexPosition( WirePortDataType type, PrecisionType precisionType, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) - { - if( HasInfo( TemplateInfoOnSematics.POSITION, useMasterNodeCategory, customCategory ) ) - { - InterpDataHelper info = GetInfo( TemplateInfoOnSematics.POSITION, useMasterNodeCategory, customCategory ); - if( type != WirePortDataType.OBJECT && type != info.VarType ) - return TemplateHelperFunctions.AutoSwizzleData( info.VarName, info.VarType, type,true ); - else - return info.VarName; - } - else - { - MasterNodePortCategory portCategory = useMasterNodeCategory ? m_currentDataCollector.PortCategory : customCategory; - string name = "ase_vertex_pos"; - string varName = RegisterInfoOnSemantic( portCategory, TemplateInfoOnSematics.POSITION, TemplateSemantics.POSITION, name, WirePortDataType.FLOAT4, precisionType, true ); - if( type != WirePortDataType.OBJECT && type != WirePortDataType.FLOAT4 ) - return TemplateHelperFunctions.AutoSwizzleData( varName, WirePortDataType.FLOAT4, type,true ); - else - return varName; - } - } - - private const string InstancingLibStandard = "UnityInstancing.cginc"; - private const string InstancingLibSRP = "Packages/com.unity.render-pipelines.core/ShaderLibrary/UnityInstancing.hlsl"; - - public void SetupInstancing() - { - if( !HasInfo( TemplateInfoOnSematics.INSTANCE_ID ) ) - { - m_currentDataCollector.AddToPragmas( -1, IOUtils.InstancedPropertiesHeader ); - m_currentDataCollector.AddToIncludes( -1, IsSRP ? InstancingLibSRP : InstancingLibStandard ); - m_currentDataCollector.AddToVertexInput( Constants.InstanceIdMacro ); - m_currentDataCollector.AddToInterpolators( Constants.InstanceIdMacro ); - m_currentDataCollector.AddToLocalVariables( MasterNodePortCategory.Vertex, -1, string.Format( "UNITY_SETUP_INSTANCE_ID({0});", m_currentTemplateData.VertexFunctionData.InVarName ) ); - m_currentDataCollector.AddToLocalVariables( MasterNodePortCategory.Vertex, -1, string.Format( "UNITY_TRANSFER_INSTANCE_ID({0}, {1});", m_currentTemplateData.VertexFunctionData.InVarName, m_currentTemplateData.VertexFunctionData.OutVarName ) ); - m_currentDataCollector.AddToLocalVariables( MasterNodePortCategory.Fragment, -1, string.Format( "UNITY_SETUP_INSTANCE_ID({0});", m_currentTemplateData.FragmentFunctionData.InVarName ) ); - } - } - - public string GetVertexColor( PrecisionType precisionType ) - { - if( HasInfo( TemplateInfoOnSematics.COLOR ) ) - { - return GetInfo( TemplateInfoOnSematics.COLOR ).VarName; - } - else - { - string name = "ase_color"; - return RegisterInfoOnSemantic( TemplateInfoOnSematics.COLOR, TemplateSemantics.COLOR, name, WirePortDataType.FLOAT4, precisionType, false ); - } - } - - public string GetVertexNormal( PrecisionType precisionType, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) - { - if( HasInfo( TemplateInfoOnSematics.NORMAL, useMasterNodeCategory, customCategory ) ) - { - InterpDataHelper info = GetInfo( TemplateInfoOnSematics.NORMAL, useMasterNodeCategory, customCategory ); - return TemplateHelperFunctions.AutoSwizzleData( info.VarName, info.VarType, WirePortDataType.FLOAT3 , false); - } - else - { - MasterNodePortCategory category = useMasterNodeCategory ? m_currentDataCollector.PortCategory : customCategory; - string name = "ase_normal"; - return RegisterInfoOnSemantic( category, TemplateInfoOnSematics.NORMAL, TemplateSemantics.NORMAL, name, WirePortDataType.FLOAT3, precisionType, false ); - } - } - - public string GetWorldNormal( PrecisionType precisionType = PrecisionType.Float, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment, bool normalize = false ) - { - string result = string.Empty; - if( GetCustomInterpolatedData( TemplateInfoOnSematics.WORLD_NORMAL, WirePortDataType.FLOAT3, precisionType, ref result, useMasterNodeCategory, customCategory ) ) - { - if( normalize ) - return string.Format( "normalize( {0} )", result ); - else - return result; - } - - string varName = normalize ? "normalizeWorldNormal" : GeneratorUtils.WorldNormalStr; - - if( HasCustomInterpolatedData( varName, useMasterNodeCategory, customCategory ) ) - return varName; - - string worldNormalValue = string.Empty; - - if( !GetCustomInterpolatedData( TemplateInfoOnSematics.WORLD_NORMAL, WirePortDataType.FLOAT3, precisionType, ref worldNormalValue, false, MasterNodePortCategory.Vertex ) ) - { - string vertexNormal = GetVertexNormal( precisionType, false, MasterNodePortCategory.Vertex ); - string formatStr = string.Empty; - if( IsSRP ) - formatStr = "TransformObjectToWorldNormal({0})"; - else - formatStr = "UnityObjectToWorldNormal({0})"; - worldNormalValue = string.Format( formatStr, vertexNormal ); - } - - if( normalize ) - worldNormalValue = string.Format( "normalize( {0} )", worldNormalValue ); - - RegisterCustomInterpolatedData( varName, WirePortDataType.FLOAT3, precisionType, worldNormalValue, useMasterNodeCategory, customCategory ); - return varName; - } - - public string GetWorldNormal( int uniqueId, PrecisionType precisionType, string normal, string outputId ) - { - string tanToWorld0 = string.Empty; - string tanToWorld1 = string.Empty; - string tanToWorld2 = string.Empty; - - GetWorldTangentTf( precisionType, out tanToWorld0, out tanToWorld1, out tanToWorld2, true ); - - string tanNormal = "tanNormal" + outputId; - m_currentDataCollector.AddLocalVariable( uniqueId, "float3 " + tanNormal + " = " + normal + ";" ); - return string.Format( "float3(dot({1},{0}), dot({2},{0}), dot({3},{0}))", tanNormal, tanToWorld0, tanToWorld1, tanToWorld2 ); - } - - public string GetVertexTangent( WirePortDataType type, PrecisionType precisionType, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) - { - if( HasInfo( TemplateInfoOnSematics.TANGENT, useMasterNodeCategory, customCategory ) ) - { - InterpDataHelper info = GetInfo( TemplateInfoOnSematics.TANGENT, useMasterNodeCategory, customCategory ); - if( type != WirePortDataType.OBJECT && type != info.VarType ) - return TemplateHelperFunctions.AutoSwizzleData( info.VarName, info.VarType, type , false); - else - return info.VarName; - } - else - { - MasterNodePortCategory category = useMasterNodeCategory ? m_currentDataCollector.PortCategory : customCategory; - string name = "ase_tangent"; - string varName = RegisterInfoOnSemantic( category, TemplateInfoOnSematics.TANGENT, TemplateSemantics.TANGENT, name, WirePortDataType.FLOAT4, precisionType, false ); - if( type != WirePortDataType.OBJECT && type != WirePortDataType.FLOAT4 ) - return TemplateHelperFunctions.AutoSwizzleData( varName, WirePortDataType.FLOAT4, type , false ); - else - return varName; - } - } - - public string GetVertexBitangent( PrecisionType precisionType, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) - { - string varName = GeneratorUtils.VertexBitangentStr; - if( HasCustomInterpolatedData( varName, useMasterNodeCategory, customCategory ) ) - return varName; - - string tangentValue = GetVertexTangent( WirePortDataType.FLOAT3, precisionType, false, MasterNodePortCategory.Vertex ); - string normalValue = GetVertexNormal( precisionType, false, MasterNodePortCategory.Vertex ); - - string bitangentValue = string.Format( "cross({0},{1})", normalValue, tangentValue ); - RegisterCustomInterpolatedData( varName, WirePortDataType.FLOAT3, precisionType, bitangentValue, useMasterNodeCategory, customCategory ); - return varName; - } - - public string GetWorldTangent( PrecisionType precisionType, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) - { - string result = string.Empty; - if( GetCustomInterpolatedData( TemplateInfoOnSematics.WORLD_TANGENT, WirePortDataType.FLOAT3, precisionType, ref result, useMasterNodeCategory, customCategory ) ) - { - return result; - } - - string varName = GeneratorUtils.WorldTangentStr; - if( HasCustomInterpolatedData( varName, useMasterNodeCategory, customCategory ) ) - return varName; - - string worldTangentValue = string.Empty; - if( !GetCustomInterpolatedData( TemplateInfoOnSematics.WORLD_TANGENT, WirePortDataType.FLOAT3, precisionType, ref worldTangentValue, false, MasterNodePortCategory.Vertex ) ) - { - string vertexTangent = GetVertexTangent( WirePortDataType.FLOAT4, precisionType, false, MasterNodePortCategory.Vertex ); - string formatStr = string.Empty; - - if( IsSRP ) - formatStr = "TransformObjectToWorldDir({0}.xyz)"; - else - formatStr = "UnityObjectToWorldDir({0})"; - - worldTangentValue = string.Format( formatStr, vertexTangent ); - } - RegisterCustomInterpolatedData( varName, WirePortDataType.FLOAT3, precisionType, worldTangentValue, useMasterNodeCategory, customCategory ); - return varName; - } - - public string GetTangentSign( PrecisionType precisionType, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) - { - string varName = GeneratorUtils.VertexTangentSignStr; - if( HasCustomInterpolatedData( varName, useMasterNodeCategory, customCategory ) ) - return varName; - - string tangentValue = GetVertexTangent( WirePortDataType.FLOAT4, precisionType, false, MasterNodePortCategory.Vertex ); - string tangentSignValue = string.Format( "{0}.w * unity_WorldTransformParams.w", tangentValue ); - RegisterCustomInterpolatedData( varName, WirePortDataType.FLOAT, precisionType, tangentSignValue, useMasterNodeCategory, customCategory ); - return varName; - } - - - public string GetWorldBinormal( PrecisionType precisionType, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) - { - string result = string.Empty; - if( GetCustomInterpolatedData( TemplateInfoOnSematics.WORLD_BITANGENT, WirePortDataType.FLOAT3, precisionType, ref result, useMasterNodeCategory, customCategory ) ) - { - return result; - } - - string varName = GeneratorUtils.WorldBitangentStr; - if( HasCustomInterpolatedData( varName, useMasterNodeCategory, customCategory ) ) - return varName; - - string worldBinormal = string.Empty; - if( !GetCustomInterpolatedData( TemplateInfoOnSematics.WORLD_BITANGENT, WirePortDataType.FLOAT3, precisionType, ref worldBinormal, false, MasterNodePortCategory.Vertex ) ) - { - string worldNormal = GetWorldNormal( precisionType, false, MasterNodePortCategory.Vertex ); - string worldtangent = GetWorldTangent( precisionType, false, MasterNodePortCategory.Vertex ); - string tangentSign = GetTangentSign( precisionType, false, MasterNodePortCategory.Vertex ); - worldBinormal = string.Format( "cross( {0}, {1} ) * {2}", worldNormal, worldtangent, tangentSign ); - } - - RegisterCustomInterpolatedData( varName, WirePortDataType.FLOAT3, PrecisionType.Float, worldBinormal, useMasterNodeCategory, customCategory ); - return varName; - } - - public string GetWorldReflection( PrecisionType precisionType, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment, bool normalize = false ) - { - string varName = GeneratorUtils.WorldReflectionStr;//UIUtils.GetInputValueFromType( SurfaceInputs.WORLD_REFL ); - if( normalize ) - varName = "normalized" + varName; - - if( HasCustomInterpolatedData( varName, useMasterNodeCategory, customCategory ) ) - return varName; - - string worldNormal = GetWorldNormal( precisionType ); - string worldViewDir = GetViewDir(); - string worldRefl = string.Format( "reflect(-{0}, {1})", worldViewDir, worldNormal ); - - if( normalize ) - worldRefl = string.Format( "normalize( {0} )", worldRefl ); - - m_currentDataCollector.AddLocalVariable( -1, precisionType, WirePortDataType.FLOAT3, varName, worldRefl ); - return varName; - } - - public string GetWorldReflection( PrecisionType precisionType, string normal ) - { - string tanToWorld0 = string.Empty; - string tanToWorld1 = string.Empty; - string tanToWorld2 = string.Empty; - - GetWorldTangentTf( precisionType, out tanToWorld0, out tanToWorld1, out tanToWorld2 ); - string worldRefl = GetViewDir(); - - return string.Format( "reflect( -{0}, float3( dot( {2}, {1} ), dot( {3}, {1} ), dot( {4}, {1} ) ) )", worldRefl, normal, tanToWorld0, tanToWorld1, tanToWorld2 ); - } - - public string GetLightAtten( int uniqueId, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) - { - //string result = string.Empty; - //if( GetCustomInterpolatedData( TemplateInfoOnSematics.WORLD_POSITION, PrecisionType.Float, ref result, useMasterNodeCategory, customCategory ) ) - //{ - // return result; - //} - - //string varName = GeneratorUtils.WorldPositionStr;//UIUtils.GetInputValueFromType( SurfaceInputs.WORLD_POS ); - //if( HasCustomInterpolatedData( varName, useMasterNodeCategory, customCategory ) ) - // return varName; - - //if( !m_availableVertData.ContainsKey( TemplateInfoOnSematics.POSITION ) ) - //{ - // UIUtils.ShowMessage( "Attempting to access inexisting vertex position to calculate world pos" ); - // return "fixed3(0,0,0)"; - //} - - //string vertexPos = m_availableVertData[ TemplateInfoOnSematics.POSITION ].VarName; - //string worldPosConversion = string.Format( "mul(unity_ObjectToWorld, {0}).xyz", vertexPos ); - - //RegisterCustomInterpolatedData( varName, WirePortDataType.FLOAT3, PrecisionType.Float, worldPosConversion, useMasterNodeCategory, customCategory ); - //return varName; - - m_currentDataCollector.AddToIncludes( uniqueId, Constants.UnityAutoLightLib ); - m_currentDataCollector.AddToDefines( uniqueId, "ASE_SHADOWS 1" ); -#if UNITY_5_6_OR_NEWER - RequestMacroInterpolator( "UNITY_SHADOW_COORDS" ); -#else - RequestMacroInterpolator( "SHADOW_COORDS" ); - m_currentDataCollector.AddToPragmas( uniqueId, "multi_compile_fwdbase" ); -#endif - //string vOutName = CurrentTemplateData.VertexFunctionData.OutVarName; - string fInName = CurrentTemplateData.FragmentFunctionData.InVarName; - string worldPos = GetWorldPos(); - m_currentDataCollector.AddLocalVariable( uniqueId, "UNITY_LIGHT_ATTENUATION(ase_atten, " + fInName + ", " + worldPos + ")" ); - return "ase_atten"; - - } - - public string GenerateRotationIndependentObjectScale( ref MasterNodeDataCollector dataCollector, int uniqueId ) - { - string value = string.Empty; - - if( m_currentSRPType != TemplateSRPType.BuiltIn ) - { - value = "float3( length( GetWorldToObjectMatrix()[ 0 ].xyz ), length( GetWorldToObjectMatrix()[ 1 ].xyz ), length( GetWorldToObjectMatrix()[ 2 ].xyz ) )"; - } - else - { - value = "float3( length( unity_WorldToObject[ 0 ].xyz ), length( unity_WorldToObject[ 1 ].xyz ), length( unity_WorldToObject[ 2 ].xyz ) )"; - } - value = "( 1.0 / "+ value +" )"; - dataCollector.AddLocalVariable( uniqueId, PrecisionType.Float, WirePortDataType.FLOAT3, GeneratorUtils.ParentObjectScaleStr, value ); - return GeneratorUtils.ParentObjectScaleStr; - } - - public string GenerateObjectScale( ref MasterNodeDataCollector dataCollector, int uniqueId ) - { - string value = string.Empty; - - if( m_currentSRPType != TemplateSRPType.BuiltIn ) - { - value = "float3( length( GetObjectToWorldMatrix()[ 0 ].xyz ), length( GetObjectToWorldMatrix()[ 1 ].xyz ), length( GetObjectToWorldMatrix()[ 2 ].xyz ) )"; - } - else - { - value = "float3( length( unity_ObjectToWorld[ 0 ].xyz ), length( unity_ObjectToWorld[ 1 ].xyz ), length( unity_ObjectToWorld[ 2 ].xyz ) )"; - } - dataCollector.AddLocalVariable( uniqueId, PrecisionType.Float, WirePortDataType.FLOAT3, GeneratorUtils.ObjectScaleStr, value ); - return GeneratorUtils.ObjectScaleStr; - } - - public string GetWorldPos( bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) - { - // overriding precision - var precision = PrecisionType.Float; - - string result = string.Empty; - if( GetCustomInterpolatedData( TemplateInfoOnSematics.WORLD_POSITION, WirePortDataType.FLOAT3, precision, ref result, useMasterNodeCategory, customCategory ) ) - { - return result; - } - else if( m_currentSRPType == TemplateSRPType.HD ) - { - if( GetCustomInterpolatedData( TemplateInfoOnSematics.RELATIVE_WORLD_POS, WirePortDataType.FLOAT3, precision, ref result, useMasterNodeCategory, customCategory ) ) - { - string worldPosVarName = GeneratorUtils.WorldPositionStr; - string relWorldPosConversion = string.Format( "GetAbsolutePositionWS( {0} )", result ); - m_currentDataCollector.AddLocalVariable( -1, precision, WirePortDataType.FLOAT3, worldPosVarName, relWorldPosConversion ); - return worldPosVarName; - } - } - - string varName = GeneratorUtils.WorldPositionStr;//UIUtils.GetInputValueFromType( SurfaceInputs.WORLD_POS ); - if( HasCustomInterpolatedData( varName, useMasterNodeCategory, customCategory ) ) - return varName; - - if( !m_availableVertData.ContainsKey( TemplateInfoOnSematics.POSITION ) ) - { - UIUtils.ShowMessage( "Attempting to access inexisting vertex position to calculate world pos" ); - return "half3(0,0,0)"; - } - - string vertexPos = m_availableVertData[ TemplateInfoOnSematics.POSITION ].VarName; - - string worldPosConversion = string.Empty; - - //Check if world pos already defined in the vertex body - if( !GetCustomInterpolatedData( TemplateInfoOnSematics.WORLD_POSITION, WirePortDataType.FLOAT3, precision, ref worldPosConversion, false, MasterNodePortCategory.Vertex ) ) - { - if( m_currentSRPType == TemplateSRPType.HD ) - { -#if UNITY_2018_3_OR_NEWER - worldPosConversion = string.Format( "GetAbsolutePositionWS( TransformObjectToWorld( ({0}).xyz ) )", vertexPos ); -#else - worldPosConversion = string.Format( "GetAbsolutePositionWS( mul( GetObjectToWorldMatrix(), {0}).xyz )", vertexPos ); -#endif - } - else if( m_currentSRPType == TemplateSRPType.Lightweight ) - { - worldPosConversion = string.Format( "mul(GetObjectToWorldMatrix(), {0}).xyz", vertexPos ); - } - else - { - worldPosConversion = string.Format( "mul(unity_ObjectToWorld, {0}).xyz", vertexPos ); - } - } - RegisterCustomInterpolatedData( varName, WirePortDataType.FLOAT3, precision, worldPosConversion, useMasterNodeCategory, customCategory ); - return varName; - } - - public string GetClipPosForValue( string customVertexPos, string outputId, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) - { - string varName = GeneratorUtils.ClipPositionStr + outputId; - if( HasCustomInterpolatedData( varName, useMasterNodeCategory, customCategory ) ) - return varName; - - if( !m_availableVertData.ContainsKey( TemplateInfoOnSematics.POSITION ) ) - { - UIUtils.ShowMessage( "Attempting to access inexisting vertex position to calculate clip pos" ); - return "half4(0,0,0,0)"; - } - - string formatStr = string.Empty; - switch( m_currentSRPType ) - { - default: - case TemplateSRPType.BuiltIn: - formatStr = "UnityObjectToClipPos({0})"; - break; - case TemplateSRPType.HD: - formatStr = "TransformWorldToHClip( TransformObjectToWorld({0}))"; - break; - case TemplateSRPType.Lightweight: - formatStr = "TransformObjectToHClip(({0}).xyz)"; - break; - } - - string clipSpaceConversion = string.Format( formatStr, customVertexPos ); - RegisterCustomInterpolatedData( varName, WirePortDataType.FLOAT4, PrecisionType.Float, clipSpaceConversion, useMasterNodeCategory, customCategory ); - return varName; - } - - public string GetClipPos( bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) - { - string varName = GeneratorUtils.ClipPositionStr;// "clipPos"; - if( HasCustomInterpolatedData( varName, useMasterNodeCategory, customCategory ) ) - return varName; - - if( !m_availableVertData.ContainsKey( TemplateInfoOnSematics.POSITION ) ) - { - UIUtils.ShowMessage( "Attempting to access inexisting vertex position to calculate clip pos" ); - return "half4(0,0,0,0)"; - } - - string vertexPos = m_availableVertData[ TemplateInfoOnSematics.POSITION ].VarName; - - string formatStr = string.Empty; - switch( m_currentSRPType ) - { - default: - case TemplateSRPType.BuiltIn: - formatStr = "UnityObjectToClipPos({0})"; - break; - case TemplateSRPType.HD: - formatStr = "TransformWorldToHClip( TransformObjectToWorld({0}))"; - break; - case TemplateSRPType.Lightweight: - formatStr = "TransformObjectToHClip(({0}).xyz)"; - break; - } - - string clipSpaceConversion = string.Format( formatStr, vertexPos ); - RegisterCustomInterpolatedData( varName, WirePortDataType.FLOAT4, PrecisionType.Float, clipSpaceConversion, useMasterNodeCategory, customCategory ); - return varName; - } - - public string GetScreenPosForValue( PrecisionType precision, string customVertexPos, string outputId, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) - { - // overriding precision - precision = PrecisionType.Float; - - string varName = UIUtils.GetInputValueFromType( SurfaceInputs.SCREEN_POS ) + outputId; - if( HasCustomInterpolatedData( varName, useMasterNodeCategory, customCategory ) ) - return varName; - - string clipSpacePos = GetClipPosForValue( customVertexPos, outputId, false, MasterNodePortCategory.Vertex ); - string screenPosConversion = string.Empty; - if( m_currentSRPType == TemplateSRPType.HD ) - { - screenPosConversion = string.Format( "ComputeScreenPos( {0} , _ProjectionParams.x )", clipSpacePos ); - } - else - { - screenPosConversion = string.Format( "ComputeScreenPos({0})", clipSpacePos ); - } - RegisterCustomInterpolatedData( varName, WirePortDataType.FLOAT4, precision, screenPosConversion, useMasterNodeCategory, customCategory ); - return varName; - } - - public string GetScreenPos( PrecisionType precision, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) - { - // overriding precision - precision = PrecisionType.Float; - - string result = string.Empty; - if( GetCustomInterpolatedData( TemplateInfoOnSematics.SCREEN_POSITION, WirePortDataType.FLOAT4, precision, ref result, useMasterNodeCategory, customCategory ) ) - { - return result; - } - - string varName = UIUtils.GetInputValueFromType( SurfaceInputs.SCREEN_POS ); - if( HasCustomInterpolatedData( varName, useMasterNodeCategory, customCategory ) ) - return varName; - - string clipSpacePos = GetClipPos( false, MasterNodePortCategory.Vertex ); - string screenPosConversion = string.Empty; - if( m_currentSRPType == TemplateSRPType.HD ) - { - screenPosConversion = string.Format( "ComputeScreenPos( {0} , _ProjectionParams.x )", clipSpacePos ); - } - else - { - screenPosConversion = string.Format( "ComputeScreenPos({0})", clipSpacePos ); - } - RegisterCustomInterpolatedData( varName, WirePortDataType.FLOAT4, precision, screenPosConversion, useMasterNodeCategory, customCategory ); - return varName; - } - - public string GetScreenPosNormalized( PrecisionType precision, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) - { - string result = string.Empty; - if( GetCustomInterpolatedData( TemplateInfoOnSematics.SCREEN_POSITION_NORMALIZED, WirePortDataType.FLOAT4, precision, ref result, useMasterNodeCategory, customCategory ) ) - { - return result; - } - - string varName = GeneratorUtils.ScreenPositionNormalizedStr;// "norm" + UIUtils.GetInputValueFromType( SurfaceInputs.SCREEN_POS ); - string screenPos = GetScreenPos( precision, useMasterNodeCategory, customCategory ); - string clipPlaneTestOp = string.Format( "{0}.z = ( UNITY_NEAR_CLIP_VALUE >= 0 ) ? {0}.z : {0}.z * 0.5 + 0.5;", varName ); - m_currentDataCollector.AddLocalVariable( -1, precision, WirePortDataType.FLOAT4, varName, string.Format( GeneratorUtils.NormalizedScreenPosFormat, screenPos ) ); - m_currentDataCollector.AddLocalVariable( -1, clipPlaneTestOp ); - return varName; - } - - public string GetViewDir( bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment, NormalizeType normalizeType = NormalizeType.Regular ) - { - // overriding precision - var precision = PrecisionType.Float; - - string result = string.Empty; - if( GetCustomInterpolatedData( TemplateInfoOnSematics.WORLD_VIEW_DIR, WirePortDataType.FLOAT3, precision, ref result, useMasterNodeCategory, customCategory ) ) - return result; - - string varName = GeneratorUtils.WorldViewDirectionStr;//UIUtils.GetInputValueFromType( SurfaceInputs.VIEW_DIR ); - if( HasCustomInterpolatedData( varName, useMasterNodeCategory, customCategory ) ) - return varName; - - string worldPos = GetWorldPos(); - - string formatStr = string.Empty; - if( IsSRP ) - formatStr = "( _WorldSpaceCameraPos.xyz - {0} )"; - else - formatStr = "UnityWorldSpaceViewDir({0})"; - - string viewDir = string.Format( formatStr, worldPos ); - m_currentDataCollector.AddLocalVariable( -1, precision, WirePortDataType.FLOAT3, varName, viewDir ); - - switch( normalizeType ) - { - default: - case NormalizeType.Off: - break; - case NormalizeType.Regular: - m_currentDataCollector.AddLocalVariable( -1, varName + " = normalize(" + varName + ");" ); - break; - case NormalizeType.Safe: - m_currentDataCollector.AddLocalVariable( -1, varName + " = " + TemplateHelperFunctions.SafeNormalize( m_currentDataCollector, varName ) + ";" ); - break; - } - - - //RegisterCustomInterpolatedData( varName, WirePortDataType.FLOAT3, PrecisionType.Float, viewDir, useMasterNodeCategory, customCategory ); - return varName; - } - - public string GetTangentViewDir( PrecisionType precisionType, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment, NormalizeType normalizeType = NormalizeType.Regular ) - { - string varName = GeneratorUtils.TangentViewDirectionStr; - if( HasCustomInterpolatedData( varName, useMasterNodeCategory, customCategory ) ) - return varName; - - string tanToWorld0 = string.Empty; - string tanToWorld1 = string.Empty; - string tanToWorld2 = string.Empty; - - GetWorldTangentTf( precisionType, out tanToWorld0, out tanToWorld1, out tanToWorld2 ); - string viewDir = GetViewDir(); - string tanViewDir = string.Format( " {0} * {3}.x + {1} * {3}.y + {2} * {3}.z", tanToWorld0, tanToWorld1, tanToWorld2, viewDir ); - - m_currentDataCollector.AddLocalVariable( -1, precisionType, WirePortDataType.FLOAT3, varName, tanViewDir ); - switch( normalizeType ) - { - default: - case NormalizeType.Off: break; - case NormalizeType.Regular: - m_currentDataCollector.AddLocalVariable( -1, varName + " = normalize(" + varName + ");" ); - break; - case NormalizeType.Safe: - m_currentDataCollector.AddLocalVariable( -1, varName + " = " + TemplateHelperFunctions.SafeNormalize( m_currentDataCollector, varName ) + ";" ); - break; - } - - return varName; - } - - public void GetWorldTangentTf( PrecisionType precisionType, out string tanToWorld0, out string tanToWorld1, out string tanToWorld2, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) - { - tanToWorld0 = "tanToWorld0"; - tanToWorld1 = "tanToWorld1"; - tanToWorld2 = "tanToWorld2"; - - if( HasCustomInterpolatedData( tanToWorld0, useMasterNodeCategory, customCategory ) || - HasCustomInterpolatedData( tanToWorld1, useMasterNodeCategory, customCategory ) || - HasCustomInterpolatedData( tanToWorld2, useMasterNodeCategory, customCategory ) ) - return; - - string worldTangent = GetWorldTangent( precisionType, useMasterNodeCategory, customCategory ); - string worldNormal = GetWorldNormal( precisionType, useMasterNodeCategory, customCategory ); - string worldBinormal = GetWorldBinormal( precisionType, useMasterNodeCategory, customCategory ); - - string tanToWorldVar0 = string.Format( "float3( {0}.x, {1}.x, {2}.x )", worldTangent, worldBinormal, worldNormal ); - string tanToWorldVar1 = string.Format( "float3( {0}.y, {1}.y, {2}.y )", worldTangent, worldBinormal, worldNormal ); - string tanToWorldVar2 = string.Format( "float3( {0}.z, {1}.z, {2}.z )", worldTangent, worldBinormal, worldNormal ); - - if( customCategory == MasterNodePortCategory.Vertex ) - { - RegisterCustomInterpolatedData( tanToWorld0, WirePortDataType.FLOAT3, precisionType, tanToWorldVar0, useMasterNodeCategory, customCategory ); - RegisterCustomInterpolatedData( tanToWorld1, WirePortDataType.FLOAT3, precisionType, tanToWorldVar1, useMasterNodeCategory, customCategory ); - RegisterCustomInterpolatedData( tanToWorld2, WirePortDataType.FLOAT3, precisionType, tanToWorldVar2, useMasterNodeCategory, customCategory ); - } - else - { - m_currentDataCollector.AddLocalVariable( -1, precisionType, WirePortDataType.FLOAT3, tanToWorld0, tanToWorldVar0 ); - m_currentDataCollector.AddLocalVariable( -1, precisionType, WirePortDataType.FLOAT3, tanToWorld1, tanToWorldVar1 ); - m_currentDataCollector.AddLocalVariable( -1, precisionType, WirePortDataType.FLOAT3, tanToWorld2, tanToWorldVar2 ); - } - } - - public string GetTangentToWorldMatrixFast( PrecisionType precisionType, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) - { - string worldTangent = GetWorldTangent( precisionType ); - string worldNormal = GetWorldNormal( precisionType ); - string worldBinormal = GetWorldBinormal( precisionType ); - - string varName = GeneratorUtils.TangentToWorldFastStr; - if( HasCustomInterpolatedData( varName, useMasterNodeCategory, customCategory ) ) - return varName; - - string result = string.Format( "float3x3({0}.x,{1}.x,{2}.x,{0}.y,{1}.y,{2}.y,{0}.z,{1}.z,{2}.z)", worldTangent, worldBinormal, worldNormal ); - m_currentDataCollector.AddLocalVariable( -1, precisionType, WirePortDataType.FLOAT3x3, GeneratorUtils.TangentToWorldFastStr, result ); - return GeneratorUtils.TangentToWorldFastStr; - } - - public string GetTangentToWorldMatrixPrecise( PrecisionType precisionType, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) - { - string worldToTangent = GetWorldToTangentMatrix( precisionType, useMasterNodeCategory, customCategory ); - GeneratorUtils.Add3x3InverseFunction( ref m_currentDataCollector, UIUtils.PrecisionWirePortToCgType( precisionType, WirePortDataType.FLOAT ) ); - m_currentDataCollector.AddLocalVariable( -1, precisionType, WirePortDataType.FLOAT3x3, GeneratorUtils.TangentToWorldPreciseStr, string.Format( GeneratorUtils.Inverse3x3Header, worldToTangent ) ); - return GeneratorUtils.TangentToWorldPreciseStr; - } - - public string GetWorldToTangentMatrix( PrecisionType precisionType, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) - { - string worldTangent = GetWorldTangent( precisionType ); - string worldNormal = GetWorldNormal( precisionType ); - string worldBinormal = GetWorldBinormal( precisionType ); - - string varName = GeneratorUtils.WorldToTangentStr;// "worldToTanMat"; - if( HasCustomInterpolatedData( varName, useMasterNodeCategory, customCategory ) ) - return varName; - string worldTanMat = string.Format( "float3x3({0},{1},{2})", worldTangent, worldBinormal, worldNormal ); - - m_currentDataCollector.AddLocalVariable( -1, precisionType, WirePortDataType.FLOAT3x3, varName, worldTanMat ); - return varName; - } - - public string GetObjectToViewPos( PrecisionType precision, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) - { - // overriding precision - precision = PrecisionType.Float; - - string varName = "objectToViewPos"; - if( HasCustomInterpolatedData( varName, useMasterNodeCategory, customCategory ) ) - return varName; - string vertexPos = GetVertexPosition( WirePortDataType.FLOAT3, precision, false, MasterNodePortCategory.Vertex ); - - string formatStr = string.Empty; - if( IsSRP ) - formatStr = "TransformWorldToView(TransformObjectToWorld({0}))"; - else - formatStr = "UnityObjectToViewPos({0})"; - - string objectToViewPosValue = string.Format( formatStr, vertexPos ); - RegisterCustomInterpolatedData( varName, WirePortDataType.FLOAT3, precision, objectToViewPosValue, useMasterNodeCategory, customCategory ); - return varName; - } - - public string GetEyeDepth( PrecisionType precision, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment, int viewSpace = 0 ) - { - // overriding precision - precision = PrecisionType.Float; - - string varName = "eyeDepth"; - if( HasCustomInterpolatedData( varName, useMasterNodeCategory, customCategory ) ) - return varName; - string objectToView = GetObjectToViewPos( precision, false, MasterNodePortCategory.Vertex ); - string eyeDepthValue = string.Format( "-{0}.z", objectToView ); - if( viewSpace == 1 ) - { - eyeDepthValue += " * _ProjectionParams.w"; - } - - RegisterCustomInterpolatedData( varName, WirePortDataType.FLOAT, precision, eyeDepthValue, useMasterNodeCategory, customCategory ); - return varName; - } - - public string GetObjectSpaceLightDir( PrecisionType precisionType, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) - { - if( !IsSRP ) - { - m_currentDataCollector.AddToIncludes( -1, Constants.UnityLightingLib ); - m_currentDataCollector.AddToIncludes( -1, Constants.UnityAutoLightLib ); - } - - string varName = "objectSpaceLightDir"; - - if( HasCustomInterpolatedData( varName, useMasterNodeCategory, customCategory ) ) - return varName; - - string vertexPos = GetVertexPosition( WirePortDataType.FLOAT4, precisionType, false, MasterNodePortCategory.Vertex ); - - string objectSpaceLightDir = string.Empty; - switch( m_currentSRPType ) - { - default: - case TemplateSRPType.BuiltIn: - objectSpaceLightDir = string.Format( "ObjSpaceLightDir({0})", vertexPos ); - break; - case TemplateSRPType.HD: - string worldSpaceLightDir = GetWorldSpaceLightDir( precisionType, useMasterNodeCategory, customCategory ); - objectSpaceLightDir = string.Format( "mul( GetWorldToObjectMatrix(), {0} ).xyz", worldSpaceLightDir ); - break; - case TemplateSRPType.Lightweight: - objectSpaceLightDir = "mul( GetWorldToObjectMatrix(), _MainLightPosition ).xyz"; - break; - } - - RegisterCustomInterpolatedData( varName, WirePortDataType.FLOAT3, precisionType, objectSpaceLightDir, useMasterNodeCategory, customCategory ); - return varName; - } - - public string GetWorldSpaceLightDir( PrecisionType precision, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) - { - if( !IsSRP ) - { - m_currentDataCollector.AddToIncludes( -1, Constants.UnityLightingLib ); - m_currentDataCollector.AddToIncludes( -1, Constants.UnityAutoLightLib ); - AddLateDirective( AdditionalLineType.Custom, "//This is a late directive" ); - } - else - { - - string lightVar; - if( m_currentSRPType == TemplateSRPType.HD ) - { - AddHDLightInfo(); - lightVar = "-" + string.Format( TemplateHelperFunctions.HDLightInfoFormat, "0", "forward" ); - } - else - { - lightVar = "_MainLightPosition.xyz"; - } - return m_currentDataCollector.SafeNormalizeLightDir ? string.Format( "SafeNormalize({0})", lightVar ) : lightVar; - } - - string varName = "worldSpaceLightDir"; - if( HasCustomInterpolatedData( varName, useMasterNodeCategory, customCategory ) ) - return varName; - - string worldPos = GetWorldPos( useMasterNodeCategory, customCategory ); - string worldSpaceLightDir = string.Format( "UnityWorldSpaceLightDir({0})", worldPos ); - if( m_currentDataCollector.SafeNormalizeLightDir ) - { - if( IsSRP ) - { - worldSpaceLightDir = string.Format( "SafeNormalize{0})", worldSpaceLightDir ); - } - else - { - m_currentDataCollector.AddToIncludes( -1, Constants.UnityBRDFLib ); - worldSpaceLightDir = string.Format( "Unity_SafeNormalize({0})", worldSpaceLightDir ); - } - } - - m_currentDataCollector.AddLocalVariable( -1, precision, WirePortDataType.FLOAT3, varName, worldSpaceLightDir ); - return varName; - } - - public void RegisterCustomInterpolatedData( string name, WirePortDataType dataType, PrecisionType precision, string vertexInstruction, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) - { - bool addLocalVariable = !name.Equals( vertexInstruction ); - - MasterNodePortCategory category = useMasterNodeCategory ? m_currentDataCollector.PortCategory : customCategory; - - if( !m_customInterpolatedData.ContainsKey( name ) ) - { - m_customInterpolatedData.Add( name, new TemplateCustomData( name, dataType ) ); - } - - if( !m_customInterpolatedData[ name ].IsVertex ) - { - m_customInterpolatedData[ name ].IsVertex = true; - if( addLocalVariable ) - m_currentDataCollector.AddToVertexLocalVariables( -1, precision, dataType, name, vertexInstruction ); - } - - if( category == MasterNodePortCategory.Fragment ) - { - if( !m_customInterpolatedData[ name ].IsFragment ) - { - m_customInterpolatedData[ name ].IsFragment = true; - TemplateVertexData interpData = RequestNewInterpolator( dataType, false ); - if( interpData == null ) - { - Debug.LogErrorFormat( "Could not assign interpolator of type {0} to variable {1}", dataType, name ); - return; - } - - m_currentDataCollector.AddToVertexLocalVariables( -1, m_currentTemplateData.VertexFunctionData.OutVarName + "." + interpData.VarNameWithSwizzle, name ); - m_currentDataCollector.AddToLocalVariables( -1, precision, dataType, name, m_currentTemplateData.FragmentFunctionData.InVarName + "." + interpData.VarNameWithSwizzle ); - } - } - } - - public bool HasCustomInterpolatedData( string name, bool useMasterNodeCategory = true, MasterNodePortCategory customCategory = MasterNodePortCategory.Fragment ) - { - if( m_customInterpolatedData.ContainsKey( name ) ) - { - MasterNodePortCategory category = useMasterNodeCategory ? m_currentDataCollector.PortCategory : customCategory; - return ( category == MasterNodePortCategory.Fragment ) ? m_customInterpolatedData[ name ].IsFragment : m_customInterpolatedData[ name ].IsVertex; - } - return false; - } - - public bool HasFragmentInputParams - { - get - { - if( m_fragmentInputParams != null ) - return m_fragmentInputParams.Count > 0; - - return false; - } - } - - public string FragInputParamsStr - { - get - { - string value = string.Empty; - if( m_fragmentInputParams != null && m_fragmentInputParams.Count > 0 ) - { - int count = m_fragmentInputParams.Count; - if( count > 0 ) - { - value = ", "; - foreach( KeyValuePair<TemplateSemantics, TemplateInputParameters> kvp in m_fragmentInputParams ) - { - value += kvp.Value.Declaration; - - if( --count > 0 ) - { - value += " , "; - } - } - } - } - return value; - } - } - - public string VertexInputParamsStr - { - get - { - string value = string.Empty; - if( m_vertexInputParams != null && m_vertexInputParams.Count > 0 ) - { - int count = m_vertexInputParams.Count; - if( count > 0 ) - { - value = ", "; - foreach( KeyValuePair<TemplateSemantics, TemplateInputParameters> kvp in m_vertexInputParams ) - { - value += kvp.Value.Declaration; - - if( --count > 0 ) - { - value += " , "; - } - } - } - } - return value; - } - } - - public void Destroy() - { - m_currentTemplate = null; - - m_currentTemplateData = null; - - m_currentDataCollector = null; - - if( m_fullSrpBatcherPropertiesList != null ) - { - m_fullSrpBatcherPropertiesList.Clear(); - m_fullSrpBatcherPropertiesList = null; - } - - if( m_srpBatcherPropertiesList != null ) - { - m_srpBatcherPropertiesList.Clear(); - m_srpBatcherPropertiesList = null; - } - - if( m_srpBatcherPropertiesDict != null ) - { - m_srpBatcherPropertiesDict.Clear(); - m_srpBatcherPropertiesDict = null; - } - - if( m_lateDirectivesList != null ) - { - m_lateDirectivesList.Clear(); - m_lateDirectivesList = null; - } - - if( m_lateDirectivesDict != null ) - { - m_lateDirectivesDict.Clear(); - m_lateDirectivesDict = null; - } - - if( m_registeredVertexData != null ) - { - m_registeredVertexData.Clear(); - m_registeredVertexData = null; - } - - if( m_vertexInputParams != null ) - { - m_vertexInputParams.Clear(); - m_vertexInputParams = null; - } - - if( m_fragmentInputParams != null ) - { - m_fragmentInputParams.Clear(); - m_fragmentInputParams = null; - } - - if( m_vertexDataDict != null ) - { - m_vertexDataDict.Clear(); - m_vertexDataDict = null; - } - - if( m_interpolatorData != null ) - { - m_interpolatorData.Destroy(); - m_interpolatorData = null; - } - - if( m_availableFragData != null ) - { - m_availableFragData.Clear(); - m_availableFragData = null; - } - - if( m_availableVertData != null ) - { - m_availableVertData.Clear(); - m_availableVertData = null; - } - - if( m_customInterpolatedData != null ) - { - m_customInterpolatedData.Clear(); - m_customInterpolatedData = null; - } - - if( m_specialVertexLocalVars != null ) - { - m_specialVertexLocalVars.Clear(); - m_specialVertexLocalVars = null; - } - - if( m_specialFragmentLocalVars != null ) - { - m_specialFragmentLocalVars.Clear(); - m_specialFragmentLocalVars = null; - } - } - - public void BuildCBuffer( int nodeId ) - { - m_fullSrpBatcherPropertiesList.Clear(); - if( m_srpBatcherPropertiesList.Count > 0 ) - { - var regex = new Regex( @"(\d)\s+\b" ); - m_srpBatcherPropertiesList.Sort( ( a, b ) => - { - var matchA = regex.Match( a.PropertyName ); - int sizeA = 0; - if( matchA.Groups.Count > 1 && matchA.Groups[ 1 ].Value.Length > 0 ) - sizeA = Convert.ToInt32( matchA.Groups[ 1 ].Value, System.Globalization.CultureInfo.InvariantCulture ); - - var matchB = regex.Match( b.PropertyName ); - int sizeB = 0; - if( matchB.Groups.Count > 1 && matchB.Groups[ 1 ].Value.Length > 0 ) - sizeB = Convert.ToInt32( matchB.Groups[ 1 ].Value, System.Globalization.CultureInfo.InvariantCulture ); - - return sizeB.CompareTo( sizeA ); - } ); - - m_fullSrpBatcherPropertiesList.Insert(0, new PropertyDataCollector( nodeId, IOUtils.SRPCBufferPropertiesBegin )); - m_fullSrpBatcherPropertiesList.AddRange( m_srpBatcherPropertiesList ); - m_fullSrpBatcherPropertiesList.Add( new PropertyDataCollector( nodeId, IOUtils.SRPCBufferPropertiesEnd ) ); - } - } - - - public void DumpSRPBatcher() - { - for( int i = 0; i < m_srpBatcherPropertiesList.Count; i++ ) - { - Debug.Log( i + "::" + m_srpBatcherPropertiesList[ i ].PropertyName ); - } - } - - public const string GlobalMaxInterpolatorReachedMsg = "Maximum amount of interpolators reached!\nPlease consider optmizing your shader!"; - public const string MaxInterpolatorSMReachedMsg = "Maximum amount of interpolators reached for current shader model on pass {0}! Please consider increasing the shader model to {1}!"; - public void CheckInterpolatorOverflow( string currShaderModel, string passName ) - { - int maxInterpolatorAmount = TemplateHelperFunctions.AvailableInterpolators[ currShaderModel ]; - int currInterpolatorAmount = 1 + TemplateHelperFunctions.SemanticToInt[ InterpData.AvailableInterpolators[ InterpData.AvailableInterpolators.Count - 1 ].Semantic ]; - if( currInterpolatorAmount > maxInterpolatorAmount ) - { - string shaderModel = string.Empty; - if( TemplateHelperFunctions.GetShaderModelForInterpolatorAmount( currInterpolatorAmount, ref shaderModel ) ) - { - UIUtils.ShowMessage( string.Format( MaxInterpolatorSMReachedMsg, passName, shaderModel ), MessageSeverity.Error ); - } - else - { - UIUtils.ShowMessage( GlobalMaxInterpolatorReachedMsg, MessageSeverity.Error ); - } - } - } - - public Dictionary<TemplateSemantics, TemplateInputParameters> FragInputParameters { get { return m_fragmentInputParams; } } - - public bool HasVertexInputParams - { - get - { - if( m_vertexInputParams != null ) - return m_vertexInputParams.Count > 0; - - return false; - } - } - - public Dictionary<TemplateSemantics, TemplateInputParameters> VertexInputParameters { get { return m_vertexInputParams; } } - public TemplateData CurrentTemplateData { get { return m_currentTemplateData; } } - public int MultipassSubshaderIdx { get { return m_multipassSubshaderIdx; } } - public int MultipassPassIdx { get { return m_multipassPassIdx; } } - public TemplateSRPType CurrentSRPType { get { return m_currentSRPType; } set { m_currentSRPType = value; } } - public bool IsHDRP { get { return m_currentSRPType == TemplateSRPType.HD; } } - public bool IsLWRP { get { return m_currentSRPType == TemplateSRPType.Lightweight; } } - public bool IsSRP { get { return ( m_currentSRPType == TemplateSRPType.Lightweight || m_currentSRPType == TemplateSRPType.HD ); } } - public TemplateInterpData InterpData { get { return m_interpolatorData; } } - public List<PropertyDataCollector> LateDirectivesList { get { return m_lateDirectivesList; } } - public List<PropertyDataCollector> SrpBatcherPropertiesList { get { return m_srpBatcherPropertiesList; } } - public List<PropertyDataCollector> FullSrpBatcherPropertiesList { get { return m_fullSrpBatcherPropertiesList; } } - public Dictionary<TemplateSemantics, TemplateVertexData> VertexDataDict { get { return m_vertexDataDict; } } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateDataCollector.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateDataCollector.cs.meta deleted file mode 100644 index 9386f5fa..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateDataCollector.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: c757602c408f7354b96c2a5eb21662a4 -timeCreated: 1495710491 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateDataParent.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateDataParent.cs deleted file mode 100644 index b7c3fd02..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateDataParent.cs +++ /dev/null @@ -1,217 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace AmplifyShaderEditor -{ - public enum TemplateDataType - { - LegacySinglePass, - MultiPass - } - - [Serializable] - public class TemplateIncludePragmaContainter - { - [SerializeField] - private int m_nativeTopIndex = -1; - - [SerializeField] - private List<string> m_nativeDirectivesList = new List<string>(); - - [SerializeField] - private List<string> m_includesList = new List<string>(); - private Dictionary<string,string> m_includesDict = new Dictionary<string,string>(); - - [SerializeField] - private List<string> m_pragmasList = new List<string>(); - private Dictionary<string, string> m_pragmasDict = new Dictionary<string, string>(); - - [SerializeField] - private List<string> m_definesList = new List<string>(); - private Dictionary<string, string> m_definesDict = new Dictionary<string, string>(); - - public void RefreshIncludesList() - { - if ( m_includesDict.Count != m_includesList.Count ) - { - m_includesDict.Clear(); - int count = m_includesList.Count; - for ( int i = 0; i < count; i++ ) - { - m_includesDict.Add( m_includesList[ i ], m_includesList[ i ] ); - } - } - } - - public void RefreshPragmasList() - { - if ( m_pragmasDict.Count != m_pragmasList.Count ) - { - m_pragmasDict.Clear(); - int count = m_pragmasList.Count; - for ( int i = 0; i < count; i++ ) - { - m_pragmasDict.Add( m_pragmasList[ i ], m_pragmasList[ i ] ); - } - } - } - - - public void RefreshDefinesList() - { - if ( m_definesDict.Count != m_definesList.Count ) - { - m_definesDict.Clear(); - int count = m_definesList.Count; - for ( int i = 0; i < count; i++ ) - { - m_definesDict.Add( m_definesList[ i ], m_definesList[ i ] ); - } - } - } - - public bool HasInclude( string include ) - { - RefreshIncludesList(); - return m_includesDict.ContainsKey( include ); - } - - public bool HasPragma( string pragma ) - { - RefreshPragmasList(); - return m_pragmasDict.ContainsKey( pragma ); - } - - public bool HasDefine( string pragma ) - { - RefreshDefinesList(); - return m_definesDict.ContainsKey( pragma ); - } - - public void AddInclude( string include ) - { - RefreshIncludesList(); - if ( !m_includesDict.ContainsKey( include ) ) - { - m_includesList.Add( include ); - m_includesDict.Add( include, include ); - } - } - - public void AddPragma( string pragma ) - { - RefreshPragmasList(); - if ( !m_pragmasDict.ContainsKey( pragma ) ) - { - m_pragmasList.Add( pragma ); - m_pragmasDict.Add( pragma, pragma ); - } - } - - public void AddDefine( string define ) - { - RefreshDefinesList(); - if ( !m_definesDict.ContainsKey( define ) ) - { - m_definesList.Add( define ); - m_definesDict.Add( define, define ); - } - } - - public void AddNativeDirective( string native, int topIndex ) - { - m_nativeTopIndex = topIndex; - m_nativeDirectivesList.Add( native ); - } - - public void Destroy() - { - m_nativeDirectivesList.Clear(); - m_nativeDirectivesList = null; - - - m_includesList.Clear(); - m_includesDict.Clear(); - m_includesList = null; - m_includesDict = null; - - m_pragmasList.Clear(); - m_pragmasDict.Clear(); - m_pragmasList = null; - m_pragmasDict = null; - - m_definesList.Clear(); - m_definesDict.Clear(); - m_definesList = null; - m_definesDict = null; - } - - public List<string> IncludesList { get { return m_includesList; } } - public List<string> PragmasList { get { return m_pragmasList; } } - public List<string> DefinesList { get { return m_definesList; } } - public List<string> NativeDirectivesList { get { return m_nativeDirectivesList; } } - public int NativeTopIndex { get { return m_nativeTopIndex; } } - - } - - [Serializable] - public class TemplateInfoContainer - { - public string Id = string.Empty; - public string Data = string.Empty; - public int Index = -1; - public bool IsValid { get { return Index > -1; } } - public void Reset() - { - Id = string.Empty; - Data = string.Empty; - Index = -1; - } - } - - [Serializable] - public class TemplateDataParent : ScriptableObject - { - [SerializeField] - protected TemplateDataType m_templateType; - - [SerializeField] - protected string m_name; - - [SerializeField] - protected string m_guid; - - [SerializeField] - protected int m_orderId; - - [SerializeField] - protected string m_defaultShaderName = string.Empty; - - [SerializeField] - protected bool m_isValid = true; - - [SerializeField] - protected bool m_communityTemplate = false; - - public virtual void Destroy() { } - public virtual bool Reload() { return true; } - public string Name - { - get { return m_name; } - set - { - m_name = value.StartsWith( "Hidden/" ) ? value.Replace( "Hidden/", string.Empty ) : value; - } - } - public string GUID { get { return m_guid; } set { m_guid = value; } } - public int OrderId { get { return m_orderId; } set { m_orderId = value; } } - public string DefaultShaderName { get { return m_defaultShaderName; } set { m_defaultShaderName = value; } } - public bool IsValid { get { return m_isValid; } } - public TemplateDataType TemplateType { get { return m_templateType; } } - public virtual void Init( string name, string guid, bool isCommunity ) { m_communityTemplate = isCommunity; } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateDataParent.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateDataParent.cs.meta deleted file mode 100644 index 49aee2ac..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateDataParent.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 4e8f3788c7c239042b3cc3d086311227 -timeCreated: 1518720013 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateDepthModule.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateDepthModule.cs deleted file mode 100644 index 0ce4a1c1..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateDepthModule.cs +++ /dev/null @@ -1,391 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using System.Collections.Generic; -using UnityEngine; -using UnityEditor; - -namespace AmplifyShaderEditor -{ - [Serializable] - public sealed class TemplateDepthModule : TemplateModuleParent - { - private const string ZWriteFormatter = "ZWrite {0}\n"; - private const string ZTestFormatter = "ZTest {0}\n"; - - [SerializeField] - private bool m_validZTest = false; - - [SerializeField] - private InlineProperty m_zTestMode = new InlineProperty( 0 ); - - [SerializeField] - private bool m_validZWrite = false; - - [SerializeField] - private InlineProperty m_zWriteMode = new InlineProperty( 0 ); - - [SerializeField] - private InlineProperty m_offsetFactor = new InlineProperty( 0 ); - - [SerializeField] - private InlineProperty m_offsetUnits = new InlineProperty( 0 ); - - [SerializeField] - private bool m_offsetEnabled = false; - - [SerializeField] - private bool m_validOffset = false; - - public TemplateDepthModule() : base( "Depth" ) { } - - public void CopyFrom( TemplateDepthModule other, bool allData ) - { - if( allData ) - { - m_independentModule = other.IndependentModule; - m_validZTest = other.ValidZTest; - m_validZWrite = other.ValidZWrite; - m_validOffset = other.ValidOffset; - } - - m_zTestMode.CopyFrom( other.ZTestMode ); - m_zWriteMode.CopyFrom( other.ZWriteMode ); - m_offsetFactor.CopyFrom( other.OffsetFactor ); - m_offsetUnits.CopyFrom( other.OffsetUnits ); - m_offsetEnabled = other.OffsetEnabled; - } - - public void ConfigureFromTemplateData( TemplateDepthData depthData ) - { - m_independentModule = depthData.IndependentModule; - if( depthData.ValidZTest && m_validZTest != depthData.ValidZTest ) - { - if( string.IsNullOrEmpty( depthData.ZTestInlineValue ) ) - { - m_zTestMode.IntValue = ZBufferOpHelper.ZTestModeDict[ depthData.ZTestModeValue ]; - m_zTestMode.ResetProperty(); - } - else - { - m_zTestMode.SetInlineByName( depthData.ZTestInlineValue ); - } - } - - - - if( depthData.ValidZWrite && m_validZWrite != depthData.ValidZWrite ) - { - if( string.IsNullOrEmpty( depthData.ZWriteInlineValue ) ) - { - m_zWriteMode.IntValue = ZBufferOpHelper.ZWriteModeDict[ depthData.ZWriteModeValue ]; - m_zWriteMode.ResetProperty(); - } - else - { - m_zWriteMode.SetInlineByName( depthData.ZWriteInlineValue ); - } - } - - if( depthData.ValidOffset && m_validOffset != depthData.ValidOffset ) - { - if( string.IsNullOrEmpty( depthData.OffsetFactorInlineValue ) ) - { - m_offsetFactor.FloatValue = depthData.OffsetFactor; - m_offsetFactor.ResetProperty(); - } - else - { - m_offsetFactor.SetInlineByName( depthData.OffsetFactorInlineValue ); - } - - if( string.IsNullOrEmpty( depthData.OffsetUnitsInlineValue ) ) - { - m_offsetUnits.FloatValue = depthData.OffsetUnits; - m_offsetUnits.ResetProperty(); - } - else - { - m_offsetUnits.SetInlineByName( depthData.OffsetUnitsInlineValue ); - } - m_offsetEnabled = depthData.ValidOffset; - } - - m_validZTest = depthData.ValidZTest; - m_validZWrite = depthData.ValidZWrite; - m_validOffset = depthData.ValidOffset; - m_validData = m_validZTest || m_validZWrite || m_validOffset; - } - - public override void ShowUnreadableDataMessage( ParentNode owner ) - { - bool foldoutValue = owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedDepth; - NodeUtils.DrawPropertyGroup( ref foldoutValue, ZBufferOpHelper.DepthParametersStr, base.ShowUnreadableDataMessage ); - owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedDepth = foldoutValue; - } - - public override void Draw( UndoParentNode owner, bool style = true ) - { - bool foldout = owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedDepth; - if( style ) - { - NodeUtils.DrawPropertyGroup( ref foldout, ZBufferOpHelper.DepthParametersStr, () => - { - EditorGUI.indentLevel++; - DrawBlock( owner ); - EditorGUI.indentLevel--; - } ); - } - else - { - NodeUtils.DrawNestedPropertyGroup( ref foldout, ZBufferOpHelper.DepthParametersStr, () => - { - DrawBlock( owner ); - } ); - } - owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedDepth = foldout; - } - - void DrawBlock( UndoParentNode owner ) - { - EditorGUI.BeginChangeCheck(); - Color cachedColor = GUI.color; - GUI.color = new Color( cachedColor.r, cachedColor.g, cachedColor.b, ( EditorGUIUtility.isProSkin ? 0.5f : 0.25f ) ); - //EditorGUILayout.BeginVertical( UIUtils.MenuItemBackgroundStyle ); - GUI.color = cachedColor; - - EditorGUILayout.Separator(); - - if( m_validZWrite ) - m_zWriteMode.EnumTypePopup( ref owner, ZBufferOpHelper.ZWriteModeStr, ZBufferOpHelper.ZWriteModeValues ); - - if( m_validZTest ) - m_zTestMode.EnumTypePopup( ref owner, ZBufferOpHelper.ZTestModeStr, ZBufferOpHelper.ZTestModeLabels ); - - - if( m_validOffset ) - { - m_offsetEnabled = owner.EditorGUILayoutToggle( ZBufferOpHelper.OffsetStr, m_offsetEnabled ); - if( m_offsetEnabled ) - { - EditorGUI.indentLevel++; - m_offsetFactor.FloatField( ref owner, ZBufferOpHelper.OffsetFactorStr ); - m_offsetUnits.FloatField( ref owner, ZBufferOpHelper.OffsetUnitsStr ); - EditorGUI.indentLevel--; - } - } - EditorGUILayout.Separator(); - - //EditorGUILayout.EndVertical(); - if( EditorGUI.EndChangeCheck() ) - { - m_isDirty = true; - } - } - - public void ReadZWriteFromString( ref uint index, ref string[] nodeParams ) - { - bool validDataOnMeta = m_validZWrite; - if( UIUtils.CurrentShaderVersion() > TemplatesManager.MPShaderVersion ) - { - validDataOnMeta = Convert.ToBoolean( nodeParams[ index++ ] ); - } - - if( validDataOnMeta ) - { - if( UIUtils.CurrentShaderVersion() < 15304 ) - { - m_zWriteMode.IntValue = Convert.ToInt32( nodeParams[ index++ ] ); - } - else - { - m_zWriteMode.ReadFromString( ref index, ref nodeParams ); - } - } - } - - public void ReadZTestFromString( ref uint index, ref string[] nodeParams ) - { - bool validDataOnMeta = m_validZTest; - if( UIUtils.CurrentShaderVersion() > TemplatesManager.MPShaderVersion ) - { - validDataOnMeta = Convert.ToBoolean( nodeParams[ index++ ] ); - } - - if( validDataOnMeta ) - { - if( UIUtils.CurrentShaderVersion() < 15304 ) - { - m_zTestMode.IntValue = Convert.ToInt32( nodeParams[ index++ ] ); - } - else - { - m_zTestMode.ReadFromString( ref index, ref nodeParams ); - } - } - } - - public void ReadOffsetFromString( ref uint index, ref string[] nodeParams ) - { - bool validDataOnMeta = m_validOffset; - if( UIUtils.CurrentShaderVersion() > TemplatesManager.MPShaderVersion ) - { - validDataOnMeta = Convert.ToBoolean( nodeParams[ index++ ] ); - } - - if( validDataOnMeta ) - { - m_offsetEnabled = Convert.ToBoolean( nodeParams[ index++ ] ); - if( UIUtils.CurrentShaderVersion() < 15304 ) - { - m_offsetFactor.FloatValue = Convert.ToSingle( nodeParams[ index++ ] ); - m_offsetUnits.FloatValue = Convert.ToSingle( nodeParams[ index++ ] ); - } - else - { - m_offsetFactor.ReadFromString( ref index, ref nodeParams, false ); - m_offsetUnits.ReadFromString( ref index, ref nodeParams, false ); - } - } - } - - public override void ReadFromString( ref uint index, ref string[] nodeParams ) - { - ReadZWriteFromString( ref index, ref nodeParams ); - ReadZTestFromString( ref index, ref nodeParams ); - ReadOffsetFromString( ref index, ref nodeParams ); - } - - public void WriteZWriteToString( ref string nodeInfo ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_validZWrite ); - if( m_validZWrite ) - m_zWriteMode.WriteToString( ref nodeInfo ); - } - - public void WriteZTestToString( ref string nodeInfo ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_validZTest ); - if( m_validZTest ) - m_zTestMode.WriteToString( ref nodeInfo ); - } - - public void WriteOffsetToString( ref string nodeInfo ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_validOffset ); - if( m_validOffset ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_offsetEnabled ); - m_offsetFactor.WriteToString( ref nodeInfo ); - m_offsetUnits.WriteToString( ref nodeInfo ); - } - } - - public override void WriteToString( ref string nodeInfo ) - { - WriteZWriteToString( ref nodeInfo ); - WriteZTestToString( ref nodeInfo ); - WriteOffsetToString( ref nodeInfo ); - } - - public bool IsActive { get { return ( m_zTestMode.IsValid || m_zTestMode.IntValue != 0 ) || ( m_zWriteMode.IsValid || m_zWriteMode.IntValue != 0 ) || m_offsetEnabled; } } - public string CurrentZWriteMode - { - get - { - if( m_zWriteMode.IsValid ) - { - return string.Format( ZWriteFormatter, m_zWriteMode.GetValueOrProperty() ); ; - } - - int finalZWrite = ( m_zWriteMode.IntValue == 0 ) ? 1 : m_zWriteMode.IntValue; - return string.Format( ZWriteFormatter, ZBufferOpHelper.ZWriteModeValues[ finalZWrite ] ); ; - } - } - public string CurrentZTestMode - { - get - { - if( m_zTestMode.IsValid ) - return string.Format( ZTestFormatter, m_zTestMode.GetValueOrProperty() ); - - int finalZTestMode = ( m_zTestMode.IntValue == 0 ) ? 3 : m_zTestMode.IntValue; - return string.Format( ZTestFormatter, ZBufferOpHelper.ZTestModeValues[ finalZTestMode ] ); - } - } - - public string CurrentOffset - { - get - { - if( m_offsetEnabled ) - return "Offset " + m_offsetFactor.GetValueOrProperty() + " , " + m_offsetUnits.GetValueOrProperty() + "\n"; - else - return "Offset 0,0\n"; - } - } - - public bool ValidZTest { get { return m_validZTest; } } - public bool ValidZWrite { get { return m_validZWrite; } } - public bool ValidOffset { get { return m_validOffset; } } - public InlineProperty ZTestMode { get { return m_zTestMode; } } - public InlineProperty ZWriteMode { get { return m_zWriteMode; } } - public InlineProperty OffsetFactor { get { return m_offsetFactor; } } - public InlineProperty OffsetUnits { get { return m_offsetUnits; } } - public bool OffsetEnabled { get { return m_offsetEnabled; } } - - - public ZTestMode ZTestModeValue - { - set - { - m_zTestMode.IntValue = ZBufferOpHelper.ZTestModeDict[ value ]; - m_zTestMode.Active = false; - } - get - { - return (ZTestMode)( m_zTestMode.IntValue - 1 ); - } - } - public ZWriteMode ZWriteModeValue - { - set - { - m_zWriteMode.IntValue = ZBufferOpHelper.ZWriteModeDict[ value ]; - m_zWriteMode.Active = false; - } - get - { - return (ZWriteMode)( m_zWriteMode.IntValue - 1 ); - } - } - public float OffsetFactorValue - { - set - { - m_offsetEnabled = true; - m_offsetFactor.FloatValue = value; - m_offsetFactor.Active = false; - } - get - { - return m_offsetFactor.FloatValue; - } - } - - public float OffsetUnitsValue - { - set - { - m_offsetEnabled = true; - m_offsetUnits.FloatValue = value; - m_offsetUnits.Active = false; - } - get - { - return m_offsetUnits.FloatValue; - } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateDepthModule.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateDepthModule.cs.meta deleted file mode 100644 index a559fe74..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateDepthModule.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 91bbf209a618780459e775d6816a4b06 -timeCreated: 1513873547 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateFragmentDataNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateFragmentDataNode.cs deleted file mode 100644 index 68d5f9f3..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateFragmentDataNode.cs +++ /dev/null @@ -1,274 +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.Collections.Generic; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Template Fragment Data", "Surface Data", "Select and use available interpolated fragment data from the template" )] - public class TemplateFragmentDataNode : TemplateNodeParent - { - private List<TemplateVertexData> m_interpolatorData = null; - - [SerializeField] - private int m_currentDataIdx = -1; - - [SerializeField] - private string m_dataName = string.Empty; - [SerializeField] - private string m_inVarName = string.Empty; - - private string[] m_dataLabels = null; - - private bool m_fetchDataId = false; - private UpperLeftWidgetHelper m_upperLeftWidgetHelper = new UpperLeftWidgetHelper(); - - void FetchDataId() - { - if( m_interpolatorData != null ) - { - m_currentDataIdx = 0; - int count = m_interpolatorData.Count; - m_dataLabels = new string[ count ]; - for( int i = 0; i < count; i++ ) - { - m_dataLabels[ i ] = m_interpolatorData[ i ].VarName; - if( m_interpolatorData[ i ].VarName.Equals( m_dataName ) ) - { - m_currentDataIdx = i; - } - } - UpdateFromId(); - } - else - { - m_currentDataIdx = -1; - } - } - - void UpdateFromId() - { - if( m_interpolatorData != null ) - { - if( m_interpolatorData.Count == 0 ) - { - for( int i = 0; i < 4; i++ ) - m_containerGraph.DeleteConnection( false, UniqueId, i, false, true ); - - m_headerColor = UIUtils.GetColorFromCategory( "Default" ); - m_content.text = "None"; - m_additionalContent.text = string.Empty; - m_outputPorts[ 0 ].ChangeProperties( "None", WirePortDataType.OBJECT, false ); - ConfigurePorts(); - return; - } - - bool areCompatible = TemplateHelperFunctions.CheckIfCompatibles( m_outputPorts[ 0 ].DataType, m_interpolatorData[ m_currentDataIdx ].DataType ); - switch( m_interpolatorData[ m_currentDataIdx ].DataType ) - { - default: - case WirePortDataType.INT: - case WirePortDataType.FLOAT: - m_outputPorts[ 0 ].ChangeProperties( Constants.EmptyPortValue, m_interpolatorData[ m_currentDataIdx ].DataType, false ); - break; - case WirePortDataType.FLOAT2: - m_outputPorts[ 0 ].ChangeProperties( "XY", m_interpolatorData[ m_currentDataIdx ].DataType, false ); - break; - case WirePortDataType.FLOAT3: - m_outputPorts[ 0 ].ChangeProperties( "XYZ", m_interpolatorData[ m_currentDataIdx ].DataType, false ); - break; - case WirePortDataType.FLOAT4: - m_outputPorts[ 0 ].ChangeProperties( "XYZW", m_interpolatorData[ m_currentDataIdx ].DataType, false ); - break; - case WirePortDataType.COLOR: - m_outputPorts[ 0 ].ChangeProperties( "RGBA", m_interpolatorData[ m_currentDataIdx ].DataType, false ); - break; - } - - ConfigurePorts(); - - if( !areCompatible ) - { - m_containerGraph.DeleteConnection( false, UniqueId, 0, false, true ); - } - - m_dataName = m_interpolatorData[ m_currentDataIdx ].VarName; - m_content.text = m_dataName; - m_sizeIsDirty = true; - CheckWarningState(); - } - } - - - public override void DrawProperties() - { - base.DrawProperties(); - if( m_multiPassMode ) - { - DrawMultipassProperties(); - } - - if( m_currentDataIdx > -1 ) - { - EditorGUI.BeginChangeCheck(); - m_currentDataIdx = EditorGUILayoutPopup( DataLabelStr, m_currentDataIdx, m_dataLabels ); - if( EditorGUI.EndChangeCheck() ) - { - UpdateFromId(); - } - } - } - - protected override void OnSubShaderChange() - { - base.OnSubShaderChange(); - FetchInterpolator(); - FetchDataId(); - } - - protected override void OnPassChange() - { - FetchInterpolator(); - FetchDataId(); - } - - void DrawMultipassProperties() - { - DrawSubShaderUI(); - DrawPassUI(); - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - if( m_containerGraph.CurrentCanvasMode != NodeAvailability.TemplateShader ) - return; - - if( m_interpolatorData == null || m_interpolatorData.Count == 0 ) - { - MasterNode masterNode = m_containerGraph.CurrentMasterNode; - FetchInterpolator( masterNode ); - } - - if( m_fetchDataId ) - { - m_fetchDataId = false; - FetchDataId(); - } - - if( m_currentDataIdx > -1 ) - { - EditorGUI.BeginChangeCheck(); - m_currentDataIdx = m_upperLeftWidgetHelper.DrawWidget( this, m_currentDataIdx, m_dataLabels ); - if( EditorGUI.EndChangeCheck() ) - { - UpdateFromId(); - } - } - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if( dataCollector.MasterNodeCategory != AvailableShaderTypes.Template ) - { - UIUtils.ShowMessage( UniqueId, "Template Fragmment Data node is only intended for templates use only" ); - return m_outputPorts[ 0 ].ErrorValue; - } - - if( !dataCollector.IsFragmentCategory ) - { - UIUtils.ShowMessage( UniqueId, "Template Fragment Data node node is only intended for fragment use use only" ); - return m_outputPorts[ 0 ].ErrorValue; - } - - if( m_multiPassMode ) - { - if( dataCollector.TemplateDataCollectorInstance.MultipassSubshaderIdx != SubShaderIdx || - dataCollector.TemplateDataCollectorInstance.MultipassPassIdx != PassIdx - ) - { - UIUtils.ShowMessage( UniqueId, string.Format( "{0} is only intended for subshader {1} and pass {2}", m_dataLabels[ m_currentDataIdx ], SubShaderIdx, PassIdx ) ); - return m_outputPorts[ outputId ].ErrorValue; - } - } - - return GetOutputVectorItem( 0, outputId, m_inVarName + m_dataName ); - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - m_dataName = GetCurrentParam( ref nodeParams ); - m_fetchDataId = true; - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_dataName ); - } - - public override void OnMasterNodeReplaced( MasterNode newMasterNode ) - { - base.OnMasterNodeReplaced( newMasterNode ); - if( newMasterNode.CurrentMasterNodeCategory == AvailableShaderTypes.Template ) - { - FetchInterpolator( newMasterNode ); - } - else - { - m_interpolatorData = null; - m_currentDataIdx = -1; - } - } - - protected override bool ValidatePass( int passIdx ) - { - return ( m_templateMPData.SubShaders[ SubShaderIdx ].Passes[ passIdx ].FragmentFunctionData != null && - m_templateMPData.SubShaders[ SubShaderIdx ].Passes[ passIdx ].InterpolatorDataContainer != null ); - } - - void FetchInterpolator( MasterNode masterNode = null ) - { - FetchMultiPassTemplate( masterNode ); - if( m_multiPassMode ) - { - if( m_templateMPData != null ) - { - m_inVarName = m_templateMPData.SubShaders[ SubShaderIdx ].Passes[ PassIdx ].FragmentFunctionData.InVarName + "."; - m_interpolatorData = m_templateMPData.SubShaders[ SubShaderIdx ].Passes[ PassIdx ].InterpolatorDataContainer.RawInterpolators; - m_fetchDataId = true; - } - } - else - { - if( masterNode == null ) - masterNode = m_containerGraph.CurrentMasterNode; - - TemplateData currentTemplate = ( masterNode as TemplateMasterNode ).CurrentTemplate; - if( currentTemplate != null ) - { - m_inVarName = currentTemplate.FragmentFunctionData.InVarName + "."; - m_interpolatorData = currentTemplate.InterpolatorData.RawInterpolators; - FetchDataId(); - } - else - { - m_interpolatorData = null; - m_currentDataIdx = -1; - } - } - } - - public override void Destroy() - { - base.Destroy(); - m_dataLabels = null; - m_interpolatorData = null; - m_upperLeftWidgetHelper = null; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateFragmentDataNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateFragmentDataNode.cs.meta deleted file mode 100644 index 8e3e69fc..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateFragmentDataNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 2b53cc116abb0df45b028f41b8f0305e -timeCreated: 1506595629 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateHelperFunctions.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateHelperFunctions.cs deleted file mode 100644 index d5fc6583..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateHelperFunctions.cs +++ /dev/null @@ -1,2374 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using System.Text.RegularExpressions; -using UnityEngine; -using UnityEditor; -using System.Collections.Generic; - -namespace AmplifyShaderEditor -{ - public enum CustomTemplatePropertyUIEnum - { - None, - HDPBR - } - - public enum TemplateSemantics - { - NONE, - POSITION, - SV_POSITION, - COLOR, - COLOR0, - COLOR1, - TEXCOORD0, - TEXCOORD1, - TEXCOORD2, - TEXCOORD3, - TEXCOORD4, - TEXCOORD5, - TEXCOORD6, - TEXCOORD7, - TEXCOORD8, - TEXCOORD9, - TEXCOORD10, - TEXCOORD11, - TEXCOORD12, - TEXCOORD13, - TEXCOORD14, - TEXCOORD15, - NORMAL, - TANGENT, - VFACE, - SV_VertexID, - SV_PrimitiveID, - SV_InstanceID, - INTERNALTESSPOS - } - - public enum TemplateInfoOnSematics - { - NONE, - POSITION, - CLIP_POS, - SCREEN_POSITION, - SCREEN_POSITION_NORMALIZED, - COLOR, - TEXTURE_COORDINATES0, - TEXTURE_COORDINATES1, - TEXTURE_COORDINATES2, - TEXTURE_COORDINATES3, - TEXTURE_COORDINATES4, - TEXTURE_COORDINATES5, - TEXTURE_COORDINATES6, - TEXTURE_COORDINATES7, - NORMAL, - TANGENT, - WORLD_NORMAL, - WORLD_TANGENT, - WORLD_BITANGENT, - WORLD_VIEW_DIR, - WORLD_POSITION, - RELATIVE_WORLD_POS, - INSTANCE_ID, - OTHER, - VFACE, - SHADOWCOORDS, - VERTEXID - } - - public enum TemplateShaderPropertiesIdx - { - Identation = 1, - Name = 3, - InspectorName, - Type - } - - public enum TemplateShaderGlobalsIdx - { - Type = 1, - Name = 2 - } - public enum TemplateDataCheck - { - Valid, - Invalid - } - - public enum InvisibleOptionsEnum - { - SyncProperties = 1 << 0 - } - - public enum TemplateSpecialTags - { - RenderType, - Queue, - None - } - - public class TemplateReplaceHelper - { - public TemplateMultiPassMasterNode MasterNode = null; - public bool Used = false; - public TemplateReplaceHelper( TemplateMultiPassMasterNode masterNode ) { MasterNode = masterNode; } - } - - [Serializable] - public class TemplatesTagData - { - public string Name; - public string Value; - public TemplatesTagData( string name, string value ) - { - Name = name; - Value = value; - } - } - - [Serializable] - public class TemplateModuleData - { - public bool IndependentModule = true; - public TemplateDataCheck DataCheck = TemplateDataCheck.Invalid; - public string InlineData = string.Empty; - public int StartIdx; - public bool IsValid { get { return DataCheck == TemplateDataCheck.Valid; } } - public virtual void SetAllModulesDefault() { IndependentModule = false; DataCheck = TemplateDataCheck.Valid; } - } - - [Serializable] - public sealed class TemplateTagsModuleData : TemplateModuleData - { - public string TagsId; - public List<TemplatesTagData> Tags = new List<TemplatesTagData>(); - public void Destroy() - { - Tags.Clear(); - Tags = null; - } - - public void Reset() - { - Tags.Clear(); - } - - public void Dump() - { - string dump = string.Empty; - for( int i = 0; i < Tags.Count; i++ ) - { - dump += string.Format( "[{0}] Name: {1} Value: {2}\n", i, Tags[ i ].Name, Tags[ i ].Value ); - } - Debug.Log( dump ); - } - } - - [Serializable] - public class TemplateShaderModelData : TemplateModuleData - { - public string Id = string.Empty; - public string Value = "2.5"; - public int InterpolatorAmount = 8; - public bool Encapsulate = false; - public override void SetAllModulesDefault() - { - base.SetAllModulesDefault(); - Id = string.Empty; - Value = "3.0"; - InterpolatorAmount = 10; - Encapsulate = true; - } - } - - [Serializable] - public sealed class TemplateDepthData : TemplateModuleData - { - public bool ValidZWrite; - public string ZWriteModeId; - public ZWriteMode ZWriteModeValue; - public int ZWriteStartIndex; - public string ZWriteInlineValue; - - - public bool ValidZTest; - public string ZTestModeId; - public ZTestMode ZTestModeValue; - public int ZTestStartIndex; - public string ZTestInlineValue; - - public bool ValidOffset; - public string OffsetId; - public float OffsetFactor; - public float OffsetUnits; - public int OffsetStartIndex; - public string OffsetFactorInlineValue; - public string OffsetUnitsInlineValue; - - public override void SetAllModulesDefault() - { - base.SetAllModulesDefault(); - ValidZWrite = true; - ZWriteModeId = string.Empty; - ZWriteModeValue = ZWriteMode.On; - ZWriteStartIndex = -1; - ZWriteInlineValue = string.Empty; - - - ValidZTest = true; - ZTestModeId = string.Empty; - ZTestModeValue = ZTestMode.LEqual; - ZTestStartIndex = -1; - ZTestInlineValue = string.Empty; - - ValidOffset = true; - OffsetId = string.Empty; - OffsetFactor = 0; - OffsetUnits = 0; - OffsetStartIndex = -1; - OffsetFactorInlineValue = string.Empty; - OffsetUnitsInlineValue = string.Empty; - } - - public void SetDataCheck() - { - DataCheck = ( ValidZWrite || ValidZTest || ValidOffset )?TemplateDataCheck.Valid:TemplateDataCheck.Invalid; - } - } - - [Serializable] - public sealed class TemplateStencilData : TemplateModuleData - { - public string StencilBufferId; - public bool Active = true; - - public int Reference; - public string ReferenceInline; - - public int ReadMask = 255; - public string ReadMaskInline; - - public int WriteMask = 255; - public string WriteMaskInline; - - public string ComparisonFront; - public string ComparisonFrontInline; - - public string PassFront; - public string PassFrontInline; - - public string FailFront; - public string FailFrontInline; - - public string ZFailFront; - public string ZFailFrontInline; - - public string ComparisonBack; - public string ComparisonBackInline; - - public string PassBack; - public string PassBackInline; - - public string FailBack; - public string FailBackInline; - - public string ZFailBack; - public string ZFailBackInline; - - public void SetDefaultValues() - { - Active = false; - - StencilBufferId = string.Empty; - - Reference = 255; - ReferenceInline = string.Empty; - - ReadMask = 255; - ReadMaskInline = string.Empty; - - WriteMask = 255; - WriteMaskInline = string.Empty; - - ComparisonFront = "always"; - ComparisonFrontInline = string.Empty; - - PassFront = "keep"; - PassFrontInline = string.Empty; - - FailFront = "keep"; - FailFrontInline = string.Empty; - - ZFailFront = "keep"; - ZFailFrontInline = string.Empty; - - - ComparisonBack = "always"; - ComparisonBackInline = string.Empty; - - PassBack = "keep"; - PassBackInline = string.Empty; - - FailBack = "keep"; - FailBackInline = string.Empty; - - ZFailBack = "keep"; - ZFailBackInline = string.Empty; - } - - public void SetIndependentDefault() - { - IndependentModule = true; - DataCheck = TemplateDataCheck.Valid; - SetDefaultValues(); - } - - public override void SetAllModulesDefault() - { - base.SetAllModulesDefault(); - SetDefaultValues(); - } - } - - [Serializable] - public sealed class TemplateBlendData : TemplateModuleData - { - public bool ValidBlendMode = false; - public bool BlendModeOff = true; - - public string BlendModeId; - public bool SeparateBlendFactors = false; - public AvailableBlendFactor SourceFactorRGB = AvailableBlendFactor.One; - public string SourceFactorRGBInline; - public AvailableBlendFactor DestFactorRGB = AvailableBlendFactor.Zero; - public string DestFactorRGBInline; - public int BlendModeStartIndex; - - public AvailableBlendFactor SourceFactorAlpha = AvailableBlendFactor.One; - public string SourceFactorAlphaInline; - public AvailableBlendFactor DestFactorAlpha = AvailableBlendFactor.Zero; - public string DestFactorAlphaInline; - - public bool ValidBlendOp = false; - public string BlendOpId; - public bool SeparateBlendOps = false; - public AvailableBlendOps BlendOpRGB = AvailableBlendOps.OFF; - public string BlendOpRGBInline; - public AvailableBlendOps BlendOpAlpha = AvailableBlendOps.OFF; - public string BlendOpAlphaInline; - public int BlendOpStartIndex; - - public bool IndependentAlphaToMask = false; - public bool ValidAlphaToMask = false; - public bool AlphaToMaskValue = false; - public string AlphaToMaskId; - - public override void SetAllModulesDefault() - { - base.SetAllModulesDefault(); - - if( !ValidAlphaToMask ) - { - ValidAlphaToMask = true; - AlphaToMaskValue = false; - AlphaToMaskId = string.Empty; - } - - if( !ValidBlendMode ) - { - ValidBlendMode = true; - BlendModeOff = true; - BlendModeId = string.Empty; - SeparateBlendFactors = false; - SourceFactorRGB = AvailableBlendFactor.One; - SourceFactorRGBInline = string.Empty; - DestFactorRGB = AvailableBlendFactor.Zero; - DestFactorRGBInline = string.Empty; - BlendModeStartIndex = -1; - SourceFactorAlpha = AvailableBlendFactor.One; - SourceFactorAlphaInline = string.Empty; - DestFactorAlpha = AvailableBlendFactor.Zero; - DestFactorAlphaInline = string.Empty; - } - - if( !ValidBlendOp ) - { - ValidBlendOp = true; - BlendOpId = string.Empty; - SeparateBlendOps = false; - BlendOpRGB = AvailableBlendOps.OFF; - BlendOpRGBInline = string.Empty; - BlendOpAlpha = AvailableBlendOps.OFF; - BlendOpAlphaInline = string.Empty; - BlendOpStartIndex = -1; - } - - DataCheck = TemplateDataCheck.Valid; - } - - } - - [Serializable] - public sealed class TemplateCullModeData : TemplateModuleData - { - public string CullModeId; - public CullMode CullModeData = CullMode.Back; - public override void SetAllModulesDefault() - { - base.SetAllModulesDefault(); - CullModeId = string.Empty; - CullModeData = CullMode.Back; - } - } - - [Serializable] - public sealed class TemplateColorMaskData : TemplateModuleData - { - public string ColorMaskId; - public bool[] ColorMaskData = { true, true, true, true }; - public override void SetAllModulesDefault() - { - base.SetAllModulesDefault(); - ColorMaskId = string.Empty; - for( int i = 0; i < ColorMaskData.Length; i++ ) - { - ColorMaskData[ i ] = true; - } - } - } - - public static class TemplateHelperFunctions - { - /* - struct DirectionalLightData - { - uint lightLayers; - float3 positionRWS; - float3 color; - int cookieIndex; - float volumetricDimmer; - float3 right; - float3 up; - float3 forward; - int tileCookie; - int shadowIndex; - int contactShadowIndex; - float4 shadowMaskSelector; - int nonLightmappedOnly; - float diffuseScale; - float specularScale; - }; - */ - public static string HDLightInfoFormat = "_DirectionalLightDatas[{0}].{1}"; - - public static string[] VectorSwizzle = { "x", "y", "z", "w" }; - public static string[] ColorSwizzle = { "r", "g", "b", "a" }; - - public static readonly Dictionary<string, CustomTemplatePropertyUIEnum> CustomTemplatePropertyUI = new Dictionary<string, CustomTemplatePropertyUIEnum> - { - { "None", CustomTemplatePropertyUIEnum.None}, - { "HDPBR", CustomTemplatePropertyUIEnum.HDPBR} - }; - - public static readonly Dictionary<string, InvisibleOptionsEnum> InvisibleOptions = new Dictionary<string, InvisibleOptionsEnum>() - { - { "SyncP", InvisibleOptionsEnum.SyncProperties } - }; - - public static readonly Dictionary<string, TemplateSpecialTags> StringToReservedTags = new Dictionary<string, TemplateSpecialTags>() - { - { TemplateSpecialTags.RenderType.ToString(), TemplateSpecialTags.RenderType}, - { TemplateSpecialTags.Queue.ToString(), TemplateSpecialTags.Queue}, - }; - - public static readonly Dictionary<string, RenderType> StringToRenderType = new Dictionary<string, RenderType> - { - {"Opaque",RenderType.Opaque}, - {"Transparent",RenderType.Transparent}, - {"TransparentCutout",RenderType.TransparentCutout}, - {"Background",RenderType.Background}, - {"Overlay",RenderType.Overlay}, - {"TreeOpaque",RenderType.TreeOpaque}, - {"TreeTransparentCutout",RenderType.TreeTransparentCutout}, - {"TreeBillboard",RenderType.TreeBillboard}, - {"Grass",RenderType.Grass}, - {"GrassBillboard",RenderType.GrassBillboard} - }; - - public static readonly Dictionary<string, RenderQueue> StringToRenderQueue = new Dictionary<string, RenderQueue> - { - {"Background",RenderQueue.Background }, - {"Geometry",RenderQueue.Geometry }, - {"AlphaTest",RenderQueue.AlphaTest }, - {"Transparent",RenderQueue.Transparent }, - {"Overlay",RenderQueue.Overlay } - }; - - public static readonly Dictionary<string, WirePortDataType> PropertyToWireType = new Dictionary<string, WirePortDataType> - { - {"Float",WirePortDataType.FLOAT}, - {"Range",WirePortDataType.FLOAT}, - {"Int",WirePortDataType.INT}, - {"Color",WirePortDataType.COLOR}, - {"Vector",WirePortDataType.FLOAT4}, - {"2D",WirePortDataType.SAMPLER2D}, - {"3D",WirePortDataType.SAMPLER3D}, - {"Cube",WirePortDataType.SAMPLERCUBE} - }; - - public static readonly Dictionary<WirePortDataType, int> DataTypeChannelUsage = new Dictionary<WirePortDataType, int> - { - {WirePortDataType.OBJECT,0 }, - {WirePortDataType.FLOAT,1 }, - {WirePortDataType.FLOAT2,2 }, - {WirePortDataType.FLOAT3,3 }, - {WirePortDataType.FLOAT4,4 }, - {WirePortDataType.FLOAT3x3,0 }, - {WirePortDataType.FLOAT4x4,0 }, - {WirePortDataType.COLOR,4 }, - {WirePortDataType.INT,1 }, - {WirePortDataType.UINT,1 }, - {WirePortDataType.SAMPLER1D,0 }, - {WirePortDataType.SAMPLER2D,0 }, - {WirePortDataType.SAMPLER3D,0 }, - {WirePortDataType.SAMPLERCUBE,0 } - }; - - public static readonly Dictionary<int, WirePortDataType> ChannelToDataType = new Dictionary<int, WirePortDataType> - { - {1,WirePortDataType.FLOAT}, - {2,WirePortDataType.FLOAT2}, - {3,WirePortDataType.FLOAT3}, - {4,WirePortDataType.FLOAT4} - }; - - public static readonly Dictionary<TemplateSemantics, string> SemanticsDefaultName = new Dictionary<TemplateSemantics, string> - { - {TemplateSemantics.COLOR ,"ase_color"}, - {TemplateSemantics.NORMAL ,"ase_normal"}, - {TemplateSemantics.POSITION ,"ase_position"}, - {TemplateSemantics.SV_POSITION ,"ase_sv_position"}, - {TemplateSemantics.TANGENT ,"ase_tangent"}, - {TemplateSemantics.VFACE ,"ase_vface"}, - {TemplateSemantics.SV_VertexID ,"ase_vertexId"}, - {TemplateSemantics.SV_PrimitiveID ,"ase_primitiveId"}, - {TemplateSemantics.INTERNALTESSPOS ,"ase_internalTessPos"}, - {TemplateSemantics.TEXCOORD0 ,"ase_tex_coord0"}, - {TemplateSemantics.TEXCOORD1 ,"ase_tex_coord1"}, - {TemplateSemantics.TEXCOORD2 ,"ase_tex_coord2"}, - {TemplateSemantics.TEXCOORD3 ,"ase_tex_coord3"}, - {TemplateSemantics.TEXCOORD4 ,"ase_tex_coord4"}, - {TemplateSemantics.TEXCOORD5 ,"ase_tex_coord5"}, - {TemplateSemantics.TEXCOORD6 ,"ase_tex_coord6"}, - {TemplateSemantics.TEXCOORD7 ,"ase_tex_coord7"}, - {TemplateSemantics.TEXCOORD8 ,"ase_tex_coord8"}, - {TemplateSemantics.TEXCOORD9 ,"ase_tex_coord9"}, - {TemplateSemantics.TEXCOORD10 ,"ase_tex_coord10"}, - {TemplateSemantics.TEXCOORD11 ,"ase_tex_coord11"}, - {TemplateSemantics.TEXCOORD12 ,"ase_tex_coord12"}, - {TemplateSemantics.TEXCOORD13 ,"ase_tex_coord13"}, - {TemplateSemantics.TEXCOORD14 ,"ase_tex_coord14"}, - {TemplateSemantics.TEXCOORD15 ,"ase_tex_coord15"}, - }; - - public static readonly Dictionary<int, TemplateInfoOnSematics> IntToInfo = new Dictionary<int, TemplateInfoOnSematics> - { - {0,TemplateInfoOnSematics.TEXTURE_COORDINATES0 }, - {1,TemplateInfoOnSematics.TEXTURE_COORDINATES1 }, - {2,TemplateInfoOnSematics.TEXTURE_COORDINATES2 }, - {3,TemplateInfoOnSematics.TEXTURE_COORDINATES3 }, - {4,TemplateInfoOnSematics.TEXTURE_COORDINATES4 }, - {5,TemplateInfoOnSematics.TEXTURE_COORDINATES5 }, - {6,TemplateInfoOnSematics.TEXTURE_COORDINATES6 }, - {7,TemplateInfoOnSematics.TEXTURE_COORDINATES7 }, - }; - - public static readonly Dictionary<string, TemplateInfoOnSematics> ShortcutToInfo = new Dictionary<string, TemplateInfoOnSematics> - { - {"p" ,TemplateInfoOnSematics.POSITION }, - {"sp" ,TemplateInfoOnSematics.CLIP_POS }, - {"spu" ,TemplateInfoOnSematics.SCREEN_POSITION }, - {"spn" ,TemplateInfoOnSematics.SCREEN_POSITION_NORMALIZED }, - {"c" ,TemplateInfoOnSematics.COLOR }, - {"uv0" ,TemplateInfoOnSematics.TEXTURE_COORDINATES0 }, - {"uv1" ,TemplateInfoOnSematics.TEXTURE_COORDINATES1 }, - {"uv2" ,TemplateInfoOnSematics.TEXTURE_COORDINATES2 }, - {"uv3" ,TemplateInfoOnSematics.TEXTURE_COORDINATES3 }, - {"uv4" ,TemplateInfoOnSematics.TEXTURE_COORDINATES4 }, - {"uv5" ,TemplateInfoOnSematics.TEXTURE_COORDINATES5 }, - {"uv6" ,TemplateInfoOnSematics.TEXTURE_COORDINATES6 }, - {"uv7" ,TemplateInfoOnSematics.TEXTURE_COORDINATES7 }, - {"n" ,TemplateInfoOnSematics.NORMAL }, - {"t" ,TemplateInfoOnSematics.TANGENT }, - {"wn" ,TemplateInfoOnSematics.WORLD_NORMAL}, - {"wt" ,TemplateInfoOnSematics.WORLD_TANGENT}, - {"wbt" ,TemplateInfoOnSematics.WORLD_BITANGENT}, - {"wvd" ,TemplateInfoOnSematics.WORLD_VIEW_DIR}, - {"wp" ,TemplateInfoOnSematics.WORLD_POSITION}, - {"rwp" ,TemplateInfoOnSematics.RELATIVE_WORLD_POS}, - {"vf" ,TemplateInfoOnSematics.VFACE}, - {"sc" ,TemplateInfoOnSematics.SHADOWCOORDS} - }; - - public static readonly Dictionary<TemplateInfoOnSematics, string> InfoToDefineFrag = new Dictionary<TemplateInfoOnSematics, string> - { - {TemplateInfoOnSematics.POSITION ,"ASE_NEEDS_FRAG_POSITION"}, - {TemplateInfoOnSematics.CLIP_POS ,"ASE_NEEDS_FRAG_CLIP_POS"}, - {TemplateInfoOnSematics.SCREEN_POSITION,"ASE_NEEDS_FRAG_SCREEN_POSITION" }, - {TemplateInfoOnSematics.SCREEN_POSITION_NORMALIZED,"ASE_NEEDS_FRAG_SCREEN_POSITION_NORMALIZED" }, - {TemplateInfoOnSematics.COLOR, "ASE_NEEDS_FRAG_COLOR"}, - {TemplateInfoOnSematics.TEXTURE_COORDINATES0,"ASE_NEEDS_FRAG_TEXTURE_COORDINATES0" }, - {TemplateInfoOnSematics.TEXTURE_COORDINATES1,"ASE_NEEDS_FRAG_TEXTURE_COORDINATES1" }, - {TemplateInfoOnSematics.TEXTURE_COORDINATES2,"ASE_NEEDS_FRAG_TEXTURE_COORDINATES2" }, - {TemplateInfoOnSematics.TEXTURE_COORDINATES3,"ASE_NEEDS_FRAG_TEXTURE_COORDINATES3" }, - {TemplateInfoOnSematics.TEXTURE_COORDINATES4,"ASE_NEEDS_FRAG_TEXTURE_COORDINATES4" }, - {TemplateInfoOnSematics.TEXTURE_COORDINATES5,"ASE_NEEDS_FRAG_TEXTURE_COORDINATES5" }, - {TemplateInfoOnSematics.TEXTURE_COORDINATES6,"ASE_NEEDS_FRAG_TEXTURE_COORDINATES6" }, - {TemplateInfoOnSematics.TEXTURE_COORDINATES7,"ASE_NEEDS_FRAG_TEXTURE_COORDINATES7" }, - {TemplateInfoOnSematics.NORMAL,"ASE_NEEDS_FRAG_NORMAL" }, - {TemplateInfoOnSematics.TANGENT ,"ASE_NEEDS_FRAG_TANGENT"}, - {TemplateInfoOnSematics.WORLD_NORMAL,"ASE_NEEDS_FRAG_WORLD_NORMAL"}, - {TemplateInfoOnSematics.WORLD_TANGENT,"ASE_NEEDS_FRAG_WORLD_TANGENT"}, - {TemplateInfoOnSematics.WORLD_BITANGENT,"ASE_NEEDS_FRAG_WORLD_BITANGENT"}, - {TemplateInfoOnSematics.WORLD_VIEW_DIR,"ASE_NEEDS_FRAG_WORLD_VIEW_DIR"}, - {TemplateInfoOnSematics.WORLD_POSITION,"ASE_NEEDS_FRAG_WORLD_POSITION"}, - {TemplateInfoOnSematics.RELATIVE_WORLD_POS,"ASE_NEEDS_FRAG_RELATIVE_WORLD_POS"}, - {TemplateInfoOnSematics.VFACE,"ASE_NEEDS_FRAG_VFACE"}, - {TemplateInfoOnSematics.SHADOWCOORDS,"ASE_NEEDS_FRAG_SHADOWCOORDS"} - }; - - public static readonly Dictionary<TemplateInfoOnSematics, string> InfoToDefineVertex = new Dictionary<TemplateInfoOnSematics, string> - { - {TemplateInfoOnSematics.POSITION ,"ASE_NEEDS_VERT_POSITION"}, - {TemplateInfoOnSematics.CLIP_POS ,"ASE_NEEDS_VERT_CLIP_POS"}, - {TemplateInfoOnSematics.SCREEN_POSITION,"ASE_NEEDS_VERT_SCREEN_POSITION" }, - {TemplateInfoOnSematics.SCREEN_POSITION_NORMALIZED,"ASE_NEEDS_VERT_SCREEN_POSITION_NORMALIZED" }, - {TemplateInfoOnSematics.COLOR, "ASE_NEEDS_VERT_COLOR"}, - {TemplateInfoOnSematics.TEXTURE_COORDINATES0,"ASE_NEEDS_VERT_TEXTURE_COORDINATES0" }, - {TemplateInfoOnSematics.TEXTURE_COORDINATES1,"ASE_NEEDS_VERT_TEXTURE_COORDINATES1" }, - {TemplateInfoOnSematics.TEXTURE_COORDINATES2,"ASE_NEEDS_VERT_TEXTURE_COORDINATES2" }, - {TemplateInfoOnSematics.TEXTURE_COORDINATES3,"ASE_NEEDS_VERT_TEXTURE_COORDINATES3" }, - {TemplateInfoOnSematics.TEXTURE_COORDINATES4,"ASE_NEEDS_VERT_TEXTURE_COORDINATES4" }, - {TemplateInfoOnSematics.TEXTURE_COORDINATES5,"ASE_NEEDS_VERT_TEXTURE_COORDINATES5" }, - {TemplateInfoOnSematics.TEXTURE_COORDINATES6,"ASE_NEEDS_VERT_TEXTURE_COORDINATES6" }, - {TemplateInfoOnSematics.TEXTURE_COORDINATES7,"ASE_NEEDS_VERT_TEXTURE_COORDINATES7" }, - {TemplateInfoOnSematics.NORMAL,"ASE_NEEDS_VERT_NORMAL" }, - {TemplateInfoOnSematics.TANGENT ,"ASE_NEEDS_VERT_TANGENT"}, - {TemplateInfoOnSematics.WORLD_NORMAL,"ASE_NEEDS_VERT_WORLD_NORMAL"}, - {TemplateInfoOnSematics.WORLD_TANGENT,"ASE_NEEDS_VERT_WORLD_TANGENT"}, - {TemplateInfoOnSematics.WORLD_BITANGENT,"ASE_NEEDS_VERT_WORLD_BITANGENT"}, - {TemplateInfoOnSematics.WORLD_VIEW_DIR,"ASE_NEEDS_VERT_WORLD_VIEW_DIR"}, - {TemplateInfoOnSematics.WORLD_POSITION,"ASE_NEEDS_VERT_WORLD_POSITION"}, - {TemplateInfoOnSematics.RELATIVE_WORLD_POS,"ASE_NEEDS_VERT_RELATIVE_WORLD_POS"}, - {TemplateInfoOnSematics.VFACE,"ASE_NEEDS_VERT_VFACE"}, - {TemplateInfoOnSematics.SHADOWCOORDS,"ASE_NEEDS_VERT_SHADOWCOORDS"} - }; - - public static readonly Dictionary<TemplateInfoOnSematics, string> InfoToLocalVar = new Dictionary<TemplateInfoOnSematics, string> - { - {TemplateInfoOnSematics.POSITION,GeneratorUtils.VertexPosition4Str }, - {TemplateInfoOnSematics.CLIP_POS,GeneratorUtils.ClipPositionStr }, - {TemplateInfoOnSematics.SCREEN_POSITION,GeneratorUtils.ScreenPositionStr }, - {TemplateInfoOnSematics.SCREEN_POSITION_NORMALIZED,GeneratorUtils.ScreenPositionNormalizedStr }, - {TemplateInfoOnSematics.COLOR, "ase_color" }, - {TemplateInfoOnSematics.TEXTURE_COORDINATES0, "ase_uv0" }, - {TemplateInfoOnSematics.TEXTURE_COORDINATES1, "ase_uv1" }, - {TemplateInfoOnSematics.TEXTURE_COORDINATES2, "ase_uv2" }, - {TemplateInfoOnSematics.TEXTURE_COORDINATES3, "ase_uv3" }, - {TemplateInfoOnSematics.NORMAL, GeneratorUtils.VertexNormalStr }, - {TemplateInfoOnSematics.TANGENT, GeneratorUtils.VertexTangentStr }, - {TemplateInfoOnSematics.WORLD_NORMAL, GeneratorUtils.WorldNormalStr}, - {TemplateInfoOnSematics.WORLD_TANGENT, GeneratorUtils.WorldTangentStr}, - {TemplateInfoOnSematics.WORLD_BITANGENT, GeneratorUtils.WorldBitangentStr}, - {TemplateInfoOnSematics.WORLD_VIEW_DIR, GeneratorUtils.WorldViewDirectionStr}, - {TemplateInfoOnSematics.WORLD_POSITION, GeneratorUtils.WorldPositionStr}, - {TemplateInfoOnSematics.RELATIVE_WORLD_POS, GeneratorUtils.RelativeWorldPositionStr}, - {TemplateInfoOnSematics.VFACE, GeneratorUtils.VFaceStr}, - {TemplateInfoOnSematics.SHADOWCOORDS, GeneratorUtils.ShadowCoordsStr} - }; - - - public static readonly Dictionary<TemplateInfoOnSematics, WirePortDataType> InfoToWirePortType = new Dictionary<TemplateInfoOnSematics, WirePortDataType> - { - {TemplateInfoOnSematics.POSITION,WirePortDataType.FLOAT4 }, - {TemplateInfoOnSematics.CLIP_POS,WirePortDataType.FLOAT4 }, - {TemplateInfoOnSematics.SCREEN_POSITION,WirePortDataType.FLOAT4 }, - {TemplateInfoOnSematics.SCREEN_POSITION_NORMALIZED,WirePortDataType.FLOAT4 }, - {TemplateInfoOnSematics.COLOR, WirePortDataType.COLOR }, - {TemplateInfoOnSematics.TEXTURE_COORDINATES0, WirePortDataType.FLOAT4 }, - {TemplateInfoOnSematics.TEXTURE_COORDINATES1, WirePortDataType.FLOAT4 }, - {TemplateInfoOnSematics.TEXTURE_COORDINATES2, WirePortDataType.FLOAT4 }, - {TemplateInfoOnSematics.TEXTURE_COORDINATES3, WirePortDataType.FLOAT4 }, - {TemplateInfoOnSematics.NORMAL, WirePortDataType.FLOAT3 }, - {TemplateInfoOnSematics.TANGENT, WirePortDataType.FLOAT4 }, - {TemplateInfoOnSematics.WORLD_NORMAL, WirePortDataType.FLOAT3}, - {TemplateInfoOnSematics.WORLD_TANGENT, WirePortDataType.FLOAT3}, - {TemplateInfoOnSematics.WORLD_BITANGENT, WirePortDataType.FLOAT3}, - {TemplateInfoOnSematics.WORLD_VIEW_DIR, WirePortDataType.FLOAT3}, - {TemplateInfoOnSematics.WORLD_POSITION, WirePortDataType.FLOAT3}, - {TemplateInfoOnSematics.RELATIVE_WORLD_POS, WirePortDataType.FLOAT3}, - {TemplateInfoOnSematics.VFACE, WirePortDataType.FLOAT}, - {TemplateInfoOnSematics.SHADOWCOORDS, WirePortDataType.FLOAT4}, - }; - public static readonly Dictionary<int, TemplateInfoOnSematics> IntToUVChannelInfo = new Dictionary<int, TemplateInfoOnSematics> - { - {0,TemplateInfoOnSematics.TEXTURE_COORDINATES0 }, - {1,TemplateInfoOnSematics.TEXTURE_COORDINATES1 }, - {2,TemplateInfoOnSematics.TEXTURE_COORDINATES2 }, - {3,TemplateInfoOnSematics.TEXTURE_COORDINATES3 }, - {4,TemplateInfoOnSematics.TEXTURE_COORDINATES4 }, - {5,TemplateInfoOnSematics.TEXTURE_COORDINATES5 }, - {6,TemplateInfoOnSematics.TEXTURE_COORDINATES6 }, - {7,TemplateInfoOnSematics.TEXTURE_COORDINATES7 } - }; - - public static readonly Dictionary<int, TemplateSemantics> IntToSemantic = new Dictionary<int, TemplateSemantics> - { - { 0,TemplateSemantics.TEXCOORD0 }, - { 1,TemplateSemantics.TEXCOORD1 }, - { 2,TemplateSemantics.TEXCOORD2 }, - { 3,TemplateSemantics.TEXCOORD3 }, - { 4,TemplateSemantics.TEXCOORD4 }, - { 5,TemplateSemantics.TEXCOORD5 }, - { 6,TemplateSemantics.TEXCOORD6 }, - { 7,TemplateSemantics.TEXCOORD7 }, - { 8,TemplateSemantics.TEXCOORD8 }, - { 9,TemplateSemantics.TEXCOORD9 }, - { 10,TemplateSemantics.TEXCOORD10 }, - { 11,TemplateSemantics.TEXCOORD11 }, - { 12,TemplateSemantics.TEXCOORD12 }, - { 13,TemplateSemantics.TEXCOORD13 }, - { 14,TemplateSemantics.TEXCOORD14 }, - { 15,TemplateSemantics.TEXCOORD15 } - }; - - public static readonly Dictionary<TemplateSemantics, int> SemanticToInt = new Dictionary<TemplateSemantics, int> - { - { TemplateSemantics.TEXCOORD0,0 }, - { TemplateSemantics.TEXCOORD1,1 }, - { TemplateSemantics.TEXCOORD2,2 }, - { TemplateSemantics.TEXCOORD3,3 }, - { TemplateSemantics.TEXCOORD4,4 }, - { TemplateSemantics.TEXCOORD5,5 }, - { TemplateSemantics.TEXCOORD6,6 }, - { TemplateSemantics.TEXCOORD7,7 }, - { TemplateSemantics.TEXCOORD8,8 }, - { TemplateSemantics.TEXCOORD9,9 }, - { TemplateSemantics.TEXCOORD10,10 }, - { TemplateSemantics.TEXCOORD11,11 }, - { TemplateSemantics.TEXCOORD12,12 }, - { TemplateSemantics.TEXCOORD13,13 }, - { TemplateSemantics.TEXCOORD14,14 }, - { TemplateSemantics.TEXCOORD15,15 }, - }; - - public static readonly Dictionary<string, TemplateSemantics> ShortcutToSemantic = new Dictionary<string, TemplateSemantics> - { - { "p" ,TemplateSemantics.POSITION }, - { "sp" ,TemplateSemantics.SV_POSITION }, - { "c" ,TemplateSemantics.COLOR }, - { "n" ,TemplateSemantics.NORMAL }, - { "t" ,TemplateSemantics.TANGENT }, - { "tc0" ,TemplateSemantics.TEXCOORD0 }, - { "tc1" ,TemplateSemantics.TEXCOORD1 }, - { "tc2" ,TemplateSemantics.TEXCOORD2 }, - { "tc3" ,TemplateSemantics.TEXCOORD3 }, - { "tc4" ,TemplateSemantics.TEXCOORD4 }, - { "tc5" ,TemplateSemantics.TEXCOORD5 }, - { "tc6" ,TemplateSemantics.TEXCOORD6 }, - { "tc7" ,TemplateSemantics.TEXCOORD7 }, - { "tc8" ,TemplateSemantics.TEXCOORD8 }, - { "tc9" ,TemplateSemantics.TEXCOORD9 }, - { "tc10" ,TemplateSemantics.TEXCOORD10 }, - { "tc11" ,TemplateSemantics.TEXCOORD11 }, - { "tc12" ,TemplateSemantics.TEXCOORD12 }, - { "tc13" ,TemplateSemantics.TEXCOORD13 }, - { "tc14" ,TemplateSemantics.TEXCOORD14 }, - { "tc15" ,TemplateSemantics.TEXCOORD15 } - }; - - public static readonly Dictionary<string, WirePortDataType> CgToWirePortType = new Dictionary<string, WirePortDataType>() - { - {"float" ,WirePortDataType.FLOAT}, - {"float2" ,WirePortDataType.FLOAT2}, - {"float3" ,WirePortDataType.FLOAT3}, - {"float4" ,WirePortDataType.FLOAT4}, - {"float3x3" ,WirePortDataType.FLOAT3x3}, - {"float4x4" ,WirePortDataType.FLOAT4x4}, - {"half" ,WirePortDataType.FLOAT}, - {"half2" ,WirePortDataType.FLOAT2}, - {"half3" ,WirePortDataType.FLOAT3}, - {"half4" ,WirePortDataType.FLOAT4}, - {"half3x3" ,WirePortDataType.FLOAT3x3}, - {"half4x4" ,WirePortDataType.FLOAT4x4}, - {"fixed" ,WirePortDataType.FLOAT}, - {"fixed2" ,WirePortDataType.FLOAT2}, - {"fixed3" ,WirePortDataType.FLOAT3}, - {"fixed4" ,WirePortDataType.FLOAT4}, - {"fixed3x3" ,WirePortDataType.FLOAT3x3}, - {"fixed4x4" ,WirePortDataType.FLOAT4x4}, - {"int" ,WirePortDataType.INT}, - {"uint" ,WirePortDataType.INT}, - {"sampler1D" ,WirePortDataType.SAMPLER1D}, - {"sampler2D" ,WirePortDataType.SAMPLER2D}, - {"sampler2D_float" ,WirePortDataType.SAMPLER2D}, - {"sampler3D" ,WirePortDataType.SAMPLER3D}, - {"samplerCUBE" ,WirePortDataType.SAMPLERCUBE} - }; - - public static readonly Dictionary<string, int> AvailableInterpolators = new Dictionary<string, int>() - { - {"2.0",8 }, - {"2.5",8 }, - {"3.0",10}, - {"3.5",10}, - {"4.0",16}, - {"4.5",16}, - {"4.6",16}, - {"5.0",16} - }; - - public static readonly string[] AvailableShaderModels = - { "2.0", "2.5", "3.0", "3.5", "4.0", "4.5", "4.6", "5.0" }; - - public static readonly Dictionary<string, int> ShaderModelToArrayIdx = new Dictionary<string, int>() - { - {"2.0",0}, - {"2.5",1}, - {"3.0",2}, - {"3.5",3}, - {"4.0",4}, - {"4.5",5}, - {"4.6",6}, - {"5.0",7} - }; - - public static readonly string HDPBRTag = "UNITY_MATERIAL_LIT"; - public static readonly Dictionary<string, TemplateSRPType> TagToRenderPipeline = new Dictionary<string, TemplateSRPType>() - { - { "UniversalPipeline",TemplateSRPType.Lightweight }, - { "LightweightPipeline",TemplateSRPType.Lightweight }, - { "HDRenderPipeline",TemplateSRPType.HD } - }; -#if UNITY_2018_3_OR_NEWER - public static string CoreColorLib = "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"; - public static string CoreCommonLib = "Packages/com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl"; -#else - public static string CoreCommonLib = "CoreRP/ShaderLibrary/Common.hlsl"; - public static string CoreColorLib = "CoreRP/ShaderLibrary/Color.hlsl"; -#endif - - public static string FetchSubShaderBody = @"(SubShader.*)\/\*ase_lod\*\/"; - public static string TemplateCustomUI = @"\/\*CustomNodeUI:(\w*)\*\/"; - public static string HidePassPattern = @"\/\*ase_hide_pass[:]*([a-zA-Z:]*)\*\/"; - public static string ASEPassPattern = @"\/\*ase_pass[:]*([a-zA-Z:]*)\*\/"; - public static string BlendWholeWordPattern = @"\bBlend\b"; - public static string BlendOpWholeWordPattern = @"\bBlendOp\b"; - public static string AlphaToMaskPattern = @"\bAlphaToMask (\w*)"; - public static string CullWholeWordPattern = @"\bCull\b"; - public static string ColorMaskWholeWordPattern = @"\bColorMask\b"; - public static string StencilWholeWordPattern = @"\bStencil\b"; - public static string ZWriteWholeWordPattern = @"\bZWrite\b"; - public static string ZTestWholeWordPattern = @"\bZTest\b"; - public static string ZOffsetWholeWordPattern = @"\bOffset\b"; - public static string TagsWholeWordPattern = @"\bTags\b"; - - - public static string CustomInspectorPattern = "^\\s*CustomEditor\\s+\\\"([\\w\\.]*)\\\""; - public static string FallbackPattern = "^\\s*Fallback\\s+\\\"([\\w\\/\\\\]*)\\\""; - public static string DefinesPattern = @"^\s*#define\s+([\w .]*)"; - public static string PragmasPattern = @"^\s*#pragma\s+([\w .]*)"; - public static string IncludesPattern = "^\\s*#include\\s+\"([\\w.\\/]*)\""; - public static string GlobalDirectivesPattern = "[#]+(define|pragma|include)\\s+([\\w .\\/\\\"]*)"; - public static string BeforePragmaPattern = @"(?:CGPROGRAM|HLSLPROGRAM|GLSLPROGRAM).*?\n(\s*)(.)"; - public static string GlobalTOPDirectivesPattern = @"(CGPROGRAM|CGINCLUDE|HLSLPROGRAM|HLSLINCLUDE).*?\n\s*(.)"; - - public static string VertexPragmaPattern = @"#pragma vertex\s+(\w+)"; - public static string FragmentPragmaPattern = @"#pragma fragment\s+(\w+)"; - public static string FunctionBodyStartPattern = @"\s+{0}\s*\("; - - public static string ShaderModelPattern = @"#pragma\s+target\s+([0-9]*[.]*[0-9]*)"; - - public static readonly string LocalVarPattern = @"\/\*ase_local_var[:]*(\w*)\*\/\s*(\w*)\s+(\w*)"; - - public static readonly string InlinePattern = @"\/\*ase_inline_begin\*\/(.*?)\/\*ase_inline_end\*\/"; - - public static readonly string SubShaderLODPattern = @"\sLOD\s+(\d+)"; - - public static readonly string PassNamePattern = "Name\\s+\\\"([\\w\\+\\-\\*\\/\\(\\) ]*)\\\""; - - public static readonly string TagsPattern = "\"(\\w+)\"\\s*=\\s*\"(\\w+\\+*\\w*)\""; - public static readonly string ZTestPattern = @"^\s*ZTest\s+(\[*\w+\]*)"; - public static readonly string ZWritePattern = @"^\s*ZWrite\s+(\[*\w+\]*)"; - //public static readonly string ZOffsetPattern = @"\s*Offset\s+([-+]?[0-9]*\.?[0-9]+)\s*,\s*([-+]?[0-9]*\.?[0-9]+)"; - public static readonly string ZOffsetPattern = @"^\s*Offset\s+([-+]?[0-9]*\.?[0-9]+|\[*\w+\]*)\s*,\s*([-+]?[0-9]*\.?[0-9]+|\[*\w+\]*)\s*"; - public static readonly string VertexDataPattern = @"(\w+)\s*(\w+)\s*:\s*([A-Z0-9_]+);"; - public static readonly string InterpRangePattern = @"ase_interp\((\d\.{0,1}\w{0,4}),(\d*)\)"; - //public static readonly string PropertiesPatternB = "(\\w*)\\s*\\(\\s*\"([\\w ]*)\"\\s*\\,\\s*(\\w*)\\s*.*\\)"; - //public static readonly string PropertiesPatternC = "^\\s*(\\w*)\\s*\\(\\s*\"([\\w\\(\\)\\+\\-\\\\* ]*)\"\\s*\\,\\s*(\\w*)\\s*.*\\)"; - //public static readonly string PropertiesPatternD = "(\\/\\/\\s*)*(\\w*)\\s*\\(\\s*\"([\\w\\(\\)\\+\\-\\\\* ]*)\"\\s*\\,\\s*(\\w*)\\s*.*\\)"; - //public static readonly string PropertiesPatternE = "(\\/\\/\\s*)*(\\w*)\\s*\\(\\s*\"([\\w\\(\\)\\+\\-\\\\* ]*)\"\\s*\\,\\s*(\\w*)\\s*.*\\)\\s*=\\s*[\\w,()\" {}]*"; - //public static readonly string PropertiesPatternF = "^(\\/\\/)*\\s*(\\[[\\[\\]\\w\\s\\(\\)\\_\\,]*\\])*\\s*(\\w*)\\s*\\(\\s*\"([\\w\\(\\)\\+\\-\\\\* ]*)\"\\s*\\,\\s*(\\w*)\\s*.*\\)\\s*=\\s*[\\w,()\" {}]*"; - //public static readonly string PropertiesPatternG = "^(\\s*)(\\[[\\[\\]\\w\\s\\(\\)\\_\\,]*\\])*\\s*(\\w*)\\s*\\(\\s*\"([\\w\\(\\)\\+\\-\\\\* ]*)\"\\s*\\,\\s*(\\w*)\\s*.*\\)\\s*=\\s*[\\w,()\" {}]*"; - public static readonly string PropertiesPatternG = "^(\\s*)(\\[[\\[\\]\\w\\s\\(\\)_,\\.]*\\])*\\s*(\\w*)\\s*\\(\\s*\"([\\w\\(\\)\\+\\-\\\\* ]*)\"\\s*\\,\\s*(\\w*)\\s*.*\\)\\s*=\\s*[\\w,()\" {}\\.]*"; - public static readonly string CullModePattern = @"^\s*Cull\s+(\[*\w+\]*)"; - public static readonly string ColorMaskPattern = @"^\s*ColorMask\s+([\d\w\[\]]+)(\s*\d)*"; - //public static readonly string BlendModePattern = @"\s*Blend\s+(\w+)\s+(\w+)(?:[\s,]+(\w+)\s+(\w+)|)"; - //public static readonly string BlendModePattern = @"\s*Blend\s+(\[*\w+\]*)\s+(\[*\w+\]*)(?:[\s,]+(\[*\w+\]*)\s+(\[*\w+\]*)|)"; - public static readonly string BlendModePattern = @"^\s*Blend\s+(?:(?=\d)|(\[*\w+\]*)\s+(\[*\w+\]*)(?:[\s,]+(\[*\w+\]*)\s+(\[*\w+\]*)|))"; - //public static readonly string BlendOpPattern = @"\s*BlendOp\s+(\w+)[\s,]*(?:(\w+)|)"; - //public static readonly string BlendOpPattern = @"\s*BlendOp\s+(\[*\w+\]*)[\s,]*(?:(\[*\w+\]*)|)"; - public static readonly string BlendOpPattern = @"^\s*BlendOp\s+(?:(?=\d)|(\[*\w+\]*)[\s,]*(?:(\[*\w+\]*)|))"; - - public static readonly string StencilOpGlobalPattern = @"Stencil\s*{([\w\W\s]*)}"; - public static readonly string StencilOpLinePattern = @"(\w+)\s*(\[*\w+\]*)"; - - public static readonly string ShaderGlobalsOverallPattern = "(?:\\/\\*ase_pragma\\*\\/|[\\}\\#])[\\w\\s\\;\\/\\*\\.\\\"]*\\/\\*ase_globals\\*\\/"; - public static readonly string ShaderGlobalsMultilinePattern = @"^\s*(?:uniform\s*)*(\w*)\s*(\w*);$"; - - public static readonly string TexSemantic = "float4 {0} : TEXCOORD{1};"; - public static readonly string TexFullSemantic = "float4 {0} : {1};"; - public static readonly string InterpFullSemantic = "{0} {1} : {2};"; - public static readonly string BaseInterpolatorName = "ase_texcoord"; - public static readonly string TexUVFullSemantic = "float4 ase_texcoord{0} : TEXCOORD{0};"; - public static readonly string InterpMacro = "{0}({1})"; - - public static readonly string InterpolatorDecl = Constants.VertexShaderOutputStr + ".{0} = " + Constants.VertexShaderInputStr + ".{0};"; - public static readonly string TemplateVariableDecl = "{0} = {1};"; - public static readonly string TemplateVarFormat = "{0}.{1}"; - - //public static readonly string StructsRemoval = @"struct\s+\w+\s+{[\s\w;\/\*]+};"; - public static readonly string StructsRemoval = @"struct\s+\w+\s+{[\s\w\(\).;:=,\/\*]+};"; - - public static readonly string SRPBatcherFindTag = @"CBUFFER_START\s*\(\s*UnityPerMaterial\s*\)\s*\n(\s*)"; - - public static string ReplaceAt( this string body, string oldStr, string newStr, int startIndex ) - { - return body.Remove( startIndex, oldStr.Length ).Insert( startIndex, newStr ); - } - - public static bool GetPassUniqueId( TemplateTagData tagData, TemplatePropertyContainer propertyContainer, TemplateIdManager idManager, string uniquePrefix, int offsetIdx, string subBody, ref string passUniqueID ) - { - Match match = Regex.Match( subBody, ASEPassPattern ); - if( match.Success && match.Groups.Count > 1 && match.Groups[1].Length > 0 ) - { - passUniqueID = match.Groups[ 1 ].Value; - - tagData.StartIdx = offsetIdx + match.Index; - tagData.Id = match.Value; - - idManager.RegisterId( tagData.StartIdx, uniquePrefix + tagData.Id, tagData.Id ); - propertyContainer.AddId( subBody, tagData.Id, tagData.SearchIndentation ); - return true; - } - return false; - } - - public static CustomTemplatePropertyUIEnum FetchCustomUI( string data ) - { - Match match = Regex.Match( data, TemplateCustomUI ); - if( match.Success && CustomTemplatePropertyUI.ContainsKey( match.Groups[ 1 ].Value ) ) - { - return CustomTemplatePropertyUI[ match.Groups[ 1 ].Value ]; - } - return CustomTemplatePropertyUIEnum.None; - } - - public static bool FetchInvisibleInfo( string input, ref int optionsArr, ref string id, ref int idIndex ) - { - Match match = Regex.Match( input, HidePassPattern ); - if( match.Success ) - { - id = match.Value; - idIndex = match.Index; - if( match.Groups.Count > 1 ) - { - string[] properties = match.Groups[ 1 ].Value.Split( ':' ); - for( int i = 0; i < properties.Length; i++ ) - { - if( InvisibleOptions.ContainsKey( properties[ i ] ) ) - { - optionsArr |= (int)InvisibleOptions[ properties[ i ] ]; - } - } - } - } - return match.Success; - } - - static public string GenerateTextureSemantic( ref MasterNodeDataCollector dataCollector, int uv ) - { - string texCoordName = BaseInterpolatorName; - if( uv > 0 ) - { - texCoordName += uv.ToString(); - } - - string texCoordData = string.Format( TexSemantic, texCoordName, uv ); - dataCollector.AddToVertexInput( texCoordData ); - dataCollector.AddToInterpolators( texCoordData ); - dataCollector.AddToVertexInterpolatorsDecl( string.Format( InterpolatorDecl, texCoordName ) ); - return texCoordName; - } - - public static void CreatePragmaIncludeList( string data, TemplateIncludePragmaContainter includePragmaContainer ) - { - // this finds the topmost position for including directives - int topIndex = -1; - foreach( Match match in Regex.Matches( data, GlobalTOPDirectivesPattern, RegexOptions.Singleline ) ) - { - if( match.Groups.Count == 3 ) - { - topIndex = match.Groups[ 2 ].Index; - } - } - - foreach( Match match in Regex.Matches( data, GlobalDirectivesPattern, RegexOptions.Multiline ) ) - { - if( match.Success ) - { - includePragmaContainer.AddNativeDirective( match.Groups[ 0 ].Value, topIndex ); - } - } - - foreach( Match match in Regex.Matches( data, PragmasPattern, RegexOptions.Multiline ) ) - { - if( match.Groups.Count == 2 ) - { - includePragmaContainer.AddPragma( match.Groups[ 1 ].Value ); - } - } - - foreach( Match match in Regex.Matches( data, DefinesPattern, RegexOptions.Multiline ) ) - { - if( match.Groups.Count == 2 ) - { - includePragmaContainer.AddDefine( match.Groups[ 1 ].Value ); - } - } - - foreach( Match match in Regex.Matches( data, IncludesPattern, RegexOptions.Multiline ) ) - { - if( match.Groups.Count == 2 ) - { - includePragmaContainer.AddInclude( match.Groups[ 1 ].Value ); - } - } - } - - public static void CreateShaderPropertiesList( string propertyData, ref List<TemplateShaderPropertyData> propertiesList, ref Dictionary<string, TemplateShaderPropertyData> duplicatesHelper ) - { - int identationIdx = (int)TemplateShaderPropertiesIdx.Identation; - int nameIdx = (int)TemplateShaderPropertiesIdx.Name; - int typeIdx = (int)TemplateShaderPropertiesIdx.Type; - int inspectorNameIdx = (int)TemplateShaderPropertiesIdx.InspectorName; - - foreach( Match match in Regex.Matches( propertyData, PropertiesPatternG,RegexOptions.Multiline ) ) - { - if( match.Groups.Count > 1 ) - { - if( !duplicatesHelper.ContainsKey( match.Groups[ nameIdx ].Value ) && PropertyToWireType.ContainsKey( match.Groups[ typeIdx ].Value ) ) - { - TemplateShaderPropertyData newData = new TemplateShaderPropertyData( match.Index, - match.Value, - match.Groups[ identationIdx ].Value, - match.Groups[ inspectorNameIdx ].Value, - match.Groups[ nameIdx ].Value, - PropertyToWireType[ match.Groups[ typeIdx ].Value ], - PropertyType.Property ); - propertiesList.Add( newData ); - duplicatesHelper.Add( newData.PropertyName, newData ); - } - } - } - } - - public static void CreateShaderGlobalsList( string propertyData, ref List<TemplateShaderPropertyData> propertiesList, ref Dictionary<string, TemplateShaderPropertyData> duplicatesHelper ) - { - int typeIdx = (int)TemplateShaderGlobalsIdx.Type; - int nameIdx = (int)TemplateShaderGlobalsIdx.Name; - - // removes structs - propertyData = Regex.Replace( propertyData, StructsRemoval, "" ); - MatchCollection matchCollection = Regex.Matches( propertyData, ShaderGlobalsOverallPattern ); - string value = ( matchCollection.Count > 0 ) ? matchCollection[ 0 ].Groups[ 0 ].Value : propertyData; - foreach( Match lineMatch in Regex.Matches( value, ShaderGlobalsMultilinePattern, RegexOptions.Multiline ) ) - { - if( lineMatch.Groups.Count > 1 ) - { - if( !duplicatesHelper.ContainsKey( lineMatch.Groups[ nameIdx ].Value ) && CgToWirePortType.ContainsKey( lineMatch.Groups[ typeIdx ].Value ) ) - { - TemplateShaderPropertyData newData = new TemplateShaderPropertyData( -1, - string.Empty, - string.Empty, - string.Empty, - lineMatch.Groups[ nameIdx ].Value, - CgToWirePortType[ lineMatch.Groups[ typeIdx ].Value ], - PropertyType.Global ); - duplicatesHelper.Add( newData.PropertyName, newData ); - propertiesList.Add( newData ); - } - } - } - } - - public static void CreateStencilOps( string stencilData, ref TemplateStencilData stencilDataObj ) - { - stencilDataObj.DataCheck = TemplateDataCheck.Invalid; - MatchCollection overallGlobalMatch = Regex.Matches( stencilData, StencilOpGlobalPattern ); - if( overallGlobalMatch.Count == 1 && overallGlobalMatch[ 0 ].Groups.Count == 2 ) - { - string property = string.Empty; - string value = overallGlobalMatch[ 0 ].Groups[ 1 ].Value; - foreach( Match match in Regex.Matches( value, StencilOpLinePattern ) ) - { - stencilDataObj.DataCheck = TemplateDataCheck.Valid; - if( match.Groups.Count == 3 ) - { - switch( match.Groups[ 1 ].Value ) - { - default: - { - stencilDataObj.DataCheck = TemplateDataCheck.Invalid; - return; - } - case "Ref": - { - if( match.Groups[ 2 ].Success && IsInlineProperty( match.Groups[ 2 ].Value, ref property ) ) - { - stencilDataObj.ReferenceInline = property; - } - else - { - try - { - stencilDataObj.Reference = Convert.ToInt32( match.Groups[ 2 ].Value ); - } - catch( Exception e ) - { - Debug.LogException( e ); - stencilDataObj.DataCheck = TemplateDataCheck.Invalid; - return; - } - } - } - break; - case "ReadMask": - { - if( match.Groups[ 2 ].Success && IsInlineProperty( match.Groups[ 2 ].Value, ref property ) ) - { - stencilDataObj.ReadMaskInline = property; - } - else - { - try - { - stencilDataObj.ReadMask = Convert.ToInt32( match.Groups[ 2 ].Value ); - } - catch( Exception e ) - { - Debug.LogException( e ); - stencilDataObj.DataCheck = TemplateDataCheck.Invalid; - return; - } - } - } - break; - case "WriteMask": - { - if( match.Groups[ 2 ].Success && IsInlineProperty( match.Groups[ 2 ].Value, ref property ) ) - { - stencilDataObj.WriteMaskInline = property; - } - else - { - try - { - stencilDataObj.WriteMask = Convert.ToInt32( match.Groups[ 2 ].Value ); - } - catch( Exception e ) - { - Debug.LogException( e ); - stencilDataObj.DataCheck = TemplateDataCheck.Invalid; - return; - } - } - } - break; - case "CompFront": - case "Comp": - { - if( match.Groups[ 2 ].Success && IsInlineProperty( match.Groups[ 2 ].Value, ref property ) ) - { - stencilDataObj.ComparisonFrontInline = property; - } - else - { - stencilDataObj.ComparisonFront = match.Groups[ 2 ].Value; - } - } - break; - case "PassFront": - case "Pass": - { - if( match.Groups[ 2 ].Success && IsInlineProperty( match.Groups[ 2 ].Value, ref property ) ) - { - stencilDataObj.PassFrontInline = property; - } - else - { - stencilDataObj.PassFront = match.Groups[ 2 ].Value; - } - } - break; - case "FailFront": - case "Fail": - { - if( match.Groups[ 2 ].Success && IsInlineProperty( match.Groups[ 2 ].Value, ref property ) ) - { - stencilDataObj.FailFrontInline = property; - } - else - { - stencilDataObj.FailFront = match.Groups[ 2 ].Value; - } - } - break; - case "ZFail": - case "ZFailFront": - { - if( match.Groups[ 2 ].Success && IsInlineProperty( match.Groups[ 2 ].Value, ref property ) ) - { - stencilDataObj.ZFailFrontInline = property; - } - else - { - stencilDataObj.ZFailFront = match.Groups[ 2 ].Value; - } - } - break; - case "CompBack": - { - if( match.Groups[ 2 ].Success && IsInlineProperty( match.Groups[ 2 ].Value, ref property ) ) - { - stencilDataObj.ComparisonBackInline = property; - } - else - { - stencilDataObj.ComparisonBack = match.Groups[ 2 ].Value; - } - } - break; - case "PassBack": - { - if( match.Groups[ 2 ].Success && IsInlineProperty( match.Groups[ 2 ].Value, ref property ) ) - { - stencilDataObj.PassBackInline = property; - } - else - { - stencilDataObj.PassBack = match.Groups[ 2 ].Value; - } - } - break; - case "FailBack": - { - if( match.Groups[ 2 ].Success && IsInlineProperty( match.Groups[ 2 ].Value, ref property ) ) - { - stencilDataObj.FailBackInline = property; - } - else - { - stencilDataObj.FailBack = match.Groups[ 2 ].Value; - } - } - break; - case "ZFailBack": - { - if( match.Groups[ 2 ].Success && IsInlineProperty( match.Groups[ 2 ].Value, ref property ) ) - { - stencilDataObj.ZFailBackInline = property; - } - else - { - stencilDataObj.ZFailBack = match.Groups[ 2 ].Value; - } - } - break; - } - } - } - } - } - - public static void CreateColorMask( string colorMaskData, ref TemplateColorMaskData colorMaskObj ) - { - colorMaskObj.DataCheck = TemplateDataCheck.Invalid; - Match match = Regex.Match( colorMaskData, ColorMaskPattern ); - if( match.Groups.Count == 3 && !match.Groups[ 2 ].Success ) // second group is the colormask MRT which isn't implemented yet - { - string property = string.Empty; - if( match.Groups[ 1 ].Success && IsInlineProperty( match.Groups[ 1 ].Value, ref property ) ) - { - colorMaskObj.InlineData = property; - colorMaskObj.DataCheck = TemplateDataCheck.Valid; - } - else - { - for( int i = 0; i < 4; i++ ) - { - colorMaskObj.ColorMaskData[ i ] = false; - } - - colorMaskObj.DataCheck = TemplateDataCheck.Valid; - try - { - for( int i = 0; i < match.Groups[ 1 ].Value.Length; i++ ) - { - switch( Char.ToLower( match.Groups[ 1 ].Value[ i ] ) ) - { - case 'r': colorMaskObj.ColorMaskData[ 0 ] = true; break; - case 'g': colorMaskObj.ColorMaskData[ 1 ] = true; break; - case 'b': colorMaskObj.ColorMaskData[ 2 ] = true; break; - case 'a': colorMaskObj.ColorMaskData[ 3 ] = true; break; - case '0': - { - for( int j = 0; j < 4; j++ ) - { - colorMaskObj.ColorMaskData[ j ] = false; - } - return; - } - default: - { - colorMaskObj.DataCheck = TemplateDataCheck.Invalid; - return; - } - } - } - } - catch( Exception e ) - { - Debug.LogException( e ); - colorMaskObj.DataCheck = TemplateDataCheck.Invalid; - return; - } - } - } - } - - public static void CreateCullMode( string cullModeData, ref TemplateCullModeData cullDataObj ) - { - cullDataObj.DataCheck = TemplateDataCheck.Invalid; - Match match = Regex.Match( cullModeData, CullModePattern ); - if( match.Groups.Count == 2 ) - { - string property = string.Empty; - if( match.Groups[ 1 ].Success && IsInlineProperty( match.Groups[ 1 ].Value, ref property ) ) - { - cullDataObj.InlineData = property; - cullDataObj.DataCheck = TemplateDataCheck.Valid; - } - else - { - try - { - cullDataObj.CullModeData = (CullMode)Enum.Parse( typeof( CullMode ), match.Groups[ 1 ].Value ); - cullDataObj.DataCheck = TemplateDataCheck.Valid; - } - catch( Exception e ) - { - cullDataObj.DataCheck = TemplateDataCheck.Invalid; - Debug.LogException( e ); - return; - } - } - } - } - - public static void CreateBlendMode( string blendModeData, ref TemplateBlendData blendDataObj ) - { - blendDataObj.ValidBlendMode = true; - string property = string.Empty; - bool noMatches = true; - // TODO: OPTIMIZE REGEX EXPRESSIONS TO NOT CATCH EMPTY GROUPS - foreach( Match match in Regex.Matches( blendModeData, BlendModePattern ) ) - { - - if( match.Groups.Count == 3 ) - { - if( match.Groups[ 0 ].Success && - match.Groups[ 1 ].Success ) - { - - try - { - if( IsInlineProperty( match.Groups[ 1 ].Value, ref property ) ) - { - blendDataObj.SourceFactorRGBInline = property; - } - else - { - AvailableBlendFactor sourceAll = (AvailableBlendFactor)Enum.Parse( typeof( AvailableBlendFactor ), match.Groups[ 1 ].Value ); - blendDataObj.SourceFactorRGB = sourceAll; - } - if( match.Groups[ 2 ].Success && IsInlineProperty( match.Groups[ 2 ].Value, ref property ) ) - { - blendDataObj.DestFactorRGBInline = property; - } - else - { - AvailableBlendFactor destAll = (AvailableBlendFactor)Enum.Parse( typeof( AvailableBlendFactor ), match.Groups[ 2 ].Value ); - blendDataObj.DestFactorRGB = destAll; - } - - blendDataObj.SeparateBlendFactors = false; - blendDataObj.BlendModeOff = false; - noMatches = false; - } - catch( Exception e ) - { - Debug.LogException( e ); - blendDataObj.DataCheck = TemplateDataCheck.Invalid; - blendDataObj.ValidBlendMode = false; - return; - } - break; - } - } - else if( match.Groups.Count == 5 ) - { - if( match.Groups[ 0 ].Success && - match.Groups[ 1 ].Success ) - { - try - { - if( IsInlineProperty( match.Groups[ 1 ].Value, ref property ) ) - { - blendDataObj.SourceFactorRGBInline = property; - } - else - { - AvailableBlendFactor sourceRGB = (AvailableBlendFactor)Enum.Parse( typeof( AvailableBlendFactor ), match.Groups[ 1 ].Value ); - blendDataObj.SourceFactorRGB = sourceRGB; - } - - if( match.Groups[ 2 ].Success && IsInlineProperty( match.Groups[ 2 ].Value, ref property ) ) - { - blendDataObj.DestFactorRGBInline = property; - } - else - { - AvailableBlendFactor destRGB = (AvailableBlendFactor)Enum.Parse( typeof( AvailableBlendFactor ), match.Groups[ 2 ].Value ); - blendDataObj.DestFactorRGB = destRGB; - } - - if( match.Groups[ 3 ].Success && match.Groups[ 4 ].Success ) - { - if( IsInlineProperty( match.Groups[ 3 ].Value, ref property ) ) - { - blendDataObj.SourceFactorAlphaInline = property; - } - else - { - AvailableBlendFactor sourceA = (AvailableBlendFactor)Enum.Parse( typeof( AvailableBlendFactor ), match.Groups[ 3 ].Value ); - blendDataObj.SourceFactorAlpha = sourceA; - } - - if( IsInlineProperty( match.Groups[ 4 ].Value, ref property ) ) - { - blendDataObj.DestFactorAlphaInline = property; - } - else - { - AvailableBlendFactor destA = (AvailableBlendFactor)Enum.Parse( typeof( AvailableBlendFactor ), match.Groups[ 4 ].Value ); - blendDataObj.DestFactorAlpha = destA; - } - - blendDataObj.SeparateBlendFactors = true; - } - else - { - blendDataObj.SeparateBlendFactors = false; - } - blendDataObj.BlendModeOff = false; - noMatches = false; - } - catch( Exception e ) - { - Debug.LogException( e ); - blendDataObj.DataCheck = TemplateDataCheck.Invalid; - blendDataObj.ValidBlendMode = false; - return; - } - break; - } - } - } - - if( noMatches ) - blendDataObj.ValidBlendMode = false; - } - - public static void CreateBlendOp( string blendOpData, ref TemplateBlendData blendDataObj ) - { - bool noMatches = true; - blendDataObj.ValidBlendOp = true; - string property = string.Empty; - // TODO: OPTIMIZE REGEX EXPRESSIONS TO NOT CATCH EMPTY GROUPS - foreach( Match match in Regex.Matches( blendOpData, BlendOpPattern, RegexOptions.None ) ) - { - if( match.Groups.Count == 2 ) - { - if( match.Groups[ 0 ].Success && - match.Groups[ 1 ].Success ) - { - - try - { - if( IsInlineProperty( match.Groups[ 1 ].Value, ref property ) ) - { - blendDataObj.BlendOpRGBInline = property; - } - else - { - AvailableBlendOps blendOpsAll = (AvailableBlendOps)Enum.Parse( typeof( AvailableBlendOps ), match.Groups[ 1 ].Value ); - blendDataObj.BlendOpRGB = blendOpsAll; - } - blendDataObj.SeparateBlendOps = false; - noMatches = false; - } - catch( Exception e ) - { - Debug.LogException( e ); - blendDataObj.DataCheck = TemplateDataCheck.Invalid; - blendDataObj.ValidBlendOp = false; - return; - } - break; - } - } - else if( match.Groups.Count == 3 ) - { - if( match.Groups[ 0 ].Success && - match.Groups[ 1 ].Success ) - { - try - { - if( IsInlineProperty( match.Groups[ 1 ].Value, ref property ) ) - { - blendDataObj.BlendOpRGBInline = property; - } - else - { - AvailableBlendOps blendOpsRGB = (AvailableBlendOps)Enum.Parse( typeof( AvailableBlendOps ), match.Groups[ 1 ].Value ); - blendDataObj.BlendOpRGB = blendOpsRGB; - } - - if( match.Groups[ 2 ].Success ) - { - if( IsInlineProperty( match.Groups[ 2 ].Value, ref property ) ) - { - blendDataObj.BlendOpAlphaInline = property; - } - else - { - AvailableBlendOps blendOpsA = (AvailableBlendOps)Enum.Parse( typeof( AvailableBlendOps ), match.Groups[ 2 ].Value ); - blendDataObj.BlendOpAlpha = blendOpsA; - } - blendDataObj.SeparateBlendOps = true; - } - else - { - blendDataObj.SeparateBlendOps = false; - } - noMatches = false; - } - catch( Exception e ) - { - Debug.LogException( e ); - blendDataObj.DataCheck = TemplateDataCheck.Invalid; - blendDataObj.ValidBlendOp = false; - return; - } - break; - } - } - } - - if( noMatches ) - blendDataObj.ValidBlendOp = false; - } - - public static void FetchLocalVars( string body, ref List<TemplateLocalVarData> localVarList, TemplateFunctionData vertexFunction, TemplateFunctionData fragFunction ) - { - foreach( Match match in Regex.Matches( body, LocalVarPattern ) ) - { - if( match.Groups.Count == 4 ) - { - if( CgToWirePortType.ContainsKey( match.Groups[ 2 ].Value ) ) - { - MasterNodePortCategory category; - if( fragFunction.MainBodyLocalIdx > vertexFunction.MainBodyLocalIdx ) - { - if( match.Index < fragFunction.MainBodyLocalIdx ) - { - category = MasterNodePortCategory.Vertex; - } - else - { - category = MasterNodePortCategory.Fragment; - } - } - else - { - if( match.Index < vertexFunction.MainBodyLocalIdx ) - { - category = MasterNodePortCategory.Fragment; - } - else - { - category = MasterNodePortCategory.Vertex; - } - } - - if( !string.IsNullOrEmpty( match.Groups[ 1 ].Value ) && ShortcutToInfo.ContainsKey( match.Groups[ 1 ].Value ) ) - { - string id = match.Groups[ 0 ].Value.Substring( 0, match.Groups[ 0 ].Value.IndexOf( "*/" ) + 2 ); - TemplateLocalVarData data = new TemplateLocalVarData( ShortcutToInfo[ match.Groups[ 1 ].Value ], id, CgToWirePortType[ match.Groups[ 2 ].Value ], category, match.Groups[ 3 ].Value, match.Index ); - localVarList.Add( data ); - } - else - { - TemplateLocalVarData data = new TemplateLocalVarData( CgToWirePortType[ match.Groups[ 2 ].Value ], category, match.Groups[ 3 ].Value, match.Index ); - localVarList.Add( data ); - } - - } - } - } - } - - public static void FetchInlineVars( string body, ref TemplateIdManager idManager ) - { - foreach( Match match in Regex.Matches( body, InlinePattern ) ) - { - if( match.Success && match.Groups.Count == 2 ) - { - string id = match.Groups[ 0 ].Value; - string prop = match.Groups[ 1 ].Value; - idManager.RegisterTag( id, prop ); - } - } - } - - public static TemplateSRPType CreateTags( ref TemplateTagsModuleData tagsObj, bool isSubShader ) - { - TemplateSRPType srpType = TemplateSRPType.BuiltIn; - MatchCollection matchColl = Regex.Matches( tagsObj.TagsId, TagsPattern, RegexOptions.IgnorePatternWhitespace ); - int count = matchColl.Count; - if( count > 0 ) - { - for( int i = 0; i < count; i++ ) - { - if( matchColl[ i ].Groups.Count == 3 ) - { - if( isSubShader && matchColl[ i ].Groups[ 1 ].Value.Equals( "RenderPipeline" ) ) - { - if( TagToRenderPipeline.ContainsKey( matchColl[ i ].Groups[ 2 ].Value ) ) - srpType = TagToRenderPipeline[ matchColl[ i ].Groups[ 2 ].Value ]; - } - tagsObj.Tags.Add( new TemplatesTagData( matchColl[ i ].Groups[ 1 ].Value, matchColl[ i ].Groups[ 2 ].Value ) ); - } - } - } - return srpType; - } - - public static void CreateZWriteMode( string zWriteData, ref TemplateDepthData depthDataObj ) - { - depthDataObj.DataCheck = TemplateDataCheck.Invalid; - Match match = Regex.Match( zWriteData, ZWritePattern ); - if( match.Groups.Count == 2 ) - { - string property = string.Empty; - if( match.Groups[ 1 ].Success && IsInlineProperty( match.Groups[ 1 ].Value, ref property ) ) - { - depthDataObj.ZWriteInlineValue = property; - depthDataObj.DataCheck = TemplateDataCheck.Valid; - depthDataObj.ValidZWrite = true; - } - else - { - try - { - depthDataObj.ZWriteModeValue = (ZWriteMode)Enum.Parse( typeof( ZWriteMode ), match.Groups[ 1 ].Value ); - depthDataObj.DataCheck = TemplateDataCheck.Valid; - depthDataObj.ValidZWrite = true; - } - catch - { - depthDataObj.DataCheck = TemplateDataCheck.Invalid; - } - } - } - } - - public static void CreateZTestMode( string zTestData, ref TemplateDepthData depthDataObj ) - { - depthDataObj.DataCheck = TemplateDataCheck.Invalid; - Match match = Regex.Match( zTestData, ZTestPattern ); - if( match.Groups.Count == 2 ) - { - string property = string.Empty; - if( match.Groups[ 1 ].Success && IsInlineProperty( match.Groups[ 1 ].Value, ref property ) ) - { - depthDataObj.ZTestInlineValue = property; - depthDataObj.DataCheck = TemplateDataCheck.Valid; - depthDataObj.ValidZTest = true; - } - else - { - try - { - depthDataObj.ZTestModeValue = (ZTestMode)Enum.Parse( typeof( ZTestMode ), match.Groups[ 1 ].Value ); - depthDataObj.DataCheck = TemplateDataCheck.Valid; - depthDataObj.ValidZTest = true; - } - catch - { - depthDataObj.DataCheck = TemplateDataCheck.Invalid; - } - } - } - } - - public static void CreateZOffsetMode( string zOffsetData, ref TemplateDepthData depthDataObj ) - { - depthDataObj.DataCheck = TemplateDataCheck.Invalid; - Match match = Regex.Match( zOffsetData, ZOffsetPattern ); - if( match.Groups.Count == 3 ) - { - try - { - string property = string.Empty; - - if( match.Groups[ 1 ].Success && IsInlineProperty( match.Groups[ 1 ].Value, ref property ) ) - { - depthDataObj.OffsetFactorInlineValue = property; - } - else - { - depthDataObj.OffsetFactor = Convert.ToSingle( match.Groups[ 1 ].Value ); - } - - if( match.Groups[ 2 ].Success && IsInlineProperty( match.Groups[ 2 ].Value, ref property ) ) - { - depthDataObj.OffsetUnitsInlineValue = property; - } - else - { - depthDataObj.OffsetUnits = Convert.ToSingle( match.Groups[ 2 ].Value ); - } - - depthDataObj.ValidOffset = true; - depthDataObj.DataCheck = TemplateDataCheck.Valid; - } - catch - { - depthDataObj.DataCheck = TemplateDataCheck.Invalid; - } - } - } - - public static List<TemplateVertexData> CreateVertexDataList( string vertexData, string parametersBody ) - { - List<TemplateVertexData> vertexDataList = null; - Dictionary<TemplateSemantics, TemplateVertexData> vertexDataDict = null; - - foreach( Match match in Regex.Matches( vertexData, VertexDataPattern ) ) - { - if( match.Groups.Count > 1 ) - { - if( vertexDataList == null ) - { - vertexDataList = new List<TemplateVertexData>(); - vertexDataDict = new Dictionary<TemplateSemantics, TemplateVertexData>(); - } - - WirePortDataType dataType = CgToWirePortType[ match.Groups[ 1 ].Value ]; - string varName = match.Groups[ 2 ].Value; - TemplateSemantics semantics = (TemplateSemantics)Enum.Parse( typeof( TemplateSemantics ), match.Groups[ 3 ].Value ); - TemplateVertexData templateVertexData = new TemplateVertexData( semantics, dataType, varName ); - vertexDataList.Add( templateVertexData ); - vertexDataDict.Add( semantics, templateVertexData ); - } - } - - if( vertexData.Contains( Constants.InstanceIdMacro ) ) - { - TemplateVertexData templateVertexData = new TemplateVertexData( TemplateSemantics.SV_InstanceID, WirePortDataType.UINT, Constants.InstanceIdVariable ); - templateVertexData.DataInfo = TemplateInfoOnSematics.INSTANCE_ID; - templateVertexData.Available = true; - templateVertexData.ExcludeStructPrefix = true; - - vertexDataList.Add( templateVertexData ); - vertexDataDict.Add( TemplateSemantics.SV_InstanceID, templateVertexData ); - } - - if( !string.IsNullOrEmpty( parametersBody ) ) - { - string[] paramsArray = parametersBody.Split( IOUtils.FIELD_SEPARATOR ); - if( paramsArray.Length > 0 ) - { - for( int i = 0; i < paramsArray.Length; i++ ) - { - string[] paramDataArr = paramsArray[ i ].Split( IOUtils.VALUE_SEPARATOR ); - if( paramDataArr.Length == 2 ) - { - string[] swizzleInfoArr = paramDataArr[ 1 ].Split( IOUtils.FLOAT_SEPARATOR ); - TemplateSemantics semantic = ShortcutToSemantic[ swizzleInfoArr[ 0 ] ]; - if( vertexDataDict.ContainsKey( semantic ) ) - { - TemplateVertexData templateVertexData = vertexDataDict[ semantic ]; - if( templateVertexData != null ) - { - if( swizzleInfoArr.Length > 1 ) - { - templateVertexData.DataSwizzle = "." + swizzleInfoArr[ 1 ]; - } - templateVertexData.DataInfo = ShortcutToInfo[ paramDataArr[ 0 ] ]; - templateVertexData.Available = true; - } - } - } - } - } - } - - if( vertexDataDict != null ) - { - vertexDataDict.Clear(); - vertexDataDict = null; - } - - return vertexDataList; - } - - public static TemplateInterpData CreateInterpDataList( string interpData, string fullLine, int maxInterpolators ) - { - TemplateInterpData interpDataObj = null; - List<TemplateVertexData> interpDataList = null; - Dictionary<TemplateSemantics, TemplateVertexData> interpDataDict = null; - Match rangeMatch = Regex.Match( fullLine, InterpRangePattern ); - if( rangeMatch.Groups.Count > 0 ) - { - interpDataObj = new TemplateInterpData(); - // Get range of available interpolators - int minVal = 0; - int maxVal = 0; - try - { - string[] minValArgs = rangeMatch.Groups[ 1 ].Value.Split( IOUtils.FLOAT_SEPARATOR ); - minVal = Convert.ToInt32( minValArgs[ 0 ] ); - if( string.IsNullOrEmpty( rangeMatch.Groups[ 2 ].Value ) ) - { - maxVal = maxInterpolators - 1; - interpDataObj.DynamicMax = true; - } - else - { - maxVal = Convert.ToInt32( rangeMatch.Groups[ 2 ].Value ); - } - if( minVal > maxVal ) - { - //int aux = minVal; - //minVal = maxVal; - //maxVal = aux; - maxVal = minVal; - } - - for( int i = minVal; i <= maxVal; i++ ) - { - interpDataObj.AvailableInterpolators.Add( new TemplateInterpElement( IntToSemantic[ i ] ) ); - } - if( minValArgs.Length > 1 ) - { - interpDataObj.AvailableInterpolators[ 0 ].SetAvailableChannelsFromString( minValArgs[ 1 ] ); - } - } - catch( Exception e ) - { - Debug.LogException( e ); - } - - interpDataList = new List<TemplateVertexData>(); - interpDataDict = new Dictionary<TemplateSemantics, TemplateVertexData>(); - - //Get Current interpolators - int parametersBeginIdx = fullLine.IndexOf( ":" ) + 1; - int parametersEnd = fullLine.IndexOf( TemplatesManager.TemplateEndOfLine ); - string parametersBody = fullLine.Substring( parametersBeginIdx, parametersEnd - parametersBeginIdx ); - - foreach( Match match in Regex.Matches( interpData, VertexDataPattern ) ) - { - if( match.Groups.Count > 1 ) - { - WirePortDataType dataType = CgToWirePortType[ match.Groups[ 1 ].Value ]; - string varName = match.Groups[ 2 ].Value; - TemplateSemantics semantics = (TemplateSemantics)Enum.Parse( typeof( TemplateSemantics ), match.Groups[ 3 ].Value ); - TemplateVertexData templateVertexData = new TemplateVertexData( semantics, dataType, varName ); - //interpDataList.Add( templateVertexData ); - interpDataDict.Add( semantics, templateVertexData ); - interpDataObj.RawInterpolators.Add( templateVertexData ); - //Check if they are also on the free channels list and update their names - interpDataObj.ReplaceNameOnInterpolator( semantics, varName ); - } - } - - if( interpData.Contains( Constants.InstanceIdMacro ) ) - { - TemplateVertexData templateInterpData = new TemplateVertexData( TemplateSemantics.SV_InstanceID, WirePortDataType.UINT, Constants.InstanceIdVariable ); - templateInterpData.DataInfo = TemplateInfoOnSematics.INSTANCE_ID; - templateInterpData.Available = true; - templateInterpData.ExcludeStructPrefix = true; - interpDataList.Add( templateInterpData ); - interpDataDict.Add( TemplateSemantics.SV_InstanceID, templateInterpData ); - } - - Dictionary<string, TemplateVertexData> auxDict = new Dictionary<string, TemplateVertexData>(); - // Get info for available interpolators - string[] paramsArray = parametersBody.Split( IOUtils.FIELD_SEPARATOR ); - if( paramsArray.Length > 0 ) - { - for( int i = 0; i < paramsArray.Length; i++ ) - { - string[] paramDataArr = paramsArray[ i ].Split( IOUtils.VALUE_SEPARATOR ); - if( paramDataArr.Length == 2 ) - { - string[] swizzleInfoArr = paramDataArr[ 1 ].Split( IOUtils.FLOAT_SEPARATOR ); - TemplateSemantics semantic = ShortcutToSemantic[ swizzleInfoArr[ 0 ] ]; - if( interpDataDict.ContainsKey( semantic ) ) - { - if( interpDataDict[ semantic ] != null ) - { - string[] multiComponent = paramDataArr[ 0 ].Split( IOUtils.FLOAT_SEPARATOR ); - - if( multiComponent.Length > 1 ) - { - TemplateVertexData templateInterpData = null; - if( auxDict.ContainsKey( multiComponent[ 0 ] ) ) - { - templateInterpData = auxDict[ multiComponent[ 0 ] ]; - } - else - { - templateInterpData = new TemplateVertexData( interpDataDict[ semantic ] ); - //if( swizzleInfoArr.Length > 1 ) - //{ - // templateInterpData.DataSwizzle = "." + swizzleInfoArr[ 1 ]; - //} - templateInterpData.DataInfo = ShortcutToInfo[ multiComponent[ 0 ] ]; - templateInterpData.Available = true; - interpDataList.Add( templateInterpData ); - auxDict.Add( multiComponent[ 0 ], templateInterpData ); - } - - if( swizzleInfoArr[ 1 ].Length == multiComponent[ 1 ].Length ) - { - for( int channelIdx = 0; channelIdx < swizzleInfoArr[ 1 ].Length; channelIdx++ ) - { - templateInterpData.RegisterComponent( multiComponent[ 1 ][ channelIdx ], interpDataDict[ semantic ].VarName + "." + swizzleInfoArr[ 1 ][ channelIdx ] ); - } - } - } - else - { - TemplateVertexData templateInterpData = new TemplateVertexData( interpDataDict[ semantic ] ); - if( swizzleInfoArr.Length > 1 ) - { - templateInterpData.DataSwizzle = "." + swizzleInfoArr[ 1 ]; - } - templateInterpData.DataInfo = ShortcutToInfo[ paramDataArr[ 0 ] ]; - templateInterpData.Available = true; - interpDataList.Add( templateInterpData ); - } - } - } - } - } - } - - /*TODO: - 1) Remove interpDataList.Add( templateVertexData ); from initial foreach - 2) When looping though each foreach array element, create a new TemplateVertexData - from the one containted on the interpDataDict and add it to interpDataList - */ - for( int i = 0; i < interpDataList.Count; i++ ) - { - interpDataList[ i ].BuildVar(); - } - - auxDict.Clear(); - auxDict = null; - - interpDataObj.Interpolators = interpDataList; - interpDataDict.Clear(); - interpDataDict = null; - } - return interpDataObj; - } - - public static void FetchDependencies( TemplateInfoContainer dependencies, ref string body ) - { - int index = body.IndexOf( TemplatesManager.TemplateDependenciesListTag ); - if( index > 0 ) - { - dependencies.Index = index; - dependencies.Id = TemplatesManager.TemplateDependenciesListTag; - dependencies.Data = TemplatesManager.TemplateDependenciesListTag; - } - else - { - int lastIndex = body.LastIndexOf( '}' ); - if( lastIndex > 0 ) - { - body = body.Insert( lastIndex, "\t" + TemplatesManager.TemplateDependenciesListTag + "\n" ); - FetchDependencies( dependencies, ref body ); - } - } - } - - public static void FetchCustomInspector( TemplateInfoContainer inspectorContainer, ref string body ) - { - Match match = Regex.Match( body, CustomInspectorPattern, RegexOptions.Multiline ); - if( match != null && match.Groups.Count > 1 ) - { - inspectorContainer.Index = match.Index; - inspectorContainer.Id = match.Groups[ 0 ].Value; - inspectorContainer.Data = match.Groups[ 1 ].Value; - -#if UNITY_2019_3_OR_NEWER - if( ASEPackageManagerHelper.CurrentHDVersion > ASESRPVersions.ASE_SRP_6_9_1 ) - { - if( inspectorContainer.Data.Equals( "UnityEditor.Experimental.Rendering.HDPipeline.HDLitGUI" ) ) - inspectorContainer.Data = "UnityEditor.Rendering.HighDefinition.HDLitGUI"; - } -#endif - } - else - { - int index = body.LastIndexOf( '}' ); - if( index > 0 ) - { - body = body.Insert( index, string.Format( "\tCustomEditor \"{0}\"\n", Constants.DefaultCustomInspector ) ); - FetchCustomInspector( inspectorContainer, ref body ); - } - } - } - - public static void FetchFallback( TemplateInfoContainer fallbackContainer, ref string body ) - { - Match match = Regex.Match( body, FallbackPattern, RegexOptions.Multiline | RegexOptions.IgnoreCase ); - if( match != null && match.Groups.Count > 1 ) - { - fallbackContainer.Index = match.Index; - fallbackContainer.Id = match.Groups[ 0 ].Value; - fallbackContainer.Data = match.Groups[ 1 ].Value; - } - else - { - int index = body.LastIndexOf( '}' ); - if( index > 0 ) - { - body = body.Insert( index, "\tFallback \"\"\n" ); - FetchFallback( fallbackContainer, ref body ); - } - } - } - - public static string AutoSwizzleData( string dataVar, WirePortDataType from, WirePortDataType to, bool isPosition ) - { - switch( from ) - { - case WirePortDataType.COLOR: - case WirePortDataType.FLOAT4: - { - switch( to ) - { - case WirePortDataType.FLOAT3: dataVar += ".xyz"; break; - case WirePortDataType.FLOAT2: dataVar += ".xy"; break; - case WirePortDataType.INT: - case WirePortDataType.FLOAT: dataVar += ".x"; break; - } - } - break; - case WirePortDataType.FLOAT3: - { - switch( to ) - { - case WirePortDataType.FLOAT4: dataVar = string.Format( "float4({0},{1})", dataVar,(isPosition?1:0) ); break; - case WirePortDataType.FLOAT2: dataVar += ".xy"; break; - case WirePortDataType.INT: - case WirePortDataType.FLOAT: dataVar += ".x"; break; - } - } - break; - case WirePortDataType.FLOAT2: - { - switch( to ) - { - case WirePortDataType.FLOAT4: dataVar = string.Format( "float4({0},0,{1})", dataVar , (isPosition ? 1 : 0) ); break; - case WirePortDataType.FLOAT3: dataVar = string.Format( "float3({0},0)", dataVar ); break; - case WirePortDataType.INT: - case WirePortDataType.FLOAT: dataVar += ".x"; break; - } - } - break; - case WirePortDataType.FLOAT: - { - switch( to ) - { - case WirePortDataType.FLOAT4: dataVar = string.Format( "float4({0},0,0,{1})", dataVar, ( isPosition ? 1 : 0 ) ); break; - case WirePortDataType.FLOAT3: dataVar = string.Format( "float3({0},0,0)", dataVar ); break; - case WirePortDataType.FLOAT2: dataVar = string.Format( "float2({0},0)", dataVar ); break; - } - } - break; - } - return dataVar; - } - - public static bool CheckIfTemplate( string assetPath ) - { - Type type = AssetDatabase.GetMainAssetTypeAtPath( assetPath ); - if( type == typeof( Shader ) ) - { - Shader shader = AssetDatabase.LoadAssetAtPath<Shader>( assetPath ); - if( shader != null ) - { - string body = IOUtils.LoadTextFileFromDisk( assetPath ); - return ( body.IndexOf( TemplatesManager.TemplateShaderNameBeginTag ) > -1 ); - } - } - return false; - } - - public static bool CheckIfCompatibles( WirePortDataType first, WirePortDataType second ) - { - switch( first ) - { - case WirePortDataType.OBJECT: - return true; - case WirePortDataType.FLOAT: - case WirePortDataType.FLOAT2: - case WirePortDataType.FLOAT3: - case WirePortDataType.FLOAT4: - case WirePortDataType.COLOR: - case WirePortDataType.INT: - { - switch( second ) - { - case WirePortDataType.FLOAT3x3: - case WirePortDataType.FLOAT4x4: - case WirePortDataType.SAMPLER1D: - case WirePortDataType.SAMPLER2D: - case WirePortDataType.SAMPLER3D: - case WirePortDataType.SAMPLERCUBE: - return false; - } - } - break; - case WirePortDataType.FLOAT3x3: - case WirePortDataType.FLOAT4x4: - { - switch( second ) - { - case WirePortDataType.FLOAT: - case WirePortDataType.FLOAT2: - case WirePortDataType.FLOAT3: - case WirePortDataType.FLOAT4: - case WirePortDataType.COLOR: - case WirePortDataType.INT: - case WirePortDataType.SAMPLER1D: - case WirePortDataType.SAMPLER2D: - case WirePortDataType.SAMPLER3D: - case WirePortDataType.SAMPLERCUBE: - return false; - } - } - break; - case WirePortDataType.SAMPLER1D: - case WirePortDataType.SAMPLER2D: - case WirePortDataType.SAMPLER3D: - case WirePortDataType.SAMPLERCUBE: - { - switch( second ) - { - case WirePortDataType.FLOAT: - case WirePortDataType.FLOAT2: - case WirePortDataType.FLOAT3: - case WirePortDataType.FLOAT4: - case WirePortDataType.FLOAT3x3: - case WirePortDataType.FLOAT4x4: - case WirePortDataType.COLOR: - case WirePortDataType.INT: - return false; - } - } - break; - } - return true; - } - // Lightweight <-> Default functions - public static string WorldSpaceViewDir( MasterNodeDataCollector dataCollector, string worldPosVec3, bool normalize ) - { - string value = string.Empty; - if( dataCollector.IsTemplate && dataCollector.IsSRP ) - { - value = string.Format( "_WorldSpaceCameraPos.xyz - {0}", worldPosVec3 ); - } - else - { - value = string.Format( "UnityWorldSpaceViewDir( {0} )", worldPosVec3 ); - } - - if( normalize ) - { - value = SafeNormalize( dataCollector, value ); - } - - return value; - } - - public static string SafeNormalize( MasterNodeDataCollector dataCollector, string value ) - { - if( dataCollector.IsTemplate && dataCollector.IsSRP ) - { - value = string.Format( "SafeNormalize( {0} )", value ); - } - else - { - dataCollector.AddToIncludes( -1, Constants.UnityBRDFLib ); - value = string.Format( "Unity_SafeNormalize( {0} )", value ); - } - return value; - } - - - public static string CreateUnpackNormalStr( MasterNodeDataCollector dataCollector, bool applyScale, string scale ) - { - string funcName; - if( dataCollector.IsTemplate && dataCollector.IsSRP ) - { - if( dataCollector.TemplateDataCollectorInstance.IsHDRP ) - { - funcName = "UnpackNormalmapRGorAG( {0}, " + scale + " )"; - } - else - { - funcName = "UnpackNormalScale( {0}, " + scale + " )"; - } - } - else - { - funcName = applyScale ? "UnpackScaleNormal( {0}, " + scale + " )" : "UnpackNormal( {0} )"; - } - return funcName; - } - - public static bool IsInlineProperty( string data, ref string property ) - { - if( data.Length > 0 && data[ 0 ] == '[' && data[ data.Length - 1 ] == ']' ) - { - property = data.Substring( 1, data.Length - 2 ); - return true; - } - return false; - } - - // public static readonly string FetchDefaultDepthFormat = "UNITY_SAMPLE_DEPTH(tex2Dproj(_CameraDepthTexture,UNITY_PROJ_COORD( {0} )))"; - public static readonly string FetchDefaultDepthFormat = "SAMPLE_DEPTH_TEXTURE( _CameraDepthTexture, {0}.xy )"; - public static readonly string FetchDefaultDepthFormatVertex = "SAMPLE_DEPTH_TEXTURE_LOD( _CameraDepthTexture, float4( {0}.xy, 0, 0 ) )"; - - public static readonly string FetchLWDepthFormat = "SHADERGRAPH_SAMPLE_SCENE_DEPTH( {0}.xy )"; - public static readonly string FetchLWDepthFormatVertex = "SHADERGRAPH_SAMPLE_SCENE_DEPTH_LOD( {0}.xy )"; -#if UNITY_2018_3_OR_NEWER - public static readonly string FetchHDDepthFormat = "SampleCameraDepth( {0}.xy )"; -#else - public static readonly string FetchHDDepthFormat = "SAMPLE_TEXTURE2D( _CameraDepthTexture, s_point_clamp_sampler, {0}.xy ).r"; -#endif - public static string CreateDepthFetch( MasterNodeDataCollector dataCollector, string screenPos ) - { - string screenDepthInstruction = string.Empty; - if( dataCollector.IsTemplate && dataCollector.IsSRP ) - { - if( dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.Lightweight ) - { - if( dataCollector.PortCategory == MasterNodePortCategory.Vertex ) - { - string m_functionBody = string.Empty; - GenerateLW( ref m_functionBody ); - dataCollector.AddFunctions( FetchLWDepthFormatVertex, m_functionBody, "0" ); - screenDepthInstruction = string.Format( FetchLWDepthFormatVertex, screenPos ); - } - else - screenDepthInstruction = string.Format( FetchLWDepthFormat, screenPos ); - } - else if( dataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HD ) - screenDepthInstruction = string.Format( FetchHDDepthFormat, screenPos ); - } - else - { - if( dataCollector.PortCategory == MasterNodePortCategory.Vertex ) - screenDepthInstruction = string.Format( FetchDefaultDepthFormatVertex, screenPos ); - else - screenDepthInstruction = string.Format( FetchDefaultDepthFormat, screenPos ); - } - return screenDepthInstruction; - } - - public static void GenerateLW( ref string body ) - { - body = string.Empty; - IOUtils.AddFunctionHeader( ref body, "float SHADERGRAPH_SAMPLE_SCENE_DEPTH_LOD(float2 uv)" ); - IOUtils.AddFunctionLine( ref body, "#if defined(REQUIRE_DEPTH_TEXTURE)" ); - IOUtils.AddFunctionLine( ref body, "#if defined(UNITY_STEREO_INSTANCING_ENABLED) || defined(UNITY_STEREO_MULTIVIEW_ENABLED)" ); - IOUtils.AddFunctionLine( ref body, " \tfloat rawDepth = SAMPLE_TEXTURE2D_ARRAY_LOD(_CameraDepthTexture, sampler_CameraDepthTexture, uv, unity_StereoEyeIndex, 0).r;" ); - IOUtils.AddFunctionLine( ref body, "#else" ); - IOUtils.AddFunctionLine( ref body, " \tfloat rawDepth = SAMPLE_DEPTH_TEXTURE_LOD(_CameraDepthTexture, sampler_CameraDepthTexture, uv, 0);" ); - IOUtils.AddFunctionLine( ref body, "#endif" ); - IOUtils.AddFunctionLine( ref body, "return rawDepth;" ); - IOUtils.AddFunctionLine( ref body, "#endif // REQUIRE_DEPTH_TEXTURE" ); - IOUtils.AddFunctionLine( ref body, "return 0;" ); - IOUtils.CloseFunctionBody( ref body ); - } - - public static bool GetShaderModelForInterpolatorAmount( int interpAmount, ref string shaderModel ) - { - for( int i = 0; i < AvailableShaderModels.Length; i++ ) - { - if( AvailableInterpolators[ AvailableShaderModels[ i ] ] >= interpAmount ) - { - shaderModel = AvailableShaderModels[ i ]; - return true; - } - } - return false; - } - - public static string GetSubShaderFrom( string shaderBody ) - { - Match match = Regex.Match( shaderBody, FetchSubShaderBody, RegexOptions.Singleline ); - if( match.Success && match.Groups.Count > 1 ) - { - return match.Groups[ 1 ].Value; - } - - return string.Empty; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateHelperFunctions.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateHelperFunctions.cs.meta deleted file mode 100644 index 8cbfe8cd..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateHelperFunctions.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 517aad6764d713946bc566f0a83cd44d -timeCreated: 1495548641 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateIdManager.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateIdManager.cs deleted file mode 100644 index a9d242d0..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateIdManager.cs +++ /dev/null @@ -1,236 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace AmplifyShaderEditor -{ - [Serializable] - public class TemplatePassId - { - public string PassId; - public bool RemoveFromShader; - } - - - [Serializable] - public class TemplateTag - { - public string Tag = string.Empty; - public string Replacement = string.Empty; - public string Output = string.Empty; - public TemplateTag( string tag, string replacement = null ) - { - Tag = tag; - if( replacement != null ) - { - Replacement = replacement; - Output = replacement; - } - } - } - - [Serializable] - public class TemplateId - { - public int StartIdx = -1; - public string UniqueID; - public string Tag; - public string ReplacementText; - public bool IsReplaced = false; - public bool EmptyReplacer = false; - public TemplateId( int bodyIdx, string uniqueID, string tag, bool emptyReplacer = false ) - { - StartIdx = bodyIdx; - UniqueID = uniqueID; - Tag = tag; - EmptyReplacer = emptyReplacer; - ReplacementText = emptyReplacer ? string.Empty : tag; - } - - public void SetReplacementText( string replacementText ) - { - ReplacementText = replacementText; - IsReplaced = true; - } - - public void Reset() - { - ReplacementText = EmptyReplacer?string.Empty:Tag; - IsReplaced = false; - } - } - - [Serializable] - public class TemplateIdManager - { - [SerializeField] - private bool m_isSorted = false; - [SerializeField] - private string m_shaderBody; - [SerializeField] - private List<TemplateId> m_registeredIds = new List<TemplateId>(); - - [SerializeField] - private List<TemplateTag> m_registeredTags = new List<TemplateTag>(); - - [SerializeField] - private List<TemplatePassId> m_registeredPassIds = new List<TemplatePassId>(); - - private Dictionary<string, TemplateId> m_registeredIdsDict = new Dictionary<string, TemplateId>(); - - public TemplateIdManager( string shaderBody ) - { - m_shaderBody = shaderBody; - } - - public void Destroy() - { - m_registeredPassIds.Clear(); - m_registeredPassIds = null; - - m_registeredTags.Clear(); - m_registeredTags = null; - - m_registeredIds.Clear(); - m_registeredIds = null; - if( m_registeredIdsDict != null ) - { - m_registeredIdsDict.Clear(); - m_registeredIdsDict = null; - } - } - - void RefreshIds() - { - if( m_registeredIdsDict == null ) - { - m_registeredIdsDict = new Dictionary<string, TemplateId>(); - } - - if( m_registeredIdsDict.Count != m_registeredIds.Count ) - { - m_registeredIdsDict.Clear(); - int count = m_registeredIds.Count; - for( int i = 0; i < count; i++ ) - { - m_registeredIdsDict.Add( m_registeredIds[ i ].UniqueID, m_registeredIds[ i ] ); - } - } - } - - public void RegisterId( int bodyIdx, string uniqueID, string tag, bool emptyReplacer = false ) - { - if( bodyIdx < 0 ) - return; - - RefreshIds(); - - TemplateId templateId = new TemplateId( bodyIdx, uniqueID, tag, emptyReplacer ); - m_registeredIds.Add( templateId ); - m_registeredIdsDict.Add( uniqueID, templateId ); - } - - public void RegisterTag( string tag, string replacement = null ) - { - m_registeredTags.Add( new TemplateTag( tag, replacement ) ); - } - - public void RegisterPassId( string passId ) - { - m_registeredPassIds.Add( new TemplatePassId() { PassId = passId, RemoveFromShader = false } ); - } - - public void SetPassIdUsage( int idx , bool removeFromShader ) - { - m_registeredPassIds[ idx ].RemoveFromShader = removeFromShader; - } - - public void SetReplacementText( string uniqueId, string replacementText ) - { - RefreshIds(); - - if( m_registeredIdsDict.ContainsKey( uniqueId ) && m_registeredIdsDict[ uniqueId ].StartIdx >= 0 ) - m_registeredIdsDict[ uniqueId ].SetReplacementText( replacementText ); - } - - - public string BuildShader() - { - if( !m_isSorted ) - { - m_registeredIds.Sort( ( x, y ) => { return x.StartIdx.CompareTo( y.StartIdx ); } ); - } - - int idCount = m_registeredIds.Count; - int offset = 0; - string finalShaderBody = m_shaderBody; - for( int i = 0; i < idCount; i++ ) - { - if( m_registeredIds[ i ].StartIdx >= 0 && m_registeredIds[ i ].IsReplaced ) - { - finalShaderBody = finalShaderBody.ReplaceAt( m_registeredIds[ i ].Tag, m_registeredIds[ i ].ReplacementText, offset + m_registeredIds[ i ].StartIdx ); - offset += ( m_registeredIds[ i ].ReplacementText.Length - m_registeredIds[ i ].Tag.Length ); - } - } - - int count = m_registeredPassIds.Count; - for( int i = 0; i < count; i++ ) - { - if( m_registeredPassIds[ i ].RemoveFromShader ) - finalShaderBody = finalShaderBody.Replace( m_registeredPassIds[ i ].PassId, string.Empty ); - } - - for( int i = 0; i < idCount; i++ ) - { - if( !m_registeredIds[ i ].IsReplaced && !m_registeredIds[ i ].Tag.Equals( m_registeredIds[ i ].ReplacementText ) ) - { - finalShaderBody = finalShaderBody.Replace( m_registeredIds[ i ].Tag, m_registeredIds[ i ].ReplacementText ); - } - } - - count = m_registeredTags.Count; - for( int i = 0; i < count; i++ ) - { - finalShaderBody = finalShaderBody.Replace( m_registeredTags[ i ].Tag, m_registeredTags[ i ].Replacement ); - m_registeredTags[ i ].Replacement = m_registeredTags[ i ].Output; - } - - //finalShaderBody = finalShaderBody.Replace( TemplatesManager.TemplateExcludeFromGraphTag, string.Empty ); - //finalShaderBody = finalShaderBody.Replace( TemplatesManager.TemplateMainPassTag, string.Empty ); - - return finalShaderBody; - } - - public void ResetRegistersState() - { - int count = m_registeredIds.Count; - for( int i = 0; i < count; i++ ) - { - m_registeredIds[ i ].Reset(); - } - } - - public void Reset() - { - m_registeredIds.Clear(); - if( m_registeredIdsDict == null ) - { - m_registeredIdsDict = new Dictionary<string, TemplateId>(); - } - else - { - m_registeredIdsDict.Clear(); - } - } - - public string ShaderBody - { - get { return m_shaderBody; } - set { m_shaderBody = value; } - } - - public List<TemplateTag> RegisteredTags { get { return m_registeredTags; } set { m_registeredTags = value; } } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateIdManager.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateIdManager.cs.meta deleted file mode 100644 index 887ff5a8..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateIdManager.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: b0d2e93061ffcbd45b085a61e5000daa -timeCreated: 1517315635 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateInterpData.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateInterpData.cs deleted file mode 100644 index 6e5da580..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateInterpData.cs +++ /dev/null @@ -1,234 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace AmplifyShaderEditor -{ - [Serializable] - public class TemplateInterpElement - { - public TemplateSemantics Semantic; - public bool[] AvailableChannels = { true, true, true, true }; - public bool IsFull = false; - public int Usage = 0; - public string Name; - - public TemplateInterpElement( TemplateInterpElement other ) - { - Semantic = other.Semantic; - for ( int i = 0; i < AvailableChannels.Length; i++ ) - { - AvailableChannels[ i ] = other.AvailableChannels[ i ]; - } - IsFull = other.IsFull; - Usage = other.Usage; - Name = other.Name; - } - - public TemplateInterpElement( TemplateSemantics semantic ) - { - Semantic = semantic; - int semanticId = TemplateHelperFunctions.SemanticToInt[ Semantic ]; - Name = ( semanticId == 0 ) ? TemplateHelperFunctions.BaseInterpolatorName : TemplateHelperFunctions.BaseInterpolatorName + semanticId.ToString(); - } - - public void SetAvailableChannelsFromString( string channels ) - { - for ( int i = 0; i < AvailableChannels.Length; i++ ) - { - AvailableChannels[ i ] = false; - } - Usage = AvailableChannels.Length; - - for ( int i = 0; i < channels.Length; i++ ) - { - switch ( channels[ i ] ) - { - case 'x': if ( !AvailableChannels[ 0 ] ) { AvailableChannels[ 0 ] = true; Usage--; } break; - case 'y': if ( !AvailableChannels[ 1 ] ) { AvailableChannels[ 1 ] = true; Usage--; } break; - case 'z': if ( !AvailableChannels[ 2 ] ) { AvailableChannels[ 2 ] = true; Usage--; } break; - case 'w': if ( !AvailableChannels[ 3 ] ) { AvailableChannels[ 3 ] = true; Usage--; } break; - } - } - } - - public TemplateVertexData RequestChannels( WirePortDataType type, bool isColor, string customName = null ) - { - if ( IsFull ) - return null; - - int channelsRequired = TemplateHelperFunctions.DataTypeChannelUsage[ type ]; - if ( channelsRequired == 0 ) - return null; - - int firstChannel = -1; - for ( int i = 0; i < AvailableChannels.Length; i++ ) - { - if ( AvailableChannels[ i ] ) - { - if ( firstChannel < 0 ) - { - firstChannel = i; - } - channelsRequired -= 1; - if ( channelsRequired == 0 ) - break; - } - } - - //did not found enough channels to fill request - if ( channelsRequired > 0 ) - return null; - - if( Usage == 0 && customName != null ) - { - Name = customName; - } - - Usage += 1; - TemplateVertexData data = null; - - if ( type == WirePortDataType.COLOR || type == WirePortDataType.FLOAT4 ) - { - // Automatically lock all channels - for ( int i = firstChannel; i < ( firstChannel + channelsRequired ); i++ ) - { - AvailableChannels[ i ] = false; - } - IsFull = true; - data = new TemplateVertexData( Semantic, type, Name ); - } - else - { - string[] swizzleArray = ( isColor ) ? TemplateHelperFunctions.ColorSwizzle : TemplateHelperFunctions.VectorSwizzle; - string channels = "."; - int count = firstChannel + TemplateHelperFunctions.DataTypeChannelUsage[ type ]; - for ( int i = firstChannel; i < count; i++ ) - { - AvailableChannels[ i ] = false; - channels += swizzleArray[ i ]; - if ( i == ( AvailableChannels.Length - 1 ) ) - { - IsFull = true; - } - } - - data = new TemplateVertexData( Semantic, type, Name, channels ); - } - return data; - } - } - - [Serializable] - public class TemplateInterpData - { - [SerializeField] - private string m_interpDataId = string.Empty; - - [SerializeField] - private int m_interpDataStartIdx = -1; - - [SerializeField] - private bool m_dynamicMax = false; - - public List<TemplateInterpElement> AvailableInterpolators = new List<TemplateInterpElement>(); - public List<TemplateVertexData> Interpolators = new List<TemplateVertexData>(); - public List<TemplateVertexData> RawInterpolators = new List<TemplateVertexData>(); - - public TemplateInterpData() { } - - public bool HasRawInterpolatorOfName( string name ) - { - return RawInterpolators.Exists( ( x ) => x.VarName.Equals( name )); - } - - public TemplateInterpData( TemplateInterpData other ) - { - m_dynamicMax = other.DynamicMax; - - foreach ( TemplateInterpElement data in other.AvailableInterpolators ) - { - AvailableInterpolators.Add( new TemplateInterpElement( data ) ); - } - - for ( int i = 0; i < other.Interpolators.Count; i++ ) - { - Interpolators.Add( new TemplateVertexData( other.Interpolators[ i ] ) ); - } - - for( int i = 0; i < other.RawInterpolators.Count; i++ ) - { - RawInterpolators.Add( new TemplateVertexData( other.RawInterpolators[ i ] ) ); - } - } - - - public void RecalculateAvailableInterpolators( int newMax ) - { - if( m_dynamicMax ) - { - if( !TemplateHelperFunctions.IntToSemantic.ContainsKey( ( newMax - 1 ) ) ) - { - Debug.LogWarning( "Attempting to add inexisting available interpolators" ); - return; - } - - if( AvailableInterpolators.Count > 0 ) - { - int currMax = 1 + TemplateHelperFunctions.SemanticToInt[ AvailableInterpolators[ AvailableInterpolators.Count - 1 ].Semantic ]; - if( newMax > currMax ) - { - int count = newMax - currMax; - for( int i = 0; i < count; i++ ) - { - AvailableInterpolators.Add( new TemplateInterpElement( TemplateHelperFunctions.IntToSemantic[ currMax + i ] )); - } - } - else if( newMax < currMax ) - { - int min = TemplateHelperFunctions.SemanticToInt[ AvailableInterpolators[ 0 ].Semantic ]; - if( newMax > min ) - { - int count = currMax - newMax; - for( int i = 0; i < count; i++ ) - { - AvailableInterpolators.RemoveAt( AvailableInterpolators.Count - 1 ); - } - } - } - } - } - } - - public void ReplaceNameOnInterpolator( TemplateSemantics semantic, string newName ) - { - for ( int i = 0; i < AvailableInterpolators.Count; i++ ) - { - if ( AvailableInterpolators[ i ].Semantic == semantic ) - { - AvailableInterpolators[ i ].Name = newName; - break; - } - } - } - - public void Destroy() - { - AvailableInterpolators.Clear(); - AvailableInterpolators = null; - - Interpolators.Clear(); - Interpolators = null; - - RawInterpolators.Clear(); - RawInterpolators = null; - } - - public string InterpDataId { get { return m_interpDataId; } set { m_interpDataId = value; } } - public int InterpDataStartIdx { get { return m_interpDataStartIdx; } set { m_interpDataStartIdx = value; } } - public bool DynamicMax { get { return m_dynamicMax; } set { m_dynamicMax = value; } } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateInterpData.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateInterpData.cs.meta deleted file mode 100644 index cf31bc9b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateInterpData.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 8f700ba5366bcda45beea5c0e2db9f3e -timeCreated: 1496053368 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateLocalVarData.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateLocalVarData.cs deleted file mode 100644 index 3cde2f03..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateLocalVarData.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System; -using UnityEngine; - -namespace AmplifyShaderEditor -{ - [Serializable] - public class TemplateLocalVarData - { - [SerializeField] - private WirePortDataType m_dataType = WirePortDataType.OBJECT; - - [SerializeField] - private string m_localVarName = string.Empty; - - [SerializeField] - private int m_position = -1; - - [SerializeField] - private bool m_isSpecialVar = false; - - [SerializeField] - private TemplateInfoOnSematics m_specialVarType; - - [SerializeField] - private MasterNodePortCategory m_category; - - [SerializeField] - private string m_id; - - public TemplateLocalVarData( WirePortDataType dataType, MasterNodePortCategory category, string localVarName, int position ) - { - m_dataType = dataType; - m_localVarName = localVarName; - m_position = position; - m_category = category; - //Debug.Log( m_localVarName + " " + m_inputData.PortCategory + " " + m_inputData.PortName ); - } - - public TemplateLocalVarData( TemplateInfoOnSematics specialVarType,string id, WirePortDataType dataType, MasterNodePortCategory category, string localVarName, int position ) - { - m_id = id; - m_dataType = dataType; - m_localVarName = localVarName; - m_position = position; - m_specialVarType = specialVarType; - m_isSpecialVar = true; - m_category = category; - //Debug.Log( m_localVarName + " " + m_inputData.PortCategory + " " + m_inputData.PortName ); - } - - public WirePortDataType DataType { get { return m_dataType; } } - public string LocalVarName { get { return m_localVarName; } } - public int Position { get { return m_position; } } - public bool IsSpecialVar { get { return m_isSpecialVar; } } - public TemplateInfoOnSematics SpecialVarType{ get { return m_specialVarType; } } - public MasterNodePortCategory Category { get { return m_category; } } - public string Id { get { return m_id; } } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateLocalVarData.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateLocalVarData.cs.meta deleted file mode 100644 index 267c3527..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateLocalVarData.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 4c6ad22d8633c7142ae0237479df76ed -timeCreated: 1518017743 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateLocalVarsNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateLocalVarsNode.cs deleted file mode 100644 index 85898210..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateLocalVarsNode.cs +++ /dev/null @@ -1,258 +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.Collections.Generic; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Template Local Var Data", "Surface Data", "Select and use available local variable data from the template" )] - public sealed class TemplateLocalVarsNode : TemplateNodeParent - { - private List<TemplateLocalVarData> m_localVarsData = null; - - [SerializeField] - private int m_currentDataIdx = -1; - - [SerializeField] - private string m_dataName = string.Empty; - - private string[] m_dataLabels = null; - - private bool m_fetchDataId = false; - private UpperLeftWidgetHelper m_upperLeftWidgetHelper = new UpperLeftWidgetHelper(); - - void FetchDataId() - { - if( m_localVarsData != null && m_localVarsData.Count > 0 ) - { - m_currentDataIdx = 0; - int count = m_localVarsData.Count; - m_dataLabels = new string[ count ]; - for( int i = 0; i < count; i++ ) - { - m_dataLabels[ i ] = m_localVarsData[ i ].LocalVarName; - if( m_localVarsData[ i ].LocalVarName.Equals( m_dataName ) ) - { - m_currentDataIdx = i; - } - } - UpdateFromId(); - } - else - { - m_currentDataIdx = -1; - } - } - - void UpdateFromId() - { - if( m_localVarsData != null ) - { - if( m_localVarsData.Count == 0 ) - { - for( int i = 0; i < 4; i++ ) - m_containerGraph.DeleteConnection( false, UniqueId, i, false, true ); - - m_headerColor = UIUtils.GetColorFromCategory( "Default" ); - m_content.text = "None"; - m_additionalContent.text = string.Empty; - m_outputPorts[ 0 ].ChangeProperties( "None", WirePortDataType.OBJECT, false ); - ConfigurePorts(); - return; - } - - bool areCompatible = TemplateHelperFunctions.CheckIfCompatibles( m_outputPorts[ 0 ].DataType, m_localVarsData[ m_currentDataIdx ].DataType ); - string category = m_localVarsData[ m_currentDataIdx ].Category == MasterNodePortCategory.Fragment ? "Surface Data" : "Vertex Data"; - m_headerColor = UIUtils.GetColorFromCategory( category ); - switch( m_localVarsData[ m_currentDataIdx ].DataType ) - { - default: - case WirePortDataType.INT: - case WirePortDataType.FLOAT: - m_outputPorts[ 0 ].ChangeProperties( Constants.EmptyPortValue, m_localVarsData[ m_currentDataIdx ].DataType, false ); - break; - case WirePortDataType.FLOAT2: - m_outputPorts[ 0 ].ChangeProperties( "XY", m_localVarsData[ m_currentDataIdx ].DataType, false ); - break; - case WirePortDataType.FLOAT3: - m_outputPorts[ 0 ].ChangeProperties( "XYZ", m_localVarsData[ m_currentDataIdx ].DataType, false ); - break; - case WirePortDataType.FLOAT4: - m_outputPorts[ 0 ].ChangeProperties( "XYZW", m_localVarsData[ m_currentDataIdx ].DataType, false ); - break; - case WirePortDataType.COLOR: - m_outputPorts[ 0 ].ChangeProperties( "RGBA", m_localVarsData[ m_currentDataIdx ].DataType, false ); - break; - } - - ConfigurePorts(); - - if( !areCompatible ) - { - m_containerGraph.DeleteConnection( false, UniqueId, 0, false, true ); - } - - m_dataName = m_localVarsData[ m_currentDataIdx ].LocalVarName; - m_content.text = m_dataName; - m_sizeIsDirty = true; - CheckWarningState(); - } - } - - public override void DrawProperties() - { - base.DrawProperties(); - if( m_multiPassMode ) - { - DrawMultipassProperties(); - } - - if( m_currentDataIdx > -1 ) - { - EditorGUI.BeginChangeCheck(); - m_currentDataIdx = EditorGUILayoutPopup( DataLabelStr, m_currentDataIdx, m_dataLabels ); - if( EditorGUI.EndChangeCheck() ) - { - UpdateFromId(); - } - } - } - protected override void OnSubShaderChange() - { - FetchLocalVarData(); - FetchDataId(); - } - - protected override void OnPassChange() - { - base.OnPassChange(); - FetchLocalVarData(); - FetchDataId(); - } - - void DrawMultipassProperties() - { - DrawSubShaderUI(); - DrawPassUI(); - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - if( m_containerGraph.CurrentCanvasMode != NodeAvailability.TemplateShader ) - return; - - if( m_localVarsData == null || m_localVarsData.Count == 0 ) - { - MasterNode masterNode = m_containerGraph.CurrentMasterNode; - if( masterNode.CurrentMasterNodeCategory == AvailableShaderTypes.Template ) - { - FetchLocalVarData( masterNode ); - } - } - - if( m_fetchDataId ) - { - m_fetchDataId = false; - FetchDataId(); - } - - if( m_currentDataIdx > -1 ) - { - EditorGUI.BeginChangeCheck(); - m_currentDataIdx = m_upperLeftWidgetHelper.DrawWidget( this, m_currentDataIdx, m_dataLabels ); - if( EditorGUI.EndChangeCheck() ) - { - UpdateFromId(); - } - } - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if( m_localVarsData[ m_currentDataIdx ].Category != dataCollector.PortCategory ) - { - UIUtils.ShowMessage( UniqueId, string.Format( "Local Var {0} can only work on ports of type {1}", m_localVarsData[ m_currentDataIdx ].LocalVarName, m_localVarsData[ m_currentDataIdx ].Category ) ); - return m_outputPorts[ 0 ].ErrorValue; - } - - if( m_multiPassMode ) - { - if( dataCollector.TemplateDataCollectorInstance.MultipassSubshaderIdx != SubShaderIdx || - dataCollector.TemplateDataCollectorInstance.MultipassPassIdx != PassIdx - ) - { - UIUtils.ShowMessage( UniqueId, string.Format( "{0} is only intended for subshader {1} and pass {2}", m_dataLabels[ m_currentDataIdx ], SubShaderIdx, PassIdx ) ); - return m_outputPorts[ outputId ].ErrorValue; - } - } - - return GetOutputVectorItem( 0, outputId, m_dataName ); - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - m_dataName = GetCurrentParam( ref nodeParams ); - m_fetchDataId = true; - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_dataName ); - } - - public override void OnMasterNodeReplaced( MasterNode newMasterNode ) - { - base.OnMasterNodeReplaced( newMasterNode ); - if( newMasterNode.CurrentMasterNodeCategory == AvailableShaderTypes.Template ) - { - FetchLocalVarData( newMasterNode ); - } - else - { - m_localVarsData = null; - m_currentDataIdx = -1; - } - } - - void FetchLocalVarData( MasterNode masterNode = null ) - { - FetchMultiPassTemplate( masterNode ); - if( m_multiPassMode ) - { - if( m_templateMPData != null ) - { - m_localVarsData = m_templateMPData.SubShaders[ SubShaderIdx ].Passes[ PassIdx ].LocalVarsList; - m_fetchDataId = true; - } - } - else - { - TemplateData currentTemplate = ( masterNode as TemplateMasterNode ).CurrentTemplate; - if( currentTemplate != null ) - { - m_localVarsData = currentTemplate.LocalVarsList; - m_fetchDataId = true; - } - else - { - m_localVarsData = null; - m_currentDataIdx = -1; - } - } - } - - public override void Destroy() - { - base.Destroy(); - m_dataLabels = null; - m_localVarsData = null; - m_upperLeftWidgetHelper = null; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateLocalVarsNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateLocalVarsNode.cs.meta deleted file mode 100644 index f7453d99..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateLocalVarsNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: f708a5bf672ab004a9363a4a71f48f28 -timeCreated: 1518104790 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMasterNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMasterNode.cs deleted file mode 100644 index 6d6c1de9..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMasterNode.cs +++ /dev/null @@ -1,750 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -// THIS FILE IS DEPRECATED AND SHOULD NOT BE USED - -#define SHOW_TEMPLATE_HELP_BOX - -using System; -using System.Collections.Generic; -using UnityEngine; -using UnityEditor; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Template Master Node", "Master", "Shader Generated according to template rules", null, KeyCode.None, false, true, "Template MultiPass Master Node", typeof( TemplateMultiPassMasterNode ) )] - public sealed class TemplateMasterNode : MasterNode - { - private const string WarningMessage = "Templates is a feature that is still heavily under development and users may experience some problems.\nPlease email support@amplify.pt if any issue occurs."; - private const string CurrentTemplateLabel = "Current Template"; - private const string OpenTemplateStr = "Edit Template"; - - //protected const string SnippetsFoldoutStr = " Snippets"; - //[SerializeField] - //private bool m_snippetsFoldout = true; - - [NonSerialized] - private TemplateData m_currentTemplate = null; - - private bool m_fireTemplateChange = false; - private bool m_fetchMasterNodeCategory = false; - private bool m_reRegisterTemplateData = false; - - [SerializeField] - private string m_templateGUID = string.Empty; - - [SerializeField] - private string m_templateName = string.Empty; - - [SerializeField] - private TemplatesBlendModule m_blendOpHelper = new TemplatesBlendModule(); - - [SerializeField] - private TemplateCullModeModule m_cullModeHelper = new TemplateCullModeModule(); - - [SerializeField] - private TemplateColorMaskModule m_colorMaskHelper = new TemplateColorMaskModule(); - - [SerializeField] - private TemplatesStencilBufferModule m_stencilBufferHelper = new TemplatesStencilBufferModule(); - - [SerializeField] - private TemplateDepthModule m_depthOphelper = new TemplateDepthModule(); - - [SerializeField] - private TemplateTagsModule m_tagsHelper = new TemplateTagsModule(); - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_masterNodeCategory = 1;// First Template - m_marginPreviewLeft = 20; - m_insideSize.y = 60; - m_customPrecision = true; - } - - public override void ReleaseResources() - { - if( m_currentTemplate != null && m_currentTemplate.AvailableShaderProperties != null ) - { - // Unregister old template properties - int oldPropertyCount = m_currentTemplate.AvailableShaderProperties.Count; - for( int i = 0; i < oldPropertyCount; i++ ) - { - UIUtils.ReleaseUniformName( UniqueId, m_currentTemplate.AvailableShaderProperties[ i ].PropertyName ); - } - } - } - - public override void OnEnable() - { - base.OnEnable(); - m_reRegisterTemplateData = true; - } - - void FetchInfoFromTemplate() - { - if( m_currentTemplate.BlendData.DataCheck == TemplateDataCheck.Valid ) - m_blendOpHelper.ConfigureFromTemplateData( m_currentTemplate.BlendData ); - - if( m_currentTemplate.CullModeData.DataCheck == TemplateDataCheck.Valid ) - m_cullModeHelper.ConfigureFromTemplateData( m_currentTemplate.CullModeData ); - - if( m_currentTemplate.ColorMaskData.DataCheck == TemplateDataCheck.Valid ) - m_colorMaskHelper.ConfigureFromTemplateData( m_currentTemplate.ColorMaskData ); - - if( m_currentTemplate.StencilData.DataCheck == TemplateDataCheck.Valid ) - m_stencilBufferHelper.ConfigureFromTemplateData( m_currentTemplate.StencilData ); - - if( m_currentTemplate.DepthData.DataCheck == TemplateDataCheck.Valid ) - m_depthOphelper.ConfigureFromTemplateData( m_currentTemplate.DepthData ); - - if( m_currentTemplate.TagData.DataCheck == TemplateDataCheck.Valid ) - m_tagsHelper.ConfigureFromTemplateData( m_currentTemplate.TagData ); - } - - void FetchCurrentTemplate() - { - m_currentTemplate = m_containerGraph.ParentWindow.TemplatesManagerInstance.GetTemplate( m_templateGUID ) as TemplateData; - if( m_currentTemplate == null ) - { - m_currentTemplate = m_containerGraph.ParentWindow.TemplatesManagerInstance.GetTemplate( m_templateName ) as TemplateData; - } - - if( m_currentTemplate != null ) - { - if( m_inputPorts.Count != m_currentTemplate.InputDataList.Count ) - { - DeleteAllInputConnections( true ); - - List<TemplateInputData> inputDataList = m_currentTemplate.InputDataList; - int count = inputDataList.Count; - for( int i = 0; i < count; i++ ) - { - AddInputPort( inputDataList[ i ].DataType, false, inputDataList[ i ].PortName, inputDataList[ i ].OrderId, inputDataList[ i ].PortCategory, inputDataList[ i ].PortUniqueId ); - } - FetchInfoFromTemplate(); - } - else - { - List<TemplateInputData> inputDataList = m_currentTemplate.InputDataList; - int count = inputDataList.Count; - for( int i = 0; i < count; i++ ) - { - m_inputPorts[ i ].ChangeProperties( inputDataList[ i ].PortName, inputDataList[ i ].DataType, false ); - } - } - } - } - - public override void RefreshAvailableCategories() - { - FetchCurrentTemplate(); - - int templateCount = m_containerGraph.ParentWindow.TemplatesManagerInstance.TemplateCount; - m_availableCategories = new MasterNodeCategoriesData[ templateCount + 1 ]; - m_availableCategoryLabels = new GUIContent[ templateCount + 1 ]; - - m_availableCategories[ 0 ] = new MasterNodeCategoriesData( AvailableShaderTypes.SurfaceShader, string.Empty ); - m_availableCategoryLabels[ 0 ] = new GUIContent( "Surface" ); - if( m_currentTemplate == null ) - { - m_masterNodeCategory = -1; - } - - for( int i = 0; i < templateCount; i++ ) - { - int idx = i + 1; - TemplateData templateData = m_containerGraph.ParentWindow.TemplatesManagerInstance.GetTemplate( i ) as TemplateData; - - if( m_currentTemplate != null && m_currentTemplate.GUID.Equals( templateData.GUID ) ) - m_masterNodeCategory = idx; - - m_availableCategories[ idx ] = new MasterNodeCategoriesData( AvailableShaderTypes.Template, templateData.GUID ); - m_availableCategoryLabels[ idx ] = new GUIContent( templateData.Name ); - } - } - - void SetCategoryIdxFromTemplate() - { - int templateCount = m_containerGraph.ParentWindow.TemplatesManagerInstance.TemplateCount; - for( int i = 0; i < templateCount; i++ ) - { - int idx = i + 1; - TemplateData templateData = m_containerGraph.ParentWindow.TemplatesManagerInstance.GetTemplate( i ) as TemplateData; - if( templateData != null && m_currentTemplate != null && m_currentTemplate.GUID.Equals( templateData.GUID ) ) - m_masterNodeCategory = idx; - } - } - - public void SetTemplate( TemplateData newTemplate, bool writeDefaultData, bool fetchMasterNodeCategory ) - { - ReleaseResources(); - - if( newTemplate == null || newTemplate.InputDataList == null ) - return; - - m_fetchMasterNodeCategory = fetchMasterNodeCategory; - - DeleteAllInputConnections( true ); - m_currentTemplate = newTemplate; - m_currentShaderData = newTemplate.Name; - - List<TemplateInputData> inputDataList = newTemplate.InputDataList; - int count = inputDataList.Count; - for( int i = 0; i < count; i++ ) - { - AddInputPort( inputDataList[ i ].DataType, false, inputDataList[ i ].PortName, inputDataList[ i ].OrderId, inputDataList[ i ].PortCategory, inputDataList[ i ].PortUniqueId ); - } - - if( writeDefaultData ) - { - ShaderName = newTemplate.DefaultShaderName; - } - - RegisterProperties(); - m_fireTemplateChange = true; - m_templateGUID = newTemplate.GUID; - m_templateName = newTemplate.DefaultShaderName; - FetchInfoFromTemplate(); - } - - void RegisterProperties() - { - if( m_currentTemplate != null ) - { - m_reRegisterTemplateData = false; - // Register old template properties - int newPropertyCount = m_currentTemplate.AvailableShaderProperties.Count; - for( int i = 0; i < newPropertyCount; i++ ) - { - int nodeId = UIUtils.CheckUniformNameOwner( m_currentTemplate.AvailableShaderProperties[ i ].PropertyName ); - if( nodeId > -1 ) - { - ParentNode node = m_containerGraph.GetNode( nodeId ); - if( node != null ) - { - UIUtils.ShowMessage( string.Format( "Template requires property name {0} which is currently being used by {1}. Please rename it and reload template.", m_currentTemplate.AvailableShaderProperties[ i ].PropertyName, node.Attributes.Name ) ); - } - else - { - UIUtils.ShowMessage( string.Format( "Template requires property name {0} which is currently being on your graph. Please rename it and reload template.", m_currentTemplate.AvailableShaderProperties[ i ].PropertyName ) ); - } - } - else - { - UIUtils.RegisterUniformName( UniqueId, m_currentTemplate.AvailableShaderProperties[ i ].PropertyName ); - } - } - } - } - - public override void DrawProperties() - { - if( m_currentTemplate == null ) - return; - - base.DrawProperties(); - - bool generalIsVisible = ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedGeneralShaderOptions; - NodeUtils.DrawPropertyGroup( ref generalIsVisible, GeneralFoldoutStr, DrawGeneralOptions ); - ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedGeneralShaderOptions = generalIsVisible; - if( m_currentTemplate.BlendData.DataCheck == TemplateDataCheck.Valid ) - m_blendOpHelper.Draw( this ); - - - if( m_currentTemplate.StencilData.DataCheck == TemplateDataCheck.Valid ) - { - CullMode cullMode = ( m_currentTemplate.CullModeData.DataCheck == TemplateDataCheck.Valid ) ? m_cullModeHelper.CurrentCullMode : CullMode.Back; - m_stencilBufferHelper.Draw( this, cullMode ); - } - - if( m_currentTemplate.DepthData.DataCheck == TemplateDataCheck.Valid ) - m_depthOphelper.Draw( this ); - - if( m_currentTemplate.TagData.DataCheck == TemplateDataCheck.Valid ) - m_tagsHelper.Draw( this ); - - DrawMaterialInputs( UIUtils.MenuItemToolbarStyle ); - - // NodeUtils.DrawPropertyGroup( ref m_snippetsFoldout, SnippetsFoldoutStr, DrawSnippetOptions ); - if( GUILayout.Button( OpenTemplateStr ) && m_currentTemplate != null ) - { - try - { - string pathname = AssetDatabase.GUIDToAssetPath( m_currentTemplate.GUID ); - if( !string.IsNullOrEmpty( pathname ) ) - { - Shader selectedTemplate = AssetDatabase.LoadAssetAtPath<Shader>( pathname ); - if( selectedTemplate != null ) - { - AssetDatabase.OpenAsset( selectedTemplate, 1 ); - } - } - } - catch( Exception e ) - { - Debug.LogException( e ); - } - } - -#if SHOW_TEMPLATE_HELP_BOX - EditorGUILayout.HelpBox( WarningMessage, MessageType.Warning ); -#endif - - } - - public void DrawGeneralOptions() - { - DrawShaderName(); - DrawCurrentShaderType(); - EditorGUI.BeginChangeCheck(); - DrawPrecisionProperty( false ); - if( EditorGUI.EndChangeCheck() ) - ContainerGraph.CurrentPrecision = m_currentPrecisionType; - - if( m_currentTemplate.CullModeData.DataCheck == TemplateDataCheck.Valid ) - m_cullModeHelper.Draw( this ); - - if( m_currentTemplate.ColorMaskData.DataCheck == TemplateDataCheck.Valid ) - m_colorMaskHelper.Draw( this ); - } - - //public void DrawSnippetOptions() - //{ - // m_currentTemplate.DrawSnippetProperties( this ); - //} - - bool CreateInstructionsForList( ref List<InputPort> ports, ref string shaderBody, ref List<string> vertexInstructions, ref List<string> fragmentInstructions ) - { - if( ports.Count == 0 ) - return true; - - bool isValid = true; - UIUtils.CurrentWindow.CurrentGraph.ResetNodesLocalVariables(); - for( int i = 0; i < ports.Count; i++ ) - { - TemplateInputData inputData = m_currentTemplate.InputDataFromId( ports[ i ].PortId ); - if( ports[ i ].IsConnected ) - { - m_currentDataCollector.ResetInstructions(); - m_currentDataCollector.ResetVertexInstructions(); - - m_currentDataCollector.PortCategory = ports[ i ].Category; - string newPortInstruction = ports[ i ].GeneratePortInstructions( ref m_currentDataCollector ); - - - if( m_currentDataCollector.DirtySpecialLocalVariables ) - { - string cleanVariables = m_currentDataCollector.SpecialLocalVariables.Replace( "\t", string.Empty ); - m_currentDataCollector.AddInstructions( cleanVariables, false ); - m_currentDataCollector.ClearSpecialLocalVariables(); - } - - if( m_currentDataCollector.DirtyVertexVariables ) - { - string cleanVariables = m_currentDataCollector.VertexLocalVariables.Replace( "\t", string.Empty ); - m_currentDataCollector.AddVertexInstruction( cleanVariables, UniqueId, false ); - m_currentDataCollector.ClearVertexLocalVariables(); - } - - // fill functions - for( int j = 0; j < m_currentDataCollector.InstructionsList.Count; j++ ) - { - fragmentInstructions.Add( m_currentDataCollector.InstructionsList[ j ].PropertyName ); - } - - for( int j = 0; j < m_currentDataCollector.VertexDataList.Count; j++ ) - { - vertexInstructions.Add( m_currentDataCollector.VertexDataList[ j ].PropertyName ); - } - - isValid = m_currentTemplate.FillTemplateBody( inputData.TagId, ref shaderBody, newPortInstruction ) && isValid; - } - else - { - isValid = m_currentTemplate.FillTemplateBody( inputData.TagId, ref shaderBody, inputData.DefaultValue ) && isValid; - } - } - return isValid; - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - - if( m_currentTemplate == null ) - { - FetchCurrentTemplate(); - } - - if( m_reRegisterTemplateData ) - { - RegisterProperties(); - } - - if( m_containerGraph.IsInstancedShader ) - { - DrawInstancedIcon( drawInfo ); - } - - if( m_fetchMasterNodeCategory ) - { - if( m_availableCategories != null ) - { - m_fetchMasterNodeCategory = false; - SetCategoryIdxFromTemplate(); - } - } - - if( m_fireTemplateChange ) - { - m_fireTemplateChange = false; - m_containerGraph.FireMasterNodeReplacedEvent(); - } - } - - public override void UpdateFromShader( Shader newShader ) - { - if( m_currentMaterial != null ) - { - m_currentMaterial.shader = newShader; - } - CurrentShader = newShader; - } - - public override void UpdateMasterNodeMaterial( Material material ) - { - m_currentMaterial = material; - FireMaterialChangedEvt(); - } - - public override Shader Execute( string pathname, bool isFullPath ) - { - if( m_currentTemplate == null ) - return m_currentShader; - - //Create data collector - ForceReordering(); - base.Execute( pathname, isFullPath ); - - SetupNodeCategories(); - - m_currentDataCollector.TemplateDataCollectorInstance.BuildFromTemplateData( m_currentDataCollector, m_currentTemplate ); - int shaderPropertiesAmount = m_currentTemplate.AvailableShaderProperties.Count; - for( int i = 0; i < shaderPropertiesAmount; i++ ) - { - m_currentDataCollector.SoftRegisterUniform( m_currentTemplate.AvailableShaderProperties[ i ] ); - } - m_containerGraph.CheckPropertiesAutoRegister( ref m_currentDataCollector ); - - //Sort ports by both - List<InputPort> fragmentPorts = new List<InputPort>(); - List<InputPort> vertexPorts = new List<InputPort>(); - SortInputPorts( ref vertexPorts, ref fragmentPorts ); - - string shaderBody = m_currentTemplate.TemplateBody; - - List<string> vertexInstructions = new List<string>(); - List<string> fragmentInstructions = new List<string>(); - - bool validBody = true; - - validBody = CreateInstructionsForList( ref fragmentPorts, ref shaderBody, ref vertexInstructions, ref fragmentInstructions ) && validBody; - ContainerGraph.ResetNodesLocalVariablesIfNot( MasterNodePortCategory.Vertex ); - validBody = CreateInstructionsForList( ref vertexPorts, ref shaderBody, ref vertexInstructions, ref fragmentInstructions ) && validBody; - - m_currentTemplate.ResetTemplateUsageData(); - - // Fill vertex interpolators assignment - for( int i = 0; i < m_currentDataCollector.VertexInterpDeclList.Count; i++ ) - { - vertexInstructions.Add( m_currentDataCollector.VertexInterpDeclList[ i ] ); - } - - vertexInstructions.AddRange( m_currentDataCollector.TemplateDataCollectorInstance.GetInterpUnusedChannels() ); - //Fill common local variables and operations - - validBody = m_currentTemplate.FillVertexInstructions( ref shaderBody, vertexInstructions.ToArray() ) && validBody; - validBody = m_currentTemplate.FillFragmentInstructions( ref shaderBody, fragmentInstructions.ToArray() ) && validBody; - - // Add Instanced Properties - if( m_containerGraph.IsInstancedShader ) - { - m_currentDataCollector.TabifyInstancedVars(); - m_currentDataCollector.InstancedPropertiesList.Insert( 0, new PropertyDataCollector( -1, string.Format( IOUtils.InstancedPropertiesBegin, UIUtils.RemoveInvalidCharacters( m_shaderName ) ) ) ); - m_currentDataCollector.InstancedPropertiesList.Add( new PropertyDataCollector( -1, IOUtils.InstancedPropertiesEnd ) ); - m_currentDataCollector.UniformsList.AddRange( m_currentDataCollector.InstancedPropertiesList ); - } - - //Add Functions - m_currentDataCollector.UniformsList.AddRange( m_currentDataCollector.FunctionsList ); - - // Fill common tags - m_currentDataCollector.IncludesList.AddRange( m_currentDataCollector.PragmasList ); - - validBody = m_currentTemplate.FillTemplateBody( m_currentTemplate.ShaderNameId, ref shaderBody, string.Format( TemplatesManager.NameFormatter, m_shaderName ) ) && validBody; - validBody = m_currentTemplate.FillTemplateBody( TemplatesManager.TemplatePassTag, ref shaderBody, m_currentDataCollector.GrabPassList ) && validBody; - validBody = m_currentTemplate.FillTemplateBody( TemplatesManager.TemplatePragmaTag, ref shaderBody, m_currentDataCollector.IncludesList ) && validBody; - //validBody = m_currentTemplate.FillTemplateBody( TemplatesManager.TemplateTagsTag, ref shaderBody, m_currentDataCollector.TagsList ) && validBody; - validBody = m_currentTemplate.FillTemplateBody( TemplatesManager.TemplatePropertyTag, ref shaderBody, m_currentDataCollector.BuildUnformatedPropertiesStringArr() ) && validBody; - validBody = m_currentTemplate.FillTemplateBody( TemplatesManager.TemplateGlobalsTag, ref shaderBody, m_currentDataCollector.UniformsList ) && validBody; - validBody = m_currentTemplate.FillTemplateBody( m_currentTemplate.VertexDataId, ref shaderBody, m_currentDataCollector.VertexInputList.ToArray() ) && validBody; - validBody = m_currentTemplate.FillTemplateBody( m_currentTemplate.InterpDataId, ref shaderBody, m_currentDataCollector.InterpolatorList.ToArray() ) && validBody; - - if( m_currentTemplate.BlendData.ValidBlendMode ) - { - validBody = m_currentTemplate.FillTemplateBody( m_currentTemplate.BlendData.BlendModeId, ref shaderBody, m_blendOpHelper.CurrentBlendFactor ) && validBody; - } - - if( m_currentTemplate.BlendData.ValidBlendOp ) - { - validBody = m_currentTemplate.FillTemplateBody( m_currentTemplate.BlendData.BlendOpId, ref shaderBody, m_blendOpHelper.CurrentBlendOp ) && validBody; - } - - if( m_currentTemplate.BlendData.ValidAlphaToMask ) - { - validBody = m_currentTemplate.FillTemplateBody( m_currentTemplate.BlendData.AlphaToMaskId, ref shaderBody, m_blendOpHelper.CurrentAlphaToMask ) && validBody; - } - - if( m_currentTemplate.DepthData.ValidZWrite ) - { - validBody = m_currentTemplate.FillTemplateBody( m_currentTemplate.DepthData.ZWriteModeId, ref shaderBody, m_depthOphelper.CurrentZWriteMode ) && validBody; - } - - if( m_currentTemplate.DepthData.ValidZTest ) - { - validBody = m_currentTemplate.FillTemplateBody( m_currentTemplate.DepthData.ZTestModeId, ref shaderBody, m_depthOphelper.CurrentZTestMode ) && validBody; - } - - if( m_currentTemplate.DepthData.ValidOffset ) - { - validBody = m_currentTemplate.FillTemplateBody( m_currentTemplate.DepthData.OffsetId, ref shaderBody, m_depthOphelper.CurrentOffset ) && validBody; - } - - if( m_currentTemplate.CullModeData.DataCheck == TemplateDataCheck.Valid ) - { - validBody = m_currentTemplate.FillTemplateBody( m_currentTemplate.CullModeData.CullModeId, ref shaderBody, m_cullModeHelper.GenerateShaderData(false) ) && validBody; - } - - if( m_currentTemplate.ColorMaskData.DataCheck == TemplateDataCheck.Valid ) - { - validBody = m_currentTemplate.FillTemplateBody( m_currentTemplate.ColorMaskData.ColorMaskId, ref shaderBody, m_colorMaskHelper.GenerateShaderData( false ) ) && validBody; - } - - if( m_currentTemplate.StencilData.DataCheck == TemplateDataCheck.Valid ) - { - CullMode cullMode = ( m_currentTemplate.CullModeData.DataCheck == TemplateDataCheck.Valid ) ? m_cullModeHelper.CurrentCullMode : CullMode.Back; - validBody = m_currentTemplate.FillTemplateBody( m_currentTemplate.StencilData.StencilBufferId, ref shaderBody, m_stencilBufferHelper.CreateStencilOp( cullMode ) ) && validBody; - } - - if( m_currentTemplate.TagData.DataCheck == TemplateDataCheck.Valid ) - { - validBody = m_currentTemplate.FillTemplateBody( m_currentTemplate.TagData.TagsId, ref shaderBody, m_tagsHelper.GenerateTags() ) && validBody; - } - - if( m_currentDataCollector.TemplateDataCollectorInstance.HasVertexInputParams ) - { - validBody = m_currentTemplate.FillTemplateBody( TemplatesManager.TemplateInputsVertParamsTag, ref shaderBody, m_currentDataCollector.TemplateDataCollectorInstance.VertexInputParamsStr ) && validBody; - } - - if( m_currentDataCollector.TemplateDataCollectorInstance.HasFragmentInputParams ) - { - validBody = m_currentTemplate.FillTemplateBody( TemplatesManager.TemplateInputsFragParamsTag, ref shaderBody, m_currentDataCollector.TemplateDataCollectorInstance.FragInputParamsStr ) && validBody; - } - - m_currentTemplate.FillEmptyTags( ref shaderBody ); - - //m_currentTemplate.InsertSnippets( ref shaderBody ); - - vertexInstructions.Clear(); - vertexInstructions = null; - - fragmentInstructions.Clear(); - fragmentInstructions = null; - if( validBody ) - { - UpdateShaderAsset( ref pathname, ref shaderBody, isFullPath ); - } - - return m_currentShader; - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - try - { - ShaderName = GetCurrentParam( ref nodeParams ); - if( m_shaderName.Length > 0 ) - ShaderName = UIUtils.RemoveShaderInvalidCharacters( ShaderName ); - - string templateGUID = GetCurrentParam( ref nodeParams ); - string templateShaderName = string.Empty; - if( UIUtils.CurrentShaderVersion() > 13601 ) - { - templateShaderName = GetCurrentParam( ref nodeParams ); - } - - TemplateData template = m_containerGraph.ParentWindow.TemplatesManagerInstance.GetTemplate( templateGUID ) as TemplateData; - if( template != null ) - { - SetTemplate( template, false, true ); - } - else - { - template = m_containerGraph.ParentWindow.TemplatesManagerInstance.GetTemplateByName( templateShaderName ) as TemplateData; - if( template != null ) - { - SetTemplate( template, false, true ); - } - else - { - m_masterNodeCategory = -1; - } - } - - if( UIUtils.CurrentShaderVersion() > 13902 ) - { - //BLEND MODULE - if( m_currentTemplate.BlendData.ValidBlendMode ) - { - m_blendOpHelper.ReadBlendModeFromString( ref m_currentReadParamIdx, ref nodeParams ); - } - - if( m_currentTemplate.BlendData.ValidBlendOp ) - { - m_blendOpHelper.ReadBlendOpFromString( ref m_currentReadParamIdx, ref nodeParams ); - } - - //CULL MODE - if( m_currentTemplate.CullModeData.DataCheck == TemplateDataCheck.Valid ) - { - m_cullModeHelper.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); - } - - //COLOR MASK - if( m_currentTemplate.ColorMaskData.DataCheck == TemplateDataCheck.Valid ) - { - m_colorMaskHelper.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); - } - - //STENCIL BUFFER - if( m_currentTemplate.StencilData.DataCheck == TemplateDataCheck.Valid ) - { - m_stencilBufferHelper.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); - } - } - - if( UIUtils.CurrentShaderVersion() > 14202 ) - { - //DEPTH OPTIONS - if( m_currentTemplate.DepthData.ValidZWrite ) - { - m_depthOphelper.ReadZWriteFromString( ref m_currentReadParamIdx, ref nodeParams ); - } - - if( m_currentTemplate.DepthData.ValidZTest ) - { - m_depthOphelper.ReadZTestFromString( ref m_currentReadParamIdx, ref nodeParams ); - } - - if( m_currentTemplate.DepthData.ValidOffset ) - { - m_depthOphelper.ReadOffsetFromString( ref m_currentReadParamIdx, ref nodeParams ); - } - } - - //TAGS - if( UIUtils.CurrentShaderVersion() > 14301 ) - { - if( m_currentTemplate.TagData.DataCheck == TemplateDataCheck.Valid ) - m_tagsHelper.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); - } - } - catch( Exception e ) - { - Debug.LogException( e, this ); - } - m_containerGraph.CurrentCanvasMode = NodeAvailability.TemplateShader; - m_containerGraph.CurrentPrecision = m_currentPrecisionType; - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_shaderName ); - IOUtils.AddFieldValueToString( ref nodeInfo, ( m_currentTemplate != null ) ? m_currentTemplate.GUID : string.Empty ); - IOUtils.AddFieldValueToString( ref nodeInfo, ( m_currentTemplate != null ) ? m_currentTemplate.DefaultShaderName : string.Empty ); - - //BLEND MODULE - if( m_currentTemplate.BlendData.ValidBlendMode ) - { - m_blendOpHelper.WriteBlendModeToString( ref nodeInfo ); - } - - if( m_currentTemplate.BlendData.ValidBlendOp ) - { - m_blendOpHelper.WriteBlendOpToString( ref nodeInfo ); - } - - //CULL MODULE - if( m_currentTemplate.CullModeData.DataCheck == TemplateDataCheck.Valid ) - { - m_cullModeHelper.WriteToString( ref nodeInfo ); - } - - //COLOR MASK MODULE - if( m_currentTemplate.ColorMaskData.DataCheck == TemplateDataCheck.Valid ) - { - m_colorMaskHelper.WriteToString( ref nodeInfo ); - } - - //STENCIL BUFFER MODULE - if( m_currentTemplate.StencilData.DataCheck == TemplateDataCheck.Valid ) - { - m_stencilBufferHelper.WriteToString( ref nodeInfo ); - } - - //DEPTH MODULE - if( m_currentTemplate.DepthData.ValidZWrite ) - { - m_depthOphelper.WriteZWriteToString( ref nodeInfo ); - } - - if( m_currentTemplate.DepthData.ValidZTest ) - { - m_depthOphelper.WriteZTestToString( ref nodeInfo ); - } - - if( m_currentTemplate.DepthData.ValidOffset ) - { - m_depthOphelper.WriteOffsetToString( ref nodeInfo ); - } - - //TAGS - if( m_currentTemplate.TagData.DataCheck == TemplateDataCheck.Valid ) - { - m_tagsHelper.WriteToString( ref nodeInfo ); - } - } - - public override void Destroy() - { - base.Destroy(); - m_currentTemplate = null; - m_blendOpHelper = null; - m_cullModeHelper = null; - m_colorMaskHelper.Destroy(); - m_colorMaskHelper = null; - m_stencilBufferHelper.Destroy(); - m_stencilBufferHelper = null; - m_tagsHelper.Destroy(); - m_tagsHelper = null; - - } - - public TemplateData CurrentTemplate { get { return m_currentTemplate; } } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMasterNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMasterNode.cs.meta deleted file mode 100644 index b17058f3..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMasterNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 8bbd856408a816448a2686501df37397 -timeCreated: 1493905112 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMenuItems.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMenuItems.cs deleted file mode 100644 index 920dc274..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMenuItems.cs +++ /dev/null @@ -1,50 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> -using UnityEditor; - -namespace AmplifyShaderEditor -{ - public class TemplateMenuItems - { - [MenuItem( "Assets/Create/Amplify Shader/Legacy/Unlit", false, 85 )] - public static void ApplyTemplateLegacyUnlit() - { - AmplifyShaderEditorWindow.CreateConfirmationTemplateShader( "0770190933193b94aaa3065e307002fa" ); - } - [MenuItem( "Assets/Create/Amplify Shader/Legacy/Post Process", false, 85 )] - public static void ApplyTemplateLegacyPostProcess() - { - AmplifyShaderEditorWindow.CreateConfirmationTemplateShader( "c71b220b631b6344493ea3cf87110c93" ); - } - [MenuItem( "Assets/Create/Amplify Shader/Deprecated/Legacy/Default Unlit", false, 85 )] - public static void ApplyTemplateDeprecatedLegacyDefaultUnlit() - { - AmplifyShaderEditorWindow.CreateConfirmationTemplateShader( "6e114a916ca3e4b4bb51972669d463bf" ); - } - [MenuItem( "Assets/Create/Amplify Shader/Legacy/Default UI", false, 85 )] - public static void ApplyTemplateLegacyDefaultUI() - { - AmplifyShaderEditorWindow.CreateConfirmationTemplateShader( "5056123faa0c79b47ab6ad7e8bf059a4" ); - } - [MenuItem( "Assets/Create/Amplify Shader/Legacy/Unlit Lightmap", false, 85 )] - public static void ApplyTemplateLegacyUnlitLightmap() - { - AmplifyShaderEditorWindow.CreateConfirmationTemplateShader( "899e609c083c74c4ca567477c39edef0" ); - } - [MenuItem( "Assets/Create/Amplify Shader/Legacy/Default Sprites", false, 85 )] - public static void ApplyTemplateLegacyDefaultSprites() - { - AmplifyShaderEditorWindow.CreateConfirmationTemplateShader( "0f8ba0101102bb14ebf021ddadce9b49" ); - } - [MenuItem( "Assets/Create/Amplify Shader/Legacy/Particles Alpha Blended", false, 85 )] - public static void ApplyTemplateLegacyParticlesAlphaBlended() - { - AmplifyShaderEditorWindow.CreateConfirmationTemplateShader( "0b6a9f8b4f707c74ca64c0be8e590de0" ); - } - [MenuItem( "Assets/Create/Amplify Shader/Legacy/Multi Pass Unlit", false, 85 )] - public static void ApplyTemplateLegacyMultiPassUnlit() - { - AmplifyShaderEditorWindow.CreateConfirmationTemplateShader( "e1de45c0d41f68c41b2cc20c8b9c05ef" ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMenuItems.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMenuItems.cs.meta deleted file mode 100644 index 69a390bc..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMenuItems.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: da0b931bd234a1e43b65f684d4b59bfb -timeCreated: 1496736284 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateModuleHelper.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateModuleHelper.cs deleted file mode 100644 index 147fee0b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateModuleHelper.cs +++ /dev/null @@ -1,497 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using UnityEngine; - -namespace AmplifyShaderEditor -{ - - [Serializable] - public class TemplateModulesHelper - { - [SerializeField] - internal bool Foldout = false; - - private bool m_isDirty = false; - - [SerializeField] - private TemplatesBlendModule m_blendOpHelper = new TemplatesBlendModule(); - - [SerializeField] - private TemplateCullModeModule m_cullModeHelper = new TemplateCullModeModule(); - - [SerializeField] - private TemplateColorMaskModule m_colorMaskHelper = new TemplateColorMaskModule(); - - [SerializeField] - private TemplatesStencilBufferModule m_stencilBufferHelper = new TemplatesStencilBufferModule(); - - [SerializeField] - private TemplateDepthModule m_depthOphelper = new TemplateDepthModule(); - - [SerializeField] - private TemplateTagsModule m_tagsHelper = new TemplateTagsModule(); - - [SerializeField] - private TemplateShaderModelModule m_shaderModelHelper = new TemplateShaderModelModule(); - - [SerializeField] - private TemplateAdditionalIncludesHelper m_additionalIncludes = new TemplateAdditionalIncludesHelper(); - - [SerializeField] - private TemplateAdditionalDefinesHelper m_additionalDefines = new TemplateAdditionalDefinesHelper(); - - [SerializeField] - private TemplateAdditionalPragmasHelper m_additionalPragmas = new TemplateAdditionalPragmasHelper(); - - [SerializeField] - private TemplateAdditionalDirectivesHelper m_additionalDirectives = new TemplateAdditionalDirectivesHelper(" Additional Directives"); - - [SerializeField] - private bool m_hasValidData = false; - - [SerializeField] - private bool m_allModulesMode = false; - - public void CopyFrom( TemplateModulesHelper other ) - { - m_allModulesMode = other.AllModulesMode; - - if( other.BlendOpHelper.IsDirty ) - { - m_blendOpHelper.CopyFrom( other.BlendOpHelper, true ); - } - - if( other.CullModeHelper.IsDirty ) - { - m_cullModeHelper.CopyFrom( other.CullModeHelper , true ); - } - - if( other.ColorMaskHelper.IsDirty ) - { - m_colorMaskHelper.CopyFrom( other.ColorMaskHelper , true); - } - - if( other.StencilBufferHelper.IsDirty ) - { - m_stencilBufferHelper.CopyFrom( other.StencilBufferHelper,true ); - } - - if( other.DepthOphelper.IsDirty ) - { - m_depthOphelper.CopyFrom( other.DepthOphelper,true ); - } - - if( other.TagsHelper.IsDirty ) - { - m_tagsHelper.CopyFrom( other.TagsHelper ); - } - - if( other.ShaderModelHelper.IsDirty ) - { - m_shaderModelHelper.CopyFrom( other.ShaderModelHelper, true ); - } - } - - public void SyncWith( TemplateModulesHelper other ) - { - - if( m_blendOpHelper.ValidData && other.BlendOpHelper.ValidData ) - { - m_blendOpHelper.CopyFrom( other.BlendOpHelper, false ); - } - - if( m_cullModeHelper.ValidData && other.CullModeHelper.ValidData ) - { - m_cullModeHelper.CopyFrom( other.CullModeHelper, false ); - } - - if( m_colorMaskHelper.ValidData && other.ColorMaskHelper.ValidData ) - { - m_colorMaskHelper.CopyFrom( other.ColorMaskHelper , false ); - } - - if( m_stencilBufferHelper.ValidData && other.StencilBufferHelper.ValidData ) - { - m_stencilBufferHelper.CopyFrom( other.StencilBufferHelper, false ); - } - - if( m_depthOphelper.ValidData && other.DepthOphelper.ValidData ) - { - m_depthOphelper.CopyFrom( other.DepthOphelper, false ); - } - - if( m_shaderModelHelper.ValidData && other.ShaderModelHelper.ValidData ) - { - m_shaderModelHelper.CopyFrom( other.ShaderModelHelper , false); - } - } - - public void FetchDataFromTemplate( TemplateModulesData module ) - { - m_allModulesMode = module.AllModulesMode; - - if( module.PragmaTag.IsValid ) - { - m_hasValidData = true; - //m_additionalPragmas.IsValid = true; - //m_additionalPragmas.FillNativeItems( module.IncludePragmaContainer.PragmasList ); - - //m_additionalIncludes.IsValid = true; - //m_additionalIncludes.FillNativeItems( module.IncludePragmaContainer.IncludesList ); - - //m_additionalDefines.IsValid = true; - //m_additionalDefines.FillNativeItems( module.IncludePragmaContainer.DefinesList ); - - m_additionalDirectives.FillNativeItems( module.IncludePragmaContainer.NativeDirectivesList ); - m_additionalDirectives.IsValid = true; - } - else - { - //m_additionalPragmas.IsValid = false; - //m_additionalIncludes.IsValid = false; - //m_additionalDefines.IsValid = false; - m_additionalDirectives.IsValid = false; - } - - m_blendOpHelper.ConfigureFromTemplateData( module.BlendData ); - if( module.BlendData.DataCheck == TemplateDataCheck.Valid ) - { - m_hasValidData = true; - } - - m_cullModeHelper.ConfigureFromTemplateData( module.CullModeData ); - if( module.CullModeData.DataCheck == TemplateDataCheck.Valid ) - { - m_hasValidData = true; - } - - m_colorMaskHelper.ConfigureFromTemplateData( module.ColorMaskData ); - if( module.ColorMaskData.DataCheck == TemplateDataCheck.Valid ) - { - m_hasValidData = true; - } - - m_stencilBufferHelper.ConfigureFromTemplateData( module.StencilData ); - if( module.StencilData.DataCheck == TemplateDataCheck.Valid ) - { - m_hasValidData = true; - } - - m_depthOphelper.ConfigureFromTemplateData( module.DepthData ); - if( module.DepthData.DataCheck == TemplateDataCheck.Valid ) - { - m_hasValidData = true; - } - - m_tagsHelper.ConfigureFromTemplateData( module.TagData ); - if( module.TagData.DataCheck == TemplateDataCheck.Valid ) - { - m_hasValidData = true; - } - - m_shaderModelHelper.ConfigureFromTemplateData( module.ShaderModel ); - if( module.ShaderModel.DataCheck == TemplateDataCheck.Valid ) - { - m_hasValidData = true; - } - } - - public void OnLogicUpdate( TemplateModulesData currentModule ) - { - if( currentModule.TagData.DataCheck == TemplateDataCheck.Valid ) - m_tagsHelper.OnLogicUpdate(); - } - - public void Draw( ParentNode owner, TemplateModulesData currentModule , TemplateModulesHelper parent = null ) - { - if( currentModule.ShaderModel.DataCheck == TemplateDataCheck.Valid ) - m_shaderModelHelper.Draw( owner ); - - m_isDirty = m_shaderModelHelper.IsDirty; - - if( currentModule.CullModeData.DataCheck == TemplateDataCheck.Valid ) - m_cullModeHelper.Draw( owner ); - - m_isDirty = m_isDirty || m_cullModeHelper.IsDirty; - - if( currentModule.ColorMaskData.DataCheck == TemplateDataCheck.Valid ) - m_colorMaskHelper.Draw( owner ); - - m_isDirty = m_isDirty || m_colorMaskHelper.IsDirty; - - if( currentModule.DepthData.DataCheck == TemplateDataCheck.Valid ) - m_depthOphelper.Draw( owner, false ); - - m_isDirty = m_isDirty || m_depthOphelper.IsDirty; - - if( currentModule.BlendData.DataCheck == TemplateDataCheck.Valid ) - m_blendOpHelper.Draw( owner, false ); - - m_isDirty = m_isDirty || m_blendOpHelper.IsDirty; - - - if( currentModule.StencilData.DataCheck == TemplateDataCheck.Valid ) - { - CullMode cullMode = CullMode.Back; - if( currentModule.CullModeData.DataCheck == TemplateDataCheck.Valid ) - { - cullMode = m_cullModeHelper.CurrentCullMode; - } - else if( parent != null && parent.CullModeHelper.ValidData ) - { - cullMode = parent.CullModeHelper.CurrentCullMode; - } - m_stencilBufferHelper.Draw( owner, cullMode, false ); - } - - m_isDirty = m_isDirty || m_stencilBufferHelper.IsDirty; - - if( currentModule.TagData.DataCheck == TemplateDataCheck.Valid ) - m_tagsHelper.Draw( owner, false ); - - m_isDirty = m_isDirty || m_tagsHelper.IsDirty; - - if( currentModule.PragmaTag.IsValid ) - { - //m_additionalDefines.Draw( owner ); - //m_additionalIncludes.Draw( owner ); - //m_additionalPragmas.Draw( owner ); - m_additionalDirectives.Draw( owner , false); - } - - m_isDirty = m_isDirty || - //m_additionalDefines.IsDirty || - //m_additionalIncludes.IsDirty || - //m_additionalPragmas.IsDirty || - m_additionalDirectives.IsDirty; - } - - public void Destroy() - { - m_shaderModelHelper = null; - m_blendOpHelper = null; - m_cullModeHelper = null; - m_colorMaskHelper.Destroy(); - m_colorMaskHelper = null; - m_stencilBufferHelper.Destroy(); - m_stencilBufferHelper = null; - m_tagsHelper.Destroy(); - m_tagsHelper = null; - m_additionalDefines.Destroy(); - m_additionalDefines = null; - m_additionalIncludes.Destroy(); - m_additionalIncludes = null; - m_additionalPragmas.Destroy(); - m_additionalPragmas = null; - m_additionalDirectives.Destroy(); - m_additionalDirectives = null; - } - - public string GenerateAllModulesString( bool isSubShader ) - { - string moduleBody = string.Empty; - if( !ShaderModelHelper.IndependentModule ) - { - moduleBody += ShaderModelHelper.GenerateShaderData( isSubShader ) + "\n"; - } - - if( !BlendOpHelper.IndependentModule ) - { - if( BlendOpHelper.BlendModeEnabled ) - moduleBody += BlendOpHelper.CurrentBlendFactor + "\n"; - - if( BlendOpHelper.BlendOpActive ) - moduleBody += BlendOpHelper.CurrentBlendOp + "\n"; - - } - - if( !BlendOpHelper.AlphaToMaskIndependent ) - { - if( BlendOpHelper.ValidAlphaToMask && BlendOpHelper.AlphaToMaskValue ) - moduleBody += BlendOpHelper.CurrentAlphaToMask + "\n"; - } - - if( !CullModeHelper.IndependentModule ) - moduleBody += CullModeHelper.GenerateShaderData( isSubShader ) + "\n"; - - if( !ColorMaskHelper.IndependentModule ) - moduleBody += ColorMaskHelper.GenerateShaderData( isSubShader ) + "\n"; - - if( !DepthOphelper.IndependentModule ) - { - moduleBody += DepthOphelper.CurrentZWriteMode; - moduleBody += DepthOphelper.CurrentZTestMode; - if( DepthOphelper.OffsetEnabled ) - moduleBody += DepthOphelper.CurrentOffset; - } - - if( !StencilBufferHelper.IndependentModule && StencilBufferHelper.Active ) - { - CullMode cullMode = ( CullModeHelper.ValidData ) ? CullModeHelper.CurrentCullMode : CullMode.Back; - moduleBody += StencilBufferHelper.CreateStencilOp( cullMode ); - } - - return moduleBody; - } - - public void ReadFromString( ref uint index, ref string[] nodeParams ) - { - try - { - m_blendOpHelper.ReadFromString( ref index, ref nodeParams ); - } - catch( Exception e ) - { - Debug.LogException( e ); - } - try - { - m_cullModeHelper.ReadFromString( ref index, ref nodeParams ); - } - catch( Exception e ) - { - Debug.LogException( e ); - } - try - { - m_colorMaskHelper.ReadFromString( ref index, ref nodeParams ); - } - catch( Exception e ) - { - Debug.LogException( e ); - } - try - { - m_stencilBufferHelper.ReadFromString( ref index, ref nodeParams ); - } - catch( Exception e ) - { - Debug.LogException( e ); - } - try - { - m_depthOphelper.ReadFromString( ref index, ref nodeParams ); - } - catch( Exception e ) - { - Debug.LogException( e ); - } - try - { - m_tagsHelper.ReadFromString( ref index, ref nodeParams ); - } - catch( Exception e ) - { - Debug.LogException( e ); - } - try - { - m_shaderModelHelper.ReadFromString( ref index, ref nodeParams ); - } - catch( Exception e ) - { - Debug.LogException( e ); - } - - - if( UIUtils.CurrentShaderVersion() < 15312 ) - { - try - { - m_additionalDefines.ReadFromString( ref index, ref nodeParams ); - } - catch( Exception e ) - { - Debug.LogException( e ); - } - try - { - m_additionalPragmas.ReadFromString( ref index, ref nodeParams ); - } - catch( Exception e ) - { - Debug.LogException( e ); - } - try - { - m_additionalIncludes.ReadFromString( ref index, ref nodeParams ); - } - catch( Exception e ) - { - Debug.LogException( e ); - } - - m_additionalDirectives.AddItems( AdditionalLineType.Include, m_additionalIncludes.ItemsList ); - m_additionalDirectives.AddItems( AdditionalLineType.Define, m_additionalDefines.ItemsList ); - m_additionalDirectives.AddItems( AdditionalLineType.Pragma, m_additionalPragmas.ItemsList ); - - } - else - { - try - { - m_additionalDirectives.ReadFromString( ref index, ref nodeParams ); - } - catch( Exception e ) - { - Debug.LogException( e ); - } - } - } - - public void WriteToString( ref string nodeInfo ) - { - m_blendOpHelper.WriteToString( ref nodeInfo ); - m_cullModeHelper.WriteToString( ref nodeInfo ); - m_colorMaskHelper.WriteToString( ref nodeInfo ); - m_stencilBufferHelper.WriteToString( ref nodeInfo ); - m_depthOphelper.WriteToString( ref nodeInfo ); - m_tagsHelper.WriteToString( ref nodeInfo ); - m_shaderModelHelper.WriteToString( ref nodeInfo ); - - //m_additionalDefines.WriteToString( ref nodeInfo ); - //m_additionalPragmas.WriteToString( ref nodeInfo ); - //m_additionalIncludes.WriteToString( ref nodeInfo ); - - m_additionalDirectives.WriteToString( ref nodeInfo ); - } - - public TemplatesBlendModule BlendOpHelper { get { return m_blendOpHelper; } } - public TemplateCullModeModule CullModeHelper { get { return m_cullModeHelper; } } - public TemplateColorMaskModule ColorMaskHelper { get { return m_colorMaskHelper; } } - public TemplatesStencilBufferModule StencilBufferHelper { get { return m_stencilBufferHelper; } } - public TemplateDepthModule DepthOphelper { get { return m_depthOphelper; } } - public TemplateTagsModule TagsHelper { get { return m_tagsHelper; } } - public TemplateShaderModelModule ShaderModelHelper { get { return m_shaderModelHelper; } } - //public TemplateAdditionalIncludesHelper AdditionalIncludes { get { return m_additionalIncludes; } } - //public TemplateAdditionalDefinesHelper AdditionalDefines { get { return m_additionalDefines; } } - //public TemplateAdditionalPragmasHelper AdditionalPragmas { get { return m_additionalPragmas; } } - public TemplateAdditionalDirectivesHelper AdditionalDirectives { get { return m_additionalDirectives; } } - public bool AllModulesMode { get { return m_allModulesMode; } } - public bool HasValidData { get { return m_hasValidData; } } - public bool IsDirty - { - get { return m_isDirty; } - set - { - m_isDirty = value; - if( !value ) - { - m_blendOpHelper.IsDirty = false; - m_cullModeHelper.IsDirty = false; - m_colorMaskHelper.IsDirty = false; - m_stencilBufferHelper.IsDirty = false; - m_tagsHelper.IsDirty = false; - m_shaderModelHelper.IsDirty = false; - //m_additionalDefines.IsDirty = false; - //m_additionalPragmas.IsDirty = false; - //m_additionalIncludes.IsDirty = false; - m_additionalDirectives.IsDirty = false; - } - } - } - // public bool Foldout { get { return m_foldout; } set { m_foldout = value; } } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateModuleHelper.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateModuleHelper.cs.meta deleted file mode 100644 index 95ebce97..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateModuleHelper.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 144af5a201bd97542bf3a483976759db -timeCreated: 1518705839 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateModuleParent.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateModuleParent.cs deleted file mode 100644 index cb28c2f3..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateModuleParent.cs +++ /dev/null @@ -1,62 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using UnityEngine; -using UnityEditor; - -namespace AmplifyShaderEditor -{ - [Serializable] - public class TemplateModuleParent - { - private const string UnreadableDataMessagePrefix = "Unreadable data on Module "; - protected string m_unreadableMessage; - - [SerializeField] - protected bool m_validData = false; - - [SerializeField] - protected bool m_isDirty = false; - - [SerializeField] - protected string m_moduleName = string.Empty; - - //[SerializeField] - //protected bool m_foldoutValue = false; - - [SerializeField] - protected bool m_independentModule = true; - - public TemplateModuleParent( string moduleName ) { m_moduleName = moduleName; m_unreadableMessage = UnreadableDataMessagePrefix + moduleName; } - public virtual void Draw( UndoParentNode owner , bool style = true) { } - public virtual void ReadFromString( ref uint index, ref string[] nodeParams ) { } - public virtual void WriteToString( ref string nodeInfo ) { } - public virtual string GenerateShaderData( bool isSubShader ) { return string.Empty; } - public virtual void Destroy() { } - public bool ValidData { get { return m_validData; } } - public bool ValidAndIndependent { get { return m_validData && m_independentModule; } } - - public virtual void ShowUnreadableDataMessage( ParentNode owner ) - { - ShowUnreadableDataMessage(); - } - - public virtual void ShowUnreadableDataMessage() - { - EditorGUILayout.HelpBox( m_unreadableMessage, MessageType.Info ); - } - - public bool IsDirty - { - get { return m_isDirty; } - set { m_isDirty = value; } - } - - public bool IndependentModule - { - get { return m_independentModule; } - set { m_independentModule = value; } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateModuleParent.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateModuleParent.cs.meta deleted file mode 100644 index a0a1d88c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateModuleParent.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 3aaabf1f5cb06414a8be17a89487e10f -timeCreated: 1511185965 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateModulesData.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateModulesData.cs deleted file mode 100644 index 5cbc9a7b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateModulesData.cs +++ /dev/null @@ -1,541 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using System.Text.RegularExpressions; -using System.Collections.Generic; -using UnityEngine; - -namespace AmplifyShaderEditor -{ - public enum TemplateModuleDataType - { - ModuleShaderModel, - ModuleBlendMode, - ModuleBlendOp, - ModuleAlphaToMask, - ModuleCullMode, - ModuleColorMask, - ModuleStencil, - ModuleZwrite, - ModuleZTest, - ModuleZOffset, - ModuleTag, - ModuleGlobals, - ModuleSRPBatcher, - ModuleFunctions, - ModulePragma, - ModulePragmaBefore, - ModulePass, - ModuleInputVert, - ModuleInputFrag, - PassVertexFunction, - PassFragmentFunction, - PassVertexData, - PassInterpolatorData, - PassNameData, - AllModules, - VControl, - ControlData, - DomainData - //EndPass - } - - public enum TemplateSRPType - { - BuiltIn, - HD, - Lightweight - } - - [Serializable] - public class TemplateModulesData - { - [SerializeField] - private TemplateBlendData m_blendData = new TemplateBlendData(); - - [SerializeField] - private TemplateCullModeData m_cullModeData = new TemplateCullModeData(); - - [SerializeField] - private TemplateColorMaskData m_colorMaskData = new TemplateColorMaskData(); - - [SerializeField] - private TemplateStencilData m_stencilData = new TemplateStencilData(); - - [SerializeField] - private TemplateDepthData m_depthData = new TemplateDepthData(); - - [SerializeField] - private TemplateTagsModuleData m_tagData = new TemplateTagsModuleData(); - - [SerializeField] - private TemplateTagData m_globalsTag = new TemplateTagData( TemplatesManager.TemplateGlobalsTag, true ); - - [SerializeField] - private TemplateTagData m_srpBatcherTag = new TemplateTagData( TemplatesManager.TemplateSRPBatcherTag, true ); - - [SerializeField] - private TemplateTagData m_allModulesTag = new TemplateTagData( TemplatesManager.TemplateAllModulesTag, true ); - - [SerializeField] - private TemplateTagData m_functionsTag = new TemplateTagData( TemplatesManager.TemplateFunctionsTag, true ); - - [SerializeField] - private TemplateTagData m_pragmaTag = new TemplateTagData( TemplatesManager.TemplatePragmaTag, true ); - - [SerializeField] - private TemplateTagData m_pragmaBeforeTag = new TemplateTagData( TemplatesManager.TemplatePragmaBeforeTag, true ); - - [SerializeField] - private TemplateTagData m_passTag = new TemplateTagData( TemplatesManager.TemplatePassTag, true ); - - [SerializeField] - private TemplateTagData m_inputsVertTag = new TemplateTagData( TemplatesManager.TemplateInputsVertParamsTag, false ); - - [SerializeField] - private TemplateTagData m_inputsFragTag = new TemplateTagData( TemplatesManager.TemplateInputsFragParamsTag, false ); - - [SerializeField] - private TemplateShaderModelData m_shaderModel = new TemplateShaderModelData(); - - [SerializeField] - private TemplateSRPType m_srpType = TemplateSRPType.BuiltIn; - - [SerializeField] - private bool m_srpIsPBR = false; - - [SerializeField] - private string m_uniquePrefix; - - [SerializeField] - private TemplateIncludePragmaContainter m_includePragmaContainer = new TemplateIncludePragmaContainter(); - - [SerializeField] - private bool m_allModulesMode = false; - - [SerializeField] - private string m_passUniqueName = string.Empty; - - public void Destroy() - { - m_blendData = null; - m_cullModeData = null; - m_colorMaskData = null; - m_stencilData = null; - m_depthData = null; - m_tagData.Destroy(); - m_tagData = null; - m_globalsTag = null; - m_srpBatcherTag = null; - m_allModulesTag = null; - m_functionsTag = null; - m_pragmaTag = null; - m_pragmaBeforeTag = null; - m_passTag = null; - m_inputsVertTag = null; - m_inputsFragTag = null; - m_includePragmaContainer.Destroy(); - m_includePragmaContainer = null; - } - - public void ConfigureCommonTag( TemplateTagData tagData, TemplatePropertyContainer propertyContainer, TemplateIdManager idManager, string uniquePrefix, int offsetIdx, string subBody ) - { - int id = subBody.IndexOf( tagData.Id ); - if ( id >= 0 ) - { - tagData.StartIdx = offsetIdx + id; - idManager.RegisterId( tagData.StartIdx, uniquePrefix + tagData.Id, tagData.Id ); - propertyContainer.AddId( subBody, tagData.Id, tagData.SearchIndentation ); - } - } - - public TemplateModulesData( TemplateOptionsContainer optionsContainer, TemplateIdManager idManager, TemplatePropertyContainer propertyContainer, string uniquePrefix, int offsetIdx, string subBody, bool isSubShader ) - { - if ( string.IsNullOrEmpty( subBody ) ) - return; - - m_uniquePrefix = uniquePrefix; - //PRAGMAS AND INCLUDES - TemplateHelperFunctions.CreatePragmaIncludeList( subBody, m_includePragmaContainer ); - - //COMMON TAGS - ConfigureCommonTag( m_globalsTag, propertyContainer, idManager, uniquePrefix, offsetIdx, subBody ); - ConfigureCommonTag( m_srpBatcherTag, propertyContainer, idManager, uniquePrefix, offsetIdx, subBody ); - ConfigureCommonTag( m_functionsTag, propertyContainer, idManager, uniquePrefix, offsetIdx, subBody ); - ConfigureCommonTag( m_pragmaTag, propertyContainer, idManager, uniquePrefix, offsetIdx, subBody ); - ConfigureCommonTag( m_pragmaBeforeTag, propertyContainer, idManager, uniquePrefix, offsetIdx, subBody ); - if( !TemplateHelperFunctions.GetPassUniqueId( m_passTag, propertyContainer, idManager, uniquePrefix, offsetIdx, subBody, ref m_passUniqueName ) ) - { - ConfigureCommonTag( m_passTag, propertyContainer, idManager, uniquePrefix, offsetIdx, subBody ); - } - ConfigureCommonTag( m_inputsVertTag, propertyContainer, idManager, uniquePrefix, offsetIdx, subBody ); - ConfigureCommonTag( m_inputsFragTag, propertyContainer, idManager, uniquePrefix, offsetIdx, subBody ); - - // If Options are enabled then remove them so they won't influence Regex matches - if( optionsContainer.Enabled && optionsContainer.EndIndex > 0 ) - { - offsetIdx += optionsContainer.EndIndex; - subBody = subBody.Substring( optionsContainer.EndIndex ); - } - //BlEND MODE - { - Match blendModeMatch = Regex.Match( subBody, TemplateHelperFunctions.BlendWholeWordPattern ); - if( blendModeMatch.Success ) - { - int blendModeIdx = blendModeMatch.Index; - - int end = subBody.IndexOf( TemplatesManager.TemplateNewLine, blendModeIdx ); - string blendParams = subBody.Substring( blendModeIdx, end - blendModeIdx ); - m_blendData.BlendModeId = blendParams; - m_blendData.BlendModeStartIndex = offsetIdx + blendModeIdx; - idManager.RegisterId( m_blendData.BlendModeStartIndex, uniquePrefix + m_blendData.BlendModeId, m_blendData.BlendModeId ); - - TemplateHelperFunctions.CreateBlendMode( blendParams, ref m_blendData ); - if( m_blendData.ValidBlendMode ) - { - propertyContainer.AddId( subBody, blendParams, false ); - } - - } - } - //BLEND OP - { - Match blendOpMatch = Regex.Match( subBody, TemplateHelperFunctions.BlendOpWholeWordPattern ); - if( blendOpMatch.Success ) - { - int blendOpIdx = blendOpMatch.Index; - int end = subBody.IndexOf( TemplatesManager.TemplateNewLine, blendOpIdx ); - string blendOpParams = subBody.Substring( blendOpIdx, end - blendOpIdx ); - m_blendData.BlendOpId = blendOpParams; - BlendData.BlendOpStartIndex = offsetIdx + blendOpIdx; - idManager.RegisterId( m_blendData.BlendOpStartIndex, uniquePrefix + m_blendData.BlendOpId, m_blendData.BlendOpId ); - TemplateHelperFunctions.CreateBlendOp( blendOpParams, ref m_blendData ); - if( m_blendData.ValidBlendOp ) - { - propertyContainer.AddId( subBody, blendOpParams, false ); - } - } - - } - - //ALPHA TO MASK - { - Match alphaToMaskMatch = Regex.Match( subBody, TemplateHelperFunctions.AlphaToMaskPattern ); - if( alphaToMaskMatch.Success ) - { - m_blendData.ValidAlphaToMask = true; - m_blendData.AlphaToMaskId = alphaToMaskMatch.Groups[ 0 ].Value; - if( alphaToMaskMatch.Groups.Count > 1 ) - m_blendData.AlphaToMaskValue = alphaToMaskMatch.Groups[ 1 ].Value.Equals( "On" ) ? true : false; - m_blendData.IndependentAlphaToMask = true; - idManager.RegisterId( offsetIdx + alphaToMaskMatch.Index, uniquePrefix + m_blendData.AlphaToMaskId, m_blendData.AlphaToMaskId ); - propertyContainer.AddId( subBody, m_blendData.AlphaToMaskId, false ); - } - - m_blendData.DataCheck = ( m_blendData.ValidBlendMode || m_blendData.ValidBlendOp || m_blendData.ValidAlphaToMask ) ? TemplateDataCheck.Valid : TemplateDataCheck.Invalid; - } - - //CULL MODE - { - Match cullMatch = Regex.Match( subBody, TemplateHelperFunctions.CullWholeWordPattern ); - if( cullMatch.Success ) - { - int cullIdx = cullMatch.Index; - int end = subBody.IndexOf( TemplatesManager.TemplateNewLine, cullIdx ); - string cullParams = subBody.Substring( cullIdx, end - cullIdx ); - m_cullModeData.CullModeId = cullParams; - m_cullModeData.StartIdx = offsetIdx + cullIdx; - idManager.RegisterId( m_cullModeData.StartIdx, uniquePrefix + m_cullModeData.CullModeId, m_cullModeData.CullModeId ); - TemplateHelperFunctions.CreateCullMode( cullParams, ref m_cullModeData ); - if( m_cullModeData.DataCheck == TemplateDataCheck.Valid ) - propertyContainer.AddId( subBody, cullParams, false, string.Empty ); - - } - } - //COLOR MASK - { - Match colorMaskMatch = Regex.Match( subBody, TemplateHelperFunctions.ColorMaskWholeWordPattern ); - if( colorMaskMatch.Success ) - { - int colorMaskIdx = colorMaskMatch.Index; - int end = subBody.IndexOf( TemplatesManager.TemplateNewLine, colorMaskIdx ); - string colorMaskParams = subBody.Substring( colorMaskIdx, end - colorMaskIdx ); - m_colorMaskData.ColorMaskId = colorMaskParams; - m_colorMaskData.StartIdx = offsetIdx + colorMaskIdx; - idManager.RegisterId( m_colorMaskData.StartIdx, uniquePrefix + m_colorMaskData.ColorMaskId, m_colorMaskData.ColorMaskId ); - TemplateHelperFunctions.CreateColorMask( colorMaskParams, ref m_colorMaskData ); - if( m_colorMaskData.DataCheck == TemplateDataCheck.Valid ) - propertyContainer.AddId( subBody, colorMaskParams, false ); - - } - } - //STENCIL - { - Match stencilMatch = Regex.Match( subBody, TemplateHelperFunctions.StencilWholeWordPattern ); - if( stencilMatch.Success ) - { - int stencilIdx = stencilMatch.Index; - int stencilEndIdx = subBody.IndexOf( "}", stencilIdx ); - if( stencilEndIdx > 0 ) - { - string stencilParams = subBody.Substring( stencilIdx, stencilEndIdx + 1 - stencilIdx ); - m_stencilData.StencilBufferId = stencilParams; - m_stencilData.StartIdx = offsetIdx + stencilIdx; - idManager.RegisterId( m_stencilData.StartIdx, uniquePrefix + m_stencilData.StencilBufferId, m_stencilData.StencilBufferId ); - TemplateHelperFunctions.CreateStencilOps( stencilParams, ref m_stencilData ); - if( m_stencilData.DataCheck == TemplateDataCheck.Valid ) - { - propertyContainer.AddId( subBody, stencilParams, true ); - } - } - } - else - { - int stencilTagIdx = subBody.IndexOf( TemplatesManager.TemplateStencilTag ); - if( stencilTagIdx > -1 ) - { - m_stencilData.SetIndependentDefault(); - m_stencilData.StencilBufferId = TemplatesManager.TemplateStencilTag; - m_stencilData.StartIdx = offsetIdx + stencilTagIdx; - idManager.RegisterId( m_stencilData.StartIdx, uniquePrefix + m_stencilData.StencilBufferId, m_stencilData.StencilBufferId ); - propertyContainer.AddId( subBody, m_stencilData.StencilBufferId, true ); - } - } - } - //ZWRITE - { - Match zWriteMatch = Regex.Match( subBody, TemplateHelperFunctions.ZWriteWholeWordPattern ); - if( zWriteMatch.Success ) - { - int zWriteOpIdx = zWriteMatch.Index; - int zWriteEndIdx = subBody.IndexOf( TemplatesManager.TemplateNewLine, zWriteOpIdx ); - if( zWriteEndIdx > 0 ) - { - m_depthData.ZWriteModeId = subBody.Substring( zWriteOpIdx, zWriteEndIdx + 1 - zWriteOpIdx ); - m_depthData.ZWriteStartIndex = offsetIdx + zWriteOpIdx; - idManager.RegisterId( m_depthData.ZWriteStartIndex, uniquePrefix + m_depthData.ZWriteModeId, m_depthData.ZWriteModeId ); - TemplateHelperFunctions.CreateZWriteMode( m_depthData.ZWriteModeId, ref m_depthData ); - if( m_depthData.DataCheck == TemplateDataCheck.Valid ) - { - propertyContainer.AddId( subBody, m_depthData.ZWriteModeId, true ); - } - } - } - } - - //ZTEST - { - Match zTestMatch = Regex.Match( subBody, TemplateHelperFunctions.ZTestWholeWordPattern ); - if( zTestMatch.Success ) - { - int zTestOpIdx = zTestMatch.Index; - int zTestEndIdx = subBody.IndexOf( TemplatesManager.TemplateNewLine, zTestOpIdx ); - if( zTestEndIdx > 0 ) - { - m_depthData.ZTestModeId = subBody.Substring( zTestOpIdx, zTestEndIdx + 1 - zTestOpIdx ); - m_depthData.ZTestStartIndex = offsetIdx + zTestOpIdx; - idManager.RegisterId( m_depthData.ZTestStartIndex, uniquePrefix + m_depthData.ZTestModeId, m_depthData.ZTestModeId ); - TemplateHelperFunctions.CreateZTestMode( m_depthData.ZTestModeId, ref m_depthData ); - if( m_depthData.DataCheck == TemplateDataCheck.Valid ) - { - propertyContainer.AddId( subBody, m_depthData.ZTestModeId, true ); - } - } - } - } - - //ZOFFSET - { - Match zOffsetMatch = Regex.Match( subBody, TemplateHelperFunctions.ZOffsetWholeWordPattern ); - if( zOffsetMatch.Success ) - { - int zOffsetIdx = zOffsetMatch.Index; - int zOffsetEndIdx = subBody.IndexOf( TemplatesManager.TemplateNewLine, zOffsetIdx ); - if( zOffsetEndIdx > 0 ) - { - m_depthData.OffsetId = subBody.Substring( zOffsetIdx, zOffsetEndIdx + 1 - zOffsetIdx ); - m_depthData.OffsetStartIndex = offsetIdx + zOffsetIdx; - idManager.RegisterId( m_depthData.OffsetStartIndex, uniquePrefix + m_depthData.OffsetId, m_depthData.OffsetId ); - TemplateHelperFunctions.CreateZOffsetMode( m_depthData.OffsetId, ref m_depthData ); - if( m_depthData.DataCheck == TemplateDataCheck.Valid ) - { - propertyContainer.AddId( subBody, m_depthData.OffsetId, true ); - } - } - } - m_depthData.SetDataCheck(); - } - //TAGS - { - Match tagsMatch = Regex.Match( subBody, TemplateHelperFunctions.TagsWholeWordPattern ); - if ( tagsMatch.Success ) - { - int tagsIdx = tagsMatch.Index; - int tagsEndIdx = subBody.IndexOf( "}", tagsIdx ); - if ( tagsEndIdx > -1 ) - { - m_tagData.Reset(); - m_tagData.TagsId = subBody.Substring( tagsIdx, tagsEndIdx + 1 - tagsIdx ); - m_tagData.StartIdx = offsetIdx + tagsIdx; - idManager.RegisterId( m_tagData.StartIdx, uniquePrefix + m_tagData.TagsId, m_tagData.TagsId ); - m_srpType = TemplateHelperFunctions.CreateTags( ref m_tagData, isSubShader ); - - propertyContainer.AddId( subBody, m_tagData.TagsId, false ); - m_tagData.DataCheck = TemplateDataCheck.Valid; - } - else - { - m_tagData.DataCheck = TemplateDataCheck.Invalid; - } - } - else - { - m_tagData.DataCheck = TemplateDataCheck.Invalid; - } - } - - //SHADER MODEL - { - Match match = Regex.Match( subBody, TemplateHelperFunctions.ShaderModelPattern ); - if ( match != null && match.Groups.Count > 1 ) - { - if ( TemplateHelperFunctions.AvailableInterpolators.ContainsKey( match.Groups[ 1 ].Value ) ) - { - m_shaderModel.Id = match.Groups[ 0 ].Value; - m_shaderModel.StartIdx = offsetIdx + match.Index; - m_shaderModel.Value = match.Groups[ 1 ].Value; - m_shaderModel.InterpolatorAmount = TemplateHelperFunctions.AvailableInterpolators[ match.Groups[ 1 ].Value ]; - m_shaderModel.DataCheck = TemplateDataCheck.Valid; - idManager.RegisterId( m_shaderModel.StartIdx, uniquePrefix + m_shaderModel.Id, m_shaderModel.Id ); - } - else - { - m_shaderModel.DataCheck = TemplateDataCheck.Invalid; - } - } - } - - // ALL MODULES - int allModulesIndex = subBody.IndexOf( TemplatesManager.TemplateAllModulesTag ); - if( allModulesIndex > 0 ) - { - //ONLY REGISTER MISSING TAGS - ConfigureCommonTag( m_allModulesTag, propertyContainer, idManager, uniquePrefix, offsetIdx, subBody ); - m_allModulesMode = true; - - m_blendData.SetAllModulesDefault(); - - if( !m_cullModeData.IsValid ) - m_cullModeData.SetAllModulesDefault(); - - if( !m_colorMaskData.IsValid ) - m_colorMaskData.SetAllModulesDefault(); - - if( !m_stencilData.IsValid ) - m_stencilData.SetAllModulesDefault(); - - if( !m_depthData.IsValid ) - m_depthData.SetAllModulesDefault(); - - if( !m_shaderModel.IsValid ) - m_shaderModel.SetAllModulesDefault(); - } - } - - public void TestPropertyInternalName( string name, ref List<TemplateShaderPropertyData> availableShaderProperties, ref Dictionary<string, TemplateShaderPropertyData> duplicatesHelper ) - { - if( !string.IsNullOrEmpty( name ) && !duplicatesHelper.ContainsKey( name )) - { - TemplateShaderPropertyData newData = new TemplateShaderPropertyData( -1, string.Empty, string.Empty, name, name, WirePortDataType.INT, PropertyType.Property ); - availableShaderProperties.Add( newData ); - duplicatesHelper.Add( newData.PropertyName , newData ); - } - } - - public void RegisterInternalUnityInlines( ref List<TemplateShaderPropertyData> availableShaderProperties, ref Dictionary<string, TemplateShaderPropertyData> duplicatesHelper ) - { - TestPropertyInternalName( m_depthData.ZWriteInlineValue, ref availableShaderProperties , ref duplicatesHelper); - TestPropertyInternalName( m_depthData.ZTestInlineValue, ref availableShaderProperties, ref duplicatesHelper ); - TestPropertyInternalName( m_depthData.OffsetFactorInlineValue, ref availableShaderProperties, ref duplicatesHelper ); - TestPropertyInternalName( m_depthData.OffsetUnitsInlineValue, ref availableShaderProperties, ref duplicatesHelper ); - - TestPropertyInternalName( m_blendData.SourceFactorRGBInline, ref availableShaderProperties, ref duplicatesHelper ); - TestPropertyInternalName( m_blendData.DestFactorRGBInline, ref availableShaderProperties, ref duplicatesHelper ); - TestPropertyInternalName( m_blendData.SourceFactorAlphaInline, ref availableShaderProperties, ref duplicatesHelper ); - TestPropertyInternalName( m_blendData.DestFactorAlphaInline, ref availableShaderProperties, ref duplicatesHelper ); - TestPropertyInternalName( m_blendData.BlendOpRGBInline, ref availableShaderProperties, ref duplicatesHelper ); - TestPropertyInternalName( m_blendData.BlendOpAlphaInline, ref availableShaderProperties, ref duplicatesHelper ); - - TestPropertyInternalName( m_stencilData.ReferenceInline, ref availableShaderProperties, ref duplicatesHelper ); - TestPropertyInternalName( m_stencilData.ReadMaskInline, ref availableShaderProperties, ref duplicatesHelper ); - TestPropertyInternalName( m_stencilData.WriteMaskInline, ref availableShaderProperties, ref duplicatesHelper ); - TestPropertyInternalName( m_stencilData.ComparisonFrontInline, ref availableShaderProperties, ref duplicatesHelper ); - TestPropertyInternalName( m_stencilData.PassFrontInline, ref availableShaderProperties, ref duplicatesHelper ); - TestPropertyInternalName( m_stencilData.FailFrontInline, ref availableShaderProperties, ref duplicatesHelper ); - TestPropertyInternalName( m_stencilData.ZFailFrontInline, ref availableShaderProperties, ref duplicatesHelper ); - TestPropertyInternalName( m_stencilData.ComparisonBackInline, ref availableShaderProperties, ref duplicatesHelper ); - TestPropertyInternalName( m_stencilData.PassBackInline, ref availableShaderProperties, ref duplicatesHelper ); - TestPropertyInternalName( m_stencilData.FailBackInline, ref availableShaderProperties, ref duplicatesHelper ); - TestPropertyInternalName( m_stencilData.ZFailBackInline, ref availableShaderProperties, ref duplicatesHelper ); - - TestPropertyInternalName( m_cullModeData.InlineData, ref availableShaderProperties, ref duplicatesHelper ); - - TestPropertyInternalName( m_colorMaskData.InlineData, ref availableShaderProperties, ref duplicatesHelper ); - } - - public void SetPassUniqueNameIfUndefined( string value ) - { - if( string.IsNullOrEmpty( m_passUniqueName ) ) - m_passUniqueName = value; - } - - public bool HasValidData - { - get - { - return m_blendData.DataCheck == TemplateDataCheck.Valid || - m_cullModeData.DataCheck == TemplateDataCheck.Valid || - m_colorMaskData.DataCheck == TemplateDataCheck.Valid || - m_stencilData.DataCheck == TemplateDataCheck.Valid || - m_depthData.DataCheck == TemplateDataCheck.Valid || - m_tagData.DataCheck == TemplateDataCheck.Valid || - m_shaderModel.DataCheck == TemplateDataCheck.Valid || - m_globalsTag.IsValid || - m_srpBatcherTag.IsValid || - m_allModulesTag.IsValid || - m_functionsTag.IsValid || - m_pragmaTag.IsValid || - m_pragmaBeforeTag.IsValid || - m_passTag.IsValid || - m_inputsVertTag.IsValid || - m_inputsFragTag.IsValid; - } - } - - public TemplateBlendData BlendData { get { return m_blendData; } } - public TemplateCullModeData CullModeData { get { return m_cullModeData; } } - public TemplateColorMaskData ColorMaskData { get { return m_colorMaskData; } } - public TemplateStencilData StencilData { get { return m_stencilData; } } - public TemplateDepthData DepthData { get { return m_depthData; } } - public TemplateTagsModuleData TagData { get { return m_tagData; } } - public TemplateTagData GlobalsTag { get { return m_globalsTag; } } - public TemplateTagData SRPBatcherTag { get { return m_srpBatcherTag; } } - public TemplateTagData AllModulesTag { get { return m_allModulesTag; } } - public TemplateTagData FunctionsTag { get { return m_functionsTag; } } - public TemplateTagData PragmaTag { get { return m_pragmaTag; } } - public TemplateTagData PragmaBeforeTag { get { return m_pragmaBeforeTag; } } - public TemplateTagData PassTag { get { return m_passTag; } } - public TemplateTagData InputsVertTag { get { return m_inputsVertTag; } } - public TemplateTagData InputsFragTag { get { return m_inputsFragTag; } } - public TemplateShaderModelData ShaderModel { get { return m_shaderModel; } } - public TemplateSRPType SRPType { get { return m_srpType; } set { m_srpType = value; } } - public bool SRPIsPBR { get { return m_srpIsPBR; } set { m_srpIsPBR = value; } } - public bool SRPIsPBRHD { get { return m_srpIsPBR && m_srpType == TemplateSRPType.HD; } } - public string UniquePrefix { get { return m_uniquePrefix; } } - public string PassUniqueName { get { return m_passUniqueName; } } - public bool HasPassUniqueName { get { return !string.IsNullOrEmpty( m_passUniqueName ); } } - public TemplateIncludePragmaContainter IncludePragmaContainer { get { return m_includePragmaContainer; } } - public bool AllModulesMode { get { return m_allModulesMode; } } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateModulesData.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateModulesData.cs.meta deleted file mode 100644 index 64714772..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateModulesData.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 122447ac2bc376a448a42a0f5373e63b -timeCreated: 1521718529 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMultiPass.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMultiPass.cs deleted file mode 100644 index 5086b55f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMultiPass.cs +++ /dev/null @@ -1,1248 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> -using System; -using System.Text.RegularExpressions; -using System.Collections.Generic; -using UnityEngine; -using UnityEditor; - -namespace AmplifyShaderEditor -{ - [Serializable] - public class TemplateUniquePassData - { - public int SubShaderIdx; - public int PassIdx; - } - - [Serializable] - public sealed class TemplateMultiPass : TemplateDataParent - { - [SerializeField] - private List<TemplateShaderPropertyData> m_availableShaderProperties = new List<TemplateShaderPropertyData>(); - - [SerializeField] - private List<TemplateSubShader> m_subShaders = new List<TemplateSubShader>(); - - [SerializeField] - private TemplateTagData m_propertyTag; - - [SerializeField] - private TemplateIdManager m_templateIdManager; - - [SerializeField] - private string m_shaderNameId = string.Empty; - - [SerializeField] - private string m_shaderBody; - - [SerializeField] - private TemplatePropertyContainer m_templateProperties = new TemplatePropertyContainer(); - - [SerializeField] - private TemplateShaderInfo m_shaderData; - - [SerializeField] - private bool m_isSinglePass = false; - - [SerializeField] - private int m_masterNodesRequired = 0; - - [SerializeField] - TemplateInfoContainer m_customInspectorContainer = new TemplateInfoContainer(); - - [SerializeField] - TemplateInfoContainer m_dependenciesContainer = new TemplateInfoContainer(); - - [SerializeField] - TemplateInfoContainer m_fallbackContainer = new TemplateInfoContainer(); - - [SerializeField] - TemplateInfoContainer m_beforePragmaContainer = new TemplateInfoContainer(); - - [SerializeField] - private CustomTemplatePropertyUIEnum m_customTemplatePropertyUI = CustomTemplatePropertyUIEnum.None; - - [SerializeField] - private int m_lodInjectorId = -1; - - [SerializeField] - TemplateShaderModelData m_globalShaderModel = new TemplateShaderModelData(); - - private Dictionary<string, TemplateUniquePassData> m_passUniqueIdData = new Dictionary<string, TemplateUniquePassData>(); - - - public TemplateMultiPass() - { - m_templateType = TemplateDataType.MultiPass; - } - - public TemplateMultiPass( string name, string guid, bool isCommunity ) - { - m_templateType = TemplateDataType.MultiPass; - Init( name, guid, isCommunity ); - } - - public override void Init( string name, string guid, bool isCommunity ) - { - base.Init( name, guid, isCommunity ); - TemplatesManager.CurrTemplateGUIDLoaded = guid; - LoadTemplateBody( guid ); - Name = string.IsNullOrEmpty( name ) ? m_defaultShaderName : name; - } - - void LoadTemplateBody( string guid ) - { - m_passUniqueIdData.Clear(); - m_guid = guid; - string datapath = AssetDatabase.GUIDToAssetPath( guid ); - string shaderBody = string.Empty; - shaderBody = IOUtils.LoadTextFileFromDisk( datapath ); - shaderBody = shaderBody.Replace( "\r\n", "\n" ); - - // Insert Before Tag - MatchCollection col = Regex.Matches( shaderBody, TemplateHelperFunctions.BeforePragmaPattern, RegexOptions.Singleline ); - for( int i = col.Count - 1; i >= 0; i-- ) - { - if( col[ i ].Groups.Count == 3 ) - { - shaderBody = shaderBody.Insert( col[ i ].Groups[ 2 ].Index, TemplatesManager.TemplatePragmaBeforeTag + "\n" + col[ i ].Groups[ 1 ].Value ); - } - } - //Detect SRP Batcher - MatchCollection srpMatch = Regex.Matches( shaderBody, TemplateHelperFunctions.SRPBatcherFindTag ); - for( int i = srpMatch.Count - 1; i >= 0; i-- ) - { - if( srpMatch[ i ].Groups.Count == 2 ) - { - shaderBody = shaderBody.Insert( srpMatch[ i ].Groups[ 0 ].Index + srpMatch[ i ].Groups[ 0 ].Length, TemplatesManager.TemplateSRPBatcherTag + srpMatch[ i ].Groups[ 1 ].Value ); - } - } - - - // Detect if template has LOD tag, if not, insert one - // It will be read and processed over the TemplateSubShader constructor - { - Match match = Regex.Match( shaderBody, TemplateHelperFunctions.SubShaderLODPattern ); - if( match == null || ( match != null && !match.Success ) ) - { - MatchCollection subShaderMatch = Regex.Matches( shaderBody, TemplatesManager.TemplateMPSubShaderTag ); - - int subShaderAmount = subShaderMatch.Count; - - for( int i = subShaderAmount - 1; i > -1; i-- ) - { - if( subShaderMatch[ i ].Success ) - { - shaderBody = shaderBody.Insert( subShaderMatch[ i ].Index + subShaderMatch[ i ].Length, "\n\t\t\tLOD 0\n" ); - } - } - } - } - m_shaderData = TemplateShaderInfoUtil.CreateShaderData( shaderBody ); - if( m_shaderData == null ) - { - m_isValid = false; - return; - } - - m_templateIdManager = new TemplateIdManager( shaderBody ); - - try - { - int nameBegin = shaderBody.IndexOf( TemplatesManager.TemplateShaderNameBeginTag ); - if( nameBegin < 0 ) - { - // Not a template - return; - } - - int nameEnd = shaderBody.IndexOf( TemplatesManager.TemplateFullEndTag, nameBegin ); - if( nameEnd < 0 ) - return; - - - m_shaderBody = shaderBody; - int defaultBegin = nameBegin + TemplatesManager.TemplateShaderNameBeginTag.Length; - int defaultLength = nameEnd - defaultBegin; - m_defaultShaderName = shaderBody.Substring( defaultBegin, defaultLength ); - int[] nameIdx = m_defaultShaderName.AllIndexesOf( "\"" ); - nameIdx[ 0 ] += 1; // Ignore the " character from the string - m_defaultShaderName = m_defaultShaderName.Substring( nameIdx[ 0 ], nameIdx[ 1 ] - nameIdx[ 0 ] ); - m_shaderNameId = shaderBody.Substring( nameBegin, nameEnd + TemplatesManager.TemplateFullEndTag.Length - nameBegin ); - m_templateProperties.AddId( shaderBody, m_shaderNameId, false ); - m_templateIdManager.RegisterId( nameBegin, m_shaderNameId, m_shaderNameId ); - shaderBody = shaderBody.Substring( nameEnd + TemplatesManager.TemplateFullEndTag.Length ); - } - catch( Exception e ) - { - Debug.LogException( e ); - m_isValid = false; - } - - m_customTemplatePropertyUI = TemplateHelperFunctions.FetchCustomUI( shaderBody ); - TemplateHelperFunctions.FetchDependencies( m_dependenciesContainer, ref m_shaderBody ); - if( m_dependenciesContainer.IsValid ) - { - int index = m_dependenciesContainer.Id.IndexOf( TemplatesManager.TemplateDependenciesListTag ); - m_templateProperties.AddId( new TemplateProperty( m_dependenciesContainer.Id, m_dependenciesContainer.Id.Substring( 0, index ), true ) ); - m_templateIdManager.RegisterId( m_dependenciesContainer.Index, m_dependenciesContainer.Id, m_dependenciesContainer.Id ); - } - - TemplateHelperFunctions.FetchCustomInspector( m_customInspectorContainer, ref m_shaderBody ); - if( m_customInspectorContainer.IsValid ) - { - int index = m_customInspectorContainer.Id.IndexOf( "CustomEditor" ); - m_templateProperties.AddId( new TemplateProperty( m_customInspectorContainer.Id, m_customInspectorContainer.Id.Substring( 0, index ), true ) ); - m_templateIdManager.RegisterId( m_customInspectorContainer.Index, m_customInspectorContainer.Id, m_customInspectorContainer.Id ); - } - - TemplateHelperFunctions.FetchFallback( m_fallbackContainer, ref m_shaderBody ); - if( m_fallbackContainer.IsValid ) - { - int index = m_fallbackContainer.Id.IndexOf( "Fallback", StringComparison.InvariantCultureIgnoreCase ); - m_templateProperties.AddId( new TemplateProperty( m_fallbackContainer.Id, m_fallbackContainer.Id.Substring( 0, index ), true ) ); - m_templateIdManager.RegisterId( m_fallbackContainer.Index, m_fallbackContainer.Id, m_fallbackContainer.Id ); - } - - m_lodInjectorId = m_shaderBody.IndexOf( TemplatesManager.TemplateLODsTag ); - - // Shader body may have been changed to inject inexisting tags like fallback - m_templateIdManager.ShaderBody = m_shaderBody; - - m_propertyTag = new TemplateTagData( m_shaderData.PropertyStartIdx, TemplatesManager.TemplatePropertyTag, true ); - m_templateIdManager.RegisterId( m_shaderData.PropertyStartIdx, TemplatesManager.TemplatePropertyTag, TemplatesManager.TemplatePropertyTag ); - m_templateProperties.AddId( shaderBody, TemplatesManager.TemplatePropertyTag, true ); - Dictionary<string, TemplateShaderPropertyData> duplicatesHelper = new Dictionary<string, TemplateShaderPropertyData>(); - TemplateHelperFunctions.CreateShaderPropertiesList( m_shaderData.Properties, ref m_availableShaderProperties, ref duplicatesHelper ); - for( int i = 0; i < m_availableShaderProperties.Count; i++ ) - { - m_templateIdManager.RegisterId( m_availableShaderProperties[ i ].Index, m_availableShaderProperties[ i ].FullValue, m_availableShaderProperties[ i ].FullValue ); - } - - int subShaderCount = m_shaderData.SubShaders.Count; - - int mainSubShaderIdx = -1; - int mainPassIdx = -1; - - int firstVisibleSubShaderId = -1; - int firstVisiblePassId = -1; - bool foundMainPass = false; - bool foundFirstVisible = false; - - m_templateIdManager.RegisterTag( TemplatesManager.TemplatePassesEndTag ); - m_templateIdManager.RegisterTag( TemplatesManager.TemplateMainPassTag ); - - //SHADER MODEL - { - Match shaderModelMatch = Regex.Match( m_shaderData.Properties, TemplateHelperFunctions.ShaderModelPattern ); - if( shaderModelMatch != null && shaderModelMatch.Success ) - { - if( TemplateHelperFunctions.AvailableInterpolators.ContainsKey( shaderModelMatch.Groups[ 1 ].Value ) ) - { - m_globalShaderModel.Id = shaderModelMatch.Groups[ 0 ].Value; - m_globalShaderModel.StartIdx = shaderModelMatch.Index; - m_globalShaderModel.Value = shaderModelMatch.Groups[ 1 ].Value; - m_globalShaderModel.InterpolatorAmount = TemplateHelperFunctions.AvailableInterpolators[ shaderModelMatch.Groups[ 1 ].Value ]; - m_globalShaderModel.DataCheck = TemplateDataCheck.Valid; - } - else - { - m_globalShaderModel.DataCheck = TemplateDataCheck.Invalid; - } - } - } - // - - - for( int i = 0; i < subShaderCount; i++ ) - { - TemplateSubShader subShader = new TemplateSubShader(this, i, m_templateIdManager, "SubShader" + i, m_shaderData.SubShaders[ i ], ref duplicatesHelper ); - - if( subShader.FoundMainPass ) - { - if( !foundMainPass ) - { - foundMainPass = true; - mainSubShaderIdx = i; - mainPassIdx = subShader.MainPass; - } - } - else if( subShader.MainPass > -1 ) - { - if( !foundFirstVisible ) - { - foundFirstVisible = true; - firstVisibleSubShaderId = i; - firstVisiblePassId = subShader.MainPass; - } - } - - m_subShaders.Add( subShader ); - m_masterNodesRequired += subShader.Passes.Count; - } - - - if( !foundMainPass && foundFirstVisible ) - { - mainSubShaderIdx = firstVisibleSubShaderId; - mainPassIdx = firstVisiblePassId; - } - - for( int subShaderIdx = 0; subShaderIdx < subShaderCount; subShaderIdx++ ) - { - m_subShaders[ subShaderIdx ].Modules.RegisterInternalUnityInlines( ref m_availableShaderProperties , ref duplicatesHelper ); - int passCount = m_subShaders[ subShaderIdx ].Passes.Count; - for( int passIdx = 0; passIdx < passCount; passIdx++ ) - { - m_subShaders[ subShaderIdx ].Passes[ passIdx ].Modules.RegisterInternalUnityInlines( ref m_availableShaderProperties, ref duplicatesHelper ); - m_subShaders[ subShaderIdx ].Passes[ passIdx ].IsMainPass = ( mainSubShaderIdx == subShaderIdx && mainPassIdx == passIdx ); - } - } - - duplicatesHelper.Clear(); - duplicatesHelper = null; - m_isSinglePass = ( m_subShaders.Count == 1 && m_subShaders[ 0 ].PassAmount == 1 ); - - } - - public void ResetState() - { - m_templateIdManager.ResetRegistersState(); - int subshaderCount = m_subShaders.Count; - for( int subShaderIdx = 0; subShaderIdx < subshaderCount; subShaderIdx++ ) - { - m_subShaders[ subShaderIdx ].TemplateProperties.ResetTemplateUsageData(); - int passCount = m_subShaders[ subShaderIdx ].Passes.Count; - for( int passIdx = 0; passIdx < passCount; passIdx++ ) - { - m_subShaders[ subShaderIdx ].Passes[ passIdx ].TemplateProperties.ResetTemplateUsageData(); - } - } - } - - public override void Destroy() - { - m_templateProperties.Destroy(); - m_templateProperties = null; - - m_availableShaderProperties.Clear(); - m_availableShaderProperties = null; - - int subShaderCount = m_subShaders.Count; - for( int i = 0; i < subShaderCount; i++ ) - { - m_subShaders[ i ].Destroy(); - } - - m_subShaders.Clear(); - m_subShaders = null; - - m_templateIdManager.Destroy(); - m_templateIdManager = null; - } - - public void SetSubShaderData( TemplateModuleDataType type, int subShaderId, string[] list ) - { - string id = GetSubShaderDataId( type, subShaderId, false ); - string body = string.Empty; - FillTemplateBody( subShaderId, -1, id, ref body, list ); - SetSubShaderData( type, subShaderId, body ); - } - - public void SetSubShaderData( TemplateModuleDataType type, int subShaderId, List<PropertyDataCollector> list ) - { - string id = GetSubShaderDataId( type, subShaderId, false ); - string body = string.Empty; - FillTemplateBody( subShaderId, -1, id, ref body, list ); - SetSubShaderData( type, subShaderId, body ); - } - - public void SetSubShaderData( TemplateModuleDataType type, int subShaderId, string text ) - { - if( subShaderId >= m_subShaders.Count ) - return; - - string prefix = m_subShaders[ subShaderId ].Modules.UniquePrefix; - switch( type ) - { - case TemplateModuleDataType.AllModules: - { - m_templateIdManager.SetReplacementText( prefix + TemplatesManager.TemplateAllModulesTag, text ); - } - break; - case TemplateModuleDataType.ModuleShaderModel: - { - m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.ShaderModel.Id, text ); - } - break; - case TemplateModuleDataType.ModuleBlendMode: - { - m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.BlendData.BlendModeId, text ); - } - break; - case TemplateModuleDataType.ModuleBlendOp: - { - m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.BlendData.BlendOpId, text ); - } - break; - case TemplateModuleDataType.ModuleAlphaToMask: - { - m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.BlendData.AlphaToMaskId, text ); - } - break; - case TemplateModuleDataType.ModuleCullMode: - { - m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.CullModeData.CullModeId, text ); - } - break; - case TemplateModuleDataType.ModuleColorMask: - { - m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.ColorMaskData.ColorMaskId, text ); - } - break; - case TemplateModuleDataType.ModuleStencil: - { - m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.StencilData.StencilBufferId, text ); - } - break; - case TemplateModuleDataType.ModuleZwrite: - { - m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.DepthData.ZWriteModeId, text ); - } - break; - case TemplateModuleDataType.ModuleZTest: - { - m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.DepthData.ZTestModeId, text ); - } - break; - case TemplateModuleDataType.ModuleZOffset: - { - m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.DepthData.OffsetId, text ); - } - break; - case TemplateModuleDataType.ModuleTag: - { - m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.TagData.TagsId, text ); - } - break; - case TemplateModuleDataType.ModuleGlobals: - { - m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.GlobalsTag.Id, text ); - } - break; - case TemplateModuleDataType.ModuleSRPBatcher: - { - m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.SRPBatcherTag.Id, text ); - } - break; - case TemplateModuleDataType.ModuleFunctions: - { - m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.FunctionsTag.Id, text ); - } - break; - case TemplateModuleDataType.ModulePragma: - { - m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.PragmaTag.Id, text ); - } - break; - case TemplateModuleDataType.ModulePragmaBefore: - { - m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.PragmaBeforeTag.Id, text ); - } - break; - case TemplateModuleDataType.ModulePass: - { - m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.PassTag.Id, text ); - } - break; - case TemplateModuleDataType.ModuleInputVert: - { - m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.InputsVertTag.Id, text ); - } - break; - case TemplateModuleDataType.ModuleInputFrag: - { - m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Modules.InputsFragTag.Id, text ); - } - break; - } - } - - public void SetPropertyData( string[] properties ) - { - string body = string.Empty; - FillTemplateBody( -1, -1, TemplatesManager.TemplatePropertyTag, ref body, properties ); - SetPropertyData( body ); - } - - - public void SetPropertyData( string text ) - { - m_templateIdManager.SetReplacementText( m_propertyTag.Id, text ); - } - - public string GetSubShaderDataId( TemplateModuleDataType type, int subShaderId, bool addPrefix ) - { - if( subShaderId >= m_subShaders.Count ) - return string.Empty; - - string prefix = string.Empty; - switch( type ) - { - case TemplateModuleDataType.AllModules: - { - prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty; - return prefix + TemplatesManager.TemplateAllModulesTag; - } - case TemplateModuleDataType.ModuleBlendMode: - { - prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty; - return prefix + m_subShaders[ subShaderId ].Modules.BlendData.BlendModeId; - } - case TemplateModuleDataType.ModuleBlendOp: - { - prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty; - return prefix + m_subShaders[ subShaderId ].Modules.BlendData.BlendOpId; - } - case TemplateModuleDataType.ModuleAlphaToMask: - { - prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty; - return prefix + m_subShaders[ subShaderId ].Modules.BlendData.AlphaToMaskId; - } - case TemplateModuleDataType.ModuleCullMode: - { - prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty; - return prefix + m_subShaders[ subShaderId ].Modules.CullModeData.CullModeId; - } - case TemplateModuleDataType.ModuleColorMask: - { - prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty; - return prefix + m_subShaders[ subShaderId ].Modules.ColorMaskData.ColorMaskId; - } - case TemplateModuleDataType.ModuleStencil: - { - prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty; - return prefix + m_subShaders[ subShaderId ].Modules.StencilData.StencilBufferId; - } - case TemplateModuleDataType.ModuleZwrite: - { - prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty; - return prefix + m_subShaders[ subShaderId ].Modules.DepthData.ZWriteModeId; - } - case TemplateModuleDataType.ModuleZTest: - { - prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty; - return prefix + m_subShaders[ subShaderId ].Modules.DepthData.ZTestModeId; - } - case TemplateModuleDataType.ModuleZOffset: - { - prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty; - return prefix + m_subShaders[ subShaderId ].Modules.DepthData.OffsetId; - } - case TemplateModuleDataType.ModuleTag: - { - prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty; - return prefix + m_subShaders[ subShaderId ].Modules.TagData.TagsId; - } - case TemplateModuleDataType.ModuleGlobals: - { - prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty; - return prefix + m_subShaders[ subShaderId ].Modules.GlobalsTag.Id; - } - case TemplateModuleDataType.ModuleSRPBatcher: - { - prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty; - return prefix + m_subShaders[ subShaderId ].Modules.SRPBatcherTag.Id; - } - case TemplateModuleDataType.ModuleFunctions: - { - prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty; - return prefix + m_subShaders[ subShaderId ].Modules.FunctionsTag.Id; - } - case TemplateModuleDataType.ModulePragma: - { - prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty; - return prefix + m_subShaders[ subShaderId ].Modules.PragmaTag.Id; - } - case TemplateModuleDataType.ModulePragmaBefore: - { - prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty; - return prefix + m_subShaders[ subShaderId ].Modules.PragmaBeforeTag.Id; - } - case TemplateModuleDataType.ModulePass: - { - prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty; - return prefix + m_subShaders[ subShaderId ].Modules.PassTag.Id; - } - case TemplateModuleDataType.ModuleInputVert: - { - prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty; - return prefix + m_subShaders[ subShaderId ].Modules.InputsVertTag.Id; - } - case TemplateModuleDataType.ModuleInputFrag: - { - prefix = addPrefix ? m_subShaders[ subShaderId ].Modules.UniquePrefix : string.Empty; - return prefix + m_subShaders[ subShaderId ].Modules.InputsFragTag.Id; - } - } - return string.Empty; - - } - public string GetPassDataId( TemplateModuleDataType type, int subShaderId, int passId, bool addPrefix ) - { - if( subShaderId >= m_subShaders.Count || passId >= m_subShaders[ subShaderId ].Passes.Count ) - return string.Empty; - - string prefix = string.Empty; - switch( type ) - { - case TemplateModuleDataType.AllModules: - { - prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty; - return prefix + TemplatesManager.TemplateAllModulesTag; - } - case TemplateModuleDataType.ModuleBlendMode: - { - prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty; - return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.BlendData.BlendModeId; - } - case TemplateModuleDataType.ModuleBlendOp: - { - prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty; - return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.BlendData.BlendOpId; - } - case TemplateModuleDataType.ModuleAlphaToMask: - { - prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty; - return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.BlendData.AlphaToMaskId; - } - case TemplateModuleDataType.ModuleCullMode: - { - prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty; - return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.CullModeData.CullModeId; - } - case TemplateModuleDataType.ModuleColorMask: - { - prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty; - return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.ColorMaskData.ColorMaskId; - } - case TemplateModuleDataType.ModuleStencil: - { - prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty; - return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.StencilData.StencilBufferId; - } - case TemplateModuleDataType.ModuleZwrite: - { - prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty; - return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.DepthData.ZWriteModeId; - } - case TemplateModuleDataType.ModuleZTest: - { - prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty; - return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.DepthData.ZTestModeId; - } - case TemplateModuleDataType.ModuleZOffset: - { - prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty; - return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.DepthData.OffsetId; - } - case TemplateModuleDataType.ModuleTag: - { - prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty; - return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.TagData.TagsId; - } - case TemplateModuleDataType.ModuleGlobals: - { - prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty; - return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.GlobalsTag.Id; - } - case TemplateModuleDataType.ModuleSRPBatcher: - { - prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty; - return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.SRPBatcherTag.Id; - } - case TemplateModuleDataType.ModuleFunctions: - { - prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty; - return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.FunctionsTag.Id; - } - case TemplateModuleDataType.ModulePragma: - { - prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty; - return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.PragmaTag.Id; - } - case TemplateModuleDataType.ModulePragmaBefore: - { - prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty; - return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.PragmaBeforeTag.Id; - } - case TemplateModuleDataType.ModulePass: - { - prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty; - return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.PassTag.Id; - } - case TemplateModuleDataType.ModuleInputVert: - { - prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty; - return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.InputsVertTag.Id; - } - case TemplateModuleDataType.ModuleInputFrag: - { - prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix : string.Empty; - return prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.InputsFragTag.Id; - } - case TemplateModuleDataType.PassVertexFunction: - { - prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix : string.Empty; - return prefix + m_subShaders[ subShaderId ].Passes[ passId ].VertexFunctionData.Id; - } - case TemplateModuleDataType.PassFragmentFunction: - { - prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix : string.Empty; - return prefix + m_subShaders[ subShaderId ].Passes[ passId ].FragmentFunctionData.Id; - } - case TemplateModuleDataType.PassVertexData: - { - prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix : string.Empty; - return prefix + m_subShaders[ subShaderId ].Passes[ passId ].VertexDataContainer.VertexDataId; - } - case TemplateModuleDataType.PassInterpolatorData: - { - prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix : string.Empty; - return prefix + m_subShaders[ subShaderId ].Passes[ passId ].InterpolatorDataContainer.InterpDataId; - } - case TemplateModuleDataType.VControl: - { - prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix : string.Empty; - return prefix + m_subShaders[ subShaderId ].Passes[ passId ].TessVControlTag.Id; - } - case TemplateModuleDataType.ControlData: - { - prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix : string.Empty; - return prefix + m_subShaders[ subShaderId ].Passes[ passId ].TessControlData.Id; - } - case TemplateModuleDataType.DomainData: - { - prefix = addPrefix ? m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix : string.Empty; - return prefix + m_subShaders[ subShaderId ].Passes[ passId ].TessDomainData.Id; - } - } - return string.Empty; - } - - public void SetPassData( TemplateModuleDataType type, int subShaderId, int passId, string[] list ) - { - //if( list == null || list.Length == 0 ) - // return; - - string id = GetPassDataId( type, subShaderId, passId, false ); - string body = string.Empty; - FillTemplateBody( subShaderId, passId, id, ref body, list ); - SetPassData( type, subShaderId, passId, body ); - } - - public void SetPassData( TemplateModuleDataType type, int subShaderId, int passId, List<PropertyDataCollector> list ) - { - //if( list == null || list.Count == 0 ) - // return; - - string id = GetPassDataId( type, subShaderId, passId, false ); - string body = string.Empty; - FillTemplateBody( subShaderId, passId, id, ref body, list ); - SetPassData( type, subShaderId, passId, body ); - } - - public void SetPassData( TemplateModuleDataType type, int subShaderId, int passId, string text ) - { - if( subShaderId >= m_subShaders.Count || passId >= m_subShaders[ subShaderId ].Passes.Count ) - return; - - string prefix = string.Empty; - switch( type ) - { - //case TemplateModuleDataType.EndPass: - //{ - // prefix = m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix; - // m_templateIdManager.SetReplacementText( prefix + TemplatesManager.TemplateEndPassTag, text ); - //} - //break; - case TemplateModuleDataType.AllModules: - { - prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix; - m_templateIdManager.SetReplacementText( prefix + TemplatesManager.TemplateAllModulesTag, text ); - } - break; - case TemplateModuleDataType.ModuleShaderModel: - { - prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix; - m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.ShaderModel.Id, text ); - } - break; - case TemplateModuleDataType.ModuleBlendMode: - { - prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix; - m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.BlendData.BlendModeId, text ); - } - break; - case TemplateModuleDataType.ModuleBlendOp: - { - prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix; - m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.BlendData.BlendOpId, text ); - } - break; - case TemplateModuleDataType.ModuleAlphaToMask: - { - prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix; - m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.BlendData.AlphaToMaskId, text ); - } - break; - case TemplateModuleDataType.ModuleCullMode: - { - prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix; - m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.CullModeData.CullModeId, text ); - } - break; - case TemplateModuleDataType.ModuleColorMask: - { - prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix; - m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.ColorMaskData.ColorMaskId, text ); - } - break; - case TemplateModuleDataType.ModuleStencil: - { - prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix; - m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.StencilData.StencilBufferId, text ); - } - break; - case TemplateModuleDataType.ModuleZwrite: - { - prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix; - m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.DepthData.ZWriteModeId, text ); - } - break; - case TemplateModuleDataType.ModuleZTest: - { - prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix; - m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.DepthData.ZTestModeId, text ); - } - break; - case TemplateModuleDataType.ModuleZOffset: - { - prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix; - m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.DepthData.OffsetId, text ); - } - break; - case TemplateModuleDataType.ModuleTag: - { - prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix; - m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.TagData.TagsId, text ); - } - break; - case TemplateModuleDataType.ModuleGlobals: - { - prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix; - m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.GlobalsTag.Id, text ); - } - break; - case TemplateModuleDataType.ModuleSRPBatcher: - { - prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix; - m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.SRPBatcherTag.Id, text ); - } - break; - case TemplateModuleDataType.ModuleFunctions: - { - prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix; - m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.FunctionsTag.Id, text ); - } - break; - case TemplateModuleDataType.ModulePragma: - { - prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix; - m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.PragmaTag.Id, text ); - } - break; - case TemplateModuleDataType.ModulePragmaBefore: - { - prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix; - m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.PragmaBeforeTag.Id, text ); - } - break; - case TemplateModuleDataType.ModulePass: - { - prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix; - m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.PassTag.Id, text ); - } - break; - case TemplateModuleDataType.ModuleInputVert: - { - prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix; - m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.InputsVertTag.Id, text ); - } - break; - case TemplateModuleDataType.ModuleInputFrag: - { - prefix = m_subShaders[ subShaderId ].Passes[ passId ].Modules.UniquePrefix; - m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].Modules.InputsFragTag.Id, text ); - } - break; - case TemplateModuleDataType.PassVertexFunction: - { - prefix = m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix; - m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].VertexFunctionData.Id, text ); - } - break; - case TemplateModuleDataType.PassFragmentFunction: - { - prefix = m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix; - m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].FragmentFunctionData.Id, text ); - } - break; - case TemplateModuleDataType.PassVertexData: - { - prefix = m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix; - m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].VertexDataContainer.VertexDataId, text ); - } - break; - case TemplateModuleDataType.PassInterpolatorData: - { - prefix = m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix; - m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].InterpolatorDataContainer.InterpDataId, text ); - } - break; - case TemplateModuleDataType.PassNameData: - { - prefix = m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix; - m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].PassNameContainer.Id, text ); - } - break; - case TemplateModuleDataType.VControl: - { - prefix = m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix; - m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].TessVControlTag.Id, text ); - } - break; - case TemplateModuleDataType.ControlData: - { - prefix = m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix; - m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].TessControlData.Id, text ); - } - break; - case TemplateModuleDataType.DomainData: - { - prefix = m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix; - m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].TessDomainData.Id, text ); - } - break; - } - } - - public void SetPassInputData( int subShaderId, int passId, int inputId, string text ) - { - if( subShaderId >= m_subShaders.Count || - passId >= m_subShaders[ subShaderId ].Passes.Count ) - return; - - string prefix = m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix; - TemplateInputData inputData = m_subShaders[ subShaderId ].Passes[ passId ].InputDataFromId( inputId ); - if( inputData != null ) - { - m_templateIdManager.SetReplacementText( prefix + inputData.TagId, text ); - } - else - { - Debug.LogErrorFormat( "Unable to find input data for port with id {0} on subshader {1} pass {2}", inputId, subShaderId, passId ); - } - } - - public void SetPassInputDataByArrayIdx( int subShaderId, int passId, int inputId, string text ) - { - if( subShaderId >= m_subShaders.Count || - passId >= m_subShaders[ subShaderId ].Passes.Count || - inputId >= m_subShaders[ subShaderId ].Passes[ passId ].InputDataList.Count ) - return; - - string prefix = m_subShaders[ subShaderId ].Passes[ passId ].UniquePrefix; - m_templateIdManager.SetReplacementText( prefix + m_subShaders[ subShaderId ].Passes[ passId ].InputDataList[ inputId ].TagId, text ); - } - - public TemplateData CreateTemplateData( string name, string guid, int subShaderId, int passId ) - { - if( subShaderId >= m_subShaders.Count || - passId >= m_subShaders[ subShaderId ].Passes.Count ) - return null; - - if( string.IsNullOrEmpty( name ) ) - name = m_defaultShaderName; - - TemplateData templateData = ScriptableObject.CreateInstance<TemplateData>(); - templateData.Name = name; - templateData.GUID = guid; - templateData.TemplateBody = m_shaderBody; - templateData.DefaultShaderName = m_defaultShaderName; - templateData.ShaderNameId = m_shaderNameId; - templateData.OrderId = m_orderId; - - templateData.InputDataList = SubShaders[ subShaderId ].Passes[ passId ].InputDataList; - templateData.VertexDataContainer = SubShaders[ subShaderId ].Passes[ passId ].VertexDataContainer; - templateData.InterpolatorDataContainer = SubShaders[ subShaderId ].Passes[ passId ].InterpolatorDataContainer; - templateData.AvailableShaderProperties = m_availableShaderProperties; - templateData.VertexFunctionData = SubShaders[ subShaderId ].Passes[ passId ].VertexFunctionData; - templateData.FragmentFunctionData = SubShaders[ subShaderId ].Passes[ passId ].FragmentFunctionData; - templateData.BlendData = SubShaders[ subShaderId ].Passes[ passId ].Modules.BlendData; - templateData.CullModeData = SubShaders[ subShaderId ].Passes[ passId ].Modules.CullModeData; - templateData.ColorMaskData = SubShaders[ subShaderId ].Passes[ passId ].Modules.ColorMaskData; - templateData.StencilData = SubShaders[ subShaderId ].Passes[ passId ].Modules.StencilData; - templateData.DepthData = SubShaders[ subShaderId ].Passes[ passId ].Modules.DepthData; - templateData.TagData = SubShaders[ subShaderId ].Passes[ passId ].Modules.TagData; - - //templateData.PropertyList = m_pr; - //private Dictionary<string, TemplateProperty> m_propertyDict = new Dictionary<string, TemplateProperty>(); - - return templateData; - } - - public bool FillTemplateBody( int subShaderId, int passId, string id, ref string body, List<PropertyDataCollector> values ) - { - if( values.Count == 0 ) - { - return true; - } - - string[] array = new string[ values.Count ]; - for( int i = 0; i < values.Count; i++ ) - { - array[ i ] = values[ i ].PropertyName; - } - return FillTemplateBody( subShaderId, passId, id, ref body, array ); - } - - public bool FillTemplateBody( int subShaderId, int passId, string id, ref string body, params string[] values ) - { - if( values.Length == 0 ) - { - if( id[ id.Length - 1 ] == '\n' ) - body = "\n"; - - return true; - } - - TemplatePropertyContainer propertyContainer = null; - if( subShaderId >= 0 ) - { - if( passId >= 0 ) - { - propertyContainer = SubShaders[ subShaderId ].Passes[ passId ].TemplateProperties; - } - else - { - propertyContainer = SubShaders[ subShaderId ].TemplateProperties; - } - } - else - { - propertyContainer = m_templateProperties; - } - - propertyContainer.BuildInfo(); - - if( propertyContainer.PropertyDict.ContainsKey( id ) ) - { - string finalValue = propertyContainer.PropertyDict[ id ].UseIndentationAtStart ? propertyContainer.PropertyDict[ id ].Indentation : string.Empty; - for( int i = 0; i < values.Length; i++ ) - { - - if( propertyContainer.PropertyDict[ id ].AutoLineFeed ) - { - string[] valuesArr = values[ i ].Split( '\n' ); - for( int j = 0; j < valuesArr.Length; j++ ) - { - //first value will be automatically indented by the string replace - finalValue += ( ( i == 0 && j == 0 ) ? string.Empty : propertyContainer.PropertyDict[ id ].Indentation ) + valuesArr[ j ]; - finalValue += TemplatesManager.TemplateNewLine; - } - } - else - { - //first value will be automatically indented by the string replace - finalValue += ( i == 0 ? string.Empty : propertyContainer.PropertyDict[ id ].Indentation ) + values[ i ]; - } - } - - body = finalValue; - propertyContainer.PropertyDict[ id ].Used = true; - return true; - } - - if( values.Length > 1 || !string.IsNullOrEmpty( values[ 0 ] ) ) - { - UIUtils.ShowMessage( string.Format( "Attempting to write data into inexistant tag {0}. Please review the template {1} body and consider adding the missing tag.", id, m_defaultShaderName ), MessageSeverity.Error ); - return false; - } - return true; - } - - public bool FillVertexInstructions( int subShaderId, int passId, params string[] values ) - { - TemplateFunctionData vertexFunctionData = SubShaders[ subShaderId ].Passes[ passId ].VertexFunctionData; - if( vertexFunctionData != null && !string.IsNullOrEmpty( vertexFunctionData.Id ) ) - { - string body = string.Empty; - bool isValid = FillTemplateBody( subShaderId, passId, vertexFunctionData.Id, ref body, values ); - SetPassData( TemplateModuleDataType.PassVertexFunction, subShaderId, passId, body ); - return isValid; - } - - if( values.Length > 0 ) - { - UIUtils.ShowMessage( "Attemping to add vertex instructions on a template with no assigned vertex code area", MessageSeverity.Error ); - return false; - } - return true; - } - - public bool FillFragmentInstructions( int subShaderId, int passId, params string[] values ) - { - TemplateFunctionData fragmentFunctionData = SubShaders[ subShaderId ].Passes[ passId ].FragmentFunctionData; - if( fragmentFunctionData != null && !string.IsNullOrEmpty( fragmentFunctionData.Id ) ) - { - string body = string.Empty; - bool isValid = FillTemplateBody( subShaderId, passId, fragmentFunctionData.Id, ref body, values ); - SetPassData( TemplateModuleDataType.PassFragmentFunction, subShaderId, passId, body ); - return isValid; - } - - if( values.Length > 0 ) - { - UIUtils.ShowMessage( "Attemping to add fragment instructions on a template with no assigned vertex code area", MessageSeverity.Error ); - return false; - } - return true; - } - - public void SetShaderName( string name ) - { - m_templateIdManager.SetReplacementText( m_shaderNameId, name ); - } - - public void SetCustomInspector( string customInspector ) - { - if( m_customInspectorContainer.Index > -1 ) - { - m_templateIdManager.SetReplacementText( m_customInspectorContainer.Id, m_templateProperties.PropertyDict[ m_customInspectorContainer.Id ].Indentation + customInspector ); - } - } - - public void SetFallback( string fallback ) - { - if( m_fallbackContainer.Index > -1 ) - { - m_templateIdManager.SetReplacementText( m_fallbackContainer.Id, m_templateProperties.PropertyDict[ m_fallbackContainer.Id ].Indentation + fallback ); - } - } - - public void SetDependencies( string dependencies ) - { - if( m_dependenciesContainer.Index > -1 ) - { - m_templateIdManager.SetReplacementText( m_dependenciesContainer.Id, dependencies ); - } - } - - private void OnEnable() - { - hideFlags = HideFlags.HideAndDontSave; - } - - public override bool Reload() - { - m_propertyTag = null; - m_shaderNameId = string.Empty; - m_shaderBody = string.Empty; - m_isSinglePass = false; - m_masterNodesRequired = 0; - m_beforePragmaContainer.Reset(); - m_customInspectorContainer.Reset(); - m_fallbackContainer.Reset(); - m_dependenciesContainer.Reset(); - m_availableShaderProperties.Clear(); - int count = m_subShaders.Count; - for( int i = 0; i < count; i++ ) - { - m_subShaders[ i ].Destroy(); - } - m_subShaders.Clear(); - - m_templateIdManager.Reset(); - if( m_shaderData != null ) - m_shaderData.Destroy(); - - m_templateProperties.Reset(); - - string oldName = m_defaultShaderName; - LoadTemplateBody( m_guid ); - - if( m_communityTemplate ) - Name = m_defaultShaderName; - - return !oldName.Equals( m_defaultShaderName ); - } - - public bool GetSubShaderandPassFor( string passUniqueId, ref int subShaderId, ref int passId ) - { - if( string.IsNullOrEmpty( passUniqueId ) ) - return false; - - if( m_passUniqueIdData.Count == 0 ) - { - for( int subShaderIdx = 0; subShaderIdx < m_subShaders.Count; subShaderIdx++ ) - { - for( int passIdx = 0; passIdx < m_subShaders[ subShaderIdx ].Passes.Count; passIdx++ ) - { - if( m_subShaders[ subShaderIdx ].Passes[ passIdx ].Modules.HasPassUniqueName ) - { - if( m_passUniqueIdData.ContainsKey( m_subShaders[ subShaderIdx ].Passes[ passIdx ].Modules.PassUniqueName ) ) - { - Debug.LogErrorFormat( "Found duplicate pass name '{0}' over template. Please fix template as it will result in multiple errors.", m_subShaders[ subShaderIdx ].Passes[ passIdx ].Modules.PassUniqueName ); - return false; - } - m_passUniqueIdData.Add( m_subShaders[ subShaderIdx ].Passes[ passIdx ].Modules.PassUniqueName, new TemplateUniquePassData() { PassIdx = passIdx, SubShaderIdx = subShaderIdx } ); - } - } - } - } - - if( m_passUniqueIdData.ContainsKey( passUniqueId ) ) - { - subShaderId = m_passUniqueIdData[ passUniqueId ].SubShaderIdx; - passId = m_passUniqueIdData[ passUniqueId ].PassIdx; - return true; - } - subShaderId = -1; - passId = -1; - return false; - } - - public TemplateShaderPropertyData GetShaderPropertyData( string propertyName ) - { - return m_availableShaderProperties.Find( ( x ) => ( x.PropertyName.Equals( propertyName ) ) ); - } - - public TemplateSRPType SRPtype { get { return m_subShaders[ 0 ].Modules.SRPType; } } - //public bool SRPIsPBRHD { get { return m_subShaders[0].Modules.SRPIsPBRHD ; } } - public List<TemplateSubShader> SubShaders { get { return m_subShaders; } } - public List<TemplateShaderPropertyData> AvailableShaderProperties { get { return m_availableShaderProperties; } } - public TemplateTagData PropertyTag { get { return m_propertyTag; } } - public TemplateIdManager IdManager { get { return m_templateIdManager; } } - public TemplatePropertyContainer TemplateProperties { get { return m_templateProperties; } } - public TemplateInfoContainer CustomInspectorContainer { get { return m_customInspectorContainer; } } - public TemplateInfoContainer FallbackContainer { get { return m_fallbackContainer; } } - public TemplateInfoContainer BeforePragmaContainer { get { return m_beforePragmaContainer; } } - public bool IsSinglePass { get { return m_isSinglePass; } } - public int MasterNodesRequired { get { return m_masterNodesRequired; } } - public CustomTemplatePropertyUIEnum CustomTemplatePropertyUI { get { return m_customTemplatePropertyUI; } } - public bool CanAddLODs { get { return m_lodInjectorId > -1; } } - public TemplateShaderModelData GlobalShaderModel { get { return m_globalShaderModel; } } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMultiPass.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMultiPass.cs.meta deleted file mode 100644 index 00e2dee2..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMultiPass.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 4214390aa7f66364bbab454dc15a04ac -timeCreated: 1516981847 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMultiPassMasterNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMultiPassMasterNode.cs deleted file mode 100644 index 92ce5c77..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMultiPassMasterNode.cs +++ /dev/null @@ -1,3113 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> -//#define SHOW_TEMPLATE_HELP_BOX - -using System; -using System.Collections.Generic; -using UnityEngine; -using UnityEditor; - -namespace AmplifyShaderEditor -{ - public enum HDSRPMaterialType - { - SubsurfaceScattering, - Standard, - Specular, - Anisotropy, - Iridescence, - Translucent - } - - public enum InvisibilityStatus - { - LockedInvisible, - Invisible, - Visible - } - - public enum SetTemplateSource - { - NewShader, - ShaderLoad, - HotCodeReload - }; - - [Serializable] - [NodeAttributes( "Template Master Node", "Master", "Shader Generated according to template rules", null, KeyCode.None, false )] - public sealed class TemplateMultiPassMasterNode : MasterNode - { - private const double MaxLODEditTimestamp = 1; - - private static int PASS_SELECTOR_VERSION = 16200; - private static int PASS_UNIQUE_ID_VERSION = 16204; - - private const string LodNameId = "LODName"; - private const string LodValueId = "LODValue"; - - private const string LodSubtitle = "LOD( {0} )"; - private const string AdditionalLODsStr = "LODs"; - - private const string SubTitleFormatterStr = "(SubShader {0} Pass {1})"; - private const string NoSubShaderPropertyStr = "No Sub-Shader properties available"; - private const string NoPassPropertyStr = "No Pass properties available"; - - private const string WarningMessage = "Templates is a feature that is still heavily under development and users may experience some problems.\nPlease email support@amplify.pt if any issue occurs."; - private const string OpenTemplateStr = "Edit Template"; - private const string ReloadTemplateStr = "Reload Template"; - private const string CommonPropertiesStr = "Common Properties "; - private const string SubShaderModuleStr = "SubShader "; - private const string PassModuleStr = "Pass "; - - private const string PassNameStr = "Name"; - private const string PassNameFormateStr = "Name \"{0}\""; - private const string SubShaderLODValueLabel = "LOD Value"; - private const string SubShaderLODNameLabel = "LOD Name"; - - - - private bool m_reRegisterTemplateData = false; - private bool m_fireTemplateChange = false; - private bool m_fetchMasterNodeCategory = false; - - [SerializeField] - private string m_templateGUID = "4e1801f860093ba4f9eb58a4b556825b"; - - [SerializeField] - private int m_passIdx = 0; - - //[SerializeField] - //private string m_passIdxStr = string.Empty; - - [SerializeField] - private bool m_passFoldout = false; - - [SerializeField] - private int m_subShaderIdx = 0; - - //[SerializeField] - //private string m_subShaderIdxStr = string.Empty; - - [SerializeField] - private bool m_subStringFoldout = false; - - [SerializeField] - private bool m_lodFoldout = false; - - - [SerializeField] - private string m_mainLODName = string.Empty; - - //[SerializeField] - //private string m_subShaderLODStr; - - //[SerializeField] - //private bool m_mainMPMasterNode = false; - - [NonSerialized] - private TemplateMultiPass m_templateMultiPass = null; - - [NonSerialized] - private TemplateMultiPassMasterNode m_mainMasterNodeRef = null; - - [SerializeField] - private TemplateModulesHelper m_subShaderModule = new TemplateModulesHelper(); - - [SerializeField] - private TemplateModulesHelper m_passModule = new TemplateModulesHelper(); - - [SerializeField] - private UsePassHelper m_usePass; - - [SerializeField] - private string m_passName = string.Empty; - - [SerializeField] - private string m_passUniqueId = string.Empty; - - [SerializeField] - private string m_originalPassName = string.Empty; - - [SerializeField] - private bool m_hasLinkPorts = false; - - [SerializeField] - private InvisibilityStatus m_isInvisible = InvisibilityStatus.Visible; - - [SerializeField] - private int m_invisibleOptions = 0; - - [SerializeField] - private bool m_invalidNode = false; - - [SerializeField] - private FallbackPickerHelper m_fallbackHelper = null; - - [SerializeField] - private DependenciesHelper m_dependenciesHelper = new DependenciesHelper(); - - [SerializeField] - private TemplateOptionsUIHelper m_subShaderOptions = new TemplateOptionsUIHelper( true ); - - [SerializeField] - private TemplateOptionsUIHelper m_passOptions = new TemplateOptionsUIHelper( false ); - - [SerializeField] - private TemplatePassSelectorHelper m_passSelector = new TemplatePassSelectorHelper(); - - [SerializeField] - private TemplateOptionsDefinesContainer m_optionsDefineContainer = new TemplateOptionsDefinesContainer(); - - [SerializeField] - private TerrainDrawInstancedHelper m_drawInstancedHelper = new TerrainDrawInstancedHelper(); - - // HATE THIS BELOW, MUST REMOVE HD SPECIFIC CODE FROM GENERIC MASTER NODE - private const string HDSRPMaterialTypeStr = "Material Type"; - private const string SRPMaterialSubsurfaceScatteringKeyword = "_MATERIAL_FEATURE_SUBSURFACE_SCATTERING 1"; - private const string SRPMaterialTransmissionKeyword = "_MATERIAL_FEATURE_TRANSMISSION 1"; - private const string SRPHDMaterialSpecularKeyword = "_MATERIAL_FEATURE_SPECULAR_COLOR 1"; - //private const string SRPLWMaterialSpecularKeyword = "_SPECULAR_SETUP 1"; - private const string SRPMaterialAnisotropyKeyword = "_MATERIAL_FEATURE_ANISOTROPY 1"; - private const string SRPMaterialIridiscenceKeyword = "_MATERIAL_FEATURE_IRIDESCENCE 1"; - //private const string SRPMaterialNormalMapKeyword = "_NORMALMAP 1"; - //private const string SRPMaterialAlphaTestKeyword = "_ALPHATEST_ON 1"; - //private const string SRPMaterialBlendModeAlphaClipThresholdKeyword = "_AlphaClip 1"; - private const string SRPMaterialTransparentKeyword = "_SURFACE_TYPE_TRANSPARENT 1"; - private const string SRPMaterialBlendModeAddKeyword = "_BLENDMODE_ADD 1"; - private const string SRPMaterialBlendModeAlphaKeyword = "_BLENDMODE_ALPHA 1"; - private const string SRPMaterialClearCoatKeyword = "_MATERIAL_FEATURE_CLEAR_COAT"; - - [NonSerialized] - private bool m_fetchPorts = true; - [NonSerialized] - private InputPort m_specularPort; - [NonSerialized] - private InputPort m_metallicPort; - [NonSerialized] - private InputPort m_coatMaskPort; - [NonSerialized] - private InputPort m_diffusionProfilePort; - [NonSerialized] - private InputPort m_subsurfaceMaskPort; - [NonSerialized] - private InputPort m_thicknessPort; - [NonSerialized] - private InputPort m_anisotropyPort; - [NonSerialized] - private InputPort m_iridescenceThicknessPort; - [NonSerialized] - private InputPort m_iridescenceMaskPort; - [NonSerialized] - private InputPort m_indexOfRefractionPort; - [NonSerialized] - private InputPort m_transmittanceColorPort; - [NonSerialized] - private InputPort m_transmittanceAbsorptionDistancePort; - [NonSerialized] - private InputPort m_transmittanceMaskPort; - - [SerializeField] - private HDSRPMaterialType m_hdSrpMaterialType = HDSRPMaterialType.Standard; - - [NonSerialized] - private bool m_refreshLODValueMasterNodes = false; - [NonSerialized] - private bool m_refocusLODValueMasterNodes = false; - [NonSerialized] - private double m_refreshLODValueMasterNodesTimestamp; - - ////////////////////////////////////////////////////////////////////////// - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_masterNodeCategory = 1;// First Template - m_marginPreviewLeft = 20; - m_shaderNameIsTitle = true; - m_customInspectorName = string.Empty; - m_customPrecision = true; - } - - public override void ReleaseResources() - { - // Internal template resources ( for inline properties) are released by first node on the list - // As it's also registered that way - if( IsLODMainFirstPass ) - m_containerGraph.ClearInternalTemplateNodes(); - - if( !IsLODMainMasterNode ) - return; - TemplateMultiPass template = ( m_templateMultiPass == null ) ? m_containerGraph.ParentWindow.TemplatesManagerInstance.GetTemplate( m_templateGUID ) as TemplateMultiPass : m_templateMultiPass; - //Maintained the logic of being the main master node to unregister since this method is being called - //over the main master node in multiple places - //but it will unregister with unique of the first master node (pass 0) since it was the one - //to register it - int passUniqueId = ( m_passIdx == 0 ) ? UniqueId : ContainerGraph.MultiPassMasterNodes.NodesList[ 0 ].UniqueId; - - if( template != null && template.AvailableShaderProperties != null ) - { - // Unregister old template properties - int oldPropertyCount = template.AvailableShaderProperties.Count; - for( int i = 0; i < oldPropertyCount; i++ ) - { - UIUtils.ReleaseUniformName( passUniqueId, template.AvailableShaderProperties[ i ].PropertyName ); - } - } - } - - public void CopyOptionsFrom( TemplateMultiPassMasterNode origin ) - { - //Copy options - SubShaderOptions.CopyOptionsValuesFrom( origin.SubShaderOptions ); - PassOptions.CopyOptionsValuesFrom( origin.PassOptions ); - - //Copy selected passes - if( IsMainOutputNode ) - m_passSelector.CopyFrom( origin.PassSelector ); - } - - void RegisterProperties() - { - //First pass must be the one to always register properties so all modules - //can extract a valid negative Id when reading inline properties - if( /*!IsLODMainMasterNode*/!IsLODMainFirstPass ) - { - m_reRegisterTemplateData = false; - return; - } - - if( m_templateMultiPass != null ) - { - m_reRegisterTemplateData = false; - // Register old template properties - int newPropertyCount = m_templateMultiPass.AvailableShaderProperties.Count; - for( int i = 0; i < newPropertyCount; i++ ) - { - m_containerGraph.AddInternalTemplateNode( m_templateMultiPass.AvailableShaderProperties[ i ] ); - int nodeId = UIUtils.CheckUniformNameOwner( m_templateMultiPass.AvailableShaderProperties[ i ].PropertyName ); - if( nodeId > -1 ) - { - if( UniqueId != nodeId ) - { - ParentNode node = m_containerGraph.GetNode( nodeId ); - if( node != null ) - { - UIUtils.ShowMessage( string.Format( "Template requires property name {0} which is currently being used by {1}. Please rename it and reload template.", m_templateMultiPass.AvailableShaderProperties[ i ].PropertyName, node.Attributes.Name ) ); - } - else - { - UIUtils.ShowMessage( string.Format( "Template requires property name {0} which is currently being on your graph. Please rename it and reload template.", m_templateMultiPass.AvailableShaderProperties[ i ].PropertyName ) ); - } - } - } - else - { - UIUtils.RegisterUniformName( UniqueId, m_templateMultiPass.AvailableShaderProperties[ i ].PropertyName ); - } - } - } - } - - public override void OnEnable() - { - base.OnEnable(); - m_reRegisterTemplateData = true; - - if( m_usePass == null ) - { - m_usePass = ScriptableObject.CreateInstance<UsePassHelper>(); - m_usePass.Init( " Additional Use Passes" ); - } - - if( m_fallbackHelper == null ) - { - m_fallbackHelper = ScriptableObject.CreateInstance<FallbackPickerHelper>(); - m_fallbackHelper.Init(); - } - } - - protected override void OnUniqueIDAssigned() - { - base.OnUniqueIDAssigned(); - if( UniqueId >= 0 ) - { - if( m_lodIndex == -1 ) - { - m_containerGraph.MultiPassMasterNodes.AddNode( this ); - } - else - { - m_containerGraph.LodMultiPassMasternodes[ m_lodIndex ].AddNode( this ); - } - } - } - - public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) - { - base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); - m_passOptions.CheckImediateActionsForPort( this, portId ); - } - - public override void OnInputPortDisconnected( int portId ) - { - base.OnInputPortDisconnected( portId ); - m_passOptions.CheckImediateActionsForPort( this, portId ); - } - - public void ForceTemplateRefresh() - { - SetTemplate( null, false, true, m_subShaderIdx, m_passIdx, SetTemplateSource.HotCodeReload ); - } - - public void SetTemplate( TemplateMultiPass template, bool writeDefaultData, bool fetchMasterNodeCategory, int subShaderIdx, int passIdx , SetTemplateSource source ) - { - if( subShaderIdx > -1 ) - m_subShaderIdx = subShaderIdx; - - if( passIdx > -1 ) - m_passIdx = passIdx; - - ReleaseResources(); - bool hotCodeOrRead = ( template == null ); - m_templateMultiPass = ( hotCodeOrRead ) ? m_containerGraph.ParentWindow.TemplatesManagerInstance.GetTemplate( m_templateGUID ) as TemplateMultiPass : template; - if( m_templateMultiPass != null ) - { - - string passName = string.IsNullOrEmpty( m_passUniqueId ) ? ( m_isInvisible == InvisibilityStatus.LockedInvisible ? m_passName : m_originalPassName ) : m_passUniqueId; - int newPassIdx = m_passIdx; - int newSubShaderIdx = m_subShaderIdx; - m_templateMultiPass.GetSubShaderandPassFor( passName, ref newSubShaderIdx, ref newPassIdx ); - if( newPassIdx == -1 || newSubShaderIdx == -1 ) - { - //m_containerGraph.MarkToDelete( this ); - ContainerGraph.ParentWindow.SetOutdatedShaderFromTemplate(); - m_invalidNode = true; - UIUtils.ShowMessage( "Template changed drastically. Removing invalid passes." ); - return; - } - else - { - if( m_passIdx != newPassIdx ) - m_passIdx = newPassIdx; - - if( m_subShaderIdx != newSubShaderIdx ) - m_subShaderIdx = newSubShaderIdx; - } - - m_containerGraph.CurrentSRPType = m_templateMultiPass.SRPtype; - if( m_templateMultiPass.IsSinglePass ) - { - SetAdditonalTitleText( string.Empty ); - } - else if( m_templateMultiPass.SubShaders[ 0 ].MainPass != m_passIdx ) - { - SetAdditonalTitleText( string.Format( SubTitleFormatterStr, m_subShaderIdx, m_passIdx ) ); - } - m_invalidNode = false; - if( m_subShaderIdx >= m_templateMultiPass.SubShaders.Count || - m_passIdx >= m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes.Count ) - { - if( DebugConsoleWindow.DeveloperMode ) - Debug.LogFormat( "Inexisting pass {0}. Cancelling template fetch", m_originalPassName ); - - return; - } - - m_isMainOutputNode = m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].IsMainPass; - if( m_isMainOutputNode ) - { - // We cannot use UIUtils.MasterNodeOnTexture.height since this method can be - // called before UIUtils is initialized - m_insideSize.y = 55; - } - else - { - m_insideSize.y = 0; - } - - //IsMainOutputNode = m_mainMPMasterNode; - if( source != SetTemplateSource.HotCodeReload ) - { - //Only set this if no hotcode reload happens ( via new shader or load ) - m_isInvisible = m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].IsInvisible ? InvisibilityStatus.LockedInvisible : InvisibilityStatus.Visible; - } - else - { - // On hot code reload we only need to verify if template pass visibility data changes - // and change accordingly - if( m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].IsInvisible ) - { - if( m_isInvisible != InvisibilityStatus.LockedInvisible ) - m_isInvisible = InvisibilityStatus.LockedInvisible; - } - else - { - if( m_isInvisible == InvisibilityStatus.LockedInvisible ) - { - m_isInvisible = InvisibilityStatus.Visible; - } - } - } - - m_invisibleOptions = m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].InvisibleOptions; - - m_originalPassName = m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].PassNameContainer.Data; - - if( !hotCodeOrRead ) - { - if( m_templateMultiPass.SubShaders[ m_subShaderIdx ].LODContainer.Index > -1 ) - { - //m_subShaderLODStr = m_templateMultiPass.SubShaders[ m_subShaderIdx ].LODContainer.Id; - ShaderLOD = Convert.ToInt32( m_templateMultiPass.SubShaders[ m_subShaderIdx ].LODContainer.Data ); - } - else - { - ShaderLOD = 0; - } - } - - m_shaderNameIsTitle = IsMainOutputNode; - m_fetchMasterNodeCategory = fetchMasterNodeCategory; - m_templateGUID = m_templateMultiPass.GUID; - UpdatePortInfo(); - - RegisterProperties(); - - // template is null when hot code reloading or loading from file so inspector name shouldn't be changed - if( !hotCodeOrRead ) - { - m_customInspectorName = m_templateMultiPass.CustomInspectorContainer.Data; - if( m_isMainOutputNode ) - { - m_passSelector.Clear(); - m_passSelector.Setup( m_templateMultiPass.SubShaders[ m_subShaderIdx ] ); - } - } - else - { - //Hotcode reload or ReadFromString - // Setup is only made if internal pass array is null - if( m_isMainOutputNode ) - { - m_passSelector.Setup( m_templateMultiPass.SubShaders[ m_subShaderIdx ] ); - } - } - - SetupCustomOptionsFromTemplate( template != null ); - - if( string.IsNullOrEmpty( m_fallbackHelper.RawFallbackShader ) ) - m_fallbackHelper.RawFallbackShader = m_templateMultiPass.FallbackContainer.Data; - - //bool updateInfofromTemplate = UpdatePortInfo(); - //if( updateInfofromTemplate ) - //{ - m_subShaderModule.FetchDataFromTemplate( m_templateMultiPass.SubShaders[ m_subShaderIdx ].Modules ); - m_passModule.FetchDataFromTemplate( m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].Modules ); - //} - - //RegisterProperties(); - if( writeDefaultData ) - { - //ShaderName = m_templateMultiPass.DefaultShaderName; - ShaderName = m_shaderName; - m_passName = m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].PassNameContainer.Data; - if( !m_templateMultiPass.IsSinglePass /*&& !m_shaderNameIsTitle*/ ) - { - if( m_templateMultiPass.SubShaders[ 0 ].MainPass != m_passIdx ) - SetClippedTitle( m_passName ); - } - } - - UpdateSubShaderPassStr(); - - if( m_isMainOutputNode ) - m_fireTemplateChange = true; - } - else - { - m_invalidNode = true; - } - } - - public override void OnRefreshLinkedPortsComplete() - { - if( m_invalidNode ) - return; - - if( m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].Modules.SRPIsPBRHD ) - ConfigHDPorts(); - - SetReadOptions(); - } - - public void SetReadOptions() - { - m_passOptions.SetReadOptions(); - if( m_isMainOutputNode ) - m_subShaderOptions.SetReadOptions(); - } - - bool UpdatePortInfo() - { - List<TemplateInputData> inputDataList = m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].InputDataList; - int count = inputDataList.Count; - if( count != m_inputPorts.Count ) - { - DeleteAllInputConnections( true ); - - for( int i = 0; i < count; i++ ) - { - InputPort port = AddInputPort( inputDataList[ i ].DataType, false, inputDataList[ i ].PortName, inputDataList[ i ].OrderId, inputDataList[ i ].PortCategory, inputDataList[ i ].PortUniqueId ); - port.ExternalLinkId = inputDataList[ i ].LinkId; - m_hasLinkPorts = m_hasLinkPorts || !string.IsNullOrEmpty( inputDataList[ i ].LinkId ); - } - return true; - } - else - { - for( int i = 0; i < count; i++ ) - { - m_inputPorts[ i ].ChangeProperties( inputDataList[ i ].PortName, inputDataList[ i ].DataType, false ); - m_inputPorts[ i ].ExternalLinkId = inputDataList[ i ].LinkId; - } - return false; - } - } - - public void SetPropertyActionFromItem( TemplateModulesHelper module, TemplateActionItem item ) - { - TemplateModulesHelper subShaderModule = m_isMainOutputNode ? m_subShaderModule : m_mainMasterNodeRef.SubShaderModule; - switch( item.PropertyAction ) - { - case PropertyActionsEnum.CullMode: - { - if( item.CopyFromSubShader ) - { - module.CullModeHelper.CurrentCullMode = subShaderModule.CullModeHelper.CurrentCullMode; - } - else - { - module.CullModeHelper.CurrentCullMode = item.ActionCullMode; - } - - } - break; - case PropertyActionsEnum.ColorMask: - { - if( item.CopyFromSubShader ) - { - module.ColorMaskHelper.ColorMask = subShaderModule.ColorMaskHelper.ColorMask; - } - else - { - module.ColorMaskHelper.ColorMask = item.ColorMask; - } - } - break; - case PropertyActionsEnum.ZWrite: - { - if( item.CopyFromSubShader ) - { - module.DepthOphelper.ZWriteModeValue = subShaderModule.DepthOphelper.ZWriteModeValue; - } - else - { - module.DepthOphelper.ZWriteModeValue = item.ActionZWrite; - } - } - break; - case PropertyActionsEnum.ZTest: - { - if( item.CopyFromSubShader ) - { - module.DepthOphelper.ZTestModeValue = subShaderModule.DepthOphelper.ZTestModeValue; - } - else - { - module.DepthOphelper.ZTestModeValue = item.ActionZTest; - } - } - break; - case PropertyActionsEnum.ZOffsetFactor: - { - if( item.CopyFromSubShader ) - { - module.DepthOphelper.OffsetFactorValue = subShaderModule.DepthOphelper.OffsetFactorValue; - } - else - { - module.DepthOphelper.OffsetFactorValue = item.ActionZOffsetFactor; - } - } - break; - case PropertyActionsEnum.ZOffsetUnits: - { - if( item.CopyFromSubShader ) - { - module.DepthOphelper.OffsetUnitsValue = subShaderModule.DepthOphelper.OffsetUnitsValue; - } - else - { - module.DepthOphelper.OffsetUnitsValue = item.ActionZOffsetUnits; - } - } - break; - case PropertyActionsEnum.BlendRGB: - { - if( item.CopyFromSubShader ) - { - module.BlendOpHelper.SourceFactorRGB = subShaderModule.BlendOpHelper.SourceFactorRGB; - module.BlendOpHelper.DestFactorRGB = subShaderModule.BlendOpHelper.DestFactorRGB; - } - else - { - module.BlendOpHelper.SourceFactorRGB = item.ActionBlendRGBSource; - module.BlendOpHelper.DestFactorRGB = item.ActionBlendRGBDest; - } - } - break; - case PropertyActionsEnum.BlendAlpha: - { - if( item.CopyFromSubShader ) - { - module.BlendOpHelper.SourceFactorAlpha = subShaderModule.BlendOpHelper.SourceFactorAlpha; - module.BlendOpHelper.DestFactorAlpha = subShaderModule.BlendOpHelper.DestFactorAlpha; - } - else - { - module.BlendOpHelper.CurrentAlphaIndex = 1; - module.BlendOpHelper.SourceFactorAlpha = item.ActionBlendAlphaSource; - module.BlendOpHelper.DestFactorAlpha = item.ActionBlendAlphaDest; - } - } - break; - case PropertyActionsEnum.BlendOpRGB: - { - if( item.CopyFromSubShader ) - { - module.BlendOpHelper.BlendOpRGB = subShaderModule.BlendOpHelper.BlendOpRGB; - } - else - { - module.BlendOpHelper.BlendOpRGB = item.ActionBlendOpRGB; - } - } - break; - case PropertyActionsEnum.BlendOpAlpha: - { - if( item.CopyFromSubShader ) - { - module.BlendOpHelper.BlendOpAlpha = subShaderModule.BlendOpHelper.BlendOpAlpha; - } - else - { - module.BlendOpHelper.BlendOpAlpha = item.ActionBlendOpAlpha; - } - } - break; - case PropertyActionsEnum.StencilReference: - { - if( item.CopyFromSubShader ) - { - module.StencilBufferHelper.ReferenceValue = subShaderModule.StencilBufferHelper.ReferenceValue; - } - else - { - module.StencilBufferHelper.ReferenceValue = item.ActionStencilReference; - } - } - break; - case PropertyActionsEnum.StencilReadMask: - { - if( item.CopyFromSubShader ) - { - module.StencilBufferHelper.ReadMaskValue = subShaderModule.StencilBufferHelper.ReadMaskValue; - } - else - { - module.StencilBufferHelper.ReadMaskValue = item.ActionStencilReadMask; - } - } - break; - case PropertyActionsEnum.StencilWriteMask: - { - if( item.CopyFromSubShader ) - { - module.StencilBufferHelper.WriteMaskValue = subShaderModule.StencilBufferHelper.WriteMaskValue; - } - else - { - module.StencilBufferHelper.WriteMaskValue = item.ActionStencilWriteMask; - } - } - break; - case PropertyActionsEnum.StencilComparison: - { - if( item.CopyFromSubShader ) - { - module.StencilBufferHelper.ComparisonFunctionIdxValue = subShaderModule.StencilBufferHelper.ComparisonFunctionIdxValue; - } - else - { - module.StencilBufferHelper.ComparisonFunctionIdxValue = item.ActionStencilComparison; - } - } - break; - case PropertyActionsEnum.StencilPass: - { - if( item.CopyFromSubShader ) - { - module.StencilBufferHelper.PassStencilOpIdxValue = subShaderModule.StencilBufferHelper.PassStencilOpIdxValue; - } - else - { - module.StencilBufferHelper.PassStencilOpIdxValue = item.ActionStencilPass; - } - } - break; - case PropertyActionsEnum.StencilFail: - { - if( item.CopyFromSubShader ) - { - module.StencilBufferHelper.FailStencilOpIdxValue = subShaderModule.StencilBufferHelper.FailStencilOpIdxValue; - } - else - { - module.StencilBufferHelper.FailStencilOpIdxValue = item.ActionStencilFail; - } - } - break; - case PropertyActionsEnum.StencilZFail: - { - if( item.CopyFromSubShader ) - { - module.StencilBufferHelper.ZFailStencilOpIdxValue = subShaderModule.StencilBufferHelper.ZFailStencilOpIdxValue; - } - else - { - module.StencilBufferHelper.ZFailStencilOpIdxValue = item.ActionStencilZFail; - } - } - break; - case PropertyActionsEnum.RenderType: - { - module.TagsHelper.AddSpecialTag( TemplateSpecialTags.RenderType, item ); - } - break; - case PropertyActionsEnum.RenderQueue: - { - module.TagsHelper.AddSpecialTag( TemplateSpecialTags.Queue, item ); - } - break; - } - } - - public void OnCustomPassOptionSelected( bool isRefreshing, bool invertAction, TemplateOptionUIItem uiItem, params TemplateActionItem[] validActions ) - { - m_passOptions.OnCustomOptionSelected( isRefreshing, invertAction, this, uiItem, validActions ); - } - - public void OnCustomSubShaderOptionSelected( bool isRefreshing, bool invertAction, TemplateOptionUIItem uiItem, params TemplateActionItem[] validActions ) - { - if( m_isMainOutputNode ) - m_subShaderOptions.OnCustomOptionSelected( isRefreshing, invertAction, this, uiItem, validActions ); - } - - void SetupCustomOptionsFromTemplate( bool newTemplate ) - { - m_passOptions.SetupCustomOptionsFromTemplate( this, newTemplate ); - if( m_isMainOutputNode ) - m_subShaderOptions.SetupCustomOptionsFromTemplate( this, newTemplate ); - } - - void SetPassCustomOptionsInfo( TemplateMultiPassMasterNode masterNode ) - { - TemplateMultiPassMasterNode mainMasterNode = masterNode.IsMainOutputNode ? masterNode : ( m_containerGraph.CurrentMasterNode as TemplateMultiPassMasterNode ); - mainMasterNode.SubShaderOptions.SetSubShaderCustomOptionsPortsInfo( masterNode, ref m_currentDataCollector ); - masterNode.PassOptions.SetCustomOptionsInfo( masterNode, ref m_currentDataCollector ); - } - - void RefreshCustomOptionsDict() - { - m_passOptions.RefreshCustomOptionsDict(); - if( m_isMainOutputNode ) - m_subShaderOptions.RefreshCustomOptionsDict(); - } - - void SetCategoryIdxFromTemplate() - { - int templateCount = m_containerGraph.ParentWindow.TemplatesManagerInstance.TemplateCount; - for( int i = 0; i < templateCount; i++ ) - { - int idx = i + 1; - TemplateMultiPass templateData = m_containerGraph.ParentWindow.TemplatesManagerInstance.GetTemplate( i ) as TemplateMultiPass; - if( templateData != null && m_templateMultiPass != null && m_templateMultiPass.GUID.Equals( templateData.GUID ) ) - m_masterNodeCategory = idx; - } - } - - public void CheckTemplateChanges() - { - if( m_invalidNode ) - return; - - if( IsLODMainMasterNode ) - { - if( m_containerGraph.MultiPassMasterNodes.Count != m_templateMultiPass.MasterNodesRequired ) - { - if( m_availableCategories == null ) - RefreshAvailableCategories(); - - if( DebugConsoleWindow.DeveloperMode ) - Debug.Log( "Template Pass amount was changed. Rebuiling master nodes" ); - - m_containerGraph.ParentWindow.ReplaceMasterNode( m_availableCategories[ m_masterNodeCategory ], true ); - } - } - } - - public override void OnNodeLogicUpdate( DrawInfo drawInfo ) - { - if( m_invalidNode ) - { - return; - } - base.OnNodeLogicUpdate( drawInfo ); - - if( m_templateMultiPass == null ) - { - // Hotcode reload has happened - SetTemplate( null, false, true, m_subShaderIdx, m_passIdx , SetTemplateSource.HotCodeReload ); - CheckTemplateChanges(); - } - - if( m_reRegisterTemplateData ) - { - RegisterProperties(); - } - - if( m_fetchMasterNodeCategory ) - { - if( m_availableCategories != null ) - { - m_fetchMasterNodeCategory = false; - SetCategoryIdxFromTemplate(); - } - } - - if( m_fireTemplateChange ) - { - m_fireTemplateChange = false; - m_containerGraph.FireMasterNodeReplacedEvent(); - } - - if( m_subShaderModule.HasValidData ) - { - m_subShaderModule.OnLogicUpdate( m_templateMultiPass.SubShaders[ m_subShaderIdx ].Modules ); - } - - if( m_passModule.HasValidData ) - { - m_passModule.OnLogicUpdate( m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].Modules ); - } - - if( !m_isMainOutputNode && m_mainMasterNodeRef == null ) - { - m_mainMasterNodeRef = m_containerGraph.CurrentMasterNode as TemplateMultiPassMasterNode; - } - - if( m_refreshLODValueMasterNodes && ( EditorApplication.timeSinceStartup - m_refreshLODValueMasterNodesTimestamp ) > MaxLODEditTimestamp ) - { - m_refreshLODValueMasterNodes = false; - m_refocusLODValueMasterNodes = true; - m_containerGraph.SortLODMasterNodes(); - } - } - - public override void Draw( DrawInfo drawInfo ) - { - if( m_isInvisible == InvisibilityStatus.Visible ) - { - base.Draw( drawInfo ); - } - } - - public override void OnNodeLayout( DrawInfo drawInfo ) - { - if( m_invalidNode ) - { - if( m_isMainOutputNode ) - { - UIUtils.ShowMessage( "Invalid current template. Switching to Standard Surface", MessageSeverity.Error ); - m_shaderModelIdx = 0; - m_masterNodeCategory = 0; - m_containerGraph.ParentWindow.ReplaceMasterNode( new MasterNodeCategoriesData( AvailableShaderTypes.SurfaceShader, m_shaderName ), false ); - } - return; - } - - if( m_isInvisible != InvisibilityStatus.Visible ) - { - return; - } - - if( !IsMainOutputNode ) - { - if( !IsInvisible && Docking ) - { - m_useSquareNodeTitle = true; - TemplateMultiPassMasterNode master = ContainerGraph.CurrentMasterNode as TemplateMultiPassMasterNode; - m_position = master.TruePosition; - m_position.height = 32; - int masterIndex = ContainerGraph.MultiPassMasterNodes.NodesList.IndexOf( master ); - int index = ContainerGraph.MultiPassMasterNodes.GetNodeRegisterIdx( UniqueId ); - if( index > masterIndex ) - { - int backTracking = 0; - for( int i = index - 1; i > masterIndex; i-- ) - { - if( !ContainerGraph.MultiPassMasterNodes.NodesList[ i ].IsInvisible && ContainerGraph.MultiPassMasterNodes.NodesList[ i ].Docking ) - backTracking++; - } - m_position.y = master.TruePosition.yMax + 1 + 33 * ( backTracking );// ContainerGraph.MultiPassMasterNodes.NodesList[ index - 1 ].TruePosition.yMax; - base.OnNodeLayout( drawInfo ); - } - else - { - int forwardTracking = 1; - for( int i = index + 1; i < masterIndex; i++ ) - { - if( !ContainerGraph.MultiPassMasterNodes.NodesList[ i ].IsInvisible && ContainerGraph.MultiPassMasterNodes.NodesList[ i ].Docking ) - forwardTracking++; - } - m_position.y = master.TruePosition.y - 33 * ( forwardTracking );// ContainerGraph.MultiPassMasterNodes.NodesList[ index - 1 ].TruePosition.yMax; - base.OnNodeLayout( drawInfo ); - } - } - else - { - m_useSquareNodeTitle = false; - base.OnNodeLayout( drawInfo ); - } - } - else - { - base.OnNodeLayout( drawInfo ); - } - } - - public override void OnNodeRepaint( DrawInfo drawInfo ) - { - base.OnNodeRepaint( drawInfo ); - if( m_invalidNode ) - return; - - if( m_isInvisible == InvisibilityStatus.Visible ) - { - if( m_containerGraph.IsInstancedShader ) - { - DrawInstancedIcon( drawInfo ); - } - } - } - - public override void UpdateFromShader( Shader newShader ) - { - if( m_currentMaterial != null && m_currentMaterial.shader != newShader ) - { - m_currentMaterial.shader = newShader; - } - CurrentShader = newShader; - } - - public override void UpdateMasterNodeMaterial( Material material ) - { - m_currentMaterial = material; - FireMaterialChangedEvt(); - } - - void DrawReloadButton() - { - if( GUILayout.Button( ReloadTemplateStr ) && m_templateMultiPass != null ) - { - m_templateMultiPass.Reload(); - } - } - - void DrawOpenTemplateButton() - { - GUILayout.BeginHorizontal(); - { - if( GUILayout.Button( OpenTemplateStr ) && m_templateMultiPass != null ) - { - try - { - string pathname = AssetDatabase.GUIDToAssetPath( m_templateMultiPass.GUID ); - if( !string.IsNullOrEmpty( pathname ) ) - { - Shader selectedTemplate = AssetDatabase.LoadAssetAtPath<Shader>( pathname ); - if( selectedTemplate != null ) - { - AssetDatabase.OpenAsset( selectedTemplate, 1 ); - } - } - } - catch( Exception e ) - { - Debug.LogException( e ); - } - } - - if( GUILayout.Button( "\u25C4", GUILayout.Width( 18 ), GUILayout.Height( 18 ) ) && m_templateMultiPass != null ) - { - try - { - string pathname = AssetDatabase.GUIDToAssetPath( m_templateMultiPass.GUID ); - if( !string.IsNullOrEmpty( pathname ) ) - { - Shader selectedTemplate = AssetDatabase.LoadAssetAtPath<Shader>( pathname ); - if( selectedTemplate != null ) - { - Event.current.Use(); - Selection.activeObject = selectedTemplate; - EditorGUIUtility.PingObject( Selection.activeObject ); - } - } - } - catch( Exception e ) - { - Debug.LogException( e ); - } - } - } - GUILayout.EndHorizontal(); - } - - public override void DrawProperties() - { - base.DrawProperties(); - if( m_invalidNode ) - return; - - NodeUtils.DrawPropertyGroup( ref m_propertiesFoldout, CommonPropertiesStr, DrawCommonProperties ); - NodeUtils.DrawPropertyGroup( ref m_subStringFoldout, SubShaderModuleStr, DrawSubShaderProperties ); - NodeUtils.DrawPropertyGroup( ref m_passFoldout, PassModuleStr, DrawPassProperties ); - - DrawMaterialInputs( UIUtils.MenuItemToolbarStyle, false ); - - if( m_propertyOrderChanged ) - { - List<TemplateMultiPassMasterNode> mpNodes = UIUtils.CurrentWindow.CurrentGraph.MultiPassMasterNodes.NodesList; - int count = mpNodes.Count; - for( int i = 0; i < count; i++ ) - { - if( mpNodes[ i ].UniqueId != UniqueId ) - { - mpNodes[ i ].CopyPropertyListFrom( this ); - } - } - } - -#if SHOW_TEMPLATE_HELP_BOX - EditorGUILayout.HelpBox( WarningMessage, MessageType.Warning ); -#endif - } - - // this will be removed later when PBR options are created - void SetExtraDefine( string define ) - { - List<TemplateMultiPassMasterNode> nodes = this.ContainerGraph.MultiPassMasterNodes.NodesList; - int count = nodes.Count; - for( int nodeIdx = 0; nodeIdx < count; nodeIdx++ ) - { - nodes[ nodeIdx ].OptionsDefineContainer.AddDefine( "#define " + define, false ); - } - } - - void AddHDKeywords() - { - if( m_templateMultiPass.CustomTemplatePropertyUI == CustomTemplatePropertyUIEnum.None ) - return; - - if( m_templateMultiPass.SubShaders[ m_subShaderIdx ].Modules.SRPType != TemplateSRPType.HD || - !m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].Modules.SRPIsPBR ) - return; - - switch( m_hdSrpMaterialType ) - { - case HDSRPMaterialType.SubsurfaceScattering: - { - SetExtraDefine( SRPMaterialSubsurfaceScatteringKeyword ); - //m_currentDataCollector.AddToDefines( UniqueId, SRPMaterialSubsurfaceScatteringKeyword ); - if( m_thicknessPort != null && m_thicknessPort.HasOwnOrLinkConnection ) - { - SetExtraDefine( SRPMaterialTransmissionKeyword ); - //m_currentDataCollector.AddToDefines( UniqueId, SRPMaterialTransmissionKeyword ); - } - } - break; - case HDSRPMaterialType.Standard: - break; - case HDSRPMaterialType.Specular: - { - SetExtraDefine( SRPHDMaterialSpecularKeyword ); - //m_currentDataCollector.AddToDefines( UniqueId, SRPHDMaterialSpecularKeyword ); - } - break; - case HDSRPMaterialType.Anisotropy: - { - SetExtraDefine( SRPMaterialAnisotropyKeyword ); - //m_currentDataCollector.AddToDefines( UniqueId, SRPMaterialAnisotropyKeyword ); - } - break; - case HDSRPMaterialType.Iridescence: - { - SetExtraDefine( SRPMaterialIridiscenceKeyword ); - //m_currentDataCollector.AddToDefines( UniqueId, SRPMaterialIridiscenceKeyword ); - } - break; - case HDSRPMaterialType.Translucent: - { - SetExtraDefine( SRPMaterialTransmissionKeyword ); - //m_currentDataCollector.AddToDefines( UniqueId, SRPMaterialTransmissionKeyword ); - } - break; - } - - if( m_coatMaskPort != null && m_coatMaskPort.HasOwnOrLinkConnection ) - { - SetExtraDefine( SRPMaterialClearCoatKeyword ); - //m_currentDataCollector.AddToDefines( UniqueId, SRPMaterialClearCoatKeyword ); - } - } - - void FetchHDPorts() - { - if( m_fetchPorts ) - { - m_fetchPorts = false; - if( m_inputPorts.Count > 4 ) - { - m_specularPort = GetInputPortByUniqueId( 3 ); - m_metallicPort = GetInputPortByUniqueId( 4 ); - m_coatMaskPort = GetInputPortByUniqueId( 11 ); - m_diffusionProfilePort = GetInputPortByUniqueId( 12 ); - m_subsurfaceMaskPort = GetInputPortByUniqueId( 13 ); - m_thicknessPort = GetInputPortByUniqueId( 14 ); - m_anisotropyPort = GetInputPortByUniqueId( 15 ); - m_iridescenceThicknessPort = GetInputPortByUniqueId( 16 ); - m_iridescenceMaskPort = GetInputPortByUniqueId( 17 ); - m_indexOfRefractionPort = GetInputPortByUniqueId( 18 ); - m_transmittanceColorPort = GetInputPortByUniqueId( 19 ); - m_transmittanceAbsorptionDistancePort = GetInputPortByUniqueId( 20 ); - m_transmittanceMaskPort = GetInputPortByUniqueId( 21 ); - } - } - } - - void ConfigHDPorts() - { - if( m_templateMultiPass.CustomTemplatePropertyUI == CustomTemplatePropertyUIEnum.None ) - return; - - if( m_templateMultiPass.SubShaders[ m_subShaderIdx ].Modules.SRPType != TemplateSRPType.HD || - !m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].Modules.SRPIsPBR ) - return; - - FetchHDPorts(); - if( m_inputPorts.Count > 4 ) - { - switch( m_hdSrpMaterialType ) - { - case HDSRPMaterialType.SubsurfaceScattering: - { - m_specularPort.Visible = false; - m_metallicPort.Visible = false; - m_coatMaskPort.Visible = true; - m_diffusionProfilePort.Visible = true; - m_subsurfaceMaskPort.Visible = true; - m_thicknessPort.Visible = true; - m_anisotropyPort.Visible = false; - m_iridescenceThicknessPort.Visible = false; - m_iridescenceMaskPort.Visible = false; - m_indexOfRefractionPort.Visible = false; - m_transmittanceColorPort.Visible = false; - m_transmittanceAbsorptionDistancePort.Visible = false; - m_transmittanceMaskPort.Visible = false; - } - break; - case HDSRPMaterialType.Standard: - { - m_specularPort.Visible = false; - m_metallicPort.Visible = true; - m_coatMaskPort.Visible = true; - m_diffusionProfilePort.Visible = false; - m_subsurfaceMaskPort.Visible = false; - m_thicknessPort.Visible = false; - m_anisotropyPort.Visible = false; - m_iridescenceThicknessPort.Visible = false; - m_iridescenceMaskPort.Visible = false; - m_indexOfRefractionPort.Visible = false; - m_transmittanceColorPort.Visible = false; - m_transmittanceAbsorptionDistancePort.Visible = false; - m_transmittanceMaskPort.Visible = false; - } - break; - case HDSRPMaterialType.Specular: - { - m_specularPort.Visible = true; - m_metallicPort.Visible = false; - m_coatMaskPort.Visible = true; - m_diffusionProfilePort.Visible = false; - m_subsurfaceMaskPort.Visible = false; - m_thicknessPort.Visible = false; - m_anisotropyPort.Visible = false; - m_iridescenceThicknessPort.Visible = false; - m_iridescenceMaskPort.Visible = false; - m_indexOfRefractionPort.Visible = false; - m_transmittanceColorPort.Visible = false; - m_transmittanceAbsorptionDistancePort.Visible = false; - m_transmittanceMaskPort.Visible = false; - } - break; - case HDSRPMaterialType.Anisotropy: - { - m_specularPort.Visible = false; - m_metallicPort.Visible = true; - m_coatMaskPort.Visible = true; - m_diffusionProfilePort.Visible = false; - m_subsurfaceMaskPort.Visible = false; - m_thicknessPort.Visible = false; - m_anisotropyPort.Visible = true; - m_iridescenceThicknessPort.Visible = false; - m_iridescenceMaskPort.Visible = false; - m_indexOfRefractionPort.Visible = false; - m_transmittanceColorPort.Visible = false; - m_transmittanceAbsorptionDistancePort.Visible = false; - m_transmittanceMaskPort.Visible = false; - } - break; - case HDSRPMaterialType.Iridescence: - { - m_specularPort.Visible = false; - m_metallicPort.Visible = true; - m_coatMaskPort.Visible = true; - m_diffusionProfilePort.Visible = false; - m_subsurfaceMaskPort.Visible = false; - m_thicknessPort.Visible = false; - m_anisotropyPort.Visible = false; - m_iridescenceThicknessPort.Visible = true; - m_iridescenceMaskPort.Visible = true; - m_indexOfRefractionPort.Visible = false; - m_transmittanceColorPort.Visible = false; - m_transmittanceAbsorptionDistancePort.Visible = false; - m_transmittanceMaskPort.Visible = false; - } - break; - case HDSRPMaterialType.Translucent: - { - m_specularPort.Visible = false; - m_metallicPort.Visible = false; - m_coatMaskPort.Visible = false; - m_diffusionProfilePort.Visible = true; - m_subsurfaceMaskPort.Visible = false; - m_thicknessPort.Visible = true; - m_anisotropyPort.Visible = false; - m_iridescenceThicknessPort.Visible = false; - m_iridescenceMaskPort.Visible = false; - m_indexOfRefractionPort.Visible = false; - m_transmittanceColorPort.Visible = false; - m_transmittanceAbsorptionDistancePort.Visible = false; - m_transmittanceMaskPort.Visible = false; - } - break; - } - } - m_sizeIsDirty = ( m_isInvisible == InvisibilityStatus.Visible ); - } - - - public void SetShaderLODValueAndLabel( int value ) - { - if( ShaderLOD != value ) - ShaderLOD = value; - - if( ContainerGraph.HasLODs ) - { - SetClippedAdditionalTitle( string.Format( LodSubtitle, ShaderLOD ) ); - } - else - { - SetAdditonalTitleText( string.Empty ); - } - } - - void DrawLODAddRemoveButtons() - { - DrawLODAddRemoveButtons( -2 , true ); - } - - void DrawLODAddRemoveButtons( int index , bool showRemove ) - { - if( GUILayoutButton( string.Empty, UIUtils.PlusStyle, GUILayout.Width( 15 ) ) ) - { - Vector2 minPos = Vec2Position; - //bool newNodePositionMode = false; - //if( newNodePositionMode ) - //{ - // for( int lod = 0; lod < ContainerGraph.LodMultiPassMasternodes.Count; lod++ ) - // { - // if( ContainerGraph.LodMultiPassMasternodes[ lod ].Count != 0 ) - // { - // Vector2 currPos = ContainerGraph.LodMultiPassMasternodes[ lod ].NodesList[ m_passIdx ].Vec2Position; - // if( currPos.y > minPos.y ) - // { - // minPos = currPos; - // } - // } - // else - // { - // if( index < 0 ) - // { - // index = lod; - // } - // break; - // } - // } - //} - //else - //{ - for( int lod = ContainerGraph.LodMultiPassMasternodes.Count - 1 ; lod >= 0; lod-- ) - { - if( ContainerGraph.LodMultiPassMasternodes[ lod ].Count != 0 ) - { - minPos = ContainerGraph.LodMultiPassMasternodes[ lod ].NodesList[ m_passIdx ].Vec2Position; - break; - } - } - //} - - minPos.y += HeightEstimate + 10; - ContainerGraph.CreateLodMasterNodes( m_templateMultiPass, index, minPos ); - } - - if( showRemove && GUILayoutButton( string.Empty, UIUtils.MinusStyle, GUILayout.Width( 15 ) ) ) - { - ContainerGraph.DestroyLodMasterNodes( index ); - } - } - - void SetupLODNodeName() - { - if( IsMainOutputNode ) - { - if( string.IsNullOrEmpty( m_mainLODName ) ) - { - m_shaderNameIsTitle = true; - m_content.text = GenerateClippedTitle( m_croppedShaderName ); - } - else - { - m_shaderNameIsTitle = false; - m_content.text = GenerateClippedTitle( m_mainLODName ); - } - } - else - { - m_shaderNameIsTitle = false; - m_content.text = GenerateClippedTitle( m_passName ); - } - } - - public void DrawLodRowItem(bool listMode) - { - float labelWidthBuffer = EditorGUIUtility.labelWidth; - EditorGUILayout.BeginHorizontal(); - if( listMode ) - { - if( GUILayout.Button( "\u25b6", GUILayout.Width( 18 ), GUILayout.Height( 18 ) ) ) - { - m_containerGraph.ParentWindow.FocusOnNode( this, 1, false, true ); - } - EditorGUI.BeginChangeCheck(); - GUI.SetNextControlName( LodValueId + m_lodIndex ); - m_shaderLOD = EditorGUILayoutIntField( string.Empty, m_shaderLOD, GUILayout.Width( 50 ) ); - } - else - { - EditorGUI.BeginChangeCheck(); - EditorGUIUtility.labelWidth = 45; - GUI.SetNextControlName( LodValueId + m_lodIndex ); - m_shaderLOD = EditorGUILayoutIntField( "LOD", ShaderLOD, GUILayout.Width(100)); - EditorGUIUtility.labelWidth = labelWidthBuffer; - } - - if( EditorGUI.EndChangeCheck() ) - { - m_refreshLODValueMasterNodes = true; - m_refreshLODValueMasterNodesTimestamp = EditorApplication.timeSinceStartup; - - if( ContainerGraph.HasLODs ) - SetClippedAdditionalTitle( string.Format( LodSubtitle, ShaderLOD ) ); - } - - EditorGUI.BeginChangeCheck(); - GUI.SetNextControlName( LodNameId + ShaderLOD ); - if( listMode ) - { - m_mainLODName = EditorGUILayoutTextField( string.Empty, m_mainLODName, GUILayout.Width( 100 ) ); - } - else - { - GUILayout.Space( -15 ); - EditorGUIUtility.labelWidth = 45; - m_mainLODName = EditorGUILayoutTextField( string.Empty, m_mainLODName ); - EditorGUIUtility.labelWidth = labelWidthBuffer; - } - if( EditorGUI.EndChangeCheck() ) - { - // If reorder is scheduled make sure it doesn't happen when editing LOD name - if( m_refreshLODValueMasterNodes ) - m_refreshLODValueMasterNodesTimestamp = EditorApplication.timeSinceStartup; - - SetupLODNodeName(); - } - - if( listMode ) - DrawLODAddRemoveButtons( m_lodIndex, ( m_lodIndex >= 0) ); - - EditorGUILayout.EndHorizontal(); - - if( m_refocusLODValueMasterNodes ) - { - m_refocusLODValueMasterNodes = false; - string focusedControl = GUI.GetNameOfFocusedControl(); - if( focusedControl.Contains( LodValueId ) ) - { - GUI.FocusControl( LodValueId + m_lodIndex ); - TextEditor te = (TextEditor)GUIUtility.GetStateObject( typeof( TextEditor ), GUIUtility.keyboardControl ); - if( te != null ) - { - te.SelectTextEnd(); - } - } - else if( focusedControl.Contains( LodNameId ) ) - { - GUI.FocusControl( LodNameId + m_lodIndex ); - TextEditor te = (TextEditor)GUIUtility.GetStateObject( typeof( TextEditor ), GUIUtility.keyboardControl ); - if( te != null ) - { - te.SelectTextEnd(); - } - } - } - } - - void DrawLOD() - { - if( m_templateMultiPass.CanAddLODs && m_lodIndex == -1 ) - { - EditorGUILayout.Space(); - - DrawLodRowItem(true); - EditorGUILayout.Space(); - - for( int i = 0; i < ContainerGraph.LodMultiPassMasternodes.Count; i++ ) - { - if( ContainerGraph.LodMultiPassMasternodes[ i ].NodesList.Count > 0 ) - { - TemplateMultiPassMasterNode masterNode = m_containerGraph.LodMultiPassMasternodes[ i ].NodesList[ m_passIdx ]; - masterNode.DrawLodRowItem( true ); - EditorGUILayout.Space(); - } - } - EditorGUILayout.Space(); - } - } - - void DrawCommonProperties() - { - if( m_isMainOutputNode ) - { - //if( m_templateMultiPass.CanAddLODs && m_lodIndex == -1 ) - //{ - // if( GUILayoutButton( string.Empty, UIUtils.PlusStyle, GUILayout.Width( 15 ) ) ) - // { - // ContainerGraph.CreateLodMasterNodes( m_templateMultiPass, Vec2Position ); - // } - - - // if( GUILayoutButton( string.Empty, UIUtils.MinusStyle, GUILayout.Width( 15 ) ) ) - // { - // ContainerGraph.DestroyLodMasterNodes(); - // } - - //} - - //EditorGUILayout.LabelField( "LOD: " + m_lodIndex ); - DrawShaderName(); - DrawCurrentShaderType(); - - if( m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].Modules.SRPIsPBRHD ) - { - if( m_templateMultiPass.CustomTemplatePropertyUI == CustomTemplatePropertyUIEnum.HDPBR ) - { - EditorGUI.BeginChangeCheck(); - CurrentHDMaterialType = (HDSRPMaterialType)EditorGUILayoutEnumPopup( HDSRPMaterialTypeStr, m_hdSrpMaterialType ); - if( EditorGUI.EndChangeCheck() ) - ConfigHDPorts(); - } - } - - EditorGUI.BeginChangeCheck(); - DrawPrecisionProperty( false ); - if( EditorGUI.EndChangeCheck() ) - ContainerGraph.CurrentPrecision = m_currentPrecisionType; - m_drawInstancedHelper.Draw( this ); - m_fallbackHelper.Draw( this ); - DrawCustomInspector( m_templateMultiPass.SRPtype != TemplateSRPType.BuiltIn ); - m_subShaderOptions.DrawCustomOptions( this ); - m_dependenciesHelper.Draw( this, true ); - } - //EditorGUILayout.LabelField( m_subShaderIdxStr ); - //EditorGUILayout.LabelField( m_passIdxStr ); - - if( IsLODMainMasterNode && m_templateMultiPass.CanAddLODs ) - { - NodeUtils.DrawNestedPropertyGroup( ref m_lodFoldout, AdditionalLODsStr, DrawLOD, DrawLODAddRemoveButtons ); - } - - DrawOpenTemplateButton(); - if( DebugConsoleWindow.DeveloperMode ) - DrawReloadButton(); - - } - - public void DrawSubShaderProperties() - { - if( !m_isMainOutputNode ) - { - m_mainMasterNodeRef.DrawSubShaderProperties(); - return; - } - - bool noValidData = true; - if( ShaderLOD > 0 ) - { - noValidData = false; - if( m_templateMultiPass.CanAddLODs && m_containerGraph.LodMultiPassMasternodes[0].Count > 0 ) - { - DrawLodRowItem( false ); - } - else - { - ShaderLOD = EditorGUILayoutIntField( SubShaderLODValueLabel, ShaderLOD ); - } - } - - if( m_subShaderModule.HasValidData ) - { - noValidData = false; - m_subShaderModule.Draw( this, m_templateMultiPass.SubShaders[ m_subShaderIdx ].Modules ); - //if( m_subShaderModule.IsDirty ) - //{ - // List<TemplateMultiPassMasterNode> mpNodes = UIUtils.CurrentWindow.CurrentGraph.MultiPassMasterNodes.NodesList; - // int count = mpNodes.Count; - // for( int i = 0; i < count; i++ ) - // { - // if( mpNodes[ i ].SubShaderIdx == m_subShaderIdx && mpNodes[ i ].UniqueId != UniqueId ) - // { - // mpNodes[ i ].SubShaderModule.CopyFrom( m_subShaderModule ); - // } - // } - // m_subShaderModule.IsDirty = false; - //} - } - - m_passSelector.Draw( this ); - - if( noValidData ) - { - EditorGUILayout.HelpBox( NoSubShaderPropertyStr, MessageType.Info ); - } - } - - void DrawPassProperties() - { - EditorGUI.BeginChangeCheck(); - m_passName = EditorGUILayoutTextField( PassNameStr, m_passName ); - if( EditorGUI.EndChangeCheck() ) - { - if( m_passName.Length > 0 ) - { - m_passName = UIUtils.RemoveShaderInvalidCharacters( m_passName ); - } - else - { - m_passName = m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].PassNameContainer.Data; - } - //if( !m_templateMultiPass.IsSinglePass ) - // SetClippedTitle( m_passName ); - } - EditorGUILayout.LabelField( Pass.Modules.PassUniqueName ); - if( m_passModule.HasValidData ) - { - m_passModule.Draw( this, m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].Modules, m_subShaderModule ); - } - - m_usePass.Draw( this, false ); - m_passOptions.DrawCustomOptions( this ); - } - - bool CreateInstructionsForList( TemplateData templateData, ref List<InputPort> ports, ref string shaderBody, ref List<string> vertexInstructions, ref List<string> fragmentInstructions ) - { - if( ports.Count == 0 ) - return true; - AddHDKeywords(); - bool isValid = true; - //UIUtils.CurrentWindow.CurrentGraph.ResetNodesLocalVariables(); - for( int i = 0; i < ports.Count; i++ ) - { - TemplateInputData inputData = templateData.InputDataFromId( ports[ i ].PortId ); - if( ports[ i ].HasOwnOrLinkConnection ) - { - //if( m_templateMultiPass.SubShaders[ m_subShaderIdx ].Modules.SRPType == TemplateSRPType.Lightweight ) - //{ - // if( ports[ i ].Name.Contains( "Normal" ) ) - // { - // m_currentDataCollector.AddToDirectives( SRPMaterialNormalMapKeyword, -1, AdditionalLineType.Define ); - // } - - // if( ports[ i ].Name.Contains( "Alpha Clip Threshold" ) ) - // { - // m_currentDataCollector.AddToDirectives( SRPMaterialBlendModeAlphaClipThresholdKeyword, -1, AdditionalLineType.Define ); - // } - - // if( ports[ i ].Name.Contains( "Specular" ) ) - // { - // m_currentDataCollector.AddToDirectives( SRPLWMaterialSpecularKeyword, -1, AdditionalLineType.Define ); - // } - //} - //else if( m_templateMultiPass.SubShaders[ m_subShaderIdx ].Modules.SRPType == TemplateSRPType.HD ) - //{ - // if( ports[ i ].Name.Contains( "Normal" ) ) - // { - // //m_currentDataCollector.AddToDefines( UniqueId, SRPMaterialNormalMapKeyword ); - // } - - // if( ports[ i ].Name.Contains( "Alpha Clip Threshold" ) ) - // { - // //m_currentDataCollector.AddToDefines( UniqueId, SRPMaterialAlphaTestKeyword ); - // } - - //} - - m_currentDataCollector.ResetInstructions(); - m_currentDataCollector.ResetVertexInstructions(); - - m_currentDataCollector.PortCategory = ports[ i ].Category; - string newPortInstruction = ports[ i ].GeneratePortInstructions( ref m_currentDataCollector ); - - if( m_currentDataCollector.DirtySpecialLocalVariables ) - { - string cleanVariables = m_currentDataCollector.SpecialLocalVariables.Replace( "\t", string.Empty ); - m_currentDataCollector.AddInstructions( cleanVariables, false ); - m_currentDataCollector.ClearSpecialLocalVariables(); - } - - if( m_currentDataCollector.DirtyVertexVariables ) - { - string cleanVariables = m_currentDataCollector.VertexLocalVariables.Replace( "\t", string.Empty ); - m_currentDataCollector.AddVertexInstruction( cleanVariables, UniqueId, false ); - m_currentDataCollector.ClearVertexLocalVariables(); - } - - // fill functions - for( int j = 0; j < m_currentDataCollector.InstructionsList.Count; j++ ) - { - fragmentInstructions.Add( m_currentDataCollector.InstructionsList[ j ].PropertyName ); - } - - for( int j = 0; j < m_currentDataCollector.VertexDataList.Count; j++ ) - { - vertexInstructions.Add( m_currentDataCollector.VertexDataList[ j ].PropertyName ); - } - - m_templateMultiPass.SetPassInputData( m_subShaderIdx, m_passIdx, ports[ i ].PortId, newPortInstruction ); - isValid = m_templateMultiPass.FillTemplateBody( m_subShaderIdx, m_passIdx, inputData.TagId, ref shaderBody, newPortInstruction ) && isValid; - } - else - { - m_templateMultiPass.SetPassInputData( m_subShaderIdx, m_passIdx, ports[ i ].PortId, inputData.DefaultValue ); - isValid = m_templateMultiPass.FillTemplateBody( m_subShaderIdx, m_passIdx, inputData.TagId, ref shaderBody, inputData.DefaultValue ) && isValid; - } - } - return isValid; - } - - public string BuildShaderBody( MasterNodeDataCollector inDataCollector, ref MasterNodeDataCollector outDataCollector ) - { - List<TemplateMultiPassMasterNode> list = UIUtils.CurrentWindow.CurrentGraph.MultiPassMasterNodes.NodesList; - int currentSubshader = list[ 0 ].SubShaderIdx; - m_templateMultiPass.SetShaderName( string.Format( TemplatesManager.NameFormatter, m_shaderName ) ); - if( string.IsNullOrEmpty( m_customInspectorName ) ) - { - m_templateMultiPass.SetCustomInspector( string.Empty ); - } - else - { - m_templateMultiPass.SetCustomInspector( CustomInspectorFormatted ); - } - - m_templateMultiPass.SetFallback( m_fallbackHelper.FallbackShader ); - m_templateMultiPass.SetDependencies( m_dependenciesHelper.GenerateDependencies() ); - - if( inDataCollector != null ) - outDataCollector.CopyPropertiesFromDataCollector( inDataCollector ); - - outDataCollector.TemplateDataCollectorInstance.CurrentSRPType = m_templateMultiPass.SRPtype; - - int lastActivePass = m_passSelector.LastActivePass; - int count = list.Count; - - for( int i = 0; i < count; i++ ) - { - bool removePass = !m_passSelector.IsVisible( i ); - - list[ 0 ].CurrentTemplate.IdManager.SetPassIdUsage( i, removePass ); - if( removePass ) - continue; - - list[ i ].CollectData(); - list[ i ].FillPassData( this, outDataCollector.TemplateDataCollectorInstance ); - - if( list[ i ].SubShaderIdx == currentSubshader ) - { - outDataCollector.CopyPropertiesFromDataCollector( list[ i ].CurrentDataCollector ); - } - else - { - list[ i - 1 ].FillPropertyData( outDataCollector ); - list[ i - 1 ].FillSubShaderData(); - outDataCollector.Destroy(); - outDataCollector = new MasterNodeDataCollector(); - outDataCollector.CopyPropertiesFromDataCollector( list[ i ].CurrentDataCollector ); - - currentSubshader = list[ i ].SubShaderIdx; - } - - // Last element must the one filling subshader data - // as only there all properties are caught - //if( i == ( count - 1 ) ) - if( i == lastActivePass ) - { - list[ i ].FillPropertyData( outDataCollector ); - } - - if( list[ i ].IsMainOutputNode ) - list[ i ].FillSubShaderData(); - } - - outDataCollector.TemplateDataCollectorInstance.BuildCBuffer( -1 ); - - //Fill uniforms is set on last since we need to collect all srp batcher data ( if needed ) - //To set it into each pass - for( int i = 0; i < count; i++ ) - { - bool removePass = !m_passSelector.IsVisible( i ); - if( removePass ) - continue; - - list[ i ].FillUniforms( outDataCollector.TemplateDataCollectorInstance ); - } - - return list[ 0 ].CurrentTemplate.IdManager.BuildShader(); - } - - public string BuildLOD( MasterNodeDataCollector inDataCollector, ref MasterNodeDataCollector outDataCollector ) - { - UsageListTemplateMultiPassMasterNodes bufferNodesList = ContainerGraph.MultiPassMasterNodes; - int bufferMasterNodeId = ContainerGraph.CurrentMasterNodeId; - - ContainerGraph.MultiPassMasterNodes = ContainerGraph.LodMultiPassMasternodes[ m_lodIndex ]; - ContainerGraph.CurrentMasterNodeId = UniqueId; - - m_templateMultiPass.ResetState(); - base.Execute( string.Empty, false ); - string shaderBody = BuildShaderBody( inDataCollector, ref outDataCollector ); - - - ContainerGraph.MultiPassMasterNodes = bufferNodesList; - ContainerGraph.CurrentMasterNodeId = bufferMasterNodeId; - return shaderBody; - } - - public override Shader Execute( string pathname, bool isFullPath ) - { - ForceReordering(); - MasterNodeDataCollector overallDataCollector = new MasterNodeDataCollector(); - - //BUILD LOD - string allLodSubShaders = string.Empty; - if( ContainerGraph.HasLODs ) - { - for( int lod = 0; lod < ContainerGraph.LodMultiPassMasternodes.Count; lod++ ) - { - if( ContainerGraph.LodMultiPassMasternodes[ lod ].Count == 0 ) - break; - - TemplateMultiPassMasterNode newMasterNode = ContainerGraph.LodMultiPassMasternodes[ lod ].NodesList.Find( ( x ) => x.IsMainOutputNode ); - string lodSubShaders = newMasterNode.BuildLOD( null, ref overallDataCollector ); - lodSubShaders = TemplateHelperFunctions.GetSubShaderFrom( lodSubShaders ) + "\n"; - allLodSubShaders += lodSubShaders; - } - } - - //BUILD MAIN - m_templateMultiPass.ResetState(); - base.Execute( pathname, isFullPath ); - MasterNodeDataCollector dummy = new MasterNodeDataCollector(); - string shaderBody = BuildShaderBody( overallDataCollector, ref dummy ); - - //COMBINE LOD WITH MAIN - if( !string.IsNullOrEmpty( allLodSubShaders ) ) - shaderBody = shaderBody.Replace( TemplatesManager.TemplateLODsTag, allLodSubShaders ); - - UpdateShaderAsset( ref pathname, ref shaderBody, isFullPath ); - return m_currentShader; - } - - public void CollectData() - { - if( m_inputPorts.Count == 0 ) - return; - - ContainerGraph.ResetNodesLocalVariables(); - m_optionsDefineContainer.RemoveTemporaries(); - m_currentDataCollector = new MasterNodeDataCollector( this ); - m_currentDataCollector.TemplateDataCollectorInstance.SetMultipassInfo( m_templateMultiPass, m_subShaderIdx, m_passIdx, m_templateMultiPass.SubShaders[ m_subShaderIdx ].Modules.SRPType ); - m_currentDataCollector.TemplateDataCollectorInstance.FillSpecialVariables( m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ] ); - SetupNodeCategories(); - if( m_containerGraph.IsInstancedShader ) - { - string blockName = UIUtils.RemoveInvalidCharacters( ContainerGraph.GetMainMasterNodeOfLOD( -1 ).ShaderName ); - m_currentDataCollector.SetupInstancePropertiesBlock( blockName ); - } - TemplateData templateData = m_templateMultiPass.CreateTemplateData( m_shaderName, string.Empty, m_subShaderIdx, m_passIdx ); - m_currentDataCollector.TemplateDataCollectorInstance.BuildFromTemplateData( m_currentDataCollector, templateData ); - - if( m_currentDataCollector.TemplateDataCollectorInstance.InterpData.DynamicMax ) - { - int interpolatorAmount = -1; - if( m_passModule.ShaderModelHelper.ValidData ) - { - interpolatorAmount = m_passModule.ShaderModelHelper.InterpolatorAmount; - } - else - { - TemplateModulesHelper subShaderModule = IsMainOutputNode ? m_subShaderModule : ( m_containerGraph.CurrentMasterNode as TemplateMultiPassMasterNode ).SubShaderModule; - if( subShaderModule.ShaderModelHelper.ValidData ) - { - interpolatorAmount = subShaderModule.ShaderModelHelper.InterpolatorAmount; - } - } - - if( interpolatorAmount > -1 ) - { - m_currentDataCollector.TemplateDataCollectorInstance.InterpData.RecalculateAvailableInterpolators( interpolatorAmount ); - } - } - - //Copy Properties - { - int shaderPropertiesAmount = m_templateMultiPass.AvailableShaderProperties.Count; - for( int i = 0; i < shaderPropertiesAmount; i++ ) - { - m_currentDataCollector.SoftRegisterUniform( m_templateMultiPass.AvailableShaderProperties[ i ] ); - } - } - //Copy Globals from SubShader level - { - int subShaderGlobalAmount = m_templateMultiPass.SubShaders[ m_subShaderIdx ].AvailableShaderGlobals.Count; - for( int i = 0; i < subShaderGlobalAmount; i++ ) - { - m_currentDataCollector.SoftRegisterUniform( m_templateMultiPass.SubShaders[ m_subShaderIdx ].AvailableShaderGlobals[ i ] ); - } - } - //Copy Globals from Pass Level - { - int passGlobalAmount = m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].AvailableShaderGlobals.Count; - for( int i = 0; i < passGlobalAmount; i++ ) - { - m_currentDataCollector.SoftRegisterUniform( m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].AvailableShaderGlobals[ i ] ); - } - } - // Check Current Options for property changes on subshader - if( m_isMainOutputNode ) - { - CheckPropertyChangesOnOptions( m_subShaderOptions ); - } - - // Check Current Options for property changes on pass - CheckPropertyChangesOnOptions( m_passOptions ); - - - //Set SRP info -#if UNITY_2018_3_OR_NEWER - if( m_templateMultiPass.SRPtype != TemplateSRPType.BuiltIn ) - ASEPackageManagerHelper.SetSRPInfoOnDataCollector( ref m_currentDataCollector ); -#endif - RegisterStandaloneFuntions(); - m_containerGraph.CheckPropertiesAutoRegister( ref m_currentDataCollector ); - - //Sort ports by both - List<InputPort> fragmentPorts = new List<InputPort>(); - List<InputPort> vertexPorts = new List<InputPort>(); - - SortInputPorts( ref vertexPorts, ref fragmentPorts ); - - - string shaderBody = templateData.TemplateBody; - - List<string> vertexInstructions = new List<string>(); - List<string> fragmentInstructions = new List<string>(); - - bool validBody = true; - - //validBody = CreateInstructionsForList( templateData, ref fragmentPorts, ref shaderBody, ref vertexInstructions, ref fragmentInstructions ) && validBody; - //ContainerGraph.ResetNodesLocalVariablesIfNot( MasterNodePortCategory.Vertex ); - //validBody = CreateInstructionsForList( templateData, ref vertexPorts, ref shaderBody, ref vertexInstructions, ref fragmentInstructions ) && validBody; - validBody = CreateInstructionsForList( templateData, ref vertexPorts, ref shaderBody, ref vertexInstructions, ref fragmentInstructions ) && validBody; - validBody = CreateInstructionsForList( templateData, ref fragmentPorts, ref shaderBody, ref vertexInstructions, ref fragmentInstructions ) && validBody; - - if( !m_isMainOutputNode && m_mainMasterNodeRef == null ) - { - m_mainMasterNodeRef = m_containerGraph.CurrentMasterNode as TemplateMultiPassMasterNode; - } - - TerrainDrawInstancedHelper drawInstanced = m_isMainOutputNode ? m_drawInstancedHelper : m_mainMasterNodeRef.DrawInstancedHelperInstance; - drawInstanced.UpdateDataCollectorForTemplates( ref m_currentDataCollector, ref vertexInstructions ); - - templateData.ResetTemplateUsageData(); - - // Fill vertex interpolators assignment - for( int i = 0; i < m_currentDataCollector.VertexInterpDeclList.Count; i++ ) - { - vertexInstructions.Add( m_currentDataCollector.VertexInterpDeclList[ i ] ); - } - - vertexInstructions.AddRange( m_currentDataCollector.TemplateDataCollectorInstance.GetInterpUnusedChannels() ); - - //Fill common local variables and operations - validBody = m_templateMultiPass.FillVertexInstructions( m_subShaderIdx, m_passIdx, vertexInstructions.ToArray() ) && validBody; - validBody = m_templateMultiPass.FillFragmentInstructions( m_subShaderIdx, m_passIdx, fragmentInstructions.ToArray() ) && validBody; - - vertexInstructions.Clear(); - vertexInstructions = null; - - fragmentInstructions.Clear(); - fragmentInstructions = null; - - // Add Instanced Properties - if( m_containerGraph.IsInstancedShader ) - { - m_currentDataCollector.OptimizeInstancedProperties(); - m_currentDataCollector.TabifyInstancedVars(); - - //string cbufferBegin = m_currentDataCollector.IsSRP ? - // string.Format( IOUtils.SRPInstancedPropertiesBegin, "UnityPerMaterial" ) : - // string.Format( IOUtils.InstancedPropertiesBegin, m_currentDataCollector.InstanceBlockName ); - //string cBufferEnd = m_currentDataCollector.IsSRP ? ( string.Format( IOUtils.SRPInstancedPropertiesEnd, m_currentDataCollector.InstanceBlockName ) ) : IOUtils.InstancedPropertiesEnd; - string cbufferBegin = m_currentDataCollector.IsSRP ? - string.Format( IOUtils.LWSRPInstancedPropertiesBegin, m_currentDataCollector.InstanceBlockName ) : - string.Format( IOUtils.InstancedPropertiesBegin, m_currentDataCollector.InstanceBlockName ); - string cBufferEnd = m_currentDataCollector.IsSRP ? ( string.Format( IOUtils.LWSRPInstancedPropertiesEnd, m_currentDataCollector.InstanceBlockName ) ) : IOUtils.InstancedPropertiesEnd; - - m_currentDataCollector.InstancedPropertiesList.Insert( 0, new PropertyDataCollector( -1, cbufferBegin ) ); - m_currentDataCollector.InstancedPropertiesList.Add( new PropertyDataCollector( -1, cBufferEnd ) ); - m_currentDataCollector.UniformsList.AddRange( m_currentDataCollector.InstancedPropertiesList ); - } - - if( m_currentDataCollector.DotsPropertiesList.Count > 0 ) - { - m_currentDataCollector.DotsPropertiesList.Insert( 0, new PropertyDataCollector( -1, "UNITY_DOTS_INSTANCING_START(MaterialPropertyMetadata)" ) ); - m_currentDataCollector.DotsPropertiesList.Insert( 0, new PropertyDataCollector( -1, "#ifdef UNITY_DOTS_INSTANCING_ENABLED" ) ); - m_currentDataCollector.DotsPropertiesList.Insert( 0, new PropertyDataCollector( -1, "" ) ); - m_currentDataCollector.DotsPropertiesList.Add( new PropertyDataCollector( -1, "UNITY_DOTS_INSTANCING_END(MaterialPropertyMetadata)" ) ); - m_currentDataCollector.DotsDefinesList.Add( new PropertyDataCollector( -1, "#endif" ) ); - m_currentDataCollector.UniformsList.AddRange( m_currentDataCollector.DotsPropertiesList ); - m_currentDataCollector.UniformsList.AddRange( m_currentDataCollector.DotsDefinesList ); - } - - TemplateShaderModelModule shaderModelModule = m_isMainOutputNode ? m_subShaderModule.ShaderModelHelper : m_mainMasterNodeRef.SubShaderModule.ShaderModelHelper; - string shaderModel = string.Empty; - if( m_passModule.ShaderModelHelper.ValidData ) - { - shaderModel = m_passModule.ShaderModelHelper.CurrentShaderModel; - } - else if( shaderModelModule.ValidData ) - { - shaderModel = shaderModelModule.CurrentShaderModel; - } - else if( m_templateMultiPass.GlobalShaderModel.IsValid ) - { - shaderModel = m_templateMultiPass.GlobalShaderModel.Value; - } - else - { - shaderModel = ( m_templateMultiPass.SRPtype == TemplateSRPType.HD ) ? "4.5" : "3.0"; - } - - m_currentDataCollector.TemplateDataCollectorInstance.CheckInterpolatorOverflow( shaderModel, m_passName ); - } - - public void CheckPropertyChangesOnOptions( TemplateOptionsUIHelper optionsUI ) - { - //Only Main LOD master node can change shader properties - if( !IsLODMainMasterNode ) - return; - - List<TemplateOptionUIItem> options = optionsUI.PassCustomOptionsUI; - for( int optionIdx = 0; optionIdx < options.Count; optionIdx++ ) - { - if( options[ optionIdx ].IsVisible ) - { - TemplateActionItem[] actionItems = options[ optionIdx ].CurrentOptionActions.Columns; - for( int actionIdx = 0; actionIdx < actionItems.Length; actionIdx++ ) - { - if( actionItems[ actionIdx ].ActionType == AseOptionsActionType.SetShaderProperty && !string.IsNullOrEmpty( actionItems[ actionIdx ].ActionBuffer ) ) - { - TemplateShaderPropertyData data = m_templateMultiPass.GetShaderPropertyData( actionItems[ actionIdx ].ActionData ); - if( data != null ) - { - string newPropertyValue = data.CreatePropertyForValue( actionItems[ actionIdx ].ActionBuffer ); - CurrentTemplate.IdManager.SetReplacementText( data.FullValue, newPropertyValue ); - } - } - } - - if( options[ optionIdx ].Options.Type == AseOptionsType.Field ) - { - foreach( var item in CurrentTemplate.IdManager.RegisteredTags ) - { - if( item.Output.Equals( options[ optionIdx ].Options.FieldInlineName ) ) - { - var node = options[ optionIdx ].Options.FieldValue.GetPropertyNode(); - if( node != null && ( node.IsConnected || node.AutoRegister ) && options[ optionIdx ].Options.FieldValue.Active ) - { - item.Replacement = node.PropertyName; - } - } - } - } - } - } - } - public void FillPropertyData( MasterNodeDataCollector dataCollector = null ) - { - MasterNodeDataCollector currDataCollector = ( dataCollector == null ) ? m_currentDataCollector : dataCollector; - -#if UNITY_2019_2_OR_NEWER - // Temporary hack - if( m_templateMultiPass.SRPtype != TemplateSRPType.BuiltIn && ASEPackageManagerHelper.CurrentHDVersion > ASESRPVersions.ASE_SRP_6_9_0 ) - { - if( m_templateMultiPass.AvailableShaderProperties.Find( x => x.PropertyName.Equals( "_AlphaCutoff" ) ) == null ) - { - if( !currDataCollector.ContainsProperty("_AlphaCutoff") ) - { - currDataCollector.AddToProperties( UniqueId, "[HideInInspector] _AlphaCutoff(\"Alpha Cutoff \", Range(0, 1)) = 0.5", -1 ); - } - } - - if( m_templateMultiPass.AvailableShaderProperties.Find( x => x.PropertyName.Equals( "_EmissionColor" ) ) == null ) - { - if( !currDataCollector.ContainsProperty( "_EmissionColor" ) ) - { - currDataCollector.AddToProperties( UniqueId, "[HideInInspector] _EmissionColor(\"Emission Color\", Color) = (1,1,1,1)", -1 ); - } - } - } -#endif - - m_templateMultiPass.SetPropertyData( currDataCollector.BuildUnformatedPropertiesStringArr() ); - } - - public void FillSubShaderData( /*MasterNodeDataCollector dataCollector = null */) - { - //MasterNodeDataCollector currDataCollector = ( dataCollector == null ) ? m_currentDataCollector : dataCollector; - //// SubShader Data - - //m_templateMultiPass.SetPropertyData( currDataCollector.BuildUnformatedPropertiesStringArr() ); - //templateMultiPass.SetSubShaderData( TemplateModuleDataType.ModulePass, m_subShaderIdx, currDataCollector.GrabPassList ); - if( ShaderLOD > -1 ) - { - string lodUniqueId = m_templateMultiPass.SubShaders[ m_subShaderIdx ].UniquePrefix + "Module" + m_templateMultiPass.SubShaders[ m_subShaderIdx ].LODContainer.Id; - m_templateMultiPass.IdManager.SetReplacementText( lodUniqueId, "LOD " + ShaderLOD ); - } - - SetModuleData( m_subShaderModule, true ); - } - - public void FillPassData( TemplateMultiPassMasterNode masterNode, TemplateDataCollector mainTemplateDataCollector ) - { - if( m_isInvisible != InvisibilityStatus.Visible ) - { - if( masterNode.UniqueId != UniqueId ) - { - if( ( m_invisibleOptions & (int)InvisibleOptionsEnum.SyncProperties ) > 0 ) - { - PassModule.SyncWith( masterNode.PassModule ); - } - } - - int inputCount = m_inputPorts.Count; - for( int i = 0; i < inputCount; i++ ) - { - if( m_inputPorts[ i ].HasExternalLink ) - { - TemplateMultiPassMasterNode linkedNode = m_inputPorts[ i ].ExternalLinkNode as TemplateMultiPassMasterNode; - if( linkedNode != null ) - { - SetLinkedModuleData( linkedNode.PassModule ); - } - } - } - } - - SetModuleData( m_passModule, false ); - if( m_currentDataCollector != null ) - { - if( Pass.CustomOptionsContainer.CopyOptionsFromMainPass ) - { - SetPassCustomOptionsInfo( m_containerGraph.CurrentMasterNode as TemplateMultiPassMasterNode ); - } - else - { - SetPassCustomOptionsInfo( this ); - } - - var inputArray = m_currentDataCollector.VertexInputList.ToArray(); - - m_templateMultiPass.SetPassData( TemplateModuleDataType.PassVertexData, m_subShaderIdx, m_passIdx, inputArray ); - m_templateMultiPass.SetPassData( TemplateModuleDataType.PassInterpolatorData, m_subShaderIdx, m_passIdx, m_currentDataCollector.InterpolatorList.ToArray() ); - SetHDInfoOnPass(); - List<PropertyDataCollector> afterNativesIncludePragmaDefineList = new List<PropertyDataCollector>(); - afterNativesIncludePragmaDefineList.AddRange( m_currentDataCollector.IncludesList ); - afterNativesIncludePragmaDefineList.AddRange( m_currentDataCollector.DefinesList ); - //includePragmaDefineList.AddRange( m_optionsDefineContainer.DefinesList ); - afterNativesIncludePragmaDefineList.AddRange( m_currentDataCollector.PragmasList ); - afterNativesIncludePragmaDefineList.AddRange( m_currentDataCollector.AfterNativeDirectivesList ); - - //includePragmaDefineList.AddRange( m_currentDataCollector.MiscList ); - - List<PropertyDataCollector> beforeNatives = new List<PropertyDataCollector>(); - beforeNatives.AddRange( m_optionsDefineContainer.DefinesList ); - beforeNatives.AddRange( m_currentDataCollector.BeforeNativeDirectivesList ); - - m_templateMultiPass.SetPassData( TemplateModuleDataType.ModulePragmaBefore, m_subShaderIdx, m_passIdx, beforeNatives ); - m_templateMultiPass.SetPassData( TemplateModuleDataType.ModulePragma, m_subShaderIdx, m_passIdx, afterNativesIncludePragmaDefineList ); - - m_currentDataCollector.TemplateDataCollectorInstance.CloseLateDirectives(); - - //Add Functions - if( m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].Modules.FunctionsTag.IsValid ) - { - m_currentDataCollector.FunctionsList.InsertRange( 0, m_currentDataCollector.TemplateDataCollectorInstance.LateDirectivesList ); - m_templateMultiPass.SetPassData( TemplateModuleDataType.ModuleFunctions, m_subShaderIdx, m_passIdx, m_currentDataCollector.FunctionsList ); - } - else - { - m_currentDataCollector.UniformsList.InsertRange( 0, m_currentDataCollector.TemplateDataCollectorInstance.LateDirectivesList ); - m_currentDataCollector.UniformsList.AddRange( m_currentDataCollector.FunctionsList ); - } - - //copy srp batch if present - //if( m_currentDataCollector.IsSRP ) - //{ - // m_currentDataCollector.UniformsList.AddRange( mainTemplateDataCollector.SrpBatcherPropertiesList ); - //} - //m_templateMultiPass.SetPassData( TemplateModuleDataType.ModuleGlobals, m_subShaderIdx, m_passIdx, m_currentDataCollector.UniformsList ); - - m_templateMultiPass.SetPassData( TemplateModuleDataType.ModuleInputVert, m_subShaderIdx, m_passIdx, m_currentDataCollector.TemplateDataCollectorInstance.VertexInputParamsStr ); - m_templateMultiPass.SetPassData( TemplateModuleDataType.ModuleInputFrag, m_subShaderIdx, m_passIdx, m_currentDataCollector.TemplateDataCollectorInstance.FragInputParamsStr ); - - if( m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].TessVControlTag != null && m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].TessVControlTag.IsValid ) - m_templateMultiPass.SetPassData( TemplateModuleDataType.VControl, m_subShaderIdx, m_passIdx, inputArray ); - - if( m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].TessControlData != null && m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].TessControlData.IsValid ) - m_templateMultiPass.SetPassData( TemplateModuleDataType.ControlData, m_subShaderIdx, m_passIdx, m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].TessControlData.GenerateControl( m_currentDataCollector.TemplateDataCollectorInstance.VertexDataDict, m_currentDataCollector.VertexInputList ) ); - - if( m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].TessDomainData != null && m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].TessDomainData.IsValid ) - m_templateMultiPass.SetPassData( TemplateModuleDataType.DomainData, m_subShaderIdx, m_passIdx, m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].TessDomainData.GenerateDomain( m_currentDataCollector.TemplateDataCollectorInstance.VertexDataDict, m_currentDataCollector.VertexInputList ) ); - - afterNativesIncludePragmaDefineList.Clear(); - afterNativesIncludePragmaDefineList = null; - - beforeNatives.Clear(); - beforeNatives = null; - } - - m_templateMultiPass.SetPassData( TemplateModuleDataType.PassNameData, m_subShaderIdx, m_passIdx, string.Format( PassNameFormateStr, m_passName ) ); - } - - public List<PropertyDataCollector> CrossCheckSoftRegisteredUniformList( List<PropertyDataCollector> uniformList ) - { - List<PropertyDataCollector> newItems = new List<PropertyDataCollector>(); - for( int i = 0; i < uniformList.Count; i++ ) - { - if( !m_currentDataCollector.CheckIfSoftRegistered( uniformList[ i ].PropertyName ) ) - { - newItems.Add( uniformList[ i ] ); - } - } - return newItems; - } - - public void FillUniforms( TemplateDataCollector mainTemplateDataCollector ) - { - if( m_currentDataCollector.IsSRP ) - { - - if( m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].Modules.SRPBatcherTag.IsValid ) - { - List<PropertyDataCollector> finalList = CrossCheckSoftRegisteredUniformList( mainTemplateDataCollector.SrpBatcherPropertiesList ); - m_templateMultiPass.SetPassData( TemplateModuleDataType.ModuleSRPBatcher, m_subShaderIdx, m_passIdx, finalList ); - finalList.Clear(); - finalList = null; - } - else - { - List<PropertyDataCollector> finalList = CrossCheckSoftRegisteredUniformList( mainTemplateDataCollector.FullSrpBatcherPropertiesList ); - m_currentDataCollector.UniformsList.AddRange( finalList ); - finalList.Clear(); - finalList = null; - } - } - m_templateMultiPass.SetPassData( TemplateModuleDataType.ModuleGlobals, m_subShaderIdx, m_passIdx, m_currentDataCollector.UniformsList ); - } - - void SetHDInfoOnPass() - { -#if UNITY_2019_3_OR_NEWER - if( ASEPackageManagerHelper.CurrentHDVersion > ASESRPVersions.ASE_SRP_6_9_1 ) - return; -#endif - - if( m_currentDataCollector.TemplateDataCollectorInstance.CurrentSRPType == TemplateSRPType.HD ) - { - TemplateModulesHelper subShaderHelper = null; - TemplateModulesHelper passHelper = null; - - if( m_isMainOutputNode ) - { - subShaderHelper = m_subShaderModule; - passHelper = m_passModule; - } - else - { - TemplateMultiPassMasterNode masterNode = m_containerGraph.CurrentMasterNode as TemplateMultiPassMasterNode; - if( masterNode != null ) - { - subShaderHelper = masterNode.SubShaderModule; - passHelper = masterNode.PassModule; - } - else - { - subShaderHelper = m_subShaderModule; - passHelper = m_passModule; - } - } - - RenderQueue renderQueue = RenderQueue.Geometry; - RenderType renderType = RenderType.Opaque; - if( passHelper.TagsHelper.HasRenderInfo( ref renderType, ref renderQueue ) || - subShaderHelper.TagsHelper.HasRenderInfo( ref renderType, ref renderQueue ) ) - { - if( renderType == RenderType.Transparent && renderQueue == RenderQueue.Transparent ) - { - SetExtraDefine( SRPMaterialTransparentKeyword ); - //m_currentDataCollector.AddToDefines( UniqueId, SRPMaterialTransparentKeyword ); - TemplatesBlendModule blendOpHelper = passHelper.BlendOpHelper.ValidBlendMode ? passHelper.BlendOpHelper : subShaderHelper.BlendOpHelper; - if( blendOpHelper.IsAdditiveRGB ) - { - SetExtraDefine( SRPMaterialBlendModeAddKeyword ); - //m_currentDataCollector.AddToDefines( UniqueId, SRPMaterialBlendModeAddKeyword ); - } - else if( blendOpHelper.IsAlphaBlendRGB ) - { - SetExtraDefine( SRPMaterialBlendModeAlphaKeyword ); - //m_currentDataCollector.AddToDefines( UniqueId, SRPMaterialBlendModeAlphaKeyword ); - } - } - } - } - } - - void SetLinkedModuleData( TemplateModulesHelper linkedModule ) - { - //if( linkedModule.AdditionalPragmas.ValidData ) - //{ - // linkedModule.AdditionalPragmas.AddToDataCollector( ref m_currentDataCollector, m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].Modules.IncludePragmaContainer ); - //} - - //if( linkedModule.AdditionalIncludes.ValidData ) - //{ - // linkedModule.AdditionalIncludes.AddToDataCollector( ref m_currentDataCollector, m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].Modules.IncludePragmaContainer ); - //} - - //if( linkedModule.AdditionalDefines.ValidData ) - //{ - // linkedModule.AdditionalDefines.AddToDataCollector( ref m_currentDataCollector, m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].Modules.IncludePragmaContainer ); - //} - - if( linkedModule.AdditionalDirectives.ValidData ) - { - linkedModule.AdditionalDirectives.AddAllToDataCollector( ref m_currentDataCollector, m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].Modules.IncludePragmaContainer ); - } - } - - void SetModuleData( TemplateModulesHelper module, bool isSubShader ) - { - if( isSubShader ) - { - - //if ( module.AdditionalPragmas.ValidData ) - //{ - // module.AdditionalPragmas.AddToDataCollector( ref m_currentDataCollector, m_templateMultiPass.SubShaders[ m_subShaderIdx ].Modules.IncludePragmaContainer ); - //} - - //if ( module.AdditionalIncludes.ValidData ) - //{ - // module.AdditionalIncludes.AddToDataCollector( ref m_currentDataCollector, m_templateMultiPass.SubShaders[ m_subShaderIdx ].Modules.IncludePragmaContainer ); - //} - - //if ( module.AdditionalDefines.ValidData ) - //{ - // module.AdditionalDefines.AddToDataCollector( ref m_currentDataCollector, m_templateMultiPass.SubShaders[ m_subShaderIdx ].Modules.IncludePragmaContainer ); - //} - - if( module.AdditionalDirectives.ValidData ) - { - module.AdditionalDirectives.AddAllToDataCollector( ref m_currentDataCollector, m_templateMultiPass.SubShaders[ m_subShaderIdx ].Modules.IncludePragmaContainer ); - } - - if( module.TagsHelper.ValidData ) - { - m_templateMultiPass.SetSubShaderData( TemplateModuleDataType.ModuleTag, m_subShaderIdx, module.TagsHelper.GenerateTags() ); - } - - if( module.AllModulesMode ) - { - string body = module.GenerateAllModulesString( isSubShader ); - m_templateMultiPass.SetSubShaderData( TemplateModuleDataType.AllModules, m_subShaderIdx, body.Split( '\n' ) ); - } - - if( module.ShaderModelHelper.ValidAndIndependent ) - { - m_templateMultiPass.SetSubShaderData( TemplateModuleDataType.ModuleShaderModel, m_subShaderIdx, module.ShaderModelHelper.GenerateShaderData( isSubShader ) ); - } - - if( module.BlendOpHelper.IndependentModule && module.BlendOpHelper.ValidBlendMode ) - { - m_templateMultiPass.SetSubShaderData( TemplateModuleDataType.ModuleBlendMode, m_subShaderIdx, module.BlendOpHelper.CurrentBlendFactor ); - } - - if( module.BlendOpHelper.IndependentModule && module.BlendOpHelper.ValidBlendOp ) - { - m_templateMultiPass.SetSubShaderData( TemplateModuleDataType.ModuleBlendOp, m_subShaderIdx, module.BlendOpHelper.CurrentBlendOp ); - } - - if( module.BlendOpHelper.AlphaToMaskIndependent && module.BlendOpHelper.ValidAlphaToMask ) - { - m_templateMultiPass.SetSubShaderData( TemplateModuleDataType.ModuleAlphaToMask, m_subShaderIdx, module.BlendOpHelper.CurrentAlphaToMask ); - } - - if( module.CullModeHelper.ValidAndIndependent ) - { - m_templateMultiPass.SetSubShaderData( TemplateModuleDataType.ModuleCullMode, m_subShaderIdx, module.CullModeHelper.GenerateShaderData( isSubShader ) ); - } - - if( module.ColorMaskHelper.ValidAndIndependent ) - { - m_templateMultiPass.SetSubShaderData( TemplateModuleDataType.ModuleColorMask, m_subShaderIdx, module.ColorMaskHelper.GenerateShaderData( isSubShader ) ); - } - - if( module.DepthOphelper.IndependentModule && module.DepthOphelper.ValidZTest ) - { - m_templateMultiPass.SetSubShaderData( TemplateModuleDataType.ModuleZTest, m_subShaderIdx, module.DepthOphelper.CurrentZTestMode ); - } - - if( module.DepthOphelper.IndependentModule && module.DepthOphelper.ValidZWrite ) - { - m_templateMultiPass.SetSubShaderData( TemplateModuleDataType.ModuleZwrite, m_subShaderIdx, module.DepthOphelper.CurrentZWriteMode ); - } - - if( module.DepthOphelper.IndependentModule && module.DepthOphelper.ValidOffset ) - { - m_templateMultiPass.SetSubShaderData( TemplateModuleDataType.ModuleZOffset, m_subShaderIdx, module.DepthOphelper.CurrentOffset ); - } - - if( module.StencilBufferHelper.ValidAndIndependent ) - { - CullMode cullMode = ( module.CullModeHelper.ValidData ) ? module.CullModeHelper.CurrentCullMode : CullMode.Back; - string value = module.StencilBufferHelper.CreateStencilOp( cullMode ); - m_templateMultiPass.SetSubShaderData( TemplateModuleDataType.ModuleStencil, m_subShaderIdx, value.Split( '\n' ) ); - } - - } - else - { - //if ( module.AdditionalPragmas.ValidData ) - //{ - // module.AdditionalPragmas.AddToDataCollector( ref m_currentDataCollector, m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].Modules.IncludePragmaContainer ); - //} - - //if ( module.AdditionalIncludes.ValidData ) - //{ - // module.AdditionalIncludes.AddToDataCollector( ref m_currentDataCollector, m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].Modules.IncludePragmaContainer ); - //} - - //if ( module.AdditionalDefines.ValidData ) - //{ - // module.AdditionalDefines.AddToDataCollector( ref m_currentDataCollector, m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].Modules.IncludePragmaContainer ); - //} - List<PropertyDataCollector> aboveUsePass = new List<PropertyDataCollector>(); - List<PropertyDataCollector> belowUsePass = new List<PropertyDataCollector>(); - m_usePass.BuildUsePassInfo( m_currentDataCollector, ref aboveUsePass, ref belowUsePass ); - //TODO Must place this on the correct place - aboveUsePass.AddRange( belowUsePass ); - - //adding grab pass after use pass on purpose, so it wont be caught by them - aboveUsePass.AddRange( m_currentDataCollector.GrabPassList ); - - m_templateMultiPass.SetPassData( TemplateModuleDataType.ModulePass, m_subShaderIdx, m_passIdx, aboveUsePass ); - //m_templateMultiPass.SetPassData( TemplateModuleDataType.EndPass, m_subShaderIdx, m_passIdx, bellowUsePass); - - if( module.AdditionalDirectives.ValidData ) - { - module.AdditionalDirectives.AddAllToDataCollector( ref m_currentDataCollector, m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].Modules.IncludePragmaContainer ); - } - - if( module.TagsHelper.ValidData ) - { - m_templateMultiPass.SetPassData( TemplateModuleDataType.ModuleTag, m_subShaderIdx, m_passIdx, module.TagsHelper.GenerateTags() ); - } - - if( module.AllModulesMode ) - { - string body = module.GenerateAllModulesString( isSubShader ); - m_templateMultiPass.SetPassData( TemplateModuleDataType.AllModules, m_subShaderIdx, m_passIdx, body.Split( '\n' ) ); - } - - if( module.ShaderModelHelper.ValidAndIndependent ) - { - m_templateMultiPass.SetPassData( TemplateModuleDataType.ModuleShaderModel, m_subShaderIdx, m_passIdx, module.ShaderModelHelper.GenerateShaderData( isSubShader ) ); - } - - if( module.BlendOpHelper.IndependentModule && module.BlendOpHelper.ValidBlendMode ) - { - m_templateMultiPass.SetPassData( TemplateModuleDataType.ModuleBlendMode, m_subShaderIdx, m_passIdx, module.BlendOpHelper.CurrentBlendFactor ); - } - - if( module.BlendOpHelper.IndependentModule && module.BlendOpHelper.ValidBlendOp ) - { - m_templateMultiPass.SetPassData( TemplateModuleDataType.ModuleBlendOp, m_subShaderIdx, m_passIdx, module.BlendOpHelper.CurrentBlendOp ); - } - - if( module.BlendOpHelper.AlphaToMaskIndependent && module.BlendOpHelper.ValidAlphaToMask ) - { - m_templateMultiPass.SetPassData( TemplateModuleDataType.ModuleAlphaToMask, m_subShaderIdx, m_passIdx, module.BlendOpHelper.CurrentAlphaToMask ); - } - - if( module.CullModeHelper.ValidAndIndependent ) - { - m_templateMultiPass.SetPassData( TemplateModuleDataType.ModuleCullMode, m_subShaderIdx, m_passIdx, module.CullModeHelper.GenerateShaderData( isSubShader ) ); - } - - if( module.ColorMaskHelper.ValidAndIndependent ) - { - m_templateMultiPass.SetPassData( TemplateModuleDataType.ModuleColorMask, m_subShaderIdx, m_passIdx, module.ColorMaskHelper.GenerateShaderData( isSubShader ) ); - } - - if( module.DepthOphelper.IndependentModule && module.DepthOphelper.ValidZTest ) - { - m_templateMultiPass.SetPassData( TemplateModuleDataType.ModuleZTest, m_subShaderIdx, m_passIdx, module.DepthOphelper.CurrentZTestMode ); - } - - if( module.DepthOphelper.IndependentModule && module.DepthOphelper.ValidZWrite ) - { - m_templateMultiPass.SetPassData( TemplateModuleDataType.ModuleZwrite, m_subShaderIdx, m_passIdx, module.DepthOphelper.CurrentZWriteMode ); - } - - if( module.DepthOphelper.IndependentModule && module.DepthOphelper.ValidOffset ) - { - m_templateMultiPass.SetPassData( TemplateModuleDataType.ModuleZOffset, m_subShaderIdx, m_passIdx, module.DepthOphelper.CurrentOffset ); - } - - if( module.StencilBufferHelper.ValidAndIndependent ) - { - CullMode cullMode = ( module.CullModeHelper.ValidData ) ? module.CullModeHelper.CurrentCullMode : CullMode.Back; - string value = module.StencilBufferHelper.CreateStencilOp( cullMode ); - m_templateMultiPass.SetPassData( TemplateModuleDataType.ModuleStencil, m_subShaderIdx, m_passIdx, value.Split( '\n' ) ); - } - } - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - return "0"; - } - - public override void Destroy() - { - base.Destroy(); - - m_drawInstancedHelper = null; - - m_optionsDefineContainer.Destroy(); - m_optionsDefineContainer = null; - - m_passSelector.Destroy(); - m_passSelector = null; - - m_subShaderOptions.Destroy(); - m_passOptions.Destroy(); - - m_fallbackHelper.Destroy(); - GameObject.DestroyImmediate( m_fallbackHelper ); - m_fallbackHelper = null; - - m_usePass.Destroy(); - GameObject.DestroyImmediate( m_usePass ); - m_usePass = null; - - m_dependenciesHelper.Destroy(); - m_dependenciesHelper = null; - - m_subShaderModule.Destroy(); - m_subShaderModule = null; - m_passModule.Destroy(); - m_passModule = null; - if( m_lodIndex == -1 ) - { - ContainerGraph.MultiPassMasterNodes.RemoveNode( this ); - } - else - { - ContainerGraph.LodMultiPassMasternodes[ m_lodIndex ].RemoveNode( this ); - } - } - - void UpdateSubShaderPassStr() - { - //m_subShaderIdxStr = SubShaderModuleStr + m_templateMultiPass.SubShaders[ m_subShaderIdx ].Idx; - //m_passIdxStr = PassModuleStr + m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].Idx; - } - - public override void ReadFromString( ref string[] nodeParams ) - { - - base.ReadFromString( ref nodeParams ); - try - { - string currShaderName = GetCurrentParam( ref nodeParams ); - if( currShaderName.Length > 0 ) - currShaderName = UIUtils.RemoveShaderInvalidCharacters( currShaderName ); - - m_templateGUID = GetCurrentParam( ref nodeParams ); - bool hasUniqueName = false; - if( UIUtils.CurrentShaderVersion() > PASS_UNIQUE_ID_VERSION ) - { - hasUniqueName = Convert.ToBoolean( GetCurrentParam( ref nodeParams ) ); - } - - if( hasUniqueName ) - m_passUniqueId = GetCurrentParam( ref nodeParams ); - - m_subShaderIdx = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - m_passIdx = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - if( UIUtils.CurrentShaderVersion() > LOD_SUBSHADER_VERSION ) - { - - if( m_lodIndex != -1 ) - { - m_containerGraph.MultiPassMasterNodes.RemoveNode( this ); - m_containerGraph.LodMultiPassMasternodes[ m_lodIndex ].AddNode( this ); - } - } - - m_passName = GetCurrentParam( ref nodeParams ); - SetTemplate( null, false, true, m_subShaderIdx, m_passIdx, SetTemplateSource.ShaderLoad ); - ////If value gotten from template is > -1 then it contains the LOD field - ////and we can properly write the value - //if( m_subShaderLOD > -1 ) - //{ - // m_subShaderLOD = subShaderLOD; - //} - - // only in here, after SetTemplate, we know if shader name is to be used as title or not - ShaderName = currShaderName; - m_visiblePorts = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - m_subShaderModule.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); - m_passModule.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); - if( UIUtils.CurrentShaderVersion() > 15308 ) - { - m_fallbackHelper.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); - m_dependenciesHelper.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); - } - - if( UIUtils.CurrentShaderVersion() > 15402 ) - { - m_usePass.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); - } - - if( UIUtils.CurrentShaderVersion() > 15409 ) - { - m_hdSrpMaterialType = (HDSRPMaterialType)Enum.Parse( typeof( HDSRPMaterialType ), GetCurrentParam( ref nodeParams ) ); - } - - if( UIUtils.CurrentShaderVersion() > 15501 ) - { - if( m_isMainOutputNode && UIUtils.CurrentShaderVersion() > PASS_SELECTOR_VERSION ) - m_subShaderOptions.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); - - m_passOptions.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); - } - - if( m_isMainOutputNode && UIUtils.CurrentShaderVersion() > PASS_SELECTOR_VERSION ) - { - m_passSelector.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); - } - - if( m_isMainOutputNode && UIUtils.CurrentShaderVersion() > 16203 ) - { - m_drawInstancedHelper.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); - } - - if( m_isMainOutputNode && UIUtils.CurrentShaderVersion() > LOD_SUBSHADER_VERSION ) - { - m_mainLODName = GetCurrentParam( ref nodeParams ); - SetupLODNodeName(); - } - else - { - m_content.text = GenerateClippedTitle( m_passName ); - } - - - //if( m_templateMultiPass != null && !m_templateMultiPass.IsSinglePass ) - //{ - // SetClippedTitle( m_passName ); - //} - } - catch( Exception e ) - { - Debug.LogException( e, this ); - } - - m_containerGraph.CurrentCanvasMode = NodeAvailability.TemplateShader; - m_containerGraph.CurrentPrecision = m_currentPrecisionType; - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, ShaderName ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_templateGUID ); - - bool hasUniquePassName = Pass.Modules.HasPassUniqueName; - IOUtils.AddFieldValueToString( ref nodeInfo, hasUniquePassName ); - if( hasUniquePassName ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, Pass.Modules.PassUniqueName ); - } - - IOUtils.AddFieldValueToString( ref nodeInfo, m_subShaderIdx ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_passIdx ); - - IOUtils.AddFieldValueToString( ref nodeInfo, m_passName ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_visiblePorts ); - m_subShaderModule.WriteToString( ref nodeInfo ); - m_passModule.WriteToString( ref nodeInfo ); - m_fallbackHelper.WriteToString( ref nodeInfo ); - m_dependenciesHelper.WriteToString( ref nodeInfo ); - m_usePass.WriteToString( ref nodeInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_hdSrpMaterialType ); - if( m_isMainOutputNode ) - m_subShaderOptions.WriteToString( ref nodeInfo ); - - m_passOptions.WriteToString( ref nodeInfo ); - - if( m_isMainOutputNode ) - { - m_passSelector.WriteToString( ref nodeInfo ); - m_drawInstancedHelper.WriteToString( ref nodeInfo ); - } - - if( m_isMainOutputNode ) - IOUtils.AddFieldValueToString( ref nodeInfo, m_mainLODName ); - - } - - public override void ReadFromDeprecated( ref string[] nodeParams, Type oldType = null ) - { - base.ReadFromString( ref nodeParams ); - try - { - string currShaderName = GetCurrentParam( ref nodeParams ); - if( currShaderName.Length > 0 ) - currShaderName = UIUtils.RemoveShaderInvalidCharacters( currShaderName ); - - string templateGUID = GetCurrentParam( ref nodeParams ); - string templateShaderName = string.Empty; - if( UIUtils.CurrentShaderVersion() > 13601 ) - { - templateShaderName = GetCurrentParam( ref nodeParams ); - } - - TemplateMultiPass template = m_containerGraph.ParentWindow.TemplatesManagerInstance.GetTemplate( templateGUID ) as TemplateMultiPass; - if( template != null ) - { - m_templateGUID = templateGUID; - SetTemplate( null, false, true, 0, 0,SetTemplateSource.ShaderLoad ); - } - else - { - template = m_containerGraph.ParentWindow.TemplatesManagerInstance.GetTemplateByName( templateShaderName ) as TemplateMultiPass; - if( template != null ) - { - m_templateGUID = template.GUID; - SetTemplate( null, false, true, 0, 0, SetTemplateSource.ShaderLoad ); - } - else - { - m_masterNodeCategory = -1; - } - } - - if( m_invalidNode ) - return; - - // only in here, after SetTemplate, we know if shader name is to be used as title or not - ShaderName = currShaderName; - if( UIUtils.CurrentShaderVersion() > 13902 ) - { - - //BLEND MODULE - if( m_templateMultiPass.SubShaders[ 0 ].Modules.BlendData.ValidBlendMode ) - { - m_subShaderModule.BlendOpHelper.ReadBlendModeFromString( ref m_currentReadParamIdx, ref nodeParams ); - } - else if( m_templateMultiPass.SubShaders[ 0 ].Passes[ 0 ].Modules.BlendData.ValidBlendMode ) - { - m_passModule.BlendOpHelper.ReadBlendModeFromString( ref m_currentReadParamIdx, ref nodeParams ); - } - - if( m_templateMultiPass.SubShaders[ 0 ].Modules.BlendData.ValidBlendOp ) - { - m_subShaderModule.BlendOpHelper.ReadBlendOpFromString( ref m_currentReadParamIdx, ref nodeParams ); - } - else if( m_templateMultiPass.SubShaders[ 0 ].Passes[ 0 ].Modules.BlendData.ValidBlendOp ) - { - m_passModule.BlendOpHelper.ReadBlendOpFromString( ref m_currentReadParamIdx, ref nodeParams ); - } - - - //CULL MODE - if( m_templateMultiPass.SubShaders[ 0 ].Modules.CullModeData.DataCheck == TemplateDataCheck.Valid ) - { - m_subShaderModule.CullModeHelper.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); - } - else if( m_templateMultiPass.SubShaders[ 0 ].Passes[ 0 ].Modules.CullModeData.DataCheck == TemplateDataCheck.Valid ) - { - m_passModule.CullModeHelper.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); - } - - //COLOR MASK - if( m_templateMultiPass.SubShaders[ 0 ].Modules.ColorMaskData.DataCheck == TemplateDataCheck.Valid ) - { - m_subShaderModule.ColorMaskHelper.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); - } - else if( m_templateMultiPass.SubShaders[ 0 ].Passes[ 0 ].Modules.ColorMaskData.DataCheck == TemplateDataCheck.Valid ) - { - m_passModule.ColorMaskHelper.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); - } - - //STENCIL BUFFER - if( m_templateMultiPass.SubShaders[ 0 ].Modules.StencilData.DataCheck == TemplateDataCheck.Valid ) - { - m_subShaderModule.StencilBufferHelper.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); - } - else if( m_templateMultiPass.SubShaders[ 0 ].Passes[ 0 ].Modules.StencilData.DataCheck == TemplateDataCheck.Valid ) - { - m_passModule.StencilBufferHelper.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); - } - - } - - if( UIUtils.CurrentShaderVersion() > 14202 ) - { - //DEPTH OPTIONS - if( m_templateMultiPass.SubShaders[ 0 ].Modules.DepthData.ValidZWrite ) - { - m_subShaderModule.DepthOphelper.ReadZWriteFromString( ref m_currentReadParamIdx, ref nodeParams ); - } - else if( m_templateMultiPass.SubShaders[ 0 ].Passes[ 0 ].Modules.DepthData.ValidZWrite ) - { - m_passModule.DepthOphelper.ReadZWriteFromString( ref m_currentReadParamIdx, ref nodeParams ); - } - - if( m_templateMultiPass.SubShaders[ 0 ].Modules.DepthData.ValidZTest ) - { - m_subShaderModule.DepthOphelper.ReadZTestFromString( ref m_currentReadParamIdx, ref nodeParams ); - } - else if( m_templateMultiPass.SubShaders[ 0 ].Passes[ 0 ].Modules.DepthData.ValidZTest ) - { - m_subShaderModule.DepthOphelper.ReadZTestFromString( ref m_currentReadParamIdx, ref nodeParams ); - } - - if( m_templateMultiPass.SubShaders[ 0 ].Modules.DepthData.ValidOffset ) - { - m_subShaderModule.DepthOphelper.ReadOffsetFromString( ref m_currentReadParamIdx, ref nodeParams ); - } - else if( m_templateMultiPass.SubShaders[ 0 ].Passes[ 0 ].Modules.DepthData.ValidOffset ) - { - m_passModule.DepthOphelper.ReadOffsetFromString( ref m_currentReadParamIdx, ref nodeParams ); - } - - } - - //TAGS - if( UIUtils.CurrentShaderVersion() > 14301 ) - { - if( m_templateMultiPass.SubShaders[ 0 ].Modules.TagData.DataCheck == TemplateDataCheck.Valid ) - { - m_subShaderModule.TagsHelper.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); - } - else if( m_templateMultiPass.SubShaders[ 0 ].Passes[ 0 ].Modules.TagData.DataCheck == TemplateDataCheck.Valid ) - { - m_passModule.TagsHelper.ReadFromString( ref m_currentReadParamIdx, ref nodeParams ); - } - - } - } - catch( Exception e ) - { - Debug.LogException( e, this ); - } - m_containerGraph.CurrentCanvasMode = NodeAvailability.TemplateShader; - } - - public void ForceOptionsRefresh() - { - m_passOptions.Refresh(); - if( m_isMainOutputNode ) - m_subShaderOptions.Refresh(); - } - - public void SetPassVisible( string passName, bool visible ) - { - TemplateMultiPassMasterNode node = m_containerGraph.GetMasterNodeOfPass( passName, m_lodIndex ); - if( node != null ) - { - m_passSelector.SetPassVisible( passName, visible ); - node.IsInvisible = !visible; - } - - } - - public override void RefreshExternalReferences() - { - if( m_invalidNode ) - return; - - base.RefreshExternalReferences(); - if( IsLODMainMasterNode ) - { - SetMasterNodeCategoryFromGUID( m_templateGUID ); - } - - CheckTemplateChanges(); - if( m_templateMultiPass != null && m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].Modules.SRPIsPBRHD && UIUtils.CurrentShaderVersion() < 15410 ) - { - FetchHDPorts(); - m_hdSrpMaterialType = ( m_specularPort != null && m_specularPort.HasOwnOrLinkConnection ) ? HDSRPMaterialType.Specular : HDSRPMaterialType.Standard; - ConfigHDPorts(); - } - - if( ContainerGraph.HasLODs ) - { - SetClippedAdditionalTitle( string.Format( LodSubtitle, ShaderLOD ) ); - } - - if( m_isMainOutputNode ) - { - List<TemplateMultiPassMasterNode> masterNodes = ( m_lodIndex == -1 ) ? m_containerGraph.MultiPassMasterNodes.NodesList : m_containerGraph.LodMultiPassMasternodes[ m_lodIndex ].NodesList; - masterNodes.Sort( ( x, y ) => ( x.PassIdx.CompareTo( y.PassIdx ) )); - int passAmount = m_templateMultiPass.SubShaders[ m_subShaderIdx ].PassAmount; - if( passAmount != masterNodes.Count ) - { - UIUtils.ShowMessage( "Template master nodes amount was modified. Could not set correctly its visibility options." ); - } - else - { - for( int i = 0; i < passAmount; i++ ) - { - if( i != m_passIdx ) - { - masterNodes[ i ].IsInvisible = !m_passSelector.IsVisible( i ); - } - } - } - } - } - - public override void ReadInputDataFromString( ref string[] nodeParams ) - { - //For a Template Master Node an input port data must be set by its template and not meta data - if( UIUtils.CurrentShaderVersion() > 17007 ) - return; - - int count = 0; - if( UIUtils.CurrentShaderVersion() > 7003 ) - { - try - { - count = Convert.ToInt32( nodeParams[ m_currentReadParamIdx++ ] ); - } - catch( Exception e ) - { - Debug.LogException( e ); - } - } - else - { - count = ( m_oldInputCount < 0 ) ? m_inputPorts.Count : m_oldInputCount; - } - - for( int i = 0; i < count && i < nodeParams.Length && m_currentReadParamIdx < nodeParams.Length; i++ ) - { - if( UIUtils.CurrentShaderVersion() < 5003 ) - { - int newId = VersionConvertInputPortId( i ); - if( UIUtils.CurrentShaderVersion() > 23 ) - { - m_currentReadParamIdx++; - } - - m_currentReadParamIdx++; - if( m_inputPorts[ newId ].IsEditable && UIUtils.CurrentShaderVersion() >= 3100 && m_currentReadParamIdx < nodeParams.Length ) - { - m_currentReadParamIdx++; - } - } - else - { - m_currentReadParamIdx++; - m_currentReadParamIdx++; - m_currentReadParamIdx++; - bool isEditable = Convert.ToBoolean( nodeParams[ m_currentReadParamIdx++ ] ); - if( isEditable && m_currentReadParamIdx < nodeParams.Length ) - { - m_currentReadParamIdx++; - } - } - } - } - - //For a Template Master Node an input port data must be set by its template and not meta data - public override void WriteInputDataToString( ref string nodeInfo ) { } - - public override float HeightEstimate - { - get - { - float heightEstimate = 0; - heightEstimate = 32 + Constants.INPUT_PORT_DELTA_Y; - if( m_templateMultiPass != null && !m_templateMultiPass.IsSinglePass ) - { - heightEstimate += 22; - } - float internalPortSize = 0; - for( int i = 0; i < InputPorts.Count; i++ ) - { - if( InputPorts[ i ].Visible ) - internalPortSize += 18 + Constants.INPUT_PORT_DELTA_Y; - } - - return heightEstimate + Mathf.Max( internalPortSize, m_insideSize.y ); - } - } - - public HDSRPMaterialType CurrentHDMaterialType - { - get { return m_hdSrpMaterialType; } - set - { - m_hdSrpMaterialType = value; - if( m_isMainOutputNode ) - { - List<TemplateMultiPassMasterNode> mpNodes = UIUtils.CurrentWindow.CurrentGraph.MultiPassMasterNodes.NodesList; - int count = mpNodes.Count; - for( int i = 0; i < count; i++ ) - { - if( mpNodes[ i ].UniqueId != UniqueId ) - { - mpNodes[ i ].CurrentHDMaterialType = value; - } - } - } - } - } - public TemplateSubShader SubShader { get { return m_templateMultiPass.SubShaders[ m_subShaderIdx ]; } } - public TemplatePass Pass { get { return m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ]; } } - public int SubShaderIdx { get { return m_subShaderIdx; } } - public int PassIdx { get { return m_passIdx; } } - public TemplateMultiPass CurrentTemplate { get { return m_templateMultiPass; } } - public TemplateModulesHelper SubShaderModule { get { return m_subShaderModule; } } - public TemplateModulesHelper PassModule { get { return m_passModule; } } - public string PassName { get { return m_templateMultiPass.SubShaders[ m_subShaderIdx ].Passes[ m_passIdx ].PassNameContainer.Data; } } - public string PassUniqueName - { - get - { - return string.IsNullOrEmpty( m_passUniqueId ) ? m_originalPassName : m_passUniqueId; - } - } - - public string OriginalPassName { get { return m_originalPassName; } } - public bool HasLinkPorts { get { return m_hasLinkPorts; } } - public bool IsInvisible - { - get - { - return m_isInvisible != InvisibilityStatus.Visible; - } - set - { - if( m_isInvisible != InvisibilityStatus.LockedInvisible && !m_isMainOutputNode ) - { - m_isInvisible = value ? InvisibilityStatus.Invisible : InvisibilityStatus.Visible; - if( value ) - { - for( int i = 0; i < m_inputPorts.Count; i++ ) - { - m_inputPorts[ i ].FullDeleteConnections(); - } - } - } - } - } - - public TemplatePassSelectorHelper PassSelector { get { return m_passSelector; } } - public TemplateOptionsUIHelper PassOptions { get { return m_passOptions; } } - public TemplateOptionsUIHelper SubShaderOptions { get { return m_subShaderOptions; } } - public TemplateOptionsDefinesContainer OptionsDefineContainer { get { return m_optionsDefineContainer; } } - public TerrainDrawInstancedHelper DrawInstancedHelperInstance { get { return m_drawInstancedHelper; } } - public bool InvalidNode { get { return m_invalidNode; } } - public override void SetName( string name ) - { - ShaderName = name; - } - public bool IsLODMainFirstPass { get { return m_passIdx == 0 && m_lodIndex == -1; } } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMultiPassMasterNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMultiPassMasterNode.cs.meta deleted file mode 100644 index a96d88d0..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMultiPassMasterNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: fce684c26c654d14e927860863cd99dd -timeCreated: 1517406883 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMultiPassSwitchNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMultiPassSwitchNode.cs deleted file mode 100644 index e8aeadf8..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMultiPassSwitchNode.cs +++ /dev/null @@ -1,328 +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.Collections.Generic; - -namespace AmplifyShaderEditor -{ - - [Serializable] - public class InputSwitchMPHelper - { - public int SubShaderIdx; - public int PassIdx; - public InputSwitchMPHelper( int subShaderIdx, int passIdx ) - { - SubShaderIdx = subShaderIdx; - PassIdx = passIdx; - } - } - - [Serializable] - [NodeAttributes( "Template Multi-Pass Switch", "Logical Operators", "Relays, in compile time, the correct input port according to current analyzed sub-shader/pass." )] - public sealed class TemplateMultiPassSwitchNode : TemplateNodeParent - { - private const string InputLabelStr = "SubShader {0} Pass {1}"; - - [SerializeField] - private List<InputSwitchMPHelper> m_inputHelper = new List<InputSwitchMPHelper>(); - - [SerializeField] - private int m_inputCountHelper = -1; - - protected override void CommonInit( int uniqueId ) - { - m_createAllOutputs = false; - base.CommonInit( uniqueId ); - } - - public override void OnInputPortConnected( int portId, int otherNodeId, int otherPortId, bool activateNode = true ) - { - base.OnInputPortConnected( portId, otherNodeId, otherPortId, activateNode ); - UpdateConnections(); - } - - public override void OnConnectedOutputNodeChanges( int inputPortId, int otherNodeId, int otherPortId, string name, WirePortDataType type ) - { - base.OnConnectedOutputNodeChanges( inputPortId, otherNodeId, otherPortId, name, type ); - UpdateConnections(); - } - - public override void OnInputPortDisconnected( int portId ) - { - base.OnInputPortDisconnected( portId ); - UpdateConnections(); - } - - private void UpdateConnections() - { - WirePortDataType mainType = WirePortDataType.FLOAT; - - int highest = UIUtils.GetPriority( mainType ); - for( int i = 0; i < m_inputPorts.Count; i++ ) - { - if( m_inputPorts[ i ].IsConnected ) - { - WirePortDataType portType = m_inputPorts[ i ].GetOutputConnection().DataType; - if( UIUtils.GetPriority( portType ) > highest ) - { - mainType = portType; - highest = UIUtils.GetPriority( portType ); - } - } - } - - for( int i = 0; i < m_inputPorts.Count; i++ ) - { - m_inputPorts[ i ].ChangeType( mainType, false ); - } - - m_outputPorts[ 0 ].ChangeType( mainType, false ); - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - - if( m_templateMPData == null ) - { - FetchMultiPassTemplate(); - if( m_inputPorts.Count != m_inputCountHelper ) - { - CreateInputPorts(); - } - else - { - RefreshInputPorts(); - } - } - } - - - public void RefreshInputPorts() - { - if( m_multiPassMode ) - { - m_inputHelper.Clear(); - if( m_templateMPData != null ) - { - int index = 0; - int subShaderCount = m_templateMPData.SubShaders.Count; - for( int subShaderIdx = 0; subShaderIdx < subShaderCount; subShaderIdx++ ) - { - int passCount = m_templateMPData.SubShaders[ subShaderIdx ].Passes.Count; - for( int passIdx = 0; passIdx < passCount; passIdx++ ) - { - if( m_templateMPData.SubShaders[ subShaderIdx ].Passes[ passIdx ].HasValidFunctionBody ) - { - m_inputPorts[ index ].Name = string.Format( InputLabelStr, subShaderIdx, passIdx ); - m_inputHelper.Add( new InputSwitchMPHelper( subShaderIdx, passIdx ) ); - index += 1; - } - } - } - } - } - else - { - m_inputPorts[0].Name = "In"; - } - } - - public int RefreshInputCountHelper() - { - int inputCountHelper = 0; - if( m_multiPassMode ) - { - if( m_templateMPData != null ) - { - int subShaderCount = m_templateMPData.SubShaders.Count; - for( int subShaderIdx = 0; subShaderIdx < subShaderCount; subShaderIdx++ ) - { - int passCount = m_templateMPData.SubShaders[ subShaderIdx ].Passes.Count; - for( int passIdx = 0; passIdx < passCount; passIdx++ ) - { - if( m_templateMPData.SubShaders[ subShaderIdx ].Passes[passIdx].HasValidFunctionBody ) - inputCountHelper += 1; - } - } - } - } - else - { - inputCountHelper += 1; - } - return inputCountHelper; - } - - public void CreateInputPorts() - { - m_inputCountHelper = 0; - DeleteAllInputConnections( true ); - if( m_multiPassMode ) - { - m_inputHelper.Clear(); - if( m_templateMPData != null ) - { - int subShaderCount = m_templateMPData.SubShaders.Count; - for( int subShaderIdx = 0; subShaderIdx < subShaderCount; subShaderIdx++ ) - { - int passCount = m_templateMPData.SubShaders[ subShaderIdx ].Passes.Count; - for( int passIdx = 0; passIdx < passCount; passIdx++ ) - { - if( m_templateMPData.SubShaders[ subShaderIdx ].Passes[ passIdx ].HasValidFunctionBody ) - { - AddInputPort( WirePortDataType.FLOAT, false, string.Format( InputLabelStr, subShaderIdx, passIdx ) ); - m_inputHelper.Add( new InputSwitchMPHelper( subShaderIdx, passIdx ) ); - m_inputCountHelper += 1; - } - } - } - } - } - else - { - AddInputPort( WirePortDataType.FLOAT, false, "In" ); - m_inputCountHelper += 1; - } - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if( dataCollector.MasterNodeCategory != AvailableShaderTypes.Template ) - { - UIUtils.ShowMessage( "Template Multi-Pass Switch Data node is only intended for templates use only" ); - return m_outputPorts[ 0 ].ErrorValue; - } - - int currSubShaderIdx = dataCollector.TemplateDataCollectorInstance.MultipassSubshaderIdx; - int currPassIdx = dataCollector.TemplateDataCollectorInstance.MultipassPassIdx; - - int inputHelperCount = m_inputHelper.Count; - for( int i = 0; i< inputHelperCount; i++ ) - { - if(m_inputHelper[i].SubShaderIdx == currSubShaderIdx && m_inputHelper[ i ].PassIdx == currPassIdx ) - return m_inputPorts[ i ].GeneratePortInstructions( ref dataCollector ); - } - - UIUtils.ShowMessage( "Invalid subshader or pass on Template Multi-Pass Switch Data" ); - return m_outputPorts[ 0 ].ErrorValue; - } - - public override void OnMasterNodeReplaced( MasterNode newMasterNode ) - { - base.OnMasterNodeReplaced( newMasterNode ); - if( newMasterNode.CurrentMasterNodeCategory == AvailableShaderTypes.Template ) - { - FetchMultiPassTemplate( newMasterNode ); - m_inputCountHelper = RefreshInputCountHelper(); - if( m_inputPorts.Count != m_inputCountHelper ) - { - CreateInputPorts(); - } - else - { - RefreshInputPorts(); - } - } - else - { - DeleteAllInputConnections( true ); - } - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - m_inputCountHelper = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - // Need to add ports here so read internal data is correct - for( int i = 0; i < m_inputCountHelper; i++ ) - { - AddInputPort( WirePortDataType.FLOAT, false, Constants.EmptyPortValue ); - } - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_inputCountHelper ); - } - - public override void Destroy() - { - base.Destroy(); - m_inputHelper.Clear(); - m_inputHelper = null; - } - - public override void RefreshExternalReferences() - { - base.RefreshExternalReferences(); - FetchMultiPassTemplate(); - - bool create = false; - if( m_inputCountHelper == -1 ) - { - create = true; - } - else - { - int newInputCount = RefreshInputCountHelper(); - if( newInputCount != m_inputCountHelper ) - { - create = true; - } - } - - - if( m_multiPassMode ) - { - if( m_templateMPData != null ) - { - if( create ) - { - CreateInputPorts(); - } - else - { - m_inputHelper.Clear(); - int index = 0; - int subShaderCount = m_templateMPData.SubShaders.Count; - for( int subShaderIdx = 0; subShaderIdx < subShaderCount; subShaderIdx++ ) - { - int passCount = m_templateMPData.SubShaders[ subShaderIdx ].Passes.Count; - for( int passIdx = 0; passIdx < passCount; passIdx++ ) - { - if( m_templateMPData.SubShaders[ subShaderIdx ].Passes[ passIdx ].HasValidFunctionBody ) - { - m_inputPorts[ index ].Name = string.Format( InputLabelStr, subShaderIdx, passIdx ); - m_inputHelper.Add( new InputSwitchMPHelper( subShaderIdx, passIdx )); - index += 1; - } - } - } - - if( index != m_inputCountHelper ) - { - Debug.LogWarning( "Something wrong occured in reading MultiPass Switch node" ); - } - } - } - } - else - { - if( create ) - { - AddInputPort( WirePortDataType.FLOAT, false, "In" ); - } - else - { - m_inputPorts[ 0 ].Name = "In"; - } - } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMultiPassSwitchNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMultiPassSwitchNode.cs.meta deleted file mode 100644 index 4aafb59d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateMultiPassSwitchNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 58e4eb5fc3fed124384eef956c6c3ee1 -timeCreated: 1519319737 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateNodeParent.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateNodeParent.cs deleted file mode 100644 index 1bfc8aa9..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateNodeParent.cs +++ /dev/null @@ -1,272 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using System.Collections.Generic; -using UnityEngine; -using UnityEditor; - -namespace AmplifyShaderEditor -{ - [Serializable] - public class TemplateNodeParent : ParentNode - { - - - protected const string ErrorMessageStr = "This node can only be used inside a Template category!"; - protected const string DataLabelStr = "Data"; - protected const string SubShaderStr = "SubShader"; - protected const string PassStr = "Pass"; - - [SerializeField] - private int m_subShaderIdx = 0; - - [SerializeField] - private int m_passIdx = 0; - - [SerializeField] - private int m_passLocalArrayIdx = 0; - - [SerializeField] - protected bool m_multiPassMode = false; - - [SerializeField] - protected string[] m_availableSubshaders; - - [SerializeField] - protected string[] m_availablePassesLabels; - - [SerializeField] - protected int[] m_availablePassesValues; - - [NonSerialized] - protected TemplateMultiPass m_templateMPData = null; - protected bool m_createAllOutputs = true; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - AddOutputPort( WirePortDataType.FLOAT, "Out" ); - if( m_createAllOutputs ) - { - AddOutputPort( WirePortDataType.FLOAT, "X" ); - AddOutputPort( WirePortDataType.FLOAT, "Y" ); - AddOutputPort( WirePortDataType.FLOAT, "Z" ); - AddOutputPort( WirePortDataType.FLOAT, "W" ); - } - m_textLabelWidth = 67; - m_hasLeftDropdown = true; - } - - public override void AfterCommonInit() - { - base.AfterCommonInit(); - - if( PaddingTitleLeft == 0 ) - { - PaddingTitleLeft = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; - if( PaddingTitleRight == 0 ) - PaddingTitleRight = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; - } - } - - protected void ConfigurePorts() - { - switch( m_outputPorts[ 0 ].DataType ) - { - default: - { - for( int i = 1; i < 5; i++ ) - { - m_outputPorts[ i ].Visible = false; - } - } - break; - case WirePortDataType.FLOAT2: - { - for( int i = 1; i < 5; i++ ) - { - m_outputPorts[ i ].Visible = ( i < 3 ); - if( m_outputPorts[ i ].Visible ) - { - m_outputPorts[ i ].Name = Constants.ChannelNamesVector[ i - 1 ]; - } - } - } - break; - case WirePortDataType.FLOAT3: - { - for( int i = 1; i < 5; i++ ) - { - m_outputPorts[ i ].Visible = ( i < 4 ); - if( m_outputPorts[ i ].Visible ) - { - m_outputPorts[ i ].Name = Constants.ChannelNamesVector[ i - 1 ]; - } - } - } - break; - case WirePortDataType.FLOAT4: - { - for( int i = 1; i < 5; i++ ) - { - m_outputPorts[ i ].Visible = true; - m_outputPorts[ i ].Name = Constants.ChannelNamesVector[ i - 1 ]; - } - } - break; - case WirePortDataType.COLOR: - { - for( int i = 1; i < 5; i++ ) - { - m_outputPorts[ i ].Visible = true; - m_outputPorts[ i ].Name = Constants.ChannelNamesColor[ i - 1 ]; - } - } - break; - } - m_sizeIsDirty = true; - } - - protected virtual void OnSubShaderChange() { } - protected virtual void OnPassChange() { } - - protected void DrawSubShaderUI() - { - EditorGUI.BeginChangeCheck(); - m_subShaderIdx = EditorGUILayoutPopup( SubShaderStr, m_subShaderIdx, m_availableSubshaders ); - if( EditorGUI.EndChangeCheck() ) - { - //UpdateSubShaderAmount(); - UpdatePassAmount(); - OnSubShaderChange(); - } - } - - protected void DrawPassUI() - { - EditorGUI.BeginChangeCheck(); - m_passLocalArrayIdx = EditorGUILayoutPopup( PassStr, m_passLocalArrayIdx, m_availablePassesLabels ); - if( EditorGUI.EndChangeCheck() ) - { - m_passIdx = m_availablePassesValues[ m_passLocalArrayIdx ]; - //UpdatePassAmount(); - OnPassChange(); - } - } - - virtual protected void CheckWarningState() - { - if( m_containerGraph.CurrentCanvasMode != NodeAvailability.TemplateShader ) - { - ShowTab( NodeMessageType.Error, ErrorMessageStr ); - } - else - { - m_showErrorMessage = false; - } - } - - protected void FetchMultiPassTemplate( MasterNode masterNode = null ) - { - m_multiPassMode = m_containerGraph.MultiPassMasterNodes.NodesList.Count > 0; - if( m_multiPassMode ) - { - m_templateMPData = ( ( ( masterNode == null ) ? m_containerGraph.CurrentMasterNode : masterNode ) as TemplateMultiPassMasterNode ).CurrentTemplate; - if( m_templateMPData != null ) - { - UpdateSubShaderAmount(); - } - } - } - - protected void UpdateSubShaderAmount() - { - if( m_templateMPData == null ) - m_templateMPData = ( m_containerGraph.CurrentMasterNode as TemplateMultiPassMasterNode ).CurrentTemplate; - - if( m_templateMPData != null ) - { - int subShaderCount = m_templateMPData.SubShaders.Count; - if( m_availableSubshaders == null || subShaderCount != m_availableSubshaders.Length ) - { - m_availableSubshaders = new string[ subShaderCount ]; - for( int i = 0; i < subShaderCount; i++ ) - { - m_availableSubshaders[ i ] = i.ToString(); - } - } - m_subShaderIdx = Mathf.Min( m_subShaderIdx, subShaderCount - 1 ); - UpdatePassAmount(); - } - } - protected virtual bool ValidatePass( int passIdx ) { return true; } - protected void UpdatePassAmount() - { - if( !m_multiPassMode ) - return; - - if( m_templateMPData == null ) - m_templateMPData = ( m_containerGraph.CurrentMasterNode as TemplateMultiPassMasterNode ).CurrentTemplate; - - List<string> passLabels = new List<string>(); - List<int> passValues = new List<int>(); - int minPassIdx = int.MaxValue; - int passCount = m_templateMPData.SubShaders[ m_subShaderIdx ].Passes.Count; - bool resetPassIdx = true; - for( int i = 0; i < passCount; i++ ) - { - if( ValidatePass( i ) ) - { - passLabels.Add( i.ToString() ); - passValues.Add( i ); - minPassIdx = Mathf.Min( minPassIdx, i ); - if( m_passIdx == i ) - resetPassIdx = false; - } - } - m_availablePassesLabels = passLabels.ToArray(); - m_availablePassesValues = passValues.ToArray(); - if( resetPassIdx ) - m_passIdx = minPassIdx; - - RefreshPassLocalArrayIdx(); - } - - void RefreshPassLocalArrayIdx( ) - { - for( int i = 0; i < m_availablePassesValues.Length; i++ ) - { - if( m_availablePassesValues[ i ] == m_passIdx ) - { - m_passLocalArrayIdx = i; - } - } - } - - public override void Destroy() - { - base.Destroy(); - m_templateMPData = null; - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - if( UIUtils.CurrentShaderVersion() > TemplatesManager.MPShaderVersion ) - { - m_subShaderIdx = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - m_passIdx = Convert.ToInt32( GetCurrentParam( ref nodeParams ) ); - } - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_subShaderIdx ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_passIdx ); - } - public int SubShaderIdx { get { return m_subShaderIdx; } } - public int PassIdx { get { return m_passIdx; } } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateNodeParent.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateNodeParent.cs.meta deleted file mode 100644 index 134dcd6c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateNodeParent.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: b21cb297a12ef0a4281213619e3e76bf -timeCreated: 1519235586 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsData.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsData.cs deleted file mode 100644 index afebbc85..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsData.cs +++ /dev/null @@ -1,958 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using System.Text.RegularExpressions; -using System.Collections.Generic; -using UnityEngine; - -namespace AmplifyShaderEditor -{ - /*ase_pass_options OLDEST - DefineOnConnected:portId:definevalue - DefineOnUnconnected:portId:definevalue - Options:name:defaultOption:opt0:opt1:opt2 - SetVisible:PortId:OptionName:OptionValue - */ - - /*ase_pass_options OLD - Option:Option Name:UI Type:Default:Item0,Item1,Item3...ItemN - Action:Action Type:Action Data:ConditionA && ConditionB || ConditionC: - */ - - /*ase_pass_options:UniqueId:PropagateDataToHiddenPasses - Option:Color Offset:A,B,C:A - A:ShowPort:My Port Name - B,C:HidePort:My Port Name - B:SetDefine:MY_DEFINE - C:SetDefine:MY_COLOR_DEFINE - Option:My Other Option:True,False - True:ShowOption:Color Offset - False:HideOption:Color Offset - Port:My Port Name - On:SetDefine:MY_COLOR_DEFINE - Off:UnsetDefine:MY_COLOR_DEFINE - */ - public enum AseOptionsUIWidget - { - Dropdown, - Toggle, - Float, - FloatRange, - Int, - IntRange - } - - public enum AseOptionsType - { - Option, - Port, - Field - } - - - public enum AseOptionItemSetup - { - None, - InvertActionOnDeselection - } - - public enum AseOptionsActionType - { - ShowOption, - HideOption, - SetOption, - HidePort, - ShowPort, - SetPortName, - SetDefine, - RemoveDefine, - SetUndefine, - RemoveUndefine, - ExcludePass, - IncludePass, - SetPropertyOnPass, - SetPropertyOnSubShader, - SetShaderProperty, - SetMaterialProperty - } - - public enum PropertyActionsEnum - { - CullMode, - ColorMask, - ZWrite, - ZTest, - ZOffsetFactor, - ZOffsetUnits, - BlendRGB, - BlendAlpha, - BlendOpRGB, - BlendOpAlpha, - StencilReference, - StencilReadMask, - StencilWriteMask, - StencilComparison, - StencilPass, - StencilFail, - StencilZFail, - RenderType, - RenderQueue - } - - public enum AseOptionsSetup - { - CopyOptionsFromMainPass, - Id, - Name - } - - [Serializable] - public class TemplateActionItem - { - public AseOptionsActionType ActionType; - public string ActionData = string.Empty; - public int ActionDataIdx = -1; - - public string PassName; - public bool AllPasses = false; - - public PropertyActionsEnum PropertyAction; - //CULL - public CullMode ActionCullMode; - //COLOR MASK - public bool[] ColorMask = { true, true, true, true }; - - //DEPTH - public ZWriteMode ActionZWrite; - public ZTestMode ActionZTest; - public float ActionZOffsetFactor; - public float ActionZOffsetUnits; - - //BLEND OPS - public AvailableBlendFactor ActionBlendRGBSource; - public AvailableBlendFactor ActionBlendRGBDest; - - public AvailableBlendFactor ActionBlendAlphaSource; - public AvailableBlendFactor ActionBlendAlphaDest; - - public AvailableBlendOps ActionBlendOpRGB; - public AvailableBlendOps ActionBlendOpAlpha; - - //STENCIL - public int ActionStencilReference; - public int ActionStencilReadMask; - public int ActionStencilWriteMask; - public int ActionStencilComparison; - public int ActionStencilPass; - public int ActionStencilFail; - public int ActionStencilZFail; - - public bool CopyFromSubShader = false; - - public string ActionBuffer; - public override string ToString() - { - return ActionType + " " + ActionData + " " + ActionDataIdx; - } - } - - [Serializable] - public class TemplateActionItemGrid - { - [Serializable] - public class TemplateActionItemRow - { - public TemplateActionItem[] Columns; - } - - public TemplateActionItemRow[] Rows; - - public TemplateActionItemGrid( int rowsCount ) - { - Rows = new TemplateActionItemRow[ rowsCount ]; - } - - public TemplateActionItem this[ int row, int column ] - { - get { return Rows[ row ].Columns[ column ]; } - set { Rows[ row ].Columns[ column ] = value; } - } - - public TemplateActionItem[] this[ int row ] - { - get { return Rows[ row ].Columns; } - - set - { - if( Rows[ row ] == null ) - Rows[ row ] = new TemplateActionItemRow(); - - Rows[ row ].Columns = value; - } - } - } - - [Serializable] - public class TemplateOptionsItem - { - public AseOptionsType Type; - public AseOptionsUIWidget UIWidget; - public AseOptionItemSetup Setup = AseOptionItemSetup.None; - - public string Id = string.Empty; - public string Name = string.Empty; - public string DefaultOption = string.Empty; - public string[] Options = null; - public string[] DisplayOptions = null; - public int DisableIdx = -1; - - [SerializeField] - private float m_defaultFieldValue; - - public float FieldMin; - public float FieldMax; - - public bool FieldInline; - public string FieldInlineName; - public string FieldInlineOutput = string.Empty; - - [SerializeField] - public InlineProperty FieldValue = new InlineProperty(); - - public TemplateActionItemGrid ActionsPerOption = null; - - public int Count = 0; - - [SerializeField] - private int m_defaultOptionIndex = -1; - - ~TemplateOptionsItem() - { - Options = null; - } - - public int OptionIndexFor( string option ) - { - for( int i = 0; i < Options.Length; i++ ) - { - if( Options[ i ].Equals( option ) ) - { - return i; - } - } - Debug.LogWarning( "Couldn't find index for option: " + option ); - return 0; - } - - public int DefaultOptionIndex - { - get - { - if( m_defaultOptionIndex > -1 ) - return m_defaultOptionIndex; - - for( int i = 0; i < Options.Length; i++ ) - { - if( Options[ i ].Equals( DefaultOption ) ) - { - m_defaultOptionIndex = i; - return i; - } - } - Debug.LogWarning( "Couldn't find index for default option: " + DefaultOption ); - return 0; - } - } - - public float DefaultFieldValue - { - get - { - return m_defaultFieldValue; - } - set - { - m_defaultFieldValue = value; - } - } - } - - [Serializable] - public class TemplateOptionsContainer - { - public bool Enabled = false; - public string Body = string.Empty; - public int Index = -1; - public int Id = -1; - public string Name = string.Empty; - public bool CopyOptionsFromMainPass = false; - public TemplateOptionsItem[] Options = null; - ~TemplateOptionsContainer() - { - Options = null; - } - - public void CopyPortOptionsFrom( TemplateOptionsContainer container, string passName ) - { - if( container == null || container.Options == null ) - return; - - List<TemplateOptionsItem> newItems = new List<TemplateOptionsItem>(); - for( int i = 0; i < container.Options.Length; i++ ) - { - if( container.Options[ i ].Type == AseOptionsType.Port && - container.Options[ i ].Id.Equals( passName ) ) - { - newItems.Add( container.Options[ i ] ); - } - } - - if( newItems.Count > 0 ) - { - Enabled = true; - if( Options == null ) - { - Options = newItems.ToArray(); - } - else - { - Array.Resize<TemplateOptionsItem>( ref Options, Options.Length + newItems.Count ); - Array.Copy( newItems.ToArray(), Options, newItems.Count ); - } - } - newItems.Clear(); - newItems = null; - } - - public int EndIndex { get { return Index + Body.Length; } } - } - - public class TemplateOptionsToolsHelper - { - //public const string PassOptionsMainPattern = @"\/\*ase_pass_options:([\w:= ]*)[\n]([\w: \t;\n&|,_\+-]*)\*\/"; - //public const string SubShaderOptionsMainPattern = @"\/\*ase_subshader_options:([\w:= ]*)[\n]([\w: \t;\n&|,_\+-]*)\*\/"; - public const string PassOptionsMainPattern = "\\/\\*ase_pass_options:([\\w:= ]*)[\n]([\\w: \t;\n&|,_\\+\\-\\(\\)\\[\\]\\\"\\=\\/\\.]*)\\*\\/"; - public const string SubShaderOptionsMainPattern = "\\/\\*ase_subshader_options:([\\w:= ]*)[\n]([\\w: \t;\n&|,_\\+\\-\\(\\)\\[\\]\\\"\\=\\/\\.]*)\\*\\/"; - public static readonly char OptionsDataSeparator = ','; - public static Dictionary<string, AseOptionsSetup> AseOptionsSetupDict = new Dictionary<string, AseOptionsSetup>() - { - { "CopyOptionsFromMainPass",AseOptionsSetup.CopyOptionsFromMainPass}, - { "Id",AseOptionsSetup.Id}, - { "Name",AseOptionsSetup.Name}, - }; - - public static Dictionary<string, AseOptionsUIWidget> AseOptionsUITypeDict = new Dictionary<string, AseOptionsUIWidget>() - { - { "Dropdown",AseOptionsUIWidget.Dropdown }, - { "Toggle", AseOptionsUIWidget.Toggle } - }; - - public static Dictionary<string, AseOptionsActionType> AseOptionsActionTypeDict = new Dictionary<string, AseOptionsActionType>() - { - {"ShowOption", AseOptionsActionType.ShowOption }, - {"HideOption", AseOptionsActionType.HideOption }, - {"SetOption", AseOptionsActionType.SetOption }, - {"HidePort", AseOptionsActionType.HidePort }, - {"ShowPort", AseOptionsActionType.ShowPort }, - {"SetPortName", AseOptionsActionType.SetPortName }, - {"SetDefine", AseOptionsActionType.SetDefine }, - {"RemoveDefine", AseOptionsActionType.RemoveDefine }, - {"SetUndefine", AseOptionsActionType.SetUndefine }, - {"RemoveUndefine", AseOptionsActionType.RemoveUndefine }, - {"ExcludePass", AseOptionsActionType.ExcludePass }, - {"IncludePass", AseOptionsActionType.IncludePass }, - {"SetPropertyOnPass", AseOptionsActionType.SetPropertyOnPass }, - {"SetPropertyOnSubShader", AseOptionsActionType.SetPropertyOnSubShader }, - {"SetShaderProperty", AseOptionsActionType.SetShaderProperty }, - {"SetMaterialProperty", AseOptionsActionType.SetMaterialProperty } - }; - - public static Dictionary<string, AseOptionItemSetup> AseOptionItemSetupDict = new Dictionary<string, AseOptionItemSetup> - { - {"None", AseOptionItemSetup.None }, - { "InvertActionOnDeselection", AseOptionItemSetup.InvertActionOnDeselection} - }; - - public static bool InvertAction( AseOptionsActionType original, ref AseOptionsActionType inverted ) - { - bool success = true; - switch( original ) - { - case AseOptionsActionType.ShowOption: - inverted = AseOptionsActionType.HideOption; - break; - case AseOptionsActionType.HideOption: - inverted = AseOptionsActionType.ShowOption; - break; - case AseOptionsActionType.HidePort: - inverted = AseOptionsActionType.ShowPort; - break; - case AseOptionsActionType.ShowPort: - inverted = AseOptionsActionType.HidePort; - break; - case AseOptionsActionType.SetDefine: - inverted = AseOptionsActionType.RemoveDefine; - break; - case AseOptionsActionType.RemoveDefine: - inverted = AseOptionsActionType.SetDefine; - break; - case AseOptionsActionType.SetUndefine: - inverted = AseOptionsActionType.RemoveUndefine; - break; - case AseOptionsActionType.RemoveUndefine: - inverted = AseOptionsActionType.SetUndefine; - break; - case AseOptionsActionType.ExcludePass: - inverted = AseOptionsActionType.IncludePass; - break; - case AseOptionsActionType.IncludePass: - inverted = AseOptionsActionType.ExcludePass; - break; - case AseOptionsActionType.SetPortName: - case AseOptionsActionType.SetOption: - case AseOptionsActionType.SetPropertyOnPass: - case AseOptionsActionType.SetPropertyOnSubShader: - success = false; - break; - } - return success; - } - - - public static TemplateOptionsContainer GenerateOptionsContainer( bool isSubShader, string data ) - { - TemplateOptionsContainer optionsContainer = new TemplateOptionsContainer(); - - Match match = Regex.Match( data, isSubShader ? SubShaderOptionsMainPattern : PassOptionsMainPattern ); - optionsContainer.Enabled = match.Success; - if( match.Success ) - { - try - { - optionsContainer.Body = match.Value; - optionsContainer.Index = match.Index; - - List<TemplateOptionsItem> optionItemsList = new List<TemplateOptionsItem>(); - List<List<TemplateActionItem>> actionItemsList = new List<List<TemplateActionItem>>(); - Dictionary<string, int> optionItemToIndex = new Dictionary<string, int>(); - TemplateOptionsItem currentOption = null; - - //OPTIONS OVERALL SETUP - string[] setupLines = match.Groups[ 1 ].Value.Split( ':' ); - for( int i = 0; i < setupLines.Length; i++ ) - { - if( AseOptionsSetupDict.ContainsKey( setupLines[ i ] ) ) - { - AseOptionsSetup setup = AseOptionsSetupDict[ setupLines[ i ] ]; - switch( setup ) - { - case AseOptionsSetup.CopyOptionsFromMainPass: optionsContainer.CopyOptionsFromMainPass = true; break; - } - } - else - { - string[] args = setupLines[ i ].Split( '=' ); - if( args.Length > 1 && AseOptionsSetupDict.ContainsKey( args[ 0 ] ) ) - { - AseOptionsSetup setup = AseOptionsSetupDict[ args[ 0 ] ]; - switch( setup ) - { - case AseOptionsSetup.Id: if( !int.TryParse( args[ 1 ], out optionsContainer.Id ) ) optionsContainer.Id = -1; break; - case AseOptionsSetup.Name: optionsContainer.Name = args[ 1 ]; break; - } - } - } - } - - //AVAILABLE OPTIONS - string body = match.Groups[ 2 ].Value.Replace( "\t", string.Empty ); - string[] optionLines = body.Split( '\n' ); - for( int oL = 0; oL < optionLines.Length; oL++ ) - { - string[] optionItems = optionLines[ oL ].Split( ':' ); - if( optionItems.Length > 0 ) - { - string[] itemIds = optionItems[ 0 ].Split( OptionsDataSeparator ); - switch( itemIds[ 0 ] ) - { - case "Option": - { - //Fills previous option with its actions - //actionItemsList is cleared over here - FillOptionAction( currentOption, ref actionItemsList ); - - optionItemToIndex.Clear(); - currentOption = new TemplateOptionsItem(); - currentOption.Type = AseOptionsType.Option; - string[] optionItemSetup = optionItems[ 1 ].Split( OptionsDataSeparator ); - currentOption.Name = optionItemSetup[ 0 ]; - if( optionItemSetup.Length > 1 ) - { - if( AseOptionItemSetupDict.ContainsKey( optionItemSetup[ 1 ] ) ) - currentOption.Setup = AseOptionItemSetupDict[ optionItemSetup[ 1 ] ]; - } - - currentOption.Id = itemIds.Length > 1 ? itemIds[ 1 ] : optionItems[ 1 ]; - currentOption.DisplayOptions = optionItems[ 2 ].Split( OptionsDataSeparator ); - currentOption.DisableIdx = currentOption.DisplayOptions.Length; - optionItems[ 2 ] += ",disable"; - currentOption.Options = optionItems[ 2 ].Split( OptionsDataSeparator ); - currentOption.Count = currentOption.Options.Length; - - for( int opIdx = 0; opIdx < currentOption.Options.Length; opIdx++ ) - { - optionItemToIndex.Add( currentOption.Options[ opIdx ], opIdx ); - actionItemsList.Add( new List<TemplateActionItem>() ); - } - - if( optionItems.Length > 3 ) - { - currentOption.DefaultOption = optionItems[ 3 ]; - } - else - { - currentOption.DefaultOption = currentOption.Options[ 0 ]; - } - - if( currentOption.Options.Length == 2 || ( currentOption.Options.Length == 3 && currentOption.Options[ 2 ].Equals( "disable" ) ) ) - { - if( ( currentOption.Options[ 0 ].Equals( "true" ) && currentOption.Options[ 1 ].Equals( "false" ) ) || - ( currentOption.Options[ 0 ].Equals( "false" ) && currentOption.Options[ 1 ].Equals( "true" ) ) ) - { - // Toggle 0 is false and 1 is true - currentOption.Options[ 0 ] = "false"; - currentOption.Options[ 1 ] = "true"; - currentOption.UIWidget = AseOptionsUIWidget.Toggle; - } - } - else if( currentOption.Options.Length > 2 ) - { - currentOption.UIWidget = AseOptionsUIWidget.Dropdown; - } - else - { - Debug.LogWarning( "Detected an option with less than two items:" + optionItems[ 1 ] ); - } - optionItemsList.Add( currentOption ); - } - break; - case "Port": - { - //Fills previous option with its actions - //actionItemsList is cleared over here - FillOptionAction( currentOption, ref actionItemsList ); - - optionItemToIndex.Clear(); - - currentOption = new TemplateOptionsItem(); - currentOption.Type = AseOptionsType.Port; - if( isSubShader && optionItems.Length > 2 ) - { - currentOption.Id = optionItems[ 1 ]; - currentOption.Name = optionItems[ 2 ]; - } - else - { - currentOption.Name = optionItems[ 1 ]; - } - - currentOption.Options = new string[] { "On", "Off" }; - optionItemToIndex.Add( currentOption.Options[ 0 ], 0 ); - optionItemToIndex.Add( currentOption.Options[ 1 ], 1 ); - - actionItemsList.Add( new List<TemplateActionItem>() ); - actionItemsList.Add( new List<TemplateActionItem>() ); - - optionItemsList.Add( currentOption ); - } - break; - case "Field": - { - //Fills previous option with its actions - //actionItemsList is cleared over here - FillOptionAction( currentOption, ref actionItemsList ); - - optionItemToIndex.Clear(); - currentOption = new TemplateOptionsItem(); - currentOption.Type = AseOptionsType.Field; - - currentOption.Id = optionItems[ 1 ]; - currentOption.Name = optionItems[ 1 ]; - - currentOption.UIWidget = AseOptionsUIWidget.Float; - if( optionItems[ 2 ].Equals( "Int" ) ) - currentOption.UIWidget = AseOptionsUIWidget.Int; - - if( optionItems.Length >= 3 ) - { - currentOption.DefaultFieldValue = Convert.ToSingle( optionItems[ 3 ], System.Globalization.CultureInfo.InvariantCulture ); - } - - if( optionItems.Length >= 6 ) - { - if( currentOption.UIWidget == AseOptionsUIWidget.Int ) - currentOption.UIWidget = AseOptionsUIWidget.Int; - else - currentOption.UIWidget = AseOptionsUIWidget.FloatRange; - - currentOption.FieldMin = Convert.ToSingle( optionItems[ 4 ], System.Globalization.CultureInfo.InvariantCulture ); - currentOption.FieldMax = Convert.ToSingle( optionItems[ 5 ], System.Globalization.CultureInfo.InvariantCulture ); - } - - if( optionItems.Length == 5 || optionItems.Length == 7 ) - { - currentOption.FieldInline = true; - currentOption.FieldInlineName = optionItems[ optionItems.Length - 1 ]; - } - - currentOption.Options = new string[] { "Change", "Inline", "disable" }; - - optionItemToIndex.Add( currentOption.Options[ 0 ], 0 ); - optionItemToIndex.Add( currentOption.Options[ 1 ], 1 ); - optionItemToIndex.Add( currentOption.Options[ 2 ], 2 ); - currentOption.DisableIdx = 2; - - actionItemsList.Add( new List<TemplateActionItem>() ); - actionItemsList.Add( new List<TemplateActionItem>() ); - actionItemsList.Add( new List<TemplateActionItem>() ); - - optionItemsList.Add( currentOption ); - } - break; - default: - { - if( optionItemToIndex.ContainsKey( optionItems[ 0 ] ) ) - { - int idx = 0; - if( currentOption != null && currentOption.UIWidget == AseOptionsUIWidget.Toggle ) - { - idx = ( optionItems[ 0 ].Equals( "true" ) ) ? 1 : 0; - if( optionItems[ 0 ].Equals( "disable" ) ) - idx = 2; - } - else - { - idx = optionItemToIndex[ optionItems[ 0 ] ]; - } - actionItemsList[ idx ].Add( CreateActionItem( isSubShader, optionItems ) ); - } - else - { - //string[] ids = optionItems[ 0 ].Split( ',' ); - if( itemIds.Length > 1 ) - { - for( int i = 0; i < itemIds.Length; i++ ) - { - if( optionItemToIndex.ContainsKey( itemIds[ i ] ) ) - { - int idx = optionItemToIndex[ itemIds[ i ] ]; - actionItemsList[ idx ].Add( CreateActionItem( isSubShader, optionItems ) ); - } - } - } - } - - } - break; - } - } - } - - //Fills last option with its actions - FillOptionAction( currentOption, ref actionItemsList ); - - actionItemsList.Clear(); - actionItemsList = null; - - optionsContainer.Options = optionItemsList.ToArray(); - optionItemsList.Clear(); - optionItemsList = null; - - optionItemToIndex.Clear(); - optionItemToIndex = null; - } - catch( Exception e ) - { - Debug.LogException( e ); - } - } - return optionsContainer; - } - - static void FillOptionAction( TemplateOptionsItem currentOption, ref List<List<TemplateActionItem>> actionItemsList ) - { - if( currentOption != null ) - { - int count = actionItemsList.Count; - currentOption.ActionsPerOption = new TemplateActionItemGrid( count ); - for( int i = 0; i < count; i++ ) - { - currentOption.ActionsPerOption[ i ] = actionItemsList[ i ].ToArray(); - actionItemsList[ i ].Clear(); - } - actionItemsList.Clear(); - } - } - - static TemplateActionItem CreateActionItem( bool isSubshader, string[] optionItems ) - { - TemplateActionItem actionItem = new TemplateActionItem(); - try - { - actionItem.ActionType = AseOptionsActionTypeDict[ optionItems[ 1 ] ]; - int optionsIdx = 2; - if( optionItems.Length > 3 ) - { - optionsIdx = 3; - actionItem.PassName = optionItems[ 2 ]; - } - else - { - actionItem.AllPasses = isSubshader; - } - - actionItem.ActionData = optionItems[ optionsIdx ]; - - switch( actionItem.ActionType ) - { - case AseOptionsActionType.ShowOption: - case AseOptionsActionType.HideOption: - { - string[] arr = optionItems[ optionsIdx ].Split( OptionsDataSeparator ); - if( arr.Length > 1 ) - { - actionItem.ActionData = arr[ 0 ]; - if( !int.TryParse( arr[ 1 ], out actionItem.ActionDataIdx ) ) - { - actionItem.ActionDataIdx = -1; - } - } - } - break; - case AseOptionsActionType.SetOption: - { - string[] arr = optionItems[ optionsIdx ].Split( OptionsDataSeparator ); - if( arr.Length > 1 ) - { - actionItem.ActionData = arr[ 0 ]; - if( !int.TryParse( arr[ 1 ], out actionItem.ActionDataIdx ) ) - { - Debug.LogWarning( "SetOption value must be a the selection index" ); - } - } - } - break; - case AseOptionsActionType.HidePort: - case AseOptionsActionType.ShowPort: - { - if( !int.TryParse( actionItem.ActionData, out actionItem.ActionDataIdx ) ) - actionItem.ActionDataIdx = -1; - } - break; - case AseOptionsActionType.SetPortName: - { - string[] arr = optionItems[ optionsIdx ].Split( OptionsDataSeparator ); - if( arr.Length > 1 ) - { - int.TryParse( arr[ 0 ], out actionItem.ActionDataIdx ); - actionItem.ActionData = arr[ 1 ]; - } - } - break; - case AseOptionsActionType.SetDefine: - case AseOptionsActionType.RemoveDefine: - case AseOptionsActionType.SetUndefine: - case AseOptionsActionType.RemoveUndefine: - case AseOptionsActionType.ExcludePass: - case AseOptionsActionType.IncludePass: - break; - case AseOptionsActionType.SetShaderProperty: - { - int optIndex = optionItems[ optionsIdx ].IndexOf( OptionsDataSeparator ); - if( optIndex > -1 ) - { - actionItem.ActionData = optionItems[ optionsIdx ].Substring( 0, optIndex ); - actionItem.ActionBuffer = optionItems[ optionsIdx ].Substring( optIndex + 1, optionItems[ optionsIdx ].Length - optIndex - 1); - } - }break; - case AseOptionsActionType.SetMaterialProperty: - { - int optIndex = optionItems[ optionsIdx ].IndexOf( OptionsDataSeparator ); - if( optIndex > -1 ) - { - actionItem.ActionData = optionItems[ optionsIdx ].Substring( 0, optIndex ); - } - } - break; - case AseOptionsActionType.SetPropertyOnPass: - case AseOptionsActionType.SetPropertyOnSubShader: - { - string[] arr = optionItems[ optionsIdx ].Split( OptionsDataSeparator ); - actionItem.PropertyAction = (PropertyActionsEnum)Enum.Parse( typeof( PropertyActionsEnum ), arr[ 0 ] ); - if( arr.Length == 1 && actionItem.ActionType == AseOptionsActionType.SetPropertyOnPass ) - { - actionItem.CopyFromSubShader = true; - } - else - { - switch( actionItem.PropertyAction ) - { - case PropertyActionsEnum.CullMode: - { - if( arr.Length > 1 ) - actionItem.ActionCullMode = (CullMode)Enum.Parse( typeof( CullMode ), arr[ 1 ] ); - } - break; - case PropertyActionsEnum.ColorMask: - { - if( arr.Length > 4 ) - { - actionItem.ColorMask[ 0 ] = Convert.ToBoolean( arr[ 1 ] ); - actionItem.ColorMask[ 1 ] = Convert.ToBoolean( arr[ 2 ] ); - actionItem.ColorMask[ 2 ] = Convert.ToBoolean( arr[ 3 ] ); - actionItem.ColorMask[ 3 ] = Convert.ToBoolean( arr[ 4 ] ); - } - } - break; - case PropertyActionsEnum.ZWrite: - { - if( arr.Length > 1 ) - actionItem.ActionZWrite = (ZWriteMode)Enum.Parse( typeof( ZWriteMode ), arr[ 1 ] ); - } - break; - case PropertyActionsEnum.ZTest: - { - if( arr.Length > 1 ) - actionItem.ActionZTest = (ZTestMode)Enum.Parse( typeof( ZTestMode ), arr[ 1 ] ); - } - break; - case PropertyActionsEnum.ZOffsetFactor: - { - if( arr.Length > 1 ) - actionItem.ActionZOffsetFactor = Convert.ToSingle( arr[ 1 ] ); - } - break; - case PropertyActionsEnum.ZOffsetUnits: - { - if( arr.Length > 1 ) - actionItem.ActionZOffsetUnits = Convert.ToSingle( arr[ 1 ] ); - } - break; - case PropertyActionsEnum.BlendRGB: - { - if( arr.Length > 2 ) - { - actionItem.ActionBlendRGBSource = (AvailableBlendFactor)Enum.Parse( typeof( AvailableBlendFactor ), arr[ 1 ] ); - actionItem.ActionBlendRGBDest = (AvailableBlendFactor)Enum.Parse( typeof( AvailableBlendFactor ), arr[ 2 ] ); - } - } - break; - case PropertyActionsEnum.BlendAlpha: - { - if( arr.Length > 2 ) - { - actionItem.ActionBlendAlphaSource = (AvailableBlendFactor)Enum.Parse( typeof( AvailableBlendFactor ), arr[ 1 ] ); - actionItem.ActionBlendAlphaDest = (AvailableBlendFactor)Enum.Parse( typeof( AvailableBlendFactor ), arr[ 2 ] ); - } - } - break; - case PropertyActionsEnum.BlendOpRGB: - { - if( arr.Length > 1 ) - { - actionItem.ActionBlendOpRGB = (AvailableBlendOps)Enum.Parse( typeof( AvailableBlendOps ), arr[ 1 ] ); - - } - } - break; - case PropertyActionsEnum.BlendOpAlpha: - { - if( arr.Length > 1 ) - { - actionItem.ActionBlendOpAlpha = (AvailableBlendOps)Enum.Parse( typeof( AvailableBlendOps ), arr[ 1 ] ); - } - } - break; - case PropertyActionsEnum.StencilReference: - { - if( arr.Length > 1 ) - { - int.TryParse( arr[ 1 ], out actionItem.ActionStencilReference ); - } - } - break; - case PropertyActionsEnum.StencilReadMask: - { - if( arr.Length > 1 ) - { - int.TryParse( arr[ 1 ], out actionItem.ActionStencilReadMask ); - } - } - break; - case PropertyActionsEnum.StencilWriteMask: - { - if( arr.Length > 1 ) - { - int.TryParse( arr[ 1 ], out actionItem.ActionStencilWriteMask ); - } - } - break; - case PropertyActionsEnum.StencilComparison: - { - if( arr.Length > 1 ) - actionItem.ActionStencilComparison = StencilBufferOpHelper.StencilComparisonValuesDict[ arr[ 1 ] ]; - } - break; - case PropertyActionsEnum.StencilPass: - { - if( arr.Length > 1 ) - actionItem.ActionStencilPass = StencilBufferOpHelper.StencilOpsValuesDict[ arr[ 1 ] ]; - } - break; - case PropertyActionsEnum.StencilFail: - { - if( arr.Length > 1 ) - actionItem.ActionStencilFail = StencilBufferOpHelper.StencilOpsValuesDict[ arr[ 1 ] ]; - } - break; - case PropertyActionsEnum.StencilZFail: - { - if( arr.Length > 1 ) - actionItem.ActionStencilZFail = StencilBufferOpHelper.StencilOpsValuesDict[ arr[ 1 ] ]; - } - break; - case PropertyActionsEnum.RenderType: - { - if( arr.Length > 1 ) - actionItem.ActionData = arr[ 1 ]; - } - break; - case PropertyActionsEnum.RenderQueue: - { - if( arr.Length > 1 ) - actionItem.ActionData = arr[ 1 ]; - if( arr.Length > 2 ) - { - int.TryParse( arr[ 2 ], out actionItem.ActionDataIdx ); - } - else - { - actionItem.ActionDataIdx = 0; - } - } - break; - } - } - } - break; - } - } - catch( Exception e ) - { - Debug.LogException( e ); - } - return actionItem; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsData.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsData.cs.meta deleted file mode 100644 index 55c0596b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsData.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 019dfacde4ed75a41851c7f15f69963f -timeCreated: 1533143812 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsDefinesContainer.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsDefinesContainer.cs deleted file mode 100644 index affbd406..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsDefinesContainer.cs +++ /dev/null @@ -1,69 +0,0 @@ -using UnityEngine; -using System; -using System.Collections.Generic; - -namespace AmplifyShaderEditor -{ - [Serializable] - public class TemplateOptionsDefinesContainer - { - [SerializeField] - private List<PropertyDataCollector> m_definesList = new List<PropertyDataCollector>(); - - [NonSerialized] - private Dictionary<string, PropertyDataCollector> m_definesDict = new Dictionary<string, PropertyDataCollector>(); - - void Refresh() - { - if( m_definesDict.Count != m_definesList.Count ) - { - m_definesDict.Clear(); - for( int i = 0; i < m_definesList.Count; i++ ) - { - m_definesDict.Add( m_definesList[ i ].PropertyName, m_definesList[ i ] ); - } - } - } - - public void RemoveTemporaries() - { - List<PropertyDataCollector> temporaries = m_definesList.FindAll( ( x ) => ( x.NodeId == 1 ) ); - for( int i = 0; i < temporaries.Count; i++ ) - { - m_definesList.Remove( temporaries[ i ] ); - m_definesDict.Remove( temporaries[ i ].PropertyName ); - } - } - - public void AddDefine( string define , bool temporary ) - { - Refresh(); - if( !m_definesDict.ContainsKey( define ) ) - { - int nodeId = temporary ? 1 : 0; - PropertyDataCollector data = new PropertyDataCollector( nodeId, define ); - m_definesDict.Add( define, data ); - m_definesList.Add( data ); - } - } - - public void RemoveDefine( string define ) - { - Refresh(); - if( m_definesDict.ContainsKey( define ) ) - { - m_definesList.Remove( m_definesDict[define] ); - m_definesDict.Remove( define ); - } - } - - public void Destroy() - { - m_definesDict.Clear(); - m_definesDict = null; - m_definesList.Clear(); - m_definesList = null; - } - public List<PropertyDataCollector> DefinesList { get { return m_definesList; } } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsDefinesContainer.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsDefinesContainer.cs.meta deleted file mode 100644 index 151a9abc..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsDefinesContainer.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 0f32755ee64bb1542ad9598810d9faf9 -timeCreated: 1543339825 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsPort.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsPort.cs deleted file mode 100644 index 04c11872..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsPort.cs +++ /dev/null @@ -1,174 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace AmplifyShaderEditor -{ - // PORT CONTROLLERS - [Serializable] - public class TemplateOptionPortItem - { - [SerializeField] - private int m_portId = -1; - - [SerializeField] - private TemplateOptionsItem m_options; - - public TemplateOptionPortItem( TemplateMultiPassMasterNode owner, TemplateOptionsItem options ) - { - m_options = options; - InputPort port = owner.InputPorts.Find( x => x.Name.Equals( options.Name ) ); - if( port != null ) - { - m_portId = port.PortId; - } - } - - public void FillDataCollector( TemplateMultiPassMasterNode owner, ref MasterNodeDataCollector dataCollector ) - { - InputPort port = null; - if( m_portId > -1 ) - { - port = owner.GetInputPortByUniqueId( m_portId ); - } - else - { - port = owner.InputPorts.Find( x => x.Name.Equals( m_options.Name ) ); - } - - if( port != null ) - { - int optionId = port.HasOwnOrLinkConnection ? 0 : 1; - for( int i = 0; i < m_options.ActionsPerOption[ optionId ].Length; i++ ) - { - switch( m_options.ActionsPerOption[ optionId ][ i ].ActionType ) - { - case AseOptionsActionType.SetDefine: - { - List<TemplateMultiPassMasterNode> nodes = owner.ContainerGraph.GetMultiPassMasterNodes( owner.LODIndex ); - int count = nodes.Count; - for( int nodeIdx = 0; nodeIdx < count; nodeIdx++ ) - { - nodes[ nodeIdx ].OptionsDefineContainer.AddDefine( "#define "+m_options.ActionsPerOption[ optionId ][ i ].ActionData, false ); - } - //dataCollector.AddToDefines( -1, m_options.ActionsPerOption[ optionId ][ i ].ActionData ); - } - break; - case AseOptionsActionType.SetUndefine: - { - List<TemplateMultiPassMasterNode> nodes = owner.ContainerGraph.GetMultiPassMasterNodes( owner.LODIndex ); - int count = nodes.Count; - for( int nodeIdx = 0; nodeIdx < count; nodeIdx++ ) - { - nodes[ nodeIdx ].OptionsDefineContainer.AddDefine( "#undef " + m_options.ActionsPerOption[ optionId ][ i ].ActionData, false ); - } - //dataCollector.AddToDefines( -1, m_options.ActionsPerOption[ optionId ][ i ].ActionData, false ); - } - break; - case AseOptionsActionType.SetShaderProperty: - { - TemplateShaderPropertyData data = owner.CurrentTemplate.GetShaderPropertyData( m_options.ActionsPerOption[ optionId ][ i ].ActionData ); - if( data != null ) - { - string newPropertyValue = data.CreatePropertyForValue( m_options.ActionsPerOption[ optionId ][ i ].ActionBuffer ); - owner.CurrentTemplate.IdManager.SetReplacementText( data.FullValue, newPropertyValue ); - } - } - break; - } - } - } - } - - public void SubShaderFillDataCollector( TemplateMultiPassMasterNode owner, ref MasterNodeDataCollector dataCollector ) - { - - //TemplateMultiPassMasterNode targetNode = string.IsNullOrEmpty(m_options.Id) ? owner:owner.ContainerGraph.GetMasterNodeOfPass( m_options.Id , owner.LODIndex ); - TemplateMultiPassMasterNode targetNode = string.IsNullOrEmpty( m_options.Id ) ? - owner.ContainerGraph.GetMainMasterNodeOfLOD( owner.LODIndex ) : - owner.ContainerGraph.GetMasterNodeOfPass( m_options.Id , owner.LODIndex ); - - InputPort port = null; - if( m_portId > -1 ) - { - port = targetNode.GetInputPortByUniqueId( m_portId ); - } - else - { - port = targetNode.InputPorts.Find( x => x.Name.Equals( m_options.Name ) ); - } - - if( port != null ) - { - int optionId = port.HasOwnOrLinkConnection ? 0 : 1; - for( int i = 0; i < m_options.ActionsPerOption[ optionId ].Length; i++ ) - { - if( string.IsNullOrEmpty( m_options.ActionsPerOption[ optionId ][ i ].PassName ) || - m_options.ActionsPerOption[ optionId ][ i ].PassName.Equals( owner.PassName ) ) - { - switch( m_options.ActionsPerOption[ optionId ][ i ].ActionType ) - { - case AseOptionsActionType.SetDefine: - { - owner.OptionsDefineContainer.AddDefine( "#define " + m_options.ActionsPerOption[ optionId ][ i ].ActionData, true ); - } - break; - case AseOptionsActionType.SetUndefine: - { - owner.OptionsDefineContainer.AddDefine( "#undef " + m_options.ActionsPerOption[ optionId ][ i ].ActionData, true ); - } - break; - case AseOptionsActionType.SetShaderProperty: - { - TemplateShaderPropertyData data = owner.CurrentTemplate.GetShaderPropertyData( m_options.ActionsPerOption[ optionId ][ i ].ActionData ); - if( data != null ) - { - string newPropertyValue = data.CreatePropertyForValue( m_options.ActionsPerOption[ optionId ][ i ].ActionBuffer ); - owner.CurrentTemplate.IdManager.SetReplacementText( data.FullValue, newPropertyValue ); - } - } - break; - } - } - } - } - } - - public void CheckImediateActionsForPort( TemplateMultiPassMasterNode owner, int portId ) - { - if( portId != m_portId ) - return; - - InputPort port = null; - if( m_portId > -1 ) - { - port = owner.GetInputPortByUniqueId( m_portId ); - } - else - { - port = owner.InputPorts.Find( x => x.Name.Equals( m_options.Name ) ); - } - - if( port != null ) - { - int optionId = port.HasOwnOrLinkConnection ? 0 : 1; - for( int i = 0; i < m_options.ActionsPerOption[ optionId ].Length; i++ ) - { - switch( m_options.ActionsPerOption[ optionId ][ i ].ActionType ) - { - case AseOptionsActionType.SetPortName: - { - port.Name = m_options.ActionsPerOption[ optionId ][ i ].ActionData; - owner.SizeIsDirty = true; - } - break; - } - } - } - } - public TemplateOptionsItem Options { get { return m_options; } } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsPort.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsPort.cs.meta deleted file mode 100644 index a9c15d28..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsPort.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: fa2d25bd070cde046876bd1fa77bf116 -timeCreated: 1535044953 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsUI.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsUI.cs deleted file mode 100644 index 559f3a44..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsUI.cs +++ /dev/null @@ -1,300 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using System.Collections.Generic; -using UnityEngine; -using UnityEditor; - -namespace AmplifyShaderEditor -{ - // UI STRUCTURES - [Serializable] - public class TemplateOptionUIItem - { - public delegate void OnActionPerformed( bool isRefreshing, bool invertAction, TemplateOptionUIItem uiItem, params TemplateActionItem[] validActions ); - public event OnActionPerformed OnActionPerformedEvt; - - [SerializeField] - private bool m_isVisible = true; - - [SerializeField] - private bool m_wasVisible = true; - - [SerializeField] - private int m_currentOption = 0; - - [SerializeField] - private TemplateOptionsItem m_options; - - [SerializeField] - private bool m_checkOnExecute = false; - - [SerializeField] - private bool m_invertActionOnDeselection = false; - - public TemplateOptionUIItem( TemplateOptionsItem options ) - { - m_options = options; - if( m_options.Type == AseOptionsType.Field ) - { - m_options.FieldValue.FloatValue = m_options.DefaultFieldValue; - } - else - { - m_currentOption = m_options.DefaultOptionIndex; - } - m_invertActionOnDeselection = options.Setup == AseOptionItemSetup.InvertActionOnDeselection; - } - - public void CopyValuesFrom( TemplateOptionUIItem origin ) - { - m_isVisible = origin.IsVisible; - m_wasVisible = origin.WasVisible; - m_currentOption = origin.CurrentOption; - m_options.FieldValue.FloatValue = origin.CurrentFieldValue; - m_checkOnExecute = origin.CheckOnExecute; - m_invertActionOnDeselection = origin.InvertActionOnDeselection; - } - - public void Draw( UndoParentNode owner ) - { - if( m_isVisible ) - { - int lastOption = m_currentOption; - EditorGUI.BeginChangeCheck(); - switch( m_options.UIWidget ) - { - case AseOptionsUIWidget.Dropdown: - { - m_currentOption = owner.EditorGUILayoutPopup( m_options.Name, m_currentOption, m_options.DisplayOptions ); - } - break; - case AseOptionsUIWidget.Toggle: - { - m_currentOption = owner.EditorGUILayoutToggle( m_options.Name, m_currentOption == 1 ) ? 1 : 0; - } - break; - case AseOptionsUIWidget.Float: - { - if( m_options.FieldInline ) - { - m_options.FieldValue.FloatField( ref owner, m_options.Name ); - if( m_options.FieldValue.Active ) - m_currentOption = 1; - else - m_currentOption = 0; - } - else - { - m_options.FieldValue.FloatValue = owner.EditorGUILayoutFloatField( m_options.Name, m_options.FieldValue.FloatValue ); - } - } - break; - case AseOptionsUIWidget.Int: - { - if( m_options.FieldInline ) - { - m_options.FieldValue.IntField( ref owner, m_options.Name ); - if( m_options.FieldValue.Active ) - m_currentOption = 1; - else - m_currentOption = 0; - } - else - m_options.FieldValue.FloatValue = owner.EditorGUILayoutIntField( m_options.Name, (int)m_options.FieldValue.FloatValue ); - } - break; - case AseOptionsUIWidget.FloatRange: - { - if( m_options.FieldInline ) - { - m_options.FieldValue.SliderField( ref owner, m_options.Name, m_options.FieldMin, m_options.FieldMax ); - if( m_options.FieldValue.Active ) - m_currentOption = 1; - else - m_currentOption = 0; - } - else - m_options.FieldValue.FloatValue = owner.EditorGUILayoutSlider( m_options.Name, m_options.FieldValue.FloatValue, m_options.FieldMin, m_options.FieldMax ); - } - break; - case AseOptionsUIWidget.IntRange: - { - if( m_options.FieldInline ) - { - m_options.FieldValue.IntSlider( ref owner, m_options.Name, (int)m_options.FieldMin, (int)m_options.FieldMax ); - if( m_options.FieldValue.Active ) - m_currentOption = 1; - else - m_currentOption = 0; - } - else - m_options.FieldValue.FloatValue = owner.EditorGUILayoutIntSlider( m_options.Name, (int)m_options.FieldValue.FloatValue, (int)m_options.FieldMin, (int)m_options.FieldMax ); - } - break; - } - if( EditorGUI.EndChangeCheck() ) - { - if( OnActionPerformedEvt != null ) - { - if( m_invertActionOnDeselection ) - OnActionPerformedEvt( false, lastOption != m_options.DisableIdx, this, m_options.ActionsPerOption[ lastOption ] ); - - OnActionPerformedEvt( false, false, this, m_options.ActionsPerOption[ m_currentOption ] ); - } - } - } - } - - public void CheckEnDisable() - { - //string deb = string.Empty;// "-- Checked --" + m_options.Name+" "+ m_isVisible + " "+ m_wasVisible; - if( m_isVisible ) - { - if( !m_wasVisible ) - { - //deb = "-- Enable --" + m_options.Name; - //Debug.Log( deb ); - if( OnActionPerformedEvt != null ) - { - if( m_invertActionOnDeselection ) - { - for( int i = 0; i < m_options.Count; i++ ) - { - if( i != m_currentOption && i != m_options.DisableIdx ) - { - OnActionPerformedEvt( false, true, this, m_options.ActionsPerOption[ i ] ); - } - } - } - - OnActionPerformedEvt( false, false, this, m_options.ActionsPerOption[ m_currentOption ] ); - //if( !m_isVisible ) - //OnActionPerformedEvt( isRefreshing, false, this, m_options.ActionsPerOption[ m_options.DisableIdx ] ); - } - } - - m_wasVisible = true; - } - else if( m_wasVisible ) - { - //deb = "-- Disable --" + m_options.Name; - //Debug.Log( deb ); - m_wasVisible = false; - - if( OnActionPerformedEvt != null ) - { - OnActionPerformedEvt( false, false, this, m_options.ActionsPerOption[ m_options.DisableIdx ] ); - } - } - } - - public void FillDataCollector( ref MasterNodeDataCollector dataCollector ) - { - if( m_isVisible && m_checkOnExecute ) - { - for( int i = 0; i < m_options.ActionsPerOption[ m_currentOption ].Length; i++ ) - { - switch( m_options.ActionsPerOption[ m_currentOption ][ i ].ActionType ) - { - case AseOptionsActionType.SetDefine: - { - dataCollector.AddToDefines( -1, m_options.ActionsPerOption[ m_currentOption ][ i ].ActionData ); - } - break; - case AseOptionsActionType.SetUndefine: - { - dataCollector.AddToDefines( -1, m_options.ActionsPerOption[ m_currentOption ][ i ].ActionData, false ); - } - break; - } - } - } - } - - public void Refresh() - { - if( OnActionPerformedEvt != null ) - { - if( m_invertActionOnDeselection ) - { - for( int i = 0; i < m_options.Count; i++ ) - { - if( i != m_currentOption && i != m_options.DisableIdx ) - { - OnActionPerformedEvt( true, true, this, m_options.ActionsPerOption[ i ] ); - } - } - } - - OnActionPerformedEvt( true, false, this, m_options.ActionsPerOption[ m_currentOption ] ); - } - } - - public TemplateOptionsItem Options { get { return m_options; } } - - public void Destroy() - { - OnActionPerformedEvt = null; - } - - public bool IsVisible - { - get { return m_isVisible; } - set { m_isVisible = value; } - } - - public bool WasVisible - { - get { return m_wasVisible; } - set { m_wasVisible = value; } - } - - public bool CheckOnExecute - { - get { return m_checkOnExecute; } - set { m_checkOnExecute = value; } - } - - public InlineProperty FieldValue - { - get { return m_options.FieldValue; } - set { m_options.FieldValue = value; } - } - - public float CurrentFieldValue - { - get { return m_options.FieldValue.FloatValue; } - set { m_options.FieldValue.FloatValue = value; } - } - - public int CurrentOption - { - get { return m_currentOption; } - set - { - m_currentOption = Mathf.Clamp( value, 0, m_options.Options.Length - 1 ); - // why refreshing here? - //Refresh(); - } - } - - public int CurrentOptionIdx - { - set - { - m_currentOption = Mathf.Clamp( value, 0, m_options.Options.Length - 1 ); - } - } - public bool EmptyEvent { get { return OnActionPerformedEvt == null; } } - public TemplateActionItemGrid.TemplateActionItemRow CurrentOptionActions - { - get - { - return m_options.ActionsPerOption.Rows[m_currentOption]; - } - } - public bool InvertActionOnDeselection { get { return m_invertActionOnDeselection; } } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsUI.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsUI.cs.meta deleted file mode 100644 index b3f17647..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsUI.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 081c72eb35d61c84e9a5c34522c3ff33 -timeCreated: 1534775306 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsUIHelper.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsUIHelper.cs deleted file mode 100644 index 06d346b3..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsUIHelper.cs +++ /dev/null @@ -1,862 +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.Collections.Generic; - -namespace AmplifyShaderEditor -{ - [Serializable] - public class TemplateOptionsUIHelper - { - private const string CustomOptionsLabel = " Custom Options"; - - private bool m_isSubShader = false; - - [SerializeField] - private bool m_passCustomOptionsFoldout = true; - - [SerializeField] - private string m_passCustomOptionsLabel = CustomOptionsLabel; - - [SerializeField] - private int m_passCustomOptionsSizeCheck = 0; - - [SerializeField] - private List<TemplateOptionUIItem> m_passCustomOptionsUI = new List<TemplateOptionUIItem>(); - - [NonSerialized] - private Dictionary<string, TemplateOptionUIItem> m_passCustomOptionsUIDict = new Dictionary<string, TemplateOptionUIItem>(); - - [NonSerialized] - private TemplateMultiPassMasterNode m_owner; - - [NonSerialized] - private string[] m_readOptionNames; - - [NonSerialized] - private string[] m_readOptionSelections; - - [SerializeField] - private List<TemplateOptionPortItem> m_passCustomOptionsPorts = new List<TemplateOptionPortItem>(); - - public TemplateOptionsUIHelper( bool isSubShader ) - { - m_isSubShader = isSubShader; - } - - public void CopyOptionsValuesFrom( TemplateOptionsUIHelper origin ) - { - for( int i = 0; i < origin.PassCustomOptionsUI.Count; i++ ) - { - m_passCustomOptionsUI[ i ].CopyValuesFrom( origin.PassCustomOptionsUI[ i ] ); - } - } - - public void Destroy() - { - for( int i = 0; i < m_passCustomOptionsUI.Count; i++ ) - { - m_passCustomOptionsUI[ i ].Destroy(); - } - - m_passCustomOptionsUI.Clear(); - m_passCustomOptionsUI = null; - - m_passCustomOptionsUIDict.Clear(); - m_passCustomOptionsUIDict = null; - - m_passCustomOptionsPorts.Clear(); - m_passCustomOptionsPorts = null; - } - - public void DrawCustomOptions( TemplateMultiPassMasterNode owner ) - { - m_owner = owner; - - if( m_passCustomOptionsUI.Count > 0 ) - { - NodeUtils.DrawNestedPropertyGroup( ref m_passCustomOptionsFoldout, m_passCustomOptionsLabel, DrawCustomOptionsBlock ); - } - } - - public void DrawCustomOptionsBlock() - { - float currWidth = EditorGUIUtility.labelWidth; -#if UNITY_2019_3_OR_NEWER - float size = Mathf.Max( UIUtils.CurrentWindow.ParametersWindow.TransformedArea.width * 0.385f, 0 ); -#else - float size = Mathf.Max( UIUtils.CurrentWindow.ParametersWindow.TransformedArea.width * 0.34f, 0 ); -#endif - EditorGUIUtility.labelWidth = size; - for( int i = 0; i < m_passCustomOptionsUI.Count; i++ ) - { - m_passCustomOptionsUI[ i ].Draw( m_owner ); - } - EditorGUILayout.Space(); - EditorGUIUtility.labelWidth = currWidth; - } - - public void OnCustomOptionSelected( bool isRefreshing, bool invertAction, TemplateMultiPassMasterNode owner, TemplateOptionUIItem uiItem, params TemplateActionItem[] validActions ) - { - uiItem.CheckOnExecute = false; - for( int i = 0; i < validActions.Length; i++ ) - { - AseOptionsActionType actionType = validActions[ i ].ActionType; - if( invertAction ) - { - if( !TemplateOptionsToolsHelper.InvertAction( validActions[ i ].ActionType, ref actionType ) ) - { - continue; - } - } - - switch( actionType ) - { - case AseOptionsActionType.ShowOption: - { - TemplateOptionUIItem item = m_passCustomOptionsUI.Find( x => ( x.Options.Name.Equals( validActions[ i ].ActionData ) ) ); - if( item != null ) - { - if( isRefreshing ) - { - string optionId = validActions[ i ].PassName + validActions[ i ].ActionData + "Option"; - owner.ContainerGraph.ParentWindow.TemplatesManagerInstance.SetOptionsValue( optionId, true ); - } - - // this prevents options from showing up when loading by checking if they were hidden by another option - // it works on the assumption that an option that may possible hide this one is checked first - if( !isRefreshing ) - item.IsVisible = true; - else if( item.WasVisible ) - item.IsVisible = true; - - if( !invertAction && validActions[ i ].ActionDataIdx > -1 ) - item.CurrentOption = validActions[ i ].ActionDataIdx; - - item.CheckEnDisable(); - } - else - { - Debug.LogFormat( "Could not find Option {0} for action {1}", validActions[ i ].ActionData, validActions[ i ].ActionType ); - } - } - break; - case AseOptionsActionType.HideOption: - { - TemplateOptionUIItem item = m_passCustomOptionsUI.Find( x => ( x.Options.Name.Equals( validActions[ i ].ActionData ) ) ); - if( item != null ) - { - bool flag = false; - if( isRefreshing ) - { - string optionId = validActions[ i ].PassName + validActions[ i ].ActionData + "Option"; - flag = owner.ContainerGraph.ParentWindow.TemplatesManagerInstance.SetOptionsValue( optionId, false ); - } - - item.IsVisible = false || flag; - if( !invertAction && validActions[ i ].ActionDataIdx > -1 ) - item.CurrentOption = validActions[ i ].ActionDataIdx; - - item.CheckEnDisable(); - } - else - { - Debug.LogFormat( "Could not find Option {0} for action {1}", validActions[ i ].ActionData, validActions[ i ].ActionType ); - } - } - break; - case AseOptionsActionType.SetOption: - { - if( !uiItem.IsVisible ) - break; - - TemplateOptionUIItem item = m_passCustomOptionsUI.Find( x => ( x.Options.Name.Equals( validActions[ i ].ActionData ) ) ); - if( item != null ) - { - item.CurrentOption = validActions[ i ].ActionDataIdx; - item.Refresh(); - } - else - { - Debug.LogFormat( "Could not find Option {0} for action {1}", validActions[ i ].ActionData, validActions[ i ].ActionType ); - } - } - break; - case AseOptionsActionType.HidePort: - { - TemplateMultiPassMasterNode passMasterNode = owner; - if( !string.IsNullOrEmpty( validActions[ i ].PassName ) ) - { - passMasterNode = owner.ContainerGraph.GetMasterNodeOfPass( validActions[ i ].PassName,owner.LODIndex ); - } - - if( passMasterNode != null ) - { - InputPort port = validActions[ i ].ActionDataIdx > -1 ? - passMasterNode.GetInputPortByUniqueId( validActions[ i ].ActionDataIdx ) : - passMasterNode.InputPorts.Find( x => x.Name.Equals( validActions[ i ].ActionData ) ); - if( port != null ) - { - if( isRefreshing ) - { - string optionId = validActions[ i ].PassName + port.Name; - owner.ContainerGraph.ParentWindow.TemplatesManagerInstance.SetOptionsValue( optionId, port.IsConnected ); - port.Visible = port.IsConnected; - } - else - { - port.Visible = false; - } - passMasterNode.SizeIsDirty = true; - } - else - { - Debug.LogFormat( "Could not find port {0},{1} for action {2}", validActions[ i ].ActionDataIdx, validActions[ i ].ActionData, validActions[ i ].ActionType ); - } - } - else - { - Debug.LogFormat( "Could not find pass {0} for action {1} on {2}", validActions[ i ].PassName, validActions[ i ].ActionType, validActions[ i ].ActionData ); - } - } - break; - case AseOptionsActionType.ShowPort: - { - if( !uiItem.IsVisible ) - break; - - TemplateMultiPassMasterNode passMasterNode = owner; - if( !string.IsNullOrEmpty( validActions[ i ].PassName ) ) - { - passMasterNode = owner.ContainerGraph.GetMasterNodeOfPass( validActions[ i ].PassName, owner.LODIndex ); - } - - if( passMasterNode != null ) - { - InputPort port = validActions[ i ].ActionDataIdx > -1 ? - passMasterNode.GetInputPortByUniqueId( validActions[ i ].ActionDataIdx ) : - passMasterNode.InputPorts.Find( x => x.Name.Equals( validActions[ i ].ActionData ) ); - if( port != null ) - { - if( isRefreshing ) - { - string optionId = validActions[ i ].PassName + port.Name; - owner.ContainerGraph.ParentWindow.TemplatesManagerInstance.SetOptionsValue( optionId, true ); - } - - port.Visible = true; - passMasterNode.SizeIsDirty = true; - } - else - { - Debug.LogFormat( "Could not find port {0},{1} for action {2}", validActions[ i ].ActionDataIdx, validActions[ i ].ActionData, validActions[ i ].ActionType ); - } - } - else - { - Debug.LogFormat( "Could not find pass {0} for action {1} on {2}", validActions[ i ].PassName, validActions[ i ].ActionType, validActions[ i ].ActionData ); - } - } - break; - case AseOptionsActionType.SetPortName: - { - if( !uiItem.IsVisible ) - break; - - TemplateMultiPassMasterNode passMasterNode = owner; - if( !string.IsNullOrEmpty( validActions[ i ].PassName ) ) - { - passMasterNode = owner.ContainerGraph.GetMasterNodeOfPass( validActions[ i ].PassName, owner.LODIndex ); - } - - if( passMasterNode != null ) - { - InputPort port = passMasterNode.GetInputPortByUniqueId( validActions[ i ].ActionDataIdx ); - if( port != null ) - { - port.Name = validActions[ i ].ActionData; - passMasterNode.SizeIsDirty = true; - } - else - { - Debug.LogFormat( "Could not find port {0},{1} for action {2}", validActions[ i ].ActionDataIdx, validActions[ i ].ActionData, validActions[ i ].ActionType ); - } - } - else - { - Debug.LogFormat( "Could not find pass {0} for action {1} on {2}", validActions[ i ].PassName, validActions[ i ].ActionType, validActions[ i ].ActionData ); - } - } - break; - case AseOptionsActionType.SetDefine: - { - if( !uiItem.IsVisible ) - { - uiItem.CheckOnExecute = true; - break; - } - - //Debug.Log( "DEFINE " + validActions[ i ].ActionData ); - if( validActions[ i ].AllPasses ) - { - string actionData = validActions[ i ].ActionData; - string defineValue = string.Empty; - if( actionData.StartsWith( "pragma" ) ) - { - defineValue = "#" + actionData; - } - else - { - defineValue = "#define " + validActions[ i ].ActionData; - } - if( isRefreshing ) - { - owner.ContainerGraph.ParentWindow.TemplatesManagerInstance.SetOptionsValue( defineValue, true ); - } - List<TemplateMultiPassMasterNode> nodes = owner.ContainerGraph.GetMultiPassMasterNodes( owner.LODIndex ); - int count = nodes.Count; - for( int nodeIdx = 0; nodeIdx < count; nodeIdx++ ) - { - nodes[ nodeIdx ].OptionsDefineContainer.AddDefine( defineValue, false ); - } - } - else if( !string.IsNullOrEmpty( validActions[ i ].PassName ) ) - { - TemplateMultiPassMasterNode passMasterNode = owner.ContainerGraph.GetMasterNodeOfPass( validActions[ i ].PassName, owner.LODIndex ); - if( passMasterNode != null ) - { - string actionData = validActions[ i ].ActionData; - string defineValue = string.Empty; - if( actionData.StartsWith( "pragma" ) ) - { - defineValue = "#" + actionData; - } - else - { - defineValue = "#define " + validActions[ i ].ActionData; - } - if( isRefreshing ) - { - string optionsId = validActions[ i ].PassName + defineValue; - owner.ContainerGraph.ParentWindow.TemplatesManagerInstance.SetOptionsValue( optionsId, true ); - } - passMasterNode.OptionsDefineContainer.AddDefine( defineValue, false ); - } - else - { - Debug.LogFormat( "Could not find pass {0} for action {1} on {2}", validActions[ i ].PassName, validActions[ i ].ActionType, validActions[ i ].ActionData ); - } - } - else - { - uiItem.CheckOnExecute = true; - } - } - break; - case AseOptionsActionType.RemoveDefine: - { - //Debug.Log( "UNDEFINE " + validActions[ i ].ActionData ); - if( validActions[ i ].AllPasses ) - { - string actionData = validActions[ i ].ActionData; - string defineValue = string.Empty; - if( actionData.StartsWith( "pragma" ) ) - { - defineValue = "#" + actionData; - } - else - { - defineValue = "#define " + validActions[ i ].ActionData; - } - - bool flag = false; - if( isRefreshing ) - { - flag = owner.ContainerGraph.ParentWindow.TemplatesManagerInstance.SetOptionsValue( defineValue, false ); - } - - if( !flag ) - { - List<TemplateMultiPassMasterNode> nodes = owner.ContainerGraph.GetMultiPassMasterNodes( owner.LODIndex ); - int count = nodes.Count; - for( int nodeIdx = 0; nodeIdx < count; nodeIdx++ ) - { - nodes[ nodeIdx ].OptionsDefineContainer.RemoveDefine( defineValue ); - } - } - } - else if( !string.IsNullOrEmpty( validActions[ i ].PassName ) ) - { - TemplateMultiPassMasterNode passMasterNode = owner.ContainerGraph.GetMasterNodeOfPass( validActions[ i ].PassName, owner.LODIndex ); - if( passMasterNode != null ) - { - string actionData = validActions[ i ].ActionData; - string defineValue = string.Empty; - if( actionData.StartsWith( "pragma" ) ) - { - defineValue = "#" + actionData; - } - else - { - defineValue = "#define " + validActions[ i ].ActionData; - } - bool flag = false; - if( isRefreshing ) - { - string optionId = validActions[ i ].PassName + defineValue; - flag = owner.ContainerGraph.ParentWindow.TemplatesManagerInstance.SetOptionsValue( optionId, false ); - } - if( !flag ) - { - passMasterNode.OptionsDefineContainer.RemoveDefine( defineValue ); - } - } - else - { - Debug.LogFormat( "Could not find pass {0} for action {1} on {2}", validActions[ i ].PassName, validActions[ i ].ActionType, validActions[ i ].ActionData ); - } - } - else - { - uiItem.CheckOnExecute = false; - } - } - break; - case AseOptionsActionType.SetUndefine: - { - if( !uiItem.IsVisible ) - { - uiItem.CheckOnExecute = true; - break; - } - - if( validActions[ i ].AllPasses ) - { - string defineValue = "#undef " + validActions[ i ].ActionData; - if( isRefreshing ) - { - owner.ContainerGraph.ParentWindow.TemplatesManagerInstance.SetOptionsValue( defineValue, true ); - } - List<TemplateMultiPassMasterNode> nodes = owner.ContainerGraph.GetMultiPassMasterNodes(owner.LODIndex); - int count = nodes.Count; - for( int nodeIdx = 0; nodeIdx < count; nodeIdx++ ) - { - nodes[ nodeIdx ].OptionsDefineContainer.AddDefine( defineValue, false ); - } - } - else if( !string.IsNullOrEmpty( validActions[ i ].PassName ) ) - { - TemplateMultiPassMasterNode passMasterNode = owner.ContainerGraph.GetMasterNodeOfPass( validActions[ i ].PassName, owner.LODIndex ); - if( passMasterNode != null ) - { - string defineValue = "#undef " + validActions[ i ].ActionData; - if( isRefreshing ) - { - string optionsId = validActions[ i ].PassName + defineValue; - owner.ContainerGraph.ParentWindow.TemplatesManagerInstance.SetOptionsValue( optionsId, true ); - } - passMasterNode.OptionsDefineContainer.AddDefine( defineValue, false ); - } - else - { - Debug.LogFormat( "Could not find pass {0} for action {1} on {2}", validActions[ i ].PassName, validActions[ i ].ActionType, validActions[ i ].ActionData ); - } - } - else - { - uiItem.CheckOnExecute = true; - } - } - break; - case AseOptionsActionType.RemoveUndefine: - { - if( validActions[ i ].AllPasses ) - { - string defineValue = "#undef " + validActions[ i ].ActionData; - bool flag = false; - if( isRefreshing ) - { - flag = owner.ContainerGraph.ParentWindow.TemplatesManagerInstance.SetOptionsValue( defineValue, false ); - } - - if( !flag ) - { - List<TemplateMultiPassMasterNode> nodes = owner.ContainerGraph.GetMultiPassMasterNodes( owner.LODIndex ); - int count = nodes.Count; - for( int nodeIdx = 0; nodeIdx < count; nodeIdx++ ) - { - nodes[ nodeIdx ].OptionsDefineContainer.RemoveDefine( defineValue ); - } - } - } - else if( !string.IsNullOrEmpty( validActions[ i ].PassName ) ) - { - TemplateMultiPassMasterNode passMasterNode = owner.ContainerGraph.GetMasterNodeOfPass( validActions[ i ].PassName, owner.LODIndex ); - if( passMasterNode != null ) - { - bool flag = false; - string defineValue = "#undef " + validActions[ i ].ActionData; - if( isRefreshing ) - { - string optionId = validActions[ i ].PassName + defineValue; - flag = owner.ContainerGraph.ParentWindow.TemplatesManagerInstance.SetOptionsValue( optionId, false ); - } - - if( !flag ) - { - passMasterNode.OptionsDefineContainer.RemoveDefine( defineValue ); - } - } - else - { - Debug.LogFormat( "Could not find pass {0} for action {1} on {2}", validActions[ i ].PassName, validActions[ i ].ActionType, validActions[ i ].ActionData ); - } - } - else - { - uiItem.CheckOnExecute = false; - } - } - break; - case AseOptionsActionType.ExcludePass: - { - string optionId = validActions[ i ].ActionData + "Pass"; - bool flag = isRefreshing ? owner.ContainerGraph.ParentWindow.TemplatesManagerInstance.SetOptionsValue( optionId, false ) : false; - if( !flag ) - owner.SetPassVisible( validActions[ i ].ActionData, false ); - } - break; - case AseOptionsActionType.IncludePass: - { - if( !uiItem.IsVisible ) - break; - - string optionId = validActions[ i ].ActionData + "Pass"; - owner.ContainerGraph.ParentWindow.TemplatesManagerInstance.SetOptionsValue( optionId, true ); - owner.SetPassVisible( validActions[ i ].ActionData, true ); - } - break; - case AseOptionsActionType.SetPropertyOnPass: - { - //Debug.Log( "PASSPROP " + validActions[ i ].ActionData ); - //Refresh happens on hotcode reload and shader load and in those situation - // The property own serialization handles its setup - if( isRefreshing ) - continue; - - if( !string.IsNullOrEmpty( validActions[ i ].PassName ) ) - { - TemplateMultiPassMasterNode passMasterNode = owner.ContainerGraph.GetMasterNodeOfPass( validActions[ i ].PassName, owner.LODIndex ); - if( passMasterNode != null ) - { - passMasterNode.SetPropertyActionFromItem( passMasterNode.PassModule, validActions[ i ] ); - } - else - { - Debug.LogFormat( "Could not find pass {0} for action {1} on {2}", validActions[ i ].PassName, validActions[ i ].ActionType, validActions[ i ].ActionData ); - } - } - else - { - owner.SetPropertyActionFromItem( owner.PassModule, validActions[ i ] ); - } - } - break; - case AseOptionsActionType.SetPropertyOnSubShader: - { - //Refresh happens on hotcode reload and shader load and in those situation - // The property own serialization handles its setup - if( isRefreshing ) - continue; - - owner.SetPropertyActionFromItem( owner.SubShaderModule, validActions[ i ] ); - } - break; - case AseOptionsActionType.SetShaderProperty: - { - //This action is only check when shader is compiled over - //the TemplateMultiPassMasterNode via the on CheckPropertyChangesOnOptions() method - } - break; - case AseOptionsActionType.SetMaterialProperty: - { - if( isRefreshing ) - continue; - - if( !uiItem.IsVisible ) - break; - - if( owner.ContainerGraph.CurrentMaterial != null ) - { - string prop = validActions[ i ].ActionData; - if( owner.ContainerGraph.CurrentMaterial.HasProperty( prop ) ) - { - if( uiItem.Options.UIWidget == AseOptionsUIWidget.Float || uiItem.Options.UIWidget == AseOptionsUIWidget.FloatRange ) - owner.ContainerGraph.CurrentMaterial.SetFloat( prop, uiItem.CurrentFieldValue ); - else - owner.ContainerGraph.CurrentMaterial.SetInt( prop, (int)uiItem.CurrentFieldValue ); - - if( ASEMaterialInspector.Instance != null ) - ASEMaterialInspector.Instance.Repaint(); - } - } - } - break; - } - } - } - - public void SetupCustomOptionsFromTemplate( TemplateMultiPassMasterNode owner, bool newTemplate ) - { - TemplateOptionsContainer customOptionsContainer = m_isSubShader ? owner.SubShader.CustomOptionsContainer : owner.Pass.CustomOptionsContainer; - - if( !newTemplate && customOptionsContainer.Body.Length == m_passCustomOptionsSizeCheck ) - { - for( int i = 0; i < m_passCustomOptionsUI.Count; i++ ) - { - if( m_passCustomOptionsUI[ i ].EmptyEvent ) - { - if( m_isSubShader ) - { - m_passCustomOptionsUI[ i ].OnActionPerformedEvt += owner.OnCustomSubShaderOptionSelected; - } - else - { - m_passCustomOptionsUI[ i ].OnActionPerformedEvt += owner.OnCustomPassOptionSelected; - } - } - } - return; - } - - m_passCustomOptionsLabel = string.IsNullOrEmpty( customOptionsContainer.Name ) ? CustomOptionsLabel : " " + customOptionsContainer.Name; - - for( int i = 0; i < m_passCustomOptionsUI.Count; i++ ) - { - m_passCustomOptionsUI[ i ].Destroy(); - } - - m_passCustomOptionsUI.Clear(); - m_passCustomOptionsUIDict.Clear(); - m_passCustomOptionsPorts.Clear(); - - if( customOptionsContainer.Enabled ) - { - m_passCustomOptionsSizeCheck = customOptionsContainer.Body.Length; - for( int i = 0; i < customOptionsContainer.Options.Length; i++ ) - { - switch( customOptionsContainer.Options[ i ].Type ) - { - case AseOptionsType.Option: - { - TemplateOptionUIItem item = new TemplateOptionUIItem( customOptionsContainer.Options[ i ] ); - if( m_isSubShader ) - { - item.OnActionPerformedEvt += owner.OnCustomSubShaderOptionSelected; - } - else - { - item.OnActionPerformedEvt += owner.OnCustomPassOptionSelected; - } - - m_passCustomOptionsUI.Add( item ); - m_passCustomOptionsUIDict.Add( customOptionsContainer.Options[ i ].Id, item ); - } - break; - case AseOptionsType.Port: - { - TemplateOptionPortItem item = new TemplateOptionPortItem( owner, customOptionsContainer.Options[ i ] ); - m_passCustomOptionsPorts.Add( item ); - //if( m_isSubShader ) - //{ - // if( string.IsNullOrEmpty( customOptionsContainer.Options[ i ].Id ) ) - // { - // //No pass name selected. inject on all passes - // TemplateOptionPortItem item = new TemplateOptionPortItem( owner, customOptionsContainer.Options[ i ] ); - // m_passCustomOptionsPorts.Add( item ); - // } - // else if( customOptionsContainer.Options[ i ].Id.Equals( owner.PassName ) ) - // { - // TemplateOptionPortItem item = new TemplateOptionPortItem( owner, customOptionsContainer.Options[ i ] ); - // m_passCustomOptionsPorts.Add( item ); - // } - //} - //else - //{ - // TemplateOptionPortItem item = new TemplateOptionPortItem( owner, customOptionsContainer.Options[ i ] ); - // m_passCustomOptionsPorts.Add( item ); - //} - } - break; - case AseOptionsType.Field: - { - TemplateOptionUIItem item = new TemplateOptionUIItem( customOptionsContainer.Options[ i ] ); - if( m_isSubShader ) - { - item.OnActionPerformedEvt += owner.OnCustomSubShaderOptionSelected; - } - else - { - item.OnActionPerformedEvt += owner.OnCustomPassOptionSelected; - } - - m_passCustomOptionsUI.Add( item ); - m_passCustomOptionsUIDict.Add( customOptionsContainer.Options[ i ].Id, item ); - } - break; - } - } - } - else - { - m_passCustomOptionsSizeCheck = 0; - } - } - - public void SetCustomOptionsInfo( TemplateMultiPassMasterNode masterNode, ref MasterNodeDataCollector dataCollector ) - { - if( masterNode == null ) - return; - - for( int i = 0; i < m_passCustomOptionsUI.Count; i++ ) - { - m_passCustomOptionsUI[ i ].FillDataCollector( ref dataCollector ); - } - - for( int i = 0; i < m_passCustomOptionsPorts.Count; i++ ) - { - m_passCustomOptionsPorts[ i ].FillDataCollector( masterNode, ref dataCollector ); - } - } - - public void CheckImediateActionsForPort( TemplateMultiPassMasterNode masterNode , int portId ) - { - for( int i = 0; i < m_passCustomOptionsPorts.Count; i++ ) - { - m_passCustomOptionsPorts[ i ].CheckImediateActionsForPort( masterNode, portId ); - } - } - - public void SetSubShaderCustomOptionsPortsInfo( TemplateMultiPassMasterNode masterNode, ref MasterNodeDataCollector dataCollector ) - { - if( masterNode == null ) - return; - - - //for( int i = 0; i < m_passCustomOptionsPorts.Count; i++ ) - //{ - // if( string.IsNullOrEmpty( m_passCustomOptionsPorts[ i ].Options.Id ) || - // masterNode.PassUniqueName.Equals( m_passCustomOptionsPorts[ i ].Options.Id ) ) - // { - // m_passCustomOptionsPorts[ i ].FillDataCollector( masterNode, ref dataCollector ); - // } - //} - - for( int i = 0; i < m_passCustomOptionsPorts.Count; i++ ) - { - m_passCustomOptionsPorts[ i ].SubShaderFillDataCollector( masterNode, ref dataCollector ); - } - } - - public void RefreshCustomOptionsDict() - { - if( m_passCustomOptionsUIDict.Count != m_passCustomOptionsUI.Count ) - { - m_passCustomOptionsUIDict.Clear(); - int count = m_passCustomOptionsUI.Count; - for( int i = 0; i < count; i++ ) - { - m_passCustomOptionsUIDict.Add( m_passCustomOptionsUI[ i ].Options.Id, m_passCustomOptionsUI[ i ] ); - } - } - } - - public void ReadFromString( ref uint index, ref string[] nodeParams ) - { - RefreshCustomOptionsDict(); - int savedOptions = Convert.ToInt32( nodeParams[ index++ ] ); - - m_readOptionNames = new string[ savedOptions ]; - m_readOptionSelections = new string[ savedOptions ]; - - for( int i = 0; i < savedOptions; i++ ) - { - string optionName = nodeParams[ index++ ]; - string optionSelection = nodeParams[ index++ ]; - m_readOptionNames[ i ] = optionName; - m_readOptionSelections[ i ] = optionSelection; - - } - } - - public void SetReadOptions() - { - if( m_readOptionNames != null && m_readOptionSelections != null ) - { - for( int i = 0; i < m_readOptionNames.Length; i++ ) - { - if( m_passCustomOptionsUIDict.ContainsKey( m_readOptionNames[ i ] ) ) - { - if( m_passCustomOptionsUIDict[ m_readOptionNames[ i ] ].Options.Type == AseOptionsType.Field ) - { - m_passCustomOptionsUIDict[ m_readOptionNames[ i ] ].FieldValue.ReadFromSingle( m_readOptionSelections[ i ] ); - foreach( var item in m_passCustomOptionsUIDict[ m_readOptionNames[ i ] ].Options.ActionsPerOption.Rows ) - { - if( item.Columns.Length>0 && item.Columns[ 0 ].ActionType == AseOptionsActionType.SetMaterialProperty ) - { - if( UIUtils.CurrentWindow.CurrentGraph.CurrentMaterial != null ) - { - if( UIUtils.CurrentWindow.CurrentGraph.CurrentMaterial.HasProperty( item.Columns[ 0 ].ActionData ) ) - { - m_passCustomOptionsUIDict[ m_readOptionNames[ i ] ].CurrentFieldValue = UIUtils.CurrentWindow.CurrentGraph.CurrentMaterial.GetFloat( item.Columns[ 0 ].ActionData ); - } - } - } - } - } - else - m_passCustomOptionsUIDict[ m_readOptionNames[ i ] ].CurrentOptionIdx = Convert.ToInt32( m_readOptionSelections[ i ] ); - } - } - } - } - - public void Refresh() - { - int count = m_passCustomOptionsUI.Count; - for( int i = 0; i < count; i++ ) - { - m_passCustomOptionsUI[ i ].Refresh(); - } - } - - public void CheckDisable() - { - int count = m_passCustomOptionsUI.Count; - for( int i = 0; i < count; i++ ) - { - m_passCustomOptionsUI[ i ].CheckEnDisable(); - } - } - - public void WriteToString( ref string nodeInfo ) - { - int optionsCount = m_passCustomOptionsUI.Count; - IOUtils.AddFieldValueToString( ref nodeInfo, optionsCount ); - for( int i = 0; i < optionsCount; i++ ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_passCustomOptionsUI[ i ].Options.Id ); - if( m_passCustomOptionsUI[ i ].Options.Type == AseOptionsType.Field ) - IOUtils.AddFieldValueToString( ref nodeInfo, m_passCustomOptionsUI[ i ].FieldValue.WriteToSingle() ); - else - IOUtils.AddFieldValueToString( ref nodeInfo, m_passCustomOptionsUI[ i ].CurrentOption ); - } - } - - public List<TemplateOptionUIItem> PassCustomOptionsUI { get { return m_passCustomOptionsUI; } } - - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsUIHelper.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsUIHelper.cs.meta deleted file mode 100644 index 077260b0..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateOptionsUIHelper.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 389dcf32e61ce9d47b9a92ab691365d3 -timeCreated: 1544089703 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatePass.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatePass.cs deleted file mode 100644 index 22ea92f4..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatePass.cs +++ /dev/null @@ -1,631 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> -#define CUSTOM_OPTIONS_AVAILABLE -using UnityEngine; -using System; -using System.Collections.Generic; -using System.Text.RegularExpressions; - -namespace AmplifyShaderEditor -{ - - [Serializable] - public class TemplatePass - { - private const string DefaultPassNameStr = "SubShader {0} Pass {1}"; - - [SerializeField] - private int m_idx = -1; - - [SerializeField] - private bool m_isInvisible = false; - - [SerializeField] - private int m_invisibleOptions = 0; - - [SerializeField] - private bool m_isMainPass = false; - - [SerializeField] - private TemplateModulesData m_modules; - - [SerializeField] - private List<TemplateInputData> m_inputDataList = new List<TemplateInputData>(); - private Dictionary<int, TemplateInputData> m_inputDataDict = new Dictionary<int, TemplateInputData>(); - - [SerializeField] - private TemplateFunctionData m_vertexFunctionData; - - [SerializeField] - private TemplateFunctionData m_fragmentFunctionData; - - [SerializeField] - private VertexDataContainer m_vertexDataContainer; - - [SerializeField] - private TemplateInterpData m_interpolatorDataContainer; - - [SerializeField] - private TemplateTessVControlTag m_tessVControlTag; - - [SerializeField] - private TemplateTessControlData m_tessControlData; - - [SerializeField] - private TemplateTessDomainData m_tessDomainData; - - [SerializeField] - private List<TemplateLocalVarData> m_localVarsList = new List<TemplateLocalVarData>(); - - [SerializeField] - private string m_uniquePrefix; - - [SerializeField] - private TemplatePropertyContainer m_templateProperties = new TemplatePropertyContainer(); - - [SerializeField] - private List<TemplateShaderPropertyData> m_availableShaderGlobals = new List<TemplateShaderPropertyData>(); - - [SerializeField] - TemplateInfoContainer m_passNameContainer = new TemplateInfoContainer(); -#if CUSTOM_OPTIONS_AVAILABLE - [SerializeField] - TemplateOptionsContainer m_customOptionsContainer = new TemplateOptionsContainer(); -#endif - public TemplatePass( TemplateMultiPass template, TemplateSubShader subShader, int subshaderIdx, int passIdx, TemplateIdManager idManager, string uniquePrefix, int offsetIdx, TemplatePassInfo passInfo, ref Dictionary<string, TemplateShaderPropertyData> duplicatesHelper ) - { - m_idx = passIdx; - - m_uniquePrefix = uniquePrefix; - idManager.RegisterPassId( passInfo.Data ); - m_isMainPass = passInfo.Data.Contains( TemplatesManager.TemplateMainPassTag ); - if( !m_isMainPass ) - { - string id = string.Empty; - int idIndex = 0; - m_isInvisible = TemplateHelperFunctions.FetchInvisibleInfo( passInfo.Data, ref m_invisibleOptions, ref id, ref idIndex ); - if( m_isInvisible ) - { - idManager.RegisterId( idIndex, uniquePrefix + id, id, true ); - } - } - - FetchPassName( offsetIdx, passInfo.Data ); - if( m_passNameContainer.Index > -1 ) - { - idManager.RegisterId( m_passNameContainer.Index, uniquePrefix + m_passNameContainer.Id, m_passNameContainer.Id ); - } - else - { - m_passNameContainer.Data = string.Format( DefaultPassNameStr, subshaderIdx, passIdx ); - } - -#if CUSTOM_OPTIONS_AVAILABLE - m_customOptionsContainer = TemplateOptionsToolsHelper.GenerateOptionsContainer( false, passInfo.Data ); - if( m_customOptionsContainer.Enabled ) - { - idManager.RegisterId( m_customOptionsContainer.Index, uniquePrefix + m_customOptionsContainer.Body, m_customOptionsContainer.Body, true ); - } - //m_customOptionsContainer.CopyPortOptionsFrom( subShader.CustomOptionsContainer, m_passNameContainer.Data ); -#endif - m_modules = new TemplateModulesData( m_customOptionsContainer,idManager, m_templateProperties, uniquePrefix + "Module", offsetIdx, passInfo.Data, false ); - - if( !m_modules.PassTag.IsValid ) - { - m_modules.PassTag.StartIdx = passInfo.GlobalStartIdx; - m_templateProperties.AddId( passInfo.Data, m_modules.PassTag.Id, passInfo.LocalStartIdx, false ); - //m_modules.PassTag.StartIdx -= m_templateProperties.PropertyDict[ m_modules.PassTag.Id ].Indentation.Length; - //m_templateProperties.PropertyDict[ m_modules.PassTag.Id ].UseIndentationAtStart = false; - idManager.RegisterId( m_modules.PassTag.StartIdx, m_modules.UniquePrefix + m_modules.PassTag.Id, string.Empty ); - } - m_modules.SetPassUniqueNameIfUndefined( m_passNameContainer.Data ); - - m_modules.SRPType = subShader.Modules.SRPType; - if( m_modules.SRPType == TemplateSRPType.HD ) - { - m_modules.SRPIsPBR = passInfo.Data.Contains( TemplateHelperFunctions.HDPBRTag ); - - } - - Dictionary<string, TemplateShaderPropertyData> ownDuplicatesDict = new Dictionary<string, TemplateShaderPropertyData>( duplicatesHelper ); - TemplateHelperFunctions.CreateShaderGlobalsList( passInfo.Data, ref m_availableShaderGlobals, ref ownDuplicatesDict ); - - // Vertex and Interpolator data - FetchVertexAndInterpData( template, subShader.Modules, offsetIdx, passInfo.Data ); - if( m_vertexDataContainer != null ) - idManager.RegisterId( m_vertexDataContainer.VertexDataStartIdx, uniquePrefix + m_vertexDataContainer.VertexDataId, m_vertexDataContainer.VertexDataId ); - - if( m_interpolatorDataContainer != null ) - idManager.RegisterId( m_interpolatorDataContainer.InterpDataStartIdx, uniquePrefix + m_interpolatorDataContainer.InterpDataId, m_interpolatorDataContainer.InterpDataId ); - - //Fetch function code areas - FetchCodeAreas( offsetIdx, TemplatesManager.TemplateVertexCodeBeginArea, MasterNodePortCategory.Vertex, passInfo.Data ); - if( m_vertexFunctionData != null ) - idManager.RegisterId( m_vertexFunctionData.Position, uniquePrefix + m_vertexFunctionData.Id, m_vertexFunctionData.Id ); - - FetchCodeAreas( offsetIdx, TemplatesManager.TemplateFragmentCodeBeginArea, MasterNodePortCategory.Fragment, passInfo.Data ); - if( m_fragmentFunctionData != null ) - idManager.RegisterId( m_fragmentFunctionData.Position, uniquePrefix + m_fragmentFunctionData.Id, m_fragmentFunctionData.Id ); - - //Fetching inputs, must be do - if( m_fragmentFunctionData != null ) - FetchInputs( offsetIdx, MasterNodePortCategory.Fragment, passInfo.Data ); - - if( m_vertexFunctionData != null ) - FetchInputs( offsetIdx, MasterNodePortCategory.Vertex, passInfo.Data ); - - FetchTessellationData( template, subShader.Modules, offsetIdx, passInfo.Data ); - if( m_tessVControlTag != null ) - idManager.RegisterId( m_tessVControlTag.StartIdx, uniquePrefix + m_tessVControlTag.Id, m_tessVControlTag.Id ); - - if( m_tessControlData != null ) - idManager.RegisterId( m_tessControlData.StartIdx, uniquePrefix + m_tessControlData.Id, m_tessControlData.Id ); - - if( m_tessDomainData != null ) - idManager.RegisterId( m_tessDomainData.StartIdx, uniquePrefix + m_tessDomainData.Id, m_tessDomainData.Id ); - - TemplateHelperFunctions.FetchInlineVars( passInfo.Data, ref idManager ); - - //Fetch local variables must be done after fetching code areas as it needs them to see is variable is on vertex or fragment - TemplateHelperFunctions.FetchLocalVars( passInfo.Data, ref m_localVarsList, m_vertexFunctionData, m_fragmentFunctionData ); - - int localVarCount = m_localVarsList.Count; - if( localVarCount > 0 ) - { - idManager.RegisterTag( TemplatesManager.TemplateLocalVarTag ); - for( int i = 0; i < localVarCount; i++ ) - { - if( m_localVarsList[ i ].IsSpecialVar ) - { - idManager.RegisterTag( m_localVarsList[ i ].Id ); - } - } - } - - int inputsCount = m_inputDataList.Count; - for( int i = 0; i < inputsCount; i++ ) - { - if( m_inputDataList[ i ] != null ) - idManager.RegisterId( m_inputDataList[ i ].TagGlobalStartIdx, uniquePrefix + m_inputDataList[ i ].TagId, m_inputDataList[ i ].TagId ); - } - - //int passEndIndex = passInfo.Data.LastIndexOf( "}" ); - //if( passEndIndex > 0 ) - //{ - // int identationIndex = -1; - // for( int i = passEndIndex; i >= 0; i-- ) - // { - // if( passInfo.Data[ i ] == TemplatesManager.TemplateNewLine ) - // { - // identationIndex = i + 1; - // break; - // } - - // if( i == 0 ) - // { - // identationIndex = 0; - // } - // } - - // if( identationIndex > -1 ) - // { - // int length = passEndIndex - identationIndex; - // string indentation = ( length > 0 ) ? passInfo.Data.Substring( identationIndex, length ) : string.Empty; - // TemplateProperty templateProperty = new TemplateProperty( TemplatesManager.TemplateEndPassTag, indentation, false ); - // m_templateProperties.AddId( templateProperty ); - // idManager.RegisterId( offsetIdx + passEndIndex, uniquePrefix + TemplatesManager.TemplateEndPassTag, string.Empty ); - // } - //} - - ownDuplicatesDict.Clear(); - ownDuplicatesDict = null; - } - - public void Destroy() - { - m_passNameContainer = null; -#if CUSTOM_OPTIONS_AVAILABLE - m_customOptionsContainer = null; -#endif - if( m_templateProperties != null ) - m_templateProperties.Destroy(); - - m_templateProperties = null; - - if( m_modules != null ) - m_modules.Destroy(); - - m_modules = null; - - if( m_inputDataList != null ) - m_inputDataList.Clear(); - - m_inputDataList = null; - - if( m_inputDataDict != null ) - m_inputDataDict.Clear(); - - m_inputDataDict = null; - - m_vertexFunctionData = null; - m_fragmentFunctionData = null; - - if( m_vertexDataContainer != null ) - m_vertexDataContainer.Destroy(); - - m_vertexDataContainer = null; - - m_tessVControlTag = null; - - m_tessControlData = null; - - m_tessDomainData = null; - - if( m_interpolatorDataContainer != null ) - m_interpolatorDataContainer.Destroy(); - - if( m_localVarsList != null ) - { - m_localVarsList.Clear(); - m_localVarsList = null; - } - - m_interpolatorDataContainer = null; - - if( m_availableShaderGlobals != null ) - m_availableShaderGlobals.Clear(); - - m_availableShaderGlobals = null; - } - - public TemplateInputData InputDataFromId( int id ) - { - if( m_inputDataDict == null ) - m_inputDataDict = new Dictionary<int, TemplateInputData>(); - - if( m_inputDataDict.Count != m_inputDataList.Count ) - { - m_inputDataDict.Clear(); - for( int i = 0; i < m_inputDataList.Count; i++ ) - { - m_inputDataDict.Add( m_inputDataList[ i ].PortUniqueId, m_inputDataList[ i ] ); - } - } - - if( m_inputDataDict.ContainsKey( id ) ) - return m_inputDataDict[ id ]; - - return null; - } - - void FetchPassName( int offsetIdx, string body ) - { - Match match = Regex.Match( body, TemplateHelperFunctions.PassNamePattern ); - if( match != null && match.Groups.Count > 1 ) - { - m_passNameContainer.Id = match.Groups[ 0 ].Value; - m_passNameContainer.Data = match.Groups[ 1 ].Value; - m_passNameContainer.Index = offsetIdx + match.Index; - } - } - - void FetchTessellationData( TemplateMultiPass template, TemplateModulesData subShaderModule, int offsetIdx, string body ) - { - // Tessellation VControl Tag - try - { - int vcontrolcodeBegin = body.IndexOf( TemplatesManager.TemplateTessVControlTag ); - if( vcontrolcodeBegin > -1 ) - { - m_tessVControlTag = new TemplateTessVControlTag(); - m_tessVControlTag.Id = TemplatesManager.TemplateTessVControlTag; - m_tessVControlTag.StartIdx = offsetIdx + vcontrolcodeBegin; - - m_templateProperties.AddId( body, m_tessVControlTag.Id ); - } - } - catch( Exception e ) - { - Debug.LogException( e ); - } - - // Tessellation Control Data - try - { - int controlCodeBegin = body.IndexOf( TemplatesManager.TemplateTessControlCodeArea ); - if( controlCodeBegin > -1 ) - { - int beginIdx = controlCodeBegin + TemplatesManager.TemplateTessControlCodeArea.Length; - int endIdx = body.IndexOf( TemplatesManager.TemplateEndOfLine, beginIdx ); - int length = endIdx - beginIdx; - - string parameters = body.Substring( beginIdx, length ); - - string[] parametersArr = parameters.Split( IOUtils.FIELD_SEPARATOR ); - - string id = body.Substring( controlCodeBegin, endIdx + TemplatesManager.TemplateEndOfLine.Length - controlCodeBegin ); - string inParameters = parametersArr[ 0 ]; - string outParameters = ( parametersArr.Length > 1 ) ? parametersArr[ 1 ] : string.Empty; - - m_tessControlData = new TemplateTessControlData( offsetIdx + controlCodeBegin, id, inParameters, outParameters ); - - m_templateProperties.AddId( body, id ); - } - } - catch( Exception e ) - { - Debug.LogException( e ); - } - - // Tessellation Domain Data - try - { - int domainCodeBegin = body.IndexOf( TemplatesManager.TemplateTessDomainCodeArea ); - if( domainCodeBegin > -1 ) - { - int beginIdx = domainCodeBegin + TemplatesManager.TemplateTessDomainCodeArea.Length; - int endIdx = body.IndexOf( TemplatesManager.TemplateEndOfLine, beginIdx ); - int length = endIdx - beginIdx; - - string parameters = body.Substring( beginIdx, length ); - - string[] parametersArr = parameters.Split( IOUtils.FIELD_SEPARATOR ); - - string id = body.Substring( domainCodeBegin, endIdx + TemplatesManager.TemplateEndOfLine.Length - domainCodeBegin ); - string inParameters = ( parametersArr.Length > 0 ) ? parametersArr[ 0 ] : string.Empty; - string outParameters = ( parametersArr.Length > 1 ) ? parametersArr[ 1 ] : string.Empty; - string baryParameters = ( parametersArr.Length > 2 ) ? parametersArr[ 2 ] : string.Empty; - - m_tessDomainData = new TemplateTessDomainData( offsetIdx + domainCodeBegin, id, inParameters, outParameters, baryParameters ); - - m_templateProperties.AddId( body, id ); - } - } - catch( Exception e ) - { - Debug.LogException( e ); - } - } - - void FetchVertexAndInterpData(TemplateMultiPass template, TemplateModulesData subShaderModule, int offsetIdx, string body ) - { - // Vertex Data - try - { - int vertexDataTagBegin = body.IndexOf( TemplatesManager.TemplateVertexDataTag ); - if( vertexDataTagBegin > -1 ) - { - m_vertexDataContainer = new VertexDataContainer(); - m_vertexDataContainer.VertexDataStartIdx = offsetIdx + vertexDataTagBegin; - int vertexDataTagEnd = body.IndexOf( TemplatesManager.TemplateEndOfLine, vertexDataTagBegin ); - m_vertexDataContainer.VertexDataId = body.Substring( vertexDataTagBegin, vertexDataTagEnd + TemplatesManager.TemplateEndOfLine.Length - vertexDataTagBegin ); - int dataBeginIdx = body.LastIndexOf( '{', vertexDataTagBegin, vertexDataTagBegin ); - string vertexData = body.Substring( dataBeginIdx + 1, vertexDataTagBegin - dataBeginIdx ); - - int parametersBegin = vertexDataTagBegin + TemplatesManager.TemplateVertexDataTag.Length; - string parameters = body.Substring( parametersBegin, vertexDataTagEnd - parametersBegin ); - m_vertexDataContainer.VertexData = TemplateHelperFunctions.CreateVertexDataList( vertexData, parameters ); - m_templateProperties.AddId( body, m_vertexDataContainer.VertexDataId ); - } - } - catch( Exception e ) - { - Debug.LogException( e ); - } - - // Available interpolators - try - { - int interpDataBegin = body.IndexOf( TemplatesManager.TemplateInterpolatorBeginTag ); - if( interpDataBegin > -1 ) - { - int interpDataEnd = body.IndexOf( TemplatesManager.TemplateEndOfLine, interpDataBegin ); - string interpDataId = body.Substring( interpDataBegin, interpDataEnd + TemplatesManager.TemplateEndOfLine.Length - interpDataBegin ); - - int dataBeginIdx = body.LastIndexOf( '{', interpDataBegin, interpDataBegin ); - string interpData = body.Substring( dataBeginIdx + 1, interpDataBegin - dataBeginIdx ); - - int interpolatorAmount = TemplateHelperFunctions.AvailableInterpolators[ "2.5" ]; - - if( m_modules.ShaderModel.IsValid ) - { - interpolatorAmount = m_modules.ShaderModel.InterpolatorAmount; - } - else if( subShaderModule.ShaderModel.IsValid ) - { - interpolatorAmount = subShaderModule.ShaderModel.InterpolatorAmount; - } - else if( template.GlobalShaderModel.IsValid ) - { - interpolatorAmount = template.GlobalShaderModel.InterpolatorAmount; - } - - m_interpolatorDataContainer = TemplateHelperFunctions.CreateInterpDataList( interpData, interpDataId, interpolatorAmount ); - m_interpolatorDataContainer.InterpDataId = interpDataId; - m_interpolatorDataContainer.InterpDataStartIdx = offsetIdx + interpDataBegin; - m_templateProperties.AddId( body, interpDataId ); - - } - } - catch( Exception e ) - { - Debug.LogException( e ); - } - } - - void FetchCodeAreas( int offsetIdx, string begin, MasterNodePortCategory category, string body ) - { - int areaBeginIndexes = body.IndexOf( begin ); - if( areaBeginIndexes > -1 ) - { - int beginIdx = areaBeginIndexes + begin.Length; - int endIdx = body.IndexOf( TemplatesManager.TemplateEndOfLine, beginIdx ); - int length = endIdx - beginIdx; - - string parameters = body.Substring( beginIdx, length ); - - string[] parametersArr = parameters.Split( IOUtils.FIELD_SEPARATOR ); - - string id = body.Substring( areaBeginIndexes, endIdx + TemplatesManager.TemplateEndOfLine.Length - areaBeginIndexes ); - string inParameters = parametersArr[ 0 ]; - string outParameters = ( parametersArr.Length > 1 ) ? parametersArr[ 1 ] : string.Empty; - if( category == MasterNodePortCategory.Fragment ) - { - string mainBodyName = string.Empty; - int mainBodyLocalIndex = -1; - - Match mainBodyNameMatch = Regex.Match( body, TemplateHelperFunctions.FragmentPragmaPattern ); - if( mainBodyNameMatch != null && mainBodyNameMatch.Groups.Count == 2 ) - { - mainBodyName = mainBodyNameMatch.Groups[ 1 ].Value; - string pattern = string.Format( TemplateHelperFunctions.FunctionBodyStartPattern, mainBodyName ); - Match mainBodyIdMatch = Regex.Match( body, pattern ); - if( mainBodyIdMatch != null && mainBodyIdMatch.Groups.Count > 0 ) - { - mainBodyLocalIndex = mainBodyIdMatch.Index; - } - - } - - m_fragmentFunctionData = new TemplateFunctionData( mainBodyLocalIndex, mainBodyName, id, offsetIdx + areaBeginIndexes, inParameters, outParameters, category ); - } - else - { - string mainBodyName = string.Empty; - int mainBodyLocalIndex = -1; - - Match mainBodyNameMatch = Regex.Match( body, TemplateHelperFunctions.VertexPragmaPattern ); - if( mainBodyNameMatch != null && mainBodyNameMatch.Groups.Count == 2 ) - { - mainBodyName = mainBodyNameMatch.Groups[ 1 ].Value; - string pattern = string.Format( TemplateHelperFunctions.FunctionBodyStartPattern, mainBodyName ); - Match mainBodyIdMatch = Regex.Match( body, pattern ); - if( mainBodyIdMatch != null && mainBodyIdMatch.Groups.Count > 0 ) - { - mainBodyLocalIndex = mainBodyIdMatch.Index; - } - } - - m_vertexFunctionData = new TemplateFunctionData( mainBodyLocalIndex, mainBodyName, id, offsetIdx + areaBeginIndexes, inParameters, outParameters, category ); - } - m_templateProperties.AddId( body, id, true ); - } - } - - void FetchInputs( int offset, MasterNodePortCategory portCategory, string body ) - { - string beginTag = ( portCategory == MasterNodePortCategory.Fragment ) ? TemplatesManager.TemplateInputsFragBeginTag : TemplatesManager.TemplateInputsVertBeginTag; - int[] inputBeginIndexes = body.AllIndexesOf( beginTag ); - if( inputBeginIndexes != null && inputBeginIndexes.Length > 0 ) - { - for( int i = 0; i < inputBeginIndexes.Length; i++ ) - { - int inputEndIdx = body.IndexOf( TemplatesManager.TemplateEndSectionTag, inputBeginIndexes[ i ] ); - int defaultValueBeginIdx = inputEndIdx + TemplatesManager.TemplateEndSectionTag.Length; - int endLineIdx = body.IndexOf( TemplatesManager.TemplateFullEndTag, defaultValueBeginIdx ); - - string defaultValue = body.Substring( defaultValueBeginIdx, endLineIdx - defaultValueBeginIdx ); - string tagId = body.Substring( inputBeginIndexes[ i ], endLineIdx + TemplatesManager.TemplateFullEndTag.Length - inputBeginIndexes[ i ] ); - - int beginIndex = inputBeginIndexes[ i ] + beginTag.Length; - int length = inputEndIdx - beginIndex; - string inputData = body.Substring( beginIndex, length ); - string[] inputDataArray = inputData.Split( IOUtils.FIELD_SEPARATOR ); - - if( inputDataArray != null && inputDataArray.Length > 0 ) - { - try - { - string portName = inputDataArray[ (int)TemplatePortIds.Name ]; - WirePortDataType dataType = (WirePortDataType)Enum.Parse( typeof( WirePortDataType ), inputDataArray[ (int)TemplatePortIds.DataType ].ToUpper() ); - if( inputDataArray.Length == 3 ) - { - int portOrderId = m_inputDataList.Count; - int portUniqueId = -1; - bool isInt = int.TryParse( inputDataArray[ 2 ], out portUniqueId ); - if( isInt ) - { - if( portUniqueId < 0 ) - portUniqueId = m_inputDataList.Count; - - m_inputDataList.Add( new TemplateInputData( inputBeginIndexes[ i ], offset + inputBeginIndexes[ i ], tagId, portName, defaultValue, dataType, portCategory, portUniqueId, portOrderId, string.Empty ) ); - m_templateProperties.AddId( body, tagId, false ); - } - else - { - portUniqueId = m_inputDataList.Count; - m_inputDataList.Add( new TemplateInputData( inputBeginIndexes[ i ], offset + inputBeginIndexes[ i ], tagId, portName, defaultValue, dataType, portCategory, portUniqueId, portOrderId, inputDataArray[ 2 ] ) ); - m_templateProperties.AddId( body, tagId, false ); - } - } - else - { - int portUniqueIDArrIdx = (int)TemplatePortIds.UniqueId; - int portUniqueId = ( portUniqueIDArrIdx < inputDataArray.Length ) ? Convert.ToInt32( inputDataArray[ portUniqueIDArrIdx ] ) : -1; - if( portUniqueId < 0 ) - portUniqueId = m_inputDataList.Count; - - int portOrderArrayIdx = (int)TemplatePortIds.OrderId; - int portOrderId = ( portOrderArrayIdx < inputDataArray.Length ) ? Convert.ToInt32( inputDataArray[ portOrderArrayIdx ] ) : -1; - if( portOrderId < 0 ) - portOrderId = m_inputDataList.Count; - - int portLinkIdx = (int)TemplatePortIds.Link; - string linkId = ( portLinkIdx < inputDataArray.Length ) ? inputDataArray[ portLinkIdx ] : string.Empty; - m_inputDataList.Add( new TemplateInputData( inputBeginIndexes[ i ], offset + inputBeginIndexes[ i ], tagId, portName, defaultValue, dataType, portCategory, portUniqueId, portOrderId, linkId ) ); - m_templateProperties.AddId( body, tagId, false ); - } - } - catch( Exception e ) - { - Debug.LogException( e ); - } - } - } - } - } - -#if CUSTOM_OPTIONS_AVAILABLE - public TemplateOptionsContainer CustomOptionsContainer { get { return m_customOptionsContainer; } } -#endif - public TemplateModulesData Modules { get { return m_modules; } } - public List<TemplateInputData> InputDataList { get { return m_inputDataList; } } - public TemplateFunctionData VertexFunctionData { get { return m_vertexFunctionData; } } - public TemplateFunctionData FragmentFunctionData { get { return m_fragmentFunctionData; } } - public VertexDataContainer VertexDataContainer { get { return m_vertexDataContainer; } } - public TemplateInterpData InterpolatorDataContainer { get { return m_interpolatorDataContainer; } } - public TemplateTessVControlTag TessVControlTag { get { return m_tessVControlTag; } } - public TemplateTessControlData TessControlData { get { return m_tessControlData; } } - public TemplateTessDomainData TessDomainData { get { return m_tessDomainData; } } - public string UniquePrefix { get { return m_uniquePrefix; } } - public TemplatePropertyContainer TemplateProperties { get { return m_templateProperties; } } - public List<TemplateShaderPropertyData> AvailableShaderGlobals { get { return m_availableShaderGlobals; } } - public List<TemplateLocalVarData> LocalVarsList { get { return m_localVarsList; } } - public TemplateInfoContainer PassNameContainer { get { return m_passNameContainer; } } - public bool IsMainPass { get { return m_isMainPass; } set { m_isMainPass = value; } } - public bool IsInvisible { get { return m_isInvisible; } } - public int InvisibleOptions { get { return m_invisibleOptions; } } - public int Idx { get { return m_idx; } } - public bool AddToList - { - get - { - if( m_isInvisible ) - { - return ( m_inputDataList.Count > 0 ); - } - - return true; - } - } - public bool HasValidFunctionBody - { - get - { - if( m_fragmentFunctionData != null || m_vertexFunctionData != null ) - return true; - return false; - } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatePass.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatePass.cs.meta deleted file mode 100644 index e36dee49..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatePass.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 1e6749bf88e2d0f4ab5812f084973f4c -timeCreated: 1517831575 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatePassSelectorHelper.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatePassSelectorHelper.cs deleted file mode 100644 index e85a92d3..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatePassSelectorHelper.cs +++ /dev/null @@ -1,167 +0,0 @@ -using UnityEditor; -using UnityEngine; -using System; -using System.Collections.Generic; - -namespace AmplifyShaderEditor -{ - [Serializable] - public class PassVisibleOptionsItems - { - public bool Visible; - public string Name; - public int Idx = -1; - } - - [Serializable] - public class TemplatePassSelectorHelper - { - private const string Label = " Available Passes"; - - [SerializeField] - private bool m_foldout; - - [SerializeField] - private PassVisibleOptionsItems[] m_currentPasses; - - [NonSerialized] - private Dictionary<string, PassVisibleOptionsItems> m_currentPassesDict; - - [SerializeField] - private int m_mainPassId; - - public void CopyFrom( TemplatePassSelectorHelper from ) - { - for( int i = 0; i < from.AvailablePasses.Length; i++ ) - { - SetPassVisible( from.AvailablePasses[ i ].Name, from.AvailablePasses[ i ].Visible ); - } - } - - public void Setup( TemplateSubShader subShader ) - { - if( m_currentPasses == null ) - { - m_currentPassesDict = new Dictionary<string, PassVisibleOptionsItems>(); - m_currentPasses = new PassVisibleOptionsItems[ subShader.Passes.Count ]; - for( int i = 0; i < m_currentPasses.Length; i++ ) - { - if( subShader.Passes[ i ].IsMainPass ) - m_mainPassId = i; - - m_currentPasses[ i ] = new PassVisibleOptionsItems() { Name = subShader.Passes[ i ].PassNameContainer.Data, Visible = true, Idx = i }; - m_currentPassesDict.Add( m_currentPasses[ i ].Name, m_currentPasses[ i ] ); - } - } - } - - public void Clear() - { - m_currentPasses = null; - - if( m_currentPassesDict != null ) - m_currentPassesDict.Clear(); - - m_currentPassesDict = null; - } - - public void Destroy() - { - m_currentPasses = null; - - if( m_currentPassesDict != null ) - m_currentPassesDict.Clear(); - - m_currentPassesDict = null; - } - - public void Draw( TemplateMultiPassMasterNode owner ) - { - if( m_currentPasses.Length < 2 ) - return; - - NodeUtils.DrawNestedPropertyGroup( ref m_foldout, Label, () => - { - for( int i = 0; i < m_currentPasses.Length; i++ ) - { - EditorGUI.BeginChangeCheck(); - m_currentPasses[ i ].Visible = owner.EditorGUILayoutToggleLeft( m_currentPasses[ i ].Name, m_currentPasses[ i ].Visible ); - if( EditorGUI.EndChangeCheck() ) - { - owner.ContainerGraph.GetMultiPassMasterNodes( owner.LODIndex)[ m_currentPasses[ i ].Idx ].IsInvisible = !m_currentPasses[ i ].Visible; - } - - } - EditorGUILayout.Space(); - } ); - } - - public void ReadFromString( ref uint index, ref string[] nodeParams ) - { - int passAmount = Convert.ToInt32( nodeParams[ index++ ] ); - for( int i = 0; i < passAmount; i++ ) - { - bool value = Convert.ToBoolean( nodeParams[ index++ ] ); - if( i < m_currentPasses.Length ) - { - m_currentPasses[ i ].Visible = value; - } - } - } - - public void WriteToString( ref string nodeInfo ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_currentPasses.Length ); - for( int i = 0; i < m_currentPasses.Length; i++ ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_currentPasses[ i ].Visible ); - } - } - - public void SetPassVisible( string passName, bool visible ) - { - bool refresh = false; - if( m_currentPassesDict == null ) - { - m_currentPassesDict = new Dictionary<string, PassVisibleOptionsItems>(); - refresh = true; - } - else if( m_currentPassesDict.Count != m_currentPasses.Length ) - { - refresh = true; - } - - if( refresh ) - { - for( int i = 0; i < m_currentPasses.Length; i++ ) - { - m_currentPassesDict.Add( m_currentPasses[ i ].Name, m_currentPasses[ i ] ); - } - } - - if( m_currentPassesDict.ContainsKey( passName ) ) - { - m_currentPassesDict[ passName ].Visible = visible; - } - } - - public int LastActivePass - { - get - { - if( m_currentPasses != null ) - { - for( int i = m_currentPasses.Length - 1; i > -1; i-- ) - { - if( m_currentPasses[ i ].Visible ) - return i; - } - } - m_currentPasses[ m_mainPassId ].Visible = true; - return m_mainPassId; - } - } - public bool IsVisible( int passId ) { return m_currentPasses[ passId ].Visible; } - private PassVisibleOptionsItems[] AvailablePasses { get { return m_currentPasses; } } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatePassSelectorHelper.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatePassSelectorHelper.cs.meta deleted file mode 100644 index 2f45a9d5..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatePassSelectorHelper.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 1340693b71fe44846bb72eb1035f138d -timeCreated: 1542731803 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatePostProcessor.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatePostProcessor.cs deleted file mode 100644 index e9ee8c71..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatePostProcessor.cs +++ /dev/null @@ -1,157 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEditor; -using UnityEngine; -using System.IO; -using System.Security.AccessControl; -using System.Security.Principal; -using System.Text.RegularExpressions; -using Debug = UnityEngine.Debug; - -namespace AmplifyShaderEditor -{ - public sealed class TemplatePostProcessor : AssetPostprocessor - { - public static TemplatesManager DummyManager; - public static void Destroy() - { - if( DummyManager != null ) - { - DummyManager.Destroy(); - ScriptableObject.DestroyImmediate( DummyManager ); - DummyManager = null; - } - } - - static void OnPostprocessAllAssets( string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths ) - { - TemplatesManager templatesManager; - bool firstTimeDummyFlag = false; - if( UIUtils.CurrentWindow == null ) - { - if( DummyManager == null ) - { - DummyManager = ScriptableObject.CreateInstance<TemplatesManager>(); - DummyManager.hideFlags = HideFlags.HideAndDontSave; - firstTimeDummyFlag = true; - } - templatesManager = DummyManager; - } - else - { - Destroy(); - templatesManager = UIUtils.CurrentWindow.TemplatesManagerInstance; - } - - if( templatesManager == null ) - { - return; - } - - if( !templatesManager.Initialized ) - { - templatesManager.Init(); - } - - bool refreshMenuItems = false; - for( int i = 0; i < importedAssets.Length; i++ ) - { - if( TemplateHelperFunctions.CheckIfTemplate( importedAssets[ i ] ) ) - { - string guid = AssetDatabase.AssetPathToGUID( importedAssets[ i ] ); - TemplateDataParent templateData = templatesManager.GetTemplate( guid ); - if( templateData != null ) - { - refreshMenuItems = templateData.Reload() || refreshMenuItems || firstTimeDummyFlag; - int windowCount = IOUtils.AllOpenedWindows.Count; - AmplifyShaderEditorWindow currWindow = UIUtils.CurrentWindow; - for( int windowIdx = 0; windowIdx < windowCount; windowIdx++ ) - { - if( IOUtils.AllOpenedWindows[ windowIdx ].OutsideGraph.CurrentCanvasMode == NodeAvailability.TemplateShader ) - { - if( IOUtils.AllOpenedWindows[ windowIdx ].OutsideGraph.MultiPassMasterNodes.NodesList[ 0 ].CurrentTemplate == templateData ) - { - UIUtils.CurrentWindow = IOUtils.AllOpenedWindows[ windowIdx ]; - IOUtils.AllOpenedWindows[ windowIdx ].OutsideGraph.ForceMultiPassMasterNodesRefresh(); - } - } - } - UIUtils.CurrentWindow = currWindow; - } - else - { - refreshMenuItems = true; - string name = TemplatesManager.OfficialTemplates.ContainsKey( guid ) ? TemplatesManager.OfficialTemplates[ guid ] : string.Empty; - TemplateMultiPass mp = TemplateMultiPass.CreateInstance<TemplateMultiPass>(); - mp.Init( name, guid, true ); - templatesManager.AddTemplate( mp ); - } - } - } - - if( deletedAssets.Length > 0 ) - { - if( deletedAssets[ 0 ].IndexOf( Constants.InvalidPostProcessDatapath ) < 0 ) - { - for( int i = 0; i < deletedAssets.Length; i++ ) - { - string guid = AssetDatabase.AssetPathToGUID( deletedAssets[ i ] ); - TemplateDataParent templateData = templatesManager.GetTemplate( guid ); - if( templateData != null ) - { - // Close any window using that template - int windowCount = IOUtils.AllOpenedWindows.Count; - for( int windowIdx = 0; windowIdx < windowCount; windowIdx++ ) - { - TemplateMasterNode masterNode = IOUtils.AllOpenedWindows[ windowIdx ].CurrentGraph.CurrentMasterNode as TemplateMasterNode; - if( masterNode != null && masterNode.CurrentTemplate.GUID.Equals( templateData.GUID ) ) - { - IOUtils.AllOpenedWindows[ windowIdx ].Close(); - } - } - - templatesManager.RemoveTemplate( templateData ); - refreshMenuItems = true; - } - } - } - } - - //for ( int i = 0; i < movedAssets.Length; i++ ) - //{ - // if ( TemplateHelperFunctions.CheckIfTemplate( movedAssets[ i ] ) ) - // { - // refreshMenuItems = true; - // break; - // } - //} - - //for ( int i = 0; i < movedFromAssetPaths.Length; i++ ) - //{ - // if ( TemplateHelperFunctions.CheckIfTemplate( movedFromAssetPaths[ i ] ) ) - // { - // refreshMenuItems = true; - // break; - // } - //} - - if( refreshMenuItems ) - { - //UnityEngine.Debug.Log( "Refresh Menu Items" ); - refreshMenuItems = false; - templatesManager.CreateTemplateMenuItems(); - - AmplifyShaderEditorWindow currWindow = UIUtils.CurrentWindow; - - int windowCount = IOUtils.AllOpenedWindows.Count; - for( int windowIdx = 0; windowIdx < windowCount; windowIdx++ ) - { - UIUtils.CurrentWindow = IOUtils.AllOpenedWindows[ windowIdx ]; - IOUtils.AllOpenedWindows[ windowIdx ].CurrentGraph.ForceCategoryRefresh(); - } - UIUtils.CurrentWindow = currWindow; - } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatePostProcessor.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatePostProcessor.cs.meta deleted file mode 100644 index 3598b89a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatePostProcessor.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: d5f63490d6402e9488add7cbdfdd6872 -timeCreated: 1496739732 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderData.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderData.cs deleted file mode 100644 index 6f42c6f9..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderData.cs +++ /dev/null @@ -1,121 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> -using System; -using System.Collections.Generic; -using System.Text.RegularExpressions; - -namespace AmplifyShaderEditor -{ - [Serializable] - public class TemplatePassInfo - { - public string Modules; - public string Data; - public int GlobalStartIdx = -1; - public int LocalStartIdx = -1; - } - - [Serializable] - public class TemplateSubShaderInfo - { - public string Data; - public string Modules; - public int StartIdx = -1; - public List<TemplatePassInfo> Passes = new List<TemplatePassInfo>(); - public void Destroy() - { - Passes.Clear(); - Passes = null; - } - } - - [Serializable] - public class TemplateShaderInfo - { - public string Body; - public string Properties; - public int PropertyStartIdx = -1; - public List<TemplateSubShaderInfo> SubShaders = new List<TemplateSubShaderInfo>(); - public void Destroy() - { - int count = SubShaders.Count; - for( int i = 0; i < count; i++ ) - { - SubShaders[ i ].Destroy(); - } - SubShaders.Clear(); - SubShaders = null; - } - } - - public class TemplateShaderInfoUtil - { - public static TemplateShaderInfo CreateShaderData( string body ) - { - int nameBegin = body.IndexOf( TemplatesManager.TemplateShaderNameBeginTag ); - if( nameBegin < 0 ) - { - // Not a template - return null; - } - - TemplateShaderInfo shaderData = null; - //SHADER - MatchCollection shaderMatch = Regex.Matches( body, "\\bShader\\b" ); - if( shaderMatch.Count > 0 ) - { - //SUBSHADER - MatchCollection subShaderMatch = Regex.Matches( body, TemplatesManager.TemplateMPSubShaderTag ); - int subShaderAmount = subShaderMatch.Count; - if( subShaderAmount > 0 ) - { - shaderData = new TemplateShaderInfo(); - shaderData.Body = body; - int length = subShaderMatch[ 0 ].Index - shaderMatch[ 0 ].Groups[ 0 ].Index; - shaderData.Properties = body.Substring( shaderMatch[ 0 ].Index, length ); - shaderData.PropertyStartIdx = body.IndexOf( TemplatesManager.TemplatePropertyTag ); - - for( int subShaderIdx = 0; subShaderIdx < subShaderAmount; subShaderIdx++ ) - { - TemplateSubShaderInfo subShaderData = new TemplateSubShaderInfo(); - int subshaderBeginIndex = subShaderMatch[ subShaderIdx ].Index; - int subShaderEndIndex = ( subShaderIdx == ( subShaderAmount - 1 ) ) ? body.Length - 1 : subShaderMatch[ subShaderIdx + 1 ].Index; - subShaderData.Data = body.Substring( subshaderBeginIndex, subShaderEndIndex - subshaderBeginIndex ); - subShaderData.StartIdx = subshaderBeginIndex; - - //PASS - MatchCollection passMatch = Regex.Matches( subShaderData.Data, TemplatesManager.TemplatePassTagPattern ); - if( passMatch.Count == 0 ) - { - passMatch = Regex.Matches( subShaderData.Data, TemplatesManager.TemplateMPPassTag ); - } - - int passCount = passMatch.Count; - if( passCount > 0 ) - { - int lastPassIndex = subShaderData.Data.LastIndexOf( TemplatesManager.TemplatePassesEndTag ); - if( lastPassIndex < 0 ) - { - lastPassIndex = subShaderData.Data.Length - 1; - } - - subShaderData.Modules = subShaderData.Data.Substring( 0, passMatch[ 0 ].Index ); - for( int passIdx = 0; passIdx < passCount; passIdx++ ) - { - int passBeginIndex = passMatch[ passIdx ].Index; - int passEndIdx = ( passIdx == ( passCount - 1 ) ) ? lastPassIndex : passMatch[ passIdx + 1 ].Index; - TemplatePassInfo passData = new TemplatePassInfo(); - passData.Data = subShaderData.Data.Substring( passBeginIndex, passEndIdx - passBeginIndex ); - passData.GlobalStartIdx = subshaderBeginIndex + passBeginIndex; - passData.LocalStartIdx = passBeginIndex; - subShaderData.Passes.Add( passData ); - } - shaderData.SubShaders.Add( subShaderData ); - } - } - } - } - return shaderData; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderData.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderData.cs.meta deleted file mode 100644 index 8ae726ee..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderData.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 33fdd6a5fbc437a489acf58f5d82885c -timeCreated: 1516879445 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderModelModule.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderModelModule.cs deleted file mode 100644 index e1de14b2..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderModelModule.cs +++ /dev/null @@ -1,107 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using UnityEngine; -using UnityEditor; - -namespace AmplifyShaderEditor -{ - [Serializable] - public sealed class TemplateShaderModelModule : TemplateModuleParent - { - private const string ShaderModelStr = "Shader Model"; - private const string ShaderModelFormatStr = "#pragma target "; - private const string ShaderModelEncapsulateFormatStr = "CGINCLUDE\n#pragma target {0}\nENDCG"; - - [SerializeField] - private int m_shaderModelIdx = 2; - - [SerializeField] - private bool m_encapsulateOnCGInlude = false; - - public TemplateShaderModelModule() : base("Shader Model"){ } - - public override void Draw( UndoParentNode owner, bool style = true ) - { - EditorGUI.BeginChangeCheck(); - m_shaderModelIdx = owner.EditorGUILayoutPopup( ShaderModelStr, m_shaderModelIdx, TemplateHelperFunctions.AvailableShaderModels ); - if( EditorGUI.EndChangeCheck() ) - { - m_isDirty = true; - } - } - - public void CopyFrom( TemplateShaderModelModule other , bool allData ) - { - if( allData ) - { - m_independentModule = other.IndependentModule; - m_encapsulateOnCGInlude = other.EncapsulateOnCGInlude; - } - - m_shaderModelIdx = other.CurrentShaderModelIdx; - } - - public override void ReadFromString( ref uint index, ref string[] nodeParams ) - { - bool validDataOnMeta = m_validData; - if( UIUtils.CurrentShaderVersion() > TemplatesManager.MPShaderVersion ) - { - validDataOnMeta = Convert.ToBoolean( nodeParams[ index++ ] ); - } - - if( validDataOnMeta ) - m_shaderModelIdx = Convert.ToInt32( nodeParams[ index++ ] ); - } - - public override void WriteToString( ref string nodeInfo ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_validData ); - if( m_validData ) - IOUtils.AddFieldValueToString( ref nodeInfo, m_shaderModelIdx ); - } - - public override string GenerateShaderData( bool isSubShader ) - { - if( m_encapsulateOnCGInlude ) - { - return string.Format( ShaderModelEncapsulateFormatStr, TemplateHelperFunctions.AvailableShaderModels[ m_shaderModelIdx ] ); - } - else - { - return ShaderModelFormatStr + TemplateHelperFunctions.AvailableShaderModels[ m_shaderModelIdx ]; - } - } - - public void ConfigureFromTemplateData( TemplateShaderModelData data ) - { - bool newValidData = ( data.DataCheck == TemplateDataCheck.Valid ); - - if( newValidData && m_validData != newValidData ) - { - m_independentModule = data.IndependentModule; - - if( TemplateHelperFunctions.ShaderModelToArrayIdx.ContainsKey( data.Value ) ) - { - m_shaderModelIdx = TemplateHelperFunctions.ShaderModelToArrayIdx[ data.Value ]; - } - m_encapsulateOnCGInlude = data.Encapsulate; - } - - m_validData = newValidData; - } - - public int CurrentShaderModelIdx { get { return m_shaderModelIdx; } } - public string CurrentShaderModel { get { return TemplateHelperFunctions.AvailableShaderModels[ m_shaderModelIdx ]; } } - public bool EncapsulateOnCGInlude { get { return m_encapsulateOnCGInlude; } } - public int InterpolatorAmount - { - get - { - return TemplateHelperFunctions.AvailableInterpolators[ TemplateHelperFunctions.AvailableShaderModels[ m_shaderModelIdx ] ]; - } - } - - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderModelModule.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderModelModule.cs.meta deleted file mode 100644 index 9afc9c9f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderModelModule.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 33c15b597b8db18499c1b4a76035a552 -timeCreated: 1519899350 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderPropertyData.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderPropertyData.cs deleted file mode 100644 index 2b67f816..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderPropertyData.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - public class TemplateShaderPropertyData - { - public string PropertyInspectorName; - public string PropertyName; - public WirePortDataType PropertyDataType; - public PropertyType PropertyType; - - public int Index; - public string FullValue; - public string ReplacementValueHelper; - public string Identation; - - public TemplateShaderPropertyData( int index, string fullValue,string identation, string propertyInspectorName, string propertyName, WirePortDataType propertyDataType , PropertyType propertyType ) - { - Index = index; - FullValue = fullValue; - Identation = identation; - PropertyInspectorName = string.IsNullOrEmpty( propertyInspectorName )?propertyName: propertyInspectorName; - PropertyName = propertyName; - PropertyDataType = propertyDataType; - PropertyType = propertyType; - int idx = FullValue.LastIndexOf( "=" ); - ReplacementValueHelper = ( idx >= 0 ) ? FullValue.Substring( 0, idx + 1 ) +" ": FullValue + " = "; - } - - public string CreatePropertyForValue( string value ) - { - return value.Contains( PropertyName ) ? Identation + value : ReplacementValueHelper + value; - } - - public override string ToString() - { - return string.Format( "{0}(\"{1}\", {2})", PropertyName, PropertyInspectorName,UIUtils.WirePortToCgType( PropertyDataType ) ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderPropertyData.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderPropertyData.cs.meta deleted file mode 100644 index 411f0535..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderPropertyData.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 7d16f1d82f69ac945ac524dd877ce7fe -timeCreated: 1496341538 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderPropertyNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderPropertyNode.cs deleted file mode 100644 index 40266c37..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderPropertyNode.cs +++ /dev/null @@ -1,650 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using System.Collections.Generic; -using UnityEngine; -using UnityEditor; - -namespace AmplifyShaderEditor -{ - public enum ShaderPropertyScope - { - Shader, - SubShader, - Pass - } - - [Serializable] - [NodeAttributes( "Template Parameter", "Constants And Properties", "Select and use one of the pre-existing properties given by the template" )] - public sealed class TemplateShaderPropertyNode : TemplateNodeParent - { - private const string CurrentScopeStr = "Scope"; - private const string WarningStr = "Preview doesn't work with global variables"; - private const string PropertyLabelStr = "Parameter"; - private const string TypeLabelStr = "Type: "; - private const string PropertyNameStr = "Property Name: "; - - private int IntPropertyId; - private int FloatPropertyId; - private int VectorPropertyId; - private int Sampler2DPropertyId; - private int Sampler3DPropertyId; - private int SamplerCubePropertyId; - - [SerializeField] - private int m_currentPropertyIdx = -1; - - [SerializeField] - private string m_propertyName = string.Empty; - - [SerializeField] - private int m_propertyNameId = 0; - - [SerializeField] - private string m_typeName = string.Empty; - - [SerializeField] - private string m_propertyNameLabel = string.Empty; - - private bool m_fetchPropertyId = false; - private bool m_fetchScopeFromProperty = false; - - private List<TemplateShaderPropertyData> m_shaderProperties = null; - private string[] m_propertyLabels = null; - - private UpperLeftWidgetHelper m_upperLeftWidgetHelper = new UpperLeftWidgetHelper(); - - //Multi-Pass only properties - [SerializeField] - private ShaderPropertyScope m_currentScope = ShaderPropertyScope.Shader; - - protected override void CommonInit( int uniqueId ) - { - base.CommonInit( uniqueId ); - m_previewShaderGUID = "4feb2016be0ece148b8bf234508f6aa4"; - } - - void FetchScope() - { - int shaderScopeCount = m_templateMPData.AvailableShaderProperties.Count; - for( int i = 0; i < shaderScopeCount; i++ ) - { - if( m_templateMPData.AvailableShaderProperties[ i ].PropertyName.Equals( m_propertyName ) ) - { - m_currentScope = ShaderPropertyScope.Shader; - } - } - - int subShaderScopeCount = m_templateMPData.SubShaders[ SubShaderIdx ].AvailableShaderGlobals.Count; - for( int i = 0; i < subShaderScopeCount; i++ ) - { - if( m_templateMPData.SubShaders[ SubShaderIdx ].AvailableShaderGlobals[ i ].PropertyName.Equals( m_propertyName ) ) - { - m_currentScope = ShaderPropertyScope.SubShader; - } - } - - int passScopeCount = m_templateMPData.SubShaders[ SubShaderIdx ].Passes[ PassIdx ].AvailableShaderGlobals.Count; - for( int i = 0; i < passScopeCount; i++ ) - { - if( m_templateMPData.SubShaders[ SubShaderIdx ].Passes[ PassIdx ].AvailableShaderGlobals[ i ].PropertyName.Equals( m_propertyName ) ) - { - m_currentScope = ShaderPropertyScope.Pass; - } - } - } - - void FetchShaderProperties() - { - if( m_templateMPData == null ) - m_templateMPData = ( m_containerGraph.CurrentMasterNode as TemplateMultiPassMasterNode ).CurrentTemplate; - - if( m_templateMPData != null ) - { - switch( m_currentScope ) - { - case ShaderPropertyScope.Shader: - m_shaderProperties = m_templateMPData.AvailableShaderProperties; - break; - case ShaderPropertyScope.SubShader: - m_shaderProperties = m_templateMPData.SubShaders[ SubShaderIdx ].AvailableShaderGlobals; - break; - case ShaderPropertyScope.Pass: - m_shaderProperties = m_templateMPData.SubShaders[ SubShaderIdx ].Passes[ PassIdx ].AvailableShaderGlobals; - break; - } - } - } - - public override void OnEnable() - { - base.OnEnable(); - IntPropertyId = Shader.PropertyToID( "_IntData" ); - FloatPropertyId = Shader.PropertyToID( "_FloatData" ); - VectorPropertyId = Shader.PropertyToID( "_VectorData" ); - Sampler2DPropertyId = Shader.PropertyToID( "_Sampler2DData" ); - Sampler3DPropertyId = Shader.PropertyToID( "_Sampler3DData" ); - SamplerCubePropertyId = Shader.PropertyToID( "_SamplerCubeData" ); - } - - public override void DrawProperties() - { - base.DrawProperties(); - if( m_multiPassMode ) - { - DrawMultipassProperties(); - } - - if( m_currentPropertyIdx > -1 ) - { - - bool hasProperties = ( m_shaderProperties != null && m_shaderProperties.Count > 0 ); - if( hasProperties ) - { - EditorGUI.BeginChangeCheck(); - m_currentPropertyIdx = EditorGUILayoutPopup( PropertyLabelStr, m_currentPropertyIdx, m_propertyLabels ); - if( EditorGUI.EndChangeCheck() ) - { - UpdateFromId(); - } - EditorGUILayout.LabelField( m_typeName ); - if( m_shaderProperties[ m_currentPropertyIdx ].PropertyType != PropertyType.Global ) - { - EditorGUILayout.LabelField( m_propertyNameLabel ); - } - } - } - } - - void DrawMultipassProperties() - { - EditorGUI.BeginChangeCheck(); - m_currentScope = (ShaderPropertyScope)EditorGUILayoutEnumPopup( CurrentScopeStr, m_currentScope ); - if( EditorGUI.EndChangeCheck() ) - { - FetchShaderProperties(); - FetchPropertyId(); - } - - bool showSubShader = false; - bool showPass = false; - switch( m_currentScope ) - { - case ShaderPropertyScope.SubShader: - { - showSubShader = true; - } - break; - case ShaderPropertyScope.Pass: - { - showSubShader = true; - showPass = true; - } - break; - } - - if( showSubShader ) - { - DrawSubShaderUI(); - } - - if( showPass ) - { - DrawPassUI(); - } - } - - protected override void OnSubShaderChange() - { - FetchShaderProperties(); - FetchPropertyId(); - } - - protected override void OnPassChange() - { - FetchShaderProperties(); - FetchPropertyId(); - } - - override protected void CheckWarningState() - { - if( m_containerGraph.CurrentCanvasMode != NodeAvailability.TemplateShader ) - { - ShowTab( NodeMessageType.Error, ErrorMessageStr ); - } - else - { - if( m_shaderProperties != null && - m_shaderProperties.Count > 0 && - m_shaderProperties.Count > m_currentPropertyIdx && - m_shaderProperties[ m_currentPropertyIdx ].PropertyType == PropertyType.Global && - m_showPreview ) - { - ShowTab( NodeMessageType.Info, WarningStr ); - } - else - { - m_showErrorMessage = false; - } - } - } - - public override void SetPreviewInputs() - { - if( m_containerGraph.CurrentCanvasMode != NodeAvailability.TemplateShader ) - return; - - if( m_shaderProperties == null || m_currentPropertyIdx >= m_shaderProperties.Count ) - return; - - if( m_shaderProperties[ m_currentPropertyIdx ].PropertyType == PropertyType.Global ) - { - m_additionalContent.text = string.Empty; - PreviewMaterial.SetInt( IntPropertyId, 0 ); - return; - } - - Material currMat = m_containerGraph.CurrentMaterial; - if( currMat != null && currMat.HasProperty( m_propertyNameId ) ) - { - switch( m_shaderProperties[ m_currentPropertyIdx ].PropertyDataType ) - { - case WirePortDataType.INT: - { - int value = currMat.GetInt( m_propertyNameId ); - SetAdditonalTitleText( string.Format( Constants.SubTitleValueFormatStr, GenerateTitle( value ) ) ); - PreviewMaterial.SetInt( IntPropertyId, value ); - } - break; - case WirePortDataType.FLOAT: - { - float value = currMat.GetFloat( m_propertyNameId ); - SetAdditonalTitleText( string.Format( Constants.SubTitleValueFormatStr, GenerateTitle( value ) ) ); - PreviewMaterial.SetFloat( FloatPropertyId, value ); - } - break; - case WirePortDataType.FLOAT4: - { - Vector4 value = currMat.GetVector( m_propertyNameId ); - SetAdditonalTitleText( string.Format( Constants.SubTitleValueFormatStr, GenerateTitle( value.x, value.y, value.z, value.w ) ) ); - PreviewMaterial.SetVector( VectorPropertyId, value ); - } - break; - case WirePortDataType.COLOR: - { - Color value = currMat.GetColor( m_propertyNameId ); - SetAdditonalTitleText( string.Format( Constants.SubTitleValueFormatStr, GenerateTitle( value.r, value.g, value.b, value.a ) ) ); - PreviewMaterial.SetColor( VectorPropertyId, value ); - } - break; - case WirePortDataType.SAMPLER2D: - { - Texture value = currMat.GetTexture( m_propertyNameId ); - if( value ) - SetAdditonalTitleText( string.Format( Constants.SubTitleValueFormatStr, value.name ) ); - else - SetAdditonalTitleText( string.Empty ); - PreviewMaterial.SetTexture( Sampler2DPropertyId, value ); - } - break; - case WirePortDataType.SAMPLER3D: - { - Texture value = currMat.GetTexture( m_propertyNameId ); - if( value ) - SetAdditonalTitleText( string.Format( Constants.SubTitleValueFormatStr, value.name ) ); - else - SetAdditonalTitleText( string.Empty ); - PreviewMaterial.SetTexture( Sampler3DPropertyId, value ); - } - break; - case WirePortDataType.SAMPLERCUBE: - { - Texture value = currMat.GetTexture( m_propertyNameId ); - if( value ) - SetAdditonalTitleText( string.Format( Constants.SubTitleValueFormatStr, value.name ) ); - else - SetAdditonalTitleText( string.Empty ); - PreviewMaterial.SetTexture( SamplerCubePropertyId, value ); - } - break; - } - } - else - { - SetAdditonalTitleText( string.Empty ); - } - } - - public override void Draw( DrawInfo drawInfo ) - { - if( m_containerGraph.CurrentCanvasMode != NodeAvailability.TemplateShader ) - { - if( !m_showErrorMessage || m_errorMessageTypeIsError == NodeMessageType.Info ) - { - ShowTab( NodeMessageType.Error, ErrorMessageStr ); - } - } - else if( m_showErrorMessage ) - { - if( m_errorMessageTypeIsError == NodeMessageType.Error ) - HideTab(); - } - - base.Draw( drawInfo ); - if( m_containerGraph.CurrentCanvasMode != NodeAvailability.TemplateShader ) - return; - - if( m_shaderProperties == null ) - { - MasterNode masterNode = m_containerGraph.CurrentMasterNode; - if( masterNode.CurrentMasterNodeCategory == AvailableShaderTypes.Template ) - { - if( SetTemplate( masterNode ) ) - { - m_fetchPropertyId = true; - } - } - } - - if( m_fetchScopeFromProperty ) - { - m_fetchScopeFromProperty = false; - FetchScope(); - FetchShaderProperties(); - } - - if( m_fetchPropertyId ) - { - m_fetchPropertyId = false; - FetchPropertyId(); - } - - if( m_currentPropertyIdx > -1 ) - { - EditorGUI.BeginChangeCheck(); - m_currentPropertyIdx = m_upperLeftWidgetHelper.DrawWidget( this, m_currentPropertyIdx, m_propertyLabels ); - if( EditorGUI.EndChangeCheck() ) - { - UpdateFromId(); - } - } - } - - void FetchPropertyId() - { - if( m_shaderProperties != null ) - { - m_currentPropertyIdx = 0; - m_propertyLabels = new string[ m_shaderProperties.Count ]; - for( int i = 0; i < m_shaderProperties.Count; i++ ) - { - if( m_shaderProperties[ i ].PropertyName.Equals( m_propertyName ) ) - { - m_currentPropertyIdx = i; - } - m_propertyLabels[ i ] = m_shaderProperties[ i ].PropertyInspectorName; - } - UpdateFromId(); - } - else - { - m_currentPropertyIdx = -1; - } - } - - void UpdateFromId() - { - - if( m_shaderProperties != null ) - { - if( m_shaderProperties.Count == 0 ) - { - for( int i = 0; i < 4; i++ ) - m_containerGraph.DeleteConnection( false, UniqueId, i, false, true ); - - m_headerColor = UIUtils.GetColorFromCategory( "Default" ); - m_content.text = "None"; - m_additionalContent.text = string.Empty; - m_previewMaterialPassId = 1; - PreviewMaterial.SetFloat( FloatPropertyId, 0 ); - m_showPreview = false; - m_drawPreviewExpander = false; - m_outputPorts[ 0 ].ChangeProperties( "None", WirePortDataType.FLOAT, false ); - ConfigurePorts(); - return; - } - - m_drawPreviewExpander = true; - bool areCompatible = TemplateHelperFunctions.CheckIfCompatibles( m_outputPorts[ 0 ].DataType, m_shaderProperties[ m_currentPropertyIdx ].PropertyDataType ); - switch( m_shaderProperties[ m_currentPropertyIdx ].PropertyDataType ) - { - case WirePortDataType.SAMPLER1D: - case WirePortDataType.SAMPLER2D: - case WirePortDataType.SAMPLER3D: - case WirePortDataType.SAMPLERCUBE: - m_outputPorts[ 0 ].ChangeProperties( "Tex", m_shaderProperties[ m_currentPropertyIdx ].PropertyDataType, false ); - m_headerColor = UIUtils.GetColorFromCategory( "Textures" ); - break; - case WirePortDataType.INT: - case WirePortDataType.FLOAT: - m_outputPorts[ 0 ].ChangeProperties( Constants.EmptyPortValue, m_shaderProperties[ m_currentPropertyIdx ].PropertyDataType, false ); - m_headerColor = UIUtils.GetColorFromCategory( "Constants And Properties" ); - break; - case WirePortDataType.FLOAT4: - m_outputPorts[ 0 ].ChangeProperties( "XYZW", m_shaderProperties[ m_currentPropertyIdx ].PropertyDataType, false ); - m_headerColor = UIUtils.GetColorFromCategory( "Constants And Properties" ); - break; - case WirePortDataType.COLOR: - m_outputPorts[ 0 ].ChangeProperties( "RGBA", m_shaderProperties[ m_currentPropertyIdx ].PropertyDataType, false ); - m_headerColor = UIUtils.GetColorFromCategory( "Constants And Properties" ); - break; - default: - case WirePortDataType.OBJECT: - case WirePortDataType.FLOAT3x3: - case WirePortDataType.FLOAT4x4: - m_outputPorts[ 0 ].ChangeProperties( "Out", m_shaderProperties[ m_currentPropertyIdx ].PropertyDataType, false ); - m_headerColor = UIUtils.GetColorFromCategory( "Constants And Properties" ); - break; - } - - if( !areCompatible ) - { - for( int i = 0; i < 4; i++ ) - m_containerGraph.DeleteConnection( false, UniqueId, i, false, true ); - } - - ConfigurePorts(); - - m_propertyName = m_shaderProperties[ m_currentPropertyIdx ].PropertyName; - m_content.text = m_shaderProperties[ m_currentPropertyIdx ].PropertyInspectorName; - m_propertyNameId = Shader.PropertyToID( m_propertyName ); - m_typeName = TypeLabelStr + m_shaderProperties[ m_currentPropertyIdx ].PropertyType.ToString(); - if( m_shaderProperties[ m_currentPropertyIdx ].PropertyType != PropertyType.Global ) - { - m_propertyNameLabel = PropertyNameStr + m_shaderProperties[ m_currentPropertyIdx ].PropertyName; - } - - m_sizeIsDirty = true; - Material currMat = m_containerGraph.CurrentMaterial; - if( currMat != null ) - { - if( m_shaderProperties[ m_currentPropertyIdx ].PropertyType == PropertyType.Global ) - { - m_previewMaterialPassId = 0; - if( !m_showErrorMessage && m_showPreview ) - { - ShowTab( NodeMessageType.Info, WarningStr ); - } - } - else - { - if( m_showErrorMessage && m_errorMessageTypeIsError != NodeMessageType.Error ) - { - HideTab(); - } - switch( m_shaderProperties[ m_currentPropertyIdx ].PropertyDataType ) - { - case WirePortDataType.INT: m_previewMaterialPassId = 0; break; - case WirePortDataType.FLOAT: m_previewMaterialPassId = 1; break; - case WirePortDataType.FLOAT4: - case WirePortDataType.COLOR: m_previewMaterialPassId = 2; break; - case WirePortDataType.SAMPLER2D: m_previewMaterialPassId = 3; break; - case WirePortDataType.SAMPLER3D: m_previewMaterialPassId = 4; break; - case WirePortDataType.SAMPLERCUBE: m_previewMaterialPassId = 5; break; - default: PreviewMaterial.SetPass( 0 ); break; - } - } - } - - CheckWarningState(); - } - } - - string GenerateTitle( params float[] values ) - { - //string finalResult = "( "; - string finalResult = string.Empty; - if( values.Length == 1 ) - { - finalResult += values[ 0 ].ToString( Mathf.Abs( values[ 0 ] ) > 1000 ? Constants.PropertyBigFloatFormatLabel : Constants.PropertyFloatFormatLabel ); - } - else - { - for( int i = 0; i < values.Length; i++ ) - { - finalResult += values[ i ].ToString( Mathf.Abs( values[ i ] ) > 1000 ? Constants.PropertyBigVectorFormatLabel : Constants.PropertyVectorFormatLabel ); - if( i < ( values.Length - 1 ) ) - finalResult += ","; - } - } - //finalResult += " )"; - return finalResult; - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if( dataCollector.MasterNodeCategory != AvailableShaderTypes.Template ) - { - UIUtils.ShowMessage( UniqueId, "Template Parameter node is only intended for templates use only" ); - return m_outputPorts[ outputId ].ErrorValue; - } - - if( m_shaderProperties == null || m_shaderProperties.Count ==0 ) - { - UIUtils.ShowMessage( UniqueId, "Attempting to fetch inexistant parameter on " + m_nodeAttribs.Name +" node"); - return m_outputPorts[ outputId ].ErrorValue; - } - - if( m_multiPassMode ) - { - switch( m_currentScope ) - { - case ShaderPropertyScope.SubShader: - { - if( dataCollector.TemplateDataCollectorInstance.MultipassSubshaderIdx != SubShaderIdx ) - { - UIUtils.ShowMessage( UniqueId, string.Format( "{0} is only intended for subshader {1}", m_propertyLabels[ m_currentPropertyIdx ], SubShaderIdx ) ); - return m_outputPorts[ outputId ].ErrorValue; - } - } - break; - case ShaderPropertyScope.Pass: - { - if( dataCollector.TemplateDataCollectorInstance.MultipassSubshaderIdx != SubShaderIdx || - dataCollector.TemplateDataCollectorInstance.MultipassPassIdx != PassIdx - ) - { - UIUtils.ShowMessage( UniqueId, string.Format( "{0} is only intended for subshader {1} and pass {2}", m_propertyLabels[ m_currentPropertyIdx ], SubShaderIdx, PassIdx ) ); - return m_outputPorts[ outputId ].ErrorValue; - } - } - break; - } - } - - return GetOutputVectorItem( 0, outputId, m_propertyName ); - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - m_propertyName = GetCurrentParam( ref nodeParams ); - m_propertyNameId = Shader.PropertyToID( m_propertyName ); - if( UIUtils.CurrentShaderVersion() > TemplatesManager.MPShaderVersion ) - { - m_currentScope = (ShaderPropertyScope)Enum.Parse( typeof( ShaderPropertyScope ), GetCurrentParam( ref nodeParams ) ); - } - else - { - m_fetchScopeFromProperty = true; - } - m_fetchPropertyId = true; - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_propertyName ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_currentScope ); - } - - public override void OnMasterNodeReplaced( MasterNode newMasterNode ) - { - base.OnMasterNodeReplaced( newMasterNode ); - if( newMasterNode.CurrentMasterNodeCategory == AvailableShaderTypes.Template ) - { - SetTemplate( newMasterNode ); - if( m_fetchScopeFromProperty ) - { - m_fetchScopeFromProperty = false; - FetchScope(); - } - FetchShaderProperties(); - FetchPropertyId(); - //m_containerGraph.DeleteConnection( false, UniqueId, 0, false, true ); - } - } - - bool SetTemplate( MasterNode newMasterNode ) - { - if( m_containerGraph.MultiPassMasterNodes.NodesList.Count > 0 ) - { - m_multiPassMode = true; - TemplateMultiPassMasterNode templateMasterNode = ( newMasterNode as TemplateMultiPassMasterNode ); - if( templateMasterNode != null ) - { - m_templateMPData = templateMasterNode.CurrentTemplate; - UpdateSubShaderAmount(); - FetchShaderProperties(); - return true; - } - } - else - { - m_multiPassMode = false; - TemplateMasterNode templateMasterNode = ( newMasterNode as TemplateMasterNode ); - if( templateMasterNode != null ) - { - m_shaderProperties = templateMasterNode.CurrentTemplate.AvailableShaderProperties; - return true; - } - } - return false; - } - - public override void RefreshExternalReferences() - { - base.RefreshExternalReferences(); - CheckWarningState(); - } - - public override void Destroy() - { - base.Destroy(); - m_propertyLabels = null; - m_shaderProperties = null; - m_upperLeftWidgetHelper = null; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderPropertyNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderPropertyNode.cs.meta deleted file mode 100644 index 825090da..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateShaderPropertyNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 1579d32d6529f33418f210a5bd730436 -timeCreated: 1496398185 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateSubShader.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateSubShader.cs deleted file mode 100644 index 6dc3f834..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateSubShader.cs +++ /dev/null @@ -1,168 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using System.Collections.Generic; -using System.Text.RegularExpressions; -using UnityEngine; - -namespace AmplifyShaderEditor -{ - [Serializable] - public class TemplateSubShader - { - [SerializeField] - private int m_idx = -1; - - [SerializeField] - private List<TemplatePass> m_passes = new List<TemplatePass>(); - - [SerializeField] - private TemplateModulesData m_modules; - - [SerializeField] - private string m_uniquePrefix; - - [SerializeField] - private TemplatePropertyContainer m_templateProperties = new TemplatePropertyContainer(); - - [SerializeField] - private List<TemplateShaderPropertyData> m_availableShaderGlobals = new List<TemplateShaderPropertyData>(); - - [SerializeField] - private TemplateInfoContainer m_LODContainer = new TemplateInfoContainer(); - - [SerializeField] - private int m_passAmount = 0; - - [SerializeField] - private int m_mainPass = -1; - - [SerializeField] - private bool m_foundMainPassTag = false; - - [SerializeField] - TemplateOptionsContainer m_customOptionsContainer = new TemplateOptionsContainer(); - - public TemplateSubShader(TemplateMultiPass template, int subShaderIx, TemplateIdManager idManager, string uniquePrefix, TemplateSubShaderInfo subShaderInfo, ref Dictionary<string, TemplateShaderPropertyData> duplicatesHelper ) - { - m_idx = subShaderIx; - - m_uniquePrefix = uniquePrefix; - - FetchLOD( subShaderInfo.StartIdx, subShaderInfo.Modules ); - if( m_LODContainer.Index > -1 ) - { - idManager.RegisterId( m_LODContainer.Index, uniquePrefix + "Module" + m_LODContainer.Id, m_LODContainer.Id ); - } - - m_customOptionsContainer = TemplateOptionsToolsHelper.GenerateOptionsContainer( true, subShaderInfo.Data ); - if( m_customOptionsContainer.Enabled ) - { - idManager.RegisterId( m_customOptionsContainer.Index, uniquePrefix + m_customOptionsContainer.Body, m_customOptionsContainer.Body, true ); - } - - m_modules = new TemplateModulesData( m_customOptionsContainer, idManager, m_templateProperties, uniquePrefix + "Module", subShaderInfo.StartIdx, subShaderInfo.Modules, true ); - if( m_modules.SRPType == TemplateSRPType.HD ) - { - m_modules.SRPIsPBR = subShaderInfo.Data.Contains( TemplateHelperFunctions.HDPBRTag ); - } - - Dictionary<string, TemplateShaderPropertyData> ownDuplicatesDict = new Dictionary<string, TemplateShaderPropertyData>( duplicatesHelper ); - - TemplateHelperFunctions.CreateShaderGlobalsList( subShaderInfo.Modules, ref m_availableShaderGlobals, ref ownDuplicatesDict ); - - m_passAmount = subShaderInfo.Passes.Count; - - //if( !m_modules.PassTag.IsValid ) - //{ - // m_modules.PassTag.StartIdx = subShaderData.Passes[ 0 ].GlobalStartIdx; - // m_templateProperties.AddId( subShaderData.Data, m_modules.PassTag.Id, subShaderData.Passes[ 0 ].LocalStartIdx, m_modules.PassTag.SearchIndentation ); - // m_modules.PassTag.StartIdx -= m_templateProperties.PropertyDict[ m_modules.PassTag.Id ].Indentation.Length; - // m_templateProperties.PropertyDict[ m_modules.PassTag.Id ].UseIndentationAtStart = true; - // idManager.RegisterId( m_modules.PassTag.StartIdx, m_modules.UniquePrefix + m_modules.PassTag.Id, string.Empty ); - //} - - int firstVisible = -1; - int currAddedPassIdx = 0; - for( int passIdx = 0; passIdx < m_passAmount; passIdx++ ) - { - TemplatePass newPass = new TemplatePass( template, this,subShaderIx, passIdx, idManager, uniquePrefix + "Pass" + passIdx, subShaderInfo.Passes[ passIdx ].GlobalStartIdx, subShaderInfo.Passes[ passIdx ], ref ownDuplicatesDict ); - if( newPass.AddToList ) - { - if( newPass.IsMainPass && m_mainPass < 0 ) - { - m_mainPass = currAddedPassIdx; - m_foundMainPassTag = true; - } - else if(!newPass.IsInvisible && firstVisible < 0 ) - { - firstVisible = currAddedPassIdx; - } - - m_passes.Add( newPass ); - currAddedPassIdx++; - } - else - { - newPass.Destroy(); - newPass = null; - } - - } - - if( m_mainPass < 0 ) - { - // If no main pass was set then choose the first visible one - m_mainPass = ( firstVisible < 0 ) ? 0 : firstVisible; - m_passes[ m_mainPass ].IsMainPass = true; - } - - ownDuplicatesDict.Clear(); - ownDuplicatesDict = null; - } - - public void Destroy() - { - m_LODContainer = null; - - m_customOptionsContainer = null; - - m_templateProperties.Destroy(); - m_templateProperties = null; - - m_passes.Clear(); - m_passes = null; - - m_modules.Destroy(); - m_modules = null; - - m_availableShaderGlobals.Clear(); - m_availableShaderGlobals = null; - - } - - void FetchLOD( int offsetIdx, string body ) - { - Match match = Regex.Match( body, TemplateHelperFunctions.SubShaderLODPattern ); - if( match != null && match.Groups.Count > 1 ) - { - m_LODContainer.Id = match.Groups[ 0 ].Value; - m_LODContainer.Data = match.Groups[ 1 ].Value; - m_LODContainer.Index = offsetIdx + match.Index; - } - } - - public List<TemplatePass> Passes { get { return m_passes; } } - public TemplateModulesData Modules { get { return m_modules; } } - public string UniquePrefix { get { return m_uniquePrefix; } } - public TemplatePropertyContainer TemplateProperties { get { return m_templateProperties; } } - public List<TemplateShaderPropertyData> AvailableShaderGlobals { get { return m_availableShaderGlobals; } } - public TemplateInfoContainer LODContainer { get { return m_LODContainer; } } - public int PassAmount { get { return m_passAmount; } } - public bool FoundMainPass { get { return m_foundMainPassTag; } } - public int MainPass { get { return m_mainPass; } } - public int Idx { get { return m_idx; } } - public TemplateOptionsContainer CustomOptionsContainer { get { return m_customOptionsContainer; } } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateSubShader.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateSubShader.cs.meta deleted file mode 100644 index 41a78861..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateSubShader.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: f4ff24a5a4c92f745a159f247574c07a -timeCreated: 1517854017 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateTagsModule.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateTagsModule.cs deleted file mode 100644 index fcf38910..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateTagsModule.cs +++ /dev/null @@ -1,440 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; -using UnityEditor; - -namespace AmplifyShaderEditor -{ - [Serializable] - public class TemplateTagsModule : TemplateModuleParent - { - private const string CustomTagsStr = "Tags"; - private const string TagNameStr = "Name"; - private const string TagValueStr = "Value"; - private const string QueueIndexStr = "Index"; - private const string QueueLabelStr = "Queue"; - private const string RenderTypeLabelStr = "Type"; - private const string CustomRenderTypeLabelStr = "Custom"; - - private const float ShaderKeywordButtonLayoutWidth = 15; - private UndoParentNode m_currentOwner; - - private double m_tagNameCheckTimestamp = 0; - private bool m_tagNameCheckFlag = true; - private int m_tagNameCheckItemId = 0; - private const double TagNameCheckMaxInterval = 1.5; - - [SerializeField] - private List<CustomTagData> m_availableTags = new List<CustomTagData>(); - - private Dictionary<string, CustomTagData> m_availableTagsDict = new Dictionary<string, CustomTagData>(); - - public TemplateTagsModule() : base( "Tags" ) { } - - public void CopyFrom( TemplateTagsModule other ) - { - m_availableTags.Clear(); - m_availableTagsDict.Clear(); - - int count = other.AvailableTags.Count; - for( int i = 0; i < count; i++ ) - { - CustomTagData newData = new CustomTagData( other.AvailableTags[ i ] ); - m_availableTags.Add( newData ); - m_availableTagsDict.Add( newData.TagName, newData ); - } - } - - public void ConfigureFromTemplateData( TemplateTagsModuleData tagsData ) - { - bool newValidData = tagsData.DataCheck == TemplateDataCheck.Valid; - if( newValidData && newValidData != m_validData ) - { - m_availableTags.Clear(); - m_availableTagsDict.Clear(); - int count = tagsData.Tags.Count; - for( int i = 0; i < count; i++ ) - { - CustomTagData tagData = new CustomTagData( tagsData.Tags[ i ].Name, tagsData.Tags[ i ].Value, i ); - m_availableTags.Add( tagData ); - m_availableTagsDict.Add( tagsData.Tags[ i ].Name, tagData ); - } - } - m_validData = newValidData; - } - - public override void ShowUnreadableDataMessage( ParentNode owner ) - { - bool foldout = owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedCustomTags; - NodeUtils.DrawPropertyGroup( ref foldout, CustomTagsStr, base.ShowUnreadableDataMessage ); - owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedCustomTags = foldout; - } - - public void OnLogicUpdate() - { - if( m_tagNameCheckFlag && ( EditorApplication.timeSinceStartup - m_tagNameCheckTimestamp ) > TagNameCheckMaxInterval ) - { - m_tagNameCheckFlag = false; - if( m_tagNameCheckItemId < m_availableTags.Count ) - { - if( m_availableTags[ m_tagNameCheckItemId ].TagName.Equals( Constants.RenderQueueHelperStr ) ) - { - m_availableTags[ m_tagNameCheckItemId ].SpecialTag = TemplateSpecialTags.Queue; - } - else if( m_availableTags[ m_tagNameCheckItemId ].TagName.Equals( Constants.RenderTypeHelperStr ) ) - { - m_availableTags[ m_tagNameCheckItemId ].SpecialTag = TemplateSpecialTags.RenderType; - } - else - { - m_availableTags[ m_tagNameCheckItemId ].SpecialTag = TemplateSpecialTags.None; - } - } - } - } - - public override void Draw( UndoParentNode owner, bool style = true ) - { - m_currentOwner = owner; - bool foldout = owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedCustomTags; - if( style ) - { - NodeUtils.DrawPropertyGroup( ref foldout, CustomTagsStr, DrawMainBody, DrawButtons ); - } - else - { - NodeUtils.DrawNestedPropertyGroup( ref foldout, CustomTagsStr, DrawMainBody, DrawButtons ); - } - owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedCustomTags = foldout; - } - - void DrawButtons() - { - EditorGUILayout.Separator(); - - // Add tag - if( GUILayout.Button( string.Empty, UIUtils.PlusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) - { - m_availableTags.Add( new CustomTagData() ); - EditorGUI.FocusTextInControl( null ); - } - - //Remove tag - if( GUILayout.Button( string.Empty, UIUtils.MinusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) - { - if( m_availableTags.Count > 0 ) - { - m_availableTags.RemoveAt( m_availableTags.Count - 1 ); - EditorGUI.FocusTextInControl( null ); - } - } - } - - void DrawMainBody() - { - EditorGUI.BeginChangeCheck(); - { - EditorGUILayout.Separator(); - int itemCount = m_availableTags.Count; - - if( itemCount == 0 ) - { - EditorGUILayout.HelpBox( "Your list is Empty!\nUse the plus button to add one.", MessageType.Info ); - } - - int markedToDelete = -1; - float originalLabelWidth = EditorGUIUtility.labelWidth; - for( int i = 0; i < itemCount; i++ ) - { - m_availableTags[ i ].TagFoldout = m_currentOwner.EditorGUILayoutFoldout( m_availableTags[ i ].TagFoldout, string.Format( "[{0}] - {1}", i, m_availableTags[ i ].TagName ) ); - if( m_availableTags[ i ].TagFoldout ) - { - EditorGUI.indentLevel += 1; - EditorGUIUtility.labelWidth = 70; - //Tag Name - EditorGUI.BeginChangeCheck(); - m_availableTags[ i ].TagName = m_currentOwner.EditorGUILayoutTextField( TagNameStr, m_availableTags[ i ].TagName ); - if( EditorGUI.EndChangeCheck() ) - { - m_availableTags[ i ].TagName = UIUtils.RemoveShaderInvalidCharacters( m_availableTags[ i ].TagName ); - m_tagNameCheckFlag = true; - m_tagNameCheckItemId = i; - m_tagNameCheckTimestamp = EditorApplication.timeSinceStartup; - } - - //Tag Value - switch( m_availableTags[ i ].SpecialTag ) - { - case TemplateSpecialTags.RenderType: - { - m_availableTags[ i ].RenderType = (RenderType)m_currentOwner.EditorGUILayoutEnumPopup( RenderTypeLabelStr, m_availableTags[ i ].RenderType ); - if( m_availableTags[ i ].RenderType == RenderType.Custom ) - { - m_availableTags[ i ].TagValue = m_currentOwner.EditorGUILayoutTextField( CustomRenderTypeLabelStr, m_availableTags[ i ].TagValue ); - } - } - break; - case TemplateSpecialTags.Queue: - { - - EditorGUI.BeginChangeCheck(); - m_availableTags[ i ].RenderQueue = (RenderQueue)m_currentOwner.EditorGUILayoutEnumPopup( QueueLabelStr, m_availableTags[ i ].RenderQueue, GUILayout.MinWidth( 150 ) ); - m_availableTags[ i ].RenderQueueOffset = m_currentOwner.EditorGUILayoutIntField( QueueIndexStr, m_availableTags[ i ].RenderQueueOffset ); - if( EditorGUI.EndChangeCheck() ) - { - m_availableTags[ i ].BuildQueueTagValue(); - } - - } - break; - case TemplateSpecialTags.None: - { - EditorGUI.BeginChangeCheck(); - m_availableTags[ i ].TagValue = m_currentOwner.EditorGUILayoutTextField( TagValueStr, m_availableTags[ i ].TagValue ); - if( EditorGUI.EndChangeCheck() ) - { - m_availableTags[ i ].TagValue = UIUtils.RemoveShaderInvalidCharacters( m_availableTags[ i ].TagValue ); - } - } - break; - - } - - EditorGUIUtility.labelWidth = originalLabelWidth; - - EditorGUILayout.BeginHorizontal(); - { - GUILayout.Label( " " ); - // Add new port - if( m_currentOwner.GUILayoutButton( string.Empty, UIUtils.PlusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) - { - m_availableTags.Insert( i + 1, new CustomTagData() ); - EditorGUI.FocusTextInControl( null ); - } - - //Remove port - if( m_currentOwner.GUILayoutButton( string.Empty, UIUtils.MinusStyle, GUILayout.Width( ShaderKeywordButtonLayoutWidth ) ) ) - { - markedToDelete = i; - } - } - EditorGUILayout.EndHorizontal(); - - EditorGUI.indentLevel -= 1; - } - - } - if( markedToDelete > -1 ) - { - if( m_availableTags.Count > markedToDelete ) - { - m_availableTags.RemoveAt( markedToDelete ); - EditorGUI.FocusTextInControl( null ); - } - } - EditorGUILayout.Separator(); - } - if( EditorGUI.EndChangeCheck() ) - { - m_isDirty = true; - } - } - - //Method used by template options - // As such. Render Queue will have value and offset separated by , - public void AddSpecialTag( TemplateSpecialTags tag, TemplateActionItem item ) - { - if( tag == TemplateSpecialTags.None ) - return; - - int count = m_availableTags.Count; - for( int i = 0; i < count; i++ ) - { - if( m_availableTags[ i ].SpecialTag == tag ) - { - switch( tag ) - { - case TemplateSpecialTags.RenderType: - { - m_availableTags[ i ].RenderType = TemplateHelperFunctions.StringToRenderType[ item.ActionData ]; - return; - } - case TemplateSpecialTags.Queue: - { - - m_availableTags[ i ].RenderQueue = TemplateHelperFunctions.StringToRenderQueue[ item.ActionData ]; - m_availableTags[ i ].RenderQueueOffset = item.ActionDataIdx; - m_availableTags[ i ].BuildQueueTagValue(); - return; - } - } - } - } - - CustomTagData data = new CustomTagData(); - switch( tag ) - { - case TemplateSpecialTags.RenderType: - { - data.SpecialTag = TemplateSpecialTags.RenderType; - data.TagName = "RenderType"; - data.RenderType = TemplateHelperFunctions.StringToRenderType[ item.ActionData ]; - } - break; - case TemplateSpecialTags.Queue: - { - data.SpecialTag = TemplateSpecialTags.Queue; - data.TagName = "Queue"; - data.RenderQueue = TemplateHelperFunctions.StringToRenderQueue[ item.ActionData ]; - data.RenderQueueOffset = item.ActionDataIdx; - data.BuildQueueTagValue(); - } - break; - } - m_availableTags.Add( data ); - } - - void AddTagFromRead( string data ) - { - string[] arr = data.Split( IOUtils.VALUE_SEPARATOR ); - if( arr.Length > 1 ) - { - string name = arr[ 0 ]; - string value = arr[ 1 ]; - - if( !m_availableTagsDict.ContainsKey( name ) ) - { - CustomTagData tagData = new CustomTagData( data, m_availableTags.Count - 1 ); - m_availableTags.Add( tagData ); - m_availableTagsDict.Add( name, tagData ); - } - else - { - if( m_availableTagsDict[ name ].TagId > -1 && - m_availableTagsDict[ name ].TagId < m_availableTags.Count ) - { - if( arr.Length == 4 ) - { - m_availableTags[ m_availableTagsDict[ name ].TagId ].SetTagValue( value, arr[ 3 ] ); - } - else - { - m_availableTags[ m_availableTagsDict[ name ].TagId ].SetTagValue( value ); - } - - } - else - { - int count = m_availableTags.Count; - for( int i = 0; i < count; i++ ) - { - if( m_availableTags[ i ].TagName.Equals( name ) ) - { - m_availableTags[ i ].SetTagValue( value ); - } - } - } - } - } - } - - public override void ReadFromString( ref uint index, ref string[] nodeParams ) - { - bool validDataOnMeta = m_validData; - if( UIUtils.CurrentShaderVersion() > TemplatesManager.MPShaderVersion ) - { - validDataOnMeta = Convert.ToBoolean( nodeParams[ index++ ] ); - } - - if( validDataOnMeta ) - { - int count = Convert.ToInt32( nodeParams[ index++ ] ); - for( int i = 0; i < count; i++ ) - { - AddTagFromRead( nodeParams[ index++ ] ); - } - } - } - - public override void WriteToString( ref string nodeInfo ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_validData ); - if( m_validData ) - { - int tagsCount = m_availableTags.Count; - IOUtils.AddFieldValueToString( ref nodeInfo, tagsCount ); - for( int i = 0; i < tagsCount; i++ ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_availableTags[ i ].ToString() ); - } - } - } - - public string GenerateTags() - { - int tagsCount = m_availableTags.Count; - if( tagsCount == 0 ) - return string.Empty; - - string result = "Tags { "; - - for( int i = 0; i < tagsCount; i++ ) - { - if( m_availableTags[ i ].IsValid ) - { - result += m_availableTags[ i ].GenerateTag(); - if( i < tagsCount - 1 ) - { - result += " "; - } - } - } - - result += " }"; - - return result; - } - - public override void Destroy() - { - m_availableTags.Clear(); - m_availableTags = null; - m_currentOwner = null; - m_availableTagsDict.Clear(); - m_availableTagsDict = null; - } - - public List<CustomTagData> AvailableTags { get { return m_availableTags; } } - - public bool HasRenderInfo( ref RenderType renderType, ref RenderQueue renderQueue ) - { - if( !m_validData ) - return false; - - bool foundRenderType = false; - bool foundRenderQueue = false; - int count = m_availableTags.Count; - for( int i = 0; i < count; i++ ) - { - if( m_availableTags[ i ].TagName.Equals( Constants.RenderTypeHelperStr ) ) - { - if( TemplateHelperFunctions.StringToRenderType.ContainsKey( m_availableTags[ i ].TagValue ) ) - { - renderType = TemplateHelperFunctions.StringToRenderType[ m_availableTags[ i ].TagValue ]; - foundRenderType = true; - } - } - else if( m_availableTags[ i ].TagName.Equals( Constants.RenderQueueHelperStr ) ) - { - string value = m_availableTags[ i ].TagValue.Split( '+' )[ 0 ].Split( '-' )[ 0 ]; - if( TemplateHelperFunctions.StringToRenderQueue.ContainsKey( value ) ) - { - renderQueue = TemplateHelperFunctions.StringToRenderQueue[ value ]; - foundRenderQueue = true; - } - } - } - return foundRenderType && foundRenderQueue; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateTagsModule.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateTagsModule.cs.meta deleted file mode 100644 index b5888f75..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateTagsModule.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 905b4a4de4a974a489d7a8aac14e4fcb -timeCreated: 1516719540 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateVertexData.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateVertexData.cs deleted file mode 100644 index 3b82e046..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateVertexData.cs +++ /dev/null @@ -1,190 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using UnityEngine; - -namespace AmplifyShaderEditor -{ - [Serializable] - public class TemplateVertexData - { - [SerializeField] - private TemplateSemantics m_semantics = TemplateSemantics.NONE; - [SerializeField] - private WirePortDataType m_dataType = WirePortDataType.OBJECT; - [SerializeField] - private string m_varName = string.Empty; - [SerializeField] - private TemplateInfoOnSematics m_dataInfo = TemplateInfoOnSematics.NONE; - [SerializeField] - private string m_dataSwizzle = string.Empty; - [SerializeField] - private bool m_available = false; - [SerializeField] - private string m_varNameWithSwizzle = string.Empty; - [SerializeField] - private bool m_isSingleComponent = true; - [SerializeField] - private bool m_excludeStructPrefix = false; - [SerializeField] - private string[] m_components = { "0", "0", "0", "0" }; - [SerializeField] - private bool[] m_componentUsage = { false, false,false,false }; - - public TemplateVertexData( TemplateSemantics semantics, WirePortDataType dataType, string varName ) - { - m_semantics = semantics; - m_dataType = dataType; - m_varName = varName; - m_varNameWithSwizzle = varName; - } - - public TemplateVertexData( TemplateSemantics semantics, WirePortDataType dataType, string varName, string dataSwizzle ) - { - m_semantics = semantics; - m_dataType = dataType; - m_varName = varName; - m_dataSwizzle = dataSwizzle; - m_varNameWithSwizzle = varName + dataSwizzle; - } - - public TemplateVertexData( TemplateVertexData other ) - { - m_semantics = other.m_semantics; - m_dataType = other.m_dataType; - m_varName = other.m_varName; - m_dataInfo = other.m_dataInfo; - m_dataSwizzle = other.m_dataSwizzle; - m_available = other.m_available; - m_varNameWithSwizzle = other.m_varNameWithSwizzle; - m_isSingleComponent = other.IsSingleComponent; - m_excludeStructPrefix = other.ExcludeStructPrefix; - for( int i = 0; i < 4; i++ ) - { - m_components[ i ] = other.Components[ i ]; - } - } - - public void RegisterComponent( char channelId, string value ) - { - int channelIdInt = -1; - switch( channelId ) - { - case 'r': - case 'x': channelIdInt = 0; break; - case 'g': - case 'y': channelIdInt = 1; break; - case 'b': - case 'z': channelIdInt = 2; break; - case 'a': - case 'w': channelIdInt = 3; break; - } - - if( channelId < 0 ) - { - Debug.LogWarning( "Attempting to create interpolated data from invalid channel " + channelId ); - return; - } - - RegisterComponent( channelIdInt, value ); - } - - public void RegisterComponent( int channelId, string value ) - { - channelId = Mathf.Clamp( channelId, 0, 3 ); - m_components[ channelId ] = value; - m_componentUsage[ channelId ] = true; - m_isSingleComponent = false; - } - - public void BuildVar( PrecisionType precisionType = PrecisionType.Float ) - { - if( m_isSingleComponent ) - return; - WirePortDataType dataType = WirePortDataType.FLOAT; - if( m_componentUsage[ 3 ] ) - { - dataType = WirePortDataType.FLOAT4; - } - else if( m_componentUsage[ 2 ] ) - { - dataType = WirePortDataType.FLOAT3; - } - else if( m_componentUsage[ 1 ] ) - { - dataType = WirePortDataType.FLOAT2; - } - - string newVar = UIUtils.PrecisionWirePortToCgType( precisionType, dataType ); - newVar += "( "; - switch( dataType ) - { - default: newVar += "0"; break; - case WirePortDataType.INT: - case WirePortDataType.FLOAT: - { - newVar += "{0}."+Components[ 0 ]; - } - break; - case WirePortDataType.FLOAT2: - { - newVar += "{0}." + Components[ 0 ] + ", " + - "{0}." + Components[ 1 ]; - } - break; - case WirePortDataType.FLOAT3: - { - newVar += "{0}." + Components[ 0 ] + ", " + - "{0}." + Components[ 1 ] + ", " + - "{0}." + Components[ 2 ]; - } - break; - case WirePortDataType.FLOAT4: - case WirePortDataType.COLOR: - { - newVar += "{0}." + Components[ 0 ] + ", " + - "{0}." + Components[ 1 ] + ", " + - "{0}." + Components[ 2 ] + ", " + - "{0}." + Components[ 3 ]; - } - break; - - } - newVar += " )"; - m_varName = newVar; - m_varNameWithSwizzle = newVar; - } - - public bool ExcludeStructPrefix { get { return m_excludeStructPrefix; } set { m_excludeStructPrefix = value; } } - public bool IsSingleComponent { get { return m_isSingleComponent; } } - public string[] Components { get { return m_components; } } - public TemplateSemantics Semantics { get { return m_semantics; } } - public WirePortDataType DataType { get { return m_dataType; } } - public string VarName { get { return m_varName; } set { m_varName = value; m_varNameWithSwizzle = value + m_dataSwizzle; } } - public string DataSwizzle { get { return m_dataSwizzle; } set { m_dataSwizzle = value; m_varNameWithSwizzle = m_varName + value; } } - public TemplateInfoOnSematics DataInfo { get { return m_dataInfo; } set { m_dataInfo = value; } } - public bool Available { get { return m_available; } set { m_available = value; } } - public string VarNameWithSwizzle { get { return m_varNameWithSwizzle; } } - public WirePortDataType SwizzleType - { - get - { - if ( string.IsNullOrEmpty( m_dataSwizzle ) ) - return m_dataType; - - WirePortDataType newType = m_dataType; - switch ( m_dataSwizzle.Length ) - { - case 2: newType = WirePortDataType.FLOAT;break; - case 3: newType = WirePortDataType.FLOAT2; break; - case 4: newType = WirePortDataType.FLOAT3; break; - case 5: newType = WirePortDataType.FLOAT4; break; - } - - return newType; - } - } - - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateVertexData.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateVertexData.cs.meta deleted file mode 100644 index d4575340..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateVertexData.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: d11e7a9026804bd46962c527fe30d933 -timeCreated: 1496053368 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateVertexDataNode.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateVertexDataNode.cs deleted file mode 100644 index 65645cc3..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateVertexDataNode.cs +++ /dev/null @@ -1,272 +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.Collections.Generic; - -namespace AmplifyShaderEditor -{ - [Serializable] - [NodeAttributes( "Template Vertex Data", "Vertex Data", "Select and use available vertex data from the template" )] - public class TemplateVertexDataNode : TemplateNodeParent - { - private List<TemplateVertexData> m_interpolatorData = null; - - [SerializeField] - private int m_currentDataIdx = -1; - - [SerializeField] - private string m_dataName = string.Empty; - [SerializeField] - private string m_inVarName = string.Empty; - - private string[] m_dataLabels = null; - - private bool m_fetchDataId = false; - private UpperLeftWidgetHelper m_upperLeftWidgetHelper = new UpperLeftWidgetHelper(); - - void FetchDataId() - { - if( m_interpolatorData != null ) - { - m_currentDataIdx = 0; - int count = m_interpolatorData.Count; - m_dataLabels = new string[ count ]; - for( int i = 0; i < count; i++ ) - { - m_dataLabels[ i ] = m_interpolatorData[ i ].VarName; - if( m_interpolatorData[ i ].VarName.Equals( m_dataName ) ) - { - m_currentDataIdx = i; - } - } - UpdateFromId(); - } - else - { - m_currentDataIdx = -1; - } - } - - void UpdateFromId() - { - if( m_interpolatorData != null ) - { - if( m_interpolatorData.Count == 0 ) - { - for( int i = 0; i < 4; i++ ) - m_containerGraph.DeleteConnection( false, UniqueId, i, false, true ); - - m_headerColor = UIUtils.GetColorFromCategory( "Default" ); - m_content.text = "None"; - m_additionalContent.text = string.Empty; - m_outputPorts[ 0 ].ChangeProperties( "None", WirePortDataType.OBJECT, false ); - ConfigurePorts(); - return; - } - - bool areCompatible = TemplateHelperFunctions.CheckIfCompatibles( m_outputPorts[ 0 ].DataType, m_interpolatorData[ m_currentDataIdx ].DataType ); - switch( m_interpolatorData[ m_currentDataIdx ].DataType ) - { - default: - case WirePortDataType.INT: - case WirePortDataType.FLOAT: - m_outputPorts[ 0 ].ChangeProperties( Constants.EmptyPortValue, m_interpolatorData[ m_currentDataIdx ].DataType, false ); - break; - case WirePortDataType.FLOAT2: - m_outputPorts[ 0 ].ChangeProperties( "XY", m_interpolatorData[ m_currentDataIdx ].DataType, false ); - break; - case WirePortDataType.FLOAT3: - m_outputPorts[ 0 ].ChangeProperties( "XYZ", m_interpolatorData[ m_currentDataIdx ].DataType, false ); - break; - case WirePortDataType.FLOAT4: - m_outputPorts[ 0 ].ChangeProperties( "XYZW", m_interpolatorData[ m_currentDataIdx ].DataType, false ); - break; - case WirePortDataType.COLOR: - m_outputPorts[ 0 ].ChangeProperties( "RGBA", m_interpolatorData[ m_currentDataIdx ].DataType, false ); - break; - } - - ConfigurePorts(); - - if( !areCompatible ) - { - m_containerGraph.DeleteConnection( false, UniqueId, 0, false, true ); - } - - m_dataName = m_interpolatorData[ m_currentDataIdx ].VarName; - m_content.text = m_dataName; - m_sizeIsDirty = true; - CheckWarningState(); - } - } - - public override void DrawProperties() - { - base.DrawProperties(); - if( m_multiPassMode ) - { - DrawMultipassProperties(); - } - - if( m_currentDataIdx > -1 ) - { - EditorGUI.BeginChangeCheck(); - m_currentDataIdx = EditorGUILayoutPopup( DataLabelStr, m_currentDataIdx, m_dataLabels ); - if( EditorGUI.EndChangeCheck() ) - { - UpdateFromId(); - } - } - } - protected override void OnSubShaderChange() - { - FetchInterpolator(); - FetchDataId(); - } - - protected override void OnPassChange() - { - FetchInterpolator(); - FetchDataId(); - } - - void DrawMultipassProperties() - { - DrawSubShaderUI(); - DrawPassUI(); - } - - public override void Draw( DrawInfo drawInfo ) - { - base.Draw( drawInfo ); - if( m_containerGraph.CurrentCanvasMode != NodeAvailability.TemplateShader ) - return; - - if( m_interpolatorData == null || m_interpolatorData.Count == 0 ) - { - MasterNode masterNode = m_containerGraph.CurrentMasterNode; - FetchInterpolator( masterNode ); - } - - if( m_fetchDataId ) - { - m_fetchDataId = false; - FetchDataId(); - } - - if( m_currentDataIdx > -1 ) - { - EditorGUI.BeginChangeCheck(); - m_currentDataIdx = m_upperLeftWidgetHelper.DrawWidget( this, m_currentDataIdx, m_dataLabels ); - if( EditorGUI.EndChangeCheck() ) - { - UpdateFromId(); - } - } - } - - public override string GenerateShaderForOutput( int outputId, ref MasterNodeDataCollector dataCollector, bool ignoreLocalvar ) - { - if( dataCollector.MasterNodeCategory != AvailableShaderTypes.Template ) - { - UIUtils.ShowMessage( UniqueId, "Template Vertex Data node is only intended for templates use only" ); - return m_outputPorts[ 0 ].ErrorValue; - } - - if( dataCollector.IsFragmentCategory ) - { - UIUtils.ShowMessage( UniqueId, "Template Vertex Data node node is only intended for vertex use use only" ); - return m_outputPorts[ 0 ].ErrorValue; - } - - if( m_multiPassMode ) - { - if( dataCollector.TemplateDataCollectorInstance.MultipassSubshaderIdx != SubShaderIdx || - dataCollector.TemplateDataCollectorInstance.MultipassPassIdx != PassIdx - ) - { - UIUtils.ShowMessage( UniqueId, string.Format( "{0} is only intended for subshader {1} and pass {2}", m_dataLabels[ m_currentDataIdx ], SubShaderIdx, PassIdx ) ); - return m_outputPorts[ outputId ].ErrorValue; - } - } - - return GetOutputVectorItem( 0, outputId, m_inVarName + m_dataName ); - } - - public override void ReadFromString( ref string[] nodeParams ) - { - base.ReadFromString( ref nodeParams ); - m_dataName = GetCurrentParam( ref nodeParams ); - m_fetchDataId = true; - } - - public override void WriteToString( ref string nodeInfo, ref string connectionsInfo ) - { - base.WriteToString( ref nodeInfo, ref connectionsInfo ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_dataName ); - } - - protected override bool ValidatePass( int passIdx ) - { - return ( m_templateMPData.SubShaders[ SubShaderIdx ].Passes[ passIdx ].VertexFunctionData != null && - m_templateMPData.SubShaders[ SubShaderIdx ].Passes[ passIdx ].VertexDataContainer != null ); - } - - void FetchInterpolator( MasterNode masterNode = null ) - { - FetchMultiPassTemplate( masterNode ); - if( m_multiPassMode ) - { - if( m_templateMPData != null ) - { - m_inVarName = m_templateMPData.SubShaders[ SubShaderIdx ].Passes[ PassIdx ].VertexFunctionData.InVarName + "."; - m_interpolatorData = m_templateMPData.SubShaders[ SubShaderIdx ].Passes[ PassIdx ].VertexDataContainer.VertexData; - m_fetchDataId = true; - } - } - else - { - if( masterNode == null ) - masterNode = m_containerGraph.CurrentMasterNode; - - TemplateData currentTemplate = ( masterNode as TemplateMasterNode ).CurrentTemplate; - if( currentTemplate != null ) - { - m_inVarName = currentTemplate.VertexFunctionData.InVarName + "."; - m_interpolatorData = currentTemplate.VertexDataList; - m_fetchDataId = true; - } - else - { - m_interpolatorData = null; - m_currentDataIdx = -1; - } - } - } - - public override void OnMasterNodeReplaced( MasterNode newMasterNode ) - { - base.OnMasterNodeReplaced( newMasterNode ); - if( newMasterNode.CurrentMasterNodeCategory == AvailableShaderTypes.Template ) - { - FetchInterpolator( newMasterNode ); - } - else - { - m_interpolatorData = null; - m_currentDataIdx = -1; - } - } - - public override void Destroy() - { - base.Destroy(); - m_dataLabels = null; - m_interpolatorData = null; - m_upperLeftWidgetHelper = null; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateVertexDataNode.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateVertexDataNode.cs.meta deleted file mode 100644 index e697d689..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplateVertexDataNode.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 5eb32f2452052fb43b6b93c9baa8f02f -timeCreated: 1506610215 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatesBlendModule.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatesBlendModule.cs deleted file mode 100644 index 93af8a36..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatesBlendModule.cs +++ /dev/null @@ -1,782 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using UnityEngine; -using UnityEditor; -using System.Collections.Generic; - -namespace AmplifyShaderEditor -{ - [Serializable] - public sealed class TemplatesBlendModule : TemplateModuleParent - { - private const string AlphaToMaskStr = "Alpha To Coverage"; - private const string BlendModeStr = " Blend Mode"; - - private const string BlendModesRGBStr = "Blend RGB"; - private const string BlendModesAlphaStr = "Blend Alpha"; - - private const string BlendOpsRGBStr = "Blend Op RGB"; - private const string BlendOpsAlphaStr = "Blend Op Alpha"; - - private const string SourceFactorStr = "Src"; - private const string DstFactorStr = "Dst"; - - private const string AlphaToMaskFormat = "AlphaToMask {0}"; - private const string BlendFactorOff = "Blend Off"; - private const string SingleBlendFactorStr = "Blend {0} {1}"; - private const string SeparateBlendFactorStr = "Blend {0} {1} , {2} {3}"; - - private const string SingleBlendOpStr = "BlendOp {0}"; - private const string SeparateBlendOpStr = "BlendOp {0} , {1}"; - private const string BlendOpOffStr = "BlendOp Off"; - - - private string[] m_commonBlendTypesArr; - private List<CommonBlendTypes> m_commonBlendTypes = new List<CommonBlendTypes> - { - new CommonBlendTypes("<OFF>", AvailableBlendFactor.Zero, AvailableBlendFactor.Zero ), - new CommonBlendTypes("Custom", AvailableBlendFactor.Zero, AvailableBlendFactor.Zero ) , - new CommonBlendTypes("Alpha Blend", AvailableBlendFactor.SrcAlpha, AvailableBlendFactor.OneMinusSrcAlpha ) , - new CommonBlendTypes("Premultiplied", AvailableBlendFactor.One, AvailableBlendFactor.OneMinusSrcAlpha ), - new CommonBlendTypes("Additive", AvailableBlendFactor.One, AvailableBlendFactor.One ), - new CommonBlendTypes("Soft Additive", AvailableBlendFactor.OneMinusDstColor, AvailableBlendFactor.One ), - new CommonBlendTypes("Multiplicative", AvailableBlendFactor.DstColor, AvailableBlendFactor.Zero ), - new CommonBlendTypes("2x Multiplicative", AvailableBlendFactor.DstColor, AvailableBlendFactor.SrcColor ), - new CommonBlendTypes("Particle Additive", AvailableBlendFactor.SrcAlpha, AvailableBlendFactor.One ) - }; - - [SerializeField] - private bool m_validBlendMode = false; - - [SerializeField] - private bool m_validBlendOp = false; - - [SerializeField] - private bool m_blendModeEnabled = false; - - [SerializeField] - private bool m_validAlphaToMask = false; - - [SerializeField] - private bool m_alphaToMaskValue = false; - - [SerializeField] - private bool m_alphaToMaskIndependent = false; - - // Blend Factor - // RGB - [SerializeField] - private int m_currentRGBIndex = 0; - - [SerializeField] - private AvailableBlendFactor m_sourceFactorRGB = AvailableBlendFactor.Zero; - [SerializeField] - private InlineProperty m_sourceFactorRGBInline = new InlineProperty(); - - [SerializeField] - private AvailableBlendFactor m_destFactorRGB = AvailableBlendFactor.Zero; - [SerializeField] - private InlineProperty m_destFactorRGBInline = new InlineProperty(); - - //Alpha - [SerializeField] - private int m_currentAlphaIndex = 0; - - [SerializeField] - private AvailableBlendFactor m_sourceFactorAlpha = AvailableBlendFactor.Zero; - [SerializeField] - private InlineProperty m_sourceFactorAlphaInline = new InlineProperty(); - - [SerializeField] - private AvailableBlendFactor m_destFactorAlpha = AvailableBlendFactor.Zero; - [SerializeField] - private InlineProperty m_destFactorAlphaInline = new InlineProperty(); - - //Blend Ops - [SerializeField] - private bool m_blendOpEnabled = false; - - [SerializeField] - private AvailableBlendOps m_blendOpRGB = AvailableBlendOps.OFF; - - [SerializeField] - private InlineProperty m_blendOpRGBInline = new InlineProperty(); - - [SerializeField] - private AvailableBlendOps m_blendOpAlpha = AvailableBlendOps.OFF; - - [SerializeField] - private InlineProperty m_blendOpAlphaInline = new InlineProperty(); - - public TemplatesBlendModule() : base( "Blend Mode and Ops" ) - { - m_commonBlendTypesArr = new string[ m_commonBlendTypes.Count ]; - for( int i = 0; i < m_commonBlendTypesArr.Length; i++ ) - { - m_commonBlendTypesArr[ i ] = m_commonBlendTypes[ i ].Name; - } - } - - public void CopyFrom( TemplatesBlendModule other, bool allData ) - { - if( allData ) - { - m_independentModule = other.IndependentModule; - m_alphaToMaskIndependent = other.AlphaToMaskIndependent; - m_validBlendMode = other.ValidBlendMode; - m_validBlendOp = other.ValidBlendOp; - m_validAlphaToMask = other.ValidAlphaToMask; - } - m_alphaToMaskValue = other.AlphaToMaskValue; - m_blendModeEnabled = other.BlendModeEnabled; - m_currentRGBIndex = other.CurrentRGBIndex; - m_sourceFactorRGB = other.SourceFactorRGB; - m_destFactorRGB = other.DestFactorRGB; - m_currentAlphaIndex = other.CurrentAlphaIndex; - m_sourceFactorAlpha = other.SourceFactorAlpha; - m_destFactorAlpha = other.DestFactorAlpha; - m_blendOpEnabled = other.BlendOpEnabled; - m_blendOpRGB = other.BlendOpRGB; - m_blendOpAlpha = other.BlendOpAlpha; - m_sourceFactorRGBInline = other.SourceFactorRGBInline; - m_destFactorRGBInline = other.DestFactorRGBInline; - m_sourceFactorAlphaInline = other.SourceFactorAlphaInline; - m_destFactorAlphaInline = other.DestFactorAlphaInline; - m_blendOpRGBInline = other.BlendOpRGBInline; - m_blendOpAlphaInline = other.BlendOpAlphaInline; - } - - public void ConfigureFromTemplateData( TemplateBlendData blendData ) - { - if( blendData.ValidAlphaToMask ) - { - if( m_validAlphaToMask != blendData.ValidAlphaToMask ) - { - m_alphaToMaskValue = blendData.AlphaToMaskValue; - m_validAlphaToMask = blendData.ValidAlphaToMask; - m_alphaToMaskIndependent = blendData.IndependentAlphaToMask; - } - } - - if( blendData.ValidBlendMode ) - { - if( m_validBlendMode != blendData.ValidBlendMode ) - { - m_blendModeEnabled = true; - m_independentModule = blendData.IndependentModule; - if( string.IsNullOrEmpty( blendData.SourceFactorRGBInline ) ) - { - m_sourceFactorRGB = blendData.SourceFactorRGB; - m_sourceFactorRGBInline.ResetProperty(); - } - else - { - m_sourceFactorRGBInline.SetInlineByName( blendData.SourceFactorRGBInline ); - } - - if( string.IsNullOrEmpty( blendData.DestFactorRGBInline ) ) - { - m_destFactorRGB = blendData.DestFactorRGB; - m_destFactorRGBInline.ResetProperty(); - } - else - { - m_destFactorRGBInline.SetInlineByName( blendData.DestFactorRGBInline ); - } - - if( string.IsNullOrEmpty( blendData.SourceFactorAlphaInline ) ) - { - m_sourceFactorAlpha = blendData.SourceFactorAlpha; - m_sourceFactorAlphaInline.ResetProperty(); - } - else - { - m_sourceFactorAlphaInline.SetInlineByName( blendData.SourceFactorAlphaInline ); - } - if( string.IsNullOrEmpty( blendData.DestFactorAlphaInline ) ) - { - m_destFactorAlpha = blendData.DestFactorAlpha; - m_destFactorAlphaInline.ResetProperty(); - } - else - { - m_destFactorAlphaInline.SetInlineByName( blendData.DestFactorAlphaInline ); - } - - if( blendData.SeparateBlendFactors ) - { - if( blendData.BlendModeOff ) - { - m_currentRGBIndex = 0; - } - else - { - CheckRGBIndex(); - } - CheckAlphaIndex(); - } - else - { - if( blendData.BlendModeOff ) - { - m_currentRGBIndex = 0; - } - else - { - CheckRGBIndex(); - } - m_currentAlphaIndex = 0; - } - } - } - else - { - m_blendModeEnabled = false; - } - - if( blendData.ValidBlendOp ) - { - if( m_validBlendOp != blendData.ValidBlendOp ) - { - m_blendOpEnabled = true; - if( string.IsNullOrEmpty( blendData.BlendOpRGBInline ) ) - { - m_blendOpRGB = blendData.BlendOpRGB; - m_blendOpRGBInline.ResetProperty(); - } - else - { - m_blendOpRGBInline.SetInlineByName( blendData.BlendOpRGBInline ); - } - - if( string.IsNullOrEmpty( blendData.BlendOpAlphaInline ) ) - { - m_blendOpAlpha = blendData.BlendOpAlpha; - m_blendOpAlphaInline.ResetProperty(); - } - else - { - m_blendOpAlphaInline.SetInlineByName( blendData.BlendOpAlphaInline ); - } - } - } - else - { - m_blendOpEnabled = false; - } - - m_validBlendMode = blendData.ValidBlendMode; - m_validBlendOp = blendData.ValidBlendOp; - m_validData = m_validBlendMode || m_validBlendOp; - } - - public override void ShowUnreadableDataMessage( ParentNode owner ) - { - bool foldout = owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedBlendModeModule; - NodeUtils.DrawPropertyGroup( ref foldout, BlendModeStr, base.ShowUnreadableDataMessage ); - owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedBlendModeModule = foldout; - } - - public override void Draw( UndoParentNode owner, bool style = true ) - { - bool foldout = owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedBlendModeModule; - if( style ) - { - NodeUtils.DrawPropertyGroup( ref foldout, BlendModeStr, () => - { - DrawBlock( owner, style ); - } ); - } - else - { - NodeUtils.DrawNestedPropertyGroup( ref foldout, BlendModeStr, () => - { - DrawBlock( owner, style ); - } ); - } - owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedBlendModeModule = foldout; - } - - void DrawBlock( UndoParentNode owner, bool style ) - { - EditorGUI.BeginChangeCheck(); - { - if( m_blendModeEnabled ) - { - // RGB - EditorGUI.BeginChangeCheck(); - m_currentRGBIndex = owner.EditorGUILayoutPopup( BlendModesRGBStr, m_currentRGBIndex, m_commonBlendTypesArr ); - if( EditorGUI.EndChangeCheck() ) - { - if( m_currentRGBIndex > 1 ) - { - m_sourceFactorRGB = m_commonBlendTypes[ m_currentRGBIndex ].SourceFactor; - m_sourceFactorRGBInline.IntValue = (int)m_sourceFactorRGB; - m_sourceFactorRGBInline.SetInlineNodeValue(); - - m_destFactorRGB = m_commonBlendTypes[ m_currentRGBIndex ].DestFactor; - m_destFactorRGBInline.IntValue = (int)m_destFactorRGB; - m_destFactorRGBInline.SetInlineNodeValue(); - } - } - EditorGUI.BeginDisabledGroup( m_currentRGBIndex == 0 ); - - EditorGUI.BeginChangeCheck(); - float cached = EditorGUIUtility.labelWidth; - if( style ) - { - EditorGUIUtility.labelWidth = 40; - } - else - { - EditorGUIUtility.labelWidth = 25; - } - - EditorGUILayout.BeginHorizontal(); - //m_sourceFactorRGB = (AvailableBlendFactor)owner.EditorGUILayoutEnumPopup( SourceFactorStr, m_sourceFactorRGB ); - m_sourceFactorRGBInline.CustomDrawer( ref owner, ( x ) => { m_sourceFactorRGB = (AvailableBlendFactor)x.EditorGUILayoutEnumPopup( SourceFactorStr, m_sourceFactorRGB ); }, SourceFactorStr ); - if( style ) - { - EditorGUI.indentLevel--; - EditorGUIUtility.labelWidth = 25; - } - //m_destFactorRGB = (AvailableBlendFactor)owner.EditorGUILayoutEnumPopup( DstFactorStr, m_destFactorRGB ); - m_destFactorRGBInline.CustomDrawer( ref owner, ( x ) => { m_destFactorRGB = (AvailableBlendFactor)x.EditorGUILayoutEnumPopup( DstFactorStr, m_destFactorRGB ); }, DstFactorStr ); - if( style ) - EditorGUI.indentLevel++; - - EditorGUILayout.EndHorizontal(); - - EditorGUIUtility.labelWidth = cached; - if( EditorGUI.EndChangeCheck() ) - { - CheckRGBIndex(); - } - - EditorGUI.EndDisabledGroup(); - // Alpha - EditorGUILayout.Separator(); - - EditorGUI.BeginChangeCheck(); - m_currentAlphaIndex = owner.EditorGUILayoutPopup( BlendModesAlphaStr, m_currentAlphaIndex, m_commonBlendTypesArr ); - if( EditorGUI.EndChangeCheck() ) - { - if( m_currentAlphaIndex > 0 ) - { - m_sourceFactorAlpha = m_commonBlendTypes[ m_currentAlphaIndex ].SourceFactor; - m_sourceFactorAlphaInline.IntValue = (int)m_sourceFactorAlpha; - m_sourceFactorAlphaInline.SetInlineNodeValue(); - - m_destFactorAlpha = m_commonBlendTypes[ m_currentAlphaIndex ].DestFactor; - m_destFactorAlphaInline.IntValue = (int)m_destFactorAlpha; - m_destFactorAlphaInline.SetInlineNodeValue(); - } - } - EditorGUI.BeginDisabledGroup( m_currentAlphaIndex == 0 ); - - EditorGUI.BeginChangeCheck(); - cached = EditorGUIUtility.labelWidth; - if( style ) - { - EditorGUIUtility.labelWidth = 40; - } - else - { - EditorGUIUtility.labelWidth = 25; - } - EditorGUILayout.BeginHorizontal(); - //m_sourceFactorAlpha = (AvailableBlendFactor)owner.EditorGUILayoutEnumPopup( SourceFactorStr, m_sourceFactorAlpha ); - m_sourceFactorAlphaInline.CustomDrawer( ref owner, ( x ) => { m_sourceFactorAlpha = (AvailableBlendFactor)x.EditorGUILayoutEnumPopup( SourceFactorStr, m_sourceFactorAlpha ); }, SourceFactorStr ); - if( style ) - { - EditorGUI.indentLevel--; - EditorGUIUtility.labelWidth = 25; - } - //m_destFactorAlpha = (AvailableBlendFactor)owner.EditorGUILayoutEnumPopup( DstFactorStr, m_destFactorAlpha ); - m_destFactorAlphaInline.CustomDrawer( ref owner, ( x ) => { m_destFactorAlpha = (AvailableBlendFactor)x.EditorGUILayoutEnumPopup( DstFactorStr, m_destFactorAlpha ); }, DstFactorStr ); - if( style ) - EditorGUI.indentLevel++; - EditorGUILayout.EndHorizontal(); - EditorGUIUtility.labelWidth = cached; - - if( EditorGUI.EndChangeCheck() ) - { - CheckAlphaIndex(); - } - - EditorGUI.EndDisabledGroup(); - EditorGUILayout.Separator(); - } - - if( m_blendOpEnabled ) - { - // Both these tests should be removed on a later stage - // ASE v154dev004 changed AvailableBlendOps.OFF value from -1 to 0 - // If importing the new package into an already opened ASE window makes - // hotcode to preserve the -1 value on these variables - if( (int)m_blendOpRGB == -1 ) - m_blendOpRGB = AvailableBlendOps.OFF; - - if( (int)m_blendOpAlpha == -1 ) - m_blendOpAlpha = AvailableBlendOps.OFF; - - //m_blendOpRGB = (AvailableBlendOps)owner.EditorGUILayoutEnumPopup( BlendOpsRGBStr, m_blendOpRGB ); - m_blendOpRGBInline.CustomDrawer( ref owner, ( x ) => { m_blendOpRGB = (AvailableBlendOps)x.EditorGUILayoutPopup( BlendOpsRGBStr, (int)m_blendOpRGB, BlendOpsHelper.BlendOpsLabels ); }, BlendOpsRGBStr ); - EditorGUILayout.Separator(); - //m_blendOpAlpha = (AvailableBlendOps)owner.EditorGUILayoutEnumPopup( BlendOpsAlphaStr, m_blendOpAlpha ); - m_blendOpAlphaInline.CustomDrawer( ref owner, ( x ) => { m_blendOpAlpha = (AvailableBlendOps)x.EditorGUILayoutPopup( BlendOpsAlphaStr, (int)m_blendOpAlpha, BlendOpsHelper.BlendOpsLabels ); }, BlendOpsAlphaStr ); - } - - if( m_validAlphaToMask ) - { - EditorGUILayout.Space(); - m_alphaToMaskValue = owner.EditorGUILayoutToggle( AlphaToMaskStr, m_alphaToMaskValue ); - } - } - - if( EditorGUI.EndChangeCheck() ) - { - m_isDirty = true; - } - } - - void CheckRGBIndex() - { - int count = m_commonBlendTypes.Count; - m_currentRGBIndex = 1; - for( int i = 1; i < count; i++ ) - { - if( m_commonBlendTypes[ i ].SourceFactor == m_sourceFactorRGB && m_commonBlendTypes[ i ].DestFactor == m_destFactorRGB ) - { - m_currentRGBIndex = i; - return; - } - } - - } - - void CheckAlphaIndex() - { - int count = m_commonBlendTypes.Count; - m_currentAlphaIndex = 1; - for( int i = 1; i < count; i++ ) - { - if( m_commonBlendTypes[ i ].SourceFactor == m_sourceFactorAlpha && m_commonBlendTypes[ i ].DestFactor == m_destFactorAlpha ) - { - m_currentAlphaIndex = i; - if( m_currentAlphaIndex > 0 && m_currentRGBIndex == 0 ) - m_currentRGBIndex = 1; - return; - } - } - - if( m_currentAlphaIndex > 0 && m_currentRGBIndex == 0 ) - m_currentRGBIndex = 1; - } - - public void ReadAlphaToMaskFromString( ref uint index, ref string[] nodeParams ) - { - if( UIUtils.CurrentShaderVersion() > 16102 ) - { - m_validAlphaToMask = Convert.ToBoolean( nodeParams[ index++ ] ); - if( m_validAlphaToMask ) - { - m_alphaToMaskValue = Convert.ToBoolean( nodeParams[ index++ ] ); - } - } - } - - public void ReadBlendModeFromString( ref uint index, ref string[] nodeParams ) - { - bool validDataOnMeta = m_validBlendMode; - if( UIUtils.CurrentShaderVersion() > TemplatesManager.MPShaderVersion ) - { - validDataOnMeta = Convert.ToBoolean( nodeParams[ index++ ] ); - } - - if( validDataOnMeta ) - { - if( UIUtils.CurrentShaderVersion() < 15304 ) - { - m_currentRGBIndex = Convert.ToInt32( nodeParams[ index++ ] ); - m_sourceFactorRGB = (AvailableBlendFactor)Enum.Parse( typeof( AvailableBlendFactor ), nodeParams[ index++ ] ); - m_destFactorRGB = (AvailableBlendFactor)Enum.Parse( typeof( AvailableBlendFactor ), nodeParams[ index++ ] ); - - m_currentAlphaIndex = Convert.ToInt32( nodeParams[ index++ ] ); - m_sourceFactorAlpha = (AvailableBlendFactor)Enum.Parse( typeof( AvailableBlendFactor ), nodeParams[ index++ ] ); - m_destFactorAlpha = (AvailableBlendFactor)Enum.Parse( typeof( AvailableBlendFactor ), nodeParams[ index++ ] ); - } - else - { - m_currentRGBIndex = Convert.ToInt32( nodeParams[ index++ ] ); - m_sourceFactorRGBInline.ReadFromString( ref index, ref nodeParams ); - m_sourceFactorRGB = (AvailableBlendFactor)m_sourceFactorRGBInline.IntValue; - m_destFactorRGBInline.ReadFromString( ref index, ref nodeParams ); - m_destFactorRGB = (AvailableBlendFactor)m_destFactorRGBInline.IntValue; - - m_currentAlphaIndex = Convert.ToInt32( nodeParams[ index++ ] ); - m_sourceFactorAlphaInline.ReadFromString( ref index, ref nodeParams ); - m_sourceFactorAlpha = (AvailableBlendFactor)m_sourceFactorAlphaInline.IntValue; - m_destFactorAlphaInline.ReadFromString( ref index, ref nodeParams ); - m_destFactorAlpha = (AvailableBlendFactor)m_destFactorAlphaInline.IntValue; - } - } - } - - public void ReadBlendOpFromString( ref uint index, ref string[] nodeParams ) - { - bool validDataOnMeta = m_validBlendOp; - if( UIUtils.CurrentShaderVersion() > TemplatesManager.MPShaderVersion ) - { - validDataOnMeta = Convert.ToBoolean( nodeParams[ index++ ] ); - } - - if( validDataOnMeta ) - { - if( UIUtils.CurrentShaderVersion() < 15304 ) - { - m_blendOpRGB = (AvailableBlendOps)Enum.Parse( typeof( AvailableBlendOps ), nodeParams[ index++ ] ); - m_blendOpAlpha = (AvailableBlendOps)Enum.Parse( typeof( AvailableBlendOps ), nodeParams[ index++ ] ); - } - else - { - m_blendOpRGBInline.ReadFromString( ref index, ref nodeParams ); - m_blendOpAlphaInline.ReadFromString( ref index, ref nodeParams ); - - if( UIUtils.CurrentShaderVersion() < 15404 ) - { - // Now BlendOps enum starts at 0 and not -1 - m_blendOpRGBInline.FloatValue += 1; - m_blendOpAlphaInline.FloatValue += 1; - } - - m_blendOpRGB = (AvailableBlendOps)m_blendOpRGBInline.IntValue; - m_blendOpAlpha = (AvailableBlendOps)m_blendOpAlphaInline.IntValue; - } - //m_blendOpEnabled = ( m_blendOpRGB != AvailableBlendOps.OFF ); - } - } - public void WriteAlphaToMaskToString( ref string nodeInfo ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_validAlphaToMask ); - if( m_validAlphaToMask ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_alphaToMaskValue ); - } - } - - public void WriteBlendModeToString( ref string nodeInfo ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_validBlendMode ); - if( m_validBlendMode ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_currentRGBIndex ); - if( !m_sourceFactorRGBInline.IsValid ) m_sourceFactorRGBInline.IntValue = (int)m_sourceFactorRGB; - m_sourceFactorRGBInline.WriteToString( ref nodeInfo ); - - if( !m_destFactorRGBInline.IsValid ) m_destFactorRGBInline.IntValue = (int)m_destFactorRGB; - m_destFactorRGBInline.WriteToString( ref nodeInfo ); - - IOUtils.AddFieldValueToString( ref nodeInfo, m_currentAlphaIndex ); - if( !m_sourceFactorAlphaInline.IsValid ) m_sourceFactorAlphaInline.IntValue = (int)m_sourceFactorAlpha; - m_sourceFactorAlphaInline.WriteToString( ref nodeInfo ); - - if( !m_destFactorAlphaInline.IsValid ) m_destFactorAlphaInline.IntValue = (int)m_destFactorAlpha; - m_destFactorAlphaInline.WriteToString( ref nodeInfo ); - } - } - - public void WriteBlendOpToString( ref string nodeInfo ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_validBlendOp ); - if( m_validBlendOp ) - { - if( !m_blendOpRGBInline.IsValid ) m_blendOpRGBInline.IntValue = (int)m_blendOpRGB; - m_blendOpRGBInline.WriteToString( ref nodeInfo ); - - if( !m_blendOpAlphaInline.IsValid ) m_blendOpAlphaInline.IntValue = (int)m_blendOpAlpha; - m_blendOpAlphaInline.WriteToString( ref nodeInfo ); - } - } - - public override void ReadFromString( ref uint index, ref string[] nodeParams ) - { - ReadBlendModeFromString( ref index, ref nodeParams ); - ReadBlendOpFromString( ref index, ref nodeParams ); - ReadAlphaToMaskFromString( ref index, ref nodeParams ); - } - - public override void WriteToString( ref string nodeInfo ) - { - WriteBlendModeToString( ref nodeInfo ); - WriteBlendOpToString( ref nodeInfo ); - WriteAlphaToMaskToString( ref nodeInfo ); - } - - public override void Destroy() - { - base.Destroy(); - m_sourceFactorRGBInline = null; - m_destFactorRGBInline = null; - m_sourceFactorAlphaInline = null; - m_destFactorAlphaInline = null; - m_blendOpRGBInline = null; - m_blendOpAlphaInline = null; - } - - public string CurrentAlphaToMask - { - get - { - return string.Format( AlphaToMaskFormat, m_alphaToMaskValue ? "On" : "Off" ); - } - } - public string CurrentBlendFactorSingle - { - get - { - return ( m_currentRGBIndex > 0 ) ? string.Format( SingleBlendFactorStr, m_sourceFactorRGBInline.GetValueOrProperty( m_sourceFactorRGB.ToString() ), m_destFactorRGBInline.GetValueOrProperty( m_destFactorRGB.ToString() ) ) : BlendFactorOff; - } - } - - public string CurrentBlendFactorSeparate - { - get - { - return string.Format( SeparateBlendFactorStr, - m_sourceFactorRGBInline.GetValueOrProperty( ( m_currentRGBIndex > 0 ? m_sourceFactorRGB.ToString() : AvailableBlendFactor.One.ToString() ) ), - m_destFactorRGBInline.GetValueOrProperty( m_currentRGBIndex > 0 ? m_destFactorRGB.ToString() : AvailableBlendFactor.Zero.ToString() ), - m_sourceFactorAlphaInline.GetValueOrProperty( m_sourceFactorAlpha.ToString() ), - m_destFactorAlphaInline.GetValueOrProperty( m_destFactorAlpha.ToString() ) ); - } - } - - public string CurrentBlendFactor - { - get - { - return ( ( m_currentAlphaIndex > 0 ) ? CurrentBlendFactorSeparate : CurrentBlendFactorSingle ); - } - } - - - public string CurrentBlendOpSingle - { - get - { - return ( m_blendOpRGB != AvailableBlendOps.OFF || m_blendOpRGBInline.IsValid ) ? string.Format( SingleBlendOpStr, m_blendOpRGBInline.GetValueOrProperty( m_blendOpRGB.ToString() ) ) : string.Empty; - } - } - - public string CurrentBlendOpSeparate - { - get - { - return string.Format( SeparateBlendOpStr, m_blendOpRGBInline.GetValueOrProperty( ( m_currentRGBIndex > 0 && m_blendOpRGB != AvailableBlendOps.OFF ) ? m_blendOpRGB.ToString() : AvailableBlendOps.Add.ToString() ), m_blendOpAlphaInline.GetValueOrProperty( m_blendOpAlpha.ToString() ) ); - } - } - - public string CurrentBlendOp { get { return ( ( m_blendOpAlpha != AvailableBlendOps.OFF || m_blendOpAlphaInline.IsValid ) ? CurrentBlendOpSeparate : CurrentBlendOpSingle ); } } - public bool Active { get { return m_blendModeEnabled && ( m_currentRGBIndex > 0 || m_currentAlphaIndex > 0 ); } } - public bool BlendOpActive - { - get - { - return m_blendOpEnabled && - ( - m_blendOpRGBInline.Active || - m_blendOpAlphaInline.Active || - ( !m_blendOpRGBInline.Active && m_blendOpRGB != AvailableBlendOps.OFF ) || - ( !m_blendOpAlphaInline.Active && m_blendOpAlpha != AvailableBlendOps.OFF ) ); - } - } - - public bool ValidBlendMode { get { return m_validBlendMode; } } - public bool ValidBlendOp { get { return m_validBlendOp; } } - public int CurrentRGBIndex { get { return m_currentRGBIndex; } } - - public AvailableBlendFactor SourceFactorRGB - { - get { return m_sourceFactorRGB; } - set - { - m_sourceFactorRGB = value; - m_sourceFactorRGBInline.IntValue = (int)m_sourceFactorRGB; - m_sourceFactorRGBInline.Active = false; - } - - } - public AvailableBlendFactor DestFactorRGB - { - get { return m_destFactorRGB; } - set - { - m_destFactorRGB = value; - m_destFactorRGBInline.IntValue = (int)value; - } - } - - public int CurrentAlphaIndex { get { return m_currentAlphaIndex; } set { m_currentAlphaIndex = value; } } - - public AvailableBlendFactor SourceFactorAlpha - { - get { return m_sourceFactorAlpha; } - set - { - m_sourceFactorAlpha = value; - m_sourceFactorAlphaInline.IntValue = (int)value; - m_sourceFactorAlphaInline.Active = false; - } - } - - public AvailableBlendFactor DestFactorAlpha - { - get { return m_destFactorAlpha; } - set - { - m_destFactorAlpha = value; - m_destFactorAlphaInline.IntValue = (int)value; - m_destFactorAlphaInline.Active = false; - - } - } - - public bool BlendModeEnabled { get { return m_blendModeEnabled; } } - public bool BlendOpEnabled { get { return m_blendOpEnabled; } } - public AvailableBlendOps BlendOpRGB - { - get { return m_blendOpRGB; } - set - { - m_blendOpRGB = value; - m_blendOpRGBInline.IntValue = (int)value; - m_blendOpRGBInline.Active = false; - } - } - - public AvailableBlendOps BlendOpAlpha - { - get { return m_blendOpAlpha; } - set - { - m_blendOpAlpha = value; - m_blendOpAlphaInline.IntValue = (int)value; - m_blendOpAlphaInline.Active = false; - } - } - - public InlineProperty SourceFactorRGBInline { get { return m_sourceFactorRGBInline; } } - public InlineProperty DestFactorRGBInline { get { return m_destFactorRGBInline; } } - public InlineProperty SourceFactorAlphaInline { get { return m_sourceFactorAlphaInline; } } - public InlineProperty DestFactorAlphaInline { get { return m_destFactorAlphaInline; } } - public InlineProperty BlendOpRGBInline { get { return m_blendOpRGBInline; } } - public InlineProperty BlendOpAlphaInline { get { return m_blendOpAlphaInline; } } - public bool IsAdditiveRGB { get { return m_validBlendMode && m_blendModeEnabled && ( m_currentRGBIndex > 0 ) && ( m_sourceFactorRGB == AvailableBlendFactor.One ) && ( m_destFactorRGB == AvailableBlendFactor.One ); } } - public bool IsAlphaBlendRGB { get { return m_validBlendMode && m_blendModeEnabled && ( m_currentRGBIndex > 0 ) && ( m_sourceFactorRGB == AvailableBlendFactor.SrcAlpha ) && ( m_destFactorRGB == AvailableBlendFactor.OneMinusSrcAlpha ); } } - public bool ValidAlphaToMask { get { return m_validAlphaToMask; } } - public bool AlphaToMaskValue { get { return m_alphaToMaskValue; } } - public bool AlphaToMaskIndependent { get { return m_alphaToMaskIndependent; } } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatesBlendModule.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatesBlendModule.cs.meta deleted file mode 100644 index b4eeb76e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatesBlendModule.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 7c88941c5badfb7428059cc3ff0c0df9 -timeCreated: 1510933946 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatesManager.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatesManager.cs deleted file mode 100644 index 456cc4df..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatesManager.cs +++ /dev/null @@ -1,904 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using UnityEditor; -using System.Collections.Generic; -using UnityEngine; -using System.Text.RegularExpressions; - -namespace AmplifyShaderEditor -{ - [Serializable] - public class TemplateInputData - { - public string PortName; - public WirePortDataType DataType; - public MasterNodePortCategory PortCategory; - public int PortUniqueId; - public int OrderId; - public int TagGlobalStartIdx; - public int TagLocalStartIdx; - public string TagId; - public string DefaultValue; - public string LinkId; - - public TemplateInputData( int tagLocalStartIdx, int tagGlobalStartIdx, string tagId, string portName, string defaultValue, WirePortDataType dataType, MasterNodePortCategory portCategory, int portUniqueId, int orderId, string linkId ) - { - DefaultValue = defaultValue; - PortName = portName; - DataType = dataType; - PortCategory = portCategory; - PortUniqueId = portUniqueId; - OrderId = orderId; - TagId = tagId; - TagGlobalStartIdx = tagGlobalStartIdx; - TagLocalStartIdx = tagLocalStartIdx; - LinkId = linkId; - } - - public TemplateInputData( TemplateInputData other ) - { - DefaultValue = other.DefaultValue; - PortName = other.PortName; - DataType = other.DataType; - PortCategory = other.PortCategory; - PortUniqueId = other.PortUniqueId; - OrderId = other.OrderId; - TagId = other.TagId; - TagGlobalStartIdx = other.TagGlobalStartIdx; - LinkId = other.LinkId; - } - } - - - - [Serializable] - public class TemplatePropertyContainer - { - [SerializeField] - private List<TemplateProperty> m_propertyList = new List<TemplateProperty>(); - private Dictionary<string, TemplateProperty> m_propertyDict = new Dictionary<string, TemplateProperty>(); - - - public void AddId( TemplateProperty templateProperty ) - { - BuildInfo(); - m_propertyList.Add( templateProperty ); - m_propertyDict.Add( templateProperty.Id, templateProperty ); - } - - public void AddId( string body, string ID, bool searchIndentation = true ) - { - AddId( body, ID, searchIndentation, string.Empty ); - } - - public void AddId( string body, string ID, bool searchIndentation, string customIndentation ) - { - BuildInfo(); - - int propertyIndex = body.IndexOf( ID ); - if( propertyIndex > -1 ) - { - if( searchIndentation ) - { - int identationIndex = -1; - for( int i = propertyIndex; i >= 0; i-- ) - { - if( body[ i ] == TemplatesManager.TemplateNewLine ) - { - identationIndex = i + 1; - break; - } - - if( i == 0 ) - { - identationIndex = 0; - } - } - if( identationIndex > -1 ) - { - int length = propertyIndex - identationIndex; - string indentation = ( length > 0 ) ? body.Substring( identationIndex, length ) : string.Empty; - TemplateProperty templateProperty = new TemplateProperty( ID, indentation, false ); - m_propertyList.Add( templateProperty ); - m_propertyDict.Add( templateProperty.Id, templateProperty ); - } - else - { - TemplateProperty templateProperty = new TemplateProperty( ID, string.Empty, false ); - m_propertyList.Add( templateProperty ); - m_propertyDict.Add( templateProperty.Id, templateProperty ); - } - } - else - { - TemplateProperty templateProperty = new TemplateProperty( ID, customIndentation, true ); - m_propertyList.Add( templateProperty ); - m_propertyDict.Add( templateProperty.Id, templateProperty ); - } - } - } - - - public void AddId( string body, string ID, int propertyIndex, bool searchIndentation ) - { - AddId( body, ID, propertyIndex, searchIndentation, string.Empty ); - } - - public void AddId( string body, string ID, int propertyIndex, bool searchIndentation, string customIndentation ) - { - if( body == null || string.IsNullOrEmpty( body ) ) - return; - - BuildInfo(); - if( searchIndentation && propertyIndex > -1 && propertyIndex < body.Length ) - { - int indentationIndex = -1; - for( int i = propertyIndex; i > 0; i-- ) - { - if( body[ i ] == TemplatesManager.TemplateNewLine ) - { - indentationIndex = i + 1; - break; - } - } - - if( indentationIndex > -1 ) - { - int length = propertyIndex - indentationIndex; - string indentation = ( length > 0 ) ? body.Substring( indentationIndex, length ) : string.Empty; - TemplateProperty templateProperty = new TemplateProperty( ID, indentation, false ); - m_propertyList.Add( templateProperty ); - m_propertyDict.Add( templateProperty.Id, templateProperty ); - } - } - else - { - TemplateProperty templateProperty = new TemplateProperty( ID, customIndentation, true ); - m_propertyList.Add( templateProperty ); - m_propertyDict.Add( templateProperty.Id, templateProperty ); - } - - } - public void BuildInfo() - { - if( m_propertyDict == null ) - { - m_propertyDict = new Dictionary<string, TemplateProperty>(); - } - - if( m_propertyList.Count != m_propertyDict.Count ) - { - m_propertyDict.Clear(); - for( int i = 0; i < m_propertyList.Count; i++ ) - { - m_propertyDict.Add( m_propertyList[ i ].Id, m_propertyList[ i ] ); - } - } - } - - public void ResetTemplateUsageData() - { - BuildInfo(); - for( int i = 0; i < m_propertyList.Count; i++ ) - { - m_propertyList[ i ].Used = false; - } - } - - public void Reset() - { - m_propertyList.Clear(); - m_propertyDict.Clear(); - } - - public void Destroy() - { - m_propertyList.Clear(); - m_propertyList = null; - m_propertyDict.Clear(); - m_propertyDict = null; - } - - - public Dictionary<string, TemplateProperty> PropertyDict - { - get - { - BuildInfo(); - return m_propertyDict; - } - } - public List<TemplateProperty> PropertyList { get { return m_propertyList; } } - } - - [Serializable] - public class TemplateProperty - { - public bool UseIndentationAtStart = false; - public string Indentation; - public bool UseCustomIndentation; - public string Id; - public bool AutoLineFeed; - public bool Used; - - public TemplateProperty( string id, string indentation, bool useCustomIndentation ) - { - Id = id; - Indentation = indentation; - UseCustomIndentation = useCustomIndentation; - AutoLineFeed = !string.IsNullOrEmpty( indentation ); - Used = false; - } - } - - [Serializable] - public class TemplateTessVControlTag - { - public string Id; - public int StartIdx; - - public TemplateTessVControlTag() - { - StartIdx = -1; - } - - public bool IsValid { get { return StartIdx >= 0; } } - } - - [Serializable] - public class TemplateTessControlData - { - public string Id; - public int StartIdx; - public string InVarType; - public string InVarName; - public string OutVarType; - public string OutVarName; - - public bool IsValid { get { return StartIdx >= 0; } } - - public TemplateTessControlData() - { - StartIdx = -1; - } - - public TemplateTessControlData( int startIdx, string id, string inVarInfo, string outVarInfo ) - { - StartIdx = startIdx; - Id = id; - string[] inVarInfoArr = inVarInfo.Split( IOUtils.VALUE_SEPARATOR ); - if( inVarInfoArr.Length > 1 ) - { - InVarType = inVarInfoArr[ 1 ]; - InVarName = inVarInfoArr[ 0 ]; - } - - string[] outVarInfoArr = outVarInfo.Split( IOUtils.VALUE_SEPARATOR ); - if( outVarInfoArr.Length > 1 ) - { - OutVarType = outVarInfoArr[ 1 ]; - OutVarName = outVarInfoArr[ 0 ]; - } - } - - public string[] GenerateControl( Dictionary<TemplateSemantics, TemplateVertexData> vertexData, List<string> inputList ) - { - List<string> value = new List<string>(); - if( vertexData != null && vertexData.Count > 0 ) - { - foreach( var item in vertexData ) - { - if( inputList.FindIndex( x => { return x.Contains( item.Value.VarName ); } ) > -1 ) - value.Add( string.Format( "{0}.{1} = {2}.{1};", OutVarName, item.Value.VarName, InVarName ) ); - } - } - return value.ToArray(); - } - } - - [Serializable] - public class TemplateTessDomainData - { - public string Id; - public int StartIdx; - public string InVarType; - public string InVarName; - public string OutVarType; - public string OutVarName; - public string BaryVarType; - public string BaryVarName; - - public bool IsValid { get { return StartIdx >= 0; } } - - public TemplateTessDomainData() - { - StartIdx = -1; - } - - public TemplateTessDomainData( int startIdx, string id, string inVarInfo, string outVarInfo, string baryVarInfo ) - { - StartIdx = startIdx; - Id = id; - string[] inVarInfoArr = inVarInfo.Split( IOUtils.VALUE_SEPARATOR ); - if( inVarInfoArr.Length > 1 ) - { - InVarType = inVarInfoArr[ 1 ]; - InVarName = inVarInfoArr[ 0 ]; - } - - string[] outVarInfoArr = outVarInfo.Split( IOUtils.VALUE_SEPARATOR ); - if( outVarInfoArr.Length > 1 ) - { - OutVarType = outVarInfoArr[ 1 ]; - OutVarName = outVarInfoArr[ 0 ]; - } - - string[] baryVarInfoArr = baryVarInfo.Split( IOUtils.VALUE_SEPARATOR ); - if( baryVarInfoArr.Length > 1 ) - { - BaryVarType = baryVarInfoArr[ 1 ]; - BaryVarName = baryVarInfoArr[ 0 ]; - } - } - - public string[] GenerateDomain( Dictionary<TemplateSemantics, TemplateVertexData> vertexData, List<string> inputList ) - { - List<string> value = new List<string>(); - if( vertexData != null && vertexData.Count > 0 ) - { - foreach( var item in vertexData ) - { - //o.ase_normal = patch[0].ase_normal * bary.x + patch[1].ase_normal * bary.y + patch[2].ase_normal * bary.z; - if( inputList.FindIndex( x => { return x.Contains( item.Value.VarName ); } ) > -1 ) - value.Add( string.Format( "{0}.{1} = {2}[0].{1} * {3}.x + {2}[1].{1} * {3}.y + {2}[2].{1} * {3}.z;", OutVarName, item.Value.VarName, InVarName, BaryVarName ) ); - } - } - return value.ToArray(); - } - } - - [Serializable] - public class TemplateFunctionData - { - public int MainBodyLocalIdx; - public string MainBodyName; - - public string Id; - public int Position; - public string InVarType; - public string InVarName; - public string OutVarType; - public string OutVarName; - public MasterNodePortCategory Category; - public TemplateFunctionData( int mainBodyLocalIdx, string mainBodyName, string id, int position, string inVarInfo, string outVarInfo, MasterNodePortCategory category ) - { - MainBodyLocalIdx = mainBodyLocalIdx; - MainBodyName = mainBodyName; - Id = id; - Position = position; - { - string[] inVarInfoArr = inVarInfo.Split( IOUtils.VALUE_SEPARATOR ); - if( inVarInfoArr.Length > 1 ) - { - InVarType = inVarInfoArr[ 1 ]; - InVarName = inVarInfoArr[ 0 ]; - } - } - { - string[] outVarInfoArr = outVarInfo.Split( IOUtils.VALUE_SEPARATOR ); - if( outVarInfoArr.Length > 1 ) - { - OutVarType = outVarInfoArr[ 1 ]; - OutVarName = outVarInfoArr[ 0 ]; - } - } - Category = category; - } - } - - [Serializable] - public class TemplateTagData - { - public int StartIdx = -1; - public string Id; - public bool SearchIndentation; - public string CustomIndentation; - - - public TemplateTagData( int startIdx, string id, bool searchIndentation ) - { - StartIdx = startIdx; - Id = id; - SearchIndentation = searchIndentation; - CustomIndentation = string.Empty; - } - - public TemplateTagData( string id, bool searchIndentation ) - { - Id = id; - SearchIndentation = searchIndentation; - CustomIndentation = string.Empty; - } - - public TemplateTagData( string id, bool searchIndentation, string customIndentation ) - { - Id = id; - SearchIndentation = searchIndentation; - CustomIndentation = customIndentation; - } - - public bool IsValid { get { return StartIdx >= 0; } } - } - - public enum TemplatePortIds - { - Name = 0, - DataType, - UniqueId, - OrderId, - Link - } - - public enum TemplateCommonTagId - { - Property = 0, - Global = 1, - Function = 2, - Tag = 3, - Pragmas = 4, - Pass = 5, - Params_Vert = 6, - Params_Frag = 7 - //CullMode = 8, - //BlendMode = 9, - //BlendOp = 10, - //ColorMask = 11, - //StencilOp = 12 - } - - [Serializable] - public class TemplatesManager : ScriptableObject - { - public static int MPShaderVersion = 14503; - - public static readonly string TemplateShaderNameBeginTag = "/*ase_name*/"; - public static readonly string TemplateStencilTag = "/*ase_stencil*/\n"; - public static readonly string TemplateAllModulesTag = "/*ase_all_modules*/\n"; - public static readonly string TemplateMPSubShaderTag = "\\bSubShader\\b\\s*{"; - //public static readonly string TemplateMPPassTag = "^\\s*Pass\b\\s*{";//"\\bPass\\b\\s*{"; - public static readonly string TemplateMPPassTag = "\\bPass\\b\\s*{"; - public static readonly string TemplateLocalVarTag = "/*ase_local_var*/"; - public static readonly string TemplateDependenciesListTag = "/*ase_dependencies_list*/"; - public static readonly string TemplatePragmaBeforeTag = "/*ase_pragma_before*/"; - public static readonly string TemplatePragmaTag = "/*ase_pragma*/"; - public static readonly string TemplatePassTag = "/*ase_pass*/"; - public static readonly string TemplatePassesEndTag = "/*ase_pass_end*/"; - public static readonly string TemplateLODsTag = "/*ase_lod*/"; - //public static readonly string TemplatePassTagPattern = @"\s\/\*ase_pass\*\/"; - public static readonly string TemplatePassTagPattern = @"\s\/\*ase_pass[:\*]+"; - public static readonly string TemplatePropertyTag = "/*ase_props*/"; - public static readonly string TemplateGlobalsTag = "/*ase_globals*/"; - public static readonly string TemplateSRPBatcherTag = "/*ase_srp_batcher*/\n"; - public static readonly string TemplateInterpolatorBeginTag = "/*ase_interp("; - public static readonly string TemplateVertexDataTag = "/*ase_vdata:"; - - public static readonly string TemplateTessVControlTag = "/*ase_vcontrol*/"; - public static readonly string TemplateTessControlCodeArea = "/*ase_control_code:"; - public static readonly string TemplateTessDomainCodeArea = "/*ase_domain_code:"; - - //public static readonly string TemplateExcludeFromGraphTag = "/*ase_hide_pass*/"; - public static readonly string TemplateMainPassTag = "/*ase_main_pass*/"; - - public static readonly string TemplateFunctionsTag = "/*ase_funcs*/\n"; - //public static readonly string TemplateTagsTag = "/*ase_tags*/"; - - //public static readonly string TemplateCullModeTag = "/*ase_cull_mode*/"; - //public static readonly string TemplateBlendModeTag = "/*ase_blend_mode*/"; - //public static readonly string TemplateBlendOpTag = "/*ase_blend_op*/"; - //public static readonly string TemplateColorMaskTag = "/*ase_color_mask*/"; - //public static readonly string TemplateStencilOpTag = "/*ase_stencil*/"; - - public static readonly string TemplateCodeSnippetAttribBegin = "#CODE_SNIPPET_ATTRIBS_BEGIN#"; - public static readonly string TemplateCodeSnippetAttribEnd = "#CODE_SNIPPET_ATTRIBS_END#\n"; - public static readonly string TemplateCodeSnippetEnd = "#CODE_SNIPPET_END#\n"; - - public static readonly char TemplateNewLine = '\n'; - - // INPUTS AREA - public static readonly string TemplateInputsVertBeginTag = "/*ase_vert_out:"; - public static readonly string TemplateInputsFragBeginTag = "/*ase_frag_out:"; - public static readonly string TemplateInputsVertParamsTag = "/*ase_vert_input*/"; - public static readonly string TemplateInputsFragParamsTag = "/*ase_frag_input*/"; - - - // CODE AREA - public static readonly string TemplateVertexCodeBeginArea = "/*ase_vert_code:"; - public static readonly string TemplateFragmentCodeBeginArea = "/*ase_frag_code:"; - - - public static readonly string TemplateEndOfLine = "*/\n"; - public static readonly string TemplateEndSectionTag = "*/"; - public static readonly string TemplateFullEndTag = "/*end*/"; - - public static readonly string NameFormatter = "\"{0}\""; - - public static readonly TemplateTagData[] CommonTags = { new TemplateTagData( TemplatePropertyTag,true), - new TemplateTagData( TemplateGlobalsTag,true), - new TemplateTagData( TemplateSRPBatcherTag,true), - new TemplateTagData( TemplateFunctionsTag,true), - //new TemplateTagData( TemplateTagsTag,false," "), - new TemplateTagData( TemplatePragmaBeforeTag,true), - new TemplateTagData( TemplatePragmaTag,true), - new TemplateTagData( TemplatePassTag,true), - new TemplateTagData( TemplateInputsVertParamsTag,false), - new TemplateTagData( TemplateInputsFragParamsTag,false), - new TemplateTagData( TemplateLODsTag,true) - //new TemplateTagData( TemplateCullModeTag,false), - //new TemplateTagData( TemplateBlendModeTag,false), - //new TemplateTagData( TemplateBlendOpTag,false), - //new TemplateTagData( TemplateColorMaskTag,false), - //new TemplateTagData( TemplateStencilOpTag,true), - }; - public static string LightweigthPBRGUID = "1976390536c6c564abb90fe41f6ee334"; - public static string LightweigthUnlitGUID = "e2514bdcf5e5399499a9eb24d175b9db"; - public static string UniversalPBRGUID = "94348b07e5e8bab40bd6c8a1e3df54cd"; - public static string UniversalUnlitGUID = "2992e84f91cbeb14eab234972e07ea9d"; - - public static string HDNewLitGUID = "53b46d85872c5b24c8f4f0a1c3fe4c87"; - public static string HDNewPBRGUID = "41e04be03f2c20941bc749271be1c937"; - public static string HDNewUnlitGUID = "7f5cb9c3ea6481f469fdd856555439ef"; - public static string HDLitGUID = "091c43ba8bd92c9459798d59b089ce4e"; - public static string HDPBRGUID = "bb308bce79762c34e823049efce65141"; - public static string HDUnlitGUID = "dfe2f27ac20b08c469b2f95c236be0c3"; - - public static Dictionary<string, string> OfficialTemplates = new Dictionary<string, string>() - { - { "0770190933193b94aaa3065e307002fa","Legacy/Unlit"}, - { "32139be9c1eb75640a847f011acf3bcf","Legacy/Post-Processing Stack"}, - { "6ce779933eb99f049b78d6163735e06f","Legacy/Custom RT Init"}, - { "32120270d1b3a8746af2aca8bc749736","Legacy/Custom RT Update"}, - { LightweigthPBRGUID,"LW/PBR"}, - { LightweigthUnlitGUID,"LW/Unlit"}, - { UniversalPBRGUID,"Universal/PBR"}, - { UniversalUnlitGUID,"Universal/Unlit"}, - { "53b46d85872c5b24c8f4f0a1c3fe4c87","HD/Lit"}, - { HDLitGUID,"Deprecated/HD/Lit"}, - { HDPBRGUID,"Deprecated/HD/PBR"}, - { HDUnlitGUID,"Deprecated/HD/Unlit"}, - { "c71b220b631b6344493ea3cf87110c93","Legacy/Post Process" }, - { "6e114a916ca3e4b4bb51972669d463bf","Deprecated/Legacy/Default Unlit" }, - { "5056123faa0c79b47ab6ad7e8bf059a4","Legacy/Default UI" }, - { "899e609c083c74c4ca567477c39edef0","Legacy/Unlit Lightmap" }, - { "0f8ba0101102bb14ebf021ddadce9b49","Legacy/Default Sprites" }, - { "0b6a9f8b4f707c74ca64c0be8e590de0","Legacy/Particles Alpha Blended" }, - { "e1de45c0d41f68c41b2cc20c8b9c05ef","Legacy/Multi Pass Unlit" } - }; - - public static readonly string TemplateMenuItemsFileGUID = "da0b931bd234a1e43b65f684d4b59bfb"; - - private Dictionary<string, TemplateDataParent> m_availableTemplates = new Dictionary<string, TemplateDataParent>(); - - [SerializeField] - private List<TemplateDataParent> m_sortedTemplates = new List<TemplateDataParent>(); - - [SerializeField] - public string[] AvailableTemplateNames; - - [SerializeField] - public bool Initialized = false; - - private Dictionary<string, bool> m_optionsInitialSetup = new Dictionary<string, bool>(); - - public static string CurrTemplateGUIDLoaded = string.Empty; - - public static bool IsTestTemplate { get { return CurrTemplateGUIDLoaded.Equals( "a95a019bbc760714bb8228af04c291d1" ); } } - public static bool ShowDebugMessages = false; - public void RefreshAvailableTemplates() - { - if( m_availableTemplates.Count != m_sortedTemplates.Count ) - { - m_availableTemplates.Clear(); - int count = m_sortedTemplates.Count; - for( int i = 0; i < count; i++ ) - { - m_availableTemplates.Add( m_sortedTemplates[ i ].GUID, m_sortedTemplates[ i ] ); - } - } - } - - public void Init() - { - if( !Initialized ) - { - if( ShowDebugMessages ) - Debug.Log( "Initialize" ); - - string templateMenuItems = IOUtils.LoadTextFileFromDisk( AssetDatabase.GUIDToAssetPath( TemplateMenuItemsFileGUID ) ); - bool refreshTemplateMenuItems = false; - - foreach( KeyValuePair<string, string> kvp in OfficialTemplates ) - { - if( !string.IsNullOrEmpty( AssetDatabase.GUIDToAssetPath( kvp.Key ) ) ) - { - TemplateMultiPass template = ScriptableObject.CreateInstance<TemplateMultiPass>(); - template.Init( kvp.Value, kvp.Key, false ); - AddTemplate( template ); - if( !refreshTemplateMenuItems && templateMenuItems.IndexOf( kvp.Value ) < 0 ) - refreshTemplateMenuItems = true; - } - } - - // Search for other possible templates on the project - string[] allShaders = AssetDatabase.FindAssets( "t:shader" ); - for( int i = 0; i < allShaders.Length; i++ ) - { - if( !m_availableTemplates.ContainsKey( allShaders[ i ] ) ) - { - CheckAndLoadTemplate( allShaders[ i ] ); - } - } - - // TODO: Sort list alphabeticaly - AvailableTemplateNames = new string[ m_sortedTemplates.Count + 1 ]; - AvailableTemplateNames[ 0 ] = "Custom"; - for( int i = 0; i < m_sortedTemplates.Count; i++ ) - { - m_sortedTemplates[ i ].OrderId = i; - AvailableTemplateNames[ i + 1 ] = m_sortedTemplates[ i ].Name; - } - - if( refreshTemplateMenuItems ) - CreateTemplateMenuItems(); - - Initialized = true; - } - } - - //[MenuItem( "Window/Amplify Shader Editor/Create Menu Items", false, 1000 )] - //public static void ForceCreateTemplateMenuItems() - //{ - // UIUtils.CurrentWindow.TemplatesManagerInstance.CreateTemplateMenuItems(); - //} - - public void CreateTemplateMenuItems() - { - if( m_sortedTemplates == null || m_sortedTemplates.Count == 0 ) - return; - - // change names for duplicates - for( int i = 0; i < m_sortedTemplates.Count; i++ ) - { - for( int j = 0; j < i; j++ ) - { - if( m_sortedTemplates[ i ].Name == m_sortedTemplates[ j ].Name ) - { - var match = Regex.Match( m_sortedTemplates[ i ].Name, @".+(\d+)" ); - if( match.Success ) - { - string strNumber = match.Groups[ 1 ].Value; - int number = int.Parse( strNumber ) + 1; - string firstPart = m_sortedTemplates[ i ].Name.Substring( 0, match.Groups[ 1 ].Index ); - string secondPart = m_sortedTemplates[ i ].Name.Substring( match.Groups[ 1 ].Index + strNumber.Length ); - m_sortedTemplates[ i ].Name = firstPart + number + secondPart; - } - else - { - m_sortedTemplates[ i ].Name += " 1"; - } - } - } - } - - System.Text.StringBuilder fileContents = new System.Text.StringBuilder(); - fileContents.Append( "// Amplify Shader Editor - Visual Shader Editing Tool\n" ); - fileContents.Append( "// Copyright (c) Amplify Creations, Lda <info@amplify.pt>\n" ); - fileContents.Append( "using UnityEditor;\n" ); - fileContents.Append( "\n" ); - fileContents.Append( "namespace AmplifyShaderEditor\n" ); - fileContents.Append( "{\n" ); - fileContents.Append( "\tpublic class TemplateMenuItems\n" ); - fileContents.Append( "\t{\n" ); - int fixedPriority = 85; - for( int i = 0; i < m_sortedTemplates.Count; i++ ) - { - fileContents.AppendFormat( "\t\t[MenuItem( \"Assets/Create/Amplify Shader/{0}\", false, {1} )]\n", m_sortedTemplates[ i ].Name, fixedPriority ); - string itemName = UIUtils.RemoveInvalidCharacters( m_sortedTemplates[ i ].Name ); - fileContents.AppendFormat( "\t\tpublic static void ApplyTemplate{0}()\n", itemName/*i*/ ); - fileContents.Append( "\t\t{\n" ); - //fileContents.AppendFormat( "\t\t\tAmplifyShaderEditorWindow.CreateNewTemplateShader( \"{0}\" );\n", m_sortedTemplates[ i ].GUID ); - fileContents.AppendFormat( "\t\t\tAmplifyShaderEditorWindow.CreateConfirmationTemplateShader( \"{0}\" );\n", m_sortedTemplates[ i ].GUID ); - fileContents.Append( "\t\t}\n" ); - } - fileContents.Append( "\t}\n" ); - fileContents.Append( "}\n" ); - string filePath = AssetDatabase.GUIDToAssetPath( TemplateMenuItemsFileGUID ); - IOUtils.SaveTextfileToDisk( fileContents.ToString(), filePath, false ); - AssetDatabase.ImportAsset( filePath ); - } - - public int GetIdForTemplate( TemplateData templateData ) - { - if( templateData == null ) - return -1; - - for( int i = 0; i < m_sortedTemplates.Count; i++ ) - { - if( m_sortedTemplates[ i ].GUID.Equals( templateData.GUID ) ) - return m_sortedTemplates[ i ].OrderId; - } - return -1; - } - - - - public void AddTemplate( TemplateDataParent templateData ) - { - if( templateData == null || !templateData.IsValid ) - return; - RefreshAvailableTemplates(); - if( !m_availableTemplates.ContainsKey( templateData.GUID ) ) - { - m_sortedTemplates.Add( templateData ); - m_availableTemplates.Add( templateData.GUID, templateData ); - } - } - - public void RemoveTemplate( string guid ) - { - TemplateDataParent templateData = GetTemplate( guid ); - if( templateData != null ) - { - RemoveTemplate( templateData ); - } - } - - public void RemoveTemplate( TemplateDataParent templateData ) - { - RefreshAvailableTemplates(); - - if( m_availableTemplates != null ) - m_availableTemplates.Remove( templateData.GUID ); - - m_sortedTemplates.Remove( templateData ); - templateData.Destroy(); - } - - public void Destroy() - { - if( TemplatesManager.ShowDebugMessages ) - Debug.Log( "Destroy Manager" ); - if( m_availableTemplates != null ) - { - foreach( KeyValuePair<string, TemplateDataParent> kvp in m_availableTemplates ) - { - kvp.Value.Destroy(); - } - m_availableTemplates.Clear(); - m_availableTemplates = null; - } - int count = m_sortedTemplates.Count; - - for( int i = 0; i < count; i++ ) - { - ScriptableObject.DestroyImmediate( m_sortedTemplates[ i ] ); - } - - m_sortedTemplates.Clear(); - m_sortedTemplates = null; - - AvailableTemplateNames = null; - Initialized = false; - } - - public TemplateDataParent GetTemplate( int id ) - { - if( id < m_sortedTemplates.Count ) - return m_sortedTemplates[ id ]; - - return null; - } - - public TemplateDataParent GetTemplate( string guid ) - { - RefreshAvailableTemplates(); - if( m_availableTemplates == null && m_sortedTemplates != null ) - { - m_availableTemplates = new Dictionary<string, TemplateDataParent>(); - for( int i = 0; i < m_sortedTemplates.Count; i++ ) - { - m_availableTemplates.Add( m_sortedTemplates[ i ].GUID, m_sortedTemplates[ i ] ); - } - } - - if( m_availableTemplates.ContainsKey( guid ) ) - return m_availableTemplates[ guid ]; - - return null; - } - - - public TemplateDataParent GetTemplateByName( string name ) - { - RefreshAvailableTemplates(); - if( m_availableTemplates == null && m_sortedTemplates != null ) - { - m_availableTemplates = new Dictionary<string, TemplateDataParent>(); - for( int i = 0; i < m_sortedTemplates.Count; i++ ) - { - m_availableTemplates.Add( m_sortedTemplates[ i ].GUID, m_sortedTemplates[ i ] ); - } - } - - foreach( KeyValuePair<string, TemplateDataParent> kvp in m_availableTemplates ) - { - if( kvp.Value.DefaultShaderName.Equals( name ) ) - { - return kvp.Value; - } - } - return null; - } - - public TemplateDataParent CheckAndLoadTemplate( string guid ) - { - TemplateDataParent templateData = GetTemplate( guid ); - if( templateData == null ) - { - string datapath = AssetDatabase.GUIDToAssetPath( guid ); - string body = IOUtils.LoadTextFileFromDisk( datapath ); - - if( body.IndexOf( TemplatesManager.TemplateShaderNameBeginTag ) > -1 ) - { - templateData = ScriptableObject.CreateInstance<TemplateMultiPass>(); - templateData.Init( string.Empty, guid, true ); - if( templateData.IsValid ) - { - AddTemplate( templateData ); - return templateData; - } - } - } - - return null; - } - - private void OnEnable() - { - if( !Initialized ) - { - Init(); - } - else - { - RefreshAvailableTemplates(); - } - hideFlags = HideFlags.HideAndDontSave; - if( ShowDebugMessages ) - Debug.Log( "On Enable Manager: " + this.GetInstanceID() ); - } - - public void ResetOptionsSetupData() - { - if( ShowDebugMessages ) - Debug.Log( "Reseting options setup data" ); - m_optionsInitialSetup.Clear(); - } - - public bool SetOptionsValue( string optionId, bool value ) - { - if( m_optionsInitialSetup.ContainsKey( optionId ) ) - { - m_optionsInitialSetup[ optionId ] = m_optionsInitialSetup[ optionId ] || value; - } - else - { - m_optionsInitialSetup.Add( optionId, value ); - } - return m_optionsInitialSetup[ optionId ]; - } - - public int TemplateCount { get { return m_sortedTemplates.Count; } } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatesManager.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatesManager.cs.meta deleted file mode 100644 index b49d0694..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatesManager.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 9f0aacdb47cf3b94ebbe9e72af9d3cf1 -timeCreated: 1481126958 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatesStencilBufferModule.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatesStencilBufferModule.cs deleted file mode 100644 index 6be80ea4..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatesStencilBufferModule.cs +++ /dev/null @@ -1,662 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; -using UnityEditor; - -namespace AmplifyShaderEditor -{ - - [Serializable] - public sealed class TemplatesStencilBufferModule : TemplateModuleParent - { - private const string FoldoutLabelStr = " Stencil Buffer"; - private GUIContent ReferenceValueContent = new GUIContent( "Reference", "The value to be compared against (if Comparison is anything else than always) and/or the value to be written to the buffer (if either Pass, Fail or ZFail is set to replace)" ); - private GUIContent ReadMaskContent = new GUIContent( "Read Mask", "An 8 bit mask as an 0-255 integer, used when comparing the reference value with the contents of the buffer (referenceValue & readMask) comparisonFunction (stencilBufferValue & readMask)" ); - private GUIContent WriteMaskContent = new GUIContent( "Write Mask", "An 8 bit mask as an 0-255 integer, used when writing to the buffer" ); - private const string ComparisonStr = "Comparison"; - private const string PassStr = "Pass"; - private const string FailStr = "Fail"; - private const string ZFailStr = "ZFail"; - - private const string ComparisonFrontStr = "Comp. Front"; - private const string PassFrontStr = "Pass Front"; - private const string FailFrontStr = "Fail Front"; - private const string ZFailFrontStr = "ZFail Front"; - - private const string ComparisonBackStr = "Comp. Back"; - private const string PassBackStr = "Pass Back"; - private const string FailBackStr = "Fail Back"; - private const string ZFailBackStr = "ZFail Back"; - - private Dictionary<string, int> m_comparisonDict = new Dictionary<string, int>(); - private Dictionary<string, int> m_stencilOpsDict = new Dictionary<string, int>(); - - [SerializeField] - private bool m_active = true; - - [SerializeField] - private InlineProperty m_reference = new InlineProperty(); - - // Read Mask - private const int ReadMaskDefaultValue = 255; - [SerializeField] - private InlineProperty m_readMask = new InlineProperty( ReadMaskDefaultValue ); - - //Write Mask - private const int WriteMaskDefaultValue = 255; - [SerializeField] - private InlineProperty m_writeMask = new InlineProperty( WriteMaskDefaultValue ); - - //Comparison Function - private const int ComparisonDefaultValue = 0; - [SerializeField] - private InlineProperty m_comparisonFunctionFrontIdx = new InlineProperty( ComparisonDefaultValue ); - - [SerializeField] - private InlineProperty m_comparisonFunctionBackIdx = new InlineProperty( ComparisonDefaultValue ); - - //Pass Stencil Op - private const int PassStencilOpDefaultValue = 0; - [SerializeField] - private InlineProperty m_passStencilOpFrontIdx = new InlineProperty( PassStencilOpDefaultValue ); - - [SerializeField] - private InlineProperty m_passStencilOpBackIdx = new InlineProperty( PassStencilOpDefaultValue ); - - //Fail Stencil Op - private const int FailStencilOpDefaultValue = 0; - - [SerializeField] - private InlineProperty m_failStencilOpFrontIdx = new InlineProperty( FailStencilOpDefaultValue ); - - [SerializeField] - private InlineProperty m_failStencilOpBackIdx = new InlineProperty( FailStencilOpDefaultValue ); - - //ZFail Stencil Op - private const int ZFailStencilOpDefaultValue = 0; - [SerializeField] - private InlineProperty m_zFailStencilOpFrontIdx = new InlineProperty( ZFailStencilOpDefaultValue ); - - [SerializeField] - private InlineProperty m_zFailStencilOpBackIdx = new InlineProperty( ZFailStencilOpDefaultValue ); - - public TemplatesStencilBufferModule() : base("Stencil Buffer") - { - for( int i = 0; i < StencilBufferOpHelper.StencilComparisonValues.Length; i++ ) - { - m_comparisonDict.Add( StencilBufferOpHelper.StencilComparisonValues[ i ].ToLower(), i ); - } - - for( int i = 0; i < StencilBufferOpHelper.StencilOpsValues.Length; i++ ) - { - m_stencilOpsDict.Add( StencilBufferOpHelper.StencilOpsValues[ i ].ToLower(), i ); - } - } - - public void CopyFrom( TemplatesStencilBufferModule other , bool allData ) - { - if( allData ) - m_independentModule = other.IndependentModule; - - m_active = other.Active; - m_reference.CopyFrom( other.Reference ); - m_readMask.CopyFrom( other.ReadMask ); - m_writeMask.CopyFrom( other.WriteMask ); - m_comparisonFunctionFrontIdx.CopyFrom( other.ComparisonFunctionIdx ); - m_comparisonFunctionBackIdx.CopyFrom( other.ComparisonFunctionBackIdx ); - m_passStencilOpFrontIdx.CopyFrom( other.PassStencilOpIdx ); - m_passStencilOpBackIdx.CopyFrom( other.PassStencilOpBackIdx ); - m_failStencilOpFrontIdx.CopyFrom( other.FailStencilOpIdx ); - m_failStencilOpBackIdx.CopyFrom( other.FailStencilOpBackIdx ); - m_zFailStencilOpFrontIdx.CopyFrom( other.ZFailStencilOpIdx ); - m_zFailStencilOpBackIdx.CopyFrom( other.ZFailStencilOpBackIdx ); - } - - public void ConfigureFromTemplateData( TemplateStencilData stencilData ) - { - bool newValidData = ( stencilData.DataCheck == TemplateDataCheck.Valid ); - if( newValidData && m_validData != newValidData ) - { - m_active = stencilData.Active; - m_independentModule = stencilData.IndependentModule; - if( string.IsNullOrEmpty( stencilData.ReferenceInline ) ) - { - m_reference.IntValue = stencilData.Reference; - m_reference.ResetProperty(); - } - else - { - m_reference.SetInlineByName( stencilData.ReferenceInline ); - } - - if( string.IsNullOrEmpty( stencilData.ReadMaskInline ) ) - { - m_readMask.IntValue = stencilData.ReadMask; - m_readMask.ResetProperty(); - } - else - { - m_readMask.SetInlineByName( stencilData.ReadMaskInline ); - } - - if( string.IsNullOrEmpty( stencilData.WriteMaskInline ) ) - { - m_writeMask.IntValue = stencilData.WriteMask; - m_writeMask.ResetProperty(); - } - else - { - m_writeMask.SetInlineByName( stencilData.WriteMaskInline ); - } - - if( string.IsNullOrEmpty( stencilData.ComparisonFrontInline ) ) - { - if( !string.IsNullOrEmpty( stencilData.ComparisonFront ) ) - { - m_comparisonFunctionFrontIdx.IntValue = m_comparisonDict[ stencilData.ComparisonFront.ToLower() ]; - } - else - { - m_comparisonFunctionFrontIdx.IntValue = m_comparisonDict[ "always" ]; - } - m_comparisonFunctionFrontIdx.ResetProperty(); - } - else - { - m_comparisonFunctionFrontIdx.SetInlineByName( stencilData.ComparisonFrontInline ); - } - - if( string.IsNullOrEmpty( stencilData.PassFrontInline ) ) - { - if( !string.IsNullOrEmpty( stencilData.PassFront ) ) - { - m_passStencilOpFrontIdx.IntValue = m_stencilOpsDict[ stencilData.PassFront.ToLower() ]; - } - else - { - m_passStencilOpFrontIdx.IntValue = m_stencilOpsDict[ "keep" ]; - } - m_passStencilOpFrontIdx.ResetProperty(); - } - else - { - m_passStencilOpFrontIdx.SetInlineByName( stencilData.PassFrontInline ); - } - - if( string.IsNullOrEmpty( stencilData.FailFrontInline ) ) - { - if( !string.IsNullOrEmpty( stencilData.FailFront ) ) - { - m_failStencilOpFrontIdx.IntValue = m_stencilOpsDict[ stencilData.FailFront.ToLower() ]; - } - else - { - m_failStencilOpFrontIdx.IntValue = m_stencilOpsDict[ "keep" ]; - } - m_failStencilOpFrontIdx.ResetProperty(); - } - else - { - m_failStencilOpFrontIdx.SetInlineByName( stencilData.FailFrontInline ); - } - - if( string.IsNullOrEmpty( stencilData.ZFailFrontInline ) ) - { - if( !string.IsNullOrEmpty( stencilData.ZFailFront ) ) - { - m_zFailStencilOpFrontIdx.IntValue = m_stencilOpsDict[ stencilData.ZFailFront.ToLower() ]; - } - else - { - m_zFailStencilOpFrontIdx.IntValue = m_stencilOpsDict[ "keep" ]; - } - m_zFailStencilOpFrontIdx.ResetProperty(); - } - else - { - m_zFailStencilOpFrontIdx.SetInlineByName( stencilData.ZFailFrontInline ); - } - - if( string.IsNullOrEmpty( stencilData.ComparisonBackInline ) ) - { - if( !string.IsNullOrEmpty( stencilData.ComparisonBack ) ) - { - m_comparisonFunctionBackIdx.IntValue = m_comparisonDict[ stencilData.ComparisonBack.ToLower() ]; - } - else - { - m_comparisonFunctionBackIdx.IntValue = m_comparisonDict[ "always" ]; - } - m_comparisonFunctionBackIdx.ResetProperty(); - } - else - { - m_comparisonFunctionBackIdx.SetInlineByName( stencilData.ComparisonBackInline ); - } - - if( string.IsNullOrEmpty( stencilData.PassBackInline ) ) - { - - if( !string.IsNullOrEmpty( stencilData.PassBack ) ) - { - m_passStencilOpBackIdx.IntValue = m_stencilOpsDict[ stencilData.PassBack.ToLower() ]; - } - else - { - m_passStencilOpBackIdx.IntValue = m_stencilOpsDict[ "keep" ]; - } - m_passStencilOpBackIdx.ResetProperty(); - } - else - { - m_passStencilOpBackIdx.SetInlineByName( stencilData.PassBackInline ); - } - - if( string.IsNullOrEmpty( stencilData.FailBackInline ) ) - { - if( !string.IsNullOrEmpty( stencilData.FailBack ) ) - { - m_failStencilOpBackIdx.IntValue = m_stencilOpsDict[ stencilData.FailBack.ToLower() ]; - } - else - { - m_failStencilOpBackIdx.IntValue = m_stencilOpsDict[ "keep" ]; - } - m_failStencilOpBackIdx.ResetProperty(); - } - else - { - m_failStencilOpBackIdx.SetInlineByName( stencilData.FailBackInline ); - } - - - if( string.IsNullOrEmpty( stencilData.ZFailBackInline ) ) - { - if( !string.IsNullOrEmpty( stencilData.ZFailBack ) ) - { - m_zFailStencilOpBackIdx.IntValue = m_stencilOpsDict[ stencilData.ZFailBack.ToLower() ]; - } - else - { - m_zFailStencilOpBackIdx.IntValue = m_stencilOpsDict[ "keep" ]; - } - m_zFailStencilOpBackIdx.ResetProperty(); - } - else - { - m_zFailStencilOpBackIdx.SetInlineByName( stencilData.ZFailBackInline ); - } - } - m_validData = newValidData; - } - - public string CreateStencilOp( CullMode cullMode ) - { - if( !m_active ) - return string.Empty; - - string result = "Stencil\n{\n"; - result += string.Format( "\tRef {0}\n", m_reference.GetValueOrProperty() ); - if( m_readMask.IsValid || m_readMask.IntValue != ReadMaskDefaultValue ) - { - result += string.Format( "\tReadMask {0}\n", m_readMask.GetValueOrProperty() ); - } - - if( m_writeMask.IsValid || m_writeMask.IntValue != WriteMaskDefaultValue ) - { - result += string.Format( "\tWriteMask {0}\n", m_writeMask.GetValueOrProperty() ); - } - - if( cullMode == CullMode.Off && - ( m_comparisonFunctionBackIdx.IsValid || m_comparisonFunctionBackIdx.IntValue != ComparisonDefaultValue || - m_passStencilOpBackIdx.IsValid || m_passStencilOpBackIdx.IntValue != PassStencilOpDefaultValue || - m_failStencilOpBackIdx.IsValid || m_failStencilOpBackIdx.IntValue != FailStencilOpDefaultValue || - m_zFailStencilOpBackIdx.IsValid || m_zFailStencilOpBackIdx.IntValue != ZFailStencilOpDefaultValue ) ) - { - if( m_comparisonFunctionFrontIdx.IsValid || m_comparisonFunctionFrontIdx.IntValue != ComparisonDefaultValue ) - result += string.Format( "\tCompFront {0}\n", m_comparisonFunctionFrontIdx.GetValueOrProperty( StencilBufferOpHelper.StencilComparisonValues[ m_comparisonFunctionFrontIdx.IntValue ] ) ); - - if( m_passStencilOpFrontIdx.IsValid || m_passStencilOpFrontIdx.IntValue != PassStencilOpDefaultValue ) - result += string.Format( "\tPassFront {0}\n", m_passStencilOpFrontIdx.GetValueOrProperty( StencilBufferOpHelper.StencilOpsValues[ m_passStencilOpFrontIdx.IntValue ] ) ); - - if( m_failStencilOpFrontIdx.IsValid || m_failStencilOpFrontIdx.IntValue != FailStencilOpDefaultValue ) - result += string.Format( "\tFailFront {0}\n", m_failStencilOpFrontIdx.GetValueOrProperty( StencilBufferOpHelper.StencilOpsValues[ m_failStencilOpFrontIdx.IntValue ] ) ); - - if( m_zFailStencilOpFrontIdx.IsValid || m_zFailStencilOpFrontIdx.IntValue != ZFailStencilOpDefaultValue ) - result += string.Format( "\tZFailFront {0}\n", m_zFailStencilOpFrontIdx.GetValueOrProperty( StencilBufferOpHelper.StencilOpsValues[ m_zFailStencilOpFrontIdx.IntValue ] ) ); - - if( m_comparisonFunctionBackIdx.IsValid || m_comparisonFunctionBackIdx.IntValue != ComparisonDefaultValue ) - result += string.Format( "\tCompBack {0}\n", m_comparisonFunctionBackIdx.GetValueOrProperty( StencilBufferOpHelper.StencilComparisonValues[ m_comparisonFunctionBackIdx.IntValue ] ) ); - - if( m_passStencilOpBackIdx.IsValid || m_passStencilOpBackIdx.IntValue != PassStencilOpDefaultValue ) - result += string.Format( "\tPassBack {0}\n", m_passStencilOpBackIdx.GetValueOrProperty( StencilBufferOpHelper.StencilOpsValues[ m_passStencilOpBackIdx.IntValue ] ) ); - - if( m_failStencilOpBackIdx.IsValid || m_failStencilOpBackIdx.IntValue != FailStencilOpDefaultValue ) - result += string.Format( "\tFailBack {0}\n", m_failStencilOpBackIdx.GetValueOrProperty( StencilBufferOpHelper.StencilOpsValues[ m_failStencilOpBackIdx.IntValue ] )); - - if( m_zFailStencilOpBackIdx.IsValid || m_zFailStencilOpBackIdx.IntValue != ZFailStencilOpDefaultValue ) - result += string.Format( "\tZFailBack {0}\n", m_zFailStencilOpBackIdx.GetValueOrProperty( StencilBufferOpHelper.StencilOpsValues[ m_zFailStencilOpBackIdx.IntValue ] )); - } - else - { - if( m_comparisonFunctionFrontIdx.IsValid || m_comparisonFunctionFrontIdx.IntValue != ComparisonDefaultValue ) - result += string.Format( "\tComp {0}\n", m_comparisonFunctionFrontIdx.GetValueOrProperty(StencilBufferOpHelper.StencilComparisonValues[ m_comparisonFunctionFrontIdx.IntValue ] )); - if( m_passStencilOpFrontIdx.IsValid || m_passStencilOpFrontIdx.IntValue != PassStencilOpDefaultValue ) - result += string.Format( "\tPass {0}\n", m_passStencilOpFrontIdx.GetValueOrProperty( StencilBufferOpHelper.StencilOpsValues[ m_passStencilOpFrontIdx.IntValue ] )); - if( m_failStencilOpFrontIdx.IsValid || m_failStencilOpFrontIdx.IntValue != FailStencilOpDefaultValue ) - result += string.Format( "\tFail {0}\n", m_failStencilOpFrontIdx.GetValueOrProperty( StencilBufferOpHelper.StencilOpsValues[ m_failStencilOpFrontIdx.IntValue ] )); - if( m_zFailStencilOpFrontIdx.IsValid || m_zFailStencilOpFrontIdx.IntValue != ZFailStencilOpDefaultValue ) - result += string.Format( "\tZFail {0}\n", m_zFailStencilOpFrontIdx.GetValueOrProperty(StencilBufferOpHelper.StencilOpsValues[ m_zFailStencilOpFrontIdx.IntValue ] )); - } - - result += "}"; - return result; - } - - public override void ShowUnreadableDataMessage( ParentNode owner ) - { - bool foldout = owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedStencilOptions; - NodeUtils.DrawPropertyGroup( ref foldout, FoldoutLabelStr, base.ShowUnreadableDataMessage ); - owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedStencilOptions = foldout; - } - - public void Draw( UndoParentNode owner, CullMode cullMode , bool style = true ) - { - bool foldout = owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedStencilOptions; - if( style ) - { - NodeUtils.DrawPropertyGroup( ref foldout, FoldoutLabelStr, () => - { - DrawBlock( owner, cullMode ); - } ); - } - else - { - NodeUtils.DrawNestedPropertyGroup( owner, ref foldout, ref m_active, FoldoutLabelStr, () => - { - DrawBlock( owner, cullMode ); - } ); - } - owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedStencilOptions = foldout; - } - - void DrawBlock( UndoParentNode owner, CullMode cullMode ) - { - bool guiEnabled = GUI.enabled; - GUI.enabled = m_active; - EditorGUI.BeginChangeCheck(); - { - m_reference.IntSlider( ref owner, ReferenceValueContent, 0, 255 ); - m_readMask.IntSlider( ref owner, ReadMaskContent, 0, 255 ); - m_writeMask.IntSlider( ref owner, WriteMaskContent, 0, 255 ); - if( cullMode == CullMode.Off ) - { - m_comparisonFunctionFrontIdx.EnumTypePopup( ref owner, ComparisonFrontStr, StencilBufferOpHelper.StencilComparisonLabels ); - m_passStencilOpFrontIdx.EnumTypePopup( ref owner, PassFrontStr, StencilBufferOpHelper.StencilOpsLabels ); - m_failStencilOpFrontIdx.EnumTypePopup( ref owner, FailFrontStr, StencilBufferOpHelper.StencilOpsLabels ); - m_zFailStencilOpFrontIdx.EnumTypePopup( ref owner, ZFailFrontStr, StencilBufferOpHelper.StencilOpsLabels ); - EditorGUILayout.Separator(); - m_comparisonFunctionBackIdx.EnumTypePopup( ref owner, ComparisonBackStr, StencilBufferOpHelper.StencilComparisonLabels ); - m_passStencilOpBackIdx.EnumTypePopup( ref owner, PassBackStr, StencilBufferOpHelper.StencilOpsLabels ); - m_failStencilOpBackIdx.EnumTypePopup( ref owner, FailBackStr, StencilBufferOpHelper.StencilOpsLabels ); - m_zFailStencilOpBackIdx.EnumTypePopup( ref owner, ZFailBackStr, StencilBufferOpHelper.StencilOpsLabels ); - } - else - { - m_comparisonFunctionFrontIdx.EnumTypePopup( ref owner, ComparisonStr, StencilBufferOpHelper.StencilComparisonLabels ); - m_passStencilOpFrontIdx.EnumTypePopup( ref owner, PassFrontStr, StencilBufferOpHelper.StencilOpsLabels ); - m_failStencilOpFrontIdx.EnumTypePopup( ref owner, FailFrontStr, StencilBufferOpHelper.StencilOpsLabels ); - m_zFailStencilOpFrontIdx.EnumTypePopup( ref owner, ZFailFrontStr, StencilBufferOpHelper.StencilOpsLabels ); - } - } - if( EditorGUI.EndChangeCheck() ) - { - m_isDirty = true; - } - GUI.enabled = guiEnabled; - } - - public override void ReadFromString( ref uint index, ref string[] nodeParams ) - { - bool validDataOnMeta = m_validData; - if( UIUtils.CurrentShaderVersion() > TemplatesManager.MPShaderVersion ) - { - validDataOnMeta = Convert.ToBoolean( nodeParams[ index++ ] ); - } - - if( validDataOnMeta ) - { - if( UIUtils.CurrentShaderVersion() > 15307 ) - { - m_active = Convert.ToBoolean( nodeParams[ index++ ] ); - } - - if( UIUtils.CurrentShaderVersion() < 15304 ) - { - m_reference.IntValue = Convert.ToInt32( nodeParams[ index++ ] ); - m_readMask.IntValue = Convert.ToInt32( nodeParams[ index++ ] ); - m_writeMask.IntValue = Convert.ToInt32( nodeParams[ index++ ] ); - m_comparisonFunctionFrontIdx.IntValue = Convert.ToInt32( nodeParams[ index++ ] ); - m_passStencilOpFrontIdx.IntValue = Convert.ToInt32( nodeParams[ index++ ] ); - m_failStencilOpFrontIdx.IntValue = Convert.ToInt32( nodeParams[ index++ ] ); - m_zFailStencilOpFrontIdx.IntValue = Convert.ToInt32( nodeParams[ index++ ] ); - m_comparisonFunctionBackIdx.IntValue = Convert.ToInt32( nodeParams[ index++ ] ); - m_passStencilOpBackIdx.IntValue = Convert.ToInt32( nodeParams[ index++ ] ); - m_failStencilOpBackIdx.IntValue = Convert.ToInt32( nodeParams[ index++ ] ); - m_zFailStencilOpBackIdx.IntValue = Convert.ToInt32( nodeParams[ index++ ] ); - } - else - { - m_reference.ReadFromString( ref index, ref nodeParams ); - m_readMask.ReadFromString( ref index, ref nodeParams ); - m_writeMask.ReadFromString( ref index, ref nodeParams ); - m_comparisonFunctionFrontIdx.ReadFromString( ref index, ref nodeParams ); - m_passStencilOpFrontIdx.ReadFromString( ref index, ref nodeParams ); - m_failStencilOpFrontIdx.ReadFromString( ref index, ref nodeParams ); - m_zFailStencilOpFrontIdx.ReadFromString( ref index, ref nodeParams ); - m_comparisonFunctionBackIdx.ReadFromString( ref index, ref nodeParams ); - m_passStencilOpBackIdx.ReadFromString( ref index, ref nodeParams ); - m_failStencilOpBackIdx.ReadFromString( ref index, ref nodeParams ); - m_zFailStencilOpBackIdx.ReadFromString( ref index, ref nodeParams ); - } - - } - } - - public override void WriteToString( ref string nodeInfo ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_validData ); - if( m_validData ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_active ); - m_reference.WriteToString( ref nodeInfo ); - m_readMask.WriteToString( ref nodeInfo ); - m_writeMask.WriteToString( ref nodeInfo ); - m_comparisonFunctionFrontIdx.WriteToString( ref nodeInfo ); - m_passStencilOpFrontIdx.WriteToString( ref nodeInfo ); - m_failStencilOpFrontIdx.WriteToString( ref nodeInfo ); - m_zFailStencilOpFrontIdx.WriteToString( ref nodeInfo ); - m_comparisonFunctionBackIdx.WriteToString( ref nodeInfo ); - m_passStencilOpBackIdx.WriteToString( ref nodeInfo ); - m_failStencilOpBackIdx.WriteToString( ref nodeInfo ); - m_zFailStencilOpBackIdx.WriteToString( ref nodeInfo ); - } - } - - public override void Destroy() - { - m_comparisonDict.Clear(); - m_comparisonDict = null; - - m_stencilOpsDict.Clear(); - m_stencilOpsDict = null; - - m_reference = null; - m_readMask = null; - m_writeMask = null; - m_comparisonFunctionFrontIdx = null; - m_passStencilOpFrontIdx = null; - m_failStencilOpFrontIdx = null; - m_zFailStencilOpFrontIdx = null; - m_comparisonFunctionBackIdx = null; - m_passStencilOpBackIdx = null; - m_failStencilOpBackIdx = null; - m_zFailStencilOpBackIdx = null; - } - public bool Active { get { return m_active; } } - public InlineProperty Reference { get { return m_reference; } } - public InlineProperty ReadMask { get { return m_readMask; } } - public InlineProperty WriteMask { get { return m_writeMask; } } - public InlineProperty ComparisonFunctionIdx { get { return m_comparisonFunctionFrontIdx; } } - public InlineProperty ComparisonFunctionBackIdx { get { return m_comparisonFunctionBackIdx; } } - public InlineProperty PassStencilOpIdx { get { return m_passStencilOpFrontIdx; } } - public InlineProperty PassStencilOpBackIdx { get { return m_passStencilOpBackIdx; } } - public InlineProperty FailStencilOpIdx { get { return m_failStencilOpFrontIdx; } } - public InlineProperty FailStencilOpBackIdx { get { return m_failStencilOpBackIdx; } } - public InlineProperty ZFailStencilOpIdx { get { return m_zFailStencilOpFrontIdx; } } - public InlineProperty ZFailStencilOpBackIdx { get { return m_zFailStencilOpBackIdx; } } - - - public int ReferenceValue - { - set - { - m_reference.IntValue = value; - m_reference.Active = false; - } - get - { - return m_reference.IntValue; - } - } - - public int ReadMaskValue - { - set - { - m_readMask.IntValue = value; - m_reference.Active = false; - } - get - { - return m_readMask.IntValue; - } - } - - public int WriteMaskValue - { - set - { - m_writeMask.IntValue = value; - m_writeMask.Active = false; - } - get - { - return m_writeMask.IntValue; - } - } - - public int ComparisonFunctionIdxValue - { - set - { - m_comparisonFunctionFrontIdx.IntValue = value; - m_comparisonFunctionFrontIdx.Active = false; - } - get - { - return m_comparisonFunctionFrontIdx.IntValue; - } - } - - public int ComparisonFunctionBackIdxValue - { - set - { - m_comparisonFunctionBackIdx.IntValue = value; - m_comparisonFunctionBackIdx.Active = false; - } - get - { - return m_comparisonFunctionBackIdx.IntValue; - } - } - - public int PassStencilOpIdxValue - { - set - { - m_passStencilOpFrontIdx.IntValue = value; - m_passStencilOpFrontIdx.Active = false; - } - get - { - return m_passStencilOpFrontIdx.IntValue; - } - } - - public int PassStencilOpBackIdxValue - { - set - { - m_passStencilOpBackIdx.IntValue = value; - m_passStencilOpBackIdx.Active = false; - } - get - { - return m_passStencilOpBackIdx.IntValue; - } - } - - public int FailStencilOpIdxValue - { - set - { - m_failStencilOpFrontIdx.IntValue = value; - m_failStencilOpFrontIdx.Active = false; - } - get - { - return m_failStencilOpFrontIdx.IntValue; - } - } - public int FailStencilOpBackIdxValue - { - set - { - m_failStencilOpBackIdx.IntValue = value; - m_failStencilOpBackIdx.Active = false; - } - get - { - return m_failStencilOpBackIdx.IntValue; - } - } - - public int ZFailStencilOpIdxValue - { - set - { - m_zFailStencilOpFrontIdx.IntValue = value; - m_zFailStencilOpFrontIdx.Active = false; - } - get - { - return m_zFailStencilOpFrontIdx.IntValue; - } - } - - public int ZFailStencilOpBackIdxValue - { - set - { - m_zFailStencilOpBackIdx.IntValue = value; - m_zFailStencilOpBackIdx.Active = false; - } - get - { - return m_zFailStencilOpBackIdx.IntValue; - } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatesStencilBufferModule.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatesStencilBufferModule.cs.meta deleted file mode 100644 index 552dbaf7..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Templates/TemplatesStencilBufferModule.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: fa41b984209fa624aa1fdea5949d9d59 -timeCreated: 1511548974 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Utils.meta deleted file mode 100644 index f81a149d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 77f9dcd6b7a403a47b926073779ee42f -folderAsset: yes -timeCreated: 1481126944 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/ASEPPSHelperTool.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/ASEPPSHelperTool.cs deleted file mode 100644 index e009c04f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/ASEPPSHelperTool.cs +++ /dev/null @@ -1,460 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> -using System; -using UnityEngine; -using UnityEditor; -using System.Collections.Generic; -//using UnityEngine.Rendering.PostProcessing; - - -namespace AmplifyShaderEditor -{ - public enum ASEPostProcessEvent - { - BeforeTransparent = 0, - BeforeStack = 1, - AfterStack = 2 - } - - [Serializable] - public class ASEPPSHelperBuffer - { - public string Name; - public string Tooltip; - } - - [Serializable] - public class ASEPPSHelperTool : EditorWindow - { - private const string PPSFullTemplate = - "// Amplify Shader Editor - Visual Shader Editing Tool\n" + - "// Copyright (c) Amplify Creations, Lda <info@amplify.pt>\n" + - "#if UNITY_POST_PROCESSING_STACK_V2\n" + - "using System;\n" + - "using UnityEngine;\n" + - "using UnityEngine.Rendering.PostProcessing;\n" + - "\n" + - "[Serializable]\n" + - "[PostProcess( typeof( /*PPSRendererClass*/ ), PostProcessEvent./*PPSEventType*/, \"/*PPSMenuEntry*/\", /*AllowInSceneView*/ )]\n" + - "public sealed class /*PPSSettingsClass*/ : PostProcessEffectSettings\n" + - "{\n" + - "/*PPSPropertiesDeclaration*/" + - "}\n" + - "\n" + - "public sealed class /*PPSRendererClass*/ : PostProcessEffectRenderer</*PPSSettingsClass*/>\n" + - "{\n" + - "\tpublic override void Render( PostProcessRenderContext context )\n" + - "\t{\n" + - "\t\tvar sheet = context.propertySheets.Get( Shader.Find( \"/*PPSShader*/\" ) );\n" + - "/*PPSPropertySet*/" + - "\t\tcontext.command.BlitFullscreenTriangle( context.source, context.destination, sheet, 0 );\n" + - "\t}\n" + - "}\n" + - "#endif\n"; - - private const string PPSEventType = "/*PPSEventType*/"; - private const string PPSRendererClass = "/*PPSRendererClass*/"; - private const string PPSSettingsClass = "/*PPSSettingsClass*/"; - private const string PPSMenuEntry = "/*PPSMenuEntry*/"; - private const string PPSAllowInSceneView = "/*AllowInSceneView*/"; - private const string PPSShader = "/*PPSShader*/"; - private const string PPSPropertiesDecl = "/*PPSPropertiesDeclaration*/"; - private const string PPSPropertySet = "/*PPSPropertySet*/"; - - public static readonly string PPSPropertySetFormat = "\t\tsheet.properties.{0}( \"{1}\", settings.{1} );\n"; - public static readonly string PPSPropertySetNullPointerCheckFormat = "\t\tif(settings.{1}.value != null) sheet.properties.{0}( \"{1}\", settings.{1} );\n"; - public static readonly string PPSPropertyDecFormat = - "\t[{0}Tooltip( \"{1}\" )]\n" + - "\tpublic {2} {3} = new {2} {{ {4} }};\n"; - public static readonly Dictionary<WirePortDataType, string> WireToPPSType = new Dictionary<WirePortDataType, string>() - { - { WirePortDataType.FLOAT,"FloatParameter"}, - { WirePortDataType.FLOAT2,"Vector4Parameter"}, - { WirePortDataType.FLOAT3,"Vector4Parameter"}, - { WirePortDataType.FLOAT4,"Vector4Parameter"}, - { WirePortDataType.COLOR,"ColorParameter"}, - { WirePortDataType.SAMPLER1D,"TextureParameter"}, - { WirePortDataType.SAMPLER2D,"TextureParameter"}, - { WirePortDataType.SAMPLER3D,"TextureParameter"}, - { WirePortDataType.SAMPLERCUBE,"TextureParameter"} - }; - - public static readonly Dictionary<WirePortDataType, string> WireToPPSValueSet = new Dictionary<WirePortDataType, string>() - { - { WirePortDataType.FLOAT,"SetFloat"}, - { WirePortDataType.FLOAT2,"SetVector"}, - { WirePortDataType.FLOAT3,"SetVector"}, - { WirePortDataType.FLOAT4,"SetVector"}, - { WirePortDataType.COLOR,"SetColor"}, - { WirePortDataType.SAMPLER1D, "SetTexture"}, - { WirePortDataType.SAMPLER2D, "SetTexture"}, - { WirePortDataType.SAMPLER3D, "SetTexture"}, - { WirePortDataType.SAMPLERCUBE,"SetTexture"} - }; - - public static readonly Dictionary<UnityEditor.ShaderUtil.ShaderPropertyType, string> ShaderPropertyToPPSType = new Dictionary<UnityEditor.ShaderUtil.ShaderPropertyType, string>() - { - { UnityEditor.ShaderUtil.ShaderPropertyType.Float,"FloatParameter"}, - { UnityEditor.ShaderUtil.ShaderPropertyType.Range,"FloatParameter"}, - { UnityEditor.ShaderUtil.ShaderPropertyType.Vector,"Vector4Parameter"}, - { UnityEditor.ShaderUtil.ShaderPropertyType.Color,"ColorParameter"}, - { UnityEditor.ShaderUtil.ShaderPropertyType.TexEnv,"TextureParameter"} - }; - - - public static readonly Dictionary<UnityEditor.ShaderUtil.ShaderPropertyType, string> ShaderPropertyToPPSSet = new Dictionary<UnityEditor.ShaderUtil.ShaderPropertyType, string>() - { - { UnityEditor.ShaderUtil.ShaderPropertyType.Float,"SetFloat"}, - { UnityEditor.ShaderUtil.ShaderPropertyType.Range,"SetFloat"}, - { UnityEditor.ShaderUtil.ShaderPropertyType.Vector,"SetVector"}, - { UnityEditor.ShaderUtil.ShaderPropertyType.Color,"SetColor"}, - { UnityEditor.ShaderUtil.ShaderPropertyType.TexEnv,"SetTexture"} - }; - - private Dictionary<string, bool> m_excludedProperties = new Dictionary<string, bool> - { - { "_texcoord",true }, - { "__dirty",true} - }; - - private Material m_dummyMaterial = null; - - private DragAndDropTool m_dragAndDropTool; - private Rect m_draggableArea; - - [SerializeField] - private string m_rendererClassName = "PPSRenderer"; - - [SerializeField] - private string m_settingsClassName = "PPSSettings"; - - [SerializeField] - private string m_folderPath = "Assets/"; - - [SerializeField] - private string m_menuEntry = string.Empty; - - [SerializeField] - private bool m_allowInSceneView = true; - - [SerializeField] - private ASEPostProcessEvent m_eventType = ASEPostProcessEvent.AfterStack; - - [SerializeField] - private Shader m_currentShader = null; - - [SerializeField] - private List<ASEPPSHelperBuffer> m_tooltips = new List<ASEPPSHelperBuffer>(); - - [SerializeField] - private bool m_tooltipsFoldout = true; - - private GUIStyle m_contentStyle = null; - private GUIStyle m_pathButtonStyle = null; - private GUIContent m_pathButtonContent = new GUIContent(); - private Vector2 m_scrollPos = Vector2.zero; - - [MenuItem( "Window/Amplify Shader Editor/Post-Processing Stack Tool", false, 1001 )] - static void ShowWindow() - { - ASEPPSHelperTool window = EditorWindow.GetWindow<ASEPPSHelperTool>(); - window.titleContent.text = "Post-Processing Stack Tool"; - window.minSize = new Vector2( 302, 350 ); - window.Show(); - } - - void FetchTooltips() - { - m_tooltips.Clear(); - int propertyCount = UnityEditor.ShaderUtil.GetPropertyCount( m_currentShader ); - for( int i = 0; i < propertyCount; i++ ) - { - //UnityEditor.ShaderUtil.ShaderPropertyType type = UnityEditor.ShaderUtil.GetPropertyType( m_currentShader, i ); - string name = UnityEditor.ShaderUtil.GetPropertyName( m_currentShader, i ); - string description = UnityEditor.ShaderUtil.GetPropertyDescription( m_currentShader, i ); - - if( m_excludedProperties.ContainsKey( name )) - continue; - - m_tooltips.Add( new ASEPPSHelperBuffer { Name = name, Tooltip = description } ); - } - } - - void OnGUI() - { - if( m_pathButtonStyle == null ) - m_pathButtonStyle = "minibutton"; - - m_scrollPos = EditorGUILayout.BeginScrollView( m_scrollPos, GUILayout.Height( position.height ) ); - - EditorGUILayout.BeginVertical( m_contentStyle ); - EditorGUI.BeginChangeCheck(); - m_currentShader = EditorGUILayout.ObjectField( "Shader", m_currentShader, typeof( Shader ), false ) as Shader; - if( EditorGUI.EndChangeCheck() ) - { - GetInitialInfo( m_currentShader ); - } - - EditorGUILayout.Separator(); - EditorGUILayout.LabelField( "Path and Filename" ); - EditorGUILayout.BeginHorizontal(); - m_pathButtonContent.text = m_folderPath; - Vector2 buttonSize = m_pathButtonStyle.CalcSize( m_pathButtonContent ); - if( GUILayout.Button( m_pathButtonContent, m_pathButtonStyle, GUILayout.MaxWidth( Mathf.Min( position.width * 0.5f, buttonSize.x ) ) ) ) - { - string folderpath = EditorUtility.OpenFolderPanel( "Save Texture Array to folder", "Assets/", "" ); - folderpath = FileUtil.GetProjectRelativePath( folderpath ); - if( string.IsNullOrEmpty( folderpath ) ) - m_folderPath = "Assets/"; - else - m_folderPath = folderpath + "/"; - } - - m_settingsClassName = EditorGUILayout.TextField( m_settingsClassName, GUILayout.ExpandWidth( true ) ); - - EditorGUILayout.LabelField( ".cs", GUILayout.MaxWidth( 40 ) ); - EditorGUILayout.EndHorizontal(); - EditorGUILayout.Separator(); - - m_menuEntry = EditorGUILayout.TextField( "Name", m_menuEntry ); - - EditorGUILayout.Separator(); - - m_allowInSceneView = EditorGUILayout.Toggle( "Allow In Scene View", m_allowInSceneView ); - - EditorGUILayout.Separator(); - - m_eventType = (ASEPostProcessEvent)EditorGUILayout.EnumPopup( "Event Type", m_eventType ); - - EditorGUILayout.Separator(); - - m_tooltipsFoldout = EditorGUILayout.Foldout( m_tooltipsFoldout, "Tooltips" ); - if( m_tooltipsFoldout ) - { - EditorGUI.indentLevel++; - for( int i = 0; i < m_tooltips.Count; i++ ) - { - m_tooltips[ i ].Tooltip = EditorGUILayout.TextField( m_tooltips[ i ].Name, m_tooltips[ i ].Tooltip ); - } - EditorGUI.indentLevel--; - } - - EditorGUILayout.Separator(); - - if( GUILayout.Button( "Build" ) ) - { - System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture; - string propertiesDecl = string.Empty; - string propertiesSet = string.Empty; - GetShaderInfoFromShaderAsset( ref propertiesDecl, ref propertiesSet ); - string template = PPSFullTemplate; - template = template.Replace( PPSRendererClass, m_rendererClassName ); - template = template.Replace( PPSSettingsClass, m_settingsClassName ); - template = template.Replace( PPSEventType, m_eventType.ToString() ); - template = template.Replace( PPSPropertiesDecl, propertiesDecl ); - template = template.Replace( PPSPropertySet, propertiesSet ); - template = template.Replace( PPSMenuEntry, m_menuEntry ); - template = template.Replace( PPSAllowInSceneView, m_allowInSceneView?"true":"false" ); - template = template.Replace( PPSShader, m_currentShader.name ); - string path = m_folderPath + m_settingsClassName + ".cs"; - IOUtils.SaveTextfileToDisk( template, path, false ); - System.Threading.Thread.CurrentThread.CurrentCulture = System.Threading.Thread.CurrentThread.CurrentUICulture; - AssetDatabase.Refresh(); - } - - EditorGUILayout.EndVertical(); - EditorGUILayout.EndScrollView(); - m_draggableArea.size = position.size; - m_dragAndDropTool.TestDragAndDrop( m_draggableArea ); - } - - public void GetShaderInfoFromASE( ref string propertiesDecl, ref string propertiesSet ) - { - List<PropertyNode> properties = UIUtils.CurrentWindow.OutsideGraph.PropertyNodes.NodesList; - int propertyCount = properties.Count; - for( int i = 0; i < propertyCount; i++ ) - { - properties[ i ].GeneratePPSInfo( ref propertiesDecl, ref propertiesSet ); - } - } - - public void GetShaderInfoFromShaderAsset( ref string propertiesDecl, ref string propertiesSet ) - { - bool fetchInitialInfo = false; - if( m_currentShader == null ) - { - Material mat = Selection.activeObject as Material; - if( mat != null ) - { - m_currentShader = mat.shader; - } - else - { - m_currentShader = Selection.activeObject as Shader; - } - fetchInitialInfo = true; - } - - if( m_currentShader != null ) - { - if( fetchInitialInfo ) - GetInitialInfo( m_currentShader ); - - if( m_dummyMaterial == null ) - { - m_dummyMaterial = new Material( m_currentShader ); - } - else - { - m_dummyMaterial.shader = m_currentShader; - } - - int propertyCount = UnityEditor.ShaderUtil.GetPropertyCount( m_currentShader ); - //string allProperties = string.Empty; - int validIds = 0; - for( int i = 0; i < propertyCount; i++ ) - { - UnityEditor.ShaderUtil.ShaderPropertyType type = UnityEditor.ShaderUtil.GetPropertyType( m_currentShader, i ); - string name = UnityEditor.ShaderUtil.GetPropertyName( m_currentShader, i ); - //string description = UnityEditor.ShaderUtil.GetPropertyDescription( m_currentShader, i ); - if( m_excludedProperties.ContainsKey( name )) - continue; - - string defaultValue = string.Empty; - bool nullPointerCheck = false; - switch( type ) - { - case UnityEditor.ShaderUtil.ShaderPropertyType.Color: - { - Color value = m_dummyMaterial.GetColor( name ); - defaultValue = string.Format( "value = new Color({0}f,{1}f,{2}f,{3}f)", value.r, value.g, value.b, value.a ); - } - break; - case UnityEditor.ShaderUtil.ShaderPropertyType.Vector: - { - Vector4 value = m_dummyMaterial.GetVector( name ); - defaultValue = string.Format( "value = new Vector4({0}f,{1}f,{2}f,{3}f)", value.x, value.y, value.z, value.w ); - } - break; - case UnityEditor.ShaderUtil.ShaderPropertyType.Float: - { - float value = m_dummyMaterial.GetFloat( name ); - defaultValue = "value = " + value + "f"; - } - break; - case UnityEditor.ShaderUtil.ShaderPropertyType.Range: - { - float value = m_dummyMaterial.GetFloat( name ); - defaultValue = "value = " + value + "f"; - } - break; - case UnityEditor.ShaderUtil.ShaderPropertyType.TexEnv: - { - nullPointerCheck = true; - } - break; - } - - propertiesDecl += string.Format( PPSPropertyDecFormat, string.Empty, m_tooltips[ validIds ].Tooltip, ShaderPropertyToPPSType[ type ], name, defaultValue ); - propertiesSet += string.Format( nullPointerCheck ? PPSPropertySetNullPointerCheckFormat : PPSPropertySetFormat, ShaderPropertyToPPSSet[ type ], name ); - validIds++; - } - - } - } - - private void GetInitialInfo() - { - MasterNode masterNode = UIUtils.CurrentWindow.OutsideGraph.CurrentMasterNode; - m_menuEntry = masterNode.ShaderName.Replace( "Hidden/", string.Empty ).Replace( ".shader", string.Empty ); - string name = m_menuEntry; - m_rendererClassName = name + "PPSRenderer"; - m_settingsClassName = name + "PPSSettings"; - m_folderPath = "Assets/"; - } - - private void GetInitialInfo( Shader shader ) - { - if( shader == null ) - { - m_scrollPos = Vector2.zero; - m_menuEntry = string.Empty; - m_rendererClassName = "PPSRenderer"; - m_settingsClassName = "PPSSettings"; - m_folderPath = "Assets/"; - m_tooltips.Clear(); - return; - } - - m_menuEntry = shader.name.Replace( "Hidden/", string.Empty ).Replace( ".shader", string.Empty ); - m_menuEntry = UIUtils.RemoveInvalidCharacters( m_menuEntry ); - string name = m_menuEntry.Replace( "/", string.Empty ); - m_rendererClassName = name + "PPSRenderer"; - m_settingsClassName = name + "PPSSettings"; - m_folderPath = AssetDatabase.GetAssetPath( shader ); - m_folderPath = m_folderPath.Replace( System.IO.Path.GetFileName( m_folderPath ), string.Empty ); - - FetchTooltips(); - } - - public void OnValidObjectsDropped( UnityEngine.Object[] droppedObjs ) - { - for( int objIdx = 0; objIdx < droppedObjs.Length; objIdx++ ) - { - Material mat = droppedObjs[ objIdx ] as Material; - if( mat != null ) - { - m_currentShader = mat.shader; - GetInitialInfo( mat.shader ); - return; - } - else - { - Shader shader = droppedObjs[ objIdx ] as Shader; - if( shader != null ) - { - m_currentShader = shader; - GetInitialInfo( shader ); - return; - } - } - } - } - - private void OnEnable() - { - m_draggableArea = new Rect( 0, 0, 1, 1 ); - m_dragAndDropTool = new DragAndDropTool(); - m_dragAndDropTool.OnValidDropObjectEvt += OnValidObjectsDropped; - - if( m_contentStyle == null ) - { - m_contentStyle = new GUIStyle( GUIStyle.none ); - m_contentStyle.margin = new RectOffset( 6, 4, 5, 5 ); - } - - m_pathButtonStyle = null; - - //GetInitialInfo(); - } - - private void OnDestroy() - { - if( m_dummyMaterial != null ) - { - GameObject.DestroyImmediate( m_dummyMaterial ); - m_dummyMaterial = null; - } - - m_dragAndDropTool.Destroy(); - m_dragAndDropTool = null; - - m_tooltips.Clear(); - m_tooltips = null; - - m_contentStyle = null; - m_pathButtonStyle = null; - m_currentShader = null; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/ASEPPSHelperTool.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/ASEPPSHelperTool.cs.meta deleted file mode 100644 index 581a6221..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/ASEPPSHelperTool.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: ccaa3765dae023d4b8657544c1aeef4a -timeCreated: 1550254201 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/ASEPackageManagerHelper.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/ASEPackageManagerHelper.cs deleted file mode 100644 index 9336c150..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/ASEPackageManagerHelper.cs +++ /dev/null @@ -1,540 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> -#if UNITY_2018_3_OR_NEWER -using System; -using UnityEngine; -using UnityEditor; -using UnityEditor.PackageManager.Requests; -using System.Collections.Generic; -using System.IO; -using System.Reflection; - -namespace AmplifyShaderEditor -{ - public enum ASESRPVersions - { - ASE_SRP_3_0_0 = 030000, - ASE_SRP_3_1_0 = 030100, - ASE_SRP_3_3_0 = 030300, - ASE_SRP_4_1_0 = 040100, - ASE_SRP_4_2_0 = 040200, - ASE_SRP_4_3_0 = 040300, - ASE_SRP_4_6_0 = 040600, - ASE_SRP_4_8_0 = 040800, - ASE_SRP_4_9_0 = 040900, - ASE_SRP_4_10_0 = 041000, - ASE_SRP_5_7_2 = 050702, - ASE_SRP_5_8_2 = 050802, - ASE_SRP_5_9_0 = 050900, - ASE_SRP_5_10_0 = 051000, - ASE_SRP_5_13_0 = 051300, - ASE_SRP_5_16_1 = 051601, - ASE_SRP_6_9_0 = 060900, - ASE_SRP_6_9_1 = 060901, - ASE_SRP_6_9_2 = 060902, - ASE_SRP_7_0_1 = 070001, - ASE_SRP_7_1_1 = 070101, - ASE_SRP_7_1_2 = 070102, - ASE_SRP_7_1_5 = 070105, - ASE_SRP_7_1_6 = 070106, - ASE_SRP_7_1_7 = 070107, - ASE_SRP_7_1_8 = 070108, - ASE_SRP_7_2_0 = 070200, - ASE_SRP_7_2_1 = 070201, - ASE_SRP_RECENT = 999999 - } - - public enum ASEImportState - { - None, - Lightweight, - HD, - Both - } - - public static class AssetDatabaseEX - { - private static System.Type type = null; - public static System.Type Type { get { return ( type == null ) ? type = System.Type.GetType( "UnityEditor.AssetDatabase, UnityEditor" ) : type; } } - - public static void ImportPackageImmediately( string packagePath ) - { - AssetDatabaseEX.Type.InvokeMember( "ImportPackageImmediately", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { packagePath } ); - } - } - - - [Serializable] - public static class ASEPackageManagerHelper - { - private static string LightweightNewVersionDetected = "A new Lighweight RP version was detected and new templates are being imported.\n" + - "Please hit the Update button on your ASE canvas to recompile your shader under the newest version."; - - private static string HDNewVersionDetected = "A new HD RP version was detected and new templates are being imported.\n" + - "Please hit the Update button on your ASE canvas to recompile your shader under the newest version."; - - private static string HDPackageId = "com.unity.render-pipelines.high-definition"; - private static string LWPackageId = "com.unity.render-pipelines.lightweight"; - private static string UniversalPackageId = "com.unity.render-pipelines.universal"; - private static string HDEditorPrefsId = "ASEHDEditorPrefsId"; - private static string LWEditorPrefsId = "ASELightweigthEditorPrefsId "; - - private static string URPTemplateVersion = "ASEURPtemplate" + Application.productName; - private static string HDRPTemplateVersion = "ASEHDRPtemplate" + Application.productName; - - private static string SPKeywordFormat = "ASE_SRP_VERSION {0}"; - private static ListRequest m_packageListRequest = null; - private static UnityEditor.PackageManager.PackageInfo m_lwPackageInfo; - private static UnityEditor.PackageManager.PackageInfo m_hdPackageInfo; - - // V4.8.0 and bellow - // HD - private static readonly string[] GetNormalWSFunc = - { - "inline void GetNormalWS( FragInputs input, float3 normalTS, out float3 normalWS, float3 doubleSidedConstants )\n", - "{\n", - "\tGetNormalWS( input, normalTS, normalWS );\n", - "}\n" - }; - - // v4.6.0 and below - private static readonly string[] BuildWordTangentFunc = - { - "float3x3 BuildWorldToTangent(float4 tangentWS, float3 normalWS)\n", - "{\n", - "\tfloat3 unnormalizedNormalWS = normalWS;\n", - "\tfloat renormFactor = 1.0 / length(unnormalizedNormalWS);\n", - "\tfloat3x3 worldToTangent = CreateWorldToTangent(unnormalizedNormalWS, tangentWS.xyz, tangentWS.w > 0.0 ? 1.0 : -1.0);\n", - "\tworldToTangent[0] = worldToTangent[0] * renormFactor;\n", - "\tworldToTangent[1] = worldToTangent[1] * renormFactor;\n", - "\tworldToTangent[2] = worldToTangent[2] * renormFactor;\n", - "\treturn worldToTangent;\n", - "}\n" - }; - - private static bool m_requireUpdateList = false; - private static ASEImportState m_importingPackage = ASEImportState.None; - - - private static ASESRPVersions m_currentHDVersion = ASESRPVersions.ASE_SRP_RECENT; - private static ASESRPVersions m_currentLWVersion = ASESRPVersions.ASE_SRP_RECENT; - - private static int m_urpTemplateVersion = 4; - private static int m_hdrpTemplateVersion = 3; - - private static Dictionary<string, ASESRPVersions> m_srpVersionConverter = new Dictionary<string, ASESRPVersions>() - { - {"3.0.0-preview", ASESRPVersions.ASE_SRP_3_0_0}, - {"3.1.0-preview", ASESRPVersions.ASE_SRP_3_1_0}, - {"3.3.0-preview", ASESRPVersions.ASE_SRP_3_3_0}, - {"4.1.0-preview", ASESRPVersions.ASE_SRP_4_1_0}, - {"4.2.0-preview", ASESRPVersions.ASE_SRP_4_2_0}, - {"4.3.0-preview", ASESRPVersions.ASE_SRP_4_3_0}, - {"4.6.0-preview", ASESRPVersions.ASE_SRP_4_6_0}, - {"4.8.0-preview", ASESRPVersions.ASE_SRP_4_8_0}, - {"4.9.0-preview", ASESRPVersions.ASE_SRP_4_9_0}, - {"4.10.0-preview", ASESRPVersions.ASE_SRP_4_10_0}, - {"5.7.2-preview", ASESRPVersions.ASE_SRP_5_7_2}, - {"5.7.2", ASESRPVersions.ASE_SRP_5_7_2}, - {"5.8.2-preview", ASESRPVersions.ASE_SRP_5_8_2}, - {"5.8.2", ASESRPVersions.ASE_SRP_5_8_2}, - {"5.9.0-preview", ASESRPVersions.ASE_SRP_5_9_0}, - {"5.9.0", ASESRPVersions.ASE_SRP_5_9_0}, - {"5.10.0-preview", ASESRPVersions.ASE_SRP_5_10_0}, - {"5.10.0", ASESRPVersions.ASE_SRP_5_10_0}, - {"5.13.0-preview", ASESRPVersions.ASE_SRP_5_13_0}, - {"5.13.0", ASESRPVersions.ASE_SRP_5_13_0}, - {"5.16.1-preview", ASESRPVersions.ASE_SRP_5_16_1}, - {"5.16.1", ASESRPVersions.ASE_SRP_5_16_1}, - {"6.9.0", ASESRPVersions.ASE_SRP_6_9_0}, - {"6.9.0-preview", ASESRPVersions.ASE_SRP_6_9_0}, - {"6.9.1", ASESRPVersions.ASE_SRP_6_9_1}, - {"6.9.1-preview", ASESRPVersions.ASE_SRP_6_9_1}, - {"6.9.2", ASESRPVersions.ASE_SRP_6_9_2}, - {"6.9.2-preview", ASESRPVersions.ASE_SRP_6_9_2}, - {"7.0.1", ASESRPVersions.ASE_SRP_7_0_1}, - {"7.0.1-preview", ASESRPVersions.ASE_SRP_7_0_1}, - {"7.1.1", ASESRPVersions.ASE_SRP_7_1_1}, - {"7.1.1-preview", ASESRPVersions.ASE_SRP_7_1_1}, - {"7.1.2", ASESRPVersions.ASE_SRP_7_1_2}, - {"7.1.2-preview", ASESRPVersions.ASE_SRP_7_1_2}, - {"7.1.5", ASESRPVersions.ASE_SRP_7_1_5}, - {"7.1.5-preview", ASESRPVersions.ASE_SRP_7_1_5}, - {"7.1.6", ASESRPVersions.ASE_SRP_7_1_6}, - {"7.1.6-preview", ASESRPVersions.ASE_SRP_7_1_6}, - {"7.1.7", ASESRPVersions.ASE_SRP_7_1_7}, - {"7.1.7-preview", ASESRPVersions.ASE_SRP_7_1_7}, - {"7.1.8", ASESRPVersions.ASE_SRP_7_1_8}, - {"7.1.8-preview", ASESRPVersions.ASE_SRP_7_1_8}, - {"7.2.0", ASESRPVersions.ASE_SRP_7_2_0}, - {"7.2.0-preview", ASESRPVersions.ASE_SRP_7_2_0}, - {"7.2.1", ASESRPVersions.ASE_SRP_7_2_1}, - {"7.2.1-preview", ASESRPVersions.ASE_SRP_7_2_1}, - }; - - - - private static Dictionary<ASESRPVersions, string> m_srpToASEPackageLW = new Dictionary<ASESRPVersions, string>() - { - {ASESRPVersions.ASE_SRP_3_0_0, "b53d2f3b156ff104f90d4d7693d769c8"}, - {ASESRPVersions.ASE_SRP_3_1_0, "b53d2f3b156ff104f90d4d7693d769c8"}, - {ASESRPVersions.ASE_SRP_3_3_0, "b53d2f3b156ff104f90d4d7693d769c8"}, - {ASESRPVersions.ASE_SRP_4_1_0, "3e8eabcfae1e5aa4397de89fedeb48db"}, - {ASESRPVersions.ASE_SRP_4_2_0, "3e8eabcfae1e5aa4397de89fedeb48db"}, - {ASESRPVersions.ASE_SRP_4_3_0, "3e8eabcfae1e5aa4397de89fedeb48db"}, - {ASESRPVersions.ASE_SRP_4_6_0, "3e8eabcfae1e5aa4397de89fedeb48db"}, - {ASESRPVersions.ASE_SRP_4_8_0, "3e8eabcfae1e5aa4397de89fedeb48db"}, - {ASESRPVersions.ASE_SRP_4_9_0, "3e8eabcfae1e5aa4397de89fedeb48db"}, - {ASESRPVersions.ASE_SRP_4_10_0, "3e8eabcfae1e5aa4397de89fedeb48db"}, - {ASESRPVersions.ASE_SRP_5_7_2, "4c816894a3147d343891060451241bfe"}, - {ASESRPVersions.ASE_SRP_5_8_2, "4c816894a3147d343891060451241bfe"}, - {ASESRPVersions.ASE_SRP_5_9_0, "4c816894a3147d343891060451241bfe"}, - {ASESRPVersions.ASE_SRP_5_10_0, "4c816894a3147d343891060451241bfe"}, - {ASESRPVersions.ASE_SRP_5_13_0, "4c816894a3147d343891060451241bfe"}, - {ASESRPVersions.ASE_SRP_5_16_1, "4c816894a3147d343891060451241bfe"}, - {ASESRPVersions.ASE_SRP_6_9_0, "4c816894a3147d343891060451241bfe"}, - {ASESRPVersions.ASE_SRP_6_9_1, "4c816894a3147d343891060451241bfe"}, - {ASESRPVersions.ASE_SRP_6_9_2, "4c816894a3147d343891060451241bfe"}, - {ASESRPVersions.ASE_SRP_7_0_1, "57fcea0ed8b5eb347923c4c21fa31b57"}, - {ASESRPVersions.ASE_SRP_7_1_1, "57fcea0ed8b5eb347923c4c21fa31b57"}, - {ASESRPVersions.ASE_SRP_7_1_2, "57fcea0ed8b5eb347923c4c21fa31b57"}, - {ASESRPVersions.ASE_SRP_7_1_5, "57fcea0ed8b5eb347923c4c21fa31b57"}, - {ASESRPVersions.ASE_SRP_7_1_6, "57fcea0ed8b5eb347923c4c21fa31b57"}, - {ASESRPVersions.ASE_SRP_7_1_7, "57fcea0ed8b5eb347923c4c21fa31b57"}, - {ASESRPVersions.ASE_SRP_7_1_8, "57fcea0ed8b5eb347923c4c21fa31b57"}, - {ASESRPVersions.ASE_SRP_7_2_0, "57fcea0ed8b5eb347923c4c21fa31b57"}, - {ASESRPVersions.ASE_SRP_7_2_1, "57fcea0ed8b5eb347923c4c21fa31b57"}, - {ASESRPVersions.ASE_SRP_RECENT, "57fcea0ed8b5eb347923c4c21fa31b57"} - }; - - private static Dictionary<ASESRPVersions, string> m_srpToASEPackageHD = new Dictionary<ASESRPVersions, string>() - { - {ASESRPVersions.ASE_SRP_3_0_0, "4dc1afbcc68875c4780502f5e6b80158"}, - {ASESRPVersions.ASE_SRP_3_1_0, "4dc1afbcc68875c4780502f5e6b80158"}, - {ASESRPVersions.ASE_SRP_3_3_0, "4dc1afbcc68875c4780502f5e6b80158"}, - {ASESRPVersions.ASE_SRP_4_1_0, "5d615bf612f33364e96fb9fd2959ae9c"}, - {ASESRPVersions.ASE_SRP_4_2_0, "5d615bf612f33364e96fb9fd2959ae9c"}, - {ASESRPVersions.ASE_SRP_4_3_0, "5d615bf612f33364e96fb9fd2959ae9c"}, - {ASESRPVersions.ASE_SRP_4_6_0, "5d615bf612f33364e96fb9fd2959ae9c"}, - {ASESRPVersions.ASE_SRP_4_8_0, "5d615bf612f33364e96fb9fd2959ae9c"}, - {ASESRPVersions.ASE_SRP_4_9_0, "5d615bf612f33364e96fb9fd2959ae9c"}, - {ASESRPVersions.ASE_SRP_4_10_0, "5d615bf612f33364e96fb9fd2959ae9c"}, - {ASESRPVersions.ASE_SRP_5_7_2, "f51b7b861facbc3429fcc5f1f6f91183"}, - {ASESRPVersions.ASE_SRP_5_8_2, "2d7fe4f7c19e90f41b893bc01fc17230"}, - {ASESRPVersions.ASE_SRP_5_9_0, "2d7fe4f7c19e90f41b893bc01fc17230"}, - {ASESRPVersions.ASE_SRP_5_10_0, "2d7fe4f7c19e90f41b893bc01fc17230"}, - {ASESRPVersions.ASE_SRP_5_13_0, "2d7fe4f7c19e90f41b893bc01fc17230"}, - {ASESRPVersions.ASE_SRP_5_16_1, "2d7fe4f7c19e90f41b893bc01fc17230"}, - {ASESRPVersions.ASE_SRP_6_9_0, "e137dba02f4d0f542ab09dcedea27314"}, - {ASESRPVersions.ASE_SRP_6_9_1, "e137dba02f4d0f542ab09dcedea27314"}, - {ASESRPVersions.ASE_SRP_6_9_2, "e137dba02f4d0f542ab09dcedea27314"}, - {ASESRPVersions.ASE_SRP_7_0_1, "e137dba02f4d0f542ab09dcedea27314"}, - {ASESRPVersions.ASE_SRP_7_1_1, "e137dba02f4d0f542ab09dcedea27314"}, - {ASESRPVersions.ASE_SRP_7_1_2, "e137dba02f4d0f542ab09dcedea27314"}, - {ASESRPVersions.ASE_SRP_7_1_5, "e137dba02f4d0f542ab09dcedea27314"}, - {ASESRPVersions.ASE_SRP_7_1_6, "e137dba02f4d0f542ab09dcedea27314"}, - {ASESRPVersions.ASE_SRP_7_1_7, "e137dba02f4d0f542ab09dcedea27314"}, - {ASESRPVersions.ASE_SRP_7_1_8, "9a5e61a8b3421b944863d0946e32da0a"}, - {ASESRPVersions.ASE_SRP_7_2_0, "9a5e61a8b3421b944863d0946e32da0a"}, - {ASESRPVersions.ASE_SRP_7_2_1, "9a5e61a8b3421b944863d0946e32da0a"}, - {ASESRPVersions.ASE_SRP_RECENT, "9a5e61a8b3421b944863d0946e32da0a"} - }; - - private static Shader m_lateShader; - private static Material m_lateMaterial; - private static AmplifyShaderFunction m_lateShaderFunction; - - - public static void RequestInfo() - { - if( !m_requireUpdateList && m_importingPackage == ASEImportState.None ) - { - m_requireUpdateList = true; - m_packageListRequest = UnityEditor.PackageManager.Client.List( true ); - } - } - - static void FailedPackageImport( string packageName, string errorMessage ) - { - FinishImporter(); - } - - static void CancelledPackageImport( string packageName ) - { - FinishImporter(); - } - - static void CompletedPackageImport( string packageName ) - { - FinishImporter(); - } - - public static void StartImporting( string packagePath ) - { - if( !Preferences.GlobalAutoSRP ) - { - m_importingPackage = ASEImportState.None; - return; - } - AssetDatabase.importPackageCancelled += CancelledPackageImport; - AssetDatabase.importPackageCompleted += CompletedPackageImport; - AssetDatabase.importPackageFailed += FailedPackageImport; - AssetDatabase.ImportPackage( packagePath, false ); - //AssetDatabaseEX.ImportPackageImmediately( packagePath ); - } - - public static void FinishImporter() - { - m_importingPackage = ASEImportState.None; - AssetDatabase.importPackageCancelled -= CancelledPackageImport; - AssetDatabase.importPackageCompleted -= CompletedPackageImport; - AssetDatabase.importPackageFailed -= FailedPackageImport; - } - - public static void SetupLateShader( Shader shader ) - { - RequestInfo(); - m_lateShader = shader; - EditorApplication.delayCall += LateShaderOpener; - } - - public static void LateShaderOpener() - { - Preferences.LoadDefaults(); - Update(); - if( IsProcessing ) - { - EditorApplication.delayCall += LateShaderOpener; - } - else - { - AmplifyShaderEditorWindow.ConvertShaderToASE( m_lateShader ); - m_lateShader = null; - } - } - - public static void SetupLateMaterial( Material material ) - { - RequestInfo(); - m_lateMaterial = material; - EditorApplication.delayCall += LateMaterialOpener; - } - - public static void LateMaterialOpener() - { - Preferences.LoadDefaults(); - Update(); - if( IsProcessing ) - { - EditorApplication.delayCall += LateMaterialOpener; - } - else - { - AmplifyShaderEditorWindow.LoadMaterialToASE( m_lateMaterial ); - m_lateMaterial = null; - } - } - - public static void SetupLateShaderFunction( AmplifyShaderFunction shaderFunction ) - { - RequestInfo(); - m_lateShaderFunction = shaderFunction; - EditorApplication.delayCall += LateShaderFunctionOpener; - } - - public static void LateShaderFunctionOpener() - { - Preferences.LoadDefaults(); - Update(); - if( IsProcessing ) - { - EditorApplication.delayCall += LateShaderFunctionOpener; - } - else - { - AmplifyShaderEditorWindow.LoadShaderFunctionToASE( m_lateShaderFunction, false ); - m_lateShaderFunction = null; - } - } - - public static void Update() - { - //if( m_lwPackageInfo != null ) - //{ - // if( m_srpVersionConverter[ m_lwPackageInfo.version ] != m_currentLWVersion ) - // { - // m_currentLWVersion = m_srpVersionConverter[ m_lwPackageInfo.version ]; - // EditorPrefs.SetInt( LWEditorPrefsId, (int)m_currentLWVersion ); - // m_importingPackage = ASEImportState.Lightweight; - // string packagePath = AssetDatabase.GUIDToAssetPath( m_srpToASEPackageLW[ m_currentLWVersion ] ); - // StartImporting( packagePath ); - // } - //} - - //if( m_hdPackageInfo != null ) - //{ - // if( m_srpVersionConverter[ m_hdPackageInfo.version ] != m_currentHDVersion ) - // { - // m_currentHDVersion = m_srpVersionConverter[ m_hdPackageInfo.version ]; - // EditorPrefs.SetInt( HDEditorPrefsId, (int)m_currentHDVersion ); - // m_importingPackage = ASEImportState.HD; - // string packagePath = AssetDatabase.GUIDToAssetPath( m_srpToASEPackageHD[ m_currentHDVersion ] ); - // StartImporting( packagePath ); - // } - //} - - if( m_requireUpdateList && m_importingPackage == ASEImportState.None ) - { - if( m_packageListRequest != null && m_packageListRequest.IsCompleted ) - { - m_requireUpdateList = false; - foreach( UnityEditor.PackageManager.PackageInfo pi in m_packageListRequest.Result ) - { - if( pi.name.Equals( LWPackageId ) ) - { - m_currentLWVersion = ASESRPVersions.ASE_SRP_RECENT; - m_lwPackageInfo = pi; - ASESRPVersions oldVersion = (ASESRPVersions)EditorPrefs.GetInt( LWEditorPrefsId ); - if( m_srpVersionConverter.ContainsKey( pi.version ) ) - { - m_currentLWVersion = m_srpVersionConverter[ pi.version ]; - } - else - { - m_currentLWVersion = ASESRPVersions.ASE_SRP_RECENT; - } - - EditorPrefs.SetInt( LWEditorPrefsId, (int)m_currentLWVersion ); - bool foundNewVersion = oldVersion != m_currentLWVersion; - if( !File.Exists( AssetDatabase.GUIDToAssetPath( TemplatesManager.LightweigthPBRGUID ) ) || - !File.Exists( AssetDatabase.GUIDToAssetPath( TemplatesManager.LightweigthUnlitGUID ) ) || - foundNewVersion - ) - { - if( foundNewVersion ) - Debug.Log( LightweightNewVersionDetected ); - - m_importingPackage = ASEImportState.Lightweight; - string guid = m_srpToASEPackageLW.ContainsKey( m_currentLWVersion ) ? m_srpToASEPackageLW[ m_currentLWVersion ] : m_srpToASEPackageLW[ ASESRPVersions.ASE_SRP_RECENT ]; - string packagePath = AssetDatabase.GUIDToAssetPath( guid ); - StartImporting( packagePath ); - } - } - - if( pi.name.Equals( UniversalPackageId ) ) - { - m_currentLWVersion = ASESRPVersions.ASE_SRP_RECENT; - m_lwPackageInfo = pi; - ASESRPVersions oldVersion = (ASESRPVersions)EditorPrefs.GetInt( LWEditorPrefsId ); - if( m_srpVersionConverter.ContainsKey( pi.version ) ) - { - m_currentLWVersion = m_srpVersionConverter[ pi.version ]; - } - else - { - m_currentLWVersion = ASESRPVersions.ASE_SRP_RECENT; - } - - EditorPrefs.SetInt( LWEditorPrefsId, (int)m_currentLWVersion ); - bool foundNewVersion = oldVersion != m_currentLWVersion; - - int urpVersion = EditorPrefs.GetInt( URPTemplateVersion, m_urpTemplateVersion ); - if( urpVersion < m_urpTemplateVersion ) - foundNewVersion = true; - EditorPrefs.SetInt( URPTemplateVersion, m_urpTemplateVersion ); - - if( !File.Exists( AssetDatabase.GUIDToAssetPath( TemplatesManager.UniversalPBRGUID ) ) || - !File.Exists( AssetDatabase.GUIDToAssetPath( TemplatesManager.UniversalUnlitGUID ) ) || - foundNewVersion - ) - { - if( foundNewVersion ) - Debug.Log( LightweightNewVersionDetected ); - - m_importingPackage = ASEImportState.Lightweight; - string guid = m_srpToASEPackageLW.ContainsKey( m_currentLWVersion ) ? m_srpToASEPackageLW[ m_currentLWVersion ] : m_srpToASEPackageLW[ ASESRPVersions.ASE_SRP_RECENT ]; - string packagePath = AssetDatabase.GUIDToAssetPath( guid ); - StartImporting( packagePath ); - } - - } - - if( pi.name.Equals( HDPackageId ) ) - { - m_currentHDVersion = ASESRPVersions.ASE_SRP_RECENT; - m_hdPackageInfo = pi; - ASESRPVersions oldVersion = (ASESRPVersions)EditorPrefs.GetInt( HDEditorPrefsId ); - if( m_srpVersionConverter.ContainsKey( pi.version ) ) - { - m_currentHDVersion = m_srpVersionConverter[ pi.version ]; - } - else - { - m_currentHDVersion = ASESRPVersions.ASE_SRP_RECENT; - } - - EditorPrefs.SetInt( HDEditorPrefsId, (int)m_currentHDVersion ); - bool foundNewVersion = oldVersion != m_currentHDVersion; - - int hdrpVersion = EditorPrefs.GetInt( HDRPTemplateVersion, m_hdrpTemplateVersion ); - if( hdrpVersion < m_hdrpTemplateVersion ) - foundNewVersion = true; - EditorPrefs.SetInt( HDRPTemplateVersion, m_hdrpTemplateVersion ); - -#if UNITY_2019_3_OR_NEWER - if( !File.Exists( AssetDatabase.GUIDToAssetPath( TemplatesManager.HDNewLitGUID ) ) || - !File.Exists( AssetDatabase.GUIDToAssetPath( TemplatesManager.HDNewPBRGUID ) ) || - !File.Exists( AssetDatabase.GUIDToAssetPath( TemplatesManager.HDNewUnlitGUID ) ) || -#else - if( !File.Exists( AssetDatabase.GUIDToAssetPath( TemplatesManager.HDLitGUID ) ) || - !File.Exists( AssetDatabase.GUIDToAssetPath( TemplatesManager.HDPBRGUID ) ) || - !File.Exists( AssetDatabase.GUIDToAssetPath( TemplatesManager.HDUnlitGUID ) ) || -#endif - foundNewVersion - ) - { - if( foundNewVersion ) - Debug.Log( HDNewVersionDetected ); - - m_importingPackage = m_importingPackage == ASEImportState.Lightweight ? ASEImportState.Both : ASEImportState.HD; - string guid = m_srpToASEPackageHD.ContainsKey( m_currentHDVersion ) ? m_srpToASEPackageHD[ m_currentHDVersion ] : m_srpToASEPackageHD[ ASESRPVersions.ASE_SRP_RECENT ]; - string packagePath = AssetDatabase.GUIDToAssetPath( guid ); - StartImporting( packagePath ); - } - - } - } - } - } - } - - public static void SetSRPInfoOnDataCollector( ref MasterNodeDataCollector dataCollector ) - { - Preferences.LoadDefaults(); - if( m_requireUpdateList ) - Update(); - - if( dataCollector.CurrentSRPType == TemplateSRPType.HD ) - { - dataCollector.AddToDirectives( string.Format( SPKeywordFormat, (int)m_currentHDVersion ) ,-1, AdditionalLineType.Define ); - if( m_currentHDVersion < ASESRPVersions.ASE_SRP_4_9_0 ) - { - dataCollector.AddFunction( GetNormalWSFunc[ 0 ], GetNormalWSFunc, false ); - } - - if( m_currentHDVersion < ASESRPVersions.ASE_SRP_4_8_0 ) - { - dataCollector.AddFunction( BuildWordTangentFunc[ 0 ], BuildWordTangentFunc, false ); - } - } - - if( dataCollector.CurrentSRPType == TemplateSRPType.Lightweight ) - dataCollector.AddToDirectives( string.Format( SPKeywordFormat, (int)m_currentLWVersion ), -1, AdditionalLineType.Define ); - } - public static ASESRPVersions CurrentHDVersion { get { return m_currentHDVersion; } } - public static ASESRPVersions CurrentLWVersion { get { return m_currentLWVersion; } } - public static bool CheckImporter { get { return m_importingPackage != ASEImportState.None; } } - public static bool IsProcessing { get { return m_requireUpdateList && m_importingPackage == ASEImportState.None; } } - } -} -#endif diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/ASEPackageManagerHelper.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/ASEPackageManagerHelper.cs.meta deleted file mode 100644 index 67f628aa..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/ASEPackageManagerHelper.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: f48de3e34ed250945ba8c16d98b8ca0e -timeCreated: 1548881060 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/ASEStartScreen.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/ASEStartScreen.cs deleted file mode 100644 index c11cf8ba..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/ASEStartScreen.cs +++ /dev/null @@ -1,495 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEngine; -using UnityEditor; -using System; -using UnityEngine.Networking; -using System.Collections; - -namespace AmplifyShaderEditor -{ - public class ASEStartScreen : EditorWindow - { - [MenuItem( "Window/Amplify Shader Editor/Start Screen", false, 1999 )] - public static void Init() - { - ASEStartScreen window = (ASEStartScreen)GetWindow( typeof( ASEStartScreen ), true, "Amplify Shader Editor Start Screen" ); - window.minSize = new Vector2( 650, 500 ); - window.maxSize = new Vector2( 650, 500 ); - window.Show(); - } - - private static readonly string ChangeLogGUID = "580cccd3e608b7f4cac35ea46d62d429"; - private static readonly string ResourcesGUID = "c0a0a980c9ba86345bc15411db88d34f"; - private static readonly string BuiltInGUID = "e00e6f90ab8233e46a41c5e33917c642"; - private static readonly string UniversalGUID = "a9d68dd8913f05d4d9ce75e7b40c6044"; - private static readonly string HighDefinitionGUID = "d1c0b77896049554fa4b635531caf741"; - private static readonly string OLDHighDefinitionGUID = "dff05fea7446d7b4e9029bfab77455d2"; - private static readonly string LightWeightGUID = "6ecbfd0a046659943a69328c98ff0442"; - private static readonly string OLDLightWeightGUID = "f7c4e22642de60d448f4e4809190f7b1"; - - private static readonly string IconGUID = "2c6536772776dd84f872779990273bfc"; - - public static readonly string ChangelogURL = "http://amplify.pt/Banner/ASEchangelog.json"; - - private static readonly string ManualURL = "http://wiki.amplify.pt/index.php?title=Unity_Products:Amplify_Shader_Editor/Manual"; - private static readonly string BasicURL = "http://wiki.amplify.pt/index.php?title=Unity_Products:Amplify_Shader_Editor/Tutorials#Official_-_Basics"; - private static readonly string BeginnerURL = "http://wiki.amplify.pt/index.php?title=Unity_Products:Amplify_Shader_Editor/Tutorials#Official_-_Beginner_Series"; - private static readonly string NodesURL = "http://wiki.amplify.pt/index.php?title=Unity_Products:Amplify_Shader_Editor/Nodes"; - private static readonly string SRPURL = "http://wiki.amplify.pt/index.php?title=Unity_Products:Amplify_Shader_Editor/Scriptable_Rendering_Pipeline"; - private static readonly string FunctionsURL = "http://wiki.amplify.pt/index.php?title=Unity_Products:Amplify_Shader_Editor/Manual#Shader_Functions"; - private static readonly string TemplatesURL = "http://wiki.amplify.pt/index.php?title=Unity_Products:Amplify_Shader_Editor/Templates"; - private static readonly string APIURL = "http://wiki.amplify.pt/index.php?title=Unity_Products:Amplify_Shader_Editor/API"; - - private static readonly string DiscordURL = "https://discordapp.com/invite/EdrVAP5"; - private static readonly string ForumURL = "https://forum.unity.com/threads/best-tool-asset-store-award-amplify-shader-editor-node-based-shader-creation-tool.430959/"; - - private static readonly string SiteURL = "http://amplify.pt/download/"; - private static readonly string StoreURL = "https://assetstore.unity.com/packages/tools/visual-scripting/amplify-shader-editor-68570"; - - private static readonly GUIContent SamplesTitle = new GUIContent( "Shader Samples", "Import samples according to you project rendering pipeline" ); - private static readonly GUIContent ResourcesTitle = new GUIContent( "Learning Resources", "Check the online wiki for various topics about how to use ASE with node examples and explanations" ); - private static readonly GUIContent CommunityTitle = new GUIContent( "Community", "Need help? Reach us through our discord server or the offitial support Unity forum" ); - private static readonly GUIContent UpdateTitle = new GUIContent( "Latest Update", "Check the lastest additions, improvements and bug fixes done to ASE" ); - private static readonly GUIContent ASETitle = new GUIContent( "Amplify Shader Editor", "Are you using the latest version? Now you know" ); - - private static readonly string DownArrow = "\u25BC"; -#if UNITY_2019_3_OR_NEWER - private int DownButtonSize = 22; -#else - private int DownButtonSize = 21; -#endif - - Vector2 m_scrollPosition = Vector2.zero; - Preferences.ShowOption m_startup = Preferences.ShowOption.Never; - bool m_showLWRP = false; - bool m_showHDRP = false; - - [NonSerialized] - Texture packageIcon = null; - [NonSerialized] - Texture textIcon = null; - [NonSerialized] - Texture webIcon = null; - - GUIContent HDRPbutton = null; - GUIContent HDRPOLDbutton = null; - GUIContent URPbutton = null; - GUIContent LWRPbutton = null; - GUIContent LWRPOLDbutton = null; - GUIContent BuiltInbutton = null; - - GUIContent Manualbutton = null; - GUIContent Basicbutton = null; - GUIContent Beginnerbutton = null; - GUIContent Nodesbutton = null; - GUIContent SRPusebutton = null; - GUIContent Functionsbutton = null; - GUIContent Templatesbutton = null; - GUIContent APIbutton = null; - - GUIContent DiscordButton = null; - GUIContent ForumButton = null; - - GUIContent ASEIcon = null; - RenderTexture rt; - - [NonSerialized] - GUIStyle m_buttonStyle = null; - [NonSerialized] - GUIStyle m_buttonLeftStyle = null; - [NonSerialized] - GUIStyle m_buttonRightStyle = null; - [NonSerialized] - GUIStyle m_minibuttonStyle = null; - [NonSerialized] - GUIStyle m_labelStyle = null; - [NonSerialized] - GUIStyle m_linkStyle = null; - - private ChangeLogInfo m_changeLog; - private bool m_infoDownloaded = false; - private string m_newVersion = string.Empty; - - private void OnEnable() - { - rt = new RenderTexture( 16, 16, 0 ); - rt.Create(); - - m_startup = (Preferences.ShowOption)EditorPrefs.GetInt( Preferences.PrefStartUp, 0 ); - - if( textIcon == null ) - { - Texture icon = EditorGUIUtility.IconContent( "TextAsset Icon" ).image; - var cache = RenderTexture.active; - RenderTexture.active = rt; - Graphics.Blit( icon, rt ); - RenderTexture.active = cache; - textIcon = rt; - - Manualbutton = new GUIContent( " Manual", textIcon ); - Basicbutton = new GUIContent( " Basic use tutorials", textIcon ); - Beginnerbutton = new GUIContent( " Beginner Series", textIcon ); - Nodesbutton = new GUIContent( " Node List", textIcon ); - SRPusebutton = new GUIContent( " SRP HD/URP/LW use", textIcon ); - Functionsbutton = new GUIContent( " Shader Functions", textIcon ); - Templatesbutton = new GUIContent( " Shader Templates", textIcon ); - APIbutton = new GUIContent( " Node API", textIcon ); - } - - if( packageIcon == null ) - { - packageIcon = EditorGUIUtility.IconContent( "BuildSettings.Editor.Small" ).image; - HDRPbutton = new GUIContent( " HDRP Samples", packageIcon ); - HDRPOLDbutton = new GUIContent( " HDRP Samples 6.X.X", packageIcon ); - URPbutton = new GUIContent( " URP Samples", packageIcon ); - LWRPbutton = new GUIContent( " LWRP Samples 6.X.X", packageIcon ); - LWRPOLDbutton = new GUIContent( " LWRP Samples 3.X.X", packageIcon ); - BuiltInbutton = new GUIContent( " Built-In Samples", packageIcon ); - } - - if( webIcon == null ) - { - webIcon = EditorGUIUtility.IconContent( "BuildSettings.Web.Small" ).image; - DiscordButton = new GUIContent( " Discord", webIcon ); - ForumButton = new GUIContent( " Unity Forum", webIcon ); - } - - if( m_changeLog == null ) - { - var changelog = AssetDatabase.LoadAssetAtPath<TextAsset>( AssetDatabase.GUIDToAssetPath( ChangeLogGUID ) ); - string lastUpdate = string.Empty; - if(changelog != null ) - { - lastUpdate = changelog.text.Substring( 0, changelog.text.IndexOf( "\nv", 50 ) );// + "\n..."; - lastUpdate = lastUpdate.Replace( " *", " \u25CB" ); - lastUpdate = lastUpdate.Replace( "* ", "\u2022 " ); - } - m_changeLog = new ChangeLogInfo( VersionInfo.FullNumber, lastUpdate ); - } - - if( ASEIcon == null ) - { - ASEIcon = new GUIContent( AssetDatabase.LoadAssetAtPath<Texture2D>( AssetDatabase.GUIDToAssetPath( IconGUID ) ) ); - } - } - - private void OnDisable() - { - if( rt != null ) - { - rt.Release(); - DestroyImmediate( rt ); - } - } - - public void OnGUI() - { - if( !m_infoDownloaded ) - { - m_infoDownloaded = true; - - StartBackgroundTask( StartRequest( ChangelogURL, () => - { - var temp = ChangeLogInfo.CreateFromJSON( www.downloadHandler.text ); - if( temp != null && temp.Version >= m_changeLog.Version ) - { - m_changeLog = temp; - } - // improve this later - int major = m_changeLog.Version / 10000; - int minor = ( m_changeLog.Version / 1000 ) - major * 10; - int release = ( m_changeLog.Version / 100 ) - major * 100 - minor * 10; - int revision = ( ( m_changeLog.Version / 10 ) - major * 1000 - minor * 100 - release * 10 ) + ( m_changeLog.Version - major * 10000 - minor * 1000 - release * 100 ); - m_newVersion = major + "." + minor + "." + release + "r" + revision; - Repaint(); - } ) ); - } - - if( m_buttonStyle == null ) - { - m_buttonStyle = new GUIStyle( GUI.skin.button ); - m_buttonStyle.alignment = TextAnchor.MiddleLeft; - } - - if( m_buttonLeftStyle == null ) - { - m_buttonLeftStyle = new GUIStyle( "ButtonLeft" ); - m_buttonLeftStyle.alignment = TextAnchor.MiddleLeft; - m_buttonLeftStyle.margin = m_buttonStyle.margin; - m_buttonLeftStyle.margin.right = 0; - } - - if( m_buttonRightStyle == null ) - { - m_buttonRightStyle = new GUIStyle( "ButtonRight" ); - m_buttonRightStyle.alignment = TextAnchor.MiddleLeft; - m_buttonRightStyle.margin = m_buttonStyle.margin; - m_buttonRightStyle.margin.left = 0; - } - - if( m_minibuttonStyle == null ) - { - m_minibuttonStyle = new GUIStyle( "MiniButton" ); - m_minibuttonStyle.alignment = TextAnchor.MiddleLeft; - m_minibuttonStyle.margin = m_buttonStyle.margin; - m_minibuttonStyle.margin.left = 20; - m_minibuttonStyle.normal.textColor = m_buttonStyle.normal.textColor; - m_minibuttonStyle.hover.textColor = m_buttonStyle.hover.textColor; - } - - if( m_labelStyle == null ) - { - m_labelStyle = new GUIStyle( "BoldLabel" ); - m_labelStyle.margin = new RectOffset( 4, 4, 4, 4 ); - m_labelStyle.padding = new RectOffset( 2, 2, 2, 2 ); - m_labelStyle.fontSize = 13; - } - - if( m_linkStyle == null ) - { - var inv = AssetDatabase.LoadAssetAtPath<Texture2D>( AssetDatabase.GUIDToAssetPath( "1004d06b4b28f5943abdf2313a22790a" ) ); // find a better solution for transparent buttons - m_linkStyle = new GUIStyle(); - m_linkStyle.normal.textColor = new Color( 0.2980392f, 0.4901961f, 1f ); - m_linkStyle.hover.textColor = Color.white; - m_linkStyle.active.textColor = Color.grey; - m_linkStyle.margin.top = 3; - m_linkStyle.margin.bottom = 2; - m_linkStyle.hover.background = inv; - m_linkStyle.active.background = inv; - } - - EditorGUILayout.BeginHorizontal( GUIStyle.none, GUILayout.ExpandWidth( true ) ); - { - // left column - EditorGUILayout.BeginVertical( GUILayout.Width( 175 ) ); - { - GUILayout.Label( SamplesTitle, m_labelStyle ); - EditorGUILayout.BeginHorizontal(); - if( GUILayout.Button( HDRPbutton, m_buttonLeftStyle ) ) - ImportSample( HDRPbutton.text, HighDefinitionGUID ); - - if( GUILayout.Button( DownArrow, m_buttonRightStyle, GUILayout.Width( DownButtonSize ), GUILayout.Height( DownButtonSize ) ) ) - { - m_showHDRP = !m_showHDRP; - m_showLWRP = false; - } - EditorGUILayout.EndHorizontal(); - if( m_showHDRP ) - { - if( GUILayout.Button( HDRPOLDbutton, m_minibuttonStyle ) ) - ImportSample( HDRPOLDbutton.text, OLDHighDefinitionGUID ); - } - EditorGUILayout.BeginHorizontal(); - if( GUILayout.Button( URPbutton, m_buttonLeftStyle ) ) - ImportSample( URPbutton.text, UniversalGUID ); - - if( GUILayout.Button( DownArrow, m_buttonRightStyle, GUILayout.Width( DownButtonSize ), GUILayout.Height( DownButtonSize ) ) ) - { - m_showLWRP = !m_showLWRP; - m_showHDRP = false; - } - EditorGUILayout.EndHorizontal(); - if( m_showLWRP ) - { - EditorGUILayout.BeginVertical(); - if( GUILayout.Button( LWRPbutton, m_minibuttonStyle ) ) - ImportSample( LWRPbutton.text, LightWeightGUID ); - if( GUILayout.Button( LWRPOLDbutton, m_minibuttonStyle ) ) - ImportSample( LWRPOLDbutton.text, OLDLightWeightGUID ); - EditorGUILayout.EndVertical(); - } - if( GUILayout.Button( BuiltInbutton, m_buttonStyle ) ) - ImportSample( BuiltInbutton.text, BuiltInGUID ); - - GUILayout.Space( 10 ); - - GUILayout.Label( ResourcesTitle, m_labelStyle ); - if( GUILayout.Button( Manualbutton, m_buttonStyle ) ) - Application.OpenURL( ManualURL ); - - if( GUILayout.Button( Basicbutton, m_buttonStyle ) ) - Application.OpenURL( BasicURL ); - - if( GUILayout.Button( Beginnerbutton, m_buttonStyle ) ) - Application.OpenURL( BeginnerURL ); - - if( GUILayout.Button( Nodesbutton, m_buttonStyle ) ) - Application.OpenURL( NodesURL ); - - if( GUILayout.Button( SRPusebutton, m_buttonStyle ) ) - Application.OpenURL( SRPURL ); - - if( GUILayout.Button( Functionsbutton, m_buttonStyle ) ) - Application.OpenURL( FunctionsURL ); - - if( GUILayout.Button( Templatesbutton, m_buttonStyle ) ) - Application.OpenURL( TemplatesURL ); - - if( GUILayout.Button( APIbutton, m_buttonStyle ) ) - Application.OpenURL( APIURL ); - } - EditorGUILayout.EndVertical(); - - // right column - EditorGUILayout.BeginVertical( GUILayout.Width( 650 - 175 - 9 ), GUILayout.ExpandHeight( true ) ); - { - GUILayout.Label( CommunityTitle, m_labelStyle ); - EditorGUILayout.BeginHorizontal( GUILayout.ExpandWidth( true ) ); - { - if( GUILayout.Button( DiscordButton, GUILayout.ExpandWidth( true ) ) ) - { - Application.OpenURL( DiscordURL ); - } - if( GUILayout.Button( ForumButton, GUILayout.ExpandWidth( true ) ) ) - { - Application.OpenURL( ForumURL ); - } - } - EditorGUILayout.EndHorizontal(); - GUILayout.Label( UpdateTitle, m_labelStyle ); - m_scrollPosition = GUILayout.BeginScrollView( m_scrollPosition, "ProgressBarBack", GUILayout.ExpandHeight( true ), GUILayout.ExpandWidth( true ) ); - GUILayout.Label( m_changeLog.LastUpdate, "WordWrappedMiniLabel", GUILayout.ExpandHeight( true ) ); - GUILayout.EndScrollView(); - - EditorGUILayout.BeginHorizontal( GUILayout.ExpandWidth( true ) ); - { - EditorGUILayout.BeginVertical(); - GUILayout.Label( ASETitle, m_labelStyle ); - - GUILayout.Label( "Installed Version: " + VersionInfo.StaticToString() ); - - if( m_changeLog.Version > VersionInfo.FullNumber ) - { - var cache = GUI.color; - GUI.color = Color.red; - GUILayout.Label( "New version available: " + m_newVersion, "BoldLabel" ); - GUI.color = cache; - } - else - { - var cache = GUI.color; - GUI.color = Color.green; - GUILayout.Label( "You are using the latest version", "BoldLabel" ); - GUI.color = cache; - } - - EditorGUILayout.BeginHorizontal(); - GUILayout.Label( "Download links:" ); - if( GUILayout.Button( "Amplify", m_linkStyle ) ) - Application.OpenURL( SiteURL ); - GUILayout.Label( "-" ); - if( GUILayout.Button( "Asset Store", m_linkStyle ) ) - Application.OpenURL( StoreURL ); - EditorGUILayout.EndHorizontal(); - GUILayout.Space( 7 ); - EditorGUILayout.EndVertical(); - - GUILayout.FlexibleSpace(); - EditorGUILayout.BeginVertical(); - GUILayout.Space( 7 ); - GUILayout.Label( ASEIcon ); - EditorGUILayout.EndVertical(); - } - EditorGUILayout.EndHorizontal(); - } - EditorGUILayout.EndVertical(); - } - EditorGUILayout.EndHorizontal(); - - - EditorGUILayout.BeginHorizontal( "ProjectBrowserBottomBarBg", GUILayout.ExpandWidth( true ), GUILayout.Height(22) ); - { - GUILayout.FlexibleSpace(); - EditorGUI.BeginChangeCheck(); - var cache = EditorGUIUtility.labelWidth; - EditorGUIUtility.labelWidth = 100; - m_startup = (Preferences.ShowOption)EditorGUILayout.EnumPopup( "Show At Startup", m_startup, GUILayout.Width( 220 ) ); - EditorGUIUtility.labelWidth = cache; - if( EditorGUI.EndChangeCheck() ) - { - EditorPrefs.SetInt( Preferences.PrefStartUp, (int)m_startup ); - } - } - EditorGUILayout.EndHorizontal(); - - // Find a better way to update link buttons without repainting the window - Repaint(); - } - - void ImportSample( string pipeline, string guid ) - { - if( EditorUtility.DisplayDialog( "Import Sample", "This will import the samples for" + pipeline.Replace( " Samples", "" ) + ", please make sure the pipeline is properly installed and/or selected before importing the samples.\n\nContinue?", "Yes", "No" ) ) - { - AssetDatabase.ImportPackage( AssetDatabase.GUIDToAssetPath( ResourcesGUID ), false ); - AssetDatabase.ImportPackage( AssetDatabase.GUIDToAssetPath( guid ), false ); - } - } - - UnityWebRequest www; - - IEnumerator StartRequest( string url, Action success = null ) - { - using( www = UnityWebRequest.Get( url ) ) - { -#if UNITY_2017_2_OR_NEWER - yield return www.SendWebRequest(); -#else - yield return www.Send(); -#endif - - while( www.isDone == false ) - yield return null; - - if( success != null ) - success(); - } - } - - public static void StartBackgroundTask( IEnumerator update, Action end = null ) - { - EditorApplication.CallbackFunction closureCallback = null; - - closureCallback = () => - { - try - { - if( update.MoveNext() == false ) - { - if( end != null ) - end(); - EditorApplication.update -= closureCallback; - } - } - catch( Exception ex ) - { - if( end != null ) - end(); - Debug.LogException( ex ); - EditorApplication.update -= closureCallback; - } - }; - - EditorApplication.update += closureCallback; - } - } - - [Serializable] - internal class ChangeLogInfo - { - public int Version; - public string LastUpdate; - - public static ChangeLogInfo CreateFromJSON( string jsonString ) - { - return JsonUtility.FromJson<ChangeLogInfo>( jsonString ); - } - - public ChangeLogInfo( int version, string lastUpdate ) - { - Version = version; - LastUpdate = lastUpdate; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/ASEStartScreen.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/ASEStartScreen.cs.meta deleted file mode 100644 index b9441e35..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/ASEStartScreen.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 3e7433fb42db4d9428571bfcd0da64f3 -timeCreated: 1585827066 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/ASETextureArrayCreator.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/ASETextureArrayCreator.cs deleted file mode 100644 index e33afdcb..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/ASETextureArrayCreator.cs +++ /dev/null @@ -1,686 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> -//#define NEW_TEXTURE_3D_METHOD - -using UnityEngine; -using UnityEditor; -using System.Collections.Generic; -using UnityEditorInternal; -using System; -using System.IO; - -namespace AmplifyShaderEditor -{ - public class ASETextureArrayCreator : EditorWindow - { - [MenuItem( "Window/Amplify Shader Editor/Texture Array Creator", false, 1001 )] - static void ShowWindow() - { - ASETextureArrayCreator window = EditorWindow.GetWindow<ASETextureArrayCreator>(); - window.titleContent.text = "Texture Array"; - window.minSize = new Vector2( 302, 350 ); - window.Show(); - } - - private const string ClearButtonStr = "Clear"; - private const string TextureFilter = "t:Texture2D"; - private const string BuildArrayMessage = "Build Array"; - private const string BuildTexture3DMessage = "Build Texture 3D"; - private const string ArrayFilename = "NewTextureArray"; - private const string Texture3DFilename = "NewTexture3D"; - - private DragAndDropTool m_dragAndDropTool; - private Rect m_draggableArea; - - [SerializeField] - private List<Texture2D> m_allTextures; - - [SerializeField] - private ReorderableList m_listTextures = null; - - [SerializeField] - private bool m_tex3DMode = false; - - [SerializeField] - private bool m_linearMode = false; - - [SerializeField] - private string m_folderPath = "Assets/"; - - [SerializeField] - private string m_fileName = "NewTextureArray"; - - [SerializeField] - private bool m_filenameChanged = false; - - [SerializeField] - private TextureWrapMode m_wrapMode = TextureWrapMode.Repeat; - - [SerializeField] - private FilterMode m_filterMode = FilterMode.Bilinear; - - [SerializeField] - private int m_anisoLevel = 1; - - [SerializeField] - private int m_previewSize = 16; - - [SerializeField] - private bool m_mipMaps = true; - - [SerializeField] - private int m_selectedSizeX = 4; - - [SerializeField] - private int m_selectedSizeY = 4; - - [SerializeField] - private TextureFormat m_selectedFormatEnum = TextureFormat.ARGB32; - - [SerializeField] - private int m_quality = 100; - - private int[] m_sizes = { 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192 }; - private string[] m_sizesStr = { "32", "64", "128", "256", "512", "1024", "2048", "4096", "8192" }; - private static Dictionary<int, int> MipCount = new Dictionary<int, int>() { { 32, 6 }, { 64, 7 }, { 128, 8 }, { 256, 9 }, { 512, 10 }, { 1024, 11 }, { 2048, 12 }, { 4096, 13 }, { 8192, 14 } }; - private static List<TextureFormat> UncompressedFormats = new List<TextureFormat>() { TextureFormat.ARGB32, TextureFormat.RGBA32, TextureFormat.RGB24, TextureFormat.Alpha8 }; - - private GUIStyle m_contentStyle = null; - private GUIStyle m_pathButtonStyle = null; - private GUIContent m_pathButtonContent = new GUIContent(); - - private Vector2 m_scrollPos; - private Texture m_lastSaved; - private bool m_lockRatio = true; - private string m_message = string.Empty; - - private void OnEnable() - { - m_draggableArea = new Rect( 0, 0, 1, 1 ); - m_dragAndDropTool = new DragAndDropTool(); - m_dragAndDropTool.OnValidDropObjectEvt += OnValidObjectsDropped; - - if( m_contentStyle == null ) - { - m_contentStyle = new GUIStyle( GUIStyle.none ); - m_contentStyle.margin = new RectOffset( 6, 4, 5, 5 ); - } - - m_pathButtonStyle = null; - - if( m_allTextures == null ) - m_allTextures = new List<Texture2D>(); - - if( m_listTextures == null ) - { - m_listTextures = new ReorderableList( m_allTextures, typeof( Texture2D ), true, true, true, true ); - m_listTextures.elementHeight = 16; - - m_listTextures.drawElementCallback = ( Rect rect, int index, bool isActive, bool isFocused ) => - { - m_allTextures[ index ] = (Texture2D)EditorGUI.ObjectField( rect, "Texture " + index, m_allTextures[ index ], typeof( Texture2D ), false ); - }; - - m_listTextures.drawHeaderCallback = ( Rect rect ) => - { - m_previewSize = EditorGUI.IntSlider( rect, "Texture List", m_previewSize, 16, 64 ); - if( (float)m_previewSize != m_listTextures.elementHeight ) - m_listTextures.elementHeight = m_previewSize; - }; - m_listTextures.onAddCallback = ( list ) => - { - m_allTextures.Add( null ); - }; - - m_listTextures.onRemoveCallback = ( list ) => - { - m_allTextures.RemoveAt( list.index ); - }; - } - } - - private void OnDestroy() - { - m_dragAndDropTool.Destroy(); - m_dragAndDropTool = null; - - if( m_allTextures != null ) - { - m_allTextures.Clear(); - m_allTextures = null; - } - } - - void OnGUI() - { - if( m_pathButtonStyle == null ) - m_pathButtonStyle = "minibutton"; - - m_scrollPos = EditorGUILayout.BeginScrollView( m_scrollPos, GUILayout.Height( position.height ) ); - float cachedWidth = EditorGUIUtility.labelWidth; - EditorGUIUtility.labelWidth = 100; - EditorGUILayout.BeginVertical( m_contentStyle ); - - string buildButtonStr = m_tex3DMode ? BuildTexture3DMessage : BuildArrayMessage; - // build button - EditorGUILayout.BeginHorizontal(); - EditorGUI.BeginDisabledGroup( m_allTextures.Count <= 0 ); - if( GUILayout.Button( buildButtonStr, "prebutton", GUILayout.Height( 20 ) ) ) - { - bool showWarning = false; - for( int i = 0; i < m_allTextures.Count; i++ ) - { - if( m_allTextures[ i ].width != m_sizes[ m_selectedSizeX ] || m_allTextures[ i ].height != m_sizes[ m_selectedSizeY ] ) - { - showWarning = true; - } - } - - if( !showWarning ) - { - m_message = string.Empty; - if( m_tex3DMode ) - BuildTexture3D(); - else - BuildArray(); - } - else if( EditorUtility.DisplayDialog( "Warning!", "Some textures need to be resized to fit the selected size. Do you want to continue?", "Yes", "No" ) ) - { - m_message = string.Empty; - if( m_tex3DMode ) - BuildTexture3D(); - else - BuildArray(); - } - } - EditorGUI.EndDisabledGroup(); - EditorGUI.BeginDisabledGroup( m_lastSaved == null ); - GUIContent icon = EditorGUIUtility.IconContent( "icons/d_ViewToolZoom.png" ); - if( GUILayout.Button( icon, "prebutton", GUILayout.Width( 28 ), GUILayout.Height( 20 ) ) ) - { - EditorGUIUtility.PingObject( m_lastSaved ); - } - EditorGUI.EndDisabledGroup(); - EditorGUILayout.EndHorizontal(); - - // message - if( !string.IsNullOrEmpty( m_message ) ) - if( GUILayout.Button( "BUILD REPORT (click to hide):\n\n" + m_message, "helpbox" ) ) - m_message = string.Empty; - - // options - EditorGUILayout.BeginHorizontal(); - EditorGUILayout.PrefixLabel( "Size" ); - EditorGUIUtility.labelWidth = 16; - m_selectedSizeX = EditorGUILayout.Popup( "X", m_selectedSizeX, m_sizesStr ); - EditorGUI.BeginDisabledGroup( m_lockRatio ); - m_selectedSizeY = EditorGUILayout.Popup( "Y", m_lockRatio ? m_selectedSizeX : m_selectedSizeY, m_sizesStr ); - EditorGUI.EndDisabledGroup(); - EditorGUIUtility.labelWidth = 100; - m_lockRatio = GUILayout.Toggle( m_lockRatio, "L", "minibutton", GUILayout.Width( 18 ) ); - EditorGUILayout.EndHorizontal(); - EditorGUI.BeginChangeCheck(); - m_tex3DMode = EditorGUILayout.Toggle( "Texture 3D", m_tex3DMode ); - if( EditorGUI.EndChangeCheck() ) - { - if( !m_filenameChanged ) - { - m_fileName = m_tex3DMode ? Texture3DFilename:ArrayFilename; - } - } - - m_linearMode = EditorGUILayout.Toggle( "Linear", m_linearMode ); - m_mipMaps = EditorGUILayout.Toggle( "Mip Maps", m_mipMaps ); - m_wrapMode = (TextureWrapMode)EditorGUILayout.EnumPopup( "Wrap Mode", m_wrapMode ); - m_filterMode = (FilterMode)EditorGUILayout.EnumPopup( "Filter Mode", m_filterMode ); - m_anisoLevel = EditorGUILayout.IntSlider( "Aniso Level", m_anisoLevel, 0, 16 ); - - m_selectedFormatEnum = (TextureFormat)EditorGUILayout.EnumPopup( "Format", m_selectedFormatEnum ); - if( m_selectedFormatEnum == TextureFormat.DXT1Crunched ) - { - m_selectedFormatEnum = TextureFormat.DXT1; - Debug.Log( "Texture Array does not support crunched DXT1 format. Changing to DXT1..." ); - } - else if( m_selectedFormatEnum == TextureFormat.DXT5Crunched ) - { - m_selectedFormatEnum = TextureFormat.DXT5; - Debug.Log( "Texture Array does not support crunched DXT5 format. Changing to DXT5..." ); - } - - m_quality = EditorGUILayout.IntSlider( "Format Quality", m_quality, 0, 100 ); - EditorGUILayout.Separator(); - EditorGUILayout.LabelField( "Path and Name" ); - EditorGUILayout.BeginHorizontal(); - m_pathButtonContent.text = m_folderPath; - Vector2 buttonSize = m_pathButtonStyle.CalcSize( m_pathButtonContent ); - if( GUILayout.Button( m_pathButtonContent, m_pathButtonStyle, GUILayout.MaxWidth( Mathf.Min( position.width * 0.5f, buttonSize.x ) ) ) ) - { - string folderpath = EditorUtility.OpenFolderPanel( "Save Texture Array to folder", "Assets/", "" ); - folderpath = FileUtil.GetProjectRelativePath( folderpath ); - if( string.IsNullOrEmpty( folderpath ) ) - m_folderPath = "Assets/"; - else - m_folderPath = folderpath + "/"; - } - EditorGUI.BeginChangeCheck(); - m_fileName = EditorGUILayout.TextField( m_fileName, GUILayout.ExpandWidth( true ) ); - if( EditorGUI.EndChangeCheck() ) - { - m_filenameChanged = true; - } - EditorGUILayout.LabelField( ".asset", GUILayout.MaxWidth( 40 ) ); - EditorGUILayout.EndHorizontal(); - EditorGUILayout.Separator(); - - // list - EditorGUILayout.Separator(); - if( GUILayout.Button( ClearButtonStr ) ) - { - m_allTextures.Clear(); - } - - if( m_listTextures != null ) - m_listTextures.DoLayoutList(); - - GUILayout.Space( 20 ); - EditorGUILayout.EndVertical(); - EditorGUIUtility.labelWidth = cachedWidth; - EditorGUILayout.EndScrollView(); - m_draggableArea.size = position.size; - m_dragAndDropTool.TestDragAndDrop( m_draggableArea ); - } - - public void OnValidObjectsDropped( UnityEngine.Object[] droppedObjs ) - { - for( int objIdx = 0; objIdx < droppedObjs.Length; objIdx++ ) - { - Texture2D tex = droppedObjs[ objIdx ] as Texture2D; - if( tex != null ) - { - m_allTextures.Add( tex ); - } - else - { - DefaultAsset asset = droppedObjs[ objIdx ] as DefaultAsset; - if( asset != null ) - { - string path = AssetDatabase.GetAssetPath( asset ); - if( AssetDatabase.IsValidFolder( path ) ) - { - string[] pathArr = { path }; - string[] texInDir = AssetDatabase.FindAssets( TextureFilter, pathArr ); - for( int texIdx = 0; texIdx < texInDir.Length; texIdx++ ) - { - Texture2D internalTex = AssetDatabase.LoadAssetAtPath<Texture2D>( AssetDatabase.GUIDToAssetPath( texInDir[ texIdx ] )); - if( internalTex != null ) - { - m_allTextures.Add( internalTex ); - } - } - } - } - } - } - - m_allTextures.Sort( ( x, y ) => string.Compare( x.name, y.name ) ); - } - - private void CopyToArray( ref Texture2D from, ref Texture2DArray to, int arrayIndex, int mipLevel, bool compressed = true ) - { - if( compressed ) - { - Graphics.CopyTexture( from, 0, mipLevel, to, arrayIndex, mipLevel ); - } - else - { - to.SetPixels( from.GetPixels(), arrayIndex, mipLevel ); - to.Apply(); - } - } - -#if NEW_TEXTURE_3D_METHOD - private void BuildTexture3D() - { - int sizeX = m_sizes[ m_selectedSizeX ]; - int sizeY = m_sizes[ m_selectedSizeY ]; - - Texture3D texture3D = new Texture3D( sizeX, sizeY, m_allTextures.Count, m_selectedFormatEnum, m_mipMaps ); - texture3D.wrapMode = m_wrapMode; - texture3D.filterMode = m_filterMode; - texture3D.anisoLevel = m_anisoLevel; - //texture3D.Apply( false ); - RenderTexture cache = RenderTexture.active; - RenderTexture rt = new RenderTexture( sizeX, sizeY, 0, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Default ); - rt.Create(); - List<Texture2D> textures = new List<Texture2D>( m_allTextures.Count ); - - for( int i = 0; i < m_allTextures.Count; i++ ) - { - // build report - int widthChanges = m_allTextures[ i ].width < sizeX ? -1 : m_allTextures[ i ].width > sizeX ? 1 : 0; - int heightChanges = m_allTextures[ i ].height < sizeY ? -1 : m_allTextures[ i ].height > sizeY ? 1 : 0; - if( ( widthChanges < 0 && heightChanges <= 0 ) || ( widthChanges <= 0 && heightChanges < 0 ) ) - m_message += m_allTextures[ i ].name + " was upscaled\n"; - else if( ( widthChanges > 0 && heightChanges >= 0 ) || ( widthChanges >= 0 && heightChanges > 0 ) ) - m_message += m_allTextures[ i ].name + " was downscaled\n"; - else if( ( widthChanges > 0 && heightChanges < 0 ) || ( widthChanges < 0 && heightChanges > 0 ) ) - m_message += m_allTextures[ i ].name + " changed dimensions\n"; - - // blit image to upscale or downscale the image to any size - RenderTexture.active = rt; - - bool cachedsrgb = GL.sRGBWrite; - GL.sRGBWrite = !m_linearMode; - Graphics.Blit( m_allTextures[ i ], rt ); - GL.sRGBWrite = cachedsrgb; - - textures.Add( new Texture2D( sizeX, sizeY, TextureFormat.ARGB32, m_mipMaps, m_linearMode )); - textures[ i ].ReadPixels( new Rect( 0, 0, sizeX, sizeY ), 0, 0, m_mipMaps ); - RenderTexture.active = null; - - bool isCompressed = UncompressedFormats.FindIndex( x => x.Equals( m_selectedFormatEnum ) ) < 0; - if( isCompressed ) - { - EditorUtility.CompressTexture( textures[ i ], m_selectedFormatEnum, m_quality ); - // t2d.Apply( false ); - } - textures[ i ].Apply( false ); - } - - rt.Release(); - RenderTexture.active = cache; - - if( m_message.Length > 0 ) - m_message = m_message.Substring( 0, m_message.Length - 1 ); - - int sizeZ = textures.Count; - Color[] colors = new Color[ sizeX * sizeY * sizeZ ]; - int idx = 0; - for( int z = 0; z < sizeZ; z++ ) - { - for( int y = 0; y < sizeY; y++ ) - { - for( int x = 0; x < sizeX; x++, idx++ ) - { - colors[ idx ] = textures[ z ].GetPixel(x,y); - } - } - } - - texture3D.SetPixels( colors ); - texture3D.Apply(); - - string path = m_folderPath + m_fileName + ".asset"; - Texture3D outfile = AssetDatabase.LoadMainAssetAtPath( path ) as Texture3D; - if( outfile != null ) - { - EditorUtility.CopySerialized( texture3D, outfile ); - AssetDatabase.SaveAssets(); - EditorGUIUtility.PingObject( outfile ); - m_lastSaved = outfile; - } - else - { - AssetDatabase.CreateAsset( texture3D, path ); - EditorGUIUtility.PingObject( texture3D ); - m_lastSaved = texture3D; - } - } -#else - private void BuildTexture3D() - { - int sizeX = m_sizes[ m_selectedSizeX ]; - int sizeY = m_sizes[ m_selectedSizeY ]; - int mipCount = m_mipMaps ? MipCount[ Mathf.Max( sizeX, sizeY ) ] : 1; - - Texture3D texture3D = new Texture3D( sizeX, sizeY, m_allTextures.Count, m_selectedFormatEnum, m_mipMaps ); - texture3D.wrapMode = m_wrapMode; - texture3D.filterMode = m_filterMode; - texture3D.anisoLevel = m_anisoLevel; - texture3D.Apply( false ); - RenderTexture cache = RenderTexture.active; - RenderTexture rt = new RenderTexture( sizeX, sizeY, 0, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Default ); - rt.Create(); - List<List<Color>> mipColor = new List<List<Color>>(); - if( m_mipMaps ) - { - for( int i = 0; i < mipCount; i++ ) - { - mipColor.Add( new List<Color>() ); - } - } - else - { - mipColor.Add( new List<Color>() ); - } - - for( int i = 0; i < m_allTextures.Count; i++ ) - { - // build report - int widthChanges = m_allTextures[ i ].width < sizeX ? -1 : m_allTextures[ i ].width > sizeX ? 1 : 0; - int heightChanges = m_allTextures[ i ].height < sizeY ? -1 : m_allTextures[ i ].height > sizeY ? 1 : 0; - if( ( widthChanges < 0 && heightChanges <= 0 ) || ( widthChanges <= 0 && heightChanges < 0 ) ) - m_message += m_allTextures[ i ].name + " was upscaled\n"; - else if( ( widthChanges > 0 && heightChanges >= 0 ) || ( widthChanges >= 0 && heightChanges > 0 ) ) - m_message += m_allTextures[ i ].name + " was downscaled\n"; - else if( ( widthChanges > 0 && heightChanges < 0 ) || ( widthChanges < 0 && heightChanges > 0 ) ) - m_message += m_allTextures[ i ].name + " changed dimensions\n"; - - // blit image to upscale or downscale the image to any size - RenderTexture.active = rt; - - bool cachedsrgb = GL.sRGBWrite; - GL.sRGBWrite = !m_linearMode; - Graphics.Blit( m_allTextures[ i ], rt ); - GL.sRGBWrite = cachedsrgb; - - Texture2D t2d = new Texture2D( sizeX, sizeY, TextureFormat.ARGB32, m_mipMaps, m_linearMode ); - t2d.ReadPixels( new Rect( 0, 0, sizeX, sizeY ), 0, 0, m_mipMaps ); - RenderTexture.active = null; - - bool isCompressed = UncompressedFormats.FindIndex( x => x.Equals( m_selectedFormatEnum ) ) < 0; - if( isCompressed ) - { - EditorUtility.CompressTexture( t2d, m_selectedFormatEnum, m_quality ); - // t2d.Apply( false ); - } - t2d.Apply( false ); - - if( m_mipMaps ) - { - for( int mip = 0; mip < mipCount; mip++ ) - { - mipColor[ mip ].AddRange( t2d.GetPixels( mip ) ); - } - } - else - { - mipColor[ 0 ].AddRange( t2d.GetPixels( 0 ) ); - } - } - - rt.Release(); - RenderTexture.active = cache; - - if( m_message.Length > 0 ) - m_message = m_message.Substring( 0, m_message.Length - 1 ); - - for( int i = 0; i < mipCount; i++ ) - { - texture3D.SetPixels( mipColor[ i ].ToArray(), i ); - } - - texture3D.Apply( false ); - - string path = m_folderPath + m_fileName + ".asset"; - Texture3D outfile = AssetDatabase.LoadMainAssetAtPath( path ) as Texture3D; - if( outfile != null ) - { - EditorUtility.CopySerialized( texture3D, outfile ); - AssetDatabase.SaveAssets(); - EditorGUIUtility.PingObject( outfile ); - m_lastSaved = outfile; - } - else - { - AssetDatabase.CreateAsset( texture3D, path ); - EditorGUIUtility.PingObject( texture3D ); - m_lastSaved = texture3D; - } - } -#endif - private void BuildTexture3DAutoMips() - { - int sizeX = m_sizes[ m_selectedSizeX ]; - int sizeY = m_sizes[ m_selectedSizeY ]; - - Texture3D texture3D = new Texture3D( sizeX, sizeY, m_allTextures.Count, m_selectedFormatEnum, m_mipMaps ); - texture3D.wrapMode = m_wrapMode; - texture3D.filterMode = m_filterMode; - texture3D.anisoLevel = m_anisoLevel; - texture3D.Apply( false ); - RenderTexture cache = RenderTexture.active; - RenderTexture rt = new RenderTexture( sizeX, sizeY, 0, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Default ); - rt.Create(); - List<Color> texColors = new List<Color>(); - - for( int i = 0; i < m_allTextures.Count; i++ ) - { - // build report - int widthChanges = m_allTextures[ i ].width < sizeX ? -1 : m_allTextures[ i ].width > sizeX ? 1 : 0; - int heightChanges = m_allTextures[ i ].height < sizeY ? -1 : m_allTextures[ i ].height > sizeY ? 1 : 0; - if( ( widthChanges < 0 && heightChanges <= 0 ) || ( widthChanges <= 0 && heightChanges < 0 ) ) - m_message += m_allTextures[ i ].name + " was upscaled\n"; - else if( ( widthChanges > 0 && heightChanges >= 0 ) || ( widthChanges >= 0 && heightChanges > 0 ) ) - m_message += m_allTextures[ i ].name + " was downscaled\n"; - else if( ( widthChanges > 0 && heightChanges < 0 ) || ( widthChanges < 0 && heightChanges > 0 ) ) - m_message += m_allTextures[ i ].name + " changed dimensions\n"; - - // blit image to upscale or downscale the image to any size - RenderTexture.active = rt; - - bool cachedsrgb = GL.sRGBWrite; - GL.sRGBWrite = !m_linearMode; - Graphics.Blit( m_allTextures[ i ], rt ); - GL.sRGBWrite = cachedsrgb; - - Texture2D t2d = new Texture2D( sizeX, sizeY, TextureFormat.ARGB32, m_mipMaps, m_linearMode ); - t2d.ReadPixels( new Rect( 0, 0, sizeX, sizeY ), 0, 0, m_mipMaps ); - RenderTexture.active = null; - - bool isCompressed = UncompressedFormats.FindIndex( x => x.Equals( m_selectedFormatEnum ) ) < 0; - if( isCompressed ) - { - EditorUtility.CompressTexture( t2d, m_selectedFormatEnum, m_quality ); - t2d.Apply( false ); - } - texColors.AddRange( t2d.GetPixels() ); - } - - rt.Release(); - RenderTexture.active = cache; - - if( m_message.Length > 0 ) - m_message = m_message.Substring( 0, m_message.Length - 1 ); - - texture3D.SetPixels( texColors.ToArray() ); - texture3D.Apply(); - - string path = m_folderPath + m_fileName + ".asset"; - Texture3D outfile = AssetDatabase.LoadMainAssetAtPath( path ) as Texture3D; - if( outfile != null ) - { - EditorUtility.CopySerialized( texture3D, outfile ); - AssetDatabase.SaveAssets(); - EditorGUIUtility.PingObject( outfile ); - m_lastSaved = outfile; - } - else - { - AssetDatabase.CreateAsset( texture3D, path ); - EditorGUIUtility.PingObject( texture3D ); - m_lastSaved = texture3D; - } - } - - private void BuildArray() - { - int sizeX = m_sizes[ m_selectedSizeX ]; - int sizeY = m_sizes[ m_selectedSizeY ]; - - Texture2DArray textureArray = new Texture2DArray( sizeX, sizeY, m_allTextures.Count, m_selectedFormatEnum, m_mipMaps, m_linearMode ); - textureArray.wrapMode = m_wrapMode; - textureArray.filterMode = m_filterMode; - textureArray.anisoLevel = m_anisoLevel; - textureArray.Apply( false ); - RenderTexture cache = RenderTexture.active; - RenderTexture rt = new RenderTexture( sizeX, sizeY, 0, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Default ); - rt.Create(); - for( int i = 0; i < m_allTextures.Count; i++ ) - { - // build report - int widthChanges = m_allTextures[ i ].width < sizeX ? -1 : m_allTextures[ i ].width > sizeX ? 1 : 0; - int heightChanges = m_allTextures[ i ].height < sizeY ? -1 : m_allTextures[ i ].height > sizeY ? 1 : 0; - if( ( widthChanges < 0 && heightChanges <= 0 ) || ( widthChanges <= 0 && heightChanges < 0 ) ) - m_message += m_allTextures[ i ].name + " was upscaled\n"; - else if( ( widthChanges > 0 && heightChanges >= 0 ) || ( widthChanges >= 0 && heightChanges > 0 ) ) - m_message += m_allTextures[ i ].name + " was downscaled\n"; - else if( ( widthChanges > 0 && heightChanges < 0 ) || ( widthChanges < 0 && heightChanges > 0 ) ) - m_message += m_allTextures[ i ].name + " changed dimensions\n"; - - // blit image to upscale or downscale the image to any size - RenderTexture.active = rt; - - bool cachedsrgb = GL.sRGBWrite; - GL.sRGBWrite = !m_linearMode; - Graphics.Blit( m_allTextures[ i ], rt ); - GL.sRGBWrite = cachedsrgb; - - Texture2D t2d = new Texture2D( sizeX, sizeY, TextureFormat.ARGB32, m_mipMaps, m_linearMode ); - t2d.ReadPixels( new Rect( 0, 0, sizeX, sizeY ), 0, 0, m_mipMaps ); - RenderTexture.active = null; - - bool isCompressed = UncompressedFormats.FindIndex( x => x.Equals( m_selectedFormatEnum ) ) < 0; - if( isCompressed ) - { - EditorUtility.CompressTexture( t2d, m_selectedFormatEnum, m_quality ); - t2d.Apply( false ); - } - - if( m_mipMaps ) - { - int maxSize = Mathf.Max( sizeX, sizeY ); - for( int mip = 0; mip < MipCount[ maxSize ]; mip++ ) - { - CopyToArray( ref t2d, ref textureArray, i, mip, isCompressed ); - } - } - else - { - CopyToArray( ref t2d, ref textureArray, i, 0, isCompressed ); - } - } - - rt.Release(); - RenderTexture.active = cache; - if( m_message.Length > 0 ) - m_message = m_message.Substring( 0, m_message.Length - 1 ); - - string path = m_folderPath + m_fileName + ".asset"; - Texture2DArray outfile = AssetDatabase.LoadMainAssetAtPath( path ) as Texture2DArray; - if( outfile != null ) - { - EditorUtility.CopySerialized( textureArray, outfile ); - AssetDatabase.SaveAssets(); - EditorGUIUtility.PingObject( outfile ); - m_lastSaved = outfile; - } - else - { - AssetDatabase.CreateAsset( textureArray, path ); - EditorGUIUtility.PingObject( textureArray ); - m_lastSaved = textureArray; - } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/ASETextureArrayCreator.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/ASETextureArrayCreator.cs.meta deleted file mode 100644 index 7a01b4f3..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/ASETextureArrayCreator.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 436dc8bc09773454db57b9fbf799ec9d -timeCreated: 1504633068 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/CustomMaterialInspector.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/CustomMaterialInspector.cs deleted file mode 100644 index d34f6c50..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/CustomMaterialInspector.cs +++ /dev/null @@ -1,509 +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.Reflection; -using AmplifyShaderEditor; - - -public static class MaterialPropertyHandlerEx -{ - private static System.Type type = null; - public static System.Type Type { get { return ( type == null ) ? type = System.Type.GetType( "UnityEditor.MaterialPropertyHandler, UnityEditor" ) : type; } } - public static object GetHandler( Shader shader, string name ) - { - return MaterialPropertyHandlerEx.Type.InvokeMember( "GetHandler", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { shader, name } ); - } - - public static void OnGUI( object obj, ref Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor ) - { - Type.InvokeMember( "OnGUI", BindingFlags.Instance | BindingFlags.Public | BindingFlags.InvokeMethod, null, obj, new object[] { position, prop, label, editor } ); - } - - public static float GetPropertyHeight( object obj, MaterialProperty prop, string label, MaterialEditor editor ) - { - return (float)Type.InvokeMember( "GetPropertyHeight", BindingFlags.Instance | BindingFlags.Public | BindingFlags.InvokeMethod, null, obj, new object[] { prop, label, editor } ); - } - - public static object PropertyDrawer( object obj ) - { - return Type.InvokeMember( "propertyDrawer", BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetProperty, null, obj, new object[] {} ); - } -} - -internal class ASEMaterialInspector : ShaderGUI -{ - private const string CopyButtonStr = "Copy Values"; - private const string PasteButtonStr = "Paste Values"; - private const string PreviewModelPref = "ASEMI_PREVIEWMODEL"; - - private static MaterialEditor m_instance = null; - private static bool m_refreshOnUndo = false; - - private bool m_initialized = false; - private double m_lastRenderedTime; - private PreviewRenderUtility m_previewRenderUtility; - private Mesh m_targetMesh; - private Vector2 m_previewDir = new Vector2( 120f, -20f ); - private int m_selectedMesh = 0; - - - // Reflection Fields - private Type m_modelInspectorType = null; - private MethodInfo m_renderMeshMethod = null; - private Type m_previewGUIType = null; - private MethodInfo m_dragMethod = null; - private FieldInfo m_selectedField = null; - private FieldInfo m_infoField = null; - -#if UNITY_2018_2_OR_NEWER - public override void OnClosed( Material material ) - { - base.OnClosed( material ); - CleanUp(); - } -#endif - - void CleanUp() - { - if( m_previewRenderUtility != null ) - { - m_previewRenderUtility.Cleanup(); - m_previewRenderUtility = null; - } - } - - void UndoRedoPerformed() - { - m_refreshOnUndo = true; - } - - ~ASEMaterialInspector() - { - Undo.undoRedoPerformed -= UndoRedoPerformed; - CleanUp(); - } - public override void OnGUI( MaterialEditor materialEditor, MaterialProperty[] properties ) - { - IOUtils.Init(); - Material mat = materialEditor.target as Material; - - if( mat == null ) - return; - - m_instance = materialEditor; - - if( !m_initialized ) - { - Init(); - m_initialized = true; - Undo.undoRedoPerformed += UndoRedoPerformed; - } - - if( Event.current.type == EventType.Repaint && - mat.HasProperty( IOUtils.DefaultASEDirtyCheckId ) && - mat.GetInt( IOUtils.DefaultASEDirtyCheckId ) == 1 ) - { - mat.SetInt( IOUtils.DefaultASEDirtyCheckId, 0 ); - UIUtils.ForceUpdateFromMaterial(); - //Event.current.Use(); - } - - if( materialEditor.isVisible ) - { - GUILayout.BeginVertical(); - { - GUILayout.Space( 3 ); - if( GUILayout.Button( "Open in Shader Editor" ) ) - { -#if UNITY_2018_3_OR_NEWER - ASEPackageManagerHelper.SetupLateMaterial( mat ); - -#else - AmplifyShaderEditorWindow.LoadMaterialToASE( mat ); -#endif - } - - GUILayout.BeginHorizontal(); - { - if( GUILayout.Button( CopyButtonStr ) ) - { - System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture; - - Shader shader = mat.shader; - int propertyCount = UnityEditor.ShaderUtil.GetPropertyCount( shader ); - string allProperties = string.Empty; - for( int i = 0; i < propertyCount; i++ ) - { - UnityEditor.ShaderUtil.ShaderPropertyType type = UnityEditor.ShaderUtil.GetPropertyType( shader, i ); - string name = UnityEditor.ShaderUtil.GetPropertyName( shader, i ); - string valueStr = string.Empty; - switch( type ) - { - case UnityEditor.ShaderUtil.ShaderPropertyType.Color: - { - Color value = mat.GetColor( name ); - valueStr = value.r.ToString() + IOUtils.VECTOR_SEPARATOR + - value.g.ToString() + IOUtils.VECTOR_SEPARATOR + - value.b.ToString() + IOUtils.VECTOR_SEPARATOR + - value.a.ToString(); - } - break; - case UnityEditor.ShaderUtil.ShaderPropertyType.Vector: - { - Vector4 value = mat.GetVector( name ); - valueStr = value.x.ToString() + IOUtils.VECTOR_SEPARATOR + - value.y.ToString() + IOUtils.VECTOR_SEPARATOR + - value.z.ToString() + IOUtils.VECTOR_SEPARATOR + - value.w.ToString(); - } - break; - case UnityEditor.ShaderUtil.ShaderPropertyType.Float: - { - float value = mat.GetFloat( name ); - valueStr = value.ToString(); - } - break; - case UnityEditor.ShaderUtil.ShaderPropertyType.Range: - { - float value = mat.GetFloat( name ); - valueStr = value.ToString(); - } - break; - case UnityEditor.ShaderUtil.ShaderPropertyType.TexEnv: - { - Texture value = mat.GetTexture( name ); - valueStr = AssetDatabase.GetAssetPath( value ); - Vector2 offset = mat.GetTextureOffset( name ); - Vector2 scale = mat.GetTextureScale( name ); - valueStr += IOUtils.VECTOR_SEPARATOR + scale.x.ToString() + - IOUtils.VECTOR_SEPARATOR + scale.y.ToString() + - IOUtils.VECTOR_SEPARATOR + offset.x.ToString() + - IOUtils.VECTOR_SEPARATOR + offset.y.ToString(); - } - break; - } - - allProperties += name + IOUtils.FIELD_SEPARATOR + type + IOUtils.FIELD_SEPARATOR + valueStr; - - if( i < ( propertyCount - 1 ) ) - { - allProperties += IOUtils.LINE_TERMINATOR; - } - } - EditorPrefs.SetString( IOUtils.MAT_CLIPBOARD_ID, allProperties ); - System.Threading.Thread.CurrentThread.CurrentCulture = System.Threading.Thread.CurrentThread.CurrentUICulture; - } - - if( GUILayout.Button( PasteButtonStr ) ) - { - System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture; - string propertiesStr = EditorPrefs.GetString( IOUtils.MAT_CLIPBOARD_ID, string.Empty ); - if( !string.IsNullOrEmpty( propertiesStr ) ) - { - string[] propertyArr = propertiesStr.Split( IOUtils.LINE_TERMINATOR ); - bool validData = true; - try - { - for( int i = 0; i < propertyArr.Length; i++ ) - { - string[] valuesArr = propertyArr[ i ].Split( IOUtils.FIELD_SEPARATOR ); - if( valuesArr.Length != 3 ) - { - Debug.LogWarning( "Material clipboard data is corrupted" ); - validData = false; - break; - } - else if( mat.HasProperty( valuesArr[ 0 ] ) ) - { - UnityEditor.ShaderUtil.ShaderPropertyType type = (UnityEditor.ShaderUtil.ShaderPropertyType)Enum.Parse( typeof( UnityEditor.ShaderUtil.ShaderPropertyType ), valuesArr[ 1 ] ); - switch( type ) - { - case UnityEditor.ShaderUtil.ShaderPropertyType.Color: - { - string[] colorVals = valuesArr[ 2 ].Split( IOUtils.VECTOR_SEPARATOR ); - if( colorVals.Length != 4 ) - { - Debug.LogWarning( "Material clipboard data is corrupted" ); - validData = false; - break; - } - else - { - mat.SetColor( valuesArr[ 0 ], new Color( Convert.ToSingle( colorVals[ 0 ] ), - Convert.ToSingle( colorVals[ 1 ] ), - Convert.ToSingle( colorVals[ 2 ] ), - Convert.ToSingle( colorVals[ 3 ] ) ) ); - } - } - break; - case UnityEditor.ShaderUtil.ShaderPropertyType.Vector: - { - string[] vectorVals = valuesArr[ 2 ].Split( IOUtils.VECTOR_SEPARATOR ); - if( vectorVals.Length != 4 ) - { - Debug.LogWarning( "Material clipboard data is corrupted" ); - validData = false; - break; - } - else - { - mat.SetVector( valuesArr[ 0 ], new Vector4( Convert.ToSingle( vectorVals[ 0 ] ), - Convert.ToSingle( vectorVals[ 1 ] ), - Convert.ToSingle( vectorVals[ 2 ] ), - Convert.ToSingle( vectorVals[ 3 ] ) ) ); - } - } - break; - case UnityEditor.ShaderUtil.ShaderPropertyType.Float: - { - mat.SetFloat( valuesArr[ 0 ], Convert.ToSingle( valuesArr[ 2 ] ) ); - } - break; - case UnityEditor.ShaderUtil.ShaderPropertyType.Range: - { - mat.SetFloat( valuesArr[ 0 ], Convert.ToSingle( valuesArr[ 2 ] ) ); - } - break; - case UnityEditor.ShaderUtil.ShaderPropertyType.TexEnv: - { - string[] texVals = valuesArr[ 2 ].Split( IOUtils.VECTOR_SEPARATOR ); - if( texVals.Length != 5 ) - { - Debug.LogWarning( "Material clipboard data is corrupted" ); - validData = false; - break; - } - else - { - mat.SetTexture( valuesArr[ 0 ], AssetDatabase.LoadAssetAtPath<Texture>( texVals[ 0 ] ) ); - mat.SetTextureScale( valuesArr[ 0 ], new Vector2( Convert.ToSingle( texVals[ 1 ] ), Convert.ToSingle( texVals[ 2 ] ) ) ); - mat.SetTextureOffset( valuesArr[ 0 ], new Vector2( Convert.ToSingle( texVals[ 3 ] ), Convert.ToSingle( texVals[ 4 ] ) ) ); - } - } - break; - } - } - } - } - catch( Exception e ) - { - Debug.LogException( e ); - validData = false; - } - - - if( validData ) - { - materialEditor.PropertiesChanged(); - UIUtils.CopyValuesFromMaterial( mat ); - } - else - { - EditorPrefs.SetString( IOUtils.MAT_CLIPBOARD_ID, string.Empty ); - } - } - System.Threading.Thread.CurrentThread.CurrentCulture = System.Threading.Thread.CurrentThread.CurrentUICulture; - } - } - GUILayout.EndHorizontal(); - GUILayout.Space( 5 ); - } - GUILayout.EndVertical(); - } - EditorGUI.BeginChangeCheck(); - //base.OnGUI( materialEditor, properties ); - - // Draw custom properties instead of calling BASE to use single line texture properties - materialEditor.SetDefaultGUIWidths(); - - if( m_infoField == null ) - { - m_infoField = typeof( MaterialEditor ).GetField( "m_InfoMessage", BindingFlags.Instance | BindingFlags.NonPublic ); - } - - string info = m_infoField.GetValue( materialEditor ) as string; - if( !string.IsNullOrEmpty( info ) ) - { - EditorGUILayout.HelpBox( info, MessageType.Info ); - } - else - { - GUIUtility.GetControlID( "EditorTextField".GetHashCode(), FocusType.Passive, new Rect( 0f, 0f, 0f, 0f ) ); - } - - for( int i = 0; i < properties.Length; i++ ) - { - if( ( properties[ i ].flags & ( MaterialProperty.PropFlags.HideInInspector | MaterialProperty.PropFlags.PerRendererData ) ) == MaterialProperty.PropFlags.None ) - { - // Removed no scale offset one line texture property for consistency :( sad face - //if( ( properties[ i ].flags & MaterialProperty.PropFlags.NoScaleOffset ) == MaterialProperty.PropFlags.NoScaleOffset ) - //{ - // object obj = MaterialPropertyHandlerEx.GetHandler( mat.shader, properties[ i ].name ); - // if( obj != null ) - // { - // float height = MaterialPropertyHandlerEx.GetPropertyHeight( obj, properties[ i ], properties[ i ].displayName, materialEditor ); - // //Rect rect = (Rect)materialEditor.GetType().InvokeMember( "GetPropertyRect", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.InvokeMethod, null, materialEditor, new object[] { properties[ i ], properties[ i ].displayName, true } ); - // Rect rect = EditorGUILayout.GetControlRect( true, height, EditorStyles.layerMaskField ); - // MaterialPropertyHandlerEx.OnGUI( obj, ref rect, properties[ i ], new GUIContent( properties[ i ].displayName ), materialEditor ); - - // if( MaterialPropertyHandlerEx.PropertyDrawer( obj ) != null ) - // continue; - - // rect = EditorGUILayout.GetControlRect( true, height, EditorStyles.layerMaskField ); - // materialEditor.TexturePropertyMiniThumbnail( rect, properties[ i ], properties[ i ].displayName, string.Empty ); - // } - // else - // { - // materialEditor.TexturePropertySingleLine( new GUIContent( properties[ i ].displayName ), properties[ i ] ); - // } - //} - //else - //{ - float propertyHeight = materialEditor.GetPropertyHeight( properties[ i ], properties[ i ].displayName ); - Rect controlRect = EditorGUILayout.GetControlRect( true, propertyHeight, EditorStyles.layerMaskField, new GUILayoutOption[ 0 ] ); - materialEditor.ShaderProperty( controlRect, properties[ i ], properties[ i ].displayName ); - //} - } - } - - EditorGUILayout.Space(); - materialEditor.RenderQueueField(); -#if UNITY_5_6_OR_NEWER - materialEditor.EnableInstancingField(); -#endif -#if UNITY_5_6_2 || UNITY_5_6_3 || UNITY_5_6_4 || UNITY_2017_1_OR_NEWER - materialEditor.DoubleSidedGIField(); -#endif - materialEditor.LightmapEmissionProperty(); - if( m_refreshOnUndo || EditorGUI.EndChangeCheck() ) - { - m_refreshOnUndo = false; - - string isEmissive = mat.GetTag( "IsEmissive", false, "false" ); - if( isEmissive.Equals( "true" ) ) - { - mat.globalIlluminationFlags &= (MaterialGlobalIlluminationFlags)3; - } - else - { - mat.globalIlluminationFlags |= MaterialGlobalIlluminationFlags.EmissiveIsBlack; - } - - UIUtils.CopyValuesFromMaterial( mat ); - } - - if( materialEditor.RequiresConstantRepaint() && m_lastRenderedTime + 0.032999999821186066 < EditorApplication.timeSinceStartup ) - { - this.m_lastRenderedTime = EditorApplication.timeSinceStartup; - materialEditor.Repaint(); - } - } - - private void Init() - { - string guid = EditorPrefs.GetString( PreviewModelPref, "" ); - if( !string.IsNullOrEmpty( guid ) ) - { - m_targetMesh = AssetDatabase.LoadAssetAtPath<Mesh>( AssetDatabase.GUIDToAssetPath( guid ) ); - } - } - - public override void OnMaterialPreviewSettingsGUI( MaterialEditor materialEditor ) - { - - base.OnMaterialPreviewSettingsGUI( materialEditor ); - - if( UnityEditor.ShaderUtil.hardwareSupportsRectRenderTexture ) - { - EditorGUI.BeginChangeCheck(); - m_targetMesh = (Mesh)EditorGUILayout.ObjectField( m_targetMesh, typeof( Mesh ), false, GUILayout.MaxWidth( 120 ) ); - if( EditorGUI.EndChangeCheck() ) - { - if( m_targetMesh != null ) - { - EditorPrefs.SetString( PreviewModelPref, AssetDatabase.AssetPathToGUID( AssetDatabase.GetAssetPath( m_targetMesh ) ) ); - } - else - { - EditorPrefs.SetString( PreviewModelPref, "" ); - } - } - - if( m_selectedField == null ) - { - m_selectedField = typeof( MaterialEditor ).GetField( "m_SelectedMesh", BindingFlags.Instance | BindingFlags.NonPublic ); - } - - m_selectedMesh = (int)m_selectedField.GetValue( materialEditor ); - - if( m_selectedMesh != 0 ) - { - if( m_targetMesh != null ) - { - m_targetMesh = null; - EditorPrefs.SetString( PreviewModelPref, "" ); - } - } - } - } - - public override void OnMaterialInteractivePreviewGUI( MaterialEditor materialEditor, Rect r, GUIStyle background ) - { - if( Event.current.type == EventType.DragExited ) - { - if( DragAndDrop.objectReferences.Length > 0 ) - { - GameObject dropped = DragAndDrop.objectReferences[ 0 ] as GameObject; - if( dropped != null ) - { - m_targetMesh = AssetDatabase.LoadAssetAtPath<Mesh>( AssetDatabase.GetAssetPath( dropped ) ); - EditorPrefs.SetString( PreviewModelPref, AssetDatabase.AssetPathToGUID( AssetDatabase.GetAssetPath( m_targetMesh ) ) ); - } - } - } - - if( m_targetMesh == null ) - { - base.OnMaterialInteractivePreviewGUI( materialEditor, r, background ); - return; - } - - Material mat = materialEditor.target as Material; - - if( m_previewRenderUtility == null ) - { - m_previewRenderUtility = new PreviewRenderUtility(); -#if UNITY_2017_1_OR_NEWER - m_previewRenderUtility.cameraFieldOfView = 30f; -#else - m_previewRenderUtility.m_CameraFieldOfView = 30f; -#endif - } - - if( m_previewGUIType == null ) - { - m_previewGUIType = Type.GetType( "PreviewGUI, UnityEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null" ); - m_dragMethod = m_previewGUIType.GetMethod( "Drag2D", BindingFlags.Static | BindingFlags.Public ); - } - - if( m_modelInspectorType == null ) - { - m_modelInspectorType = Type.GetType( "UnityEditor.ModelInspector, UnityEditor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null" ); - m_renderMeshMethod = m_modelInspectorType.GetMethod( "RenderMeshPreview", BindingFlags.Static | BindingFlags.NonPublic ); - } - - m_previewDir = (Vector2)m_dragMethod.Invoke( m_previewGUIType, new object[] { m_previewDir, r } ); - - if( Event.current.type == EventType.Repaint ) - { - m_previewRenderUtility.BeginPreview( r, background ); - m_renderMeshMethod.Invoke( m_modelInspectorType, new object[] { m_targetMesh, m_previewRenderUtility, mat, null, m_previewDir, -1 } ); - m_previewRenderUtility.EndAndDrawPreview( r ); - } - } - - public static MaterialEditor Instance { get { return m_instance; } set { m_instance = value; } } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/CustomMaterialInspector.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/CustomMaterialInspector.cs.meta deleted file mode 100644 index c587b4c4..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/CustomMaterialInspector.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: a1c012872b428594f95e585bd19e5347 -timeCreated: 1481126958 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/CustomShaderInspector.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/CustomShaderInspector.cs deleted file mode 100644 index 439f777e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/CustomShaderInspector.cs +++ /dev/null @@ -1,963 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using System.Reflection; -using System.Globalization; -using UnityEngine; -using AmplifyShaderEditor; - -namespace UnityEditor -{ - [CustomEditor( typeof( Shader ) )] - internal class CustomShaderInspector : Editor - { - internal class Styles - { - public static Texture2D errorIcon = EditorGUIUtilityEx.LoadIcon( "console.erroricon.sml" ); - - public static Texture2D warningIcon = EditorGUIUtilityEx.LoadIcon( "console.warnicon.sml" ); - - public static GUIContent showSurface = EditorGUIUtilityEx.TextContent( "Show generated code|Show generated code of a surface shader" ); - - public static GUIContent showFF = EditorGUIUtilityEx.TextContent( "Show generated code|Show generated code of a fixed function shader" ); - - public static GUIContent showCurrent = new GUIContent( "Compile and show code | â–¾" ); - - public static GUIStyle messageStyle = "CN StatusInfo"; - - public static GUIStyle evenBackground = "CN EntryBackEven"; - - public static GUIContent no = EditorGUIUtilityEx.TextContent( "no" ); - - public static GUIContent builtinShader = EditorGUIUtilityEx.TextContent( "Built-in shader" ); - - public static GUIContent arrayValuePopupButton = EditorGUIUtilityEx.TextContent( "..." ); - } - - private const float kSpace = 5f; - - const float kValueFieldWidth = 200.0f; - const float kArrayValuePopupBtnWidth = 25.0f; - - private static readonly string[] kPropertyTypes = new string[] - { - "Color: ", - "Vector: ", - "Float: ", - "Range: ", - "Texture: " - }; - - private static readonly string[] kTextureTypes = new string[] - { - "No Texture?: ", - "1D?: ", - "2D: ", - "3D: ", - "Cube: ", - "2DArray: ", - "Any texture: " - }; - - private static readonly int kErrorViewHash = "ShaderErrorView".GetHashCode(); - - private Vector2 m_ScrollPosition = Vector2.zero; - - private PreviewRenderUtility m_previewRenderUtility; - private Material m_material; - private Mesh m_previewMesh; - private Vector2 m_mouseDelta; - private Transform m_cameraTransform; - - private static int m_sliderHashCode = -1; - private const float MaxDeltaY = 90; - private const int DefaultMouseSpeed = 1; - private const int ShiftMouseSpeed = 3; - private const float DeltaMultiplier = 135f; - private void ValidateData() - { - if ( m_previewRenderUtility == null ) - { - m_previewRenderUtility = new PreviewRenderUtility(); -#if UNITY_2017_1_OR_NEWER - m_cameraTransform = m_previewRenderUtility.camera.transform; -#else - m_cameraTransform = m_previewRenderUtility.m_Camera.transform; -#endif - m_cameraTransform.position = new Vector3( 0, 0, -4 ); - m_cameraTransform.rotation = Quaternion.identity; - } - - if ( m_material == null ) - { - m_material = new Material( target as Shader ); - m_material.hideFlags = HideFlags.DontSave; - } - - if ( m_previewMesh == null ) - { - m_previewMesh = Resources.GetBuiltinResource<Mesh>( "Sphere.fbx" ); - } - - if ( m_sliderHashCode < 0 ) - { - "Slider".GetHashCode(); - } - } - - public override bool HasPreviewGUI() - { - ValidateData(); - return true; - } - - public static Vector2 CheckMouseMovement( Vector2 scrollPosition, Rect position ) - { - int controlID = GUIUtility.GetControlID( m_sliderHashCode, FocusType.Passive ); - Event current = Event.current; - switch ( current.GetTypeForControl( controlID ) ) - { - case EventType.MouseDown: - { - if ( position.Contains( current.mousePosition ) && position.width > 50f ) - { - GUIUtility.hotControl = controlID; - current.Use(); - EditorGUIUtility.SetWantsMouseJumping( 1 ); - } - } - break; - case EventType.MouseUp: - { - if ( GUIUtility.hotControl == controlID ) - { - GUIUtility.hotControl = 0; - } - EditorGUIUtility.SetWantsMouseJumping( 0 ); - } - break; - case EventType.MouseDrag: - { - if ( GUIUtility.hotControl == controlID ) - { - scrollPosition -= DeltaMultiplier * current.delta * ( float ) ( ( current.shift ) ? ShiftMouseSpeed : DefaultMouseSpeed ) / Mathf.Min( position.width, position.height ); - scrollPosition.y = Mathf.Clamp( scrollPosition.y, -MaxDeltaY, MaxDeltaY ); - current.Use(); - } - } - break; - } - return scrollPosition; - } - - public override void OnPreviewGUI( Rect r, GUIStyle background ) - { - m_mouseDelta = CheckMouseMovement( m_mouseDelta, r ); - - if ( Event.current.type == EventType.Repaint ) - { - m_previewRenderUtility.BeginPreview( r, background ); - - Texture resultRender = m_previewRenderUtility.EndPreview(); - m_previewRenderUtility.DrawMesh( m_previewMesh, Matrix4x4.identity, m_material, 0 ); - m_cameraTransform.rotation = Quaternion.Euler( new Vector3( -m_mouseDelta.y, -m_mouseDelta.x, 0 ) ); - m_cameraTransform.position = m_cameraTransform.forward * -8f; -#if UNITY_2017_1_OR_NEWER - m_previewRenderUtility.camera.Render(); -#else - m_previewRenderUtility.m_Camera.Render(); -#endif - GUI.DrawTexture( r, resultRender, ScaleMode.StretchToFill, false ); - } - } - - void OnDestroy() - { - CleanUp(); - } - - public void OnDisable() - { - CleanUp(); - if( m_SrpCompatibilityCheckMaterial != null ) - { - GameObject.DestroyImmediate( m_SrpCompatibilityCheckMaterial ); - } - } - - void CleanUp() - { - if( m_previewRenderUtility != null ) - { - m_previewRenderUtility.Cleanup(); - m_previewRenderUtility = null; - } - - if( m_previewMesh != null ) - { - Resources.UnloadAsset( m_previewMesh ); - m_previewMesh = null; - } - - if( m_previewRenderUtility != null ) - { - m_previewRenderUtility.Cleanup(); - m_previewRenderUtility = null; - } - m_material = null; - } - - private Material m_SrpCompatibilityCheckMaterial = null; - public Material srpCompatibilityCheckMaterial - { - get - { - if( m_SrpCompatibilityCheckMaterial == null ) - { - m_SrpCompatibilityCheckMaterial = new Material( target as Shader ); - } - return m_SrpCompatibilityCheckMaterial; - } - } - - public virtual void OnEnable() - { - Shader s = this.target as Shader; - if( s!= null ) - ShaderUtilEx.FetchCachedErrors( s ); - } - - private static string GetPropertyType( Shader s, int index ) - { - UnityEditor.ShaderUtil.ShaderPropertyType propertyType = UnityEditor.ShaderUtil.GetPropertyType( s, index ); - if ( propertyType == UnityEditor.ShaderUtil.ShaderPropertyType.TexEnv ) - { - return CustomShaderInspector.kTextureTypes[ ( int ) UnityEditor.ShaderUtil.GetTexDim( s, index ) ]; - } - return CustomShaderInspector.kPropertyTypes[ ( int ) propertyType ]; - } - - public override void OnInspectorGUI() - { - Shader shader = this.target as Shader; - if ( shader == null ) - { - return; - } - - GUI.enabled = true; - - GUILayout.Space( 3 ); - GUILayout.BeginHorizontal(); - { - if ( GUILayout.Button( "Open in Shader Editor" ) ) - { -#if UNITY_2018_3_OR_NEWER - ASEPackageManagerHelper.SetupLateShader( shader ); -#else - AmplifyShaderEditorWindow.ConvertShaderToASE( shader ); -#endif - } - - if ( GUILayout.Button( "Open in Text Editor" ) ) - { - if( UIUtils.IsUnityNativeShader( shader ) ) - { - Debug.LogWarningFormat( "Action not allowed. Attempting to load the native {0} shader into Text Editor", shader.name ); - } - else - { - AssetDatabase.OpenAsset( shader, 1 ); - } - } - } - GUILayout.EndHorizontal(); - - GUILayout.Space( 5 ); - EditorGUI.indentLevel = 0; - this.ShowShaderCodeArea( shader ); - if ( shader.isSupported ) - { - EditorGUILayout.LabelField( "Cast shadows", ( !ShaderUtilEx.HasShadowCasterPass( shader ) ) ? "no" : "yes", new GUILayoutOption[ 0 ] ); - EditorGUILayout.LabelField( "Render queue", ShaderUtilEx.GetRenderQueue( shader ).ToString( System.Globalization.CultureInfo.InvariantCulture ), new GUILayoutOption[ 0 ] ); - EditorGUILayout.LabelField( "LOD", ShaderUtilEx.GetLOD( shader ).ToString( System.Globalization.CultureInfo.InvariantCulture ), new GUILayoutOption[ 0 ] ); - EditorGUILayout.LabelField( "Ignore projector", ( !ShaderUtilEx.DoesIgnoreProjector( shader ) ) ? "no" : "yes", new GUILayoutOption[ 0 ] ); - string label; - switch ( ShaderEx.GetDisableBatching( shader ) ) - { - case DisableBatchingType.False: - label = "no"; - break; - case DisableBatchingType.True: - label = "yes"; - break; - case DisableBatchingType.WhenLODFading: - label = "when LOD fading is on"; - break; - default: - label = "unknown"; - break; - } - EditorGUILayout.LabelField( "Disable batching", label, new GUILayoutOption[ 0 ] ); -#if UNITY_2019_3_OR_NEWER - ShowKeywords( shader ); - srpCompatibilityCheckMaterial.SetPass( 0 ); -#endif - -#if UNITY_2018_3_OR_NEWER - int shaderActiveSubshaderIndex = ShaderUtilEx.GetShaderActiveSubshaderIndex( shader ); - int sRPBatcherCompatibilityCode = ShaderUtilEx.GetSRPBatcherCompatibilityCode( shader, shaderActiveSubshaderIndex ); - string label2 = ( sRPBatcherCompatibilityCode != 0 ) ? "not compatible" : "compatible"; - EditorGUILayout.LabelField( "SRP Batcher", label2 ); - if( sRPBatcherCompatibilityCode != 0 ) - { - EditorGUILayout.HelpBox( ShaderUtilEx.GetSRPBatcherCompatibilityIssueReason( shader, shaderActiveSubshaderIndex, sRPBatcherCompatibilityCode ), MessageType.Info ); - } -#endif - CustomShaderInspector.ShowShaderProperties( shader ); - } - } -#if UNITY_2019_3_OR_NEWER - private void ShowKeywords( Shader s ) - { - EditorGUILayout.BeginHorizontal(); - EditorGUILayout.PrefixLabel( "Keywords", EditorStyles.miniButton ); - - Rect buttonRect = GUILayoutUtility.GetRect( Styles.arrayValuePopupButton, GUI.skin.button, GUILayout.MinWidth( kValueFieldWidth ) ); - buttonRect.width = kArrayValuePopupBtnWidth; - if( GUI.Button( buttonRect, Styles.arrayValuePopupButton, EditorStyles.miniButton ) ) - { - var globalKeywords = ShaderUtilEx.GetShaderGlobalKeywords( s ); - var localKeywords = ShaderUtilEx.GetShaderLocalKeywords( s ); - PopupWindow.Show( buttonRect, new KeywordsPopup( globalKeywords, localKeywords, 150.0f ) ); - } - - EditorGUILayout.EndHorizontal(); - } -#endif - private void ShowShaderCodeArea( Shader s ) - { - CustomShaderInspector.ShowSurfaceShaderButton( s ); - CustomShaderInspector.ShowFixedFunctionShaderButton( s ); - this.ShowCompiledCodeButton( s ); - this.ShowShaderErrors( s ); - } - - private static void ShowShaderProperties( Shader s ) - { - GUILayout.Space( 5f ); - GUILayout.Label( "Properties:", EditorStyles.boldLabel, new GUILayoutOption[ 0 ] ); - int propertyCount = UnityEditor.ShaderUtil.GetPropertyCount( s ); - for ( int i = 0; i < propertyCount; i++ ) - { - string propertyName = UnityEditor.ShaderUtil.GetPropertyName( s, i ); - string label = CustomShaderInspector.GetPropertyType( s, i ) + UnityEditor.ShaderUtil.GetPropertyDescription( s, i ); - EditorGUILayout.LabelField( propertyName, label, new GUILayoutOption[ 0 ] ); - } - } - - internal static void ShaderErrorListUI( UnityEngine.Object shader, ShaderError[] errors, ref Vector2 scrollPosition ) - { - int num = errors.Length; - GUILayout.Space( 5f ); - GUILayout.Label( string.Format( "Errors ({0}):", num ), EditorStyles.boldLabel, new GUILayoutOption[ 0 ] ); - int controlID = GUIUtility.GetControlID( CustomShaderInspector.kErrorViewHash, FocusType.Passive ); - float minHeight = Mathf.Min( ( float ) num * 20f + 40f, 150f ); - scrollPosition = GUILayout.BeginScrollView( scrollPosition, GUISkinEx.GetCurrentSkin().box, new GUILayoutOption[] - { - GUILayout.MinHeight(minHeight) - } ); - EditorGUIUtility.SetIconSize( new Vector2( 16f, 16f ) ); - float height = CustomShaderInspector.Styles.messageStyle.CalcHeight( EditorGUIUtilityEx.TempContent( CustomShaderInspector.Styles.errorIcon ), 100f ); - Event current = Event.current; - for ( int i = 0; i < num; i++ ) - { - Rect controlRect = EditorGUILayout.GetControlRect( false, height, new GUILayoutOption[ 0 ] ); - string message = errors[ i ].message; - string platform = errors[ i ].platform; - bool flag = errors[ i ].warning != 0; - string lastPathNameComponent = FileUtilEx.GetLastPathNameComponent( errors[ i ].file ); - int line = errors[ i ].line; - if ( current.type == EventType.MouseDown && current.button == 0 && controlRect.Contains( current.mousePosition ) ) - { - GUIUtility.keyboardControl = controlID; - if ( current.clickCount == 2 ) - { - string file = errors[ i ].file; - UnityEngine.Object @object = ( !string.IsNullOrEmpty( file ) ) ? AssetDatabase.LoadMainAssetAtPath( file ) : null; - AssetDatabase.OpenAsset( @object ?? shader, line ); - GUIUtility.ExitGUI(); - } - current.Use(); - } - if ( current.type == EventType.ContextClick && controlRect.Contains( current.mousePosition ) ) - { - current.Use(); - GenericMenu genericMenu = new GenericMenu(); - int errorIndex = i; - genericMenu.AddItem( new GUIContent( "Copy error text" ), false, delegate - { - string text = errors[ errorIndex ].message; - if ( !string.IsNullOrEmpty( errors[ errorIndex ].messageDetails ) ) - { - text += '\n'; - text += errors[ errorIndex ].messageDetails; - } - EditorGUIUtility.systemCopyBuffer = text; - } ); - genericMenu.ShowAsContext(); - } - if ( current.type == EventType.Repaint && ( i & 1 ) == 0 ) - { - GUIStyle evenBackground = CustomShaderInspector.Styles.evenBackground; - evenBackground.Draw( controlRect, false, false, false, false ); - } - Rect rect = controlRect; - rect.xMin = rect.xMax; - if ( line > 0 ) - { - GUIContent content; - if ( string.IsNullOrEmpty( lastPathNameComponent ) ) - { - content = EditorGUIUtilityEx.TempContent( line.ToString( System.Globalization.CultureInfo.InvariantCulture ) ); - } - else - { - content = EditorGUIUtilityEx.TempContent( lastPathNameComponent + ":" + line.ToString( System.Globalization.CultureInfo.InvariantCulture ) ); - } - Vector2 vector = EditorStyles.miniLabel.CalcSize( content ); - rect.xMin -= vector.x; - GUI.Label( rect, content, EditorStyles.miniLabel ); - rect.xMin -= 2f; - if ( rect.width < 30f ) - { - rect.xMin = rect.xMax - 30f; - } - } - Rect position = rect; - position.width = 0f; - if ( platform.Length > 0 ) - { - GUIContent content2 = EditorGUIUtilityEx.TempContent( platform ); - Vector2 vector2 = EditorStyles.miniLabel.CalcSize( content2 ); - position.xMin -= vector2.x; - Color contentColor = GUI.contentColor; - GUI.contentColor = new Color( 1f, 1f, 1f, 0.5f ); - GUI.Label( position, content2, EditorStyles.miniLabel ); - GUI.contentColor = contentColor; - position.xMin -= 2f; - } - Rect position2 = controlRect; - position2.xMax = position.xMin; - GUI.Label( position2, EditorGUIUtilityEx.TempContent( message, ( !flag ) ? CustomShaderInspector.Styles.errorIcon : CustomShaderInspector.Styles.warningIcon ), CustomShaderInspector.Styles.messageStyle ); - } - EditorGUIUtility.SetIconSize( Vector2.zero ); - GUILayout.EndScrollView(); - } - -#if UNITY_2019_3_OR_NEWER - ShaderMessage[] m_ShaderMessages; -#endif - private void ShowShaderErrors( Shader s ) - { -#if UNITY_2019_3_OR_NEWER - if( Event.current.type == EventType.Layout ) - { - int n = ShaderUtil.GetShaderMessageCount( s ); - m_ShaderMessages = null; - if( n >= 1 ) - { - m_ShaderMessages = ShaderUtil.GetShaderMessages( s ); - } - } - - if( m_ShaderMessages == null ) - return; - - ShaderInspectorEx.ShaderErrorListUI( s, m_ShaderMessages, ref this.m_ScrollPosition ); -#else - int shaderErrorCount = ShaderUtilEx.GetShaderErrorCount( s ); - if ( shaderErrorCount < 1 ) - { - return; - } - CustomShaderInspector.ShaderErrorListUI( s, ShaderUtilEx.GetShaderErrors( s ), ref this.m_ScrollPosition ); -#endif - } - - private void ShowCompiledCodeButton( Shader s ) - { - EditorGUILayout.BeginHorizontal( new GUILayoutOption[ 0 ] ); - EditorGUILayout.PrefixLabel( "Compiled code", EditorStyles.miniButton ); - bool flag = ShaderUtilEx.HasShaderSnippets( s ) || ShaderUtilEx.HasSurfaceShaders( s ) || ShaderUtilEx.HasFixedFunctionShaders( s ); - if ( flag ) - { - GUIContent showCurrent = CustomShaderInspector.Styles.showCurrent; - Rect rect = GUILayoutUtility.GetRect( showCurrent, EditorStyles.miniButton, new GUILayoutOption[] - { - GUILayout.ExpandWidth(false) - } ); - Rect position = new Rect( rect.xMax - 16f, rect.y, 16f, rect.height ); - if ( EditorGUIEx.ButtonMouseDown( position, GUIContent.none, FocusType.Passive, GUIStyle.none ) ) - { - Rect last = GUILayoutUtilityEx.TopLevel_GetLast(); - PopupWindow.Show( last, ( PopupWindowContent ) Activator.CreateInstance( System.Type.GetType( "UnityEditor.ShaderInspectorPlatformsPopup, UnityEditor" ), new object[] { s } ) ); - GUIUtility.ExitGUI(); - } - if ( GUI.Button( rect, showCurrent, EditorStyles.miniButton ) ) - { - ShaderUtilEx.OpenCompiledShader( s, ShaderInspectorPlatformsPopupEx.GetCurrentMode(), ShaderInspectorPlatformsPopupEx.GetCurrentPlatformMask(), ShaderInspectorPlatformsPopupEx.GetCurrentVariantStripping() == 0 ); - GUIUtility.ExitGUI(); - } - } - else - { - GUILayout.Button( "none (precompiled shader)", GUI.skin.label, new GUILayoutOption[ 0 ] ); - } - EditorGUILayout.EndHorizontal(); - } - - private static void ShowSurfaceShaderButton( Shader s ) - { - bool flag = ShaderUtilEx.HasSurfaceShaders( s ); - EditorGUILayout.BeginHorizontal( new GUILayoutOption[ 0 ] ); - EditorGUILayout.PrefixLabel( "Surface shader", EditorStyles.miniButton ); - if ( flag ) - { - if ( !( AssetImporter.GetAtPath( AssetDatabase.GetAssetPath( s ) ) == null ) ) - { - if ( GUILayout.Button( CustomShaderInspector.Styles.showSurface, EditorStyles.miniButton, new GUILayoutOption[] - { - GUILayout.ExpandWidth(false) - } ) ) - { - ShaderUtilEx.OpenParsedSurfaceShader( s ); - GUIUtility.ExitGUI(); - } - } - else - { - GUILayout.Button( CustomShaderInspector.Styles.builtinShader, GUI.skin.label, new GUILayoutOption[ 0 ] ); - } - } - else - { - GUILayout.Button( CustomShaderInspector.Styles.no, GUI.skin.label, new GUILayoutOption[ 0 ] ); - } - EditorGUILayout.EndHorizontal(); - } - - private static void ShowFixedFunctionShaderButton( Shader s ) - { - bool flag = ShaderUtilEx.HasFixedFunctionShaders( s ); - EditorGUILayout.BeginHorizontal( new GUILayoutOption[ 0 ] ); - EditorGUILayout.PrefixLabel( "Fixed function", EditorStyles.miniButton ); - if ( flag ) - { - if ( !( AssetImporter.GetAtPath( AssetDatabase.GetAssetPath( s ) ) == null ) ) - { - if ( GUILayout.Button( CustomShaderInspector.Styles.showFF, EditorStyles.miniButton, new GUILayoutOption[] - { - GUILayout.ExpandWidth(false) - } ) ) - { - ShaderUtilEx.OpenGeneratedFixedFunctionShader( s ); - GUIUtility.ExitGUI(); - } - } - else - { - GUILayout.Button( CustomShaderInspector.Styles.builtinShader, GUI.skin.label, new GUILayoutOption[ 0 ] ); - } - } - else - { - GUILayout.Button( CustomShaderInspector.Styles.no, GUI.skin.label, new GUILayoutOption[ 0 ] ); - } - EditorGUILayout.EndHorizontal(); - } - } - - internal class KeywordsPopup : PopupWindowContent - { - private Vector2 m_ScrollPos = Vector2.zero; - private string[] m_GlobalKeywords; - private string[] m_LocalKeywords; - private bool m_GlobalKeywordsExpended; - private bool m_LocalKeywordsExpended; - private float m_WindowWidth; - - private static readonly GUIStyle m_Style = EditorStyles.miniLabel; - - public KeywordsPopup( string[] globalKeywords, string[] localKeywords, float windowWidth ) - { - m_GlobalKeywords = globalKeywords; - m_LocalKeywords = localKeywords; - m_GlobalKeywordsExpended = true; - m_LocalKeywordsExpended = true; - m_WindowWidth = windowWidth; - } - - public override Vector2 GetWindowSize() - { - var numValues = m_GlobalKeywords.Length + m_LocalKeywords.Length + 2; - var lineHeight = m_Style.lineHeight + m_Style.padding.vertical + m_Style.margin.top; - return new Vector2( m_WindowWidth, Math.Min( lineHeight * numValues, 250.0f ) ); - } - - public override void OnGUI( Rect rect ) - { - m_ScrollPos = EditorGUILayout.BeginScrollView( m_ScrollPos ); - - m_GlobalKeywordsExpended = KeywordsFoldout( m_GlobalKeywordsExpended, "Global Keywords", m_GlobalKeywords ); - m_LocalKeywordsExpended = KeywordsFoldout( m_LocalKeywordsExpended, "Local Keywords", m_LocalKeywords ); - - EditorGUILayout.EndScrollView(); - } - - private bool KeywordsFoldout( bool expended, string name, string[] values ) - { - expended = EditorGUILayout.Foldout( expended, name, true, m_Style ); - - if( expended ) - { - EditorGUI.indentLevel++; - for( int i = 0; i < values.Length; ++i ) - { - EditorGUILayout.LabelField( values[ i ], m_Style ); - } - EditorGUI.indentLevel--; - } - - return expended; - } - } - - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - // UNITY EDITOR EXTENSIONS - /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - - public enum DisableBatchingType - { - False, - True, - WhenLODFading - } - - public struct ShaderError - { - public string message; - public string messageDetails; - public string platform; - public string file; - public int line; - public int warning; - } - - public static class EditorGUIUtilityEx - { - private static System.Type type = null; - public static System.Type Type { get { return ( type == null ) ? type = System.Type.GetType( "UnityEditor.EditorGUIUtility, UnityEditor" ) : type; } } - - public static Texture2D LoadIcon( string icon ) - { - return ( Texture2D ) EditorGUIUtilityEx.Type.InvokeMember( "LoadIcon", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { icon } ); - } - - public static GUIContent TextContent( string t ) - { - return ( GUIContent ) EditorGUIUtilityEx.Type.InvokeMember( "TextContent", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { t } ); - } - - internal static GUIContent TempContent( string t ) - { - return ( GUIContent ) EditorGUIUtilityEx.Type.InvokeMember( "TempContent", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { t } ); - } - - internal static GUIContent TempContent( Texture i ) - { - return ( GUIContent ) EditorGUIUtilityEx.Type.InvokeMember( "TempContent", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { i } ); - } - - internal static GUIContent TempContent( string t, Texture i ) - { - return ( GUIContent ) EditorGUIUtilityEx.Type.InvokeMember( "TempContent", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { t, i } ); - } - } - - public static class EditorGUILayoutEx - { - public static System.Type Type = typeof( EditorGUILayout ); - public static Gradient GradientField( Gradient value, params GUILayoutOption[] options ) - { -#if UNITY_2018_3_OR_NEWER - return EditorGUILayout.GradientField( value, options ); -#else - MethodInfo method = EditorGUILayoutEx.Type.GetMethod( "GradientField", BindingFlags.NonPublic | BindingFlags.Static, null, new Type[] { typeof( Gradient ), typeof( GUILayoutOption[] ) }, null ); - return (Gradient)method.Invoke( Type, new object[]{ value, options} ); -#endif - } - - public static Gradient GradientField( string label, Gradient value, params GUILayoutOption[] options ) - { -#if UNITY_2018_3_OR_NEWER - return EditorGUILayout.GradientField( label, value, options ); -#else - MethodInfo method = EditorGUILayoutEx.Type.GetMethod( "GradientField", BindingFlags.NonPublic | BindingFlags.Static, null, new Type[] { typeof( string ), typeof( Gradient ), typeof( GUILayoutOption[] ) }, null ); - return (Gradient)method.Invoke( Type, new object[] { label, value, options } ); -#endif - } - } - - public static class GUILayoutUtilityEx - { - private static System.Type type = null; - public static System.Type Type { get { return ( type == null ) ? type = System.Type.GetType( "UnityEngine.GUILayoutUtility, UnityEngine" ) : type; } } - - public static Rect TopLevel_GetLast() - { - System.Type guiLayoutGroup = System.Type.GetType( "UnityEngine.GUILayoutGroup, UnityEngine" ); - var topLevel = GUILayoutUtilityEx.Type.GetProperty( "topLevel", BindingFlags.NonPublic | BindingFlags.Static ).GetValue( null, null ); - return ( Rect ) guiLayoutGroup.InvokeMember( "GetLast", BindingFlags.Public | BindingFlags.Instance | BindingFlags.InvokeMethod, null, topLevel, new object[] { } ); - } - } - - public static class ShaderEx - { - private static System.Type type = null; - public static System.Type Type { get { return ( type == null ) ? type = System.Type.GetType( "UnityEngine.Shader, UnityEngine" ) : type; } } - - public static DisableBatchingType GetDisableBatching( Shader s ) - { - return ( DisableBatchingType ) ShaderEx.Type.GetProperty( "disableBatching", BindingFlags.NonPublic | BindingFlags.Instance ).GetValue( s, new object[ 0 ] ); - } - } - - public static class ShaderUtilEx - { - private static System.Type type = null; - public static System.Type Type { get { return ( type == null ) ? type = System.Type.GetType( "UnityEditor.ShaderUtil, UnityEditor" ) : type; } } - - public static void OpenParsedSurfaceShader( Shader s ) - { - ShaderUtilEx.Type.InvokeMember( "OpenParsedSurfaceShader", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { s } ); - } - - public static void OpenGeneratedFixedFunctionShader( Shader s ) - { - ShaderUtilEx.Type.InvokeMember( "OpenGeneratedFixedFunctionShader", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { s } ); - } - - public static void OpenCompiledShader( Shader shader, int mode, int customPlatformsMask, bool includeAllVariants ) - { - ShaderUtilEx.Type.InvokeMember( "OpenCompiledShader", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { shader, mode, customPlatformsMask, includeAllVariants } ); - } - - public static void FetchCachedErrors( Shader s ) - { -#if UNITY_2019_3_OR_NEWER - ShaderUtilEx.Type.InvokeMember( "FetchCachedMessages", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { s } ); -#else - ShaderUtilEx.Type.InvokeMember( "FetchCachedErrors", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { s } ); -#endif - } - - public static string[] GetShaderGlobalKeywords( Shader s ) - { - return ShaderUtilEx.Type.InvokeMember( "GetShaderGlobalKeywords", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { s } ) as string[]; - } - - public static string[] GetShaderLocalKeywords( Shader s ) - { - return ShaderUtilEx.Type.InvokeMember( "GetShaderLocalKeywords", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { s } ) as string[]; - } - - public static int GetShaderErrorCount( Shader s ) - { -#if UNITY_2019_3_OR_NEWER - return ShaderUtil.GetShaderMessageCount( s ); -#else - return ( int ) ShaderUtilEx.Type.InvokeMember( "GetShaderErrorCount", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { s } ); -#endif - } - - public static int GetAvailableShaderCompilerPlatforms() - { - return (int)ShaderUtilEx.Type.InvokeMember( "GetAvailableShaderCompilerPlatforms", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { } ); - } - - public static ShaderError[] GetShaderErrors( Shader s ) - { - System.Type shaderErrorType = System.Type.GetType( "UnityEditor.ShaderError, UnityEditor" ); - var errorList = ( System.Collections.IList ) ShaderUtilEx.Type.InvokeMember( "GetShaderErrors", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { s } ); - - FieldInfo messageField = shaderErrorType.GetField( "message", BindingFlags.Public | BindingFlags.Instance ); - FieldInfo messageDetailsField = shaderErrorType.GetField( "messageDetails", BindingFlags.Public | BindingFlags.Instance ); - FieldInfo platformField = shaderErrorType.GetField( "platform", BindingFlags.Public | BindingFlags.Instance ); - FieldInfo fileField = shaderErrorType.GetField( "file", BindingFlags.Public | BindingFlags.Instance ); - FieldInfo lineField = shaderErrorType.GetField( "line", BindingFlags.Public | BindingFlags.Instance ); - FieldInfo warningField = shaderErrorType.GetField( "warning", BindingFlags.Public | BindingFlags.Instance ); - - ShaderError[] errors = new ShaderError[ errorList.Count ]; - for ( int i = 0; i < errorList.Count; i++ ) - { - errors[ i ].message = ( string ) messageField.GetValue( errorList[ i ] ); - errors[ i ].messageDetails = ( string ) messageDetailsField.GetValue( errorList[ i ] ); - errors[ i ].platform = ( string ) platformField.GetValue( errorList[ i ] ); - errors[ i ].file = ( string ) fileField.GetValue( errorList[ i ] ); - errors[ i ].line = ( int ) lineField.GetValue( errorList[ i ] ); - errors[ i ].warning = ( int ) warningField.GetValue( errorList[ i ] ); - } - return errors; - } - - public static bool HasShaderSnippets( Shader s ) - { - return ( bool ) ShaderUtilEx.Type.InvokeMember( "HasShaderSnippets", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { s } ); - } - - public static bool HasSurfaceShaders( Shader s ) - { - return ( bool ) ShaderUtilEx.Type.InvokeMember( "HasSurfaceShaders", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { s } ); - } - - public static bool HasFixedFunctionShaders( Shader s ) - { - return ( bool ) ShaderUtilEx.Type.InvokeMember( "HasFixedFunctionShaders", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { s } ); - } - - public static bool HasShadowCasterPass( Shader s ) - { - return ( bool ) ShaderUtilEx.Type.InvokeMember( "HasShadowCasterPass", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { s } ); - } - - public static int GetRenderQueue( Shader s ) - { - return ( int ) ShaderUtilEx.Type.InvokeMember( "GetRenderQueue", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { s } ); - } - - public static int GetLOD( Shader s ) - { - return ( int ) ShaderUtilEx.Type.InvokeMember( "GetLOD", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { s } ); - } - - public static bool DoesIgnoreProjector( Shader s ) - { - return ( bool ) ShaderUtilEx.Type.InvokeMember( "DoesIgnoreProjector", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { s } ); - } - -#if UNITY_2018_3_OR_NEWER - public static int GetShaderActiveSubshaderIndex( Shader s ) - { - return (int)ShaderUtilEx.Type.InvokeMember( "GetShaderActiveSubshaderIndex", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { s } ); - } - - public static int GetSRPBatcherCompatibilityCode( Shader s, int subShaderIdx ) - { - return (int)ShaderUtilEx.Type.InvokeMember( "GetSRPBatcherCompatibilityCode", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { s, subShaderIdx } ); - } - - public static string GetSRPBatcherCompatibilityIssueReason( Shader s, int subShaderIdx, int err ) - { - return (string)ShaderUtilEx.Type.InvokeMember( "GetSRPBatcherCompatibilityIssueReason", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { s, subShaderIdx, err } ); - } -#endif - } - - public static class FileUtilEx - { - private static System.Type type = null; - public static System.Type Type { get { return ( type == null ) ? type = System.Type.GetType( "UnityEditor.FileUtil, UnityEditor" ) : type; } } - - public static string GetLastPathNameComponent( string path ) - { - return ( string ) FileUtilEx.Type.InvokeMember( "GetLastPathNameComponent", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { path } ); - } - } - - public static class ShaderInspectorEx - { - private static System.Type type = null; - public static System.Type Type { get { return ( type == null ) ? type = System.Type.GetType( "UnityEditor.ShaderInspector, UnityEditor" ) : type; } } - -#if UNITY_2019_3_OR_NEWER - public static void ShaderErrorListUI( UnityEngine.Object shader, ShaderMessage[] messages, ref Vector2 scrollPosition ) - { - Type.InvokeMember( "ShaderErrorListUI", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { shader, messages, scrollPosition } ); - } -#endif - } - - public static class GUISkinEx - { - private static System.Type type = null; - public static System.Type Type { get { return ( type == null ) ? type = System.Type.GetType( "UnityEngine.GUISkin, UnityEngine" ) : type; } } - - public static GUISkin GetCurrentSkin() - { - return ( GUISkin ) GUISkinEx.Type.GetField( "current", BindingFlags.NonPublic | BindingFlags.Static ).GetValue( null ); - } - } - - public static class EditorGUIEx - { - public static System.Type Type = typeof( EditorGUI ); - - public static Gradient GradientField( Rect position, Gradient gradient ) - { -#if UNITY_2018_3_OR_NEWER - return EditorGUI.GradientField( position, gradient ); -#else - return (Gradient)EditorGUIEx.Type.InvokeMember( "GradientField", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { position, gradient } ); -#endif - } - - public static bool ButtonMouseDown( Rect position, GUIContent content, FocusType focusType, GUIStyle style ) - { -#if UNITY_5_6_OR_NEWER - return EditorGUI.DropdownButton( position, content, focusType, style ); -#else - return ( bool ) EditorGUIEx.Type.InvokeMember( "ButtonMouseDown", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { position, content, focusType, style } ); -#endif - } - - public static float kObjectFieldMiniThumbnailHeight - { - get - { - return (float)EditorGUIEx.Type.InvokeMember( "kObjectFieldMiniThumbnailHeight", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.GetField, null, null, new object[] {} ); - } - } - - public static float kSingleLineHeight - { - get - { - return (float)EditorGUIEx.Type.InvokeMember( "kSingleLineHeight", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.GetField, null, null, new object[] { } ); - } - } - - } - - public static class ShaderInspectorPlatformsPopupEx - { - private static System.Type type = null; - public static System.Type Type { get { return ( type == null ) ? type = System.Type.GetType( "UnityEditor.ShaderInspectorPlatformsPopup, UnityEditor" ) : type; } } - - public static int GetCurrentMode() - { - return ( int ) ShaderInspectorPlatformsPopupEx.Type.GetProperty( "currentMode", BindingFlags.Public | BindingFlags.Static ).GetValue( null, null ); - } - - public static int GetCurrentPlatformMask() - { - return ( int ) ShaderInspectorPlatformsPopupEx.Type.GetProperty( "currentPlatformMask", BindingFlags.Public | BindingFlags.Static ).GetValue( null, null ); - } - - public static int GetCurrentVariantStripping() - { - return ( int ) ShaderInspectorPlatformsPopupEx.Type.GetProperty( "currentVariantStripping", BindingFlags.Public | BindingFlags.Static ).GetValue( null, null ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/CustomShaderInspector.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/CustomShaderInspector.cs.meta deleted file mode 100644 index 06851759..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/CustomShaderInspector.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 641dff721f3c24c4188f01fea49484cb -timeCreated: 1481126956 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/CustomTexture2DArrayInspector.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/CustomTexture2DArrayInspector.cs deleted file mode 100644 index b43ee4e2..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/CustomTexture2DArrayInspector.cs +++ /dev/null @@ -1,132 +0,0 @@ -#if !UNITY_2019_1_OR_NEWER -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEditor; - -namespace AmplifyShaderEditor -{ - [CustomEditor( typeof( Texture2DArray ) )] - public class CustomTexture2DArrayInspector : Editor - { - Texture2DArray m_target; - [SerializeField] - float m_index; - Shader m_textureArrayPreview; - Material m_previewMaterial; - GUIStyle slider = null; - GUIStyle thumb = null; - GUIContent m_allButton = null; - [SerializeField] - bool m_seeAll; - void OnEnable() - { - m_target = ( target as Texture2DArray ); - m_textureArrayPreview = AssetDatabase.LoadAssetAtPath<Shader>( AssetDatabase.GUIDToAssetPath( "610c24aad350fba4583068c6c22fa428" ) ); - m_previewMaterial = new Material( m_textureArrayPreview ); - slider = null; - thumb = null; - } - - public override void OnPreviewGUI( Rect r, GUIStyle background ) - { - base.OnPreviewGUI( r, background ); - m_previewMaterial.SetTexture( "_MainTex", m_target ); - m_previewMaterial.SetFloat( "_Index", m_index ); - EditorGUI.DrawPreviewTexture( r, m_target, m_previewMaterial, ScaleMode.ScaleToFit, 1f ); - } - - private void OnDisable() - { - DestroyImmediate( m_previewMaterial ); - m_previewMaterial = null; - } - - public override void OnInspectorGUI() - { - if( slider == null ) - slider = "preSlider"; - - if( thumb == null ) - thumb = "preSliderThumb"; - - if( m_allButton == null ) - m_allButton = EditorGUIUtility.IconContent( "PreTextureMipMapLow" ); - - base.OnInspectorGUI(); - } - - public override bool HasPreviewGUI() - { - return true; - } - - public override void OnPreviewSettings() - { - base.OnPreviewSettings(); - m_seeAll = GUILayout.Toggle( m_seeAll, m_allButton, "preButton" ); - EditorGUI.BeginDisabledGroup( m_seeAll ); - m_index = Mathf.Round( GUILayout.HorizontalSlider( m_index, 0, m_target.depth - 1, slider, thumb ) ); - EditorGUI.EndDisabledGroup(); - } - - public override void OnInteractivePreviewGUI( Rect r, GUIStyle background ) - { - //base.OnInteractivePreviewGUI( r, background ); - if( m_seeAll ) - { - int columns = Mathf.CeilToInt( Mathf.Sqrt( m_target.depth ) ); - float sizeX = r.width / columns - 20; - float centerY = ( columns * columns ) - m_target.depth; - int rows = columns; - if( centerY >= columns ) - rows--; - float sizeY = ( r.height - 16 ) / rows - 15; - - if( centerY >= columns ) - centerY = sizeY * 0.5f; - else - centerY = 0; - - Rect smallRect = r; - if( rows > 1 ) - smallRect.y += ( 15 / ( rows - 1 ) ); - else - smallRect.y += 15; - smallRect.x = r.x + 10; - smallRect.width = sizeX; - smallRect.height = sizeY; - - for( int i = 0; i < m_target.depth; i++ ) - { - m_previewMaterial.SetTexture( "_MainTex", m_target ); - m_previewMaterial.SetFloat( "_Index", i ); - EditorGUI.DrawPreviewTexture( smallRect, m_target, m_previewMaterial, ScaleMode.ScaleToFit, 1 ); - Rect dropRect = smallRect; - - float diff = smallRect.height - smallRect.width; - if( diff > 0 ) - dropRect.y -= diff * 0.5f; - dropRect.y += 16; - EditorGUI.DropShadowLabel( dropRect, "[" + i + "]" ); - - smallRect.x += sizeX + 20; - if( ( ( i + 1 ) % ( columns ) ) == 0 ) - { - smallRect.x = r.x + 10; - smallRect.height = sizeY; - smallRect.y += sizeY + 30; - } - } - } - else - { - m_previewMaterial.SetTexture( "_MainTex", m_target ); - m_previewMaterial.SetFloat( "_Index", m_index ); - EditorGUI.DrawPreviewTexture( r, m_target, m_previewMaterial, ScaleMode.ScaleToFit, 1f ); - EditorGUI.DropShadowLabel( r, "[" + m_index + "]" ); - } - } - } -} -#endif diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/CustomTexture2DArrayInspector.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/CustomTexture2DArrayInspector.cs.meta deleted file mode 100644 index 7149ec03..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/CustomTexture2DArrayInspector.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 871ecf36e52b267449b9047596793d6f -timeCreated: 1517913060 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/EditorVariablesManager.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/EditorVariablesManager.cs deleted file mode 100644 index 7b9c67c6..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/EditorVariablesManager.cs +++ /dev/null @@ -1,254 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEditor; -using System; -using UnityEngine; - -namespace AmplifyShaderEditor -{ - public class EditorVariable<T> - { - protected string m_labelName; - protected string m_name; - protected T m_value; - protected T m_defaultValue; - - public EditorVariable( string name, string labelName, T defaultValue ) { m_name = name; m_labelName = labelName; m_defaultValue = defaultValue; m_value = defaultValue; } - public string Name { get { return m_name; } } - - public virtual T Value - { - get { return m_value; } - set - { - m_value = value; - } - } - public string LabelName { get { return m_labelName; } } - } - - public sealed class EditorVariableFloat : EditorVariable<float> - { - public EditorVariableFloat( string name, string labelName, float defaultValue ) : base( name, labelName, defaultValue ) - { - m_value = EditorPrefs.GetFloat( name, m_defaultValue ); - } - - public override float Value - { - get { return m_value; } - set - { - if( m_value != value ) - { - m_value = value; - EditorPrefs.SetFloat( m_name, m_value ); - } - } - } - } - - public sealed class EditorVariableBool : EditorVariable<bool> - { - public EditorVariableBool( string name, string labelName, bool defaultValue ) : base( name, labelName, defaultValue ) - { - m_value = EditorPrefs.GetBool( name, m_defaultValue ); - } - - public override bool Value - { - get { return m_value; } - set - { - if( m_value != value ) - { - m_value = value; - EditorPrefs.SetBool( m_name, m_value ); - } - } - } - } - - public sealed class EditorVariableInt : EditorVariable<int> - { - public EditorVariableInt( string name, string labelName, int defaultValue ) : base( name, labelName, defaultValue ) - { - m_value = EditorPrefs.GetInt( name, m_defaultValue ); - } - - public override int Value - { - get { return m_value; } - set - { - if( m_value != value ) - { - m_value = value; - EditorPrefs.SetInt( m_name, m_value ); - } - } - } - } - - public sealed class EditorVariableString : EditorVariable<string> - { - public EditorVariableString( string name, string labelName, string defaultValue ) : base( name, labelName, defaultValue ) - { - m_value = EditorPrefs.GetString( name, m_defaultValue ); - } - - public override string Value - { - get { return m_value; } - set - { - if( !m_value.Equals( value ) ) - { - m_value = value; - EditorPrefs.SetString( m_name, m_value ); - } - } - } - } - - public class EditorVariablesManager - { - public static EditorVariableBool LiveMode = new EditorVariableBool( "ASELiveMode", "LiveMode", false ); - public static EditorVariableBool OutlineActiveMode = new EditorVariableBool( "ASEOutlineActiveMode", " Outline", false ); - public static EditorVariableBool NodeParametersMaximized = new EditorVariableBool( "ASENodeParametersVisible", " NodeParameters", true ); - public static EditorVariableBool NodePaletteMaximized = new EditorVariableBool( "ASENodePaletteVisible", " NodePalette", true ); - public static EditorVariableBool ExpandedRenderingPlatforms = new EditorVariableBool( "ASEExpandedRenderingPlatforms", " ExpandedRenderingPlatforms", false ); - public static EditorVariableBool ExpandedRenderingOptions = new EditorVariableBool( "ASEExpandedRenderingOptions", " ExpandedRenderingPlatforms", false ); - public static EditorVariableBool ExpandedGeneralShaderOptions = new EditorVariableBool( "ASEExpandedGeneralShaderOptions", " ExpandedGeneralShaderOptions", false ); - public static EditorVariableBool ExpandedBlendOptions = new EditorVariableBool( "ASEExpandedBlendOptions", " ExpandedBlendOptions", false ); - public static EditorVariableBool ExpandedStencilOptions = new EditorVariableBool( "ASEExpandedStencilOptions", " ExpandedStencilOptions", false ); - public static EditorVariableBool ExpandedVertexOptions = new EditorVariableBool( "ASEExpandedVertexOptions", " ExpandedVertexOptions", false ); - public static EditorVariableBool ExpandedFunctionInputs = new EditorVariableBool( "ASEExpandedFunctionInputs", " ExpandedFunctionInputs", false ); - public static EditorVariableBool ExpandedFunctionSwitches = new EditorVariableBool( "ASEExpandedFunctionSwitches", " ExpandedFunctionSwitches", false ); - public static EditorVariableBool ExpandedFunctionOutputs = new EditorVariableBool( "ASEExpandedFunctionOutputs", " ExpandedFunctionOutputs", false ); - public static EditorVariableBool ExpandedAdditionalIncludes = new EditorVariableBool( "ASEExpandedAdditionalIncludes", " ExpandedAdditionalIncludes", false ); - public static EditorVariableBool ExpandedAdditionalDefines = new EditorVariableBool( "ASEExpandedAdditionalDefines", " ExpandedAdditionalDefines", false ); - public static EditorVariableBool ExpandedAdditionalDirectives = new EditorVariableBool( "ASEExpandedAdditionalDirectives", " ExpandedAdditionalDirectives", false ); - public static EditorVariableBool ExpandedCustomTags = new EditorVariableBool( "ASEExpandedCustomTags", " ExpandedCustomTags", false ); - public static EditorVariableBool ExpandedAdditionalSurfaceOptions = new EditorVariableBool( "ASEExpandedAdditionalSurfaceOptions", " ExpandedAdditionalSurfaceOptions", false ); - public static EditorVariableBool ExpandedAdditionalPragmas = new EditorVariableBool( "ASEExpandedAdditionalPragmas", " ExpandedAdditionalPragmas", false ); - public static EditorVariableBool ExpandedDependencies = new EditorVariableBool( "ASEExpandedDependencies", " ExpandedDependencies", false ); - public static EditorVariableBool ExpandedDepth = new EditorVariableBool( "ASEExpandedDepth", " ExpandedDepth", false ); - public static EditorVariableBool ExpandedTesselation = new EditorVariableBool( "ASEExpandedTesselation", " ExpandedTesselation", false ); - public static EditorVariableBool ExpandedProperties = new EditorVariableBool( "ASEExpandedProperties", " ExpandedProperties", false ); - public static EditorVariableBool ExpandedUsePass = new EditorVariableBool( "ASEUsePass", " UsePass", false ); - //Templates - public static EditorVariableBool ExpandedBlendModeModule = new EditorVariableBool( "ASEExpandedBlendModeModule", " ExpandedBlendModeModule", false ); - } - - [Serializable] - public class InnerWindowEditorVariables - { - [SerializeField] - private bool m_liveMode = false; - [SerializeField] - private bool m_outlineActiveMode = false; - [SerializeField] - private bool m_nodeParametersMaximized = false; - [SerializeField] - private bool m_nodePaletteMaximized = false; - [SerializeField] - private bool m_expandedRenderingPlatforms = false; - [SerializeField] - private bool m_expandedRenderingOptions = false; - [SerializeField] - private bool m_expandedGeneralShaderOptions = false; - [SerializeField] - private bool m_expandedBlendOptions = false; - [SerializeField] - private bool m_expandedStencilOptions = false; - [SerializeField] - private bool m_expandedVertexOptions = false; - [SerializeField] - private bool m_expandedFunctionInputs = false; - [SerializeField] - private bool m_expandedFunctionSwitches = false; - [SerializeField] - private bool m_expandedFunctionOutputs = false; - [SerializeField] - private bool m_expandedAdditionalIncludes = false; - [SerializeField] - private bool m_expandedAdditionalDefines = false; - [SerializeField] - private bool m_expandedAdditionalDirectives = false; - [SerializeField] - private bool m_expandedCustomTags = false; - [SerializeField] - private bool m_expandedAdditionalSurfaceOptions = false; - [SerializeField] - private bool m_expandedAdditionalPragmas = false; - [SerializeField] - private bool m_expandedDependencies = false; - [SerializeField] - private bool m_expandedBlendModeModule = false; - [SerializeField] - private bool m_expandedDepth = false; - [SerializeField] - private bool m_expandedTesselation = false; - [SerializeField] - private bool m_expandedProperties = false; - [SerializeField] - private bool m_expandedUsePass = false; - - public void Initialize() - { - m_liveMode = EditorVariablesManager.LiveMode.Value; - m_outlineActiveMode = EditorVariablesManager.OutlineActiveMode.Value; - m_nodeParametersMaximized = EditorVariablesManager.NodeParametersMaximized.Value; - m_nodePaletteMaximized = EditorVariablesManager.NodePaletteMaximized.Value; - m_expandedRenderingPlatforms = EditorVariablesManager.ExpandedRenderingPlatforms.Value; - m_expandedRenderingOptions = EditorVariablesManager.ExpandedRenderingOptions.Value; - m_expandedGeneralShaderOptions = EditorVariablesManager.ExpandedGeneralShaderOptions.Value; - m_expandedBlendOptions = EditorVariablesManager.ExpandedBlendOptions.Value; - m_expandedStencilOptions = EditorVariablesManager.ExpandedStencilOptions.Value; - m_expandedVertexOptions = EditorVariablesManager.ExpandedVertexOptions.Value; - m_expandedFunctionInputs = EditorVariablesManager.ExpandedFunctionInputs.Value; - m_expandedFunctionSwitches = EditorVariablesManager.ExpandedFunctionSwitches.Value; - m_expandedFunctionOutputs = EditorVariablesManager.ExpandedFunctionOutputs.Value; - m_expandedAdditionalIncludes = EditorVariablesManager.ExpandedAdditionalIncludes.Value; - m_expandedAdditionalDefines = EditorVariablesManager.ExpandedAdditionalDefines.Value; - m_expandedAdditionalDirectives = EditorVariablesManager.ExpandedAdditionalDirectives.Value; - m_expandedCustomTags = EditorVariablesManager.ExpandedCustomTags.Value; - m_expandedAdditionalSurfaceOptions = EditorVariablesManager.ExpandedAdditionalSurfaceOptions.Value; - m_expandedAdditionalPragmas = EditorVariablesManager.ExpandedAdditionalPragmas.Value; - m_expandedDependencies = EditorVariablesManager.ExpandedDependencies.Value; - m_expandedBlendModeModule = EditorVariablesManager.ExpandedBlendModeModule.Value; - m_expandedDepth = EditorVariablesManager.ExpandedDepth.Value; - m_expandedTesselation = EditorVariablesManager.ExpandedTesselation.Value; - m_expandedProperties = EditorVariablesManager.ExpandedProperties.Value; - m_expandedUsePass = EditorVariablesManager.ExpandedUsePass.Value; - } - - public bool LiveMode{ get { return m_liveMode; } set { m_liveMode = value; EditorVariablesManager.LiveMode.Value = value; } } - public bool OutlineActiveMode { get { return m_outlineActiveMode; } set { m_outlineActiveMode = value; EditorVariablesManager.OutlineActiveMode.Value = value; } } - public bool NodeParametersMaximized { get { return m_nodeParametersMaximized; } set { m_nodeParametersMaximized = value; EditorVariablesManager.NodeParametersMaximized.Value = value; } } - public bool NodePaletteMaximized { get { return m_nodePaletteMaximized; } set { m_nodePaletteMaximized = value; EditorVariablesManager.NodePaletteMaximized.Value = value; } } - public bool ExpandedRenderingPlatforms { get { return m_expandedRenderingPlatforms; } set { m_expandedRenderingPlatforms = value; EditorVariablesManager.ExpandedRenderingPlatforms.Value = value; } } - public bool ExpandedRenderingOptions { get { return m_expandedRenderingOptions; } set { m_expandedRenderingOptions = value; EditorVariablesManager.ExpandedRenderingOptions.Value = value; } } - public bool ExpandedGeneralShaderOptions { get { return m_expandedGeneralShaderOptions; } set { m_expandedGeneralShaderOptions = value; EditorVariablesManager.ExpandedGeneralShaderOptions.Value = value; } } - public bool ExpandedBlendOptions { get { return m_expandedBlendOptions; } set { m_expandedBlendOptions = value; EditorVariablesManager.ExpandedBlendOptions.Value = value; } } - public bool ExpandedStencilOptions { get { return m_expandedStencilOptions; } set { m_expandedStencilOptions = value; EditorVariablesManager.ExpandedStencilOptions.Value = value; } } - public bool ExpandedVertexOptions { get { return m_expandedVertexOptions; } set { m_expandedVertexOptions = value; EditorVariablesManager.ExpandedVertexOptions.Value = value; } } - public bool ExpandedFunctionInputs { get { return m_expandedFunctionInputs; } set { m_expandedFunctionInputs = value; EditorVariablesManager.ExpandedFunctionInputs.Value = value; } } - public bool ExpandedFunctionSwitches { get { return m_expandedFunctionSwitches; } set { m_expandedFunctionSwitches = value; EditorVariablesManager.ExpandedFunctionSwitches.Value = value; } } - public bool ExpandedFunctionOutputs { get { return m_expandedFunctionOutputs; } set { m_expandedFunctionOutputs = value; EditorVariablesManager.ExpandedFunctionOutputs.Value = value; } } - public bool ExpandedAdditionalIncludes { get { return m_expandedAdditionalIncludes; } set { m_expandedAdditionalIncludes = value; EditorVariablesManager.ExpandedAdditionalIncludes.Value = value; } } - public bool ExpandedAdditionalDefines { get { return m_expandedAdditionalDefines; } set { m_expandedAdditionalDefines = value; EditorVariablesManager.ExpandedAdditionalDefines.Value = value; } } - public bool ExpandedAdditionalDirectives { get { return m_expandedAdditionalDirectives; } set { m_expandedAdditionalDirectives = value; EditorVariablesManager.ExpandedAdditionalDirectives.Value = value; } } - public bool ExpandedCustomTags { get { return m_expandedCustomTags; } set { m_expandedCustomTags = value; EditorVariablesManager.ExpandedCustomTags.Value = value; } } - public bool ExpandedAdditionalSurfaceOptions { get { return m_expandedAdditionalSurfaceOptions; } set { m_expandedAdditionalSurfaceOptions = value; EditorVariablesManager.ExpandedAdditionalSurfaceOptions.Value = value; } } - public bool ExpandedAdditionalPragmas { get { return m_expandedAdditionalPragmas; } set { m_expandedAdditionalPragmas = value; EditorVariablesManager.ExpandedAdditionalPragmas.Value = value; } } - public bool ExpandedDependencies { get { return m_expandedDependencies; } set { m_expandedDependencies = value; EditorVariablesManager.ExpandedDependencies.Value = value; } } - public bool ExpandedBlendModeModule { get { return m_expandedBlendModeModule; } set { m_expandedBlendModeModule = value; EditorVariablesManager.ExpandedBlendModeModule.Value = value; } } - public bool ExpandedDepth { get { return m_expandedDepth; } set { m_expandedDepth = value; EditorVariablesManager.ExpandedDepth.Value = value; } } - public bool ExpandedTesselation { get { return m_expandedTesselation; } set { m_expandedTesselation = value; EditorVariablesManager.ExpandedTesselation.Value = value; } } - public bool ExpandedProperties { get { return m_expandedProperties; } set { m_expandedProperties = value; EditorVariablesManager.ExpandedProperties.Value = value; } } - public bool ExpandedUsePass { get { return m_expandedUsePass; } set { m_expandedUsePass = value; EditorVariablesManager.ExpandedUsePass.Value = value; } } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/EditorVariablesManager.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/EditorVariablesManager.cs.meta deleted file mode 100644 index 73d074df..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/EditorVariablesManager.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: d402e3c7d578ee046a5d0826b9a41c27 -timeCreated: 1487245046 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/GeneratorUtils.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/GeneratorUtils.cs deleted file mode 100644 index 9923fc13..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/GeneratorUtils.cs +++ /dev/null @@ -1,1022 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -namespace AmplifyShaderEditor -{ - public static class GeneratorUtils - { - public const string ObjectScaleStr = "ase_objectScale"; - public const string ParentObjectScaleStr = "ase_parentObjectScale"; - public const string ScreenDepthStr = "ase_screenDepth"; - public const string ViewPositionStr = "ase_viewPos"; - public const string WorldViewDirectionStr = "ase_worldViewDir"; - public const string TangentViewDirectionStr = "ase_tanViewDir"; - public const string NormalizedViewDirStr = "ase_normViewDir"; - public const string ClipPositionStr = "ase_clipPos"; - public const string VertexPosition3Str = "ase_vertex3Pos"; - public const string VertexPosition4Str = "ase_vertex4Pos"; - public const string VertexNormalStr = "ase_vertexNormal"; - public const string VertexTangentStr = "ase_vertexTangent"; - public const string VertexTangentSignStr = "ase_vertexTangentSign"; - public const string VertexBitangentStr = "ase_vertexBitangent"; - public const string ScreenPositionStr = "ase_screenPos"; - public const string NormalizedScreenPosFormat = "{0} / {0}.w"; - public const string ScreenPositionNormalizedStr = "ase_screenPosNorm"; - public const string GrabScreenPositionStr = "ase_grabScreenPos"; - public const string GrabScreenPositionNormalizedStr = "ase_grabScreenPosNorm"; - public const string WorldPositionStr = "ase_worldPos"; - public const string RelativeWorldPositionStr = "ase_relWorldPos"; - public const string VFaceStr = "ase_vface"; - public const string ShadowCoordsStr = "ase_shadowCoords"; - public const string WorldLightDirStr = "ase_worldlightDir"; - public const string ObjectLightDirStr = "ase_objectlightDir"; - public const string WorldNormalStr = "ase_worldNormal"; - public const string NormalizedWorldNormalStr = "ase_normWorldNormal"; - public const string WorldReflectionStr = "ase_worldReflection"; - public const string WorldTangentStr = "ase_worldTangent"; - public const string WorldBitangentStr = "ase_worldBitangent"; - public const string WorldToTangentStr = "ase_worldToTangent"; - public const string ObjectToTangentStr = "ase_objectToTangent"; - public const string TangentToWorldPreciseStr = "ase_tangentToWorldPrecise"; - public const string TangentToWorldFastStr = "ase_tangentToWorldFast"; - public const string TangentToObjectStr = "ase_tangentToObject"; - public const string TangentToObjectFastStr = "ase_tangentToObjectFast"; - private const string Float3Format = "float3 {0} = {1};"; - private const string Float4Format = "float4 {0} = {1};"; - private const string GrabFunctionHeader = "inline float4 ASE_ComputeGrabScreenPos( float4 pos )"; - private const string GrabFunctionCall = "ASE_ComputeGrabScreenPos( {0} )"; - private const string Identity4x4 = "ase_identity4x4"; - private static readonly string[] GrabFunctionBody = { - "#if UNITY_UV_STARTS_AT_TOP", - "float scale = -1.0;", - "#else", - "float scale = 1.0;", - "#endif", - "float4 o = pos;", - "o.y = pos.w * 0.5f;", - "o.y = ( pos.y - o.y ) * _ProjectionParams.x * scale + o.y;", - "return o;" - }; - - // MATRIX IDENTITY - static public string GenerateIdentity4x4( ref MasterNodeDataCollector dataCollector, int uniqueId ) - { - dataCollector.AddLocalVariable( uniqueId, "float4x4 ase_identity4x4 = float4x4(1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1);" ); - return Identity4x4; - } - - - // OBJECT SCALE - static public string GenerateObjectScale( ref MasterNodeDataCollector dataCollector, int uniqueId ) - { - if( dataCollector.IsTemplate ) - return dataCollector.TemplateDataCollectorInstance.GenerateObjectScale( ref dataCollector, uniqueId ); - - //string value= "1/float3( length( unity_WorldToObject[ 0 ].xyz ), length( unity_WorldToObject[ 1 ].xyz ), length( unity_WorldToObject[ 2 ].xyz ) );"; - string value = "float3( length( unity_ObjectToWorld[ 0 ].xyz ), length( unity_ObjectToWorld[ 1 ].xyz ), length( unity_ObjectToWorld[ 2 ].xyz ) )"; - dataCollector.AddLocalVariable( uniqueId, PrecisionType.Float, WirePortDataType.FLOAT3, ObjectScaleStr, value ); - return ObjectScaleStr; - } - - static public string GenerateRotationIndependentObjectScale( ref MasterNodeDataCollector dataCollector, int uniqueId ) - { - if( dataCollector.IsTemplate ) - return dataCollector.TemplateDataCollectorInstance.GenerateRotationIndependentObjectScale( ref dataCollector, uniqueId ); - - string value = "(1.0/float3( length( unity_WorldToObject[ 0 ].xyz ), length( unity_WorldToObject[ 1 ].xyz ), length( unity_WorldToObject[ 2 ].xyz ) ))"; - dataCollector.AddLocalVariable( uniqueId, PrecisionType.Float, WirePortDataType.FLOAT3, ParentObjectScaleStr, value ); - return ParentObjectScaleStr; - } - - // WORLD POSITION - static public string GenerateWorldPosition( ref MasterNodeDataCollector dataCollector, int uniqueId ) - { - PrecisionType precision = PrecisionType.Float; - if( dataCollector.IsTemplate ) - return dataCollector.TemplateDataCollectorInstance.GetWorldPos(); - - dataCollector.AddToInput( -1, SurfaceInputs.WORLD_POS, precision ); - - string result = Constants.InputVarStr + ".worldPos"; - - if( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) - result = "mul( unity_ObjectToWorld, " + Constants.VertexShaderInputStr + ".vertex )"; - - //dataCollector.AddToLocalVariables( dataCollector.PortCategory, uniqueId, string.Format( Float3Format, WorldPositionStr, result ) ); - dataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT3, WorldPositionStr, result ); - - return WorldPositionStr; - } - - // WORLD REFLECTION - static public string GenerateWorldReflection( ref MasterNodeDataCollector dataCollector, int uniqueId, bool normalize = false ) - { - if( dataCollector.IsTemplate ) - return dataCollector.TemplateDataCollectorInstance.GetWorldReflection( UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision, true, MasterNodePortCategory.Fragment, normalize ); - - string precisionType = UIUtils.PrecisionWirePortToCgType( UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision, WirePortDataType.FLOAT3 ); - string result = string.Empty; - if( !dataCollector.DirtyNormal ) - result = Constants.InputVarStr + ".worldRefl"; - else - result = "WorldReflectionVector( " + Constants.InputVarStr + ", " + precisionType + "( 0, 0, 1 ) )"; - - if( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) - result = "UnityObjectToWorldNormal( " + Constants.VertexShaderInputStr + ".normal )"; - if( normalize ) - { - result = string.Format( "normalize( {0} )", result ); - } - - dataCollector.AddToLocalVariables( dataCollector.PortCategory, uniqueId, string.Concat( precisionType, " ", WorldReflectionStr, " = ", result, ";" ) ); - return WorldReflectionStr; - } - - // WORLD NORMAL - static public string GenerateWorldNormal( ref MasterNodeDataCollector dataCollector, int uniqueId, PrecisionType precisionType, string normal, string outputId ) - { - if( dataCollector.IsTemplate ) - return dataCollector.TemplateDataCollectorInstance.GetWorldNormal( uniqueId, precisionType, normal, outputId ); - - string tanToWorld = GenerateTangentToWorldMatrixFast( ref dataCollector, uniqueId, precisionType ); - return string.Format( "mul({0},{1})", tanToWorld, normal ); - - } - static public string GenerateWorldNormal( ref MasterNodeDataCollector dataCollector, int uniqueId, bool normalize = false ) - { - PrecisionType precision = UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision; - - if( dataCollector.IsTemplate ) - return dataCollector.TemplateDataCollectorInstance.GetWorldNormal( precision, true, MasterNodePortCategory.Fragment, normalize ); - - string precisionType = UIUtils.PrecisionWirePortToCgType( precision, WirePortDataType.FLOAT3 ); - string result = string.Empty; - if( !dataCollector.DirtyNormal ) - result = Constants.InputVarStr + ".worldNormal"; - else - result = "WorldNormalVector( " + Constants.InputVarStr + ", " + precisionType + "( 0, 0, 1 ) )"; - - if( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) - result = "UnityObjectToWorldNormal( " + Constants.VertexShaderInputStr + ".normal )"; - - dataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT3, WorldNormalStr, result ); - if( normalize ) - { - dataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT3, NormalizedWorldNormalStr, "normalize( " + WorldNormalStr + " )" ); - return NormalizedWorldNormalStr; - } - return WorldNormalStr; - } - - // WORLD TANGENT - static public string GenerateWorldTangent( ref MasterNodeDataCollector dataCollector, int uniqueId ) - { - if( dataCollector.IsTemplate ) - return dataCollector.TemplateDataCollectorInstance.GetWorldTangent( UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision ); - - string precisionType = UIUtils.PrecisionWirePortToCgType( UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision, WirePortDataType.FLOAT3 ); - string result = "WorldNormalVector( " + Constants.InputVarStr + ", " + precisionType + "( 1, 0, 0 ) )"; - - if( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) - result = "UnityObjectToWorldDir( " + Constants.VertexShaderInputStr + ".tangent.xyz )"; - dataCollector.AddLocalVariable( uniqueId, UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision, WirePortDataType.FLOAT3, WorldTangentStr, result ); - //dataCollector.AddToLocalVariables( dataCollector.PortCategory, uniqueId, string.Concat( precisionType, " ", WorldTangentStr, " = ", result, ";" ) ); - return WorldTangentStr; - } - - // WORLD BITANGENT - static public string GenerateWorldBitangent( ref MasterNodeDataCollector dataCollector, int uniqueId ) - { - if( dataCollector.IsTemplate ) - return dataCollector.TemplateDataCollectorInstance.GetWorldBinormal( UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision ); - - string precisionType = UIUtils.PrecisionWirePortToCgType( UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision, WirePortDataType.FLOAT3 ); - string result = "WorldNormalVector( " + Constants.InputVarStr + ", " + precisionType + "( 0, 1, 0 ) )"; - - if( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) - { - string worldNormal = GenerateWorldNormal( ref dataCollector, uniqueId ); - string worldTangent = GenerateWorldTangent( ref dataCollector, uniqueId ); - dataCollector.AddToVertexLocalVariables( uniqueId, string.Format( "half tangentSign = {0}.tangent.w * unity_WorldTransformParams.w;", Constants.VertexShaderInputStr ) ); - result = "cross( " + worldNormal + ", " + worldTangent + " ) * tangentSign"; - } - - dataCollector.AddToLocalVariables( dataCollector.PortCategory, uniqueId, string.Concat( precisionType, " ", WorldBitangentStr, " = ", result, ";" ) ); - return WorldBitangentStr; - } - - // OBJECT TO TANGENT MATRIX - static public string GenerateObjectToTangentMatrix( ref MasterNodeDataCollector dataCollector, int uniqueId, PrecisionType precision ) - { - string normal = GenerateVertexNormal( ref dataCollector, uniqueId, precision ); - string tangent = GenerateVertexTangent( ref dataCollector, uniqueId, precision, WirePortDataType.FLOAT3 ); - string bitangen = GenerateVertexBitangent( ref dataCollector, uniqueId, precision ); - dataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT3x3, ObjectToTangentStr, "float3x3( " + tangent + ", " + bitangen + ", " + normal + " )" ); - return ObjectToTangentStr; - } - - // TANGENT TO OBJECT - //static public string GenerateTangentToObjectMatrixFast( ref MasterNodeDataCollector dataCollector, int uniqueId, PrecisionType precision ) - //{ - // string normal = GenerateVertexNormal( ref dataCollector, uniqueId, precision ); - // string tangent = GenerateVertexTangent( ref dataCollector, uniqueId, precision ); - // string bitangent = GenerateVertexBitangent( ref dataCollector, uniqueId, precision ); - - // string result = string.Format( "float3x3({0}.x,{1}.x,{2}.x,{0}.y,{1}.y,{2}.y,{0}.z,{1}.z,{2}.z)",tangent,bitangent,normal ); - // dataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT3x3, TangentToObjectFastStr, result ); - // return TangentToObjectFastStr; - //} - - //static public string GenerateTangentToObjectMatrixPrecise( ref MasterNodeDataCollector dataCollector, int uniqueId, PrecisionType precision ) - //{ - // string objectToTangent = GenerateObjectToTangentMatrix( ref dataCollector, uniqueId, precision ); - // Add3x3InverseFunction( ref dataCollector, UIUtils.PrecisionWirePortToCgType( precision, WirePortDataType.FLOAT ) ); - // dataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT3x3, TangentToObjectStr, string.Format( Inverse3x3Header, objectToTangent ) ); - // return TangentToObjectStr; - //} - - // WORLD TO TANGENT MATRIX - static public string GenerateWorldToTangentMatrix( ref MasterNodeDataCollector dataCollector, int uniqueId, PrecisionType precision ) - { - if( dataCollector.IsTemplate ) - return dataCollector.TemplateDataCollectorInstance.GetWorldToTangentMatrix( precision ); - - if( dataCollector.IsFragmentCategory ) - { - dataCollector.ForceNormal = true; - - dataCollector.AddToInput( -1, SurfaceInputs.WORLD_NORMAL, precision ); - dataCollector.AddToInput( -1, SurfaceInputs.INTERNALDATA, addSemiColon: false ); - } - - string worldNormal = GenerateWorldNormal( ref dataCollector, uniqueId ); - string worldTangent = GenerateWorldTangent( ref dataCollector, uniqueId ); - string worldBitangent = GenerateWorldBitangent( ref dataCollector, uniqueId ); - - dataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT3x3, WorldToTangentStr, "float3x3( " + worldTangent + ", " + worldBitangent + ", " + worldNormal + " )" ); - return WorldToTangentStr; - } - - // TANGENT TO WORLD - static public string GenerateTangentToWorldMatrixFast( ref MasterNodeDataCollector dataCollector, int uniqueId, PrecisionType precision ) - { - if( dataCollector.IsTemplate ) - return dataCollector.TemplateDataCollectorInstance.GetTangentToWorldMatrixFast( precision ); - - if( dataCollector.IsFragmentCategory ) - { - dataCollector.ForceNormal = true; - - dataCollector.AddToInput( -1, SurfaceInputs.WORLD_NORMAL, precision ); - dataCollector.AddToInput( -1, SurfaceInputs.INTERNALDATA, addSemiColon: false ); - } - - string worldNormal = GenerateWorldNormal( ref dataCollector, uniqueId ); - string worldTangent = GenerateWorldTangent( ref dataCollector, uniqueId ); - string worldBitangent = GenerateWorldBitangent( ref dataCollector, uniqueId ); - - string result = string.Format( "float3x3({0}.x,{1}.x,{2}.x,{0}.y,{1}.y,{2}.y,{0}.z,{1}.z,{2}.z)", worldTangent, worldBitangent, worldNormal ); - dataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT3x3, TangentToWorldFastStr, result ); - return TangentToWorldFastStr; - } - - static public string GenerateTangentToWorldMatrixPrecise( ref MasterNodeDataCollector dataCollector, int uniqueId, PrecisionType precision ) - { - if( dataCollector.IsTemplate ) - return dataCollector.TemplateDataCollectorInstance.GetTangentToWorldMatrixPrecise( precision ); - - if( dataCollector.IsFragmentCategory ) - { - dataCollector.ForceNormal = true; - - dataCollector.AddToInput( -1, SurfaceInputs.WORLD_NORMAL, precision ); - dataCollector.AddToInput( -1, SurfaceInputs.INTERNALDATA, addSemiColon: false ); - } - - string worldToTangent = GenerateWorldToTangentMatrix( ref dataCollector, uniqueId, precision ); - Add3x3InverseFunction( ref dataCollector, UIUtils.PrecisionWirePortToCgType( precision, WirePortDataType.FLOAT ) ); - dataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT3x3, TangentToWorldPreciseStr, string.Format( Inverse3x3Header, worldToTangent ) ); - return TangentToWorldPreciseStr; - } - - // AUTOMATIC UVS - static public string GenerateAutoUVs( ref MasterNodeDataCollector dataCollector, int uniqueId, int index, string propertyName = null, WirePortDataType size = WirePortDataType.FLOAT2, string scale = null, string offset = null, string outputId = null ) - { - string result = string.Empty; - string varName = string.Empty; - if( !dataCollector.IsTemplate && index > 3 ) - { - string texCoordName = TemplateHelperFunctions.BaseInterpolatorName + index; - if( dataCollector.IsFragmentCategory ) - { - - GenerateValueInVertex( ref dataCollector, uniqueId, size, PrecisionType.Float, Constants.VertexShaderInputStr + "." + texCoordName, texCoordName, true ); - result = Constants.InputVarStr + "." + texCoordName; - } - else - { - result = Constants.VertexShaderInputStr + "." + texCoordName; - } - - if( !string.IsNullOrEmpty( propertyName ) ) - { - dataCollector.AddToUniforms( uniqueId, "uniform float4 " + propertyName + "_ST;" ); - if( size > WirePortDataType.FLOAT2 ) - { - dataCollector.UsingHigherSizeTexcoords = true; - dataCollector.AddToLocalVariables( dataCollector.PortCategory, uniqueId, PrecisionType.Float, size, "uv" + propertyName, result ); - dataCollector.AddToLocalVariables( dataCollector.PortCategory, uniqueId, "uv" + propertyName + ".xy = " + result + ".xy * " + propertyName + "_ST.xy + " + propertyName + "_ST.zw;" ); - } - else - { - dataCollector.AddToLocalVariables( dataCollector.PortCategory, uniqueId, PrecisionType.Float, size, "uv" + propertyName, result + " * " + propertyName + "_ST.xy + " + propertyName + "_ST.zw" ); - } - - result = "uv" + propertyName; - } - - return result; - } - - string indexStr = index > 0 ? ( index + 1 ).ToString() : ""; - - if( dataCollector.PortCategory == MasterNodePortCategory.Fragment || dataCollector.PortCategory == MasterNodePortCategory.Debug ) - { - string sizeDif = string.Empty; - if( size == WirePortDataType.FLOAT3 ) - sizeDif = "3"; - else if( size == WirePortDataType.FLOAT4 ) - sizeDif = "4"; - - string dummyPropUV = "_tex" + sizeDif + "coord" + indexStr; - string dummyUV = "uv" + indexStr + dummyPropUV; - - dataCollector.AddToProperties( uniqueId, "[HideInInspector] " + dummyPropUV + "( \"\", 2D ) = \"white\" {}", 100 ); - dataCollector.AddToInput( uniqueId, dummyUV, size ); - - result = Constants.InputVarStr + "." + dummyUV; - } - else - { - result = Constants.VertexShaderInputStr + ".texcoord"; - if( index > 0 ) - { - result += index.ToString(); - } - - switch( size ) - { - default: - case WirePortDataType.FLOAT2: - { - result += ".xy"; - } - break; - case WirePortDataType.FLOAT3: - { - result += ".xyz"; - } - break; - case WirePortDataType.FLOAT4: break; - } - } - - varName = "uv" + indexStr + "_TexCoord" + outputId; - - if( !string.IsNullOrEmpty( propertyName ) ) - { - string finalVarName = "uv" + index + propertyName; - - dataCollector.AddToUniforms( uniqueId, "uniform float4 " + propertyName + "_ST;" ); - if( size > WirePortDataType.FLOAT2 ) - { - dataCollector.UsingHigherSizeTexcoords = true; - dataCollector.AddToLocalVariables( dataCollector.PortCategory, uniqueId, PrecisionType.Float, size, finalVarName, result ); - dataCollector.AddToLocalVariables( dataCollector.PortCategory, uniqueId, finalVarName + ".xy = " + result + ".xy * " + propertyName + "_ST.xy + " + propertyName + "_ST.zw;" ); - } - else - { - dataCollector.AddToLocalVariables( dataCollector.PortCategory, uniqueId, PrecisionType.Float, size, finalVarName, result + " * " + propertyName + "_ST.xy + " + propertyName + "_ST.zw" ); - } - - result = finalVarName; - } - else if( !string.IsNullOrEmpty( scale ) || !string.IsNullOrEmpty( offset ) ) - { - if( size > WirePortDataType.FLOAT2 ) - { - dataCollector.UsingHigherSizeTexcoords = true; - dataCollector.AddToLocalVariables( dataCollector.PortCategory, uniqueId, PrecisionType.Float, size, varName, result ); - dataCollector.AddToLocalVariables( dataCollector.PortCategory, uniqueId, varName + ".xy = " + result + ".xy" + ( string.IsNullOrEmpty( scale ) ? "" : " * " + scale ) + ( string.IsNullOrEmpty( offset ) ? "" : " + " + offset ) + ";" ); - } - else - { - dataCollector.AddToLocalVariables( dataCollector.PortCategory, uniqueId, PrecisionType.Float, size, varName, result + ( string.IsNullOrEmpty( scale ) ? "" : " * " + scale ) + ( string.IsNullOrEmpty( offset ) ? "" : " + " + offset ) ); - } - - result = varName; - } - else if( dataCollector.PortCategory == MasterNodePortCategory.Fragment ) - { - if( size > WirePortDataType.FLOAT2 ) - dataCollector.UsingHigherSizeTexcoords = true; - } - - return result; - } - - // SCREEN POSITION NORMALIZED - static public string GenerateScreenPositionNormalizedForValue( string customVertexPos, string outputId, ref MasterNodeDataCollector dataCollector, int uniqueId, PrecisionType precision, bool addInput = true ) - { - string stringPosVar = GenerateScreenPositionForValue( customVertexPos, outputId, ref dataCollector, uniqueId, precision, addInput ); - string varName = ScreenPositionNormalizedStr + uniqueId; - - // TODO: check later if precision can be half - dataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT4, varName, string.Format( NormalizedScreenPosFormat, stringPosVar ) ); - dataCollector.AddLocalVariable( uniqueId, varName + ".z = ( UNITY_NEAR_CLIP_VALUE >= 0 ) ? " + varName + ".z : " + varName + ".z * 0.5 + 0.5;" ); - - return varName; - } - - static public string GenerateScreenPositionNormalized( ref MasterNodeDataCollector dataCollector, int uniqueId, PrecisionType precision, bool addInput = true, string customScreenPos = null ) - { - string stringPosVar = string.IsNullOrEmpty( customScreenPos ) ? GenerateScreenPosition( ref dataCollector, uniqueId, precision, addInput ) : customScreenPos; - - // TODO: check later if precision can be half - dataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT4, ScreenPositionNormalizedStr, string.Format( NormalizedScreenPosFormat, stringPosVar ) ); - dataCollector.AddLocalVariable( uniqueId, ScreenPositionNormalizedStr + ".z = ( UNITY_NEAR_CLIP_VALUE >= 0 ) ? " + ScreenPositionNormalizedStr + ".z : " + ScreenPositionNormalizedStr + ".z * 0.5 + 0.5;" ); - - return ScreenPositionNormalizedStr; - } - - // SCREEN POSITION - static public string GenerateScreenPositionForValue( string customVertexPosition, string outputId, ref MasterNodeDataCollector dataCollector, int uniqueId, PrecisionType precision, bool addInput = true ) - { - // overriding precision - precision = PrecisionType.Float; - - if( dataCollector.IsTemplate ) - return dataCollector.TemplateDataCollectorInstance.GetScreenPosForValue( precision, customVertexPosition, outputId ); - - - string value = GenerateVertexScreenPositionForValue( customVertexPosition, outputId, ref dataCollector, uniqueId, precision ); - string screenPosVarName = "screenPosition" + outputId; - dataCollector.AddToInput( uniqueId, screenPosVarName, WirePortDataType.FLOAT4, precision ); - dataCollector.AddToVertexLocalVariables( uniqueId, Constants.VertexShaderOutputStr + "." + screenPosVarName + " = " + value + ";" ); - - string screenPosVarNameOnFrag = ScreenPositionStr + outputId; - string globalResult = Constants.InputVarStr + "." + screenPosVarName; - dataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT4, screenPosVarNameOnFrag, globalResult ); - return screenPosVarNameOnFrag; - - } - - static public string GenerateScreenPosition( ref MasterNodeDataCollector dataCollector, int uniqueId, PrecisionType precision, bool addInput = true ) - { - // overriding precision - precision = PrecisionType.Float; - - if( dataCollector.UsingCustomScreenPos && dataCollector.IsFragmentCategory ) - { - string value = GenerateVertexScreenPosition( ref dataCollector, uniqueId, precision ); - dataCollector.AddToInput( uniqueId, "screenPosition", WirePortDataType.FLOAT4, precision ); - dataCollector.AddToVertexLocalVariables( uniqueId, Constants.VertexShaderOutputStr + ".screenPosition = " + value + ";" ); - - string globalResult = Constants.InputVarStr + ".screenPosition"; - dataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT4, ScreenPositionStr, globalResult ); - return ScreenPositionStr; - } - else - { - if( !dataCollector.IsFragmentCategory ) - return GenerateVertexScreenPosition( ref dataCollector, uniqueId, precision ); - - if( dataCollector.IsTemplate ) - return dataCollector.TemplateDataCollectorInstance.GetScreenPos( precision ); - } - - - if( addInput ) - dataCollector.AddToInput( uniqueId, SurfaceInputs.SCREEN_POS, precision ); - - string result = Constants.InputVarStr + ".screenPos"; - dataCollector.AddLocalVariable( uniqueId, string.Format( "float4 {0} = float4( {1}.xyz , {1}.w + 0.00000000001 );", ScreenPositionStr, result ) ); - - return ScreenPositionStr; - } - - // GRAB SCREEN POSITION - static public string GenerateGrabScreenPosition( ref MasterNodeDataCollector dataCollector, int uniqueId, PrecisionType precision, bool addInput = true, string customScreenPos = null ) - { - // overriding precision - precision = PrecisionType.Float; - - string screenPos = string.Empty; - if( string.IsNullOrEmpty( customScreenPos ) ) - screenPos = GenerateScreenPosition( ref dataCollector, uniqueId, precision, addInput ); - else - screenPos = customScreenPos; - - string computeBody = string.Empty; - IOUtils.AddFunctionHeader( ref computeBody, GrabFunctionHeader ); - foreach( string line in GrabFunctionBody ) - IOUtils.AddFunctionLine( ref computeBody, line ); - IOUtils.CloseFunctionBody( ref computeBody ); - string functionResult = dataCollector.AddFunctions( GrabFunctionCall, computeBody, screenPos ); - - dataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT4, GrabScreenPositionStr, functionResult ); - return GrabScreenPositionStr; - } - - // GRAB SCREEN POSITION NORMALIZED - static public string GenerateGrabScreenPositionNormalized( ref MasterNodeDataCollector dataCollector, int uniqueId, PrecisionType precision, bool addInput = true, string customScreenPos = null ) - { - string stringPosVar = GenerateGrabScreenPosition( ref dataCollector, uniqueId, precision, addInput, customScreenPos ); - - dataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT4, GrabScreenPositionNormalizedStr, string.Format( NormalizedScreenPosFormat, stringPosVar ) ); - return GrabScreenPositionNormalizedStr; - } - - // SCREEN POSITION ON VERT - static public string GenerateVertexScreenPositionForValue( string customVertexPosition, string outputId, ref MasterNodeDataCollector dataCollector, int uniqueId, PrecisionType precision ) - { - // overriding precision - precision = PrecisionType.Float; - - if( dataCollector.IsTemplate ) - return dataCollector.TemplateDataCollectorInstance.GetScreenPosForValue( precision, customVertexPosition, outputId ); - - string screenPosVarName = ScreenPositionStr + outputId; - string value = string.Format( "ComputeScreenPos( UnityObjectToClipPos( {0} ) )", customVertexPosition ); - dataCollector.AddToVertexLocalVariables( uniqueId, precision, WirePortDataType.FLOAT4, screenPosVarName, value ); - return screenPosVarName; - } - - static public string GenerateVertexScreenPosition( ref MasterNodeDataCollector dataCollector, int uniqueId, PrecisionType precision ) - { - // overriding precision - precision = PrecisionType.Float; - - if( dataCollector.IsTemplate ) - return dataCollector.TemplateDataCollectorInstance.GetScreenPos( precision ); - - string value = string.Format( "ComputeScreenPos( UnityObjectToClipPos( {0}.vertex ) )", Constants.VertexShaderInputStr ); - dataCollector.AddToVertexLocalVariables( uniqueId, precision, WirePortDataType.FLOAT4, ScreenPositionStr, value ); - return ScreenPositionStr; - } - - // VERTEX POSITION - static public string GenerateVertexPosition( ref MasterNodeDataCollector dataCollector, int uniqueId, WirePortDataType size ) - { - // overriding precision - var precision = PrecisionType.Float; - - if( dataCollector.IsTemplate ) - return dataCollector.TemplateDataCollectorInstance.GetVertexPosition( size, precision ); - - string value = Constants.VertexShaderInputStr + ".vertex"; - if( size == WirePortDataType.FLOAT3 ) - value += ".xyz"; - - if( dataCollector.PortCategory == MasterNodePortCategory.Fragment || dataCollector.PortCategory == MasterNodePortCategory.Debug ) - { - dataCollector.AddToInput( uniqueId, SurfaceInputs.WORLD_POS ); - dataCollector.AddToIncludes( uniqueId, Constants.UnityShaderVariables ); - - value = "mul( unity_WorldToObject, float4( " + Constants.InputVarStr + ".worldPos , 1 ) )"; - } - string varName = VertexPosition4Str; - if( size == WirePortDataType.FLOAT3 ) - varName = VertexPosition3Str; - - dataCollector.AddLocalVariable( uniqueId, precision, size, varName, value ); - return varName; - } - - // VERTEX NORMAL - static public string GenerateVertexNormal( ref MasterNodeDataCollector dataCollector, int uniqueId, PrecisionType precision ) - { - if( dataCollector.MasterNodeCategory == AvailableShaderTypes.Template ) - { - return dataCollector.TemplateDataCollectorInstance.GetVertexNormal( UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision ); - } - - string value = Constants.VertexShaderInputStr + ".normal.xyz"; - if( dataCollector.PortCategory == MasterNodePortCategory.Fragment || dataCollector.PortCategory == MasterNodePortCategory.Debug ) - { - GenerateWorldNormal( ref dataCollector, uniqueId ); - dataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT3, VertexNormalStr, "mul( unity_WorldToObject, float4( " + WorldNormalStr + ", 0 ) )" ); - //dataCollector.AddToLocalVariables( uniqueId, precision, WirePortDataType.FLOAT3, VertexNormalStr, "mul( unity_WorldToObject, float4( " + WorldNormalStr + ", 0 ) )" ); - } - else - { - dataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT3, VertexNormalStr, value ); - } - return VertexNormalStr; - } - - // VERTEX TANGENT - static public string GenerateVertexTangent( ref MasterNodeDataCollector dataCollector, int uniqueId, PrecisionType precision, WirePortDataType size ) - { - if( dataCollector.MasterNodeCategory == AvailableShaderTypes.Template ) - { - return dataCollector.TemplateDataCollectorInstance.GetVertexTangent( size,UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision ); - } - - if( dataCollector.PortCategory == MasterNodePortCategory.Fragment || dataCollector.PortCategory == MasterNodePortCategory.Debug ) - { - GenerateWorldTangent( ref dataCollector, uniqueId ); - dataCollector.AddToLocalVariables( uniqueId, precision, WirePortDataType.FLOAT4, VertexTangentStr, "mul( unity_WorldToObject, float4( " + WorldTangentStr + ", 0 ) )" ); - } - else - { - string value = Constants.VertexShaderInputStr + ".tangent"; - dataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT4, VertexTangentStr, value ); - } - - return ( size == WirePortDataType.FLOAT4 ) ? VertexTangentStr : VertexTangentStr + ".xyz"; - } - - // VERTEX TANGENT SIGN - static public string GenerateVertexTangentSign( ref MasterNodeDataCollector dataCollector, int uniqueId, PrecisionType precision ) - { - if( dataCollector.MasterNodeCategory == AvailableShaderTypes.Template ) - { - return dataCollector.TemplateDataCollectorInstance.GetTangentSign( UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision ); - } - - string value = Constants.VertexShaderInputStr + ".tangent.w"; - if( dataCollector.IsFragmentCategory ) - { - dataCollector.AddToInput( uniqueId, VertexTangentSignStr, WirePortDataType.FLOAT, PrecisionType.Half ); - dataCollector.AddToVertexLocalVariables( uniqueId, Constants.VertexShaderOutputStr + "." + VertexTangentSignStr + " = " + Constants.VertexShaderInputStr + ".tangent.w;" ); - return Constants.InputVarStr + "." + VertexTangentSignStr; - } - else - { - dataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT, VertexTangentSignStr, value ); - } - return VertexTangentSignStr; - } - - // VERTEX BITANGENT - static public string GenerateVertexBitangent( ref MasterNodeDataCollector dataCollector, int uniqueId, PrecisionType precision ) - { - if( dataCollector.MasterNodeCategory == AvailableShaderTypes.Template ) - { - return dataCollector.TemplateDataCollectorInstance.GetVertexBitangent( UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision ); - } - - if( dataCollector.PortCategory == MasterNodePortCategory.Fragment || dataCollector.PortCategory == MasterNodePortCategory.Debug ) - { - GenerateWorldBitangent( ref dataCollector, uniqueId ); - dataCollector.AddToLocalVariables( uniqueId, precision, WirePortDataType.FLOAT3, VertexBitangentStr, "mul( unity_WorldToObject, float4( " + WorldBitangentStr + ", 0 ) )" ); - } - else - { - GenerateVertexNormal( ref dataCollector, uniqueId, precision ); - GenerateVertexTangent( ref dataCollector, uniqueId, precision, WirePortDataType.FLOAT3 ); - dataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT3, VertexBitangentStr, "cross( " + VertexNormalStr + ", " + VertexTangentStr + ") * " + Constants.VertexShaderInputStr + ".tangent.w * unity_WorldTransformParams.w" ); - } - return VertexBitangentStr; - } - - // VERTEX POSITION ON FRAG - static public string GenerateVertexPositionOnFrag( ref MasterNodeDataCollector dataCollector, int uniqueId, PrecisionType precision ) - { - dataCollector.AddToInput( uniqueId, SurfaceInputs.WORLD_POS ); - dataCollector.AddToIncludes( uniqueId, Constants.UnityShaderVariables ); - - string value = "mul( unity_WorldToObject, float4( " + Constants.InputVarStr + ".worldPos , 1 ) )"; - - dataCollector.AddToLocalVariables( uniqueId, precision, WirePortDataType.FLOAT4, VertexPosition4Str, value ); - return VertexPosition4Str; - } - - // CLIP POSITION ON FRAG - static public string GenerateClipPositionOnFrag( ref MasterNodeDataCollector dataCollector, int uniqueId, PrecisionType precision ) - { - if( dataCollector.IsTemplate ) - return dataCollector.TemplateDataCollectorInstance.GetClipPos(); - - string vertexName = GenerateVertexPositionOnFrag( ref dataCollector, uniqueId, precision ); - string value = string.Format( "ComputeScreenPos( UnityObjectToClipPos( {0} ) )", vertexName ); - dataCollector.AddToLocalVariables( uniqueId, precision, WirePortDataType.FLOAT4, ClipPositionStr, value ); - return ClipPositionStr; - } - - // VIEW DIRECTION - static public string GenerateViewDirection( ref MasterNodeDataCollector dataCollector, int uniqueId, ViewSpace space = ViewSpace.World ) - { - PrecisionType precision = UIUtils.CurrentWindow.CurrentGraph.CurrentPrecision; - if( dataCollector.IsTemplate ) - return ( space == ViewSpace.Tangent ) ? dataCollector.TemplateDataCollectorInstance.GetTangentViewDir( precision ) : dataCollector.TemplateDataCollectorInstance.GetViewDir(); - - string worldPos = GenerateWorldPosition( ref dataCollector, uniqueId ); - string safeNormalizeInstruction = string.Empty; - if( dataCollector.SafeNormalizeViewDir ) - { - if( dataCollector.IsTemplate && dataCollector.IsSRP ) - { - safeNormalizeInstruction = "SafeNormalize"; - } - else - { - if( dataCollector.IsTemplate ) - dataCollector.AddToIncludes( -1, Constants.UnityBRDFLib ); - safeNormalizeInstruction = "Unity_SafeNormalize"; - } - } - dataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT3, WorldViewDirectionStr, ( dataCollector.SafeNormalizeViewDir ? safeNormalizeInstruction : "normalize" ) + "( UnityWorldSpaceViewDir( " + worldPos + " ) )" ); - - if( space == ViewSpace.Tangent ) - { - string worldToTangent = GenerateWorldToTangentMatrix( ref dataCollector, uniqueId, precision ); - dataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT3, TangentViewDirectionStr, "mul( " + worldToTangent + ", " + WorldViewDirectionStr + " )" ); - return TangentViewDirectionStr; - } - else - { - return WorldViewDirectionStr; - } - } - - // VIEW POS - static public string GenerateViewPositionOnFrag( ref MasterNodeDataCollector dataCollector, int uniqueId, PrecisionType precision ) - { - // overriding precision - precision = PrecisionType.Float; - - if( dataCollector.IsTemplate ) - UnityEngine.Debug.LogWarning( "View Pos not implemented on Templates" ); - - string vertexName = GenerateVertexPositionOnFrag( ref dataCollector, uniqueId, precision ); - string value = string.Format( "UnityObjectToViewPos( {0} )", vertexName ); - dataCollector.AddToLocalVariables( uniqueId, precision, WirePortDataType.FLOAT3, ViewPositionStr, value ); - return ViewPositionStr; - } - - // SCREEN DEPTH - static public string GenerateScreenDepthOnFrag( ref MasterNodeDataCollector dataCollector, int uniqueId, PrecisionType precision ) - { - // overriding precision - precision = PrecisionType.Float; - - if( dataCollector.IsTemplate ) - UnityEngine.Debug.LogWarning( "Screen Depth not implemented on Templates" ); - - string viewPos = GenerateViewPositionOnFrag( ref dataCollector, uniqueId, precision ); - string value = string.Format( "-{0}.z", viewPos ); - dataCollector.AddToLocalVariables( uniqueId, precision, WirePortDataType.FLOAT, ScreenDepthStr, value ); - return ScreenDepthStr; - } - - // LIGHT DIRECTION WORLD - static public string GenerateWorldLightDirection( ref MasterNodeDataCollector dataCollector, int uniqueId, PrecisionType precision ) - { - dataCollector.AddToIncludes( uniqueId, Constants.UnityCgLibFuncs ); - string worldPos = GeneratorUtils.GenerateWorldPosition( ref dataCollector, uniqueId ); - dataCollector.AddLocalVariable( uniqueId, "#if defined(LIGHTMAP_ON) && UNITY_VERSION < 560 //aseld" ); - dataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT3, WorldLightDirStr, "0" ); - dataCollector.AddLocalVariable( uniqueId, "#else //aseld" ); - dataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT3, WorldLightDirStr, ( dataCollector.SafeNormalizeLightDir ? "Unity_SafeNormalize" : "normalize" ) + "( UnityWorldSpaceLightDir( " + worldPos + " ) )" ); - dataCollector.AddLocalVariable( uniqueId, "#endif //aseld" ); - return WorldLightDirStr; - } - - // LIGHT DIRECTION Object - static public string GenerateObjectLightDirection( ref MasterNodeDataCollector dataCollector, int uniqueId, PrecisionType precision, string vertexPos ) - { - dataCollector.AddToIncludes( uniqueId, Constants.UnityCgLibFuncs ); - dataCollector.AddLocalVariable( uniqueId, precision, WirePortDataType.FLOAT3, ObjectLightDirStr, "normalize( ObjSpaceLightDir( " + vertexPos + " ) )" ); - return ObjectLightDirStr; - } - - //MATRIX INVERSE - // 3x3 - public static string Inverse3x3Header = "Inverse3x3( {0} )"; - public static string[] Inverse3x3Function = - { - "{0}3x3 Inverse3x3({0}3x3 input)\n", - "{\n", - "\t{0}3 a = input._11_21_31;\n", - "\t{0}3 b = input._12_22_32;\n", - "\t{0}3 c = input._13_23_33;\n", - "\treturn {0}3x3(cross(b,c), cross(c,a), cross(a,b)) * (1.0 / dot(a,cross(b,c)));\n", - "}\n" - }; - - public static bool[] Inverse3x3FunctionFlags = - { - true, - false, - true, - true, - true, - true, - false - }; - - public static void Add3x3InverseFunction( ref MasterNodeDataCollector dataCollector, string precisionString ) - { - if( !dataCollector.HasFunction( Inverse3x3Header ) ) - { - //Hack to be used util indent is properly used - int currIndent = UIUtils.ShaderIndentLevel; - if( dataCollector.IsTemplate ) - { - UIUtils.ShaderIndentLevel = 0; - } - else - { - UIUtils.ShaderIndentLevel = 1; - UIUtils.ShaderIndentLevel++; - } - string finalFunction = string.Empty; - for( int i = 0; i < Inverse3x3Function.Length; i++ ) - { - finalFunction += UIUtils.ShaderIndentTabs + ( Inverse3x3FunctionFlags[ i ] ? string.Format( Inverse3x3Function[ i ], precisionString ) : Inverse3x3Function[ i ] ); - } - - - UIUtils.ShaderIndentLevel = currIndent; - - dataCollector.AddFunction( Inverse3x3Header, finalFunction ); - } - } - - public static string GenerateValueInVertex( ref MasterNodeDataCollector dataCollector, int uniqueId, WirePortDataType dataType, PrecisionType currentPrecisionType, string dataValue, string dataName, bool createInterpolator ) - { - if( !dataCollector.IsFragmentCategory ) - return dataValue; - - //TEMPLATES - if( dataCollector.IsTemplate ) - { - if( createInterpolator && dataCollector.TemplateDataCollectorInstance.HasCustomInterpolatedData( dataName ) ) - return dataName; - - MasterNodePortCategory category = dataCollector.PortCategory; - dataCollector.PortCategory = MasterNodePortCategory.Vertex; - - dataCollector.PortCategory = category; - - if( createInterpolator ) - { - dataCollector.TemplateDataCollectorInstance.RegisterCustomInterpolatedData( dataName, dataType, currentPrecisionType, dataValue ); - } - else - { - dataCollector.AddToVertexLocalVariables( -1, currentPrecisionType, dataType, dataName, dataValue ); - } - - return dataName; - } - - //SURFACE - { - if( dataCollector.TesselationActive ) - { - UIUtils.ShowMessage( "Unable to use Vertex to Frag when Tessellation is active" ); - switch( dataType ) - { - case WirePortDataType.FLOAT2: - { - return "(0).xx"; - } - case WirePortDataType.FLOAT3: - { - return "(0).xxx"; - } - case WirePortDataType.FLOAT4: - case WirePortDataType.COLOR: - { - return "(0).xxxx"; - } - } - return "0"; - } - - if( createInterpolator ) - dataCollector.AddToInput( uniqueId, dataName, dataType, currentPrecisionType ); - - MasterNodePortCategory portCategory = dataCollector.PortCategory; - dataCollector.PortCategory = MasterNodePortCategory.Vertex; - if( createInterpolator ) - { - dataCollector.AddLocalVariable( uniqueId, Constants.VertexShaderOutputStr + "." + dataName, dataValue + ";" ); - } - else - { - dataCollector.AddLocalVariable( uniqueId, currentPrecisionType, dataType, dataName, dataValue ); - } - dataCollector.PortCategory = portCategory; - return createInterpolator ? Constants.InputVarStr + "." + dataName : dataName; - } - } - - public static void AddCustomStandardSamplingMacros( ref MasterNodeDataCollector dataCollector ) - { - for( int i = 0; i < Constants.CustomStandardSamplingMacros.Length; i++ ) - dataCollector.AddToDirectives( Constants.CustomStandardSamplingMacros[ i ] ); - } - - public static void AddCustomArraySamplingMacros( ref MasterNodeDataCollector dataCollector ) - { - for( int i = 0; i < Constants.CustomArraySamplingMacros.Length; i++ ) - dataCollector.AddToDirectives( Constants.CustomArraySamplingMacros[ i ] ); - } - - public static void AddCustomASEMacros( ref MasterNodeDataCollector dataCollector ) - { - string varPrefix = dataCollector.IsSRP ? varPrefix = "TEXTURE" : "UNITY_DECLARE_TEX"; - - if( dataCollector.IsSRP ) - { - for( int i = 0; i < Constants.CustomASESRPArgsMacros.Length; i++ ) - { - dataCollector.AddToDirectives( Constants.CustomASESRPArgsMacros[ i ] ); - } - - for( int i = 0; i < Constants.CustomSRPSamplingMacros.Length; i++ ) - { - dataCollector.AddToDirectives( Constants.CustomSRPSamplingMacros[ i ] ); - } - } - else - { - - for( int i = 0; i < Constants.CustomASEStandardArgsMacros.Length; i++ ) - { - dataCollector.AddToDirectives( Constants.CustomASEStandardArgsMacros[ i ] ); - } - - for( int i = 0; i < Constants.CustomStandardSamplingMacros.Length; i++ ) - { - dataCollector.AddToDirectives( Constants.CustomStandardSamplingMacros[ i ] ); - } - } - - for( int i = 0; i < Constants.CustomASEDeclararionMacros.Length; i++ ) - { - string value = string.Format( Constants.CustomASEDeclararionMacros[ i ], varPrefix ); - dataCollector.AddToDirectives( value ); - } - - string samplePrefix = string.Empty; - string samplerArgs = string.Empty; - string samplerDecl = string.Empty; - - if( dataCollector.IsSRP ) - { - samplePrefix = "SAMPLE_TEXTURE"; - samplerArgs = "samplerName,"; - - for( int i = 0; i < Constants.CustomASESamplingMacros.Length; i++ ) - { - string value = string.Format( Constants.CustomASESamplingMacros[ i ], samplerArgs, samplePrefix, samplerDecl ); - dataCollector.AddToDirectives( value ); - } - } - else - { - samplePrefix = "UNITY_SAMPLE_TEX"; - samplerArgs = "samplerName,"; - samplerDecl = "_SAMPLER"; - dataCollector.AddToDirectives( Constants.CustomASEStandarSamplingMacrosHelper[ 0 ] ); - for( int i = 0; i < Constants.CustomASESamplingMacros.Length; i++ ) - { - string value = string.Format( Constants.CustomASESamplingMacros[ i ], samplerArgs, samplePrefix, samplerDecl ); - dataCollector.AddToDirectives( value ); - } - dataCollector.AddToDirectives( Constants.CustomASEStandarSamplingMacrosHelper[ 1 ] ); - samplerArgs = string.Empty; - samplerDecl = string.Empty; - for( int i = 0; i < Constants.CustomASESamplingMacros.Length; i++ ) - { - string value = string.Format( Constants.CustomASESamplingMacros[ i ], samplerArgs, samplePrefix, samplerDecl ); - dataCollector.AddToDirectives( value ); - } - dataCollector.AddToDirectives( Constants.CustomASEStandarSamplingMacrosHelper[ 2 ] ); - } - } - - public static void RegisterUnity2019MatrixDefines( ref MasterNodeDataCollector dataCollector ) - { -#if UNITY_2019_1_OR_NEWER - if( dataCollector.IsSRP && dataCollector.TemplateDataCollectorInstance.IsHDRP && ASEPackageManagerHelper.CurrentHDVersion >= ASESRPVersions.ASE_SRP_5_13_0 ) - { - //dataCollector.AddToDefines( -1, "unity_CameraProjection UNITY_MATRIX_P" ); - //dataCollector.AddToDefines( -1, "unity_CameraInvProjection UNITY_MATRIX_I_P" ); - //dataCollector.AddToDefines( -1, "unity_WorldToCamera UNITY_MATRIX_V" ); - //dataCollector.AddToDefines( -1, "unity_CameraToWorld UNITY_MATRIX_I_V" ); - - dataCollector.AddToUniforms( -1, "float4x4 unity_CameraProjection;" ); - dataCollector.AddToUniforms( -1, "float4x4 unity_CameraInvProjection;" ); - dataCollector.AddToUniforms( -1, "float4x4 unity_WorldToCamera;" ); - dataCollector.AddToUniforms( -1, "float4x4 unity_CameraToWorld;" ); - } -#endif - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/GeneratorUtils.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/GeneratorUtils.cs.meta deleted file mode 100644 index 190ac10d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/GeneratorUtils.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 7ab31d77d200c7a4ca43f4bf159de6b3 -timeCreated: 1490798546 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/GenericMessage.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/GenericMessage.cs deleted file mode 100644 index 3a699c60..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/GenericMessage.cs +++ /dev/null @@ -1,117 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEditor; -using UnityEngine; -using System.Collections.Generic; - -namespace AmplifyShaderEditor -{ - public enum MessageSeverity - { - Normal, - Warning, - Error - } - public class GenericMessageData - { - public string message; - public MessageSeverity severity; - public bool console; - public GenericMessageData( string msg, MessageSeverity svrty, bool csle ) - { - message = msg; - severity = svrty; - console = csle; - } - } - - class GenericMessageUI - { - public delegate void OnMessageDisplay( string message, MessageSeverity severity, bool console ); - public event OnMessageDisplay OnMessageDisplayEvent; - - private const double MESSAGE_TIME = 2; - private double m_currentMessageStartTime; - private Queue<GenericMessageData> m_messageQueue; - private bool m_displayingMessage; - - public GenericMessageUI() - { - m_messageQueue = new Queue<GenericMessageData>(); - m_displayingMessage = false; - m_currentMessageStartTime = EditorApplication.timeSinceStartup; - } - - public void Destroy() - { - m_messageQueue.Clear(); - OnMessageDisplayEvent = null; - } - - public void AddToQueue( string message, MessageSeverity severity, bool console ) - { - m_messageQueue.Enqueue( new GenericMessageData( message, severity, console ) ); - } - - public void Log( string message ) - { - m_messageQueue.Enqueue( new GenericMessageData( message, MessageSeverity.Normal, true ) ); - Debug.Log( message ); - } - - public void LogError( string message ) - { - m_messageQueue.Enqueue( new GenericMessageData( message, MessageSeverity.Error, true ) ); - Debug.LogError( message ); - } - - public void LogWarning( string message ) - { - m_messageQueue.Enqueue( new GenericMessageData( message, MessageSeverity.Warning, true ) ); - Debug.LogWarning( message ); - } - - public void CheckForMessages() - { - if ( m_displayingMessage ) - { - double timeLeft = EditorApplication.timeSinceStartup - m_currentMessageStartTime; - if ( timeLeft > MESSAGE_TIME ) - { - m_displayingMessage = false; - } - } - - if ( !m_displayingMessage ) - { - if ( m_messageQueue.Count > 0 ) - { - m_displayingMessage = true; - GenericMessageData data = m_messageQueue.Dequeue(); - m_currentMessageStartTime = EditorApplication.timeSinceStartup; - - if ( OnMessageDisplayEvent != null ) - OnMessageDisplayEvent( data.message, data.severity, data.console ); - } - } - } - - public void CleanUpMessageStack() - { - m_displayingMessage = false; - m_messageQueue.Clear(); - } - - public void StartMessageCounter() - { - m_displayingMessage = true; - m_currentMessageStartTime = EditorApplication.timeSinceStartup; - } - - public bool DisplayingMessage - { - get { return ( m_displayingMessage || m_messageQueue.Count > 0 ); } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/GenericMessage.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/GenericMessage.cs.meta deleted file mode 100644 index 13853703..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/GenericMessage.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 87cfef50a69ad24479fb8b472dac6d6e -timeCreated: 1481126957 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/IOUtils.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/IOUtils.cs deleted file mode 100644 index 30385506..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/IOUtils.cs +++ /dev/null @@ -1,843 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using System.IO; -using System.Security.Cryptography; -using System.Collections.Generic; -using UnityEngine; -using UnityEditor; -using System.Threading; -using UnityEditor.VersionControl; - -namespace AmplifyShaderEditor -{ - public enum ShaderLoadResult - { - LOADED, - TEMPLATE_LOADED, - FILE_NOT_FOUND, - ASE_INFO_NOT_FOUND, - UNITY_NATIVE_PATHS - } - - public class Worker - { - public static readonly object locker = new object(); - public void DoWork() - { - while ( IOUtils.ActiveThread ) - { - if ( IOUtils.SaveInThreadFlag ) - { - IOUtils.SaveInThreadFlag = false; - lock ( locker ) - { - IOUtils.SaveInThreadShaderBody = IOUtils.ShaderCopywriteMessage + IOUtils.SaveInThreadShaderBody; - // Add checksum - string checksum = IOUtils.CreateChecksum( IOUtils.SaveInThreadShaderBody ); - IOUtils.SaveInThreadShaderBody += IOUtils.CHECKSUM + IOUtils.VALUE_SEPARATOR + checksum; - - // Write to disk - StreamWriter fileWriter = new StreamWriter( IOUtils.SaveInThreadPathName ); - try - { - fileWriter.Write( IOUtils.SaveInThreadShaderBody ); - Debug.Log( "Saving complete" ); - } - catch ( Exception e ) - { - Debug.LogException( e ); - } - finally - { - fileWriter.Close(); - } - } - } - } - Debug.Log( "Thread closed" ); - } - } - - public static class IOUtils - { - public delegate void OnShaderAction( Shader shader, bool isTemplate, string type ); - public static OnShaderAction OnShaderSavedEvent; - public static OnShaderAction OnShaderTypeChangedEvent; - - public static readonly string ShaderCopywriteMessage = "// Made with Amplify Shader Editor\n// Available at the Unity Asset Store - http://u3d.as/y3X \n"; - public static readonly string GrabPassEmpty = "\t\tGrabPass{ }\n"; - public static readonly string GrabPassBegin = "\t\tGrabPass{ \""; - public static readonly string GrabPassEnd = "\" }\n"; - public static readonly string PropertiesBegin = "\tProperties\n\t{\n"; - public static readonly string PropertiesEnd = "\t}\n"; - public static readonly string PropertiesElement = "\t\t{0}\n"; - public static readonly string PropertiesElementsRaw = "{0}\n"; - - public static readonly string PragmaTargetHeader = "\t\t#pragma target {0}\n"; - public static readonly string InstancedPropertiesHeader = "multi_compile_instancing"; - public static readonly string VirtualTexturePragmaHeader = "multi_compile _ _VT_SINGLE_MODE"; - - public static readonly string InstancedPropertiesBegin = "UNITY_INSTANCING_CBUFFER_START({0})"; - public static readonly string InstancedPropertiesEnd = "UNITY_INSTANCING_CBUFFER_END"; - public static readonly string InstancedPropertiesElement = "UNITY_DEFINE_INSTANCED_PROP({0}, {1})"; - public static readonly string InstancedPropertiesData = "UNITY_ACCESS_INSTANCED_PROP({0})"; - - public static readonly string DotsInstancedPropertiesData = "\tUNITY_DOTS_INSTANCED_PROP({0}, {1})"; - public static readonly string DotsInstancedDefinesData = "#define {1} UNITY_ACCESS_DOTS_INSTANCED_PROP_FROM_MACRO({0} , Metadata_{1})"; - - public static readonly string LWSRPInstancedPropertiesBegin = "UNITY_INSTANCING_BUFFER_START({0})"; - public static readonly string LWSRPInstancedPropertiesEnd = "UNITY_INSTANCING_BUFFER_END({0})"; - public static readonly string LWSRPInstancedPropertiesElement = "UNITY_DEFINE_INSTANCED_PROP({0}, {1})"; - public static readonly string LWSRPInstancedPropertiesData = "UNITY_ACCESS_INSTANCED_PROP({0},{1})"; - - public static readonly string SRPCBufferPropertiesBegin = "CBUFFER_START( UnityPerMaterial )";//"CBUFFER_START({0})"; - public static readonly string SRPCBufferPropertiesEnd = "CBUFFER_END"; - - - public static readonly string InstancedPropertiesBeginTabs = "\t\t"+ InstancedPropertiesBegin + "\n"; - public static readonly string InstancedPropertiesEndTabs = "\t\t"+ InstancedPropertiesEnd + "\n"; - public static readonly string InstancedPropertiesElementTabs = "\t\t\t"+ InstancedPropertiesElement + "\n"; - - public static readonly string MetaBegin = "defaultTextures:"; - public static readonly string MetaEnd = "userData:"; - public static readonly string ShaderBodyBegin = "/*ASEBEGIN"; - public static readonly string ShaderBodyEnd = "ASEEND*/"; - //public static readonly float CurrentVersionFlt = 0.4f; - //public static readonly string CurrentVersionStr = "Version=" + CurrentVersionFlt; - - public static readonly string CHECKSUM = "//CHKSM"; - public static readonly string LAST_OPENED_OBJ_ID = "ASELASTOPENOBJID"; - - public static readonly string MAT_CLIPBOARD_ID = "ASEMATCLIPBRDID"; - public static readonly char FIELD_SEPARATOR = ';'; - public static readonly char VALUE_SEPARATOR = '='; - public static readonly char LINE_TERMINATOR = '\n'; - public static readonly char VECTOR_SEPARATOR = ','; - public static readonly char FLOAT_SEPARATOR = '.'; - public static readonly char CLIPBOARD_DATA_SEPARATOR = '|'; - public static readonly char MATRIX_DATA_SEPARATOR = '|'; - public readonly static string NO_TEXTURES = "<None>"; - public static readonly string SaveShaderStr = "Please enter shader name to save"; - public static readonly string FloatifyStr = ".0"; - - // Node parameter names - public const string NodeParam = "Node"; - public const string NodePosition = "Position"; - public const string NodeId = "Id"; - public const string NodeType = "Type"; - public const string WireConnectionParam = "WireConnection"; - - public static readonly uint NodeTypeId = 1; - - public static readonly int InNodeId = 1; - public static readonly int InPortId = 2; - public static readonly int OutNodeId = 3; - public static readonly int OutPortId = 4; - - public readonly static string DefaultASEDirtyCheckName = "__dirty"; - public readonly static string DefaultASEDirtyCheckProperty = "[HideInInspector] " + DefaultASEDirtyCheckName + "( \"\", Int ) = 1"; - public readonly static string DefaultASEDirtyCheckUniform = "uniform int " + DefaultASEDirtyCheckName + " = 1;"; - - public readonly static string MaskClipValueName = "_Cutoff"; - public readonly static string MaskClipValueProperty = MaskClipValueName + "( \"{0}\", Float ) = {1}"; - public readonly static string MaskClipValueUniform = "uniform float " + MaskClipValueName + " = {0};"; - - public readonly static string ChromaticAberrationProperty = "_ChromaticAberration"; - - //public static readonly string ASEFolderGUID = "daca988099666ec40aaa2cde22bb4935"; - //public static string ASEResourcesPath = "/Plugins/EditorResources/"; - //public static string ASEFolderPath; - - //public static bool IsShaderFunctionWindow = false; - - - public static int DefaultASEDirtyCheckId; - - // this is to be used in combination with AssetDatabase.GetAssetPath, both of these include the Assets/ path so we need to remove from one of them - public static string dataPath; - - - public static string EditorResourcesGUID = "0932db7ec1402c2489679c4b72eab5eb"; - public static string GraphBgTextureGUID = "881c304491028ea48b5027ac6c62cf73"; - public static string GraphFgTextureGUID = "8c4a7fca2884fab419769ccc0355c0c1"; - public static string WireTextureGUID = "06e687f68dd96f0448c6d8217bbcf608"; - public static string MasterNodeOnTextureGUID = "26c64fcee91024a49980ea2ee9d1a2fb"; - public static string MasterNodeOffTextureGUID = "712aee08d999c16438e2d694f42428e8"; - public static string GPUInstancedOnTextureGUID = "4b0c2926cc71c5846ae2a29652d54fb6"; - public static string GPUInstancedOffTextureGUID = "486c7766baaf21b46afb63c1121ef03e"; - public static string MainSkinGUID = "57482289c346f104a8162a3a79aaff9d"; - - public static string UpdateOutdatedGUID = "cce638be049286c41bcbd0a26c356b18"; - public static string UpdateOFFGUID = "99d70ac09b4db9742b404c3f92d8564b"; - public static string UpdateUpToDatedGUID = "ce30b12fbb3223746bcfef9ea82effe3"; - public static string LiveOffGUID = "bb16faf366bcc6c4fbf0d7666b105354"; - public static string LiveOnGUID = "6a0ae1d7892333142aeb09585572202c"; - public static string LivePendingGUID = "e3182200efb67114eb5050f8955e1746"; - public static string CleanupOFFGUID = "f62c0c3a5ddcd844e905fb2632fdcb15"; - public static string CleanUpOnGUID = "615d853995cf2344d8641fd19cb09b5d"; - public static string TakeScreenshotOFFGUID = "7587de2e3bec8bf4d973109524ccc6b1"; - public static string TakeScreenshotONGUID = "7587de2e3bec8bf4d973109524ccc6b1"; - public static string ShareOFFGUID = "bc5bd469748466a459badfab23915cb0"; - public static string ShareONGUID = "bc5bd469748466a459badfab23915cb0"; - public static string OpenSourceCodeOFFGUID = "f7e8834b42791124095a8b7f2d4daac2"; - public static string OpenSourceCodeONGUID = "8b114792ff84f6546880c031eda42bc0"; - public static string FocusNodeGUID = "da673e6179c67d346abb220a6935e359"; - public static string FitViewGUID = "1def740f2314c6b4691529cadeee2e9c"; - public static string ShowInfoWindowGUID = "77af20044e9766840a6be568806dc22e"; - public static string ShowTipsWindowGUID = "066674048bbb1e64e8cdcc6c3b4abbeb"; - public static string ShowConsoleWindowGUID = "9a81d7df8e62c044a9d1cada0c8a2131"; - - - public static Dictionary<string, string> NodeTypeReplacer = new Dictionary<string, string>() - { - {"AmplifyShaderEditor.RotateAboutAxis", "AmplifyShaderEditor.RotateAboutAxisNode"}, - {"GlobalArrayNode", "AmplifyShaderEditor.GlobalArrayNode"}, - {"AmplifyShaderEditor.SimpleMaxOp", "AmplifyShaderEditor.SimpleMaxOpNode"}, - {"AmplifyShaderEditor.SimpleMinNode", "AmplifyShaderEditor.SimpleMinOpNode"}, - {"AmplifyShaderEditor.TFHCRemap", "AmplifyShaderEditor.TFHCRemapNode"}, - {"AmplifyShaderEditor.TFHCPixelateUV", "AmplifyShaderEditor.TFHCPixelate"}, - {"AmplifyShaderEditor.VirtualTexturePropertyNode", "AmplifyShaderEditor.VirtualTextureObject"} - }; - - private static readonly string AmplifyShaderEditorDefineSymbol = "AMPLIFY_SHADER_EDITOR"; - - ///////////////////////////////////////////////////////////////////////////// - // THREAD IO UTILS - public static bool SaveInThreadFlag = false; - public static string SaveInThreadShaderBody; - public static string SaveInThreadPathName; - public static Thread SaveInThreadMainThread; - public static bool ActiveThread = true; - private static bool UseSaveThread = false; - - private static bool Initialized = false; - - public static bool FunctionNodeChanged = false; - - public static List<AmplifyShaderEditorWindow> AllOpenedWindows = new List<AmplifyShaderEditorWindow>(); - - public static void StartSaveThread( string shaderBody, string pathName ) - { - if( Provider.enabled && Provider.isActive ) - { - Asset loadedAsset = Provider.GetAssetByPath( FileUtil.GetProjectRelativePath( pathName ) ); - if( loadedAsset != null ) - { - //Task statusTask = Provider.Status( loadedAsset ); - //statusTask.Wait(); - //if( Provider.CheckoutIsValid( statusTask.assetList[ 0 ] ) ) - { - Task checkoutTask = Provider.Checkout( loadedAsset, CheckoutMode.Both ); - checkoutTask.Wait(); - } - } - } - - if( UseSaveThread ) - { - if ( !SaveInThreadFlag ) - { - if ( SaveInThreadMainThread == null ) - { - Worker worker = new Worker(); - SaveInThreadMainThread = new Thread( worker.DoWork ); - SaveInThreadMainThread.Start(); - Debug.Log( "Thread created" ); - } - - SaveInThreadShaderBody = shaderBody; - SaveInThreadPathName = pathName; - SaveInThreadFlag = true; - } - } - else - { - SaveTextfileToDisk( shaderBody, pathName ); - } - } - - //////////////////////////////////////////////////////////////////////////// - public static void SetAmplifyDefineSymbolOnBuildTargetGroup( BuildTargetGroup targetGroup ) - { - string currData = PlayerSettings.GetScriptingDefineSymbolsForGroup( targetGroup ); - if ( !currData.Contains( AmplifyShaderEditorDefineSymbol ) ) - { - if ( string.IsNullOrEmpty( currData ) ) - { - PlayerSettings.SetScriptingDefineSymbolsForGroup( targetGroup, AmplifyShaderEditorDefineSymbol ); - } - else - { - if ( !currData[ currData.Length - 1 ].Equals( ';' ) ) - { - currData += ';'; - } - currData += AmplifyShaderEditorDefineSymbol; - PlayerSettings.SetScriptingDefineSymbolsForGroup( targetGroup, currData ); - } - } - } - - public static void RemoveAmplifyDefineSymbolOnBuildTargetGroup( BuildTargetGroup targetGroup ) - { - string currData = PlayerSettings.GetScriptingDefineSymbolsForGroup( targetGroup ); - if( currData.Contains( AmplifyShaderEditorDefineSymbol ) ) - { - currData = currData.Replace( AmplifyShaderEditorDefineSymbol + ";", "" ); - currData = currData.Replace( ";" + AmplifyShaderEditorDefineSymbol, "" ); - currData = currData.Replace( AmplifyShaderEditorDefineSymbol, "" ); - PlayerSettings.SetScriptingDefineSymbolsForGroup( targetGroup, currData ); - } - } - - public static void Init() - { - if ( !Initialized ) - { - Initialized = true; - if( EditorPrefs.GetBool( Preferences.PrefDefineSymbol, true ) ) - SetAmplifyDefineSymbolOnBuildTargetGroup( EditorUserBuildSettings.selectedBuildTargetGroup ); - //Array BuildTargetGroupValues = Enum.GetValues( typeof( BuildTargetGroup )); - //for ( int i = 0; i < BuildTargetGroupValues.Length; i++ ) - //{ - // if( i != 0 && i != 15 && i != 16 ) - // SetAmplifyDefineSymbolOnBuildTargetGroup( ( BuildTargetGroup ) BuildTargetGroupValues.GetValue( i ) ); - //} - - DefaultASEDirtyCheckId = Shader.PropertyToID( DefaultASEDirtyCheckName ); - dataPath = Application.dataPath.Remove( Application.dataPath.Length - 6 ); - - - //ASEFolderPath = AssetDatabase.GUIDToAssetPath( ASEFolderGUID ); - //ASEResourcesPath = ASEFolderPath + ASEResourcesPath; - } - } - - - public static void DumpTemplateManagers() - { - for( int i = 0; i < AllOpenedWindows.Count; i++ ) - { - if( AllOpenedWindows[ i ].TemplatesManagerInstance != null ) - { - Debug.Log( AllOpenedWindows[ i ].titleContent.text + ": " + AllOpenedWindows[ i ].TemplatesManagerInstance.GetInstanceID() ); - } - } - } - - public static TemplatesManager FirstValidTemplatesManager - { - get - { - for( int i = 0; i < AllOpenedWindows.Count; i++ ) - { - if( AllOpenedWindows[ i ].TemplatesManagerInstance != null ) - { - return AllOpenedWindows[ i ].TemplatesManagerInstance; - } - } - return null; - } - } - - public static void UpdateSFandRefreshWindows( AmplifyShaderFunction function ) - { - for( int i = 0; i < AllOpenedWindows.Count; i++ ) - { - AllOpenedWindows[ i ].LateRefreshAvailableNodes(); - if( AllOpenedWindows[ i ].IsShaderFunctionWindow ) - { - if( AllOpenedWindows[ i ].OpenedShaderFunction == function ) - { - AllOpenedWindows[ i ].UpdateTabTitle(); - } - } - } - } - - public static void UpdateIO() - { - int windowCount = AllOpenedWindows.Count; - if ( windowCount == 0 ) - { - EditorApplication.update -= IOUtils.UpdateIO; - return; - } - - for ( int i = 0; i < AllOpenedWindows.Count; i++ ) - { - if ( AllOpenedWindows[i] == EditorWindow.focusedWindow ) - { - UIUtils.CurrentWindow = AllOpenedWindows[ i ]; - } - - if( FunctionNodeChanged ) - AllOpenedWindows[ i ].CheckFunctions = true; - - if ( AllOpenedWindows[ i ] == null ) - { - AllOpenedWindows.RemoveAt( i ); - i--; - } - } - - if ( FunctionNodeChanged ) - FunctionNodeChanged = false; - } - - public static void Destroy() - { - ActiveThread = false; - if ( SaveInThreadMainThread != null ) - { - SaveInThreadMainThread.Abort(); - SaveInThreadMainThread = null; - } - } - - public static void GetShaderName( out string shaderName, out string fullPathname, string defaultName, string customDatapath ) - { - string currDatapath = String.IsNullOrEmpty( customDatapath ) ? Application.dataPath : customDatapath; - fullPathname = EditorUtility.SaveFilePanelInProject( "Select Shader to save", defaultName, "shader", SaveShaderStr, currDatapath ); - if ( !String.IsNullOrEmpty( fullPathname ) ) - { - shaderName = fullPathname.Remove( fullPathname.Length - 7 ); // -7 remove .shader extension - string[] subStr = shaderName.Split( '/' ); - if ( subStr.Length > 0 ) - { - shaderName = subStr[ subStr.Length - 1 ]; // Remove pathname - } - } - else - { - shaderName = string.Empty; - } - } - - public static void AddTypeToString( ref string myString, string typeName ) - { - myString += typeName; - } - - public static void AddFieldToString( ref string myString, string fieldName, object fieldValue ) - { - myString += FIELD_SEPARATOR + fieldName + VALUE_SEPARATOR + fieldValue; - } - - public static void AddFieldValueToString( ref string myString, object fieldValue ) - { - myString += FIELD_SEPARATOR + fieldValue.ToString(); - } - - public static void AddLineTerminator( ref string myString ) - { - myString += LINE_TERMINATOR; - } - - public static string CreateChecksum( string buffer ) - { - SHA1 sha1 = SHA1.Create(); - byte[] buf = System.Text.Encoding.UTF8.GetBytes( buffer ); - byte[] hash = sha1.ComputeHash( buf, 0, buf.Length ); - string hashstr = BitConverter.ToString( hash ).Replace( "-", "" ); - return hashstr; - } - - public static void SaveTextfileToDisk( string shaderBody, string pathName, bool addAdditionalInfo = true ) - { - - if ( addAdditionalInfo ) - { - shaderBody = ShaderCopywriteMessage + shaderBody; - // Add checksum - string checksum = CreateChecksum( shaderBody ); - shaderBody += CHECKSUM + VALUE_SEPARATOR + checksum; - } - - // Write to disk - StreamWriter fileWriter = new StreamWriter( pathName ); - try - { - fileWriter.Write( shaderBody ); - } - catch ( Exception e ) - { - Debug.LogException( e ); - } - finally - { - fileWriter.Close(); - } - } - - public static string AddAdditionalInfo( string shaderBody ) - { - shaderBody = ShaderCopywriteMessage + shaderBody; - string checksum = CreateChecksum( shaderBody ); - shaderBody += CHECKSUM + VALUE_SEPARATOR + checksum; - return shaderBody; - } - - public static string LoadTextFileFromDisk( string pathName ) - { - string result = string.Empty; - if ( !string.IsNullOrEmpty( pathName ) && File.Exists( pathName ) ) - { - - StreamReader fileReader = null; - try - { - fileReader = new StreamReader( pathName ); - result = fileReader.ReadToEnd(); - } - catch ( Exception e ) - { - Debug.LogException( e ); - } - finally - { - if( fileReader != null) - fileReader.Close(); - } - } - return result; - } - - public static bool IsASEShader( Shader shader ) - { - string datapath = AssetDatabase.GetAssetPath( shader ); - if ( UIUtils.IsUnityNativeShader( datapath ) ) - { - return false; - } - - string buffer = LoadTextFileFromDisk( datapath ); - if ( String.IsNullOrEmpty( buffer ) || !IOUtils.HasValidShaderBody( ref buffer ) ) - { - return false; - } - return true; - } - - public static bool IsShaderFunction( string functionInfo ) - { - string buffer = functionInfo; - if ( String.IsNullOrEmpty( buffer ) || !IOUtils.HasValidShaderBody( ref buffer ) ) - { - return false; - } - return true; - } - - public static bool HasValidShaderBody( ref string shaderBody ) - { - int shaderBodyBeginId = shaderBody.IndexOf( ShaderBodyBegin ); - if ( shaderBodyBeginId > -1 ) - { - int shaderBodyEndId = shaderBody.IndexOf( ShaderBodyEnd ); - return ( shaderBodyEndId > -1 && shaderBodyEndId > shaderBodyBeginId ); - } - return false; - } - - public static int[] AllIndexesOf( this string str, string substr, bool ignoreCase = false ) - { - if ( string.IsNullOrEmpty( str ) || string.IsNullOrEmpty( substr ) ) - { - throw new ArgumentException( "String or substring is not specified." ); - } - - List<int> indexes = new List<int>(); - int index = 0; - - while ( ( index = str.IndexOf( substr, index, ignoreCase ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal ) ) != -1 ) - { - indexes.Add( index++ ); - } - - return indexes.ToArray(); - } - - public static void AddFunctionHeader( ref string function, string header ) - { - function += "\t\t" + header + "\n\t\t{\n"; - } - - public static void AddSingleLineFunction( ref string function, string header ) - { - function += "\t\t" + header; - } - - public static void AddFunctionLine( ref string function, string line ) - { - function += "\t\t\t" + line + "\n"; - } - - public static void CloseFunctionBody( ref string function ) - { - function += "\t\t}\n"; - } - - public static string CreateFullFunction( string header, params string[] functionLines ) - { - string result = string.Empty; - AddFunctionHeader( ref result, header ); - for ( int i = 0; i > functionLines.Length; i++ ) - { - AddFunctionLine( ref result, functionLines[ i ] ); - } - CloseFunctionBody( ref result ); - return result; - } - - public static string CreateCodeComments( bool forceForwardSlash, params string[] comments ) - { - string finalComment = string.Empty; - if ( comments.Length == 1 ) - { - finalComment = "//" + comments[ 0 ]; - } - else - { - if ( forceForwardSlash ) - { - for ( int i = 0; i < comments.Length; i++ ) - { - finalComment += "//" + comments[ i ]; - if ( i < comments.Length - 1 ) - { - finalComment += "\n\t\t\t"; - } - } - } - else - { - finalComment = "/*"; - for ( int i = 0; i < comments.Length; i++ ) - { - if ( i != 0 ) - finalComment += "\t\t\t"; - finalComment += comments[ i ]; - if ( i < comments.Length - 1 ) - finalComment += "\n"; - } - finalComment += "*/"; - } - } - return finalComment; - } - - public static string GetUVChannelDeclaration( string uvName, int channelId, int set ) - { - string uvSetStr = ( set == 0 ) ? "uv" : "uv" + Constants.AvailableUVSetsStr[ set ]; - return "float2 " + uvSetStr + uvName /*+ " : TEXCOORD" + channelId*/; - } - - public static string GetUVChannelName( string uvName, int set ) - { - string uvSetStr = ( set == 0 ) ? "uv" : "uv" + Constants.AvailableUVSetsStr[ set ]; - return uvSetStr + uvName; - } - - public static string GetVertexUVChannelName( int set ) - { - string uvSetStr = ( set == 0 ) ? "texcoord" : ( "texcoord" + set.ToString() ); - return uvSetStr; - } - - public static string Floatify( float value ) - { - return ( value % 1 ) != 0 ? value.ToString() : ( value.ToString() + FloatifyStr ); - } - - public static string Vector2ToString( Vector2 data ) - { - return data.x.ToString() + VECTOR_SEPARATOR + data.y.ToString(); - } - - public static string Vector3ToString( Vector3 data ) - { - return data.x.ToString() + VECTOR_SEPARATOR + data.y.ToString() + VECTOR_SEPARATOR + data.z.ToString(); - } - - public static string Vector4ToString( Vector4 data ) - { - return data.x.ToString() + VECTOR_SEPARATOR + data.y.ToString() + VECTOR_SEPARATOR + data.z.ToString() + VECTOR_SEPARATOR + data.w.ToString(); - } - - public static string ColorToString( Color data ) - { - return data.r.ToString() + VECTOR_SEPARATOR + data.g.ToString() + VECTOR_SEPARATOR + data.b.ToString() + VECTOR_SEPARATOR + data.a.ToString(); - } - - public static string Matrix3x3ToString( Matrix4x4 matrix ) - { - return matrix[ 0, 0 ].ToString() + IOUtils.VECTOR_SEPARATOR + matrix[ 0, 1 ].ToString() + IOUtils.VECTOR_SEPARATOR + matrix[ 0, 2 ].ToString() + IOUtils.VECTOR_SEPARATOR + - matrix[ 1, 0 ].ToString() + IOUtils.VECTOR_SEPARATOR + matrix[ 1, 1 ].ToString() + IOUtils.VECTOR_SEPARATOR + matrix[ 1, 2 ].ToString() + IOUtils.VECTOR_SEPARATOR + - matrix[ 2, 0 ].ToString() + IOUtils.VECTOR_SEPARATOR + matrix[ 2, 1 ].ToString() + IOUtils.VECTOR_SEPARATOR + matrix[ 2, 2 ].ToString(); - } - - public static string Matrix4x4ToString( Matrix4x4 matrix ) - { - return matrix[ 0, 0 ].ToString() + IOUtils.VECTOR_SEPARATOR + matrix[ 0, 1 ].ToString() + IOUtils.VECTOR_SEPARATOR + matrix[ 0, 2 ].ToString() + IOUtils.VECTOR_SEPARATOR + matrix[ 0, 3 ].ToString() + IOUtils.VECTOR_SEPARATOR + - matrix[ 1, 0 ].ToString() + IOUtils.VECTOR_SEPARATOR + matrix[ 1, 1 ].ToString() + IOUtils.VECTOR_SEPARATOR + matrix[ 1, 2 ].ToString() + IOUtils.VECTOR_SEPARATOR + matrix[ 1, 3 ].ToString() + IOUtils.VECTOR_SEPARATOR + - matrix[ 2, 0 ].ToString() + IOUtils.VECTOR_SEPARATOR + matrix[ 2, 1 ].ToString() + IOUtils.VECTOR_SEPARATOR + matrix[ 2, 2 ].ToString() + IOUtils.VECTOR_SEPARATOR + matrix[ 2, 3 ].ToString() + IOUtils.VECTOR_SEPARATOR + - matrix[ 3, 0 ].ToString() + IOUtils.VECTOR_SEPARATOR + matrix[ 3, 1 ].ToString() + IOUtils.VECTOR_SEPARATOR + matrix[ 3, 2 ].ToString() + IOUtils.VECTOR_SEPARATOR + matrix[ 3, 3 ].ToString(); - } - - public static Vector2 StringToVector2( string data ) - { - string[] parsedData = data.Split( VECTOR_SEPARATOR ); - if ( parsedData.Length >= 2 ) - { - return new Vector2( Convert.ToSingle( parsedData[ 0 ] ), - Convert.ToSingle( parsedData[ 1 ] ) ); - } - return Vector2.zero; - } - - public static Vector3 StringToVector3( string data ) - { - string[] parsedData = data.Split( VECTOR_SEPARATOR ); - if ( parsedData.Length >= 3 ) - { - return new Vector3( Convert.ToSingle( parsedData[ 0 ] ), - Convert.ToSingle( parsedData[ 1 ] ), - Convert.ToSingle( parsedData[ 2 ] ) ); - } - return Vector3.zero; - } - - public static Vector4 StringToVector4( string data ) - { - string[] parsedData = data.Split( VECTOR_SEPARATOR ); - if ( parsedData.Length >= 4 ) - { - return new Vector4( Convert.ToSingle( parsedData[ 0 ] ), - Convert.ToSingle( parsedData[ 1 ] ), - Convert.ToSingle( parsedData[ 2 ] ), - Convert.ToSingle( parsedData[ 3 ] ) ); - } - return Vector4.zero; - } - - public static Color StringToColor( string data ) - { - string[] parsedData = data.Split( VECTOR_SEPARATOR ); - if ( parsedData.Length >= 4 ) - { - return new Color( Convert.ToSingle( parsedData[ 0 ] ), - Convert.ToSingle( parsedData[ 1 ] ), - Convert.ToSingle( parsedData[ 2 ] ), - Convert.ToSingle( parsedData[ 3 ] ) ); - } - return Color.white; - } - - public static Matrix4x4 StringToMatrix3x3( string data ) - { - string[] parsedData = data.Split( VECTOR_SEPARATOR ); - if ( parsedData.Length == 9 ) - { - Matrix4x4 matrix = new Matrix4x4(); - matrix[ 0, 0 ] = Convert.ToSingle( parsedData[ 0 ] ); - matrix[ 0, 1 ] = Convert.ToSingle( parsedData[ 1 ] ); - matrix[ 0, 2 ] = Convert.ToSingle( parsedData[ 2 ] ); - - matrix[ 1, 0 ] = Convert.ToSingle( parsedData[ 3 ] ); - matrix[ 1, 1 ] = Convert.ToSingle( parsedData[ 4 ] ); - matrix[ 1, 2 ] = Convert.ToSingle( parsedData[ 5 ] ); - - matrix[ 2, 0 ] = Convert.ToSingle( parsedData[ 6 ] ); - matrix[ 2, 1 ] = Convert.ToSingle( parsedData[ 7 ] ); - matrix[ 2, 2 ] = Convert.ToSingle( parsedData[ 8 ] ); - return matrix; - } - return Matrix4x4.identity; - } - - public static Matrix4x4 StringToMatrix4x4( string data ) - { - string[] parsedData = data.Split( VECTOR_SEPARATOR ); - if ( parsedData.Length == 16 ) - { - Matrix4x4 matrix = new Matrix4x4(); - matrix[ 0, 0 ] = Convert.ToSingle( parsedData[ 0 ] ); - matrix[ 0, 1 ] = Convert.ToSingle( parsedData[ 1 ] ); - matrix[ 0, 2 ] = Convert.ToSingle( parsedData[ 2 ] ); - matrix[ 0, 3 ] = Convert.ToSingle( parsedData[ 3 ] ); - - matrix[ 1, 0 ] = Convert.ToSingle( parsedData[ 4 ] ); - matrix[ 1, 1 ] = Convert.ToSingle( parsedData[ 5 ] ); - matrix[ 1, 2 ] = Convert.ToSingle( parsedData[ 6 ] ); - matrix[ 1, 3 ] = Convert.ToSingle( parsedData[ 7 ] ); - - matrix[ 2, 0 ] = Convert.ToSingle( parsedData[ 8 ] ); - matrix[ 2, 1 ] = Convert.ToSingle( parsedData[ 9 ] ); - matrix[ 2, 2 ] = Convert.ToSingle( parsedData[ 10 ] ); - matrix[ 2, 3 ] = Convert.ToSingle( parsedData[ 11 ] ); - - matrix[ 3, 0 ] = Convert.ToSingle( parsedData[ 12 ] ); - matrix[ 3, 1 ] = Convert.ToSingle( parsedData[ 13 ] ); - matrix[ 3, 2 ] = Convert.ToSingle( parsedData[ 14 ] ); - matrix[ 3, 3 ] = Convert.ToSingle( parsedData[ 15 ] ); - return matrix; - } - return Matrix4x4.identity; - } - - public static void SaveTextureToDisk( Texture2D tex, string pathname ) - { - byte[] rawData = tex.GetRawTextureData(); - Texture2D newTex = new Texture2D( tex.width, tex.height, tex.format, tex.mipmapCount > 1, false ); - newTex.LoadRawTextureData( rawData ); - newTex.Apply(); - byte[] pngData = newTex.EncodeToPNG(); - File.WriteAllBytes( pathname, pngData ); - } - - //public static void SaveObjToList( string newObj ) - //{ - // Debug.Log( UIUtils.CurrentWindow.Lastpath ); - // UIUtils.CurrentWindow.Lastpath = newObj; - // string lastOpenedObj = EditorPrefs.GetString( IOUtils.LAST_OPENED_OBJ_ID ); - // string[] allLocations = lastOpenedObj.Split( ':' ); - - // string lastLocation = allLocations[ allLocations.Length - 1 ]; - - // string resave = string.Empty; - // for ( int i = 0; i < allLocations.Length; i++ ) - // { - // if ( string.IsNullOrEmpty( allLocations[ i ] ) ) - // continue; - - // resave += allLocations[ i ]; - // resave += ":"; - // } - - // resave += newObj; - // EditorPrefs.SetString( IOUtils.LAST_OPENED_OBJ_ID, resave ); - //} - - //public static void DeleteObjFromList( string newObj ) - //{ - // string lastOpenedObj = EditorPrefs.GetString( IOUtils.LAST_OPENED_OBJ_ID ); - // string[] allLocations = lastOpenedObj.Split( ':' ); - - // string resave = string.Empty; - // for ( int i = 0; i < allLocations.Length; i++ ) - // { - // if ( string.IsNullOrEmpty( allLocations[ i ] ) || newObj.Equals( allLocations[ i ] ) ) - // continue; - - // resave += allLocations[ i ]; - // if ( i < allLocations.Length - 1 ) - // resave += ":"; - // } - - // EditorPrefs.SetString( IOUtils.LAST_OPENED_OBJ_ID, resave ); - //} - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/IOUtils.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/IOUtils.cs.meta deleted file mode 100644 index 08f17515..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/IOUtils.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: d39b4c96fb4d7f847b3a21c377d4188d -timeCreated: 1481126959 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/InlineProperty.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/InlineProperty.cs deleted file mode 100644 index 55113c61..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/InlineProperty.cs +++ /dev/null @@ -1,320 +0,0 @@ -using UnityEngine; -using UnityEditor; -using System; - -namespace AmplifyShaderEditor -{ - [System.Serializable] - public class InlineProperty - { - [SerializeField] - private float m_value = 0; - - [SerializeField] - private bool m_active = false; - - [SerializeField] - private int m_nodeId = -1; - - [SerializeField] - private string m_nodePropertyName = string.Empty; - - public InlineProperty() { } - - public InlineProperty( float val ) - { - m_value = val; - } - - public InlineProperty( int val ) - { - m_value = val; - } - - public void ResetProperty() - { - m_nodeId = -1; - m_active = false; - } - - public void CopyFrom( InlineProperty other ) - { - m_value = other.m_value; - m_active = other.m_active; - m_nodeId = other.m_nodeId; - } - - public void SetInlineByName( string propertyName ) - { - m_nodeId = UIUtils.GetNodeIdByName( propertyName ); - m_nodePropertyName = propertyName; - m_active = m_nodeId != -1; - } - - public void IntField( ref UndoParentNode owner, string content ) - { - if( !m_active ) - { - EditorGUILayout.BeginHorizontal(); - m_value = owner.EditorGUILayoutIntField( content, (int)m_value ); - if( GUILayout.Button( UIUtils.FloatIntIconON, UIUtils.FloatIntPickerONOFF, GUILayout.Width( 15 ), GUILayout.Height( 15 ) ) ) - m_active = !m_active; - EditorGUILayout.EndHorizontal(); - } - else - { - DrawPicker( ref owner, content ); - } - } - - public void IntSlider( ref UndoParentNode owner, GUIContent content, int min, int max ) - { - if( !m_active ) - { - EditorGUILayout.BeginHorizontal(); - m_value = owner.EditorGUILayoutIntSlider( content, (int)m_value, min, max ); - if( GUILayout.Button( UIUtils.FloatIntIconON, UIUtils.FloatIntPickerONOFF, GUILayout.Width( 15 ), GUILayout.Height( 15 ) ) ) - m_active = !m_active; - EditorGUILayout.EndHorizontal(); - } - else - { - DrawPicker( ref owner, content ); - } - } - - public void IntSlider( ref UndoParentNode owner, string content, int min, int max ) - { - if( !m_active ) - { - EditorGUILayout.BeginHorizontal(); - m_value = owner.EditorGUILayoutIntSlider( content, (int)m_value, min, max ); - if( GUILayout.Button( UIUtils.FloatIntIconON, UIUtils.FloatIntPickerONOFF, GUILayout.Width( 15 ), GUILayout.Height( 15 ) ) ) - m_active = !m_active; - EditorGUILayout.EndHorizontal(); - } - else - { - DrawPicker( ref owner, content ); - } - } - - public void EnumTypePopup( ref UndoParentNode owner, string content, string[] displayOptions ) - { - if( !m_active ) - { - EditorGUILayout.BeginHorizontal(); - m_value = owner.EditorGUILayoutPopup( content, (int)m_value, displayOptions ); - if( GUILayout.Button( UIUtils.FloatIntIconON, UIUtils.FloatIntPickerONOFF, GUILayout.Width( 15 ), GUILayout.Height( 15 ) ) ) - m_active = !m_active; - EditorGUILayout.EndHorizontal(); - - } - else - { - DrawPicker( ref owner, content ); - } - } - - public void FloatField( ref UndoParentNode owner, string content ) - { - if( !m_active ) - { - EditorGUILayout.BeginHorizontal(); - m_value = owner.EditorGUILayoutFloatField( content, m_value ); - if( GUILayout.Button( UIUtils.FloatIntIconON, UIUtils.FloatIntPickerONOFF, GUILayout.Width( 15 ), GUILayout.Height( 15 ) ) ) - m_active = !m_active; - EditorGUILayout.EndHorizontal(); - } - else - { - DrawPicker( ref owner, content ); - } - } - - public void SliderField( ref UndoParentNode owner, string content, float min, float max ) - { - if( !m_active ) - { - EditorGUILayout.BeginHorizontal(); - m_value = owner.EditorGUILayoutSlider( content, m_value, min, max ); - if( GUILayout.Button( UIUtils.FloatIntIconON, UIUtils.FloatIntPickerONOFF, GUILayout.Width( 15 ), GUILayout.Height( 15 ) ) ) - m_active = !m_active; - EditorGUILayout.EndHorizontal(); - } - else - { - DrawPicker( ref owner, content ); - } - } - - public void RangedFloatField( ref UndoParentNode owner, string content, float min, float max ) - { - if( !m_active ) - { - EditorGUILayout.BeginHorizontal(); - m_value = owner.EditorGUILayoutRangedFloatField( content, m_value, min, max ); - if( GUILayout.Button( UIUtils.FloatIntIconON, UIUtils.FloatIntPickerONOFF, GUILayout.Width( 15 ), GUILayout.Height( 15 ) ) ) - m_active = !m_active; - EditorGUILayout.EndHorizontal(); - } - else - { - DrawPicker( ref owner, content ); - } - } - - - public void CustomDrawer( ref UndoParentNode owner, DrawPropertySection Drawer, string content ) - { - if( !m_active ) - { - EditorGUILayout.BeginHorizontal(); - Drawer( owner ); - if( GUILayout.Button( UIUtils.FloatIntIconON, UIUtils.FloatIntPickerONOFF, GUILayout.Width( 15 ), GUILayout.Height( 15 ) ) ) - m_active = !m_active; - EditorGUILayout.EndHorizontal(); - } - else - { - DrawPicker( ref owner, content ); - } - } - - public delegate void DrawPropertySection( UndoParentNode owner ); - - private void DrawPicker( ref UndoParentNode owner, GUIContent content ) - { - DrawPicker( ref owner, content.text ); - } - - private void DrawPicker( ref UndoParentNode owner, string content ) - { - EditorGUILayout.BeginHorizontal(); - m_nodeId = owner.EditorGUILayoutIntPopup( content, m_nodeId, UIUtils.FloatIntNodeArr(), UIUtils.FloatIntNodeIds() ); - if( GUILayout.Button( UIUtils.FloatIntIconOFF, UIUtils.FloatIntPickerONOFF, GUILayout.Width( 15 ), GUILayout.Height( 15 ) ) ) - m_active = !m_active; - EditorGUILayout.EndHorizontal(); - } - - public string GetValueOrProperty( bool parentesis = true ) - { - if( m_active ) - { - PropertyNode node = GetPropertyNode(); - if( node != null ) - { - return parentesis ? "[" + node.PropertyName + "]" : node.PropertyName; - } - else - { - m_active = false; - m_nodeId = -1; - return m_value.ToString(); - } - } - else - { - return m_value.ToString(); - } - } - - public string GetValueOrProperty( string defaultValue, bool parentesis = true ) - { - if( m_active ) - { - PropertyNode node = GetPropertyNode(); - if( node != null ) - { - return parentesis ? "[" + node.PropertyName + "]" : node.PropertyName; - } - else if( !string.IsNullOrEmpty( defaultValue ) ) - { - m_active = false; - m_nodeId = -1; - return defaultValue; - } - else - { - m_active = false; - m_nodeId = -1; - return m_value.ToString(); - } - } - else - { - return defaultValue; - } - } - - public void ReadFromString( ref uint index, ref string[] nodeParams, bool isInt = true ) - { - m_value = isInt ? Convert.ToInt32( nodeParams[ index++ ] ) : Convert.ToSingle( nodeParams[ index++ ] ); - m_active = Convert.ToBoolean( nodeParams[ index++ ] ); - m_nodeId = Convert.ToInt32( nodeParams[ index++ ] ); - } - - public void ReadFromSingle( string singleLine ) - { - string[] data = singleLine.Split( IOUtils.VECTOR_SEPARATOR ); - m_value = Convert.ToSingle( data[ 0 ] ); - m_active = Convert.ToBoolean( data[ 1 ] ); - m_nodeId = Convert.ToInt32( data[ 2 ] ); - } - - public void WriteToString( ref string nodeInfo ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_value ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_active ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_nodeId ); - } - - public string WriteToSingle() - { - return m_value.ToString() + IOUtils.VECTOR_SEPARATOR + m_active + IOUtils.VECTOR_SEPARATOR + m_nodeId; - } - - public void SetInlineNodeValue() - { - if( IsValid ) - { - RangedFloatNode fnode = UIUtils.GetNode( m_nodeId ) as RangedFloatNode; - if( fnode != null ) - { - fnode.Value = m_value; - fnode.SetMaterialValueFromInline( m_value ); - } - else - { - IntNode inode = UIUtils.GetNode( m_nodeId ) as IntNode; - inode.Value = (int)m_value; - inode.SetMaterialValueFromInline( (int)m_value ); - } - } - } - - public bool IsValid { get { return m_active && m_nodeId != -1; } } - - public PropertyNode GetPropertyNode() - { - if( m_nodeId >= 0 ) - return UIUtils.GetNode( m_nodeId ) as PropertyNode; - - if( m_nodeId < -1 ) - { - if(!string.IsNullOrEmpty(m_nodePropertyName)) - return UIUtils.GetInternalTemplateNode( m_nodePropertyName ); - - - return UIUtils.GetInternalTemplateNode( m_nodeId ); - } - - return null; - } - - public int IntValue { get { return (int)m_value; } set { m_value = value; } } - public float FloatValue { get { return m_value; } set { m_value = value; } } - public bool Active { get { return m_active; } set { m_active = value; } } - public int NodeId { get { return m_nodeId; } set { m_nodeId = value; } } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/InlineProperty.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/InlineProperty.cs.meta deleted file mode 100644 index 7c5e45d6..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/InlineProperty.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: f4f4421f529503243bfef5076ae82512 -timeCreated: 1519298230 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/InvalidDataChecker.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/InvalidDataChecker.cs deleted file mode 100644 index b5540b2f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/InvalidDataChecker.cs +++ /dev/null @@ -1,172 +0,0 @@ -using UnityEditor; -using UnityEngine; -using System; -using System.Collections; -using UnityEngine.Networking; - -namespace AmplifyShaderEditor -{ - [InitializeOnLoad] - public class InvalidDataChecker - { - private static string[] m_invalidData = { "674ea7bed6b1cd94b8057074298096db", //"/Samples", - "2738539936eacef409be91f148b2a4a0", //"/Resources", - "c880e50f07f2be9499d414ac6f9f3a7a", //"/Templates", - "563f992b9989cf547ac59bf748442c17"};//"/Textures"}; - //private static string m_ASEFolderPath; - private static string m_invalidDataCollected = string.Empty; - static InvalidDataChecker() - { - bool foundInvalidData = false; - //m_ASEFolderPath = AssetDatabase.GUIDToAssetPath( IOUtils.ASEFolderGUID ); - int count = 0; - for ( int i = 0; i < m_invalidData.Length; i++ ) - { - //m_invalidData[ i ] = m_ASEFolderPath + m_invalidData[ i ]; - m_invalidData[ i ] = AssetDatabase.GUIDToAssetPath( m_invalidData[ i ] ); - if ( AssetDatabase.IsValidFolder( m_invalidData[ i ] ) ) - { - foundInvalidData = true; - m_invalidDataCollected += m_invalidData[ i ]+"\n"; - count += 1; - } - } - if ( count < 5 ) - { - for ( ; count < 5; count++ ) - { - m_invalidDataCollected += "\n"; - } - } - - if ( foundInvalidData ) - { - InvalidDataPopUp window = ( InvalidDataPopUp ) EditorWindow.GetWindow( typeof( InvalidDataPopUp ), true, "Found Invalid Data" ); - window.minSize = new Vector2( 502, 265 ); - window.maxSize = new Vector2( 502, 265 ); - window.Show(); - } - - EditorApplication.update += Update; - } - - static void Update() - { - EditorApplication.update -= Update; - - if( !EditorApplication.isPlayingOrWillChangePlaymode ) - { - Preferences.ShowOption show = Preferences.ShowOption.Never; - if( !EditorPrefs.HasKey( Preferences.PrefStartUp ) ) - { - show = Preferences.ShowOption.Always; - EditorPrefs.SetInt( Preferences.PrefStartUp, 0 ); - } - else - { - if( Time.realtimeSinceStartup < 10 ) - { - show = (Preferences.ShowOption) EditorPrefs.GetInt( Preferences.PrefStartUp, 0 ); - // check version here - if( show == Preferences.ShowOption.OnNewVersion ) - { - ASEStartScreen.StartBackgroundTask( StartRequest( ASEStartScreen.ChangelogURL, () => - { - var changeLog = ChangeLogInfo.CreateFromJSON( www.downloadHandler.text ); - if( changeLog != null ) - { - if( changeLog.Version > VersionInfo.FullNumber ) - ASEStartScreen.Init(); - } - } ) ); - } - } - } - - if( show == Preferences.ShowOption.Always ) - ASEStartScreen.Init(); - } - } - - static UnityWebRequest www; - - static IEnumerator StartRequest( string url, Action success = null ) - { - using( www = UnityWebRequest.Get( url ) ) - { -#if UNITY_2017_2_OR_NEWER - yield return www.SendWebRequest(); -#else - yield return www.Send(); -#endif - - while( www.isDone == false ) - yield return null; - - if( success != null ) - success(); - } - } - - public static void CleanInvalidData() - { - for ( int i = 0; i < m_invalidData.Length; i++ ) - { - if ( FileUtil.DeleteFileOrDirectory( m_invalidData[ i ] ) ) - { - Debug.Log( "Removed invalid " + m_invalidData[ i ] ); - if ( FileUtil.DeleteFileOrDirectory( m_invalidData[ i ] + ".meta" ) ) - { - Debug.Log( "Removed invalid " + m_invalidData[ i ] + ".meta" ); - } - } - } - AssetDatabase.Refresh(); - } - - public static string InvalidDataCollected { get { return m_invalidDataCollected; } } - } - - public class InvalidDataPopUp : EditorWindow - { - private readonly GUIContent m_buttonContent = new GUIContent( "Remove Invalid Data" ); - private Vector2 m_scrollPosition = Vector2.zero; - public void OnGUI() - { - GUILayout.BeginVertical(); - { - GUIStyle labelStyle = new GUIStyle( EditorStyles.label ); - labelStyle.alignment = TextAnchor.MiddleCenter; - labelStyle.wordWrap = true; - GUILayout.Label( "\nAmplify Shader Editor " + VersionInfo.StaticToString(), labelStyle, GUILayout.ExpandWidth( true ) ); - GUILayout.Space( 5 ); - GUILayout.Label( "Invalid/Legacy Data was found on your previous ASE folder which needs to be removed in order for it to work correctly." , labelStyle, GUILayout.ExpandWidth( true ) ); - GUILayout.Space( 5 ); - GUILayout.Label( "Below are the detected files/folders which require to be removed.", labelStyle, GUILayout.ExpandWidth( true ) ); - GUILayout.Space( 5 ); - - m_scrollPosition = GUILayout.BeginScrollView( m_scrollPosition ,GUILayout.Height(85)); - - GUILayout.TextArea( InvalidDataChecker.InvalidDataCollected ); - GUILayout.EndScrollView(); - - - GUILayout.Label( "VERY IMPORTANT: If you have assets of yours inside these folders you need to move them to another location before hitting the button below or they will be PERMANENTLY DELETED", labelStyle, GUILayout.ExpandWidth( true ) ); - GUILayout.Space( 5 ); - - GUILayout.BeginHorizontal(); - { - GUILayout.Space( 151 ); - if ( GUILayout.Button( m_buttonContent, GUILayout.Width( 200 ) ) ) - { - InvalidDataChecker.CleanInvalidData(); - Close(); - } - } - GUILayout.EndHorizontal(); - } - GUILayout.EndVertical(); - - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/InvalidDataChecker.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/InvalidDataChecker.cs.meta deleted file mode 100644 index daaec410..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/InvalidDataChecker.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: c71b815458d61e24184a60dbce19573d -timeCreated: 1481126959 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/NodeExporterUtils.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/NodeExporterUtils.cs deleted file mode 100644 index 0f2ca737..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/NodeExporterUtils.cs +++ /dev/null @@ -1,284 +0,0 @@ -using UnityEngine; -using UnityEditor; -using System.Collections.Generic; - -namespace AmplifyShaderEditor -{ - public enum DebugScreenShotNodeState - { - CreateNode, - FocusOnNode, - TakeScreenshot, - WaitFrame, - DeleteNode - }; - - public enum DebugUndoNodeState - { - CreateNode, - FocusOnNode, - WaitFrameCreate, - DeleteNode, - WaitFrameDelete, - UndoNode, - WaitFrameUndo, - PrepareForNext - }; - - - public class NodeExporterUtils - { - //Auto-Screenshot nodes - private RenderTexture m_screenshotRT; - private Texture2D m_screenshotTex2D; - private List<ContextMenuItem> m_screenshotList = new List<ContextMenuItem>(); - private DebugScreenShotNodeState m_screenShotState; - private bool m_takingShots = false; - - private DebugUndoNodeState m_undoState; - private bool m_testingUndo = false; - - - private AmplifyShaderEditorWindow m_window; - private ParentNode m_node; - - - private string m_pathname; - - public NodeExporterUtils( AmplifyShaderEditorWindow window ) - { - m_window = window; - Undo.undoRedoPerformed += OnUndoRedoPerformed; - } - - public void OnUndoRedoPerformed() - { - if( m_testingUndo && m_undoState == DebugUndoNodeState.WaitFrameUndo ) - { - m_undoState = DebugUndoNodeState.PrepareForNext; - } - } - - public void CalculateShaderInstructions( Shader shader ) - { - //Type shaderutilType = Type.GetType( "UnityEditor.ShaderUtil, UnityEditor" ); - //shaderutilType.InvokeMember( "OpenCompiledShader", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, null, null, new object[] { shader, mode, customPlatformsMask, includeAllVariants } ); - } - - public void ActivateAutoScreenShot( string pathname, int from, int to ) - { - - m_pathname = pathname; - if( !System.IO.Directory.Exists( m_pathname ) ) - { - System.IO.Directory.CreateDirectory( m_pathname ); - } - - m_screenshotRT = new RenderTexture( (int)m_window.position.width, (int)m_window.position.height, 0 ); - m_screenshotTex2D = new Texture2D( (int)m_window.position.width, (int)m_window.position.height, TextureFormat.RGB24, false ); - - RenderTexture.active = m_screenshotRT; - m_window.CurrentPaletteWindow.FillList( ref m_screenshotList, true ); - m_window.CurrentGraph.ClearGraph(); - if( m_window.IsShaderFunctionWindow ) - { - m_window.CurrentGraph.CurrentOutputNode.Vec2Position = new Vector2( 1500, 0 ); - } - else - { - m_window.CurrentGraph.CurrentMasterNode.Vec2Position = new Vector2( 1500, 0 ); - } - m_window.ResetCameraSettings(); - - m_takingShots = true; - m_screenShotState = DebugScreenShotNodeState.CreateNode; - - } - - public void ActivateNodesURL( int from , int to ) - { - m_window.CurrentPaletteWindow.FillList( ref m_screenshotList, true ); - - if( to < 0 || to > m_screenshotList.Count ) - to = m_screenshotList.Count; - - if( from >= to ) - return; - - for( int i = from; i < to; i++ ) - { - if( m_screenshotList[ i ].NodeType != typeof( FunctionNode ) ) - { - Application.OpenURL( m_screenshotList[ i ].NodeAttributes.NodeUrl ); - } - } - } - - public void ActivateAutoUndo() - { - m_window.CurrentPaletteWindow.FillList( ref m_screenshotList, true ); - m_window.CurrentGraph.ClearGraph(); - m_window.CurrentGraph.CurrentMasterNode.Vec2Position = new Vector2( 1500, 0 ); - m_window.ResetCameraSettings(); - - m_testingUndo = true; - m_undoState = DebugUndoNodeState.CreateNode; - } - - - public void Update() - { - if( m_testingUndo ) - { - if( Event.current.type == EventType.Repaint ) - { - m_window.Focus(); - switch( m_undoState ) - { - case DebugUndoNodeState.CreateNode: - { - m_window.CurrentGraph.DeSelectAll(); - m_node = m_window.CreateNode( m_screenshotList[ 0 ].NodeType, Vector2.zero, null, true ); - m_node.RefreshExternalReferences(); - m_undoState = DebugUndoNodeState.FocusOnNode; - Debug.Log( "Created " + m_node.Attributes.Name ); - } - break; - case DebugUndoNodeState.FocusOnNode: - { - m_window.FocusOnPoint( m_node.TruePosition.center, 1, false ); - m_undoState = DebugUndoNodeState.WaitFrameCreate; - Debug.Log( "Focused " + m_node.Attributes.Name ); - } - break; - case DebugUndoNodeState.WaitFrameCreate: - { - m_undoState = DebugUndoNodeState.DeleteNode; - Debug.Log( "Waiting on Create" ); - } - break; - case DebugUndoNodeState.DeleteNode: - { - Debug.Log( "Deleting " + m_node.Attributes.Name ); - m_window.DeleteSelectedNodeWithRepaint(); - m_undoState = DebugUndoNodeState.WaitFrameDelete; - } - break; - case DebugUndoNodeState.WaitFrameDelete: - { - m_undoState = DebugUndoNodeState.UndoNode; - Debug.Log( "Waiting on Delete" ); - } - break; - case DebugUndoNodeState.UndoNode: - { - Debug.Log( "Performing Undo" ); - m_undoState = DebugUndoNodeState.WaitFrameUndo; - Undo.PerformUndo(); - } - break; - case DebugUndoNodeState.WaitFrameUndo: { } break; - case DebugUndoNodeState.PrepareForNext: - { - m_screenshotList.RemoveAt( 0 ); - Debug.Log( "Undo Performed. Nodes Left " + m_screenshotList.Count ); - m_testingUndo = m_screenshotList.Count > 0; - if( m_testingUndo ) - { - m_undoState = DebugUndoNodeState.CreateNode; - Debug.Log( "Going to next node" ); - } - else - { - Debug.Log( "Finished Undo Test" ); - } - } - break; - - } - } - } - - - if( m_takingShots ) - { - m_window.Focus(); - switch( m_screenShotState ) - { - case DebugScreenShotNodeState.CreateNode: - { - m_node = m_window.CreateNode( m_screenshotList[ 0 ].NodeType, Vector2.zero, null, false ); - m_node.RefreshExternalReferences(); - m_screenShotState = DebugScreenShotNodeState.FocusOnNode; - - - } - break; - case DebugScreenShotNodeState.FocusOnNode: - { - //m_window.FocusOnNode( m_node, 1, false ); - m_window.FocusOnPoint( m_node.TruePosition.center, 1, false ); - m_screenShotState = DebugScreenShotNodeState.TakeScreenshot; - } - break; - case DebugScreenShotNodeState.TakeScreenshot: - { - if( m_screenshotRT != null && Event.current.type == EventType.Repaint ) - { - m_screenshotTex2D.ReadPixels( new Rect( 0, 0, m_screenshotRT.width, m_screenshotRT.height ), 0, 0 ); - m_screenshotTex2D.Apply(); - - byte[] bytes = m_screenshotTex2D.EncodeToPNG(); - string pictureFilename = UIUtils.ReplaceInvalidStrings( m_screenshotList[ 0 ].Name ); - pictureFilename = UIUtils.RemoveInvalidCharacters( pictureFilename ); - - System.IO.File.WriteAllBytes( m_pathname + pictureFilename + ".png", bytes ); - m_screenShotState = DebugScreenShotNodeState.WaitFrame; - } - } - break; - case DebugScreenShotNodeState.WaitFrame: { Debug.Log( "Wait Frame" ); m_screenShotState = DebugScreenShotNodeState.DeleteNode; } break; - case DebugScreenShotNodeState.DeleteNode: - { - m_window.DestroyNode( m_node ); - m_screenshotList.RemoveAt( 0 ); - m_takingShots = m_screenshotList.Count > 0; - Debug.Log( "Destroy Node " + m_screenshotList.Count ); - - if( m_takingShots ) - { - m_screenShotState = DebugScreenShotNodeState.CreateNode; - } - else - { - RenderTexture.active = null; - m_screenshotRT.Release(); - UnityEngine.Object.DestroyImmediate( m_screenshotRT ); - m_screenshotRT = null; - UnityEngine.Object.DestroyImmediate( m_screenshotTex2D ); - m_screenshotTex2D = null; - } - } - break; - }; - } - } - - public void Destroy() - { - m_window = null; - if( m_screenshotRT != null ) - { - m_screenshotRT.Release(); - UnityEngine.Object.DestroyImmediate( m_screenshotRT ); - m_screenshotRT = null; - } - - if( m_screenshotTex2D != null ) - { - UnityEngine.Object.DestroyImmediate( m_screenshotTex2D ); - m_screenshotTex2D = null; - } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/NodeExporterUtils.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/NodeExporterUtils.cs.meta deleted file mode 100644 index acdf7593..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/NodeExporterUtils.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: f9b3f6c515f0e16469de89d9e22263c5 -timeCreated: 1486374353 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/Preferences.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/Preferences.cs deleted file mode 100644 index 2688b549..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/Preferences.cs +++ /dev/null @@ -1,135 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEngine; -using UnityEditor; -using System.Collections.Generic; - -namespace AmplifyShaderEditor -{ - public class Preferences - { - public enum ShowOption - { - Always = 0, - OnNewVersion = 1, - Never = 2 - } - - private static readonly GUIContent StartUp = new GUIContent( "Show start screen on Unity launch", "You can set if you want to see the start screen everytime Unity launchs, only just when there's a new version available or never." ); - public static readonly string PrefStartUp = "ASELastSession" + Application.productName; - public static ShowOption GlobalStartUp = ShowOption.Always; - - private static readonly GUIContent AutoSRP = new GUIContent( "Auto import SRP shader templates", "By default Amplify Shader Editor checks for your SRP version and automatically imports the correct corresponding shader templates.\nTurn this OFF if you prefer to import them manually." ); - public static readonly string PrefAutoSRP = "ASEAutoSRP" + Application.productName; - public static bool GlobalAutoSRP = true; - - private static readonly GUIContent UseMacros = new GUIContent( "Use Unity's sampling macros in SRP", "Setting this ON will force the code generation to use Unity's macros when sampling textures in SRP.\nThis macros ensures better compatibility between platforms but makes the code less readable." ); - public static readonly string PrefUseMacros = "ASEUseMacros" + Application.productName; - public static bool GlobalUseMacros = false; - - private static readonly GUIContent DefineSymbol = new GUIContent( "Add Amplify Shader Editor define symbol", "Turning it OFF will disable the automatic insertion of the define symbol and remove it from the list while turning it ON will do the opposite.\nThis is used for compatibility with other plugins, if you are not sure if you need this leave it ON." ); - public static readonly string PrefDefineSymbol = "ASEDefineSymbol" + Application.productName; - public static bool GlobalDefineSymbol = true; - - private static bool PrefsLoaded = false; - -#if UNITY_2019_1_OR_NEWER - [SettingsProvider] - public static SettingsProvider ImpostorsSettings() - { - var provider = new SettingsProvider( "Preferences/Amplify Shader Editor", SettingsScope.User ) - { - guiHandler = ( string searchContext ) => - { - PreferencesGUI(); - }, - - keywords = new HashSet<string>( new[] { "start", "screen", "import", "shader", "templates", "macros", "macros", "define", "symbol" } ), - - }; - return provider; - } -#else - [PreferenceItem( "Amplify Shader Editor" )] -#endif - public static void PreferencesGUI() - { - if( !PrefsLoaded ) - { - LoadDefaults(); - PrefsLoaded = true; - } - - var cache = EditorGUIUtility.labelWidth; - EditorGUIUtility.labelWidth = 250; - EditorGUI.BeginChangeCheck(); - GlobalStartUp = (ShowOption) EditorGUILayout.EnumPopup( StartUp, GlobalStartUp ); - if( EditorGUI.EndChangeCheck() ) - { - EditorPrefs.SetInt( PrefStartUp, (int)GlobalStartUp ); - } - - EditorGUI.BeginChangeCheck(); - GlobalAutoSRP = EditorGUILayout.Toggle( AutoSRP, GlobalAutoSRP ); - if( EditorGUI.EndChangeCheck() ) - { - EditorPrefs.SetBool( PrefAutoSRP, GlobalAutoSRP ); - } - - EditorGUI.BeginChangeCheck(); - GlobalUseMacros = EditorGUILayout.Toggle( UseMacros, GlobalUseMacros ); - if( EditorGUI.EndChangeCheck() ) - { - EditorPrefs.SetBool( PrefUseMacros, GlobalUseMacros ); - if( UIUtils.CurrentWindow != null ) - { - UIUtils.CurrentWindow.CurrentGraph.SamplingThroughMacros = GlobalUseMacros; - } - } - - EditorGUI.BeginChangeCheck(); - GlobalDefineSymbol = EditorGUILayout.Toggle( DefineSymbol, GlobalDefineSymbol ); - if( EditorGUI.EndChangeCheck() ) - { - EditorPrefs.SetBool( PrefDefineSymbol, GlobalDefineSymbol ); - if( GlobalDefineSymbol ) - IOUtils.SetAmplifyDefineSymbolOnBuildTargetGroup( EditorUserBuildSettings.selectedBuildTargetGroup ); - else - IOUtils.RemoveAmplifyDefineSymbolOnBuildTargetGroup( EditorUserBuildSettings.selectedBuildTargetGroup ); - } - - EditorGUILayout.BeginHorizontal(); - GUILayout.FlexibleSpace(); - if( GUILayout.Button( "Reset and Forget All" ) ) - { - EditorPrefs.DeleteKey( PrefStartUp ); - GlobalStartUp = ShowOption.Always; - - EditorPrefs.DeleteKey( PrefAutoSRP ); - GlobalAutoSRP = true; - - EditorPrefs.DeleteKey( PrefUseMacros ); - GlobalUseMacros = false; - if( UIUtils.CurrentWindow != null ) - { - UIUtils.CurrentWindow.CurrentGraph.SamplingThroughMacros = false; - } - - EditorPrefs.DeleteKey( PrefDefineSymbol ); - GlobalDefineSymbol = true; - IOUtils.SetAmplifyDefineSymbolOnBuildTargetGroup( EditorUserBuildSettings.selectedBuildTargetGroup ); - } - EditorGUILayout.EndHorizontal(); - EditorGUIUtility.labelWidth = cache; - } - - public static void LoadDefaults() - { - GlobalStartUp = (ShowOption) EditorPrefs.GetInt( PrefStartUp, 0 ); - GlobalAutoSRP = EditorPrefs.GetBool( PrefAutoSRP, true ); - GlobalUseMacros = EditorPrefs.GetBool( PrefUseMacros, false ); - GlobalDefineSymbol = EditorPrefs.GetBool( PrefDefineSymbol, true ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/Preferences.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/Preferences.cs.meta deleted file mode 100644 index 33cf46b5..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/Preferences.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: d036571a581792b44951e3723aef2c01 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/RectExtension.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/RectExtension.cs deleted file mode 100644 index f803ac20..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/RectExtension.cs +++ /dev/null @@ -1,40 +0,0 @@ -using UnityEngine; - -namespace AmplifyShaderEditor -{ - public static class RectExtension - { - private static Rect ValidateBoundaries( this Rect thisRect ) - { - if ( thisRect.yMin > thisRect.yMax ) - { - float yMin = thisRect.yMin; - thisRect.yMin = thisRect.yMax; - thisRect.yMax = yMin; - } - - if ( thisRect.xMin > thisRect.xMax ) - { - float xMin = thisRect.xMin; - thisRect.xMin = thisRect.xMax; - thisRect.xMax = xMin; - } - return thisRect; - } - - public static bool Includes( this Rect thisRect , Rect other ) - { - thisRect = thisRect.ValidateBoundaries(); - other = other.ValidateBoundaries(); - - if ( other.xMin >= thisRect.xMin && other.xMax <= thisRect.xMax ) - { - if ( other.yMin >= thisRect.yMin && other.yMax <= thisRect.yMax ) - { - return true; - } - } - return false; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/RectExtension.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/RectExtension.cs.meta deleted file mode 100644 index 82258692..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/RectExtension.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: e5a7e5c0308e038448cd1a235bf840ca -timeCreated: 1501521591 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/SamplerStateAutoGenerator.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/SamplerStateAutoGenerator.cs deleted file mode 100644 index 8be253c4..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/SamplerStateAutoGenerator.cs +++ /dev/null @@ -1,203 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using System.Collections.Generic; -using UnityEngine; -using UnityEditor; - -namespace AmplifyShaderEditor -{ - public enum InlineSamplerFilteringMode - { - Point, - Linear, - Trilinear - }; - - public enum InlineSamplerWrapMode - { - Clamp, - Repeat, - Mirror, - MirrorOnce - }; - - public enum InlineSamplerWrapCoordinates - { - All, - U, - V, - W - }; - - [Serializable] - public class InlineSamplerWrapOptions - { - public InlineSamplerWrapMode WrapMode = InlineSamplerWrapMode.Clamp; - public InlineSamplerWrapCoordinates Coordinates = InlineSamplerWrapCoordinates.All; - public string InlineValue - { - get - { - string name = "_"+WrapMode.ToString(); - if( Coordinates != InlineSamplerWrapCoordinates.All ) - name += Coordinates.ToString(); - name += "_"; - return name; - } - } - } - - [Serializable] - public class SamplerStateAutoGenerator - { - private const int MaxCount = 3; - private const float ButtonLayoutWidth = 15; - private const string AdditionalWrapsStr = "Additional Wraps"; - private const string InlineSamplerStateStr = "Inline Sampler State"; - - [SerializeField] - private InlineSamplerFilteringMode m_filterMode = InlineSamplerFilteringMode.Point; - - [SerializeField] - private InlineSamplerWrapOptions m_mainWrapMode = new InlineSamplerWrapOptions(); - - [SerializeField] - private List<InlineSamplerWrapOptions> m_additionalWrapOptions = new List<InlineSamplerWrapOptions>(); - - [SerializeField] - private bool m_visibleWrapsFoldout = false; - - [SerializeField] - private bool m_visibleMainFoldout = false; - - [NonSerialized] - private UndoParentNode m_owner; - - public void Destroy() - { - m_mainWrapMode = null; - m_additionalWrapOptions.Clear(); - m_additionalWrapOptions = null; - } - - public string AddToDataCollector( ref MasterNodeDataCollector dataCollector ) - { - string inlineSampler = "sampler_"; - - inlineSampler += m_filterMode.ToString(); - inlineSampler += m_mainWrapMode.InlineValue; - - int count = m_additionalWrapOptions.Count; - for( int i = 0; i < count; i++ ) - { - inlineSampler += m_additionalWrapOptions[ i ].InlineValue; - } - return inlineSampler; - } - - void DrawAddRemoveButtons() - { - int count = m_additionalWrapOptions.Count; - if( count < MaxCount && m_owner.GUILayoutButton( string.Empty, UIUtils.PlusStyle, GUILayout.Width( ButtonLayoutWidth ) ) ) - { - m_additionalWrapOptions.Add( new InlineSamplerWrapOptions() ); - EditorGUI.FocusTextInControl( null ); - } - - if( count > 0 && m_owner.GUILayoutButton( string.Empty, UIUtils.MinusStyle, GUILayout.Width( ButtonLayoutWidth ) ) ) - { - m_additionalWrapOptions.RemoveAt( count - 1 ); - EditorGUI.FocusTextInControl( null ); - } - } - - public void Draw( UndoParentNode owner ) - { - m_owner = owner; - NodeUtils.DrawNestedPropertyGroup( ref m_visibleMainFoldout, InlineSamplerStateStr, DrawMain ); - } - - void DrawMain() - { - m_filterMode = (InlineSamplerFilteringMode)m_owner.EditorGUILayoutEnumPopup( m_filterMode ); - - EditorGUILayout.BeginHorizontal(); - m_mainWrapMode.WrapMode = (InlineSamplerWrapMode)m_owner.EditorGUILayoutEnumPopup( m_mainWrapMode.WrapMode ); - m_mainWrapMode.Coordinates = (InlineSamplerWrapCoordinates)m_owner.EditorGUILayoutEnumPopup( m_mainWrapMode.Coordinates ); - EditorGUILayout.EndHorizontal(); - NodeUtils.DrawNestedPropertyGroup( ref m_visibleWrapsFoldout, AdditionalWrapsStr, DrawAdditionalWrapModes, DrawAddRemoveButtons ); - } - - void DrawAdditionalWrapModes() - { - EditorGUILayout.Space(); - int count = m_additionalWrapOptions.Count; - for( int i = 0; i < count; i++ ) - { - float maxWidth = 90; - EditorGUILayout.BeginHorizontal(); - m_additionalWrapOptions[ i ].WrapMode = (InlineSamplerWrapMode)m_owner.EditorGUILayoutEnumPopup( m_additionalWrapOptions[ i ].WrapMode ,GUILayout.MaxWidth( maxWidth ) ); - m_additionalWrapOptions[ i ].Coordinates = (InlineSamplerWrapCoordinates)m_owner.EditorGUILayoutEnumPopup( m_additionalWrapOptions[ i ].Coordinates, GUILayout.MaxWidth( maxWidth ) ); - EditorGUILayout.EndHorizontal(); - } - } - - public void ReadFromString( ref uint index, ref string[] nodeParams ) - { -#if UNITY_2019_3_OR_NEWER - Enum.TryParse<InlineSamplerFilteringMode>( nodeParams[ index++ ], out m_filterMode ); - Enum.TryParse<InlineSamplerWrapCoordinates>( nodeParams[ index++ ], out m_mainWrapMode.Coordinates ); - - int count = 0; - int.TryParse( nodeParams[ index++ ], out count ); - for( int i = 0; i < count; i++ ) - { - InlineSamplerWrapOptions option = new InlineSamplerWrapOptions(); - - Enum.TryParse<InlineSamplerWrapMode>( nodeParams[ index++ ], out option.WrapMode ); - Enum.TryParse<InlineSamplerWrapCoordinates>( nodeParams[ index++ ], out option.Coordinates ); - - m_additionalWrapOptions.Add( option ); - } -#else - m_filterMode =(InlineSamplerFilteringMode) Enum.Parse( typeof( InlineSamplerFilteringMode ), nodeParams[ index++ ] ); - m_mainWrapMode.Coordinates = (InlineSamplerWrapCoordinates)Enum.Parse( typeof( InlineSamplerWrapCoordinates ),nodeParams[ index++ ] ); - - int count = 0; - int.TryParse( nodeParams[ index++ ], out count ); - for( int i = 0; i < count; i++ ) - { - InlineSamplerWrapOptions option = new InlineSamplerWrapOptions(); - - option.WrapMode = ( InlineSamplerWrapMode)Enum.Parse(typeof( InlineSamplerWrapMode ), nodeParams[ index++ ] ); - option.Coordinates = ( InlineSamplerWrapCoordinates)Enum.Parse(typeof( InlineSamplerWrapCoordinates ), nodeParams[ index++ ] ); - - m_additionalWrapOptions.Add( option ); - } -#endif - - } - - public void WriteToString( ref string nodeInfo ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_filterMode ); - - IOUtils.AddFieldValueToString( ref nodeInfo, m_mainWrapMode.WrapMode ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_mainWrapMode.Coordinates ); - - int count = m_additionalWrapOptions.Count; - IOUtils.AddFieldValueToString( ref nodeInfo, count ); - if( count > 0 ) - { - for( int i = 0; i < count; i++ ) - { - IOUtils.AddFieldValueToString( ref nodeInfo, m_additionalWrapOptions[i].WrapMode ); - IOUtils.AddFieldValueToString( ref nodeInfo, m_additionalWrapOptions[i].Coordinates ); - } - } - - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/SamplerStateAutoGenerator.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/SamplerStateAutoGenerator.cs.meta deleted file mode 100644 index 896ea53e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/SamplerStateAutoGenerator.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: fe831fe9de481bc4b9df1c1142bb9aa5 -timeCreated: 1580322794 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/ShortcutsManager.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/ShortcutsManager.cs deleted file mode 100644 index 3e48aa82..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/ShortcutsManager.cs +++ /dev/null @@ -1,215 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEngine; -using System.Collections.Generic; - -namespace AmplifyShaderEditor -{ - public class ShortcutItem - { - public delegate void ShortcutFunction(); - public ShortcutFunction MyKeyDownFunctionPtr; - public ShortcutFunction MyKeyUpFunctionPtr; - public string Name; - public string Description; - - public ShortcutItem( string name, string description ) - { - Name = name; - Description = description; - } - - public ShortcutItem( string name, string description, ShortcutFunction myKeyDownFunctionPtr, ShortcutFunction myKeyUpFunctionPtr = null ) - { - Name = name; - Description = description; - MyKeyDownFunctionPtr = myKeyDownFunctionPtr; - MyKeyUpFunctionPtr = myKeyUpFunctionPtr; - } - - public void Destroy() - { - MyKeyDownFunctionPtr = null; - MyKeyUpFunctionPtr = null; - } - } - - public class ShortcutsManager - { - public static readonly KeyCode ScrollUpKey = KeyCode.PageUp; - public static readonly KeyCode ScrollDownKey = KeyCode.PageDown; - - - private const string ItemWikiFormat = "*<b>[{0}]:</b> {1}\n"; - private Dictionary<KeyCode, Dictionary<EventModifiers, ShortcutItem>> m_editorShortcutsDict = new Dictionary<KeyCode, Dictionary<EventModifiers, ShortcutItem>>(); - private Dictionary<KeyCode, ShortcutItem> m_editorNoModifiersShortcutsDict = new Dictionary<KeyCode, ShortcutItem>(); - private List<ShortcutItem> m_editorShortcutsList = new List<ShortcutItem>(); - - private Dictionary<KeyCode, ShortcutItem> m_nodesShortcutsDict = new Dictionary<KeyCode, ShortcutItem>(); - private List<ShortcutItem> m_nodesShortcutsList = new List<ShortcutItem>(); - - public void DumpShortcutsToDisk( string pathname ) - { - if ( !System.IO.Directory.Exists( pathname ) ) - { - System.IO.Directory.CreateDirectory( pathname ); - } - - string list = "=== Full Shortcut List ===\n"; - list += "==== Editor ====\n"; - for ( int i = 0; i < m_editorShortcutsList.Count; i++ ) - { - list += string.Format( ItemWikiFormat, m_editorShortcutsList[ i ].Name, m_editorShortcutsList[ i ].Description ); - } - list += "\n"; - list += "==== Nodes ====\n"; - for ( int i = 0; i < m_nodesShortcutsList.Count; i++ ) - { - list += string.Format( ItemWikiFormat, m_nodesShortcutsList[ i ].Name, m_nodesShortcutsList[ i ].Description ); - } - - string shortcutsPathnames = pathname + "KeyboardShortcuts.txt"; - Debug.Log( " Creating shortcuts file at " + shortcutsPathnames ); - IOUtils.SaveTextfileToDisk( list, shortcutsPathnames, false ); - } - - public void RegisterNodesShortcuts( KeyCode key, string nodeName ) - { - if ( m_nodesShortcutsDict.ContainsKey( key ) ) - { - if ( DebugConsoleWindow.DeveloperMode ) - { - Debug.Log( "Attempting to register an already used node shortcut key " + key ); - } - return; - } - m_nodesShortcutsDict.Add( key, new ShortcutItem( key.ToString(), nodeName ) ); - m_nodesShortcutsList.Add( m_nodesShortcutsDict[ key ] ); - } - - public void RegisterEditorShortcut( bool showOnList, EventModifiers modifiers, KeyCode key, string description, ShortcutItem.ShortcutFunction myKeyDownFunctionPtr, ShortcutItem.ShortcutFunction myKeyUpFunctionPtr = null ) - { - if ( m_editorShortcutsDict.ContainsKey( key ) ) - { - if ( m_editorShortcutsDict[ key ].ContainsKey( modifiers ) ) - { - if ( DebugConsoleWindow.DeveloperMode ) - { - Debug.Log( "Attempting to register an already used editor shortcut key " + key ); - } - return; - } - } - else - { - m_editorShortcutsDict.Add( key, new Dictionary<EventModifiers, ShortcutItem>() ); - } - ShortcutItem item = new ShortcutItem( ( ( modifiers == EventModifiers.None || modifiers == EventModifiers.FunctionKey ) ? key.ToString() : modifiers + " + " + key ), description, myKeyDownFunctionPtr, myKeyUpFunctionPtr ); - m_editorShortcutsDict[ key ].Add( modifiers, item ); - if ( showOnList ) - m_editorShortcutsList.Add( item ); - } - - public void RegisterEditorShortcut( bool showOnList, KeyCode key, string description, ShortcutItem.ShortcutFunction myKeyDownFunctionPtr, ShortcutItem.ShortcutFunction myKeyUpFunctionPtr = null ) - { - if ( m_editorNoModifiersShortcutsDict.ContainsKey( key ) ) - { - if ( DebugConsoleWindow.DeveloperMode ) - { - Debug.Log( "Attempting to register an already used editor shortcut key " + key ); - } - return; - } - - ShortcutItem item = new ShortcutItem( key.ToString(), description, myKeyDownFunctionPtr, myKeyUpFunctionPtr ); - m_editorNoModifiersShortcutsDict.Add( key, item ); - if ( showOnList ) - m_editorShortcutsList.Add( item ); - } - - public bool ActivateShortcut( EventModifiers modifiers, KeyCode key, bool isKeyDown ) - { - if ( m_editorShortcutsDict.ContainsKey( key ) ) - { - if ( isKeyDown ) - { - if ( m_editorShortcutsDict[ key ].ContainsKey( modifiers ) ) - { - if ( m_editorShortcutsDict[ key ][ modifiers ].MyKeyDownFunctionPtr != null ) - { - m_editorShortcutsDict[ key ][ modifiers ].MyKeyDownFunctionPtr(); - return true; - } - } - } - else - { - if ( m_editorShortcutsDict[ key ].ContainsKey( modifiers ) ) - { - if ( m_editorShortcutsDict[ key ][ modifiers ].MyKeyUpFunctionPtr != null ) - { - m_editorShortcutsDict[ key ][ modifiers ].MyKeyUpFunctionPtr(); - return true; - } - } - } - } - - if ( modifiers == EventModifiers.None && m_editorNoModifiersShortcutsDict.ContainsKey( key ) ) - { - if ( isKeyDown ) - { - if ( m_editorNoModifiersShortcutsDict[ key ].MyKeyDownFunctionPtr != null ) - { - m_editorNoModifiersShortcutsDict[ key ].MyKeyDownFunctionPtr(); - return true; - } - } - else - { - if ( m_editorNoModifiersShortcutsDict[ key ].MyKeyUpFunctionPtr != null ) - { - m_editorNoModifiersShortcutsDict[ key ].MyKeyUpFunctionPtr(); - return true; - } - } - } - - return false; - } - - public void Destroy() - { - foreach ( KeyValuePair<KeyCode, ShortcutItem> kvp in m_editorNoModifiersShortcutsDict ) - { - kvp.Value.Destroy(); - } - m_editorNoModifiersShortcutsDict.Clear(); - m_editorNoModifiersShortcutsDict = null; - - foreach ( KeyValuePair<KeyCode, Dictionary<EventModifiers, ShortcutItem>> kvpKey in m_editorShortcutsDict ) - { - foreach ( KeyValuePair<EventModifiers, ShortcutItem> kvpMod in kvpKey.Value ) - { - kvpMod.Value.Destroy(); - } - kvpKey.Value.Clear(); - } - m_editorShortcutsDict.Clear(); - m_editorShortcutsDict = null; - - m_editorShortcutsList.Clear(); - m_editorShortcutsList = null; - - m_nodesShortcutsDict.Clear(); - m_nodesShortcutsDict = null; - - m_nodesShortcutsList.Clear(); - m_nodesShortcutsList = null; - } - - public List<ShortcutItem> AvailableEditorShortcutsList { get { return m_editorShortcutsList; } } - public List<ShortcutItem> AvailableNodesShortcutsList { get { return m_nodesShortcutsList; } } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/ShortcutsManager.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/ShortcutsManager.cs.meta deleted file mode 100644 index d08579e5..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/ShortcutsManager.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 15917e71489c3ca4dbc5fdef9bb37433 -timeCreated: 1487952057 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/TipsWindow.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/TipsWindow.cs deleted file mode 100644 index 1d888355..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/TipsWindow.cs +++ /dev/null @@ -1,148 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System.IO; -using System.Reflection; -using System; -using System.Collections.Generic; -using UnityEngine; -using UnityEditor; - -namespace AmplifyShaderEditor -{ - [Serializable] - public class TipsWindow : MenuParent - { - private static bool m_showWindow = false; - private bool m_dontShowAtStart = false; - - private static List<string> AllTips = new List<string>() { - "You can press W to toggle between a flat and color coded Wires and ports.", - "You can press CTRL+W to toggle between multiline or singleline Wire connections.", - "You can press P to globally open all node Previews.", - "You can press F to Focus your selection, single tap centers the selection while double tap it to also zooms on in.", - "You can press CTRL+F to open a search bar and Find a node by it's title", - "You can press SPACE to open a context menu to add a new node and press TAB or SHIFT+TAB tocycle between the found nodes", - "You can remove a node without breaking the graph connections by pressing ALT and then dragging the node out", - "You can switch two input connections holding CTRL while dragging one input connection into the other", - }; - - int m_currentTip = 0; - - public TipsWindow( AmplifyShaderEditorWindow parentWindow ) : base( parentWindow, 0, 0, 0, 64, "Tips", MenuAnchor.TOP_LEFT, MenuAutoSize.NONE ) - { - //m_dontShowAtStart = EditorPrefs.GetBool( "DontShowTipAtStart", false ); - } - - public override void Draw( Rect parentPosition, Vector2 mousePosition, int mouseButtonId, bool hasKeyboadFocus ) - { - base.Draw( parentPosition, mousePosition, mouseButtonId, hasKeyboadFocus ); - - DrawWindow( mousePosition ); - } - - public void DrawWindow( Vector2 mousePosition ) - { - if( !m_showWindow ) - return; - - Rect windowRect = new Rect( 0, 0, Screen.width, Screen.height ); - Vector2 center = windowRect.center; - windowRect.size = new Vector2( 300, 200 ); - windowRect.center = center; - Color temp = GUI.color; - GUI.color = Color.white; - GUI.Label( windowRect, string.Empty, GUI.skin.FindStyle( "flow node 0" ) ); - - if( Event.current.type == EventType.MouseDown && !windowRect.Contains( mousePosition ) ) - m_showWindow = false; - - Rect titleRect = windowRect; - titleRect.height = 35; - GUI.Label( titleRect, "Quick Tip!", GUI.skin.FindStyle( "TL Selection H2" ) ); - Rect button = titleRect; - button.size = new Vector2( 14, 14 ); - button.y += 2; - button.x = titleRect.xMax - 16; - if( GUI.Button( button, string.Empty, GUI.skin.FindStyle( "WinBtnClose" ) ) ) - CloseWindow(); - - button.y += 100; - if( GUI.Button( button, ">" ) ) - { - m_currentTip++; - if( m_currentTip >= AllTips.Count ) - m_currentTip = 0; - } - - Rect textRect = windowRect; - textRect.yMin = titleRect.yMax; - GUI.Label( textRect, AllTips[ m_currentTip ], GUI.skin.FindStyle( "WordWrappedLabel" ) ); - - Rect footerRect = windowRect; - footerRect.yMin = footerRect.yMax - 18; - footerRect.x += 3; - GUI.Label( footerRect, (m_currentTip + 1) + " of " + AllTips.Count + " tips" ); - footerRect.x += 170; - EditorGUI.BeginChangeCheck(); - m_dontShowAtStart = GUI.Toggle( footerRect, m_dontShowAtStart, "Don't show at start" ); - if( EditorGUI.EndChangeCheck() ) - { - EditorPrefs.SetBool( "DontShowTipAtStart", m_dontShowAtStart ); - } - GUI.color = temp; - - if( Event.current.type == EventType.MouseDown && windowRect.Contains( mousePosition ) ) - { - Event.current.Use(); - ParentWindow.MouseInteracted = true; - } - } - - public override void Destroy() - { - base.Destroy(); - } - - public static void ShowWindow( bool toggle = true ) - { - if( toggle ) - m_showWindow = !m_showWindow; - else - m_showWindow = true; - - //Test(); - //ExportCompiledShaders(); - } - - //public static void Test() - //{ - // Shader shader = UIUtils.CurrentWindow.CurrentGraph.CurrentShader; - // int mode = EditorPrefs.GetInt( "ShaderInspectorPlatformMode", 1 ); - // int mask = EditorPrefs.GetInt( "ShaderInspectorPlatformMask", 524287 ); - // bool strip = EditorPrefs.GetInt( "ShaderInspectorVariantStripping", 1 ) == 0; - // ShaderUtilEx.OpenCompiledShader( shader, mode, mask, strip ); - //} - - //public static void ExportCompiledShaders() - //{ - // Shader shader = UIUtils.CurrentWindow.CurrentGraph.CurrentShader; - // string shaderPath = AssetDatabase.GetAssetPath( shader ); - // SerializedObject so = new SerializedObject( shader ); - // SerializedProperty prop = so.FindProperty( "m_Script" ); - // var compiledShaderString = prop.stringValue; - // Directory.CreateDirectory( Application.dataPath + "/../ShaderSource/" ); - // if( compiledShaderString == null ) - // return; - // var outputPath = Application.dataPath + "/../ShaderSource/" + Path.GetFileNameWithoutExtension( shaderPath ) + "_compiled.shader"; - // var sw = File.CreateText( outputPath ); - // sw.Write( compiledShaderString ); - // sw.Close(); - //} - - public static void CloseWindow() - { - m_showWindow = false; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/TipsWindow.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/TipsWindow.cs.meta deleted file mode 100644 index 3d598296..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/TipsWindow.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 565dc3c9725b0db49b7d5ea17d151682 -timeCreated: 1504704078 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/UIUtils.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/UIUtils.cs deleted file mode 100644 index a525fd7c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/UIUtils.cs +++ /dev/null @@ -1,2839 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEngine; -using UnityEditor; -using System.Collections.Generic; -using System.IO; - -using System.Globalization; -using System.Text.RegularExpressions; - -namespace AmplifyShaderEditor -{ - public enum ASEColorSpace - { - Auto, - Gamma, - Linear - } - - public enum SurfaceInputs - { - DEPTH = 0, - UV_COORDS, - UV2_COORDS, - VIEW_DIR, - COLOR, - SCREEN_POS, - WORLD_POS, - WORLD_REFL, - WORLD_NORMAL, - VFACE, - INTERNALDATA - } - - public enum CustomStyle - { - NodeWindowOff = 0, - NodeWindowOn, - NodeTitle, - NodeHeader, - CommentaryHeader, - ShaderLibraryTitle, - ShaderLibraryAddToList, - ShaderLibraryRemoveFromList, - ShaderLibraryOpenListed, - ShaderLibrarySelectionAsTemplate, - ShaderLibraryItem, - CommentaryTitle, - PortEmptyIcon, - PortFullIcon, - InputPortlabel, - OutputPortLabel, - CommentaryResizeButton, - CommentaryResizeButtonInv, - CommentaryBackground, - MinimizeButton, - MaximizeButton, - NodePropertiesTitle, - ShaderModeTitle, - MaterialModeTitle, - ShaderNoMaterialModeTitle, - PropertyValuesTitle, - ShaderModeNoShader, - MainCanvasTitle, - ShaderBorder, - MaterialBorder, - SamplerTextureRef, - SamplerTextureIcon, - CustomExpressionAddItem, - CustomExpressionRemoveItem, - CustomExpressionSmallAddItem, - CustomExpressionSmallRemoveItem, - ResetToDefaultInspectorButton, - SliderStyle, - ObjectPicker, - NodePropertyPicker, - NodePreviewExpander, - NodePreviewCollapser, - SamplerButton, - SamplerFrame, - CommentarySuperTitle, - MiniButtonTopLeft, - MiniButtonTopMid, - MiniButtonTopRight, - ShaderFunctionBorder, - ShaderFunctionMode, - RightShaderMode, - FlatBackground, - DocumentationLink, - GraphButtonIcon, - GraphButton, - NodeWindowOffSquare, - NodeHeaderSquare, - NodeWindowOnSquare, - ConsoleLogMessage, - ConsoleLogCircle - } - - public enum MasterNodePortCategory - { - Vertex = 1 << 0, - Fragment = 1 << 1, - Tessellation = 1 << 2, - Debug = 1 << 3 - } - - public enum PortGenType - { - NonCustomLighting, - //Normal = 1 << 1, - //Emission = 1 << 2, - //Metallic = 1 << 3, - //Specular = 1 << 4, - CustomLighting - } - - public struct NodeData - { - public MasterNodePortCategory Category; - public int OrderIndex; - public int GraphDepth; - public NodeData( MasterNodePortCategory category ) - { - Category = category; - OrderIndex = 0; - GraphDepth = -1; - } - } - - public struct NodeCastInfo - { - public int NodeId; - public int PortId; - public NodeCastInfo( int nodeId, int portId ) - { - NodeId = nodeId; - PortId = portId; - } - public override string ToString() - { - return NodeId.ToString() + PortId.ToString(); - } - }; - - public struct ButtonClickId - { - public const int LeftMouseButton = 0; - public const int RightMouseButton = 1; - public const int MiddleMouseButton = 2; - } - - public enum ASESelectionMode - { - Shader = 0, - Material, - ShaderFunction - } - - public enum DrawOrder - { - Background, - Default - } - - public enum NodeConnectionStatus - { - Not_Connected = 0, - Connected, - Error, - Island - } - - public enum InteractionMode - { - Target, - Other, - Both - } - - public enum FunctionNodeCategories - { - Custom, - CameraAndScreen, - ConstantsAndProperties, - Functions, - ImageEffects, - Light, - LogicalOperators, - MathOperators, - MatrixOperators, - Miscellaneous, - ObjectTransform, - SurfaceData, - Textures, - Time, - TrigonometryOperators, - UVCoordinates, - VectorOperators, - VertexData - } - - public enum TransformSpaceFrom - { - Object = 0, - World, - View, - Tangent - } - - public enum TransformSpaceTo - { - Object = 0, - World, - View, - Tangent, - Clip - } - - public class UIUtils - { - public static string NewTemplateGUID; - public static int SerializeHelperCounter = 0; - public static bool IgnoreDeselectAll = false; - - public static bool DirtyMask = true; - public static bool Initialized = false; - public static float HeaderMaxHeight; - public static float CurrentHeaderHeight; - public static GUISkin MainSkin = null; - public static GUIStyle PlusStyle; - public static GUIStyle MinusStyle; - public static GUIStyle RangedFloatSliderStyle; - public static GUIStyle RangedFloatSliderThumbStyle; - public static GUIStyle SwitchNodePopUp; - public static GUIStyle PropertyPopUp; - public static GUIStyle ObjectField; - public static GUIStyle PreviewExpander; - public static GUIStyle PreviewCollapser; - public static GUIStyle ObjectFieldThumb; - public static GUIStyle ObjectFieldThumbOverlay; - public static GUIStyle InspectorPopdropdownStyle; - public static GUIStyle InspectorPopdropdownFallback; - public static GUIStyle BoldErrorStyle; - public static GUIStyle BoldWarningStyle; - public static GUIStyle BoldInfoStyle; - public static GUIStyle Separator; - public static GUIStyle ToolbarMainTitle; - public static GUIStyle ToolbarSearchTextfield; - public static GUIStyle ToolbarSearchCancelButton; - public static GUIStyle MiniButtonTopLeft; - public static GUIStyle MiniButtonTopMid; - public static GUIStyle MiniButtonTopRight; - - public static GUIStyle CommentaryTitle; - public static GUIStyle InputPortLabel; - public static GUIStyle OutputPortLabel; - - public static GUIStyle MiniObjectFieldThumbOverlay; - public static GUIStyle MiniSamplerButton; - - public static GUIStyle NodeWindowOffSquare; - public static GUIStyle NodeHeaderSquare; - public static GUIStyle NodeWindowOnSquare; - public static GUIStyle InternalDataOnPort; - public static GUIStyle InternalDataBackground; - - public static GUIStyle GraphButtonIcon; - public static GUIStyle GraphButton; - public static GUIStyle GraphDropDown; - - public static GUIStyle EmptyStyle = new GUIStyle(); - - public static GUIStyle ConsoleLogLabel; - public static GUIStyle ConsoleLogMessage; - public static GUIStyle ConsoleLogCircle; - - public static GUIStyle TooltipBox; - public static GUIStyle Box; - public static GUIStyle Button; - public static GUIStyle TextArea; - public static GUIStyle Label; - public static GUIStyle Toggle; - public static GUIStyle Textfield; - - public static GUIStyle UnZoomedNodeTitleStyle; - public static GUIStyle UnZoomedPropertyValuesTitleStyle; - public static GUIStyle UnZoomedInputPortStyle; - public static GUIStyle UnZoomedOutputPortPortStyle; - - // Node Property Menu items - public static GUIStyle MenuItemToggleStyle; - public static GUIStyle MenuItemEnableStyle; - public static GUIStyle MenuItemBackgroundStyle; - public static GUIStyle MenuItemToolbarStyle; - public static GUIStyle MenuItemInspectorDropdownStyle; - - public static GUIStyle FloatIntPickerONOFF; - - public static bool UsingProSkin = false; - - public static Texture ShaderIcon { get { return EditorGUIUtility.IconContent( "Shader Icon" ).image; } } - public static Texture MaterialIcon { get { return EditorGUIUtility.IconContent( "Material Icon" ).image; } } - - //50be8291f9514914aa55c66c49da67cf - public static Texture ShaderFunctionIcon { get { return AssetDatabase.LoadAssetAtPath<Texture>( AssetDatabase.GUIDToAssetPath( "50be8291f9514914aa55c66c49da67cf" ) ); } } - - public static Texture2D WireNodeSelection = null; - public static Texture2D SliderButton = null; - - public static Texture2D SmallErrorIcon = null; - public static Texture2D SmallWarningIcon = null; - public static Texture2D SmallInfoIcon = null; - - public static Texture2D CheckmarkIcon = null; - public static Texture2D PopupIcon = null; - - public static Texture2D MasterNodeOnTexture = null; - public static Texture2D MasterNodeOffTexture = null; - - public static Texture2D GPUInstancedOnTexture = null; - public static Texture2D GPUInstancedOffTexture = null; - - public static GUIContent LockIconOpen = null; - public static GUIContent LockIconClosed = null; - - public static GUIContent FloatIntIconON = null; - public static GUIContent FloatIntIconOFF = null; - - public static bool ShowContextOnPick = true; - - private static AmplifyShaderEditorWindow m_currentWindow = null; - public static AmplifyShaderEditorWindow CurrentWindow - { - get - { - if( m_currentWindow == null ) - { - for( int i = 0; i < IOUtils.AllOpenedWindows.Count; i++ ) - { - if( IOUtils.AllOpenedWindows[ i ] != null ) - { - m_currentWindow = IOUtils.AllOpenedWindows[ i ]; - } - else - { - //Debug.Log("No Window Found!"); - } - } - } - return m_currentWindow; - } - set { m_currentWindow = value; } - } - - public static Vector2 PortsSize; - public static Vector3 PortsDelta; - public static Vector3 ScaledPortsDelta; - - public static RectOffset RectOffsetZero; - public static RectOffset RectOffsetOne; - public static RectOffset RectOffsetTwo; - public static RectOffset RectOffsetThree; - public static RectOffset RectOffsetFour; - public static RectOffset RectOffsetFive; - public static RectOffset RectOffsetSix; - - public static Material LinearMaterial = null; - public static Shader IntShader = null; - public static Shader FloatShader = null; - public static Shader Vector2Shader = null; - public static Shader Vector3Shader = null; - public static Shader Vector4Shader = null; - public static Shader ColorShader = null; - public static Shader Texture2DShader = null; - public static Shader MaskingShader = null; - - public static bool InhibitMessages = false; - - - private static int m_shaderIndentLevel = 0; - private static string m_shaderIndentTabs = string.Empty; - - //Label Vars - - private static TextAnchor m_alignment; - private static TextClipping m_clipping; - private static bool m_wordWrap; - private static int m_fontSize; - private static Color m_fontColor; - private static FontStyle m_fontStyle; - - - private static string NumericNamePattern = @"^\d"; - private static System.Globalization.TextInfo m_textInfo; - private static string m_latestOpenedFolder = string.Empty; - private static Dictionary<int, UndoParentNode> m_undoHelper = new Dictionary<int, UndoParentNode>(); - - private static Dictionary<string, int> AvailableKeywordsDict = new Dictionary<string, int>(); - public static readonly string[] AvailableKeywords = - { - "Custom", - "ETC1_EXTERNAL_ALPHA", - "PIXELSNAP_ON", - "UNITY_PASS_FORWARDBASE", - "UNITY_PASS_FORWARDADD", - "UNITY_PASS_DEFERRED", - "UNITY_PASS_SHADOWCASTER", - "UNITY_INSTANCING_ENABLED", - "DIRECTIONAL_COOKIE" - - }; - - public static readonly string[] CategoryPresets = - { - "<Custom>", - "Camera And Screen", - "Constants And Properties", - "Functions", - "Image Effects", - "Light", - "Logical Operators", - "Math Operators", - "Matrix Operators", - "Miscellaneous", - "Object Transform", - "Surface Data", - "Textures", - "Time", - "Trigonometry Operators", - "UV Coordinates", - "Vector Operators", - "Vertex Data" - }; - - private static Dictionary<MasterNodePortCategory, int> m_portCategoryToArrayIdx = new Dictionary<MasterNodePortCategory, int> - { - { MasterNodePortCategory.Vertex,0}, - { MasterNodePortCategory.Tessellation,0}, - { MasterNodePortCategory.Fragment,1}, - { MasterNodePortCategory.Debug,1} - }; - - private static Dictionary<string, string> m_reservedPropertyNames = new Dictionary<string, string> - { - { "UNITY_MATRIX_MVP", string.Empty}, - { "UNITY_MATRIX_MV", string.Empty}, - { "UNITY_MATRIX_V", string.Empty}, - { "UNITY_MATRIX_P", string.Empty}, - { "UNITY_MATRIX_VP", string.Empty}, - { "UNITY_MATRIX_T_MV", string.Empty}, - { "UNITY_MATRIX_IT_MV", string.Empty}, - { "UNITY_MATRIX_TEXTURE0", string.Empty}, - { "UNITY_MATRIX_TEXTURE1", string.Empty}, - { "UNITY_MATRIX_TEXTURE2", string.Empty}, - { "UNITY_MATRIX_TEXTURE3", string.Empty}, - { "_Object2World", string.Empty}, - { "_WorldSpaceCameraPos", string.Empty}, - { "unity_Scale", string.Empty}, - { "_ModelLightColor", string.Empty}, - { "_SpecularLightColor", string.Empty}, - { "_ObjectSpaceLightPos", string.Empty}, - { "_Light2World", string.Empty}, - { "_World2Light", string.Empty}, - { "_Object2Light", string.Empty}, - { "_Time", string.Empty}, - { "_SinTime", string.Empty}, - { "_CosTime", string.Empty}, - { "unity_DeltaTime", string.Empty}, - { "_ProjectionParams", string.Empty}, - { "_ScreenParams", string.Empty} - }; - - private static Dictionary<string, string> m_exampleMaterialIDs = new Dictionary<string, string>() - { - //Community - {"2Sided", "8ebbbf2c99a544ca780a2573ef1450fc" }, - {"DissolveBurn", "f144f2d7ff3daf349a2b7f0fd81ec8ac" }, - {"MourEnvironmentGradient", "b64adae401bc073408ac7bff0993c107" }, - {"ForceShield", "0119aa6226e2a4cfdb6c9a5ba9df7820" }, - {"HighlightAnimated", "3d232e7526f6e426cab994cbec1fc287" }, - {"Hologram", "b422c600f1c3941b8bc7e95db33476ad" }, - {"LowPolyWater", "0557703d3791a4286a62f8ee709d5bef"}, - //Official - {"AnimatedFire", "63ea5eae6d954a14292033589d0d4275" }, - {"AnimatedFire-ShaderFunction", "9c6c9fcb82afe874a825a9e680e694b2" }, - {"BurnEffect", "0b019675a8064414b97862a02f644166" }, - {"CubemapReflections", "2c299f827334e9c459a60931aea62260" }, - {"DitheringFade", "610507217b7dcad4d97e6e03e9844171" }, - {"DoubleLayerCustomSurface", "846aec4914103104d99e9e31a217b548" }, - {"NormalExtrusion", "70a5800fbba039f46b438a2055bc6c71" }, - {"MatcapSample", "da8aaaf01fe8f2b46b2fbcb803bd7af4" }, - {"ParallaxMappingIterations", "a0cea9c3f318ac74d89cd09134aad000" }, - {"SandPOM", "905481dc696211145b88dc4bac2545f3" }, - {"ParallaxWindow", "63ad0e7afb1717b4e95adda8904ab0c3" }, - {"LocalPosCutoff", "fed8c9d33a691084c801573feeed5a62" }, - {"ImprovedReadFromAtlasTiled", "941b31b251ea8e74f9198d788a604c9b" }, - {"ReadFromAtlasTiled", "2d5537aa702f24645a1446dc3be92bbf" }, - {"ReflectRefractSoapBubble", "a844987c9f2e7334abaa34f12feda3b9" }, - {"RimLight", "e2d3a4d723cf1dc4eab1d919f3324dbc" }, - {"RefractedShadows", "11818aa28edbeb04098f3b395a5bfc1d" }, - {"TextureArray", "0f572993ab788a346aea45f2f797b7fa" }, - {"ObjectNormalRefraction", "f1a0a645876302547b608ce881c94e6d" }, - {"ShaderBallInterior", "e47ee174f55b6144b9c1a942bb23d82a" }, - {"ScreenSpaceCurvature", "2e794cb9b3900b043a37ba28cdc2f907" }, - {"ScreenSpaceDetail", "3a0163d12fede4d47a1f818a66a115de" }, - {"SimpleNoise", "cc167bc6c2063a14f84a5a77be541194" }, - {"SimpleBlur", "1d283ff911af20e429180bb15d023661" }, - {"SimpleGPUInstancing", "9d609a7c8d00c7c4c9bdcdcdba154b81" }, - {"SimpleLambert", "54b29030f7d7ffe4b84f2f215dede5ac" }, - {"SimpleRefraction", "58c94d2f48acdc049a53b4ca53d6d98a" }, - {"SimpleTexture", "9661085a7d249a54c95078ac8e7ff004" }, - {"SnowAccum", "e3bd639f50ae1a247823079047a8dc01" }, - {"StencilDiffuse01", "9f47f529fdeddd948a2d2722f73e6ac4" }, - {"StencilMask01", "6f870834077d59b44ac421c36f619d59" }, - {"StencilDiffuse02", "11cdb862d5ba68c4eae526765099305b" }, - {"StencilMask02", "344696733b065c646b18c1aa2eacfdb7" }, - {"StencilDiffuse03", "75e851f6c686a5f42ab900222b29355b" }, - {"StencilMask03", "c7b3018ad495c6b479f2e3f8564aa6dc" }, - {"SubstanceExample", "a515e243b476d7e4bb37eb9f82c87a12" }, - {"AnimatedRefraction", "e414af1524d258047bb6b82b8860062c" }, - {"Tessellation", "efb669a245f17384c88824d769d0087c" }, - {"Translucency", "842ba3dcdd461ea48bdcfcea316cbcc4" }, - {"Transmission", "1b21506b7afef734facfc42c596caa7b" }, - {"Transparency", "e323a62068140c2408d5601877e8de2c" }, - {"TriplanarProjection", "663d512de06d4e24db5205c679f394cb" }, - {"TwoSideWithFace", "c953c4b601ba78e4f870d24d038b67f6" }, - {"Ground", "48df9bdf7b922d94bb3167e6db39c943" }, - {"WaterSample", "288137d67ce790e41903020c572ab4d7" }, - {"WorldPosSlices", "013cc03f77f3d034692f902db8928787" } - }; - - private static Dictionary<TextureType, string> m_textureTypeToCgType = new Dictionary<TextureType, string>() - { - {TextureType.Texture1D, "sampler1D" }, - {TextureType.Texture2D, "sampler2D" }, - {TextureType.Texture3D, "sampler3D" }, - {TextureType.Cube , "samplerCUBE"}, - {TextureType.Texture2DArray, "sampler2D" }, - {TextureType.ProceduralTexture, "sampler2D" } - }; - - - private static Dictionary<string, Color> m_nodeCategoryToColor = new Dictionary<string, Color>() - { - { "Master", new Color( 0.6f, 0.52f, 0.43f, 1.0f )}, - { "Default", new Color( 0.26f, 0.35f, 0.44f, 1.0f )}, - { "Vertex Data", new Color( 0.8f, 0.07f, 0.18f, 1.0f)},//new Color( 0.75f, 0.10f, 0.30f, 1.0f )}, - { "Math Operators", new Color( 0.26f, 0.35f, 0.44f, 1.0f )},//new Color( 0.10f, 0.27f, 0.45f, 1.0f) }, - { "Logical Operators", new Color( 0.0f, 0.55f, 0.45f, 1.0f)},//new Color( 0.11f, 0.28f, 0.47f, 1.0f) }, - { "Trigonometry Operators", new Color( 0.1f, 0.20f, 0.35f, 1.0f)},//new Color( 0.8f, 0.07f, 0.18f, 1.0f)}, - { "Image Effects", new Color( 0.5f, 0.2f, 0.90f, 1.0f)},//new Color( 0.12f, 0.47f, 0.88f, 1.0f)}, - { "Miscellaneous", new Color( 0.49f, 0.32f, 0.60f, 1.0f)}, - { "Camera And Screen", new Color( 0.75f, 0.10f, 0.30f, 1.0f )},//new Color( 0.17f, 0.22f, 0.07f, 1.0f) }, - { "Constants And Properties", new Color( 0.42f, 0.70f, 0.22f, 1.0f) }, - { "Surface Data", new Color( 0.92f, 0.73f, 0.03f, 1.0f)}, - { "Matrix Transform", new Color( 0.09f, 0.43f, 0.2f, 1.0f) }, - { "Time", new Color( 0.25f, 0.25f, 0.25f, 1.0f)},//new Color( 0.89f, 0.59f, 0.0f, 1.0f) }, - { "Functions", new Color( 1.00f, 0.4f, 0.0f, 1.0f) }, - { "Vector Operators", new Color( 0.22f, 0.20f, 0.45f, 1.0f)}, - { "Matrix Operators", new Color( 0.45f, 0.9f, 0.20f, 1.0f) }, - { "Light", new Color( 1.0f, 0.9f, 0.0f, 1.0f) }, - { "Textures", new Color( 0.15f, 0.40f, 0.8f, 1.0f)}, - { "Commentary", new Color( 0.7f, 0.7f, 0.7f, 1.0f)}, - { "UV Coordinates", new Color( 0.89f, 0.59f, 0.0f, 1.0f) }, - { "Object Transform", new Color( 0.15f, 0.4f, 0.49f, 1.0f)}, - { "Vertex Transform", new Color( 0.15f, 0.4f, 0.49f, 1.0f)} - }; - - private static Dictionary<ToolButtonType, List<string>> m_toolButtonTooltips = new Dictionary<ToolButtonType, List<string>> - { - { ToolButtonType.New, new List<string>() { "Create new shader." } }, - { ToolButtonType.Open, new List<string>() { "Open existing shader." } }, - { ToolButtonType.Save, new List<string>() { "No changes to save.", "Save current changes." } }, - { ToolButtonType.Library, new List<string>() { "Lists custom shader selection." } }, - { ToolButtonType.Options, new List<string>() { "Open Options menu." } }, - { ToolButtonType.Update, new List<string>() { "Open or create a new shader first.", "Click to enable to update current shader.", "Shader up-to-date." } }, - { ToolButtonType.Live, new List<string>() { "Open or create a new shader first.", "Click to enable live shader preview", "Click to enable live shader and material preview." , "Live preview active, click to disable." } }, - { ToolButtonType.TakeScreenshot, new List<string>() { "Take screenshot", "Take screenshot" }}, - { ToolButtonType.Share, new List<string>() { "Share selection", "Share selection" }}, - { ToolButtonType.CleanUnusedNodes, new List<string>() { "No unconnected nodes to clean.", "Remove all nodes not connected( directly or indirectly) to the master node." }}, - { ToolButtonType.Help, new List<string>() { "Show help window." } }, - { ToolButtonType.FocusOnMasterNode,new List<string>() { "Focus on active master node." } }, - { ToolButtonType.FocusOnSelection, new List<string>() { "Focus on selection fit to screen ( if none selected )." } } - }; - - private static Color[] m_dataTypeToColorMonoMode = { new Color( 0.5f, 0.5f, 0.5f, 1.0f ), Color.white }; - private static Dictionary<WirePortDataType, Color> m_dataTypeToColor = new Dictionary<WirePortDataType, Color>( new WirePortDataTypeComparer() ) - { - { WirePortDataType.OBJECT, Color.white}, - { WirePortDataType.FLOAT, Color.gray}, - { WirePortDataType.FLOAT2, new Color(1f,1f,0f,1f)}, - { WirePortDataType.FLOAT3, new Color(0.5f,0.5f,1f,1f)}, - { WirePortDataType.FLOAT4, new Color(1f,0,1f,1f)}, - { WirePortDataType.FLOAT3x3, new Color(0.5f,1f,0.5f,1f)}, - { WirePortDataType.FLOAT4x4, new Color(0.5f,1f,0.5f,1f)}, - { WirePortDataType.COLOR, new Color(1f,0,1f,1f)}, - { WirePortDataType.INT, Color.white}, - { WirePortDataType.SAMPLER1D, new Color(1f,0.5f,0f,1f)}, - { WirePortDataType.SAMPLER2D, new Color(1f,0.5f,0f,1f)}, - { WirePortDataType.SAMPLER3D, new Color(1f,0.5f,0f,1f)}, - { WirePortDataType.SAMPLERCUBE, new Color(1f,0.5f,0f,1f)} - }; - - private static Dictionary<WirePortDataType, string> m_dataTypeToName = new Dictionary<WirePortDataType, string>() - { - { WirePortDataType.OBJECT, "Generic Object"}, - { WirePortDataType.FLOAT, "Float"}, - { WirePortDataType.FLOAT2, "Vector2"}, - { WirePortDataType.FLOAT3, "Vector3"}, - { WirePortDataType.FLOAT4, "Vector4"}, - { WirePortDataType.FLOAT3x3, "3x3 Matrix"}, - { WirePortDataType.FLOAT4x4, "4x4 Matrix"}, - { WirePortDataType.COLOR, "Color"}, - { WirePortDataType.INT, "Int"}, - { WirePortDataType.SAMPLER1D, "Sampler1D"}, - { WirePortDataType.SAMPLER2D, "Sampler2D"}, - { WirePortDataType.SAMPLER3D, "Sampler3D"}, - { WirePortDataType.SAMPLERCUBE, "SamplerCUBE"} - }; - - private static Dictionary<SurfaceInputs, string> m_inputTypeDeclaration = new Dictionary<SurfaceInputs, string>() - { - { SurfaceInputs.DEPTH, "{0} Depth : SV_Depth"}, - { SurfaceInputs.UV_COORDS, "{0}2 uv"},// texture uv must have uv or uv2 followed by the texture name - { SurfaceInputs.UV2_COORDS, "{0}2 uv2"}, - { SurfaceInputs.VIEW_DIR, "{0}3 viewDir"}, - { SurfaceInputs.COLOR, Constants.ColorInput}, - { SurfaceInputs.SCREEN_POS, "{0}4 screenPos"}, - { SurfaceInputs.WORLD_POS, "{0}3 worldPos"}, - { SurfaceInputs.WORLD_REFL, "{0}3 worldRefl"}, - { SurfaceInputs.WORLD_NORMAL,"{0}3 worldNormal"}, - { SurfaceInputs.VFACE, Constants.VFaceInput}, - { SurfaceInputs.INTERNALDATA, Constants.InternalData} - }; - - private static Dictionary<SurfaceInputs, string> m_inputTypeName = new Dictionary<SurfaceInputs, string>() - { - { SurfaceInputs.DEPTH, "Depth"}, - { SurfaceInputs.UV_COORDS, "uv"},// texture uv must have uv or uv2 followed by the texture name - { SurfaceInputs.UV2_COORDS, "uv2"}, - { SurfaceInputs.VIEW_DIR, "viewDir"}, - { SurfaceInputs.COLOR, Constants.ColorVariable}, - { SurfaceInputs.SCREEN_POS, "screenPos"}, - { SurfaceInputs.WORLD_POS, "worldPos"}, - { SurfaceInputs.WORLD_REFL, "worldRefl"}, - { SurfaceInputs.WORLD_NORMAL, "worldNormal"}, - { SurfaceInputs.VFACE, Constants.VFaceVariable}, - }; - - private static Dictionary<PrecisionType, string> m_precisionTypeToCg = new Dictionary<PrecisionType, string>() - { - {PrecisionType.Float, "float"}, - {PrecisionType.Half, "half"}, - {PrecisionType.Inherit, "float"} - }; - - private static Dictionary<VariableQualifiers, string> m_qualifierToCg = new Dictionary<VariableQualifiers, string>() - { - { VariableQualifiers.In, string.Empty}, - {VariableQualifiers.Out, "out"}, - {VariableQualifiers.InOut, "inout"} - }; - - private static Dictionary<WirePortDataType, string> m_precisionWirePortToCgType = new Dictionary<WirePortDataType, string>() - { - {WirePortDataType.FLOAT, "{0}"}, - {WirePortDataType.FLOAT2, "{0}2"}, - {WirePortDataType.FLOAT3, "{0}3"}, - {WirePortDataType.FLOAT4, "{0}4"}, - {WirePortDataType.FLOAT3x3, "{0}3x3"}, - {WirePortDataType.FLOAT4x4, "{0}4x4"}, - {WirePortDataType.COLOR, "{0}4"}, - {WirePortDataType.INT, "int"}, - {WirePortDataType.SAMPLER1D, "sampler1D"}, - {WirePortDataType.SAMPLER2D, "sampler2D"}, - {WirePortDataType.SAMPLER3D, "sampler3D"}, - {WirePortDataType.SAMPLERCUBE, "samplerCUBE"} - }; - - private static Dictionary<WirePortDataType, string> m_wirePortToCgType = new Dictionary<WirePortDataType, string>() - { - { WirePortDataType.FLOAT, "float"}, - {WirePortDataType.FLOAT2, "float2"}, - {WirePortDataType.FLOAT3, "float3"}, - {WirePortDataType.FLOAT4, "float4"}, - {WirePortDataType.FLOAT3x3, "float3x3"}, - {WirePortDataType.FLOAT4x4, "float4x4"}, - {WirePortDataType.COLOR, "float4"}, - {WirePortDataType.INT, "int"}, - {WirePortDataType.SAMPLER1D, "sampler1D"}, - {WirePortDataType.SAMPLER2D, "sampler2D"}, - {WirePortDataType.SAMPLER3D, "sampler3D"}, - {WirePortDataType.SAMPLERCUBE, "samplerCUBE"}, - {WirePortDataType.UINT, "uint"} - }; - - private static Dictionary<KeyCode, string> m_keycodeToString = new Dictionary<KeyCode, string>() - { - {KeyCode.Alpha0,"0" }, - {KeyCode.Alpha1,"1" }, - {KeyCode.Alpha2,"2" }, - {KeyCode.Alpha3,"3" }, - {KeyCode.Alpha4,"4" }, - {KeyCode.Alpha5,"5" }, - {KeyCode.Alpha6,"6" }, - {KeyCode.Alpha7,"7" }, - {KeyCode.Alpha8,"8" }, - {KeyCode.Alpha9,"9" } - }; - - private static Dictionary<WireStatus, Color> m_wireStatusToColor = new Dictionary<WireStatus, Color>() - { - { WireStatus.Default,new Color(0.7f,0.7f,0.7f,1.0f) }, - {WireStatus.Highlighted,Color.yellow }, - {WireStatus.Selected,Color.white} - }; - - private static Dictionary<WirePortDataType, string> m_autoSwizzle = new Dictionary<WirePortDataType, string>() - { - {WirePortDataType.FLOAT, ".x"}, - {WirePortDataType.FLOAT2, ".xy"}, - {WirePortDataType.FLOAT3, ".xyz"}, - {WirePortDataType.FLOAT4, ".xyzw"} - }; - - private static Dictionary<string, bool> m_unityNativeShaderPaths = new Dictionary<string, bool> - { - { "Resources/unity_builtin_extra", true }, - { "Library/unity default resources", true } - }; - - private static Dictionary<WirePortDataType, int> m_portPriority = new Dictionary<WirePortDataType, int>() - { - { WirePortDataType.OBJECT, 0}, - {WirePortDataType.SAMPLER1D, 0}, - {WirePortDataType.SAMPLER2D, 0}, - {WirePortDataType.SAMPLER3D, 0}, - {WirePortDataType.SAMPLERCUBE, 0}, - {WirePortDataType.FLOAT3x3, 1}, - {WirePortDataType.FLOAT4x4, 2}, - {WirePortDataType.INT, 3}, - {WirePortDataType.FLOAT, 4}, - {WirePortDataType.FLOAT2, 5}, - {WirePortDataType.FLOAT3, 6}, - {WirePortDataType.FLOAT4, 7}, - {WirePortDataType.COLOR, 7} - }; - - private static readonly string IncorrectInputConnectionErrorMsg = "Input Port {0} from node {1} has type {2}\nwhich is incompatible with connection of type {3} from port {4} on node {5}"; - private static readonly string IncorrectOutputConnectionErrorMsg = "Output Port {0} from node {1} has type {2}\nwhich is incompatible with connection of type {3} from port {4} on node {5}"; - private static readonly string NoVertexModeNodeWarning = "{0} is unable to generate code in vertex function"; - - private static float SwitchFixedHeight; - private static float SwitchFontSize; - private static RectOffset SwitchNodeBorder; - private static RectOffset SwitchNodeMargin; - private static RectOffset SwitchNodeOverflow; - private static RectOffset SwitchNodePadding; - - public static void ForceExampleShaderCompilation() - { - CurrentWindow.ForceMaterialsToUpdate( ref m_exampleMaterialIDs ); - - } - - public static void Destroy() - { - if( IOUtils.AllOpenedWindows != null && IOUtils.AllOpenedWindows.Count > 0 ) - { - return; - } - else - { - IOUtils.AllOpenedWindows.Clear(); - } - - Initialized = false; - PlusStyle = null; - MinusStyle = null; - m_textInfo = null; - RangedFloatSliderStyle = null; - RangedFloatSliderThumbStyle = null; - PropertyPopUp = null; - ObjectField = null; - PreviewExpander = null; - PreviewCollapser = null; - MenuItemToggleStyle = null; - MenuItemEnableStyle = null; - MenuItemBackgroundStyle = null; - MenuItemToolbarStyle = null; - MenuItemInspectorDropdownStyle = null; - ObjectFieldThumb = null; - ObjectFieldThumbOverlay = null; - InspectorPopdropdownStyle = null; - InspectorPopdropdownFallback = null; - TooltipBox = null; - UnZoomedNodeTitleStyle = null; - UnZoomedPropertyValuesTitleStyle = null; - UnZoomedInputPortStyle = null; - UnZoomedOutputPortPortStyle = null; - ToolbarSearchTextfield = null; - ToolbarSearchCancelButton = null; - FloatIntPickerONOFF = null; - Box = null; - Button = null; - TextArea = null; - Label = null; - Toggle = null; - Textfield = null; - - CommentaryTitle = null; - InputPortLabel = null; - OutputPortLabel = null; - - IntShader = null; - FloatShader = null; - Vector2Shader = null; - Vector3Shader = null; - Vector4Shader = null; - ColorShader = null; - Texture2DShader = null; - - MaskingShader = null; - - BoldErrorStyle = null; - BoldWarningStyle = null; - BoldInfoStyle = null; - Separator = null; - ToolbarMainTitle = null; - - GraphButtonIcon = null; - GraphButton = null; - GraphDropDown = null; - - ConsoleLogLabel = null; - ConsoleLogMessage = null; - ConsoleLogCircle = null; - - MiniButtonTopLeft = null; - MiniButtonTopMid = null; - MiniButtonTopRight = null; - - NodeWindowOffSquare = null; - NodeHeaderSquare = null; - NodeWindowOnSquare = null; - InternalDataOnPort = null; - InternalDataBackground = null; - - MiniObjectFieldThumbOverlay = null; - MiniSamplerButton = null; - - Resources.UnloadAsset( SmallErrorIcon ); - SmallErrorIcon = null; - - Resources.UnloadAsset( SmallWarningIcon ); - SmallWarningIcon = null; - - Resources.UnloadAsset( SmallInfoIcon ); - SmallInfoIcon = null; - - LockIconOpen = null; - LockIconClosed = null; - - FloatIntIconON = null; - FloatIntIconOFF = null; - - Resources.UnloadAsset( CheckmarkIcon ); - CheckmarkIcon = null; - - Resources.UnloadAsset( PopupIcon ); - PopupIcon = null; - - Resources.UnloadAsset( MasterNodeOnTexture ); - MasterNodeOnTexture = null; - - Resources.UnloadAsset( MasterNodeOffTexture ); - MasterNodeOffTexture = null; - - Resources.UnloadAsset( GPUInstancedOnTexture ); - GPUInstancedOnTexture = null; - - Resources.UnloadAsset( GPUInstancedOffTexture ); - GPUInstancedOffTexture = null; - - MainSkin = null; - - if( LinearMaterial != null ) - GameObject.DestroyImmediate( LinearMaterial ); - - LinearMaterial = null; - - if( m_undoHelper == null ) - { - m_undoHelper.Clear(); - m_undoHelper = null; - } - ASEMaterialInspector.Instance = null; - } - - public static void ResetMainSkin() - { - if( (object)MainSkin != null ) - { - CurrentHeaderHeight = HeaderMaxHeight; - ScaledPortsDelta = PortsDelta; - MainSkin.textField.fontSize = (int)( Constants.TextFieldFontSize ); - MainSkin.label.fontSize = (int)( Constants.DefaultFontSize ); - MainSkin.customStyles[ (int)CustomStyle.NodeTitle ].fontSize = (int)( Constants.DefaultTitleFontSize ); - - InputPortLabel.fontSize = (int)( Constants.DefaultFontSize ); - OutputPortLabel.fontSize = (int)( Constants.DefaultFontSize ); - CommentaryTitle.fontSize = (int)( Constants.DefaultFontSize ); - } - } - - public static void InitMainSkin() - { - MainSkin = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( IOUtils.MainSkinGUID ), typeof( GUISkin ) ) as GUISkin; - Initialized = true; - Texture2D portTex = GetCustomStyle( CustomStyle.PortEmptyIcon ).normal.background; - PortsSize = new Vector2( portTex.width, portTex.height ); - PortsDelta = new Vector3( 0.5f * PortsSize.x, 0.5f * PortsSize.y ); - HeaderMaxHeight = MainSkin.customStyles[ (int)CustomStyle.NodeHeader ].normal.background.height; - - RectOffsetZero = new RectOffset( 0, 0, 0, 0 ); - RectOffsetOne = new RectOffset( 1, 1, 1, 1 ); - RectOffsetTwo = new RectOffset( 2, 2, 2, 2 ); - RectOffsetThree = new RectOffset( 3, 3, 3, 3 ); - RectOffsetFour = new RectOffset( 4, 4, 4, 4 ); - RectOffsetFive = new RectOffset( 5, 5, 5, 5 ); - RectOffsetSix = new RectOffset( 6, 6, 6, 6 ); - - PropertyPopUp = GetCustomStyle( CustomStyle.NodePropertyPicker ); - ObjectField = new GUIStyle( (GUIStyle)"ObjectField" ); - PreviewExpander = GetCustomStyle( CustomStyle.NodePreviewExpander ); - PreviewCollapser = GetCustomStyle( CustomStyle.NodePreviewCollapser ); - - WireNodeSelection = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( "bfe0b03d5d60cea4f9d4b2d1d121e592" ), typeof( Texture2D ) ) as Texture2D; - SliderButton = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( "dd563e33152bb6443b099b4139ceecb9" ), typeof( Texture2D ) ) as Texture2D; - - SmallErrorIcon = EditorGUIUtility.Load( "icons/d_console.erroricon.sml.png" ) as Texture2D; - SmallWarningIcon = EditorGUIUtility.Load( "icons/d_console.warnicon.sml.png" ) as Texture2D; - SmallInfoIcon = EditorGUIUtility.Load( "icons/d_console.infoicon.sml.png" ) as Texture2D; - - LockIconOpen = new GUIContent( EditorGUIUtility.IconContent( "LockIcon-On" ) ); - LockIconOpen.tooltip = "Click to unlock and customize the variable name"; - LockIconClosed = new GUIContent( EditorGUIUtility.IconContent( "LockIcon" ) ); - LockIconClosed.tooltip = "Click to lock and auto-generate the variable name"; - - if( UsingProSkin ) - { - FloatIntIconON = new GUIContent( EditorGUIUtility.IconContent( "CircularToggle_ON" ) ); - FloatIntIconOFF = new GUIContent( EditorGUIUtility.IconContent( "CircularToggle_OFF" ) ); - } - else - { - FloatIntIconON = new GUIContent( ( AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( "ac0860a6a77e29d4091ba790a17daa0f" ), typeof( Texture2D ) ) as Texture2D ) ); - FloatIntIconOFF = new GUIContent( ( AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( "1aaca50d084b0bb43854f075ce2f302b" ), typeof( Texture2D ) ) as Texture2D ) ); - } - - CommentaryTitle = new GUIStyle( MainSkin.customStyles[ (int)CustomStyle.CommentaryTitle ] ); - InputPortLabel = new GUIStyle( MainSkin.customStyles[ (int)CustomStyle.InputPortlabel ] ); - OutputPortLabel = new GUIStyle( MainSkin.customStyles[ (int)CustomStyle.OutputPortLabel ] ); - - CheckmarkIcon = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( "e9c4642eaa083a54ab91406d8449e6ac" ), typeof( Texture2D ) ) as Texture2D; - PopupIcon = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( "d2384a227b4ac4943b73c8151393e502" ), typeof( Texture2D ) ) as Texture2D; - - BoldErrorStyle = new GUIStyle( (GUIStyle)"BoldLabel" ); - BoldErrorStyle.normal.textColor = Color.red; - BoldErrorStyle.alignment = TextAnchor.MiddleCenter; - BoldWarningStyle = new GUIStyle( (GUIStyle)"BoldLabel" ); - BoldWarningStyle.normal.textColor = Color.yellow; - BoldWarningStyle.alignment = TextAnchor.MiddleCenter; - BoldInfoStyle = new GUIStyle( (GUIStyle)"BoldLabel" ); - BoldInfoStyle.normal.textColor = Color.white; - BoldInfoStyle.alignment = TextAnchor.MiddleCenter; - - ToolbarMainTitle = new GUIStyle( MainSkin.customStyles[ (int)CustomStyle.MainCanvasTitle ] ); - Separator = new GUIStyle( MainSkin.customStyles[ (int)CustomStyle.FlatBackground ] ); - MiniButtonTopLeft = new GUIStyle( MainSkin.customStyles[ (int)CustomStyle.MiniButtonTopLeft ] ); - MiniButtonTopMid = new GUIStyle( MainSkin.customStyles[ (int)CustomStyle.MiniButtonTopMid ] ); - MiniButtonTopRight = new GUIStyle( MainSkin.customStyles[ (int)CustomStyle.MiniButtonTopRight ] ); - - InternalDataOnPort = new GUIStyle( MainSkin.customStyles[ (int)CustomStyle.NodeTitle ] ); - InternalDataOnPort.fontSize = 8; - InternalDataOnPort.fontStyle = FontStyle.BoldAndItalic; - InternalDataBackground = new GUIStyle( MainSkin.customStyles[ (int)CustomStyle.NodeWindowOffSquare ] ); - InternalDataBackground.normal.background = AssetDatabase.LoadAssetAtPath( AssetDatabase.GUIDToAssetPath( "330fd0c8f074a3c4f8042114a61a73d9" ), typeof( Texture2D ) ) as Texture2D; - InternalDataBackground.overflow = RectOffsetOne; - - MiniObjectFieldThumbOverlay = new GUIStyle( (GUIStyle)"ObjectFieldThumbOverlay" ); - MiniSamplerButton = new GUIStyle( MainSkin.customStyles[ (int)CustomStyle.SamplerButton ] ); - - m_textInfo = new System.Globalization.CultureInfo( "en-US", false ).TextInfo; - RangedFloatSliderStyle = new GUIStyle( GUI.skin.horizontalSlider ); - RangedFloatSliderThumbStyle = new GUIStyle( GUI.skin.horizontalSliderThumb ); - RangedFloatSliderThumbStyle.normal.background = SliderButton; - RangedFloatSliderThumbStyle.active.background = null; - RangedFloatSliderThumbStyle.hover.background = null; - RangedFloatSliderThumbStyle.focused.background = null; - RangedFloatSliderThumbStyle.overflow = new RectOffset( 1, 1, -4, 4 ); - RangedFloatSliderThumbStyle.margin = RectOffsetZero; - - SwitchNodePopUp = new GUIStyle( (GUIStyle)"Popup" ); - // RectOffset cannot be initiliazed on constructor - SwitchNodeBorder = new RectOffset( 4, 15, 3, 3 ); - SwitchNodeMargin = new RectOffset( 4, 4, 3, 3 ); - SwitchNodeOverflow = new RectOffset( 0, 0, -1, 2 ); - SwitchNodePadding = new RectOffset( 6, 14, 2, 3 ); - SwitchFixedHeight = 18; - SwitchFontSize = 10; - - GraphButtonIcon = new GUIStyle( MainSkin.customStyles[ (int)CustomStyle.GraphButtonIcon ] ); - GraphButton = new GUIStyle( MainSkin.customStyles[ (int)CustomStyle.GraphButton ] ); - GraphDropDown = new GUIStyle( MainSkin.customStyles[ (int)CustomStyle.GraphButton ] ); - GraphDropDown.padding.right = 20; - - Box = new GUIStyle( MainSkin.box ); - Button = new GUIStyle( GUI.skin.button ); - TextArea = new GUIStyle( GUI.skin.textArea ); - Label = new GUIStyle( GUI.skin.label ); - Toggle = new GUIStyle( GUI.skin.toggle ); - Textfield = new GUIStyle( GUI.skin.textField ); - //ShaderIcon = EditorGUIUtility.IconContent( "Shader Icon" ).image; - //MaterialIcon = EditorGUIUtility.IconContent( "Material Icon" ).image; - - ConsoleLogLabel = new GUIStyle( GUI.skin.label ); - ConsoleLogMessage = new GUIStyle( MainSkin.customStyles[ (int)CustomStyle.ConsoleLogMessage ] ); - ConsoleLogCircle = new GUIStyle( MainSkin.customStyles[ (int)CustomStyle.ConsoleLogCircle ] ); - - NodeWindowOffSquare = GetCustomStyle( CustomStyle.NodeWindowOffSquare ); - NodeHeaderSquare = GetCustomStyle( CustomStyle.NodeHeaderSquare ); - NodeWindowOnSquare = GetCustomStyle( CustomStyle.NodeWindowOnSquare ); - - UnZoomedNodeTitleStyle = new GUIStyle( GetCustomStyle( CustomStyle.NodeTitle ) ); - UnZoomedNodeTitleStyle.fontSize = 13; - - UnZoomedPropertyValuesTitleStyle = new GUIStyle( GetCustomStyle( CustomStyle.PropertyValuesTitle ) ); - UnZoomedPropertyValuesTitleStyle.fontSize = 11; - - UnZoomedInputPortStyle = new GUIStyle( InputPortLabel ); - UnZoomedInputPortStyle.fontSize = (int)Constants.DefaultFontSize; - - UnZoomedOutputPortPortStyle = new GUIStyle( OutputPortLabel ); - UnZoomedOutputPortPortStyle.fontSize = (int)Constants.DefaultFontSize; - - ObjectFieldThumb = new GUIStyle( (GUIStyle)"ObjectFieldThumb" ); - ObjectFieldThumbOverlay = new GUIStyle( (GUIStyle)"ObjectFieldThumbOverlay" ); - - FloatIntPickerONOFF = new GUIStyle( "metimelabel" ); - FloatIntPickerONOFF.padding.left = -2; - FloatIntPickerONOFF.margin = new RectOffset(0,2,2,2); - - TooltipBox = new GUIStyle( (GUIStyle)"Tooltip" ); - TooltipBox.richText = true; - - MasterNodeOnTexture = AssetDatabase.LoadAssetAtPath<Texture2D>( AssetDatabase.GUIDToAssetPath( IOUtils.MasterNodeOnTextureGUID ) ); - MasterNodeOffTexture = AssetDatabase.LoadAssetAtPath<Texture2D>( AssetDatabase.GUIDToAssetPath( IOUtils.MasterNodeOnTextureGUID ) ); - - GPUInstancedOnTexture = AssetDatabase.LoadAssetAtPath<Texture2D>( AssetDatabase.GUIDToAssetPath( IOUtils.GPUInstancedOnTextureGUID ) ); - GPUInstancedOffTexture = AssetDatabase.LoadAssetAtPath<Texture2D>( AssetDatabase.GUIDToAssetPath( IOUtils.GPUInstancedOffTextureGUID ) ); - - CheckNullMaterials(); - - UsingProSkin = EditorGUIUtility.isProSkin; - FetchMenuItemStyles(); - } - - public static bool IsLoading - { - get { return CurrentWindow.OutsideGraph.IsLoading; } - } - - public static void CheckNullMaterials() - { - if( LinearMaterial == null ) - { - Shader linearShader = AssetDatabase.LoadAssetAtPath<Shader>( AssetDatabase.GUIDToAssetPath( "e90ef6ea05743b84baf9549874c52e47" ) ); //linear previews - LinearMaterial = new Material( linearShader ); - } - - if( IntShader == null ) - IntShader = AssetDatabase.LoadAssetAtPath<Shader>( AssetDatabase.GUIDToAssetPath( "0f64d695b6ffacc469f2dd31432a232a" ) ); //int - if( FloatShader == null ) - FloatShader = AssetDatabase.LoadAssetAtPath<Shader>( AssetDatabase.GUIDToAssetPath( "d9ca47581ac157145bff6f72ac5dd73e" ) ); //ranged float - if( Vector2Shader == null ) - Vector2Shader = AssetDatabase.LoadAssetAtPath<Shader>( AssetDatabase.GUIDToAssetPath( "88b4191eb06084d4da85d1dd2f984085" ) ); //vector2 - if( Vector3Shader == null ) - Vector3Shader = AssetDatabase.LoadAssetAtPath<Shader>( AssetDatabase.GUIDToAssetPath( "8a44d38f06246bf48944b3f314bc7920" ) ); //vector3 - if( Vector4Shader == null ) - Vector4Shader = AssetDatabase.LoadAssetAtPath<Shader>( AssetDatabase.GUIDToAssetPath( "aac241d0e47a5a84fbd2edcd640788dc" ) ); //vector4 - if( ColorShader == null ) - ColorShader = AssetDatabase.LoadAssetAtPath<Shader>( AssetDatabase.GUIDToAssetPath( "6cf365ccc7ae776488ae8960d6d134c3" ) ); //color node - if( MaskingShader == null ) - MaskingShader = AssetDatabase.LoadAssetAtPath<Shader>( AssetDatabase.GUIDToAssetPath( "9c34f18ebe2be3e48b201b748c73dec0" ) ); //masking shader - if( Texture2DShader == null ) - Texture2DShader = AssetDatabase.LoadAssetAtPath<Shader>( AssetDatabase.GUIDToAssetPath( "13bd295c44d04e1419f20f792d331e33" ) ); //texture2d shader - } - - private static void FetchMenuItemStyles() - { - ObjectFieldThumb = new GUIStyle( (GUIStyle)"ObjectFieldThumb" ); - ObjectFieldThumbOverlay = new GUIStyle( (GUIStyle)"ObjectFieldThumbOverlay" ); - MenuItemToggleStyle = new GUIStyle( (GUIStyle)"foldout" ); - MenuItemEnableStyle = UsingProSkin ? new GUIStyle( (GUIStyle)"OL ToggleWhite" ) : new GUIStyle( (GUIStyle)"OL Toggle" ); - MenuItemBackgroundStyle = new GUIStyle( (GUIStyle)"TE NodeBackground" ); - MenuItemToolbarStyle = new GUIStyle( (GUIStyle)"toolbarbutton" ) { fixedHeight = 20 }; - MenuItemInspectorDropdownStyle = new GUIStyle( (GUIStyle)"toolbardropdown" ) { fixedHeight = 20 }; - MenuItemInspectorDropdownStyle.margin.bottom = 2; - - - InspectorPopdropdownStyle = new GUIStyle( GUI.skin.GetStyle( "PopupCurveDropdown" ) ); - InspectorPopdropdownStyle.alignment = TextAnchor.MiddleRight; - InspectorPopdropdownStyle.border.bottom = 16; - - InspectorPopdropdownFallback = new GUIStyle( InspectorPopdropdownStyle ); - InspectorPopdropdownFallback.overflow = new RectOffset( 0, -5, 0, 0 ); - - PlusStyle = ( EditorGUIUtility.isProSkin ) ? new GUIStyle( GetCustomStyle( CustomStyle.CustomExpressionAddItem ) ) : new GUIStyle( (GUIStyle)"OL Plus" ); - PlusStyle.imagePosition = ImagePosition.ImageOnly; - PlusStyle.overflow = new RectOffset( -2, 0, -4, 0 ); - - MinusStyle = ( EditorGUIUtility.isProSkin ) ? new GUIStyle( GetCustomStyle( CustomStyle.CustomExpressionRemoveItem ) ) : new GUIStyle( (GUIStyle)"OL Minus" ); - MinusStyle.contentOffset = Vector2.zero; - MinusStyle.imagePosition = ImagePosition.ImageOnly; - MinusStyle.overflow = new RectOffset( -2, 0, -4, 0 ); - - ToolbarSearchTextfield = new GUIStyle( (GUIStyle)"ToolbarSeachTextField" ); - ToolbarSearchCancelButton = new GUIStyle( (GUIStyle)"ToolbarSeachCancelButton" ); - } - - public static void UpdateMainSkin( DrawInfo drawInfo ) - { - CurrentHeaderHeight = HeaderMaxHeight * drawInfo.InvertedZoom; - ScaledPortsDelta = drawInfo.InvertedZoom * PortsDelta; - MainSkin.textField.fontSize = (int)( Constants.TextFieldFontSize * drawInfo.InvertedZoom ); - MainSkin.label.fontSize = (int)( Constants.DefaultFontSize * drawInfo.InvertedZoom ); - - MainSkin.customStyles[ (int)CustomStyle.NodeTitle ].fontSize = (int)( Constants.DefaultTitleFontSize * drawInfo.InvertedZoom ); - MainSkin.customStyles[ (int)CustomStyle.PropertyValuesTitle ].fontSize = (int)( Constants.PropertiesTitleFontSize * drawInfo.InvertedZoom ); - - InputPortLabel.fontSize = (int)( Constants.DefaultFontSize * drawInfo.InvertedZoom ); - OutputPortLabel.fontSize = (int)( Constants.DefaultFontSize * drawInfo.InvertedZoom ); - CommentaryTitle.fontSize = (int)( Constants.DefaultFontSize * drawInfo.InvertedZoom ); - - RangedFloatSliderStyle.fixedHeight = 18 * drawInfo.InvertedZoom; - RangedFloatSliderThumbStyle.fixedHeight = 12 * drawInfo.InvertedZoom; - RangedFloatSliderThumbStyle.fixedWidth = 10 * drawInfo.InvertedZoom; - RangedFloatSliderThumbStyle.overflow.left = (int)( 1 * drawInfo.InvertedZoom ); - RangedFloatSliderThumbStyle.overflow.right = (int)( 1 * drawInfo.InvertedZoom ); - RangedFloatSliderThumbStyle.overflow.top = (int)( -4 * drawInfo.InvertedZoom ); - RangedFloatSliderThumbStyle.overflow.bottom = (int)( 4 * drawInfo.InvertedZoom ); - - SwitchNodePopUp.fixedHeight = SwitchFixedHeight * drawInfo.InvertedZoom; - - SwitchNodePopUp.border.left = (int)( SwitchNodeBorder.left * drawInfo.InvertedZoom ); - SwitchNodePopUp.border.right = (int)( SwitchNodeBorder.right * drawInfo.InvertedZoom ); - SwitchNodePopUp.border.top = (int)( SwitchNodeBorder.top * drawInfo.InvertedZoom ); - SwitchNodePopUp.border.bottom = (int)( SwitchNodeBorder.bottom * drawInfo.InvertedZoom ); - - SwitchNodePopUp.margin.left = (int)( SwitchNodeMargin.left * drawInfo.InvertedZoom ); - SwitchNodePopUp.margin.right = (int)( SwitchNodeMargin.right * drawInfo.InvertedZoom ); - SwitchNodePopUp.margin.top = (int)( SwitchNodeMargin.top * drawInfo.InvertedZoom ); - SwitchNodePopUp.margin.bottom = (int)( SwitchNodeMargin.bottom * drawInfo.InvertedZoom ); - - SwitchNodePopUp.overflow.left = (int)( SwitchNodeOverflow.left * drawInfo.InvertedZoom ); - SwitchNodePopUp.overflow.right = (int)( SwitchNodeOverflow.right * drawInfo.InvertedZoom ); - SwitchNodePopUp.overflow.top = (int)( SwitchNodeOverflow.top * drawInfo.InvertedZoom ); - SwitchNodePopUp.overflow.bottom = (int)( SwitchNodeOverflow.bottom * drawInfo.InvertedZoom ); - - SwitchNodePopUp.padding.left = (int)( SwitchNodePadding.left * drawInfo.InvertedZoom ); - SwitchNodePopUp.padding.right = (int)( SwitchNodePadding.right * drawInfo.InvertedZoom ); - SwitchNodePopUp.padding.top = (int)( SwitchNodePadding.top * drawInfo.InvertedZoom ); - SwitchNodePopUp.padding.bottom = (int)( SwitchNodePadding.bottom * drawInfo.InvertedZoom ); - - SwitchNodePopUp.fontSize = (int)( SwitchFontSize * drawInfo.InvertedZoom ); - - BoldErrorStyle.fontSize = (int)( 12 * drawInfo.InvertedZoom ); - BoldWarningStyle.fontSize = (int)( 12 * drawInfo.InvertedZoom ); - BoldInfoStyle.fontSize = (int)( 12 * drawInfo.InvertedZoom ); - - PropertyPopUp.fixedHeight = Constants.PropertyPickerHeight * drawInfo.InvertedZoom; - PropertyPopUp.fixedWidth = Constants.PropertyPickerWidth * drawInfo.InvertedZoom; - if( UsingProSkin != EditorGUIUtility.isProSkin ) - { - UsingProSkin = EditorGUIUtility.isProSkin; - FetchMenuItemStyles(); - } - - GraphDropDown.padding.left = (int)( 2 * drawInfo.InvertedZoom + 2 ); - GraphDropDown.padding.right = (int)( 20 * drawInfo.InvertedZoom ); - GraphDropDown.fontSize = (int)( 10 * drawInfo.InvertedZoom ); - - PreviewExpander.fixedHeight = Constants.PreviewExpanderHeight * drawInfo.InvertedZoom; - PreviewExpander.fixedWidth = Constants.PreviewExpanderWidth * drawInfo.InvertedZoom; - - PreviewCollapser.fixedHeight = Constants.PreviewExpanderHeight * drawInfo.InvertedZoom; - PreviewCollapser.fixedWidth = Constants.PreviewExpanderWidth * drawInfo.InvertedZoom; - - MainSkin.customStyles[ (int)CustomStyle.SamplerButton ].fontSize = (int)( 9 * drawInfo.InvertedZoom ); - ObjectFieldThumbOverlay.fontSize = (int)( 9 * drawInfo.InvertedZoom ); - MiniButtonTopLeft.fontSize = (int)( 9 * drawInfo.InvertedZoom ); - MiniButtonTopMid.fontSize = (int)( 9 * drawInfo.InvertedZoom ); - MiniButtonTopRight.fontSize = (int)( 9 * drawInfo.InvertedZoom ); - - MiniObjectFieldThumbOverlay.fontSize = (int)( 7 * drawInfo.InvertedZoom ); - MiniSamplerButton.fontSize = (int)( 8 * drawInfo.InvertedZoom ); - - InternalDataOnPort.fontSize = (int)( 8 * drawInfo.InvertedZoom ); - ToolbarMainTitle.padding.left = 0; - ToolbarMainTitle.padding.right = 0; - - CheckNullMaterials(); - } - - public static void CacheLabelVars() - { - m_alignment = GUI.skin.label.alignment; - m_clipping = GUI.skin.label.clipping; - m_wordWrap = GUI.skin.label.wordWrap; - m_fontSize = GUI.skin.label.fontSize; - m_fontStyle = GUI.skin.label.fontStyle; - m_fontColor = GUI.skin.label.normal.textColor; - } - - public static void RestoreLabelVars() - { - GUI.skin.label.alignment = m_alignment; - GUI.skin.label.clipping = m_clipping; - GUI.skin.label.wordWrap = m_wordWrap; - GUI.skin.label.fontSize = m_fontSize; - GUI.skin.label.fontStyle = m_fontStyle; - GUI.skin.label.normal.textColor = m_fontColor; - } - - public static string GetTooltipForToolButton( ToolButtonType toolButtonType, int state ) { return m_toolButtonTooltips[ toolButtonType ][ state ]; } - - public static string KeyCodeToString( KeyCode keyCode ) - { - if( m_keycodeToString.ContainsKey( keyCode ) ) - return m_keycodeToString[ keyCode ]; - - return keyCode.ToString(); - } - - public static string TextureTypeToCgType( TextureType type ) { return m_textureTypeToCgType[ type ]; } - - public static string QualifierToCg( VariableQualifiers qualifier ) - { - return m_qualifierToCg[ qualifier ]; - } - - public static string WirePortToCgType( WirePortDataType type ) - { - if( type == WirePortDataType.OBJECT ) - return string.Empty; - - return m_wirePortToCgType[ type ]; - } - - public static string FinalPrecisionWirePortToCgType( PrecisionType precisionType, WirePortDataType type ) - { - return PrecisionWirePortToCgType( precisionType, type ); - } - - public static string PrecisionWirePortToCgType( PrecisionType precisionType, WirePortDataType type ) - { - if( type == WirePortDataType.OBJECT ) - return string.Empty; - - if( type == WirePortDataType.INT ) - return m_wirePortToCgType[ type ]; - - if( type == WirePortDataType.UINT ) - return m_wirePortToCgType[ type ]; - - return string.Format( m_precisionWirePortToCgType[ type ], m_precisionTypeToCg[ precisionType ] ); - } - - public static string GetAutoSwizzle( WirePortDataType type ) - { - return m_autoSwizzle[ type ]; - } - - public static Color GetColorForDataType( WirePortDataType dataType, bool monochromeMode = true, bool isInput = true ) - { - if( monochromeMode ) - { - return isInput ? m_dataTypeToColorMonoMode[ 0 ] : m_dataTypeToColorMonoMode[ 1 ]; - } - else - { - if ( m_dataTypeToColor.ContainsKey( dataType ) ) - return m_dataTypeToColor[ dataType ]; - } - return m_dataTypeToColor[ WirePortDataType.OBJECT ]; - } - - public static bool IsValidType( WirePortDataType type ) - { - switch ( type ) - { - case WirePortDataType.OBJECT: - case WirePortDataType.FLOAT: - case WirePortDataType.FLOAT2: - case WirePortDataType.FLOAT3: - case WirePortDataType.FLOAT4: - case WirePortDataType.FLOAT3x3: - case WirePortDataType.FLOAT4x4: - case WirePortDataType.COLOR: - case WirePortDataType.INT: - case WirePortDataType.SAMPLER1D: - case WirePortDataType.SAMPLER2D: - case WirePortDataType.SAMPLER3D: - case WirePortDataType.SAMPLERCUBE: - return true; - } - return false; - } - public static string GetNameForDataType( WirePortDataType dataType ) { return m_dataTypeToName[ dataType ]; } - - public static string GetInputDeclarationFromType( PrecisionType precision, SurfaceInputs inputType ) - { - string precisionStr = m_precisionTypeToCg[ precision ]; - return string.Format( m_inputTypeDeclaration[ inputType ], precisionStr ); - } - - public static string GetInputValueFromType( SurfaceInputs inputType ) { return m_inputTypeName[ inputType ]; } - private static string CreateLocalValueName( PrecisionType precision, WirePortDataType dataType, string localOutputValue, string value ) { return string.Format( Constants.LocalValueDecWithoutIdent, PrecisionWirePortToCgType( precision, dataType ), localOutputValue, value ); } - - public static string CastPortType( ref MasterNodeDataCollector dataCollector, PrecisionType nodePrecision, NodeCastInfo castInfo, object value, WirePortDataType oldType, WirePortDataType newType, string parameterName = null ) - { - if( oldType == newType || newType == WirePortDataType.OBJECT ) - { - return ( parameterName != null ) ? parameterName : value.ToString(); - } - - PrecisionType currentPrecision = nodePrecision; - string precisionStr = m_precisionTypeToCg[ currentPrecision ]; - string newTypeStr = m_wirePortToCgType[ newType ]; - newTypeStr = m_textInfo.ToTitleCase( newTypeStr ); - int castId = ( dataCollector.PortCategory == MasterNodePortCategory.Vertex || dataCollector.PortCategory == MasterNodePortCategory.Tessellation ) ? dataCollector.AvailableVertexTempId : dataCollector.AvailableFragTempId; - string localVarName = "temp_cast_" + castId;//m_wirePortToCgType[ oldType ] + "To" + newTypeStr + "_" + castInfo.ToString(); - string result = string.Empty; - bool useRealValue = ( parameterName == null ); - - switch( oldType ) - { - case WirePortDataType.FLOAT: - { - switch( newType ) - { - case WirePortDataType.OBJECT: result = useRealValue ? value.ToString() : parameterName; break; - case WirePortDataType.FLOAT2: - { - string localVal = CreateLocalValueName( currentPrecision, newType, localVarName, string.Format( Constants.CastHelper, ( ( useRealValue ) ? value.ToString() : parameterName ), "xx" ) ); - dataCollector.AddToLocalVariables( dataCollector.PortCategory, -1, localVal ); - result = localVarName; - } - break; - case WirePortDataType.FLOAT3: - { - string localVal = CreateLocalValueName( currentPrecision, newType, localVarName, string.Format( Constants.CastHelper, ( ( useRealValue ) ? value.ToString() : parameterName ), "xxx" ) ); - dataCollector.AddToLocalVariables( dataCollector.PortCategory, -1, localVal ); - result = localVarName; - } - break; - case WirePortDataType.COLOR: - { - string localVal = CreateLocalValueName( currentPrecision, newType, localVarName, string.Format( Constants.CastHelper, ( ( useRealValue ) ? value.ToString() : parameterName ), "xxxx" ) ); - dataCollector.AddToLocalVariables( dataCollector.PortCategory, -1, localVal ); - result = localVarName; - } - break; - case WirePortDataType.FLOAT4: - { - string localVal = CreateLocalValueName( currentPrecision, newType, localVarName, string.Format( Constants.CastHelper, ( ( useRealValue ) ? value.ToString() : parameterName ), "xxxx" ) ); - dataCollector.AddToLocalVariables( dataCollector.PortCategory, -1, localVal ); - result = localVarName; - } - break; - case WirePortDataType.FLOAT3x3: - { - string localVal = CreateLocalValueName( currentPrecision, newType, localVarName, ( ( useRealValue ) ? value.ToString() : parameterName ) ); - dataCollector.AddToLocalVariables( dataCollector.PortCategory, -1, localVal ); - result = localVarName; - } - break; - case WirePortDataType.FLOAT4x4: - { - string localVal = CreateLocalValueName( currentPrecision, newType, localVarName, ( ( useRealValue ) ? value.ToString() : parameterName ) ); - dataCollector.AddToLocalVariables( dataCollector.PortCategory, -1, localVal ); - result = localVarName; - } - break; - case WirePortDataType.INT: - { - result = ( useRealValue ) ? ( (int)value ).ToString() : "(int)" + parameterName; - } - break; - } - } - break; - case WirePortDataType.FLOAT2: - { - Vector2 vecVal = useRealValue ? (Vector2)value : Vector2.zero; - switch( newType ) - { - case WirePortDataType.OBJECT: result = useRealValue ? precisionStr + "2( " + vecVal.x + " , " + vecVal.y + " )" : parameterName; break; - case WirePortDataType.FLOAT: - { - result = ( useRealValue ) ? vecVal.x.ToString() : parameterName + ".x"; - } - break; - case WirePortDataType.FLOAT3: - { - result = ( useRealValue ) ? precisionStr + "3( " + vecVal.x + " , " + vecVal.y + " , " + " 0.0 )" : precisionStr + "3( " + parameterName + " , 0.0 )"; - } - break; - case WirePortDataType.COLOR: - case WirePortDataType.FLOAT4: - { - result = ( useRealValue ) ? precisionStr + "4( " + vecVal.x + " , " + vecVal.y + " , " + " 0.0 , 0.0 )" : precisionStr + "4( " + parameterName + ", 0.0 , 0.0 )"; - } - break; - } - } - break; - case WirePortDataType.FLOAT3: - { - Vector3 vecVal = useRealValue ? (Vector3)value : Vector3.zero; - switch( newType ) - { - case WirePortDataType.OBJECT: result = useRealValue ? precisionStr + "3( " + vecVal.x + " , " + vecVal.y + " , " + vecVal.z + " )" : parameterName; break; - case WirePortDataType.FLOAT: - { - result = ( useRealValue ) ? vecVal.x.ToString() : parameterName + ".x"; - } - break; - case WirePortDataType.FLOAT2: - { - result = ( useRealValue ) ? precisionStr + "2( " + vecVal.x + " , " + vecVal.y + " )" : parameterName + ".xy"; - } - break; - case WirePortDataType.COLOR: - case WirePortDataType.FLOAT4: - { - result = ( useRealValue ) ? precisionStr + "4( " + vecVal.x + " , " + vecVal.y + " , " + vecVal.z + " , 0.0 )" : precisionStr + "4( " + parameterName + " , 0.0 )"; - } - break; - //case WirePortDataType.FLOAT3x3: - //{ - // if ( useRealValue ) - // { - // result = precisionStr + "3x3( " + vecVal.x + " , " + vecVal.y + " , " + vecVal.z + " , " + - // vecVal.x + " , " + vecVal.y + " , " + vecVal.z + " , " + - // vecVal.x + " , " + vecVal.y + " , " + vecVal.z + " )"; - // } - // else - // { - // string localVal = CreateLocalValueName( currentPrecision, newType, localVarName, parameterName ); - // CurrentDataCollector.AddToLocalVariables( portCategory, -1, localVal ); - // result = precisionStr + "3x3( " + localVarName + ".x , " + localVarName + ".y , " + localVarName + ".x , " + - // localVarName + ".x , " + localVarName + ".y , " + localVarName + ".y , " + - // localVarName + ".x , " + localVarName + ".y , " + localVarName + ".z )"; - // } - //} - //break; - //case WirePortDataType.FLOAT4x4: - //{ - // if ( useRealValue ) - // { - // result = precisionStr + "4x4( " + vecVal + ".x , " + vecVal + ".y , " + vecVal + ".z , 0 , " + - // vecVal + ".x , " + vecVal + ".y , " + vecVal + ".z , 0 , " + - // vecVal + ".x , " + vecVal + ".y , " + vecVal + ".z , 0 , " + - // vecVal + ".x , " + vecVal + ".y , " + vecVal + ".z , 0 )"; - // } - // else - // { - // string localVal = CreateLocalValueName( currentPrecision, newType, localVarName, parameterName ); - // CurrentDataCollector.AddToLocalVariables( portCategory, -1, localVal ); - // result = precisionStr + "4x4( " + localVarName + ".x , " + localVarName + ".y , " + localVarName + ".z , 0 , " + - // localVarName + ".x , " + localVarName + ".y , " + localVarName + ".z , 0 , " + - // localVarName + ".x , " + localVarName + ".y , " + localVarName + ".z , 0 , " + - // localVarName + ".x , " + localVarName + ".y , " + localVarName + ".z , 0 )"; - // } - //} - //break; - } - } - break; - case WirePortDataType.FLOAT4: - { - Vector4 vecVal = useRealValue ? (Vector4)value : Vector4.zero; - switch( newType ) - { - case WirePortDataType.OBJECT: result = useRealValue ? precisionStr + "4( " + vecVal.x + " , " + vecVal.y + " , " + vecVal.z + " , " + vecVal.w + " )" : parameterName; break; - case WirePortDataType.FLOAT: - { - result = ( useRealValue ) ? vecVal.x.ToString() : parameterName + ".x"; - } - break; - case WirePortDataType.FLOAT2: - { - result = ( useRealValue ) ? precisionStr + "2( " + vecVal.x + " , " + vecVal.y + " )" : parameterName + ".xy"; - } - break; - case WirePortDataType.FLOAT3: - { - result = ( useRealValue ) ? precisionStr + "3( " + vecVal.x + " , " + vecVal.y + " , " + vecVal.z + " )" : parameterName + ".xyz"; - } - break; - //case WirePortDataType.FLOAT4x4: - //{ - // if ( useRealValue ) - // { - // result = precisionStr + "4x4( " + vecVal + ".x , " + vecVal + ".y , " + vecVal + ".z , " + vecVal + ".w , " + - // vecVal + ".x , " + vecVal + ".y , " + vecVal + ".z , " + vecVal + ".w , " + - // vecVal + ".x , " + vecVal + ".y , " + vecVal + ".z , " + vecVal + ".w , " + - // vecVal + ".x , " + vecVal + ".y , " + vecVal + ".z , " + vecVal + ".w )"; - // } - // else - // { - // string localVal = CreateLocalValueName( currentPrecision, newType, localVarName, parameterName ); - // CurrentDataCollector.AddToLocalVariables( portCategory, -1, localVal ); - // result = precisionStr + "4x4( " + localVarName + ".x , " + localVarName + ".y , " + localVarName + ".z , " + localVarName + ".w , " + - // localVarName + ".x , " + localVarName + ".y , " + localVarName + ".z , " + localVarName + ".w , " + - // localVarName + ".x , " + localVarName + ".y , " + localVarName + ".z , " + localVarName + ".w , " + - // localVarName + ".x , " + localVarName + ".y , " + localVarName + ".z , " + localVarName + ".w )"; - // } - //} - //break; - case WirePortDataType.COLOR: - { - result = useRealValue ? precisionStr + "4( " + vecVal.x + " , " + vecVal.y + " , " + vecVal.z + " , " + vecVal.w + " )" : parameterName; - } - break; - } - } - break; - case WirePortDataType.FLOAT3x3: - { - //Matrix4x4 matrixVal = useRealValue ? ( Matrix4x4 ) value : Matrix4x4.identity; - //switch ( newType ) - //{ - // case WirePortDataType.OBJECT: - // case WirePortDataType.FLOAT4x4: - // { - // result = ( useRealValue ) ? precisionStr + "4x4(" + matrixVal.m00 + " , " + matrixVal.m01 + " , " + matrixVal.m02 + " , " + matrixVal.m03 + " , " + - // matrixVal.m10 + " , " + matrixVal.m11 + " , " + matrixVal.m12 + " , " + matrixVal.m10 + " , " + - // matrixVal.m20 + " , " + matrixVal.m21 + " , " + matrixVal.m22 + " , " + matrixVal.m20 + " , " + - // matrixVal.m30 + " , " + matrixVal.m31 + " , " + matrixVal.m32 + " , " + matrixVal.m30 + " )" : precisionStr + "4x4(" + parameterName + ")"; - // } - // break; - //} - } - break; - case WirePortDataType.FLOAT4x4: - { - Matrix4x4 matrixVal = useRealValue ? (Matrix4x4)value : Matrix4x4.identity; - switch( newType ) - { - case WirePortDataType.OBJECT: - { - result = ( useRealValue ) ? precisionStr + "4x4(" + matrixVal.m00 + " , " + matrixVal.m01 + " , " + matrixVal.m02 + " , " + matrixVal.m03 + " , " + - matrixVal.m10 + " , " + matrixVal.m11 + " , " + matrixVal.m12 + " , " + matrixVal.m10 + " , " + - matrixVal.m20 + " , " + matrixVal.m21 + " , " + matrixVal.m22 + " , " + matrixVal.m20 + " , " + - matrixVal.m30 + " , " + matrixVal.m31 + " , " + matrixVal.m32 + " , " + matrixVal.m30 + " )" : parameterName; - } - break; - } - } - break; - case WirePortDataType.COLOR: - { - Color colorValue = ( useRealValue ) ? (Color)value : Color.black; - switch( newType ) - { - case WirePortDataType.OBJECT: result = useRealValue ? precisionStr + "4( " + colorValue.r + " , " + colorValue.g + " , " + colorValue.b + " , " + colorValue.a + " )" : parameterName; break; - case WirePortDataType.FLOAT: - { - result = ( useRealValue ) ? colorValue.r.ToString() : parameterName + ".r"; - } - break; - case WirePortDataType.FLOAT2: - { - result = ( useRealValue ) ? precisionStr + "2( " + colorValue.r + " , " + colorValue.g + " )" : parameterName + ".rg"; - } - break; - case WirePortDataType.FLOAT3: - { - result = ( useRealValue ) ? precisionStr + "3( " + colorValue.r + " , " + colorValue.g + " , " + colorValue.b + " )" : parameterName + ".rgb"; - } - break; - case WirePortDataType.FLOAT4: - { - result = useRealValue ? precisionStr + "4( " + colorValue.r + " , " + colorValue.g + " , " + colorValue.b + " , " + colorValue.a + " )" : parameterName; - } - break; - //case WirePortDataType.FLOAT4x4: - //{ - // if ( useRealValue ) - // { - // result = precisionStr + "4x4( " + colorValue.r + " , " + colorValue.g + " , " + colorValue.b + " , " + colorValue.a + " , " + - // colorValue.r + " , " + colorValue.g + " , " + colorValue.b + " , " + colorValue.a + " , " + - // colorValue.r + " , " + colorValue.g + " , " + colorValue.b + " , " + colorValue.a + " , " + - // colorValue.r + " , " + colorValue.g + " , " + colorValue.b + " , " + colorValue.a + " )"; - // } - // else - // { - // string localVal = CreateLocalValueName( currentPrecision, newType, localVarName, parameterName ); - // CurrentDataCollector.AddToLocalVariables( portCategory, -1, localVal ); - - // result = precisionStr + "4x4( " + localVarName + ".x , " + localVarName + ".y , " + localVarName + ".z , " + localVarName + ".w , " + - // localVarName + ".x , " + localVarName + ".y , " + localVarName + ".z , " + localVarName + ".w , " + - // localVarName + ".x , " + localVarName + ".y , " + localVarName + ".z , " + localVarName + ".w , " + - // localVarName + ".x , " + localVarName + ".y , " + localVarName + ".z , " + localVarName + ".w )"; - // } - //} - //break; - } - } - break; - case WirePortDataType.INT: - { - switch( newType ) - { - case WirePortDataType.OBJECT: result = useRealValue ? value.ToString() : parameterName; break; - case WirePortDataType.FLOAT2: - case WirePortDataType.FLOAT3: - case WirePortDataType.COLOR: - case WirePortDataType.FLOAT4: - { - string localVal = CreateLocalValueName( currentPrecision, newType, localVarName, ( ( useRealValue ) ? value.ToString() : parameterName ) ); - dataCollector.AddToLocalVariables( dataCollector.PortCategory, -1, localVal ); - result = localVarName; - } - break; - case WirePortDataType.FLOAT3x3: - { - string localVal = CreateLocalValueName( currentPrecision, oldType, localVarName, ( ( useRealValue ) ? value.ToString() : parameterName ) ); - dataCollector.AddToLocalVariables( dataCollector.PortCategory, -1, localVal ); - result = localVarName; - } - break; - case WirePortDataType.FLOAT4x4: - { - string localVal = CreateLocalValueName( currentPrecision, oldType, localVarName, ( ( useRealValue ) ? value.ToString() : parameterName ) ); - dataCollector.AddToLocalVariables( dataCollector.PortCategory, -1, localVal ); - result = localVarName; - } - break; - case WirePortDataType.FLOAT: - { - result = ( useRealValue ) ? ( (int)value ).ToString() : "(float)" + parameterName; - } - break; - } - } - break; - - } - if( result.Equals( string.Empty ) ) - { - result = "0"; - string warningStr = string.Format( "Unable to cast from {0} to {1}. Generating dummy data ( {2} )", oldType, newType, result ); - - if( oldType == WirePortDataType.SAMPLER1D || oldType == WirePortDataType.SAMPLER2D || oldType == WirePortDataType.SAMPLER3D || oldType == WirePortDataType.SAMPLERCUBE ) - { - warningStr = string.Format( "Unable to cast from {0} to {1}. You might want to use a Texture Sample node and connect it to the 'Tex' port. Generating dummy data ( {2} )", oldType, newType, result ); - } - ShowMessage( warningStr, MessageSeverity.Warning ); - } - return result; - } - - public static bool CanCast( WirePortDataType from, WirePortDataType to ) - { - if( from == WirePortDataType.OBJECT || to == WirePortDataType.OBJECT || from == to ) - return true; - - switch( from ) - { - case WirePortDataType.FLOAT: - { - if( to == WirePortDataType.INT ) - return true; - } - break; - case WirePortDataType.FLOAT2: - { - return false; - } - case WirePortDataType.FLOAT3: - { - if( to == WirePortDataType.COLOR || - to == WirePortDataType.FLOAT4 ) - return true; - } - break; - case WirePortDataType.FLOAT4: - { - if( to == WirePortDataType.FLOAT3 || - to == WirePortDataType.COLOR ) - return true; - } - break; - case WirePortDataType.FLOAT3x3: - { - if( to == WirePortDataType.FLOAT4x4 ) - return true; - } - break; - case WirePortDataType.FLOAT4x4: - { - if( to == WirePortDataType.FLOAT3x3 ) - return true; - } - break; - case WirePortDataType.COLOR: - { - if( to == WirePortDataType.FLOAT3 || - to == WirePortDataType.FLOAT4 ) - return true; - - } - break; - case WirePortDataType.INT: - { - if( to == WirePortDataType.FLOAT ) - return true; - } - break; - } - - return false; - } - - public static int GetChannelsAmount( WirePortDataType type ) - { - switch( type ) - { - case WirePortDataType.OBJECT: return 0; - case WirePortDataType.FLOAT: return 1; - case WirePortDataType.FLOAT2: return 2; - case WirePortDataType.FLOAT3: return 3; - case WirePortDataType.FLOAT4: return 4; - case WirePortDataType.FLOAT3x3: return 9; - case WirePortDataType.FLOAT4x4: return 16; - case WirePortDataType.COLOR: return 4; - case WirePortDataType.INT: return 1; - case WirePortDataType.UINT: return 1; - } - return 0; - } - - public static WirePortDataType GetWireTypeForChannelAmount( int channelAmount ) - { - switch( channelAmount ) - { - case 1: return WirePortDataType.FLOAT; - case 2: return WirePortDataType.FLOAT2; - case 3: return WirePortDataType.FLOAT3; - case 4: return WirePortDataType.FLOAT4; - case 9: return WirePortDataType.FLOAT3x3; - case 16: return WirePortDataType.FLOAT4x4; - } - return WirePortDataType.FLOAT; - } - - public static string GenerateUniformName( bool excludeUniformKeyword, WirePortDataType dataType, string dataName ) - { - return GenerateUniformName( excludeUniformKeyword, WirePortToCgType( dataType ), dataName ); - } - - public static string GenerateUniformName( bool excludeUniformKeyword, string dataType, string dataName ) - { - int index = excludeUniformKeyword ? 1 : 0; - return string.Format( Constants.UniformDec[index], dataType, dataName ); - } - - public static string GeneratePropertyName( string name, PropertyType propertyType, bool forceUnderscore = false ) - { - if( string.IsNullOrEmpty( name ) ) - return name; - - name = RemoveInvalidCharacters( name ); - if( propertyType != PropertyType.Global || forceUnderscore ) - { - if( name[ 0 ] != '_' ) - { - name = '_' + name; - } - } - - return name; - } - - public static string UrlReplaceInvalidStrings( string originalString ) - { - for( int i = 0; i < Constants.UrlReplacementStringValuesLen; i++ ) - { - originalString = originalString.Replace( Constants.UrlReplacementStringValues[i,0], Constants.UrlReplacementStringValues[i,1] ); - } - return originalString; - } - - public static string ReplaceInvalidStrings( string originalString ) - { - for(int i = 0; i< Constants.ReplacementStringValuesLen;i++ ) - { - originalString = originalString.Replace( Constants.ReplacementStringValues[i,0], Constants.ReplacementStringValues[ i, 1 ] ); - } - return originalString; - } - - public static string RemoveWikiInvalidCharacters( string originalString ) - { - for( int i = 0; i < Constants.WikiInvalidChars.Length; i++ ) - { - originalString = originalString.Replace( Constants.WikiInvalidChars[ i ], string.Empty ); - } - return originalString; - } - - public static string RemoveInvalidEnumCharacters( string originalString ) - { - for( int i = 0; i < Constants.EnumInvalidChars.Length; i++ ) - { - originalString = originalString.Replace( Constants.EnumInvalidChars[ i ], string.Empty ); - } - return originalString; - } - - public static string RemoveInvalidAttrCharacters( string originalString ) - { - for( int i = 0; i < Constants.AttrInvalidChars.Length; i++ ) - { - originalString = originalString.Replace( Constants.AttrInvalidChars[ i ], string.Empty ); - } - return originalString; - } - - public static string RemoveInvalidCharacters( string originalString ) - { - for( int i = 0; i < Constants.OverallInvalidChars.Length; i++ ) - { - originalString = originalString.Replace( Constants.OverallInvalidChars[ i ], string.Empty ); - } - return originalString; - } - - public static string RemoveShaderInvalidCharacters( string originalString ) - { - originalString = originalString.Replace( '\\', '/' ); - for( int i = 0; i < Constants.ShaderInvalidChars.Length; i++ ) - { - originalString = originalString.Replace( Constants.ShaderInvalidChars[ i ], string.Empty ); - } - return originalString; - } - - public static bool IsUnityNativeShader( Shader shader ) - { - string pathName = AssetDatabase.GetAssetPath( shader ); - - if( pathName.Contains( "unity_builtin_extra") || - pathName.Contains( "unity default resources" )) - return true; - - return false; - } - public static bool IsUnityNativeShader( string path ) { return m_unityNativeShaderPaths.ContainsKey( path ); } - - public static string GetComponentForPosition( int pos, WirePortDataType type, bool addDot = false ) - { - string result = addDot ? "." : string.Empty; - switch( pos ) - { - case 0: - { - return ( ( type == WirePortDataType.COLOR ) ? ( result + "r" ) : ( result + "x" ) ); - } - case 1: - { - return ( ( type == WirePortDataType.COLOR ) ? ( result + "g" ) : ( result + "y" ) ); - } - case 2: - { - return ( ( type == WirePortDataType.COLOR ) ? ( result + "b" ) : ( result + "z" ) ); - } - case 3: - { - return ( ( type == WirePortDataType.COLOR ) ? ( result + "a" ) : ( result + "w" ) ); - } - } - return string.Empty; - } - - public static string InvalidParameter( ParentNode node ) - { - ShowMessage( node.UniqueId, "Invalid entrance type on node" + node, MessageSeverity.Error ); - return "0"; - } - - public static string NoConnection( ParentNode node ) - { - ShowMessage( node.UniqueId, "No Input connection on node" + node, MessageSeverity.Error ); - return "0"; - } - - public static string UnknownError( ParentNode node ) - { - ShowMessage( node.UniqueId, "Unknown error on node" + node, MessageSeverity.Error ); - return "0"; - } - - public static string GetTex2DProperty( string name, TexturePropertyValues defaultValue ) { return name + "(\"" + name + "\", 2D) = \"" + defaultValue + "\" {}"; } - public static string AddBrackets( string value ) { return "( " + value + " )"; } - public static Color GetColorFromWireStatus( WireStatus status ) { return m_wireStatusToColor[ status ]; } - public static bool HasColorCategory( string category ) { return m_nodeCategoryToColor.ContainsKey( category ); } - public static void AddColorCategory( string category, Color color ) - { - m_nodeCategoryToColor.Add( category, color ); - } - - public static Color AddColorCategory( string category, string hexColor ) - { - try - { - Color color = new Color(); - ColorUtility.TryParseHtmlString( hexColor, out color ); - m_nodeCategoryToColor.Add( category, color ); - return color; - } - catch( System.Exception e ) - { - Debug.LogException( e ); - } - return m_nodeCategoryToColor[ "Default" ]; - } - - public static Color GetColorFromCategory( string category ) - { - if( m_nodeCategoryToColor.ContainsKey( category ) ) - return m_nodeCategoryToColor[ category ]; - - - if(DebugConsoleWindow.DeveloperMode) - Debug.LogWarning( category + " category does not contain an associated color" ); - - return m_nodeCategoryToColor[ "Default" ]; - } - - public static string LatestOpenedFolder - { - get { return m_latestOpenedFolder; } - set { m_latestOpenedFolder = value; } - } - - public static Shader CreateNewUnlit() - { - if( CurrentWindow == null ) - return null; - - string shaderName; - string pathName; - Shader newShader = null; - IOUtils.GetShaderName( out shaderName, out pathName, "MyUnlitShader", m_latestOpenedFolder ); - if( !System.String.IsNullOrEmpty( shaderName ) && !System.String.IsNullOrEmpty( pathName ) ) - { - CurrentWindow.CreateNewGraph( shaderName ); - CurrentWindow.PreMadeShadersInstance.FlatColorSequence.Execute(); - - CurrentWindow.CurrentGraph.CurrentMasterNode.SetName( shaderName ); - newShader = CurrentWindow.CurrentGraph.FireMasterNode( pathName, true ); - AssetDatabase.Refresh(); - } - return newShader; - } - - public static Shader CreateNewEmpty( string customPath = null , string customShaderName = null ) - { - if( CurrentWindow == null ) - return null; - - string shaderName; - string pathName; - Shader newShader = null; - - - string path = AssetDatabase.GetAssetPath( Selection.activeObject ); - if( path == "" ) - { - path = "Assets"; - } - else if( System.IO.Path.GetExtension( path ) != "" ) - { - path = path.Replace( System.IO.Path.GetFileName( AssetDatabase.GetAssetPath( Selection.activeObject ) ), "" ); - } - - - if( string.IsNullOrEmpty( customPath ) ) - { - IOUtils.GetShaderName( out shaderName, out pathName, Constants.DefaultShaderName, m_latestOpenedFolder ); - } - else - { - pathName = customPath; - if( string.IsNullOrEmpty( customShaderName ) ) - { - shaderName = Constants.DefaultShaderName; - int indexOfAssets = pathName.IndexOf( "Assets" ); - string uniquePath = ( indexOfAssets > 0 ) ? pathName.Remove( 0, indexOfAssets ) : pathName; - string assetPathAndName = AssetDatabase.GenerateUniqueAssetPath( uniquePath + shaderName + ".shader" ); - pathName = assetPathAndName; - shaderName = assetPathAndName.Remove( 0, assetPathAndName.IndexOf( shaderName ) ); - } - else - { - shaderName = customShaderName; - } - shaderName = shaderName.Remove( shaderName.Length - 7 ); - } - if( !System.String.IsNullOrEmpty( shaderName ) && !System.String.IsNullOrEmpty( pathName ) ) - { - m_latestOpenedFolder = pathName; - - CurrentWindow.titleContent.text = AmplifyShaderEditorWindow.GenerateTabTitle( shaderName ); - CurrentWindow.titleContent.image = ShaderIcon; - CurrentWindow.CreateNewGraph( shaderName ); - CurrentWindow.LastOpenedLocation = pathName; - CurrentWindow.CurrentGraph.CurrentMasterNode.SetName( shaderName ); - newShader = CurrentWindow.CurrentGraph.FireMasterNode( pathName, true ); - AssetDatabase.Refresh(); - } - - return newShader; - } - - - public static Shader CreateNewEmptyTemplate( string templateGUID, string customPath = null, string customShaderName = null ) - { - if( CurrentWindow == null ) - return null; - - string shaderName; - string pathName; - Shader newShader = null; - - - string path = AssetDatabase.GetAssetPath( Selection.activeObject ); - if( path == "" ) - { - path = "Assets"; - } - else if( System.IO.Path.GetExtension( path ) != "" ) - { - path = path.Replace( System.IO.Path.GetFileName( AssetDatabase.GetAssetPath( Selection.activeObject ) ), "" ); - } - - - if( string.IsNullOrEmpty( customPath ) ) - { - IOUtils.GetShaderName( out shaderName, out pathName, Constants.DefaultShaderName, m_latestOpenedFolder ); - } - else - { - pathName = customPath; - if( string.IsNullOrEmpty( customShaderName ) ) - { - shaderName = Constants.DefaultShaderName; - int indexOfAssets = pathName.IndexOf( "Assets" ); - string uniquePath = ( indexOfAssets > 0 ) ? pathName.Remove( 0, indexOfAssets ) : pathName; - string assetPathAndName = AssetDatabase.GenerateUniqueAssetPath( uniquePath + shaderName + ".shader" ); - pathName = assetPathAndName; - shaderName = assetPathAndName.Remove( 0, assetPathAndName.IndexOf( shaderName ) ); - } - else - { - shaderName = customShaderName; - } - shaderName = shaderName.Remove( shaderName.Length - 7 ); - } - if( !System.String.IsNullOrEmpty( shaderName ) && !System.String.IsNullOrEmpty( pathName ) ) - { - m_latestOpenedFolder = pathName; - - CurrentWindow.titleContent.text = AmplifyShaderEditorWindow.GenerateTabTitle( shaderName ); - CurrentWindow.titleContent.image = UIUtils.ShaderIcon; - CurrentWindow.CreateNewTemplateGraph( templateGUID ); - CurrentWindow.CurrentGraph.CurrentMasterNode.SetName( shaderName ); - newShader = CurrentWindow.CurrentGraph.FireMasterNode( pathName, true ); - AssetDatabase.Refresh(); - } - - return newShader; - } - - - public static void SetDelayedMaterialMode( Material material ) - { - if( CurrentWindow == null ) - return; - CurrentWindow.SetDelayedMaterialMode( material ); - } - - public static void CreateEmptyFromInvalid( Shader shader ) - { - if( CurrentWindow == null ) - return; - - CurrentWindow.CreateNewGraph( shader ); - CurrentWindow.ForceRepaint(); - } - - public static void CreateEmptyFunction( AmplifyShaderFunction shaderFunction ) - { - if( CurrentWindow == null ) - return; - - CurrentWindow.CreateNewFunctionGraph( shaderFunction ); - CurrentWindow.SaveToDisk( false ); - CurrentWindow.ForceRepaint(); - } - - public static void DrawFloat( UndoParentNode owner, ref Rect propertyDrawPos, ref float value, float newLabelWidth = 8 ) - { - float labelWidth = EditorGUIUtility.labelWidth; - EditorGUIUtility.labelWidth = newLabelWidth; - value = owner.EditorGUIFloatField( propertyDrawPos, " ", value, UIUtils.MainSkin.textField ); - EditorGUIUtility.labelWidth = labelWidth; - } - - public static GUIStyle GetCustomStyle( CustomStyle style ) - { - return ( Initialized ) ? MainSkin.customStyles[ (int)style ] : null; - } - - public static void SetCustomStyle( CustomStyle style, GUIStyle guiStyle ) - { - if( MainSkin != null ) - MainSkin.customStyles[ (int)style ] = new GUIStyle( guiStyle ); - } - - public static void OpenFile() - { - if( CurrentWindow == null ) - return; - string newShader = EditorUtility.OpenFilePanel( "Select Shader to open", m_latestOpenedFolder, "shader" ); - if( !System.String.IsNullOrEmpty( newShader ) ) - { - m_latestOpenedFolder = newShader.Substring( 0, newShader.LastIndexOf( '/' ) + 1 ); - int relFilenameId = newShader.IndexOf( Application.dataPath ); - if( relFilenameId > -1 ) - { - string relFilename = newShader.Substring( relFilenameId + Application.dataPath.Length - 6 );// -6 need to also copy the assets/ part - CurrentWindow.LoadFromDisk( relFilename ); - } - else - { - ShowMessage( "Can only load shaders\nfrom inside the projects folder", MessageSeverity.Error ); - } - } - } - - public static bool DetectNodeLoopsFrom( ParentNode node, Dictionary<int, int> currentNodes ) - { - for( int i = 0; i < node.InputPorts.Count; i++ ) - { - if( node.InputPorts[ i ].IsConnected ) - { - ParentNode newNode = node.InputPorts[ i ].GetOutputNode(); - if( !currentNodes.ContainsKey( newNode.UniqueId ) ) - RecursiveNodeFill( newNode, currentNodes ); - } - } - - bool found = currentNodes.ContainsKey( node.UniqueId ); - currentNodes.Clear(); - currentNodes = null; - - return found; - } - - private static void RecursiveNodeFill( ParentNode node, Dictionary<int, int> currentNodes ) - { - if( !currentNodes.ContainsKey( node.UniqueId ) ) - currentNodes.Add( node.UniqueId, 1 ); - - for( int i = 0; i < node.InputPorts.Count; i++ ) - { - if( node.InputPorts[ i ].IsConnected ) - { - ParentNode newNode = node.InputPorts[ i ].GetOutputNode(); - if( !currentNodes.ContainsKey( newNode.UniqueId ) ) - RecursiveNodeFill( newNode, currentNodes ); - } - } - } - - public static ParentNode CreateNode( System.Type type, bool registerUndo, Vector2 pos, int nodeId = -1, bool addLast = true ) - { - if( CurrentWindow != null ) - { - return CurrentWindow.CurrentGraph.CreateNode( type, registerUndo, pos, nodeId, addLast ); - } - return null; - } - - public static void DestroyNode( int nodeId ) - { - if( CurrentWindow != null ) - { - CurrentWindow.CurrentGraph.DestroyNode( nodeId ); - } - } - - public static void ShowMessage( int ownerId, string message, MessageSeverity severity = MessageSeverity.Normal, bool registerTimestamp = true ) - { - if( CurrentWindow != null ) - { - CurrentWindow.ShowMessage( ownerId, message, severity, registerTimestamp ); - } - } - - public static void ShowMessage( string message, MessageSeverity severity = MessageSeverity.Normal, bool registerTimestamp = true ) - { - if( CurrentWindow != null ) - { - CurrentWindow.ShowMessage( message, severity, registerTimestamp ); - } - } - - public static ParentNode GetNode( int nodeId ) - { - if( CurrentWindow != null ) - { - return CurrentWindow.CurrentGraph.GetNode( nodeId ); - } - return null; - } - - public static PropertyNode GetInternalTemplateNode( int nodeId ) - { - if( CurrentWindow != null ) - { - return CurrentWindow.CurrentGraph.GetInternalTemplateNode( nodeId ); - } - return null; - } - - public static PropertyNode GetInternalTemplateNode( string propertyName ) - { - if( CurrentWindow != null ) - { - return CurrentWindow.CurrentGraph.GetInternalTemplateNode( propertyName ); - } - return null; - } - - - public static void DeleteConnection( bool isInput, int nodeId, int portId, bool registerOnLog, bool propagateCallback ) - { - if( CurrentWindow != null ) - { - CurrentWindow.DeleteConnection( isInput, nodeId, portId, registerOnLog, propagateCallback ); - } - } - - public static void ConnectInputToOutput( int inNodeId, int inPortId, int outNodeId, int outPortId ) - { - if( CurrentWindow != null ) - { - CurrentWindow.ConnectInputToOutput( inNodeId, inPortId, outNodeId, outPortId ); - } - } - - public static Shader CreateNewGraph( string name ) - { - if( CurrentWindow != null ) - { - return CurrentWindow.CreateNewGraph( name ); - } - return null; - } - public static void SetConnection( int InNodeId, int InPortId, int OutNodeId, int OutPortId ) - { - if( CurrentWindow != null ) - { - CurrentWindow.CurrentGraph.SetConnection( InNodeId, InPortId, OutNodeId, OutPortId ); - } - } - - public static bool IsChannelAvailable( int channelId ) - { - if( CurrentWindow != null ) - { - return CurrentWindow.DuplicatePrevBufferInstance.IsChannelAvailable( channelId ); - } - return false; - } - - public static bool ReleaseUVChannel( int nodeId, int channelId ) - { - if( CurrentWindow != null ) - { - return CurrentWindow.DuplicatePrevBufferInstance.ReleaseUVChannel( nodeId, channelId ); - } - return false; - } - - public static bool RegisterUVChannel( int nodeId, int channelId, string name ) - { - if( CurrentWindow != null ) - { - return CurrentWindow.DuplicatePrevBufferInstance.RegisterUVChannel( nodeId, channelId, name ); - } - return false; - } - - public static void GetFirstAvailableName( int nodeId, WirePortDataType type, out string outProperty, out string outInspector, bool useCustomPrefix = false, string customPrefix = null ) - { - outProperty = string.Empty; - outInspector = string.Empty; - if( CurrentWindow != null ) - { - CurrentWindow.DuplicatePrevBufferInstance.GetFirstAvailableName( nodeId, type, out outProperty, out outInspector, useCustomPrefix, customPrefix ); - } - } - - - public static bool IsNumericName( string name ) - { - Match match = Regex.Match( name, NumericNamePattern ); - if( match != null && match.Success ) - return true; - return false; - } - - public static bool CheckInvalidUniformName( string name ) - { - if( m_reservedPropertyNames.ContainsKey( name ) ) - { - ShowMessage( string.Format( Constants.ReservedPropertyNameStr, name ) ); - return true; - } - - if( IsNumericName( name )) - { - ShowMessage( string.Format( Constants.NumericPropertyNameStr, name ) ); - return true; - } - - return false; - } - - public static bool RegisterUniformName( int nodeId, string name ) - { - if( CheckInvalidUniformName( name ) ) - { - return false; - } - - if( CurrentWindow != null ) - { - return CurrentWindow.DuplicatePrevBufferInstance.RegisterUniformName( nodeId, name ); - } - return false; - } - - public static bool ReleaseUniformName( int nodeId, string name ) - { - if( CurrentWindow != null ) - { - return CurrentWindow.DuplicatePrevBufferInstance.ReleaseUniformName( nodeId, name ); - } - return false; - } - - public static bool IsUniformNameAvailable( string name ) - { - if( CheckInvalidUniformName( name ) ) - { - return false; - } - - if( CurrentWindow != null ) - { - return CurrentWindow.DuplicatePrevBufferInstance.IsUniformNameAvailable( name ); - } - return false; - } - - public static int CheckUniformNameOwner( string name ) - { - if( CurrentWindow != null ) - { - return CurrentWindow.DuplicatePrevBufferInstance.CheckUniformNameOwner( name ); - } - return -1; - } - - public static string GetUniqueUniformName( string name ) - { - int num = 0; - Regex reg = new Regex( @"([0-9]+)$" ); - Match match = reg.Match( name ); - if( match.Success ) - { - string s = match.Groups[ 1 ].Captures[ 0 ].Value; - num = int.Parse( s ); - name = name.Replace( s, "" ); - } - - for( int i = num + 1; i < 1000; i++ ) - { - string testName = name + i; - - if( CheckInvalidUniformName( testName ) ) - { - continue; - } - - if( CurrentWindow != null ) - { - if( CurrentWindow.DuplicatePrevBufferInstance.IsUniformNameAvailable( testName ) ) - { - return testName; - } - } - } - return name; - } - - public static bool RegisterLocalVariableName( int nodeId, string name ) - { - if( CurrentWindow != null ) - { - return CurrentWindow.DuplicatePrevBufferInstance.RegisterLocalVariableName( nodeId, name ); - } - return false; - } - - public static bool ReleaseLocalVariableName( int nodeId, string name ) - { - if( CurrentWindow != null ) - { - return CurrentWindow.DuplicatePrevBufferInstance.ReleaseLocalVariableName( nodeId, name ); - } - return false; - } - - public static bool IsLocalvariableNameAvailable( string name ) - { - if( CurrentWindow != null ) - { - return CurrentWindow.DuplicatePrevBufferInstance.IsLocalvariableNameAvailable( name ); - } - return false; - } - - public static string GetChannelName( int channelId ) - { - if( CurrentWindow != null ) - { - return CurrentWindow.DuplicatePrevBufferInstance.GetChannelName( channelId ); - } - return string.Empty; - } - - public static void SetChannelName( int channelId, string name ) - { - if( CurrentWindow != null ) - { - CurrentWindow.DuplicatePrevBufferInstance.SetChannelName( channelId, name ); - } - } - - public static int RegisterFirstAvailableChannel( int nodeId, string name ) - { - if( CurrentWindow != null ) - { - return CurrentWindow.DuplicatePrevBufferInstance.RegisterFirstAvailableChannel( nodeId, name ); - } - return -1; - } - - public static int PortCategorytoAttayIdx( MasterNodePortCategory category ) - { - if( m_portCategoryToArrayIdx.ContainsKey( category )) - return m_portCategoryToArrayIdx[category]; - - return m_portCategoryToArrayIdx[ MasterNodePortCategory.Fragment ]; - } - - public static bool DisplayDialog( string shaderPath ) - { - string value = System.String.Format( "Save changes to the shader {0} before closing?", shaderPath ); - return EditorUtility.DisplayDialog( "Load selected", value, "Yes", "No" ); - } - - public static void ForceUpdateFromMaterial() - { - if( CurrentWindow != null ) - { - // CurrentWindow.Focus(); - CurrentWindow.ForceUpdateFromMaterial(); - } - } - - public static void MarkToRepaint() { if( CurrentWindow != null ) CurrentWindow.MarkToRepaint(); } - public static void RequestSave() { if( CurrentWindow != null ) CurrentWindow.RequestSave(); } - public static string FloatToString( float value ) - { - string floatStr = value.ToString(); - if( value % 1 == 0 ) - { - floatStr += ".0"; - } - return floatStr; - } - - public static int CurrentShaderVersion() - { - if( CurrentWindow != null ) - { - return CurrentWindow.CurrentGraph.LoadedShaderVersion; - } - return -1; - } - - public static bool IsProperty( PropertyType type ) { return ( type == PropertyType.Property || type == PropertyType.InstancedProperty ); } - - public static MasterNode CurrentMasterNode() - { - if( CurrentWindow != null ) - { - return CurrentWindow.CurrentGraph.CurrentMasterNode; - } - return null; - } - - public static void AddVirtualTextureCount() { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.AddVirtualTextureCount(); } } - - public static bool HasVirtualTexture() - { - if( CurrentWindow != null ) - { - return CurrentWindow.CurrentGraph.HasVirtualTexture; - } - return false; - } - - public static void RemoveVirtualTextureCount() { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.RemoveVirtualTextureCount(); } } - - //public static void AddInstancePropertyCount() { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.AddInstancePropertyCount(); } } - - public static bool IsInstancedShader() - { - if( CurrentWindow != null ) - { - return CurrentWindow.CurrentGraph.IsInstancedShader; - } - return false; - } - - //public static void RemoveInstancePropertyCount() { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.RemoveInstancePropertyCount(); } } - //public static void AddNormalDependentCount() { if ( CurrentWindow != null ) { CurrentWindow.CurrentGraph.AddNormalDependentCount(); } } - //public static void RemoveNormalDependentCount() { if ( CurrentWindow != null ) { CurrentWindow.CurrentGraph.RemoveNormalDependentCount(); } } - //public static bool IsNormalDependent() - //{ - // if ( CurrentWindow != null ) - // { - // return CurrentWindow.CurrentGraph.IsNormalDependent; - // } - // return false; - //} - - public static void CopyValuesFromMaterial( Material mat ) - { - if( CurrentWindow != null && CurrentWindow.CurrentMaterial == mat ) - { - CurrentWindow.CurrentGraph.CopyValuesFromMaterial( mat ); - } - else - { - int aseWindowCount = IOUtils.AllOpenedWindows.Count; - for( int i = 0; i < aseWindowCount; i++ ) - { - if( IOUtils.AllOpenedWindows[ i ] != m_currentWindow && IOUtils.AllOpenedWindows[ i ].CurrentMaterial == mat ) - { - IOUtils.AllOpenedWindows[ i ].CurrentGraph.CopyValuesFromMaterial( mat ); - break; - } - } - } - } - - // Sampler Node - public static void RegisterSamplerNode( SamplerNode node ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.SamplerNodes.AddNode( node ); } } - public static void UnregisterSamplerNode( SamplerNode node ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.SamplerNodes.RemoveNode( node ); } } - public static string[] SamplerNodeArr() { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.SamplerNodes.NodesArr; } return null; } - public static SamplerNode GetSamplerNode( int idx ) { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.SamplerNodes.GetNode( idx ); } return null; } - public static void UpdateSamplerDataNode( int uniqueId, string data ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.SamplerNodes.UpdateDataOnNode( uniqueId, data ); } } - public static int GetSamplerNodeRegisterId( int uniqueId ) { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.SamplerNodes.GetNodeRegisterIdx( uniqueId ); } return -1; } - public static int GetSamplerNodeAmount() { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.SamplerNodes.NodesList.Count; } return -1; } - - // Float Node - public static void RegisterFloatIntNode( PropertyNode node ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.FloatIntNodes.AddNode( node ); } } - public static void UnregisterFloatIntNode( PropertyNode node ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.FloatIntNodes.RemoveNode( node ); } } - public static string[] FloatIntNodeArr() { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.FloatIntNodes.NodesArr; } return null; } - public static int[] FloatIntNodeIds() { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.FloatIntNodes.NodeIds; } return null; } - public static PropertyNode GetFloatIntNode( int idx ) { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.FloatIntNodes.GetNode( idx ); } return null; } - public static void UpdateFloatIntDataNode( int uniqueId, string data ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.FloatIntNodes.UpdateDataOnNode( uniqueId, data ); } } - public static int GetFloatIntNodeRegisterId( int uniqueId ) { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.FloatIntNodes.GetNodeRegisterIdx( uniqueId ); } return -1; } - public static int GetNodeIdByName( string name ) - { - if( CurrentWindow != null ) - { - UsageListFloatIntNodes list = CurrentWindow.CurrentGraph.FloatIntNodes; - int count = list.Count; - for( int i = 0; i < count; i++ ) - { - if( list.NodesList[ i ].PropertyName.Equals( name ) ) - return list.NodesList[ i ].UniqueId; - } - } - return -1; - } - public static PropertyNode GetFloatIntNodeByUniqueId( int uniqueId ) { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.FloatIntNodes.GetNodeByUniqueId( uniqueId ); } return null; } - //public static int GetFloatNodeAmount() { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.FloatNodes.NodesList.Count; } return -1; } - - // Texture Property - public static void RegisterTexturePropertyNode( TexturePropertyNode node ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.TexturePropertyNodes.AddNode( node ); } } - public static void UnregisterTexturePropertyNode( TexturePropertyNode node ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.TexturePropertyNodes.RemoveNode( node ); } } - public static string[] TexturePropertyNodeArr() { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.TexturePropertyNodes.NodesArr; } return null; } - public static TexturePropertyNode GetTexturePropertyNode( int idx ) { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.TexturePropertyNodes.GetNode( idx ); } return null; } - public static void UpdateTexturePropertyDataNode( int uniqueId, string data ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.TexturePropertyNodes.UpdateDataOnNode( uniqueId, data ); } } - public static int GetTexturePropertyNodeRegisterId( int uniqueId ) { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.TexturePropertyNodes.GetNodeRegisterIdx( uniqueId ); } return -1; } - public static int GetTexturePropertyNodeAmount() { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.TexturePropertyNodes.NodesList.Count; } return -1; } - - // Texture Array - public static void RegisterTextureArrayNode( TextureArrayNode node ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.TextureArrayNodes.AddNode( node ); } } - public static void UnregisterTextureArrayNode( TextureArrayNode node ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.TextureArrayNodes.RemoveNode( node ); } } - public static string[] TextureArrayNodeArr() { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.TextureArrayNodes.NodesArr; } return null; } - public static TextureArrayNode GetTextureArrayNode( int idx ) { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.TextureArrayNodes.GetNode( idx ); } return null; } - public static void UpdateTextureArrayDataNode( int uniqueId, string data ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.TextureArrayNodes.UpdateDataOnNode( uniqueId, data ); } } - public static int GetTextureArrayNodeRegisterId( int uniqueId ) { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.TextureArrayNodes.GetNodeRegisterIdx( uniqueId ); } return -1; } - public static int GetTextureArrayNodeAmount() { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.TextureArrayNodes.NodesList.Count; } return -1; } - - // Raw Property Node - public static void RegisterRawPropertyNode( PropertyNode node ) { if( CurrentWindow != null ) { CurrentWindow.OutsideGraph.RawPropertyNodes.AddNode( node ); } } - public static void UnregisterRawPropertyNode( PropertyNode node ) { if( CurrentWindow != null ) { CurrentWindow.OutsideGraph.RawPropertyNodes.RemoveNode( node ); } } - - // Property Node - public static void RegisterPropertyNode( PropertyNode node ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.PropertyNodes.AddNode( node ); } } - public static void UnregisterPropertyNode( PropertyNode node ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.PropertyNodes.RemoveNode( node ); } } - public static string[] PropertyNodeNodeArr() { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.PropertyNodes.NodesArr; } return null; } - public static PropertyNode GetPropertyNode( int idx ) { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.PropertyNodes.GetNode( idx ); } return null; } - public static PropertyNode GetPropertyNodeByUniqueId( int uniqueId ) { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.PropertyNodes.GetNodeByUniqueId( uniqueId ); } return null; } - public static void UpdatePropertyDataNode( int uniqueId, string data ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.PropertyNodes.UpdateDataOnNode( uniqueId, data ); } } - public static int GetPropertyNodeRegisterId( int uniqueId ) { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.PropertyNodes.GetNodeRegisterIdx( uniqueId ); } return -1; } - public static List<PropertyNode> PropertyNodesList() { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.PropertyNodes.NodesList; } return null; } - public static int GetPropertyNodeAmount() { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.PropertyNodes.NodesList.Count; } return -1; } - - // Function Inputs - public static void RegisterFunctionInputNode( FunctionInput node ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.FunctionInputNodes.AddNode( node ); } } - public static void UnregisterFunctionInputNode( FunctionInput node ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.FunctionInputNodes.RemoveNode( node ); } } - public static void UpdateFunctionInputData( int uniqueId, string data ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.FunctionInputNodes.UpdateDataOnNode( uniqueId, data ); } } - public static List<FunctionInput> FunctionInputList() { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.FunctionInputNodes.NodesList; } return null; } - - // Function Nodes - public static void RegisterFunctionNode( FunctionNode node ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.FunctionNodes.AddNode( node ); } } - public static void UnregisterFunctionNode( FunctionNode node ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.FunctionNodes.RemoveNode( node ); } } - public static void UpdateFunctionData( int uniqueId, string data ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.FunctionNodes.UpdateDataOnNode( uniqueId, data ); } } - public static List<FunctionNode> FunctionList() { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.FunctionNodes.NodesList; } return null; } - - // Function Outputs - public static void RegisterFunctionOutputNode( FunctionOutput node ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.FunctionOutputNodes.AddNode( node ); } } - public static void UnregisterFunctionOutputNode( FunctionOutput node ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.FunctionOutputNodes.RemoveNode( node ); } } - public static void UpdateFunctionOutputData( int uniqueId, string data ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.FunctionOutputNodes.UpdateDataOnNode( uniqueId, data ); } } - public static List<FunctionOutput> FunctionOutputList() { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.FunctionOutputNodes.NodesList; } return null; } - - // Function Switches Copy - public static void RegisterFunctionSwitchCopyNode( FunctionSwitch node ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.FunctionSwitchCopyNodes.AddNode( node ); } } - public static void UnregisterFunctionSwitchCopyNode( FunctionSwitch node ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.FunctionSwitchCopyNodes.RemoveNode( node ); } } - public static void UpdateFunctionSwitchCopyData( int uniqueId, string data ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.FunctionSwitchCopyNodes.UpdateDataOnNode( uniqueId, data ); } } - public static List<FunctionSwitch> FunctionSwitchCopyList() { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.FunctionSwitchCopyNodes.NodesList; } return null; } - - // Function Switches - public static void RegisterFunctionSwitchNode( FunctionSwitch node ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.FunctionSwitchNodes.AddNode( node ); } } - public static void UnregisterFunctionSwitchNode( FunctionSwitch node ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.FunctionSwitchNodes.RemoveNode( node ); } } - public static void UpdateFunctionSwitchData( int uniqueId, string data ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.FunctionSwitchNodes.UpdateDataOnNode( uniqueId, data ); } } - public static List<FunctionSwitch> FunctionSwitchList() { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.FunctionSwitchNodes.NodesList; } return null; } - public static void UpdateFunctionSwitchArr() { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.FunctionSwitchNodes.UpdateNodeArr(); } } - public static string[] FunctionSwitchesNodeArr() { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.FunctionSwitchNodes.NodesArr; } return null; } - public static FunctionSwitch GetFunctionSwitchNode( int idx ) { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.FunctionSwitchNodes.GetNode( idx ); } return null; } - public static int GetFunctionSwitchNodeIndex( int uniqueId ) { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.FunctionSwitchNodes.GetNodeRegisterIdx( uniqueId ); } return -1; } - - // Screen Color Node - public static void RegisterScreenColorNode( ScreenColorNode node ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.ScreenColorNodes.AddNode( node ); } } - public static void UnregisterScreenColorNode( ScreenColorNode node ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.ScreenColorNodes.RemoveNode( node ); } } - public static string[] ScreenColorNodeArr() { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.ScreenColorNodes.NodesArr; } return null; } - public static ScreenColorNode GetScreenColorNode( int idx ) { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.ScreenColorNodes.GetNode( idx ); } return null; } - public static int GetScreenColorNodeRegisterId( int uniqueId ) { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.ScreenColorNodes.GetNodeRegisterIdx( uniqueId ); } return -1; } - public static void UpdateScreenColorDataNode( int uniqueId, string data ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.ScreenColorNodes.UpdateDataOnNode( uniqueId, data ); } } - public static int GetScreenColorNodeAmount() { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.ScreenColorNodes.NodesList.Count; } return -1; } - - // Local Var Node - public static int RegisterLocalVarNode( RegisterLocalVarNode node ) { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.LocalVarNodes.AddNode( node ); } return -1; } - public static void UnregisterLocalVarNode( RegisterLocalVarNode node ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.LocalVarNodes.RemoveNode( node ); } } - public static string[] LocalVarNodeArr() { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.LocalVarNodes.NodesArr; } return null; } - public static int LocalVarNodeAmount() { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.LocalVarNodes.NodesList.Count; } return 0; } - public static int GetLocalVarNodeRegisterId( int uniqueId ) { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.LocalVarNodes.GetNodeRegisterIdx( uniqueId ); } return -1; } - public static RegisterLocalVarNode GetLocalVarNode( int idx ) { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.LocalVarNodes.GetNode( idx ); } return null; } - public static void UpdateLocalVarDataNode( int uniqueId, string data ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.LocalVarNodes.UpdateDataOnNode( uniqueId, data ); } } - - //Global Array - public static void RegisterGlobalArrayNode( GlobalArrayNode node ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.GlobalArrayNodes.AddNode( node ); } } - public static void UnregisterGlobalArrayNode( GlobalArrayNode node ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.GlobalArrayNodes.RemoveNode( node ); } } - public static string[] GlobalArrayNodeArr() { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.GlobalArrayNodes.NodesArr; } return null; } - public static GlobalArrayNode GetGlobalArrayNode( int idx ) { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.GlobalArrayNodes.GetNode( idx ); } return null; } - public static int GetGlobalArrayNodeRegisterId( int uniqueId ) { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.GlobalArrayNodes.GetNodeRegisterIdx( uniqueId ); } return -1; } - public static void UpdateGlobalArrayDataNode( int uniqueId, string data ) { if( CurrentWindow != null ) { CurrentWindow.CurrentGraph.GlobalArrayNodes.UpdateDataOnNode( uniqueId, data ); } } - public static int GetGlobalArrayNodeAmount() { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.GlobalArrayNodes.NodesList.Count; } return -1; } - - - public static void FocusOnNode( ParentNode node, float zoom, bool selectNode ) { if( CurrentWindow != null ) { CurrentWindow.FocusOnNode( node, zoom, selectNode ); } } - public static PrecisionType CurrentPrecision() { if( CurrentWindow != null ) { return CurrentWindow.CurrentGraph.CurrentPrecision; } return PrecisionType.Float; } - public static string CurrentPrecisionCg() { if( CurrentWindow != null ) { return m_precisionTypeToCg[ CurrentWindow.CurrentGraph.CurrentPrecision ]; } return m_precisionTypeToCg[ PrecisionType.Float ]; } - - public static PrecisionType GetFinalPrecision( PrecisionType precision ) - { - if( CurrentWindow != null && CurrentWindow.CurrentGraph != null ) - { - PrecisionType mainPrecision = CurrentWindow.CurrentGraph.CurrentPrecision; - if( (int)mainPrecision > (int)precision ) - return mainPrecision; - } - return precision; - } - - public static bool GetNodeAvailabilityInBitArray( int bitArray, NodeAvailability availability ) { return ( bitArray & (int)availability ) != 0; } - public static bool GetCategoryInBitArray( int bitArray, MasterNodePortCategory category ) { return ( bitArray & (int)category ) != 0; } - public static void SetCategoryInBitArray( ref int bitArray, MasterNodePortCategory category ) { bitArray = bitArray | (int)category; } - - public static int GetPriority( WirePortDataType type ) { return m_portPriority[ type ]; } - - public static void ShowIncompatiblePortMessage( bool fromInput, ParentNode inNode, WirePort inPort, ParentNode outNode, WirePort outPort ) - { - string inPortName = inPort.Name.Equals( Constants.EmptyPortValue ) ? inPort.PortId.ToString() : inPort.Name; - string outPortName = outPort.Name.Equals( Constants.EmptyPortValue ) ? outPort.PortId.ToString() : outPort.Name; - ShowMessage( outNode.UniqueId, string.Format( ( fromInput ? IncorrectInputConnectionErrorMsg : IncorrectOutputConnectionErrorMsg ), inPortName, inNode.Attributes.Name, inPort.DataType, outPort.DataType, outPortName, outNode.Attributes.Name ) ); - } - - public static void ShowNoVertexModeNodeMessage( ParentNode node ) - { - ShowMessage( node.UniqueId, string.Format( NoVertexModeNodeWarning, node.Attributes.Name ), MessageSeverity.Warning ); - } - - public static int TotalExampleMaterials { get { return m_exampleMaterialIDs.Count; } } - - public static int ShaderIndentLevel - { - get { return m_shaderIndentLevel; } - set - { - m_shaderIndentLevel = Mathf.Max( value, 0 ); - m_shaderIndentTabs = string.Empty; - for( int i = 0; i < m_shaderIndentLevel; i++ ) { m_shaderIndentTabs += "\t"; } - } - } - - public static string ShaderIndentTabs { get { return m_shaderIndentTabs; } } - public static void AddLineToShaderBody( ref string ShaderBody, string line ) { ShaderBody += m_shaderIndentTabs + line; } - public static void AddMultiLineToShaderBody( ref string ShaderBody, string[] lines ) - { - for( int i = 0; i < lines.Length; i++ ) - { - ShaderBody += m_shaderIndentTabs + lines[ i ]; - } - } - - public static void ClearUndoHelper() - { - m_undoHelper.Clear(); - } - - public static bool CheckUndoNode( ParentNode node ) - { - if( node == null ) - return false; - if( m_undoHelper.ContainsKey( node.UniqueId ) ) - { - return false; - } - - m_undoHelper.Add( node.UniqueId, node ); - EditorUtility.SetDirty( node ); - return true; - } - - public static void MarkUndoAction() - { - SerializeHelperCounter = 2; - } - - public static bool SerializeFromUndo() - { - if( SerializeHelperCounter > 0 ) - { - SerializeHelperCounter--; - return true; - } - return false; - } - - public static int GetKeywordId( string keyword ) - { - if( AvailableKeywordsDict.Count != AvailableKeywords.Length ) - { - AvailableKeywordsDict.Clear(); - for( int i = 1; i < AvailableKeywords.Length; i++ ) - { - AvailableKeywordsDict.Add( AvailableKeywords[ i ], i ); - } - } - - if( AvailableKeywordsDict.ContainsKey( keyword ) ) - { - return AvailableKeywordsDict[ keyword ]; - } - - return 0; - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/UIUtils.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/UIUtils.cs.meta deleted file mode 100644 index 91858515..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/UIUtils.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 23e0210afe076544ca92d761094a9119 -timeCreated: 1481126954 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/UndoUtils.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/UndoUtils.cs deleted file mode 100644 index d7b35d30..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/UndoUtils.cs +++ /dev/null @@ -1,12 +0,0 @@ -using UnityEditor; -using UnityEngine; -using UnityEngine.Internal; -using System; - -namespace AmplifyShaderEditor -{ - public class UndoUtils - { - - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/UndoUtils.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/UndoUtils.cs.meta deleted file mode 100644 index e4ad8c01..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/UndoUtils.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 89dee7566d97f1847b9fe114e1c9a1a2 -timeCreated: 1489603190 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/UpperLeftWidgetHelper.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/UpperLeftWidgetHelper.cs deleted file mode 100644 index 9e92fe2d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/UpperLeftWidgetHelper.cs +++ /dev/null @@ -1,91 +0,0 @@ -using System; -using UnityEngine; -using UnityEditor; - -namespace AmplifyShaderEditor -{ - public class UpperLeftWidgetHelper - { - public int DrawWidget( ParentNode owner, int selectedIndex, GUIContent[] displayedOptions ) - { - if( owner.DropdownEditing ) - { - int newValue = owner.EditorGUIPopup( owner.DropdownRect, selectedIndex, displayedOptions, UIUtils.PropertyPopUp ); - if( newValue != selectedIndex ) - { - owner.DropdownEditing = false; - } - return newValue; - } - return selectedIndex; - } - - public int DrawWidget( ParentNode owner, int selectedIndex, string[] displayedOptions ) - { - if( owner.DropdownEditing ) - { - int newValue = owner.EditorGUIPopup( owner.DropdownRect, selectedIndex, displayedOptions, UIUtils.PropertyPopUp ); - if( newValue != selectedIndex ) - { - owner.DropdownEditing = false; - } - return newValue; - } - return selectedIndex; - } - - public int DrawWidget( ParentNode owner, int selectedIndex, string[] displayedOptions, int[] optionValues ) - { - if( owner.DropdownEditing ) - { - int newValue = owner.EditorGUIIntPopup( owner.DropdownRect, selectedIndex, displayedOptions, optionValues, UIUtils.PropertyPopUp ); - if( newValue != selectedIndex ) - { - owner.DropdownEditing = false; - } - return newValue; - } - return selectedIndex; - } - - // GC free version - public void DrawWidget<TEnum>( ref TEnum selectedIndex, ParentNode owner, Action<ParentNode> callback ) where TEnum : struct - { - if( owner.DropdownEditing ) - { - Enum asEnumType = selectedIndex as Enum; - if( asEnumType != null ) - { - EditorGUI.BeginChangeCheck(); - selectedIndex = ( owner.EditorGUIEnumPopup( owner.DropdownRect, asEnumType, UIUtils.PropertyPopUp ) as TEnum? ).Value; - if( EditorGUI.EndChangeCheck() ) - { - owner.DropdownEditing = false; - if( callback != null ) - callback( owner ); - } - } - } - } - - /* - * USE THIS OVERRIDE IN CASE THE NODE DOESN'T HAVE PREVIEW - */ - //public override void AfterCommonInit() - //{ - // base.AfterCommonInit(); - // if( PaddingTitleLeft == 0 ) - // { - // PaddingTitleLeft = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; - // if( PaddingTitleRight == 0 ) - // PaddingTitleRight = Constants.PropertyPickerWidth + Constants.IconsLeftRightMargin; - // } - //} - - - /* - * USE THE SOURCE CODE BELOW INTO THE NODE YOU WANT THE WIDGET TO SHOW - */ - //private UpperLeftWidgetHelper m_upperLeftWidget = new UpperLeftWidgetHelper(); - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/UpperLeftWidgetHelper.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/UpperLeftWidgetHelper.cs.meta deleted file mode 100644 index 6e110525..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/UpperLeftWidgetHelper.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 32dbececad3a67a4fbde694ae50ce82c -timeCreated: 1504080603 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/WindowHelper.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/WindowHelper.cs deleted file mode 100644 index 7b8972b4..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/WindowHelper.cs +++ /dev/null @@ -1,250 +0,0 @@ -#if UNITY_EDITOR -using System; -using System.Reflection; -using UnityEditor; -using UnityEngine; - -public static class WindowHelper -{ - private class R_EditorWindow - { - private EditorWindow m_instance; - private System.Type m_type; - - public R_EditorWindow( EditorWindow instance ) - { - m_instance = instance; - m_type = instance.GetType(); - } - - public object Parent - { - get - { - var field = m_type.GetField( "m_Parent", BindingFlags.Instance | BindingFlags.NonPublic ); - return field.GetValue( m_instance ); - } - } - - public object Docked - { - get - { - var property = m_type.GetProperty( "docked", BindingFlags.Instance | BindingFlags.NonPublic ); - return property.GetValue( m_instance, null ); - } - } - } - - private class R_DockArea - { - private object m_instance; - private System.Type m_type; - - public R_DockArea( object instance ) - { - m_instance = instance; - m_type = instance.GetType(); - } - - public object Window - { - get - { - var property = m_type.GetProperty( "window", BindingFlags.Instance | BindingFlags.Public ); - return property.GetValue( m_instance, null ); - } - } - - public object ActualView - { - get - { - var field = m_type.GetField( "m_ActualView", BindingFlags.Instance | BindingFlags.NonPublic ); - return field.GetValue( m_instance ); - } - } - - public object OriginalDragSource - { - set - { - var field = m_type.GetField( "s_OriginalDragSource", BindingFlags.Static | BindingFlags.NonPublic ); - field.SetValue( null, value ); - } - } - - - public void AddTab( EditorWindow pane ) - { -#if UNITY_2018_3_OR_NEWER - var method = m_type.GetMethod( "AddTab", BindingFlags.Instance | BindingFlags.Public, null, new System.Type[] { typeof( EditorWindow ), typeof( bool ) }, null ); - method.Invoke( m_instance, new object[] { pane, true } ); -#else - var method = m_type.GetMethod( "AddTab", BindingFlags.Instance | BindingFlags.Public, null, new System.Type[] { typeof( EditorWindow ) }, null ); - method.Invoke( m_instance, new object[] { pane } ); -#endif - } - - public void RemoveTab( EditorWindow pane ) - { - var method = m_type.GetMethod( "RemoveTab", BindingFlags.Instance | BindingFlags.Public, null, new System.Type[] { typeof( EditorWindow ) }, null ); - method.Invoke( m_instance, new object[] { pane } ); - } - } - - private class R_ContainerWindow - { - private object m_instance; - private System.Type m_type; - - public R_ContainerWindow( object instance ) - { - m_instance = instance; - m_type = instance.GetType(); - } - - public object RootSplitView - { - get - { - var property = m_type.GetProperty( "rootSplitView", BindingFlags.Instance | BindingFlags.Public ); - return property.GetValue( m_instance, null ); - } - } - - public object RootView - { - get - { - var property = m_type.GetProperty( "rootView", BindingFlags.Instance | BindingFlags.Public ); - return property.GetValue( m_instance, null ); - } - } - - public object WindowPtr - { - get - { - var all = m_type.GetNestedTypes(); - foreach( var item in all ) - { - Debug.Log( item.Name ); - } - var property = m_type.GetField( "m_WindowPtr", BindingFlags.Instance | BindingFlags.NonPublic ); - return property.GetValue( m_instance ); - } - } - } - - private class R_SplitView - { - private object m_instance; - private System.Type m_type; - - public R_SplitView( object instance ) - { - m_instance = instance; - m_type = instance.GetType(); - } - - public object DragOver( EditorWindow child, Vector2 screenPoint ) - { - var method = m_type.GetMethod( "DragOver", BindingFlags.Instance | BindingFlags.Public ); - return method.Invoke( m_instance, new object[] { child, screenPoint } ); - } - - public void PerformDrop( EditorWindow child, object dropInfo, Vector2 screenPoint ) - { - var method = m_type.GetMethod( "PerformDrop", BindingFlags.Instance | BindingFlags.Public ); - method.Invoke( m_instance, new object[] { child, dropInfo, screenPoint } ); - } - } - - public enum DockPosition - { - Left, - Top, - Right, - Bottom - } - - public static bool IsDocked( this EditorWindow wnd ) - { - var parent = new R_EditorWindow( wnd ); - return (bool)parent.Docked; - } - - public static void Undock( this EditorWindow wnd ) - { - var parent = new R_EditorWindow( wnd ); - var dockArea = new R_DockArea( parent.Parent ); - dockArea.RemoveTab( wnd ); - wnd.Show( true ); - } - - public static void RemoveTab( this EditorWindow wnd ) - { - var parent = new R_EditorWindow( wnd ); - var dockArea = new R_DockArea( parent.Parent ); - dockArea.RemoveTab( wnd ); - } - - /// <summary> - /// Docks the second window to the first window at the given position - /// </summary> - public static void Dock( this EditorWindow wnd, EditorWindow other, DockPosition position ) - { - var mousePosition = GetFakeMousePosition( wnd, position ); - - var parent = new R_EditorWindow( wnd ); - var child = new R_EditorWindow( other ); - var dockArea = new R_DockArea( parent.Parent ); - var containerWindow = new R_ContainerWindow( dockArea.Window ); - var splitView = new R_SplitView( containerWindow.RootSplitView ); - var dropInfo = splitView.DragOver( other, mousePosition ); - dockArea.OriginalDragSource = child.Parent; - splitView.PerformDrop( other, dropInfo, mousePosition ); - } - - - /// <summary> - /// Adds the the second window as a tab at the end of the first window tab list - /// </summary> - /// <param name="existingWindow"></param> - /// <param name="newWindow"></param> - public static void AddTab( this EditorWindow existingWindow, EditorWindow newWindow ) - { - var parent = new R_EditorWindow( existingWindow ); - var child = new R_EditorWindow( newWindow ); - var dockArea = new R_DockArea( parent.Parent ); - dockArea.OriginalDragSource = child.Parent; - dockArea.AddTab( newWindow ); - } - - private static Vector2 GetFakeMousePosition( EditorWindow wnd, DockPosition position ) - { - Vector2 mousePosition = Vector2.zero; - - // The 20 is required to make the docking work. - // Smaller values might not work when faking the mouse position. - switch ( position ) - { - case DockPosition.Left: - mousePosition = new Vector2( 20, wnd.position.size.y / 2 ); - break; - case DockPosition.Top: - mousePosition = new Vector2( wnd.position.size.x / 2, 20 ); - break; - case DockPosition.Right: - mousePosition = new Vector2( wnd.position.size.x - 20, wnd.position.size.y / 2 ); - break; - case DockPosition.Bottom: - mousePosition = new Vector2( wnd.position.size.x / 2, wnd.position.size.y - 20 ); - break; - } - - return GUIUtility.GUIToScreenPoint( mousePosition ); - } -} -#endif diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/WindowHelper.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/WindowHelper.cs.meta deleted file mode 100644 index 4b589194..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/WindowHelper.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: ad6ef05d39dc39e42b8bfe0bdb826b7a -timeCreated: 1494336778 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/WindowsUtil.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/WindowsUtil.cs deleted file mode 100644 index 3a57b9b7..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/WindowsUtil.cs +++ /dev/null @@ -1,148 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -#if UNITY_EDITOR_WIN - -using System; -using System.Collections.Generic; -using System.Runtime.InteropServices; -using System.Text; - -public class WindowsUtil -{ - public const int GWL_STYLE = -16; //hex constant for style changing - public const int WS_BORDER = 0x00800000; //window with border - public const int WS_CAPTION = 0x00C00000; //window with a title bar with border - public const int WS_SYSMENU = 0x00080000; //window with no borders etc. - public const int WS_MAXIMIZE = 0x01000000; - public const int WS_MAXIMIZEBOX = 0x00010000; - public const int WS_MINIMIZE = 0x20000000; - public const int WS_MINIMIZEBOX = 0x00020000; - public const int WS_SIZEBOX = 0x00040000; - public const int WS_VISIBLE = 0x10000000; - public const int WS_TABSTOP = 0x00010000; - public const int WS_CLIPCHILDREN = 0x02000000; - public const int WS_CLIPSIBLINGS = 0x04000000; - - [DllImport( "user32.dll", EntryPoint = "SetWindowPos" )] - public static extern bool SetWindowPos( System.IntPtr hwnd, int hWndInsertAfter, int x, int Y, int cx, int cy, int wFlags ); - - public delegate bool EnumWindowsProc( System.IntPtr hWnd, System.IntPtr lParam ); - - [DllImport( "user32.dll", CharSet = CharSet.Auto, ExactSpelling = true )] - public static extern IntPtr GetDesktopWindow(); - - [DllImport( "user32.dll" )] - public static extern int SetWindowLong( IntPtr hWnd, int nIndex, int dwNewLong ); - - [DllImport( "user32.dll" )] - public static extern int GetWindowLong( IntPtr hWnd, int nIndex ); - - [DllImport( "user32.dll", ExactSpelling = true, SetLastError = true )] - internal static extern int MapWindowPoints( IntPtr hWndFrom, IntPtr hWndTo, [In, Out] ref Rect rect, [MarshalAs( UnmanagedType.U4 )] int cPoints ); - - [DllImport( "user32.dll" )] - public static extern bool EnumWindows( EnumWindowsProc enumProc, System.IntPtr lParam ); - - [DllImport( "user32" )] - [return: MarshalAs( UnmanagedType.Bool )] - public static extern bool EnumChildWindows( IntPtr window, EnumWindowProc callback, IntPtr lParam ); - - public delegate bool EnumWindowProc( IntPtr hwnd, IntPtr lParam ); - - [DllImport( "user32.dll", SetLastError = true )] - public static extern bool MoveWindow( IntPtr hWnd, int X, int Y, int nWidth, int nHeight, bool bRepaint ); - - [DllImport( "user32.dll", CharSet = CharSet.Auto, SetLastError = true )] - public static extern int GetWindowThreadProcessId( System.IntPtr handle, out int processId ); - - [DllImport( "user32.dll", SetLastError = true )] - public static extern IntPtr FindWindowEx( string lpClassName, string lpWindowName ); - - // Find window by Caption only. Note you must pass IntPtr.Zero as the first parameter. - [DllImport( "user32.dll", EntryPoint = "FindWindow", SetLastError = true )] - public static extern IntPtr FindWindowByCaptionEx( IntPtr ZeroOnly, string lpWindowName ); - - [DllImport( "user32.dll", SetLastError = true, CharSet = CharSet.Auto )] - public static extern int GetClassName( IntPtr hWnd, StringBuilder lpClassName, int nMaxCount ); - - [DllImport( "user32.dll" )] - public static extern int GetWindowText( System.IntPtr hWnd, StringBuilder text, int nMaxCount ); - - [DllImport( "user32.dll" )] - public static extern int GetWindowTextLength( System.IntPtr hWnd ); - - [DllImport( "user32.dll" )] - public static extern IntPtr FindWindowEx( IntPtr parentWindow, IntPtr previousChildWindow, string windowClass, string windowTitle ); - - [DllImport( "user32.dll" )] - public static extern IntPtr GetActiveWindow(); - - [DllImport( "user32.dll" )] - public static extern bool GetWindowRect( System.IntPtr hwnd, ref Rect rectangle ); - - static public IntPtr[] GetProcessWindows( int processId ) - { - List<IntPtr> output = new List<IntPtr>(); - IntPtr winPtr = IntPtr.Zero; - do - { - winPtr = FindWindowEx( IntPtr.Zero, winPtr, null, null ); - int id; - GetWindowThreadProcessId( winPtr, out id ); - if( id == processId ) - output.Add( winPtr ); - } while( winPtr != IntPtr.Zero ); - - return output.ToArray(); - } - - public struct Rect - { - public int Left { get; set; } - public int Top { get; set; } - public int Right { get; set; } - public int Bottom { get; set; } - public int Width { get { return Right - Left; } } - public int Height { get { return Bottom - Top; } } - - public override string ToString() - { - return "(l: " + Left + ", r: " + Right + ", t: " + Top + ", b: " + Bottom + ")"; - } - } - - public static bool GetProcessRect( System.Diagnostics.Process process, ref Rect rect ) - { - IntPtr[] winPtrs = WindowsUtil.GetProcessWindows( process.Id ); - - for( int i = 0; i < winPtrs.Length; i++ ) - { - bool gotRect = WindowsUtil.GetWindowRect( winPtrs[ i ], ref rect ); - if( gotRect && ( rect.Left != 0 && rect.Top != 0 ) ) - return true; - } - return false; - } - - public static void SetWindowPosition( int x, int y, int sizeX = 0, int sizeY = 0 ) - { - System.Diagnostics.Process process = System.Diagnostics.Process.GetCurrentProcess(); - process.Refresh(); - - EnumWindows( delegate ( System.IntPtr wnd, System.IntPtr param ) - { - int id; - GetWindowThreadProcessId( wnd, out id ); - if( id == process.Id ) - { - SetWindowPos( wnd, 0, x, y, sizeX, sizeY, sizeX * sizeY == 0 ? 1 : 0 ); - return false; - } - - return true; - }, System.IntPtr.Zero ); - } -} - -#endif
\ No newline at end of file diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/WindowsUtil.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/WindowsUtil.cs.meta deleted file mode 100644 index 8200f79f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Utils/WindowsUtil.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 84d9a18b60b810c4c894886264a89da0 -timeCreated: 1559138384 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Version.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Version.meta deleted file mode 100644 index c5ba7b81..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Version.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 6072f991722ef6c44b167cf204724a52 -folderAsset: yes -timeCreated: 1481126944 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Version/About.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Version/About.cs deleted file mode 100644 index a1477515..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Version/About.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEngine; -using UnityEditor; - -namespace AmplifyShaderEditor -{ - public class About : EditorWindow - { - private const string AboutImageGUID = "8aba6bb20faf8824d9d81946542f1ce1"; - private Vector2 m_scrollPosition = Vector2.zero; - private Texture2D m_aboutImage; - - [MenuItem( "Window/Amplify Shader Editor/About...", false, 2001 )] - static void Init() - { - About window = (About)GetWindow( typeof( About ), true, "About Amplify Shader Editor" ); - window.minSize = new Vector2( 502, 290 ); - window.maxSize = new Vector2( 502, 290 ); - window.Show(); - } - - [MenuItem( "Window/Amplify Shader Editor/Manual", false, 2000 )] - static void OpenManual() - { - Application.OpenURL( "http://wiki.amplify.pt/index.php?title=Unity_Products:Amplify_Shader_Editor/Manual" ); - } - - private void OnEnable() - { - m_aboutImage = AssetDatabase.LoadAssetAtPath<Texture2D>( AssetDatabase.GUIDToAssetPath( AboutImageGUID ) ); - } - - public void OnGUI() - { - m_scrollPosition = GUILayout.BeginScrollView( m_scrollPosition ); - - GUILayout.BeginVertical(); - - GUILayout.Space( 10 ); - - GUILayout.BeginHorizontal(); - GUILayout.FlexibleSpace(); - GUILayout.Box( m_aboutImage, GUIStyle.none ); - - if( Event.current.type == EventType.MouseUp && GUILayoutUtility.GetLastRect().Contains( Event.current.mousePosition ) ) - Application.OpenURL( "http://www.amplify.pt" ); - - GUILayout.FlexibleSpace(); - GUILayout.EndHorizontal(); - - GUIStyle labelStyle = new GUIStyle( EditorStyles.label ); - labelStyle.alignment = TextAnchor.MiddleCenter; - labelStyle.wordWrap = true; - - GUILayout.Label( "\nAmplify Shader Editor " + VersionInfo.StaticToString(), labelStyle, GUILayout.ExpandWidth( true ) ); - - GUILayout.Label( "\nCopyright (c) Amplify Creations, Lda. All rights reserved.\n", labelStyle, GUILayout.ExpandWidth( true ) ); - - GUILayout.EndVertical(); - - GUILayout.EndScrollView(); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Version/About.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Version/About.cs.meta deleted file mode 100644 index 1f8de1d8..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Version/About.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: b52649079e4f9ef488724bd3c72449ed -timeCreated: 1481126958 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Version/VersionInfo.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Version/VersionInfo.cs deleted file mode 100644 index d8eba2dc..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Version/VersionInfo.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; - -namespace AmplifyShaderEditor -{ - [Serializable] - public class VersionInfo - { - public const byte Major = 1; - public const byte Minor = 8; - public const byte Release = 1; - public static byte Revision = 00; - - //private static string StageSuffix = "_dev0"+Revision; - - //public static string StaticToString() - //{ - // return string.Format( "{0}.{1}.{2}", Major, Minor, Release ) + StageSuffix; - //} - - public static string StaticToString() - { - return string.Format( "{0}.{1}.{2}", Major, Minor, Release ) + ( Revision > 0 ? "r" + Revision.ToString() : "" ); - } - - public static int FullNumber { get { return Major * 10000 + Minor * 1000 + Release * 100 + Revision; } } - public static string FullLabel { get { return "Version=" + FullNumber; } } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Version/VersionInfo.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Version/VersionInfo.cs.meta deleted file mode 100644 index f5edff80..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Version/VersionInfo.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 581602482686da34180d35b169cd357a -timeCreated: 1481126955 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Wires.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Wires.meta deleted file mode 100644 index 04d01cf2..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Wires.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 81b7f9ca313139248a5500a6da3c8a12 -folderAsset: yes -timeCreated: 1481126944 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Wires/GLDraw.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Wires/GLDraw.cs deleted file mode 100644 index ab8011ff..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Wires/GLDraw.cs +++ /dev/null @@ -1,156 +0,0 @@ -using UnityEngine; -using UnityEditor; -using System.Collections.Generic; - -namespace AmplifyShaderEditor -{ - public class GLDraw - { - /* - * Clipping code: http://forum.unity3d.com/threads/17066-How-to-draw-a-GUI-2D-quot-line-quot?p=230386#post230386 - * Thick line drawing code: http://unifycommunity.com/wiki/index.php?title=VectorLine - */ - public static Material LineMaterial = null; - public static bool MultiLine = false; - private static Shader LineShader = null; - private static Rect BoundBox = new Rect(); - private static Vector3[] Allv3Points = new Vector3[] { }; - private static Vector2[] AllPerpendiculars = new Vector2[] { }; - private static Color[] AllColors = new Color[] { }; - private static Vector2 StartPt = Vector2.zero; - private static Vector2 EndPt = Vector2.zero; - - private static Vector3 Up = new Vector3( 0, 1, 0 ); - private static Vector3 Zero = new Vector3( 0, 0, 0 ); - - private static Vector2 Aux1Vec2 = Vector2.zero; - - private static int HigherBoundArray = 0; - - public static void CreateMaterial() - { - if( (object)LineMaterial != null && (object)LineShader != null ) - return; - - LineShader = AssetDatabase.LoadAssetAtPath<Shader>( AssetDatabase.GUIDToAssetPath( "50fc796413bac8b40aff70fb5a886273" ) ); - LineMaterial = new Material( LineShader ); - - LineMaterial.hideFlags = HideFlags.HideAndDontSave; - } - - public static void DrawCurve( Vector3[] allPoints, Vector2[] allNormals, Color[] allColors, int pointCount ) - { - CreateMaterial(); - LineMaterial.SetPass( ( MultiLine ? 1 : 0 ) ); - - GL.Begin( GL.TRIANGLE_STRIP ); - for( int i = 0; i < pointCount; i++ ) - { - GL.Color( allColors[ i ] ); - GL.TexCoord( Zero ); - GL.Vertex3( allPoints[ i ].x - allNormals[ i ].x, allPoints[ i ].y - allNormals[ i ].y, 0 ); - GL.TexCoord( Up ); - GL.Vertex3( allPoints[ i ].x + allNormals[ i ].x, allPoints[ i ].y + allNormals[ i ].y, 0 ); - } - GL.End(); - - } - - public static Rect DrawBezier( Vector2 start, Vector2 startTangent, Vector2 end, Vector2 endTangent, Color color, float width, int type = 1 ) - { - int segments = Mathf.FloorToInt( ( start - end ).magnitude / 20 ) * 3; // Three segments per distance of 20 - return DrawBezier( start, startTangent, end, endTangent, color, width, segments, type ); - } - - public static Rect DrawBezier( Vector2 start, Vector2 startTangent, Vector2 end, Vector2 endTangent, Color color, float width, int segments, int type = 1 ) - { - return DrawBezier( start, startTangent, end, endTangent, color, color, width, segments, type ); - } - - public static Rect DrawBezier( Vector2 start, Vector2 startTangent, Vector2 end, Vector2 endTangent, Color startColor, Color endColor, float width, int segments, int type = 1 ) - { - int pointsCount = segments + 1; - int linesCount = segments; - - HigherBoundArray = HigherBoundArray > pointsCount ? HigherBoundArray : pointsCount; - - Allv3Points = Handles.MakeBezierPoints( start, end, startTangent, endTangent, pointsCount ); - if( AllColors.Length < HigherBoundArray ) - { - AllColors = new Color[ HigherBoundArray ]; - AllPerpendiculars = new Vector2[ HigherBoundArray ]; - } - - startColor.a = ( type * 0.25f ); - endColor.a = ( type * 0.25f ); - - float minX = Allv3Points[ 0 ].x; - float minY = Allv3Points[ 0 ].y; - float maxX = Allv3Points[ 0 ].x; - float maxY = Allv3Points[ 0 ].y; - - float amount = 1 / (float)linesCount; - for( int i = 0; i < pointsCount; i++ ) - { - if( i == 0 ) - { - AllColors[ 0 ] = startColor; - StartPt.Set( startTangent.y, start.x ); - EndPt.Set( start.y, startTangent.x ); - } - else if( i == pointsCount - 1 ) - { - AllColors[ pointsCount - 1 ] = endColor; - StartPt.Set( end.y, endTangent.x ); - EndPt.Set( endTangent.y, end.x ); - } - else - { - AllColors[ i ] = Color.LerpUnclamped( startColor, endColor, amount * i ); - - minX = ( Allv3Points[ i ].x < minX ) ? Allv3Points[ i ].x : minX; - minY = ( Allv3Points[ i ].y < minY ) ? Allv3Points[ i ].y : minY; - maxX = ( Allv3Points[ i ].x > maxX ) ? Allv3Points[ i ].x : maxX; - maxY = ( Allv3Points[ i ].y > maxY ) ? Allv3Points[ i ].y : maxY; - StartPt.Set( Allv3Points[ i + 1 ].y, Allv3Points[ i - 1 ].x ); - EndPt.Set( Allv3Points[ i - 1 ].y, Allv3Points[ i + 1 ].x ); - } - Aux1Vec2.Set( StartPt.x - EndPt.x, StartPt.y - EndPt.y ); - FastNormalized( ref Aux1Vec2 ); - //aux1Vec2.FastNormalized(); - Aux1Vec2.Set( Aux1Vec2.x * width, Aux1Vec2.y * width ); - AllPerpendiculars[ i ] = Aux1Vec2; - } - - BoundBox.Set( minX, minY, ( maxX - minX ), ( maxY - minY ) ); - - DrawCurve( Allv3Points, AllPerpendiculars, AllColors, pointsCount ); - return BoundBox; - } - - private static void FastNormalized( ref Vector2 v ) - { - float len = Mathf.Sqrt( v.x * v.x + v.y * v.y ); - v.Set( v.x / len, v.y / len ); - } - - public static void Destroy() - { - GameObject.DestroyImmediate( LineMaterial ); - LineMaterial = null; - - Resources.UnloadAsset( LineShader ); - LineShader = null; - } - } - - //public static class VectorEx - //{ - // public static void FastNormalized( this Vector2 v ) - // { - // float len = Mathf.Sqrt( v.x * v.x + v.y * v.y ); - // v.Set( v.x / len, v.y / len ); - // } - //} -} - diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Wires/GLDraw.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Wires/GLDraw.cs.meta deleted file mode 100644 index 0f466abc..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Wires/GLDraw.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 7647d2525992b7748a587740fd596977 -timeCreated: 1481126956 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Wires/InputPort.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Wires/InputPort.cs deleted file mode 100644 index 385887e3..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Wires/InputPort.cs +++ /dev/null @@ -1,1535 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using System; -using UnityEngine; -using UnityEditor; - -namespace AmplifyShaderEditor -{ - [Serializable] - public sealed class InputPort : WirePort - { - private const string InputDefaultNameStr = "Input"; - [SerializeField] - private int m_externalNodeLink = -1; - - [SerializeField] - private int m_externalPortLink = -1; - - [SerializeField] - private string m_externalLinkId = string.Empty; - - [SerializeField] - private bool m_typeLocked; - - [SerializeField] - private string m_internalData = string.Empty; - - [SerializeField] - private string m_internalDataWrapper = string.Empty; - - [SerializeField] - private string m_dataName = string.Empty; - - [SerializeField] - private string m_internalDataPropertyLabel = string.Empty; - - // this will only is important on master node - [SerializeField] - private MasterNodePortCategory m_category = MasterNodePortCategory.Fragment; - - [SerializeField] - private PortGenType m_genType; - - private string m_propertyName = string.Empty; - private int m_cachedPropertyId = -1; - - private int m_cachedIntShaderID = -1; - private int m_cachedFloatShaderID = -1; - private int m_cachedVectorShaderID = -1; - private int m_cachedColorShaderID = -1; - private int m_cached2DShaderID = -1; - private int m_cachedDefaultTexShaderID = -1; - - [SerializeField] - private bool m_drawInternalData = false; - - //[SerializeField] - //private RenderTexture m_inputPreview = null; - //[SerializeField] - private RenderTexture m_inputPreviewTexture = null; - private Material m_inputPreviewMaterial = null; - private Shader m_inputPreviewShader = null; - - [SerializeField] - private int m_previewInternalInt = 0; - [SerializeField] - private float m_previewInternalFloat = 0; - [SerializeField] - private Vector2 m_previewInternalVec2 = Vector2.zero; - [SerializeField] - private Vector3 m_previewInternalVec3 = Vector3.zero; - [SerializeField] - private Vector4 m_previewInternalVec4 = Vector4.zero; - [SerializeField] - private Color m_previewInternalColor = Color.clear; - [SerializeField] - private Matrix4x4 m_previewInternalMatrix4x4 = Matrix4x4.identity; - - private int m_propertyNameInt = 0; - private ParentNode m_node = null; - - public InputPort() : base( -1, -1, WirePortDataType.FLOAT, string.Empty ) { m_typeLocked = true; } - public InputPort( int nodeId, int portId, WirePortDataType dataType, string name, bool typeLocked, int orderId = -1, MasterNodePortCategory category = MasterNodePortCategory.Fragment, PortGenType genType = PortGenType.NonCustomLighting ) : base( nodeId, portId, dataType, name, orderId ) - { - m_dataName = name; - m_internalDataPropertyLabel = ( string.IsNullOrEmpty( name ) || name.Equals( Constants.EmptyPortValue ) ) ? InputDefaultNameStr : name; - m_typeLocked = typeLocked; - m_category = category; - m_genType = genType; - } - - public InputPort( int nodeId, int portId, WirePortDataType dataType, string name, string dataName, bool typeLocked, int orderId = -1, MasterNodePortCategory category = MasterNodePortCategory.Fragment, PortGenType genType = PortGenType.NonCustomLighting ) : base( nodeId, portId, dataType, name, orderId ) - { - m_dataName = dataName; - m_internalDataPropertyLabel = ( string.IsNullOrEmpty( name ) || name.Equals( Constants.EmptyPortValue ) ) ? InputDefaultNameStr : name; - m_typeLocked = typeLocked; - m_category = category; - m_genType = genType; - } - - public void SetExternalLink( int nodeId, int portId ) - { - m_externalNodeLink = nodeId; - m_externalPortLink = portId; - } - - public override bool CheckValidType( WirePortDataType dataType ) - { - if( m_typeLocked ) - return ( dataType == m_dataType ); - - return base.CheckValidType( dataType ); - } - - public override void FullDeleteConnections() - { - UIUtils.DeleteConnection( true, m_nodeId, m_portId, true, true ); - } - - public override void NotifyExternalRefencesOnChange() - { - for( int i = 0; i < m_externalReferences.Count; i++ ) - { - ParentNode node = UIUtils.GetNode( m_externalReferences[ i ].NodeId ); - if( node ) - { - OutputPort port = node.GetOutputPortByUniqueId( m_externalReferences[ i ].PortId ); - port.UpdateInfoOnExternalConn( m_nodeId, m_portId, m_dataType ); - node.OnConnectedInputNodeChanges( m_externalReferences[ i ].PortId, m_nodeId, m_portId, m_name, m_dataType ); - } - } - } - - public void UpdatePreviewInternalData() - { - switch( m_dataType ) - { - case WirePortDataType.INT: m_previewInternalInt = IntInternalData; break; - case WirePortDataType.FLOAT: m_previewInternalFloat = FloatInternalData; break; - case WirePortDataType.FLOAT2: m_previewInternalVec2 = Vector2InternalData; break; - case WirePortDataType.FLOAT3: m_previewInternalVec3 = Vector3InternalData; break; - case WirePortDataType.FLOAT4: m_previewInternalVec4 = Vector4InternalData; break; - case WirePortDataType.COLOR: m_previewInternalColor = ColorInternalData; break; - } - } - - void UpdateVariablesFromInternalData() - { - string[] data = String.IsNullOrEmpty( m_internalData ) ? null : m_internalData.Split( IOUtils.VECTOR_SEPARATOR ); - bool reset = ( data == null || data.Length == 0 ); - m_internalDataUpdated = false; - try - { - switch( m_dataType ) - { - case WirePortDataType.OBJECT:break; - case WirePortDataType.FLOAT: m_previewInternalFloat = reset ? 0 : Convert.ToSingle( data[ 0 ] ); break; - case WirePortDataType.INT: - { - if( reset ) - { - m_previewInternalInt = 0; - } - else - { - if( data[ 0 ].Contains( "." ) ) - { - m_previewInternalInt = (int)Convert.ToSingle( data[ 0 ] ); - } - else - { - m_previewInternalInt = Convert.ToInt32( data[ 0 ] ); - } - } - } - break; - case WirePortDataType.FLOAT2: - { - if( reset ) - { - m_previewInternalVec2 = Vector2.zero; - } - else - { - if( data.Length < 2 ) - { - m_previewInternalVec2.x = Convert.ToSingle( data[ 0 ] ); - m_previewInternalVec2.y = 0; - } - else - { - m_previewInternalVec2.x = Convert.ToSingle( data[ 0 ] ); - m_previewInternalVec2.y = Convert.ToSingle( data[ 1 ] ); - } - } - } - break; - case WirePortDataType.FLOAT3: - { - if( reset ) - { - m_previewInternalVec3 = Vector3.zero; - } - else - { - int count = Mathf.Min( data.Length, 3 ); - for( int i = 0; i < count; i++ ) - { - m_previewInternalVec3[ i ] = Convert.ToSingle( data[ i ] ); - } - if( count < 3 ) - { - for( int i = count; i < 3; i++ ) - { - m_previewInternalVec3[ i ] = 0; - } - } - } - - } - break; - case WirePortDataType.FLOAT4: - { - if( reset ) - { - m_previewInternalVec4 = Vector4.zero; - } - else - { - int count = Mathf.Min( data.Length, 4 ); - for( int i = 0; i < count; i++ ) - { - m_previewInternalVec4[ i ] = Convert.ToSingle( data[ i ] ); - } - if( count < 4 ) - { - for( int i = count; i < 4; i++ ) - { - m_previewInternalVec4[ i ] = 0; - } - } - } - } - break; - case WirePortDataType.COLOR: - { - if( reset ) - { - m_previewInternalColor = Color.black; - } - else - { - int count = Mathf.Min( data.Length, 4 ); - for( int i = 0; i < count; i++ ) - { - m_previewInternalColor[ i ] = Convert.ToSingle( data[ i ] ); - } - if( count < 4 ) - { - for( int i = count; i < 4; i++ ) - { - m_previewInternalColor[ i ] = 0; - } - } - } - } - break; - case WirePortDataType.FLOAT3x3: - case WirePortDataType.FLOAT4x4: - { - if( reset ) - { - m_previewInternalMatrix4x4 = Matrix4x4.identity; - } - else - { - int count = Mathf.Min( data.Length, 16 ); - int overallIdx = 0; - for( int i = 0; i < 4; i++ ) - { - for( int j = 0; j < 4; j++ ) - { - if( overallIdx < count ) - { - m_previewInternalMatrix4x4[ i, j ] = Convert.ToSingle( data[ overallIdx ] ); - } - else - { - m_previewInternalMatrix4x4[ i, j ] = ( ( i == j ) ? 1 : 0 ); - } - overallIdx++; - } - } - } - } - break; - } - } - catch( Exception e ) - { - if( DebugConsoleWindow.DeveloperMode ) - Debug.LogException( e ); - } - } - - void UpdateInternalDataFromVariables( bool forceDecimal = false ) - { - switch( m_dataType ) - { - case WirePortDataType.OBJECT:break; - case WirePortDataType.FLOAT: - { - if( forceDecimal && m_previewInternalFloat == (int)m_previewInternalFloat ) - m_internalData = m_previewInternalFloat.ToString("0.0##############"); // to make sure integer values like 0 or 1 are generated as 0.0 and 1.0 - else - m_internalData = m_previewInternalFloat.ToString(); - m_internalDataWrapper = string.Empty; - } - break; - case WirePortDataType.INT: - { - m_internalData = m_previewInternalInt.ToString(); - m_internalDataWrapper = string.Empty; - } - break; - case WirePortDataType.FLOAT2: - { - m_internalData = m_previewInternalVec2.x.ToString() + IOUtils.VECTOR_SEPARATOR + - m_previewInternalVec2.y.ToString(); - m_internalDataWrapper = "float2( {0} )"; - } - break; - case WirePortDataType.FLOAT3: - { - m_internalData = m_previewInternalVec3.x.ToString() + IOUtils.VECTOR_SEPARATOR + - m_previewInternalVec3.y.ToString() + IOUtils.VECTOR_SEPARATOR + - m_previewInternalVec3.z.ToString(); - m_internalDataWrapper = "float3( {0} )"; - } - break; - case WirePortDataType.FLOAT4: - { - m_internalData = m_previewInternalVec4.x.ToString() + IOUtils.VECTOR_SEPARATOR + - m_previewInternalVec4.y.ToString() + IOUtils.VECTOR_SEPARATOR + - m_previewInternalVec4.z.ToString() + IOUtils.VECTOR_SEPARATOR + - m_previewInternalVec4.w.ToString(); - - m_internalDataWrapper = "float4( {0} )"; - } - break; - case WirePortDataType.COLOR: - { - m_internalData = m_previewInternalColor.r.ToString() + IOUtils.VECTOR_SEPARATOR + - m_previewInternalColor.g.ToString() + IOUtils.VECTOR_SEPARATOR + - m_previewInternalColor.b.ToString() + IOUtils.VECTOR_SEPARATOR + - m_previewInternalColor.a.ToString(); - - m_internalDataWrapper = "float4( {0} )"; - } - break; - case WirePortDataType.FLOAT3x3: - { - m_internalData = m_previewInternalMatrix4x4[ 0, 0 ].ToString() + IOUtils.VECTOR_SEPARATOR + m_previewInternalMatrix4x4[ 0, 1 ].ToString() + IOUtils.VECTOR_SEPARATOR + m_previewInternalMatrix4x4[ 0, 2 ].ToString() + IOUtils.VECTOR_SEPARATOR + - m_previewInternalMatrix4x4[ 1, 0 ].ToString() + IOUtils.VECTOR_SEPARATOR + m_previewInternalMatrix4x4[ 1, 1 ].ToString() + IOUtils.VECTOR_SEPARATOR + m_previewInternalMatrix4x4[ 1, 2 ].ToString() + IOUtils.VECTOR_SEPARATOR + - m_previewInternalMatrix4x4[ 2, 0 ].ToString() + IOUtils.VECTOR_SEPARATOR + m_previewInternalMatrix4x4[ 2, 1 ].ToString() + IOUtils.VECTOR_SEPARATOR + m_previewInternalMatrix4x4[ 2, 2 ].ToString(); - - m_internalDataWrapper = "float3x3( {0} )"; - - } - break; - case WirePortDataType.FLOAT4x4: - { - m_internalData = m_previewInternalMatrix4x4[ 0, 0 ].ToString() + IOUtils.VECTOR_SEPARATOR + m_previewInternalMatrix4x4[ 0, 1 ].ToString() + IOUtils.VECTOR_SEPARATOR + m_previewInternalMatrix4x4[ 0, 2 ].ToString() + IOUtils.VECTOR_SEPARATOR + m_previewInternalMatrix4x4[ 0, 3 ].ToString() + IOUtils.VECTOR_SEPARATOR + - m_previewInternalMatrix4x4[ 1, 0 ].ToString() + IOUtils.VECTOR_SEPARATOR + m_previewInternalMatrix4x4[ 1, 1 ].ToString() + IOUtils.VECTOR_SEPARATOR + m_previewInternalMatrix4x4[ 1, 2 ].ToString() + IOUtils.VECTOR_SEPARATOR + m_previewInternalMatrix4x4[ 1, 3 ].ToString() + IOUtils.VECTOR_SEPARATOR + - m_previewInternalMatrix4x4[ 2, 0 ].ToString() + IOUtils.VECTOR_SEPARATOR + m_previewInternalMatrix4x4[ 2, 1 ].ToString() + IOUtils.VECTOR_SEPARATOR + m_previewInternalMatrix4x4[ 2, 2 ].ToString() + IOUtils.VECTOR_SEPARATOR + m_previewInternalMatrix4x4[ 2, 3 ].ToString() + IOUtils.VECTOR_SEPARATOR + - m_previewInternalMatrix4x4[ 3, 0 ].ToString() + IOUtils.VECTOR_SEPARATOR + m_previewInternalMatrix4x4[ 3, 1 ].ToString() + IOUtils.VECTOR_SEPARATOR + m_previewInternalMatrix4x4[ 3, 2 ].ToString() + IOUtils.VECTOR_SEPARATOR + m_previewInternalMatrix4x4[ 3, 3 ].ToString(); - - m_internalDataWrapper = "float4x4( {0} )"; - } - break; - } - } - - //This gets the 3x3 matrix inside of the 4x4 - private string Matrix3x3WrappedData() - { - string tempInternal = string.Empty; - - string[] data = String.IsNullOrEmpty( m_internalData ) ? null : m_internalData.Split( IOUtils.VECTOR_SEPARATOR ); - if( data.Length == 16 ) - { - int o = 0; - for( int i = 0; i < 8; i++ ) - { - if( i == 3 || i == 6 ) - o++; - tempInternal += data[ i + o ] + IOUtils.VECTOR_SEPARATOR; - } - - tempInternal += data[ 10 ]; - - return String.Format( m_internalDataWrapper, tempInternal ); - } - else - { - return String.Format( m_internalDataWrapper, m_internalData ); - } - } - - private string SamplerWrappedData( ref MasterNodeDataCollector dataCollector ) - { - m_internalData = "_Sampler" + PortId + UIUtils.GetNode( m_nodeId ).OutputId; - ParentGraph outsideGraph = UIUtils.CurrentWindow.OutsideGraph; - if( outsideGraph.SamplingThroughMacros ) - { - if( outsideGraph.IsSRP ) - { - dataCollector.AddToUniforms( m_nodeId, string.Format( Constants.TexDeclarationNoSamplerSRPMacros[ TextureType.Texture2D ], m_internalData )); - } - else - { - dataCollector.AddToUniforms( m_nodeId, string.Format( Constants.TexDeclarationNoSamplerStandardMacros[ TextureType.Texture2D ], m_internalData )); - } - } - else - { - dataCollector.AddToUniforms( m_nodeId, "uniform sampler2D " + m_internalData + ";" ); - } - - return m_internalData; - } - - //TODO: Replace GenerateShaderForOutput(...) calls to this one - // This is a new similar method to GenerateShaderForOutput(...) which always autocasts - public string GeneratePortInstructions( ref MasterNodeDataCollector dataCollector ) - { - InputPort linkPort = ExternalLink; - if( linkPort != null ) - { - return linkPort.GeneratePortInstructions( ref dataCollector ); - } - - string result = string.Empty; - if( m_externalReferences.Count > 0 && !m_locked ) - { - result = UIUtils.GetNode( m_externalReferences[ 0 ].NodeId ).GenerateShaderForOutput( m_externalReferences[ 0 ].PortId, ref dataCollector, false ); - if( m_externalReferences[ 0 ].DataType != m_dataType ) - { - result = UIUtils.CastPortType( ref dataCollector, UIUtils.GetNode( m_nodeId ).CurrentPrecisionType, new NodeCastInfo( m_externalReferences[ 0 ].NodeId, m_externalReferences[ 0 ].PortId ), null, m_externalReferences[ 0 ].DataType, m_dataType, result ); - } - } - else - { - UpdateInternalDataFromVariables( true ); - if( DataType == WirePortDataType.FLOAT3x3 ) - result = Matrix3x3WrappedData(); - else if( DataType == WirePortDataType.SAMPLER2D ) - result = SamplerWrappedData( ref dataCollector ); - else - result = !String.IsNullOrEmpty( m_internalDataWrapper ) ? String.Format( m_internalDataWrapper, m_internalData ) : m_internalData; - } - return result; - } - - public string GenerateShaderForOutput( ref MasterNodeDataCollector dataCollector, bool ignoreLocalVar ) - { - InputPort linkPort = ExternalLink; - if( linkPort != null ) - { - return linkPort.GenerateShaderForOutput( ref dataCollector, ignoreLocalVar ); - } - - string result = string.Empty; - if( m_externalReferences.Count > 0 && !m_locked ) - { - result = UIUtils.GetNode( m_externalReferences[ 0 ].NodeId ).GenerateShaderForOutput( m_externalReferences[ 0 ].PortId, ref dataCollector, ignoreLocalVar ); - } - else - { - UpdateInternalDataFromVariables( true ); - if( !String.IsNullOrEmpty( m_internalDataWrapper ) ) - { - if( DataType == WirePortDataType.FLOAT3x3 ) - result = Matrix3x3WrappedData(); - else - result = String.Format( m_internalDataWrapper, m_internalData ); - } - else - { - result = m_internalData; - } - } - return result; - } - - public string GenerateShaderForOutput( ref MasterNodeDataCollector dataCollector, WirePortDataType inputPortType, bool ignoreLocalVar, bool autoCast = false ) - { - InputPort linkPort = ExternalLink; - if( linkPort != null ) - { - return linkPort.GenerateShaderForOutput( ref dataCollector, inputPortType, ignoreLocalVar, autoCast ); - } - - string result = string.Empty; - if( m_externalReferences.Count > 0 && !m_locked ) - { - result = UIUtils.GetNode( m_externalReferences[ 0 ].NodeId ).GenerateShaderForOutput( m_externalReferences[ 0 ].PortId, ref dataCollector, ignoreLocalVar ); - if( autoCast && m_externalReferences[ 0 ].DataType != inputPortType ) - { - result = UIUtils.CastPortType( ref dataCollector, UIUtils.GetNode( m_nodeId ).CurrentPrecisionType, new NodeCastInfo( m_externalReferences[ 0 ].NodeId, m_externalReferences[ 0 ].PortId ), null, m_externalReferences[ 0 ].DataType, inputPortType, result ); - } - } - else - { - UpdateInternalDataFromVariables( true ); - if( !String.IsNullOrEmpty( m_internalDataWrapper ) ) - { - if( DataType == WirePortDataType.FLOAT3x3 ) - result = Matrix3x3WrappedData(); - else - result = String.Format( m_internalDataWrapper, m_internalData ); - } - else - { - result = m_internalData; - } - } - - return result; - } - - public OutputPort GetOutputConnection( int connID = 0 ) - { - if( connID < m_externalReferences.Count ) - { - return UIUtils.GetNode( m_externalReferences[ connID ].NodeId ).GetOutputPortByUniqueId( m_externalReferences[ connID ].PortId ); - } - return null; - } - - public ParentNode GetOutputNodeWhichIsNotRelay( int connID = 0 ) - { - if( connID < m_externalReferences.Count ) - { - ParentNode node = UIUtils.GetNode( m_externalReferences[ connID ].NodeId ); - if( node is WireNode || node is RelayNode ) - { - return node.InputPorts[ 0 ].GetOutputNodeWhichIsNotRelay( connID ); - } - - return node; - } - return null; - } - - public ParentNode GetOutputNode( int connID = 0 ) - { - if( connID < m_externalReferences.Count ) - { - return UIUtils.GetNode( m_externalReferences[ connID ].NodeId ); - } - return null; - } - - public bool TypeLocked - { - get { return m_typeLocked; } - } - - public void WriteToString( ref string myString ) - { - if( m_externalReferences.Count != 1 || m_isDummy ) - { - return; - } - - IOUtils.AddTypeToString( ref myString, IOUtils.WireConnectionParam ); - IOUtils.AddFieldValueToString( ref myString, m_nodeId ); - IOUtils.AddFieldValueToString( ref myString, m_portId ); - IOUtils.AddFieldValueToString( ref myString, m_externalReferences[ 0 ].NodeId ); - IOUtils.AddFieldValueToString( ref myString, m_externalReferences[ 0 ].PortId ); - IOUtils.AddLineTerminator( ref myString ); - } - - public void ShowInternalData( Rect rect, UndoParentNode owner, bool useCustomLabel = false, string customLabel = null ) - { - string label = ( useCustomLabel == true && customLabel != null ) ? customLabel : m_internalDataPropertyLabel; - switch( m_dataType ) - { - case WirePortDataType.OBJECT: - { - InternalData = owner.EditorGUITextField( rect, label, InternalData ); - } - break; - case WirePortDataType.FLOAT: - { - FloatInternalData = owner.EditorGUIFloatField( rect, label, FloatInternalData ); - } - break; - case WirePortDataType.FLOAT2: - { - Vector2InternalData = owner.EditorGUIVector2Field( rect, label, Vector2InternalData ); - } - break; - case WirePortDataType.FLOAT3: - { - Vector3InternalData = owner.EditorGUIVector3Field( rect, label, Vector3InternalData ); - } - break; - case WirePortDataType.FLOAT4: - { - Vector4InternalData = owner.EditorGUIVector4Field( rect, label, Vector4InternalData ); - } - break; - case WirePortDataType.FLOAT3x3: - { - Matrix4x4 matrix = Matrix4x4InternalData; - Vector3 currVec3 = Vector3.zero; - for( int i = 0; i < 3; i++ ) - { - Vector4 currVec = matrix.GetRow( i ); - currVec3.Set( currVec.x, currVec.y, currVec.z ); - EditorGUI.BeginChangeCheck(); - currVec3 = owner.EditorGUIVector3Field( rect, label + "[ " + i + " ]", currVec3 ); - rect.y += 2*EditorGUIUtility.singleLineHeight; - if( EditorGUI.EndChangeCheck() ) - { - currVec.Set( currVec3.x, currVec3.y, currVec3.z, currVec.w ); - matrix.SetRow( i, currVec ); - } - } - Matrix4x4InternalData = matrix; - } - break; - case WirePortDataType.FLOAT4x4: - { - Matrix4x4 matrix = Matrix4x4InternalData; - for( int i = 0; i < 4; i++ ) - { - Vector4 currVec = matrix.GetRow( i ); - EditorGUI.BeginChangeCheck(); - currVec = owner.EditorGUIVector4Field( rect, label + "[ " + i + " ]", currVec ); - rect.y += 2*EditorGUIUtility.singleLineHeight; - if( EditorGUI.EndChangeCheck() ) - { - matrix.SetRow( i, currVec ); - } - } - Matrix4x4InternalData = matrix; - } - break; - case WirePortDataType.COLOR: - { - ColorInternalData = owner.EditorGUIColorField( rect, label, ColorInternalData ); - } - break; - case WirePortDataType.INT: - { - IntInternalData = owner.EditorGUIIntField( rect, label, IntInternalData ); - } - break; - } - } - - public void ShowInternalData( UndoParentNode owner, bool useCustomLabel = false, string customLabel = null ) - { - string label = ( useCustomLabel == true && customLabel != null ) ? customLabel : m_internalDataPropertyLabel; - switch( m_dataType ) - { - case WirePortDataType.OBJECT: - case WirePortDataType.FLOAT: - { - FloatInternalData = owner.EditorGUILayoutFloatField( label, FloatInternalData ); - } - break; - case WirePortDataType.FLOAT2: - { - Vector2InternalData = owner.EditorGUILayoutVector2Field( label, Vector2InternalData ); - } - break; - case WirePortDataType.FLOAT3: - { - Vector3InternalData = owner.EditorGUILayoutVector3Field( label, Vector3InternalData ); - } - break; - case WirePortDataType.FLOAT4: - { - Vector4InternalData = owner.EditorGUILayoutVector4Field( label, Vector4InternalData ); - } - break; - case WirePortDataType.FLOAT3x3: - { - Matrix4x4 matrix = Matrix4x4InternalData; - Vector3 currVec3 = Vector3.zero; - for( int i = 0; i < 3; i++ ) - { - Vector4 currVec = matrix.GetRow( i ); - currVec3.Set( currVec.x, currVec.y, currVec.z ); - EditorGUI.BeginChangeCheck(); - currVec3 = owner.EditorGUILayoutVector3Field( label + "[ " + i + " ]", currVec3 ); - if( EditorGUI.EndChangeCheck() ) - { - currVec.Set( currVec3.x, currVec3.y, currVec3.z, currVec.w ); - matrix.SetRow( i, currVec ); - } - } - Matrix4x4InternalData = matrix; - } - break; - case WirePortDataType.FLOAT4x4: - { - Matrix4x4 matrix = Matrix4x4InternalData; - for( int i = 0; i < 4; i++ ) - { - Vector4 currVec = matrix.GetRow( i ); - EditorGUI.BeginChangeCheck(); - currVec = owner.EditorGUILayoutVector4Field( label + "[ " + i + " ]", currVec ); - if( EditorGUI.EndChangeCheck() ) - { - matrix.SetRow( i, currVec ); - } - } - Matrix4x4InternalData = matrix; - } - break; - case WirePortDataType.COLOR: - { - ColorInternalData = owner.EditorGUILayoutColorField( label, ColorInternalData ); - } - break; - case WirePortDataType.INT: - { - IntInternalData = owner.EditorGUILayoutIntField( label, IntInternalData ); - } - break; - } - } - public bool IsZeroInternalData - { - get - { - switch( m_dataType ) - { - - case WirePortDataType.FLOAT: return Mathf.Abs(m_previewInternalFloat) < 0.001f; - case WirePortDataType.UINT: - case WirePortDataType.INT: return m_previewInternalInt == 0; - case WirePortDataType.FLOAT2: - return (Mathf.Abs( m_previewInternalVec2.x ) < 0.001f && - Mathf.Abs( m_previewInternalVec2.y ) < 0.001f); - case WirePortDataType.FLOAT3: - return (Mathf.Abs( m_previewInternalVec3.x ) < 0.001f && - Mathf.Abs( m_previewInternalVec3.y ) < 0.001f && - Mathf.Abs( m_previewInternalVec3.z ) < 0.001f ); - case WirePortDataType.FLOAT4: - return (Mathf.Abs( m_previewInternalVec4.x ) < 0.001f && - Mathf.Abs( m_previewInternalVec4.y ) < 0.001f && - Mathf.Abs( m_previewInternalVec4.z ) < 0.001f && - Mathf.Abs( m_previewInternalVec4.w ) < 0.001f ); - case WirePortDataType.COLOR: - return (Mathf.Abs( m_previewInternalColor.r ) < 0.001f && - Mathf.Abs( m_previewInternalColor.g ) < 0.001f && - Mathf.Abs( m_previewInternalColor.b ) < 0.001f && - Mathf.Abs( m_previewInternalColor.a ) < 0.001f); - - } - return true; - } - } - public float FloatInternalData - { - set { m_previewInternalFloat = value; m_internalDataUpdated = false; } - get { return m_previewInternalFloat; } - } - - public int IntInternalData - { - set { m_previewInternalInt = value; m_internalDataUpdated = false; } - get { return m_previewInternalInt; } - } - - public Vector2 Vector2InternalData - { - set { m_previewInternalVec2 = value; m_internalDataUpdated = false; } - get { return m_previewInternalVec2; } - } - - public Vector3 Vector3InternalData - { - set { m_previewInternalVec3 = value; m_internalDataUpdated = false; } - get { return m_previewInternalVec3; } - } - - public Vector4 Vector4InternalData - { - set { m_previewInternalVec4 = value; m_internalDataUpdated = false; } - get { return m_previewInternalVec4; } - } - - public Color ColorInternalData - { - set { m_previewInternalColor = value; m_internalDataUpdated = false; } - get { return m_previewInternalColor; } - } - - public Matrix4x4 Matrix4x4InternalData - { - set { m_previewInternalMatrix4x4 = value; m_internalDataUpdated = false; } - get { return m_previewInternalMatrix4x4; } - } - - public string SamplerInternalData - { - set { InternalData = UIUtils.RemoveInvalidCharacters( value ); m_internalDataUpdated = false; } - get { return m_internalData; } - } - - public override void ForceClearConnection() - { - UIUtils.DeleteConnection( true, m_nodeId, m_portId, false, true ); - } - - private bool m_internalDataUpdated = false; - private string m_displayInternalData = string.Empty; - public string DisplayInternalData - { - get - { - if( !m_internalDataUpdated ) - { - UpdateInternalDataFromVariables(); - m_internalDataUpdated = true; - m_displayInternalData = "( "+ m_internalData + " )"; - } - return m_displayInternalData; - } - } - - public string InternalData - { - get - { - UpdateInternalDataFromVariables(); - return m_internalData; - } - set - { - m_internalData = value; - UpdateVariablesFromInternalData(); - } - } - - public string WrappedInternalData - { - get - { - UpdateInternalDataFromVariables(); - return string.IsNullOrEmpty( m_internalDataWrapper ) ? m_internalData : String.Format( m_internalDataWrapper, m_internalData ); - } - } - - public override WirePortDataType DataType - { - get { return base.DataType; } - // must be set to update internal data. do not delete - set - { - m_internalDataUpdated = false; - switch( DataType ) - { - case WirePortDataType.FLOAT: - { - switch( value ) - { - case WirePortDataType.FLOAT2: m_previewInternalVec2.x = m_previewInternalFloat; break; - case WirePortDataType.FLOAT3: m_previewInternalVec3.x = m_previewInternalFloat; break; - case WirePortDataType.FLOAT4: m_previewInternalVec4.x = m_previewInternalFloat; break; - case WirePortDataType.FLOAT3x3: - case WirePortDataType.FLOAT4x4: m_previewInternalMatrix4x4[ 0 ] = m_previewInternalFloat; break; - case WirePortDataType.COLOR: m_previewInternalColor.r = m_previewInternalFloat; break; - case WirePortDataType.INT: m_previewInternalInt = (int)m_previewInternalFloat; break; - } - } - break; - case WirePortDataType.FLOAT2: - { - switch( value ) - { - case WirePortDataType.FLOAT: m_previewInternalFloat = m_previewInternalVec2.x; break; - case WirePortDataType.FLOAT3: - { - m_previewInternalVec3.x = m_previewInternalVec2.x; - m_previewInternalVec3.y = m_previewInternalVec2.y; - } - break; - case WirePortDataType.FLOAT4: - { - m_previewInternalVec4.x = m_previewInternalVec2.x; - m_previewInternalVec4.y = m_previewInternalVec2.y; - } - break; - case WirePortDataType.FLOAT3x3: - case WirePortDataType.FLOAT4x4: - { - m_previewInternalMatrix4x4[ 0 ] = m_previewInternalVec2.x; - m_previewInternalMatrix4x4[ 1 ] = m_previewInternalVec2.y; - } - break; - case WirePortDataType.COLOR: - { - m_previewInternalColor.r = m_previewInternalVec2.x; - m_previewInternalColor.g = m_previewInternalVec2.y; - } - break; - case WirePortDataType.INT: m_previewInternalInt = (int)m_previewInternalVec2.x; break; - } - } - break; - case WirePortDataType.FLOAT3: - { - switch( value ) - { - case WirePortDataType.FLOAT: m_previewInternalFloat = m_previewInternalVec3.x; break; - case WirePortDataType.FLOAT2: - { - m_previewInternalVec2.x = m_previewInternalVec3.x; - m_previewInternalVec2.y = m_previewInternalVec3.y; - } - break; - case WirePortDataType.FLOAT4: - { - m_previewInternalVec4.x = m_previewInternalVec3.x; - m_previewInternalVec4.y = m_previewInternalVec3.y; - m_previewInternalVec4.z = m_previewInternalVec3.z; - } - break; - case WirePortDataType.FLOAT3x3: - case WirePortDataType.FLOAT4x4: - { - m_previewInternalMatrix4x4[ 0 ] = m_previewInternalVec3.x; - m_previewInternalMatrix4x4[ 1 ] = m_previewInternalVec3.y; - m_previewInternalMatrix4x4[ 2 ] = m_previewInternalVec3.z; - } - break; - case WirePortDataType.COLOR: - { - m_previewInternalColor.r = m_previewInternalVec3.x; - m_previewInternalColor.g = m_previewInternalVec3.y; - m_previewInternalColor.b = m_previewInternalVec3.z; - } - break; - case WirePortDataType.INT: m_previewInternalInt = (int)m_previewInternalVec3.x; break; - } - } - break; - case WirePortDataType.FLOAT4: - { - switch( value ) - { - case WirePortDataType.FLOAT: m_previewInternalFloat = m_previewInternalVec4.x; break; - case WirePortDataType.FLOAT2: - { - m_previewInternalVec2.x = m_previewInternalVec4.x; - m_previewInternalVec2.y = m_previewInternalVec4.y; - } - break; - case WirePortDataType.FLOAT3: - { - m_previewInternalVec3.x = m_previewInternalVec4.x; - m_previewInternalVec3.y = m_previewInternalVec4.y; - m_previewInternalVec3.z = m_previewInternalVec4.z; - } - break; - case WirePortDataType.FLOAT3x3: - case WirePortDataType.FLOAT4x4: - { - m_previewInternalMatrix4x4[ 0 ] = m_previewInternalVec4.x; - m_previewInternalMatrix4x4[ 1 ] = m_previewInternalVec4.y; - m_previewInternalMatrix4x4[ 2 ] = m_previewInternalVec4.z; - m_previewInternalMatrix4x4[ 3 ] = m_previewInternalVec4.w; - } - break; - case WirePortDataType.COLOR: - { - m_previewInternalColor.r = m_previewInternalVec4.x; - m_previewInternalColor.g = m_previewInternalVec4.y; - m_previewInternalColor.b = m_previewInternalVec4.z; - m_previewInternalColor.a = m_previewInternalVec4.w; - } - break; - case WirePortDataType.INT: m_previewInternalInt = (int)m_previewInternalVec4.x; break; - } - } - break; - case WirePortDataType.FLOAT3x3: - case WirePortDataType.FLOAT4x4: - { - switch( value ) - { - case WirePortDataType.FLOAT: m_previewInternalFloat = m_previewInternalMatrix4x4[ 0 ]; break; - case WirePortDataType.FLOAT2: - { - m_previewInternalVec2.x = m_previewInternalMatrix4x4[ 0 ]; - m_previewInternalVec2.y = m_previewInternalMatrix4x4[ 1 ]; - } - break; - case WirePortDataType.FLOAT3: - { - m_previewInternalVec3.x = m_previewInternalMatrix4x4[ 0 ]; - m_previewInternalVec3.y = m_previewInternalMatrix4x4[ 1 ]; - m_previewInternalVec3.z = m_previewInternalMatrix4x4[ 2 ]; - } - break; - case WirePortDataType.FLOAT4: - { - m_previewInternalVec4.x = m_previewInternalMatrix4x4[ 0 ]; - m_previewInternalVec4.y = m_previewInternalMatrix4x4[ 1 ]; - m_previewInternalVec4.z = m_previewInternalMatrix4x4[ 2 ]; - m_previewInternalVec4.w = m_previewInternalMatrix4x4[ 3 ]; - } - break; - case WirePortDataType.COLOR: - { - m_previewInternalColor.r = m_previewInternalMatrix4x4[ 0 ]; - m_previewInternalColor.g = m_previewInternalMatrix4x4[ 1 ]; - m_previewInternalColor.b = m_previewInternalMatrix4x4[ 2 ]; - m_previewInternalColor.a = m_previewInternalMatrix4x4[ 3 ]; - } - break; - case WirePortDataType.INT: m_previewInternalInt = (int)m_previewInternalMatrix4x4[ 0 ]; break; - } - } - break; - case WirePortDataType.COLOR: - { - switch( value ) - { - case WirePortDataType.FLOAT: m_previewInternalFloat = m_previewInternalColor.r; break; - case WirePortDataType.FLOAT2: - { - m_previewInternalVec2.x = m_previewInternalColor.r; - m_previewInternalVec2.y = m_previewInternalColor.g; - } - break; - case WirePortDataType.FLOAT3: - { - m_previewInternalVec3.x = m_previewInternalColor.r; - m_previewInternalVec3.y = m_previewInternalColor.g; - m_previewInternalVec3.z = m_previewInternalColor.b; - } - break; - case WirePortDataType.FLOAT4: - { - m_previewInternalVec4.x = m_previewInternalColor.r; - m_previewInternalVec4.y = m_previewInternalColor.g; - m_previewInternalVec4.z = m_previewInternalColor.b; - m_previewInternalVec4.w = m_previewInternalColor.a; - } - break; - case WirePortDataType.FLOAT3x3: - case WirePortDataType.FLOAT4x4: - { - m_previewInternalMatrix4x4[ 0 ] = m_previewInternalColor.r; - m_previewInternalMatrix4x4[ 1 ] = m_previewInternalColor.g; - m_previewInternalMatrix4x4[ 2 ] = m_previewInternalColor.b; - m_previewInternalMatrix4x4[ 3 ] = m_previewInternalColor.a; - } - break; - case WirePortDataType.INT: m_previewInternalInt = (int)m_previewInternalColor.r; break; - } - } - break; - case WirePortDataType.INT: - { - switch( value ) - { - case WirePortDataType.FLOAT: m_previewInternalFloat = m_previewInternalInt; break; - case WirePortDataType.FLOAT2: m_previewInternalVec2.x = m_previewInternalInt; break; - case WirePortDataType.FLOAT3: m_previewInternalVec3.x = m_previewInternalInt; break; - case WirePortDataType.FLOAT4: m_previewInternalVec4.x = m_previewInternalInt; break; - case WirePortDataType.FLOAT3x3: - case WirePortDataType.FLOAT4x4: m_previewInternalMatrix4x4[ 0 ] = m_previewInternalInt; break; - case WirePortDataType.COLOR: m_previewInternalColor.r = m_previewInternalInt; break; - } - } - break; - } - base.DataType = value; - } - } - - public string DataName - { - get { return m_dataName; } - set { m_dataName = value; } - } - - public bool IsFragment { get { return m_category == MasterNodePortCategory.Fragment || m_category == MasterNodePortCategory.Debug; } } - public MasterNodePortCategory Category - { - set { m_category = value; } - get { return m_category; } - } - - private int CachedIntPropertyID - { - get - { - if( m_cachedIntShaderID == -1 ) - m_cachedIntShaderID = Shader.PropertyToID( "_InputInt" ); - return m_cachedIntShaderID; - } - } - - private int CachedFloatPropertyID - { - get - { - if( m_cachedFloatShaderID == -1 ) - m_cachedFloatShaderID = Shader.PropertyToID( "_InputFloat" ); - return m_cachedFloatShaderID; - } - } - - private int CachedVectorPropertyID - { - get - { - if( m_cachedVectorShaderID == -1 ) - m_cachedVectorShaderID = Shader.PropertyToID( "_InputVector" ); - return m_cachedVectorShaderID; - } - } - - private int CachedColorPropertyID - { - get - { - if( m_cachedColorShaderID == -1 ) - m_cachedColorShaderID = Shader.PropertyToID( "_InputColor" ); - return m_cachedColorShaderID; - } - } - - private int CachedDefaultTexPropertyID - { - get - { - if( m_cachedDefaultTexShaderID == -1 ) - m_cachedDefaultTexShaderID = Shader.PropertyToID( "_Default" ); - return m_cachedDefaultTexShaderID; - } - } - - private int Cached2DPropertyID - { - get - { - if( m_cached2DShaderID == -1 ) - m_cached2DShaderID = Shader.PropertyToID( "_Input2D" ); - return m_cached2DShaderID; - } - } - - public int CachedPropertyId - { - get { return m_cachedPropertyId; } - } - - public bool InputNodeHasPreview( ParentGraph container ) - { - ParentNode node = null; - if( m_externalReferences.Count > 0) - { - node = container.GetNode( m_externalReferences[ 0 ].NodeId ); - } - - if( node != null ) - return node.HasPreviewShader; - - return false; - } - - public void PreparePortCacheID() - { - if( m_propertyNameInt != PortId || string.IsNullOrEmpty( m_propertyName ) ) - { - m_propertyNameInt = PortId; - m_propertyName = "_" + Convert.ToChar( PortId + 65 ); - m_cachedPropertyId = Shader.PropertyToID( m_propertyName ); - } - - if( m_cachedPropertyId == -1 ) - m_cachedPropertyId = Shader.PropertyToID( m_propertyName ); - } - - public void SetPreviewInputTexture( ParentGraph container ) - { - PreparePortCacheID(); - - if( (object)m_node == null ) - { - m_node = container.GetNode( NodeId ); - //m_node = UIUtils.GetNode( NodeId ); - } - - if( ExternalReferences.Count>0 ) - { - m_node.PreviewMaterial.SetTexture( m_cachedPropertyId, container.GetNode( ExternalReferences[ 0 ].NodeId ).GetOutputPortByUniqueId( ExternalReferences[ 0 ].PortId ).OutputPreviewTexture ); - } - //m_node.PreviewMaterial.SetTexture( m_cachedPropertyId, GetOutputConnection( 0 ).OutputPreviewTexture ); - } - - private void SetPortPreviewShader( Shader portShader ) - { - if( m_inputPreviewShader != portShader ) - { - m_inputPreviewShader = portShader; - InputPreviewMaterial.shader = portShader; - } - } - - public void SetPreviewInputValue( ParentGraph container ) - { - if( m_inputPreviewTexture == null ) - { - m_inputPreviewTexture = new RenderTexture( 128, 128, 0, RenderTextureFormat.ARGBFloat, RenderTextureReadWrite.Linear ); - m_inputPreviewTexture.wrapMode = TextureWrapMode.Repeat; - } - - switch( DataType ) - { - case WirePortDataType.INT: - { - SetPortPreviewShader( UIUtils.IntShader ); - - InputPreviewMaterial.SetInt( CachedIntPropertyID, m_previewInternalInt ); - } - break; - case WirePortDataType.FLOAT: - { - SetPortPreviewShader( UIUtils.FloatShader ); - //Debug.Log( m_previewInternalFloat ); - InputPreviewMaterial.SetFloat( CachedFloatPropertyID, m_previewInternalFloat ); - } - break; - case WirePortDataType.FLOAT2: - { - SetPortPreviewShader( UIUtils.Vector2Shader ); - - Vector2 v2 = m_previewInternalVec2;// Vector2InternalData; - InputPreviewMaterial.SetVector( CachedVectorPropertyID, new Vector4( v2.x, v2.y, 0, 0 ) ); - } - break; - case WirePortDataType.FLOAT3: - { - SetPortPreviewShader( UIUtils.Vector3Shader ); - - Vector3 v3 = m_previewInternalVec3;// Vector3InternalData; - InputPreviewMaterial.SetVector( CachedVectorPropertyID, new Vector4( v3.x, v3.y, v3.z, 0 ) ); - } - break; - case WirePortDataType.FLOAT4: - { - SetPortPreviewShader( UIUtils.Vector4Shader ); - - InputPreviewMaterial.SetVector( CachedVectorPropertyID, m_previewInternalVec4 ); - } - break; - case WirePortDataType.COLOR: - { - SetPortPreviewShader( UIUtils.ColorShader ); - - InputPreviewMaterial.SetColor( CachedColorPropertyID, m_previewInternalColor ); - } - break; - case WirePortDataType.FLOAT3x3: - case WirePortDataType.FLOAT4x4: - { - SetPortPreviewShader( UIUtils.FloatShader ); - - InputPreviewMaterial.SetFloat( CachedFloatPropertyID, 1 ); - } - break; - case WirePortDataType.SAMPLER2D: - { - SetPortPreviewShader( UIUtils.Texture2DShader ); - } - break; - default: - { - SetPortPreviewShader( UIUtils.FloatShader ); - - InputPreviewMaterial.SetFloat( CachedFloatPropertyID, 0 ); - } - break; - } - - RenderTexture temp = RenderTexture.active; - RenderTexture.active = m_inputPreviewTexture; - Graphics.Blit( null, m_inputPreviewTexture, InputPreviewMaterial ); - RenderTexture.active = temp; - - PreparePortCacheID(); - - //if( (object)m_node == null ) - // m_node = UIUtils.GetNode( NodeId ); - - if( (object)m_node == null ) - { - m_node = container.GetNode( NodeId ); - //m_node = UIUtils.GetNode( NodeId ); - } - //m_propertyName = "_A"; - //Debug.Log( m_propertyName ); - m_node.PreviewMaterial.SetTexture( m_propertyName, m_inputPreviewTexture ); - } - - public override void ChangePortId( int newPortId ) - { - if( IsConnected ) - { - int count = ExternalReferences.Count; - for( int connIdx = 0; connIdx < count; connIdx++ ) - { - int nodeId = ExternalReferences[ connIdx ].NodeId; - int portId = ExternalReferences[ connIdx ].PortId; - ParentNode node = UIUtils.GetNode( nodeId ); - if( node != null ) - { - OutputPort outputPort = node.GetOutputPortByUniqueId( portId ); - int outputCount = outputPort.ExternalReferences.Count; - for( int j = 0; j < outputCount; j++ ) - { - if( outputPort.ExternalReferences[ j ].NodeId == NodeId && - outputPort.ExternalReferences[ j ].PortId == PortId ) - { - outputPort.ExternalReferences[ j ].PortId = newPortId; - } - } - } - } - } - - PortId = newPortId; - } - - public override void Destroy() - { - base.Destroy(); - //if ( m_inputPreview != null ) - // UnityEngine.ScriptableObject.DestroyImmediate( m_inputPreview ); - //m_inputPreview = null; - - if( m_inputPreviewTexture != null ) - UnityEngine.ScriptableObject.DestroyImmediate( m_inputPreviewTexture ); - m_inputPreviewTexture = null; - - if( m_inputPreviewMaterial != null ) - UnityEngine.ScriptableObject.DestroyImmediate( m_inputPreviewMaterial ); - m_inputPreviewMaterial = null; - - m_inputPreviewShader = null; - - m_node = null; - } - - public Shader InputPreviewShader - { - get - { - if( m_inputPreviewShader == null ) - m_inputPreviewShader = AssetDatabase.LoadAssetAtPath<Shader>( AssetDatabase.GUIDToAssetPath( "d9ca47581ac157145bff6f72ac5dd73e" ) ); //ranged float - - if( m_inputPreviewShader == null ) - m_inputPreviewShader = Shader.Find( "Unlit/Colored Transparent" ); - - return m_inputPreviewShader; - } - set - { - m_inputPreviewShader = value; - } - } - - public Material InputPreviewMaterial - { - get - { - if( m_inputPreviewMaterial == null ) - m_inputPreviewMaterial = new Material( InputPreviewShader ); - - return m_inputPreviewMaterial; - } - //set - //{ - // m_inputPreviewMaterial = value; - //} - } - - public override string Name - { - get { return m_name; } - set - { - m_name = value; - m_internalDataPropertyLabel = ( string.IsNullOrEmpty( value ) || value.Equals( Constants.EmptyPortValue ) ) ? InputDefaultNameStr : value; - m_dirtyLabelSize = true; - } - } - - public string InternalDataName - { - get { return m_internalDataPropertyLabel; } - set { m_internalDataPropertyLabel = value; } - } - - public bool AutoDrawInternalData - { - get { return m_drawInternalData; } - set { m_drawInternalData = value; } - } - - public PortGenType GenType - { - get { return m_genType; } - set { m_genType = value; } - } - - public bool ValidInternalData - { - get - { - switch( m_dataType ) - { - case WirePortDataType.FLOAT: - case WirePortDataType.FLOAT2: - case WirePortDataType.FLOAT3: - case WirePortDataType.FLOAT4: - case WirePortDataType.FLOAT3x3: - case WirePortDataType.FLOAT4x4: - case WirePortDataType.COLOR: - case WirePortDataType.INT: return true; - case WirePortDataType.OBJECT: - case WirePortDataType.SAMPLER1D: - case WirePortDataType.SAMPLER2D: - case WirePortDataType.SAMPLER3D: - case WirePortDataType.SAMPLERCUBE: - default: return false; - } - } - } - - //public RenderTexture InputPreviewTexture - //{ - // get - // { - // if( IsConnected ) - // return GetOutputConnection( 0 ).OutputPreviewTexture; - // else - // return m_inputPreviewTexture; - // } - //} - - public RenderTexture InputPreviewTexture( ParentGraph container ) - { - if( IsConnected ) - { - if( m_externalReferences.Count > 0 ) - return container.GetNode( m_externalReferences[ 0 ].NodeId ).GetOutputPortByUniqueId( m_externalReferences[ 0 ].PortId ).OutputPreviewTexture; - else - return null; - } - else - { - return m_inputPreviewTexture; - } - } - - public string ExternalLinkId - { - get { return m_externalLinkId; } - set - { - m_externalLinkId = value; - if( string.IsNullOrEmpty( value ) ) - { - m_externalNodeLink = -1; - m_externalPortLink = -1; - } - } - } - - public bool HasOwnOrLinkConnection { get { return IsConnected || HasConnectedExternalLink; } } - public bool HasExternalLink { get { return m_externalNodeLink > -1 && m_externalPortLink > -1; } } - - public bool HasConnectedExternalLink - { - get - { - InputPort link = ExternalLink; - return ( link != null && link.IsConnected ); - } - } - - public InputPort ExternalLink - { - get - { - if( HasExternalLink ) - { - ParentNode linkNode = UIUtils.GetNode( m_externalNodeLink ); - if( linkNode != null ) - { - return linkNode.GetInputPortByUniqueId( m_externalPortLink ); - } - } - return null; - } - } - - public ParentNode ExternalLinkNode - { - get - { - if( HasExternalLink ) - { - return UIUtils.GetNode( m_externalNodeLink ); - } - return null; - } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Wires/InputPort.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Wires/InputPort.cs.meta deleted file mode 100644 index 421ab30b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Wires/InputPort.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: e8199169aaf7f404492a0f2353fb52f9 -timeCreated: 1481126960 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Wires/OutputPort.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Wires/OutputPort.cs deleted file mode 100644 index 3050aa85..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Wires/OutputPort.cs +++ /dev/null @@ -1,306 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEditor; -using UnityEngine; - -namespace AmplifyShaderEditor -{ - [System.Serializable] - public sealed class OutputPort : WirePort - { - public delegate void OnNewPreviewRTCreated(); - public OnNewPreviewRTCreated OnNewPreviewRTCreatedEvent; - - [SerializeField] - private bool m_connectedToMasterNode; - - [SerializeField] - private bool[] m_isLocalValue = { false, false}; - - [SerializeField] - private string[] m_localOutputValue = { string.Empty,string.Empty}; - - //[SerializeField] - //private int m_isLocalWithPortType = 0; - - private RenderTexture m_outputPreview = null; - private Material m_outputMaskMaterial = null; - - private int m_indexPreviewOffset = 0; - - public OutputPort( ParentNode owner, int nodeId, int portId, WirePortDataType dataType, string name ) : base( nodeId, portId, dataType, name ) - { - LabelSize = Vector2.zero; - OnNewPreviewRTCreatedEvent += owner.SetPreviewDirtyFromOutputs; - } - - public string ErrorValue - { - get - { - string value = string.Empty; - switch( m_dataType ) - { - default: - case WirePortDataType.OBJECT: - case WirePortDataType.INT: - case WirePortDataType.FLOAT: value = "(0)"; break; - case WirePortDataType.FLOAT2: value = "half2(0,0)"; break; - case WirePortDataType.FLOAT3: value = "half3(0,0,0)"; break; - case WirePortDataType.COLOR: - case WirePortDataType.FLOAT4: value = "half4(0,0,0,0)"; break; - case WirePortDataType.FLOAT3x3: value = "half3x3(0,0,0,0,0,0,0,0,0)"; break; - case WirePortDataType.FLOAT4x4: value = "half4x4(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)"; break; - } - return value; - } - } - - public bool ConnectedToMasterNode - { - get { return m_connectedToMasterNode; } - set { m_connectedToMasterNode = value; } - } - - public override void FullDeleteConnections() - { - UIUtils.DeleteConnection( false, m_nodeId, m_portId, true, true ); - } - - public bool HasConnectedNode - { - get - { - int count = m_externalReferences.Count; - for( int i = 0; i < count; i++ ) - { - if( UIUtils.GetNode( m_externalReferences[ i ].NodeId ).IsConnected ) - return true; - } - return false; - } - } - public InputPort GetInputConnection( int connID = 0 ) - { - if( connID < m_externalReferences.Count ) - { - return UIUtils.GetNode( m_externalReferences[ connID ].NodeId ).GetInputPortByUniqueId( m_externalReferences[ connID ].PortId ); - } - return null; - } - - public ParentNode GetInputNode( int connID = 0 ) - { - if( connID < m_externalReferences.Count ) - { - return UIUtils.GetNode( m_externalReferences[ connID ].NodeId ); - } - return null; - } - - public override void NotifyExternalRefencesOnChange() - { - for( int i = 0; i < m_externalReferences.Count; i++ ) - { - ParentNode node = UIUtils.GetNode( m_externalReferences[ i ].NodeId ); - if( node ) - { - node.CheckSpherePreview(); - InputPort port = node.GetInputPortByUniqueId( m_externalReferences[ i ].PortId ); - port.UpdateInfoOnExternalConn( m_nodeId, m_portId, m_dataType ); - node.OnConnectedOutputNodeChanges( m_externalReferences[ i ].PortId, m_nodeId, m_portId, m_name, m_dataType ); - } - } - } - - public void ChangeTypeWithRestrictions( WirePortDataType newType, int restrictions ) - { - if( m_dataType != newType ) - { - DataType = newType; - for( int i = 0; i < m_externalReferences.Count; i++ ) - { - ParentNode inNode = UIUtils.GetNode( m_externalReferences[ i ].NodeId ); - InputPort inputPort = inNode.GetInputPortByUniqueId( m_externalReferences[ i ].PortId ); - - bool valid = false; - if( restrictions == 0 ) - { - valid = true; - } - else - { - valid = ( restrictions & (int)inputPort.DataType ) != 0; - } - - if( valid ) - { - inNode.CheckSpherePreview(); - inputPort.UpdateInfoOnExternalConn( m_nodeId, m_portId, m_dataType ); - inNode.OnConnectedOutputNodeChanges( m_externalReferences[ i ].PortId, m_nodeId, m_portId, m_name, m_dataType ); - } - else - { - InvalidateConnection( m_externalReferences[ i ].NodeId, m_externalReferences[ i ].PortId ); - inputPort.InvalidateConnection( NodeId, PortId ); - i--; - } - } - } - } - - public override void ChangePortId( int newPortId ) - { - if( IsConnected ) - { - int count = ExternalReferences.Count; - for( int connIdx = 0; connIdx < count; connIdx++ ) - { - int nodeId = ExternalReferences[ connIdx ].NodeId; - int portId = ExternalReferences[ connIdx ].PortId; - ParentNode node = UIUtils.GetNode( nodeId ); - if( node != null ) - { - InputPort inputPort = node.GetInputPortByUniqueId( portId ); - int inputCount = inputPort.ExternalReferences.Count; - for( int j = 0; j < inputCount; j++ ) - { - if( inputPort.ExternalReferences[ j ].NodeId == NodeId && - inputPort.ExternalReferences[ j ].PortId == PortId ) - { - inputPort.ExternalReferences[ j ].PortId = newPortId; - } - } - } - } - } - - PortId = newPortId; - } - - public string ConfigOutputLocalValue( PrecisionType precisionType, string value, string customName, MasterNodePortCategory category ) - { - int idx = UIUtils.PortCategorytoAttayIdx( category ); - ParentGraph currentGraph = UIUtils.GetNode( NodeId ).ContainerGraph; - string autoGraphId = currentGraph.GraphId > 0 ? "_g" + currentGraph.GraphId : string.Empty; - m_localOutputValue[idx] = string.IsNullOrEmpty( customName ) ? ( "temp_output_" + m_nodeId + "_" + PortId + autoGraphId ) : customName; - m_isLocalValue[idx] = true; - //m_isLocalWithPortType |= (int)category; - return string.Format( Constants.LocalValueDecWithoutIdent, UIUtils.PrecisionWirePortToCgType( precisionType, DataType ), m_localOutputValue[idx], value ); - } - - public void SetLocalValue( string value, MasterNodePortCategory category ) - { - int idx = UIUtils.PortCategorytoAttayIdx( category ); - m_isLocalValue[idx] = true; - m_localOutputValue[ idx ] = value; - //m_isLocalWithPortType |= (int)category; - } - - public void ResetLocalValue() - { - for( int i = 0; i < m_localOutputValue.Length; i++ ) - { - m_localOutputValue[ i ] = string.Empty; - m_isLocalValue[i] = false; - } - //m_isLocalWithPortType = 0; - } - - public void ResetLocalValueIfNot( MasterNodePortCategory category ) - { - int idx = UIUtils.PortCategorytoAttayIdx( category ); - for( int i = 0; i < m_localOutputValue.Length; i++ ) - { - if( i != idx ) - { - m_localOutputValue[ i ] = string.Empty; - m_isLocalValue[ i ] = false; - } - } - } - - public void ResetLocalValueOnCategory( MasterNodePortCategory category ) - { - int idx = UIUtils.PortCategorytoAttayIdx( category ); - m_localOutputValue[ idx ] = string.Empty; - m_isLocalValue[ idx ] = false; - } - - public bool IsLocalOnCategory( MasterNodePortCategory category ) - { - int idx = UIUtils.PortCategorytoAttayIdx( category ); - return m_isLocalValue[ idx ]; - //return ( m_isLocalWithPortType & (int)category ) != 0; ; - } - - public override void ForceClearConnection() - { - UIUtils.DeleteConnection( false, m_nodeId, m_portId, false, true ); - } - - public bool IsLocalValue( MasterNodePortCategory category ) - { - int idx = UIUtils.PortCategorytoAttayIdx( category ); - return m_isLocalValue[ idx ]; - } - - public string LocalValue(MasterNodePortCategory category) - { - int idx = UIUtils.PortCategorytoAttayIdx( category ); - return m_localOutputValue[idx]; - } - - public RenderTexture OutputPreviewTexture - { - get - { - if( m_outputPreview == null ) - { - m_outputPreview = new RenderTexture( 128, 128, 0, RenderTextureFormat.ARGBFloat, RenderTextureReadWrite.Linear ); - m_outputPreview.wrapMode = TextureWrapMode.Repeat; - if( OnNewPreviewRTCreatedEvent != null ) - OnNewPreviewRTCreatedEvent(); - } - - return m_outputPreview; - } - set { m_outputPreview = value; } - } - - public int IndexPreviewOffset - { - get { return m_indexPreviewOffset; } - set { m_indexPreviewOffset = value; } - } - - public override void Destroy() - { - base.Destroy(); - if( m_outputPreview != null ) - UnityEngine.ScriptableObject.DestroyImmediate( m_outputPreview ); - m_outputPreview = null; - - if( m_outputMaskMaterial != null ) - UnityEngine.ScriptableObject.DestroyImmediate( m_outputMaskMaterial ); - m_outputMaskMaterial = null; - - OnNewPreviewRTCreatedEvent = null; - } - - public Material MaskingMaterial - { - get - { - if( m_outputMaskMaterial == null ) - { - //m_outputMaskMaterial = new Material( AssetDatabase.LoadAssetAtPath<Shader>( AssetDatabase.GUIDToAssetPath( "9c34f18ebe2be3e48b201b748c73dec0" ) ) ); - m_outputMaskMaterial = new Material( UIUtils.MaskingShader ); - } - return m_outputMaskMaterial; - } - //set { m_outputMaskMaterial = value; } - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Wires/OutputPort.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Wires/OutputPort.cs.meta deleted file mode 100644 index 9825de10..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Wires/OutputPort.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 82722ce1ba0df314490a9362e503727c -timeCreated: 1481126957 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Wires/WireBezierReference.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Wires/WireBezierReference.cs deleted file mode 100644 index 6753ff02..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Wires/WireBezierReference.cs +++ /dev/null @@ -1,58 +0,0 @@ -using UnityEngine; - -namespace AmplifyShaderEditor -{ - [System.Serializable] - public class WireBezierReference - { - private Rect m_boundingBox; - private int m_inNodeId; - private int m_inPortId; - private int m_outNodeId; - private int m_outPortId; - - public WireBezierReference() - { - m_boundingBox = new Rect(); - m_inNodeId = -1; - m_inPortId = -1; - m_outNodeId = -1; - m_outPortId = -1; - } - - public WireBezierReference( ref Rect area, int inNodeId, int inPortId, int outNodeId, int outPortId ) - { - UpdateInfo( ref area, inNodeId, inPortId, outNodeId, outPortId ); - } - - public void UpdateInfo( ref Rect area, int inNodeId, int inPortId, int outNodeId, int outPortId ) - { - m_boundingBox = area; - m_inNodeId = inNodeId; - m_inPortId = inPortId; - m_outNodeId = outNodeId; - m_outPortId = outPortId; - } - - public bool Contains( Vector2 position ) - { - return m_boundingBox.Contains( position ); - } - - public void DebugDraw() - { - GUI.Label( m_boundingBox, string.Empty, UIUtils.GetCustomStyle( CustomStyle.MainCanvasTitle )); - } - - public override string ToString() - { - return string.Format( "In node: {0} port: {1} -> Out node: {2} port: {3}", m_inNodeId, m_inPortId, m_outNodeId, m_outPortId ); - } - - public Rect BoundingBox { get { return m_boundingBox; } } - public int InNodeId { get { return m_inNodeId; } } - public int InPortId { get { return m_inPortId; } } - public int OutNodeId { get { return m_outNodeId; } } - public int OutPortId { get { return m_outPortId; } } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Wires/WireBezierReference.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Wires/WireBezierReference.cs.meta deleted file mode 100644 index df5640c3..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Wires/WireBezierReference.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 499682ec40529f44480d58747ad7ab44 -timeCreated: 1481126955 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Wires/WirePort.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Wires/WirePort.cs deleted file mode 100644 index 326bc871..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Wires/WirePort.cs +++ /dev/null @@ -1,597 +0,0 @@ -// Amplify Shader Editor - Visual Shader Editing Tool -// Copyright (c) Amplify Creations, Lda <info@amplify.pt> - -using UnityEngine; -using UnityEditor; - -using System.Collections.Generic; - -namespace AmplifyShaderEditor -{ - public enum WirePortDataType - { - OBJECT = 1 << 1, - FLOAT = 1 << 2, - FLOAT2 = 1 << 3, - FLOAT3 = 1 << 4, - FLOAT4 = 1 << 5, - FLOAT3x3 = 1 << 6, - FLOAT4x4 = 1 << 7, - COLOR = 1 << 8, - INT = 1 << 9, - SAMPLER1D = 1 << 10, - SAMPLER2D = 1 << 11, - SAMPLER3D = 1 << 12, - SAMPLERCUBE = 1 << 13, - UINT = 1 << 14 - } - - public enum VariableQualifiers - { - In = 0, - Out, - InOut - } - - public struct WirePortDataTypeComparer : IEqualityComparer<WirePortDataType> - { - public bool Equals( WirePortDataType x, WirePortDataType y ) - { - return x == y; - } - - public int GetHashCode( WirePortDataType obj ) - { - // you need to do some thinking here, - return (int)obj; - } - } - - [System.Serializable] - public class WirePort - { - private const double PortClickTime = 0.2; - - private double m_lastTimeClicked = -1; - - private Vector2 m_labelSize; - private Vector2 m_unscaledLabelSize; - protected bool m_dirtyLabelSize = true; - - private bool m_isEditable = false; - private bool m_editingName = false; - - protected int m_portRestrictions = 0; - - private bool m_repeatButtonState = false; - - [SerializeField] - private Rect m_position; - - [SerializeField] - private Rect m_labelPosition; - - [SerializeField] - protected int m_nodeId = -1; - - [SerializeField] - protected int m_portId = -1; - - [SerializeField] - protected int m_orderId = -1; - - [SerializeField] - protected WirePortDataType m_dataType = WirePortDataType.FLOAT; - - [SerializeField] - protected string m_name; - - [SerializeField] - protected List<WireReference> m_externalReferences; - - [SerializeField] - protected bool m_locked = false; - - [SerializeField] - protected bool m_visible = true; - - [SerializeField] - protected bool m_isDummy = false; - - [SerializeField] - protected bool m_hasCustomColor = false; - - [SerializeField] - protected Color m_customColor = Color.white; - - [SerializeField] - protected Rect m_activePortArea; - - public WirePort( int nodeId, int portId, WirePortDataType dataType, string name, int orderId = -1 ) - { - m_nodeId = nodeId; - m_portId = portId; - m_orderId = orderId; - m_dataType = dataType; - m_name = name; - m_externalReferences = new List<WireReference>(); - } - - public virtual void Destroy() - { - m_externalReferences.Clear(); - m_externalReferences = null; - } - - public void AddPortForbiddenTypes( params WirePortDataType[] forbiddenTypes ) - { - if( forbiddenTypes != null ) - { - if( m_portRestrictions == 0 ) - { - //if no previous restrictions are detected then we set up the bit array so we can set is bit correctly - m_portRestrictions = int.MaxValue; - } - - for( int i = 0; i < forbiddenTypes.Length; i++ ) - { - m_portRestrictions = m_portRestrictions & ( int.MaxValue - (int)forbiddenTypes[ i ] ); - } - } - } - - public void AddPortRestrictions( params WirePortDataType[] validTypes ) - { - if( validTypes != null ) - { - for( int i = 0; i < validTypes.Length; i++ ) - { - m_portRestrictions = m_portRestrictions | (int)validTypes[ i ]; - } - } - } - - public void CreatePortRestrictions( params WirePortDataType[] validTypes ) - { - m_portRestrictions = 0; - if( validTypes != null ) - { - for( int i = 0; i < validTypes.Length; i++ ) - { - m_portRestrictions = m_portRestrictions | (int)validTypes[ i ]; - } - } - } - - public virtual bool CheckValidType( WirePortDataType dataType ) - { - if( m_portRestrictions == 0 ) - { - return true; - } - - return ( m_portRestrictions & (int)dataType ) != 0; - } - - public bool ConnectTo( WireReference port ) - { - if( m_locked ) - return false; - - if( m_externalReferences.Contains( port ) ) - return false; - - m_externalReferences.Add( port ); - return true; - } - - public bool ConnectTo( int nodeId, int portId ) - { - if( m_locked ) - return false; - - - foreach( WireReference reference in m_externalReferences ) - { - if( reference.NodeId == nodeId && reference.PortId == portId ) - { - return false; - } - } - m_externalReferences.Add( new WireReference( nodeId, portId, m_dataType, false ) ); - return true; - } - - public bool ConnectTo( int nodeId, int portId, WirePortDataType dataType, bool typeLocked ) - { - if( m_locked ) - return false; - - foreach( WireReference reference in m_externalReferences ) - { - if( reference.NodeId == nodeId && reference.PortId == portId ) - { - return false; - } - } - m_externalReferences.Add( new WireReference( nodeId, portId, dataType, typeLocked ) ); - return true; - } - - public void DummyAdd( int nodeId, int portId ) - { - m_externalReferences.Insert( 0, new WireReference( nodeId, portId, WirePortDataType.OBJECT, false ) ); - m_isDummy = true; - } - - public void DummyRemove() - { - m_externalReferences.RemoveAt( 0 ); - m_isDummy = false; - } - - public void DummyClear() - { - m_externalReferences.Clear(); - m_isDummy = false; - } - - public WireReference GetConnection( int connID = 0 ) - { - if( connID < m_externalReferences.Count ) - return m_externalReferences[ connID ]; - return null; - } - - public void ChangeProperties( string newName, WirePortDataType newType, bool invalidateConnections ) - { - Name = newName; - ChangeType( newType, invalidateConnections ); - //if ( m_dataType != newType ) - //{ - // DataType = newType; - // if ( invalidateConnections ) - // { - // InvalidateAllConnections(); - // } - // else - // { - // NotifyExternalRefencesOnChange(); - // } - //} - } - - public void ChangeType( WirePortDataType newType, bool invalidateConnections ) - { - if( m_dataType != newType ) - { - //ParentNode node = UIUtils.GetNode( m_nodeId ); - //if ( node ) - //{ - // Undo.RegisterCompleteObjectUndo( node.ContainerGraph.ParentWindow, Constants.UndoChangeTypeNodesId ); - // Undo.RecordObject( node, Constants.UndoChangeTypeNodesId ); - //} - DataType = newType; - if( invalidateConnections ) - { - InvalidateAllConnections(); - } - else - { - NotifyExternalRefencesOnChange(); - } - } - } - - public virtual void ChangePortId( int newId ) { } - public virtual void NotifyExternalRefencesOnChange() { } - - public void UpdateInfoOnExternalConn( int nodeId, int portId, WirePortDataType type ) - { - for( int i = 0; i < m_externalReferences.Count; i++ ) - { - if( m_externalReferences[ i ].NodeId == nodeId && m_externalReferences[ i ].PortId == portId ) - { - m_externalReferences[ i ].DataType = type; - } - } - } - - public void InvalidateConnection( int nodeId, int portId ) - { - int id = -1; - for( int i = 0; i < m_externalReferences.Count; i++ ) - { - if( m_externalReferences[ i ].NodeId == nodeId && m_externalReferences[ i ].PortId == portId ) - { - id = i; - break; - } - } - - if( id > -1 ) - m_externalReferences.RemoveAt( id ); - } - - public void RemoveInvalidConnections() - { - Debug.Log( "Cleaning invalid connections" ); - List<WireReference> validConnections = new List<WireReference>(); - for( int i = 0; i < m_externalReferences.Count; i++ ) - { - if( m_externalReferences[ i ].IsValid ) - { - validConnections.Add( m_externalReferences[ i ] ); - } - else - { - Debug.Log( "Detected invalid connection on node " + m_nodeId + " port " + m_portId ); - } - } - m_externalReferences.Clear(); - m_externalReferences = validConnections; - } - - public void InvalidateAllConnections() - { - m_externalReferences.Clear(); - } - - public virtual void FullDeleteConnections() { } - - public bool IsConnectedTo( int nodeId, int portId ) - { - if( m_locked ) - return false; - - for( int i = 0; i < m_externalReferences.Count; i++ ) - { - if( m_externalReferences[ i ].NodeId == nodeId && m_externalReferences[ i ].PortId == portId ) - return true; - } - return false; - } - - public WirePortDataType ConnectionType( int id = 0 ) - { - return ( id < m_externalReferences.Count ) ? m_externalReferences[ id ].DataType : DataType; - } - - public bool CheckMatchConnectionType( int id = 0 ) - { - if( id < m_externalReferences.Count ) - return m_externalReferences[ id ].DataType == DataType; - - return false; - } - - public void MatchPortToConnection( int id = 0 ) - { - if( id < m_externalReferences.Count ) - { - DataType = m_externalReferences[ id ].DataType; - } - } - - public void ResetWireReferenceStatus() - { - for( int i = 0; i < m_externalReferences.Count; i++ ) - { - m_externalReferences[ i ].WireStatus = WireStatus.Default; - } - } - - public bool InsideActiveArea( Vector2 pos ) - { - return m_activePortArea.Contains( pos ); - } - - public void Click() - { - if( m_isEditable ) - { - if( ( EditorApplication.timeSinceStartup - m_lastTimeClicked ) < PortClickTime ) - { - m_editingName = true; - GUI.FocusControl( "port" + m_nodeId.ToString() + m_portId.ToString() ); - TextEditor te = (TextEditor)GUIUtility.GetStateObject( typeof( TextEditor ), GUIUtility.keyboardControl ); - if( te != null ) - { - te.SelectAll(); - } - } - - m_lastTimeClicked = EditorApplication.timeSinceStartup; - } - } - - public bool Draw( Rect textPos, GUIStyle style ) - { - bool changeFlag = false; - if( m_isEditable && m_editingName ) - { - textPos.width = m_labelSize.x; - EditorGUI.BeginChangeCheck(); - GUI.SetNextControlName( "port" + m_nodeId.ToString() + m_portId.ToString() ); - m_name = GUI.TextField( textPos, m_name, style ); - if( EditorGUI.EndChangeCheck() ) - { - m_dirtyLabelSize = true; - changeFlag = true; - } - - if( Event.current.isKey && ( Event.current.keyCode == KeyCode.Return || Event.current.keyCode == KeyCode.KeypadEnter ) ) - { - m_editingName = false; - GUIUtility.keyboardControl = 0; - } - } - else - { - GUI.Label( textPos, m_name, style ); - } - //GUI.Label( textPos, string.Empty ); - return changeFlag; - } - - public void ResetEditing() - { - m_editingName = false; - } - - public virtual void ForceClearConnection() { } - - public bool IsConnected - { - get { return ( m_externalReferences.Count > 0 && !m_locked ); } - } - - public List<WireReference> ExternalReferences - { - get { return m_externalReferences; } - } - - public int ConnectionCount - { - get { return m_externalReferences.Count; } - } - - public Rect Position - { - get { return m_position; } - set { m_position = value; } - } - - public Rect LabelPosition - { - get { return m_labelPosition; } - set { m_labelPosition = value; } - } - - public int PortId - { - get { return m_portId; } - set { m_portId = value; } - } - - public int OrderId - { - get { return m_orderId; } - set { m_orderId = value; } - } - - - public int NodeId - { - get { return m_nodeId; } - set { m_nodeId = value; } - } - - public virtual WirePortDataType DataType - { - get { return m_dataType; } - set { m_dataType = value; } - } - - public bool Visible - { - get { return m_visible; } - set - { - m_visible = value; - if( !m_visible && IsConnected ) - { - ForceClearConnection(); - } - } - } - - public bool Locked - { - get { return m_locked; } - set - { - //if ( m_locked && IsConnected ) - //{ - // ForceClearConnection(); - //} - m_locked = value; - } - } - - public virtual string Name - { - get { return m_name; } - set { m_name = value; m_dirtyLabelSize = true; } - } - - public bool DirtyLabelSize - { - get { return m_dirtyLabelSize; } - set { m_dirtyLabelSize = value; } - } - - public bool HasCustomColor - { - get { return m_hasCustomColor; } - } - - public Color CustomColor - { - get { return m_customColor; } - set - { - m_hasCustomColor = true; - m_customColor = value; - } - } - - public Rect ActivePortArea - { - get { return m_activePortArea; } - set { m_activePortArea = value; } - } - - public Vector2 LabelSize - { - get { return m_labelSize; } - set { m_labelSize = value; } - } - - public Vector2 UnscaledLabelSize - { - get { return m_unscaledLabelSize; } - set { m_unscaledLabelSize = value; } - } - - public bool IsEditable - { - get { return m_isEditable; } - set { m_isEditable = value; } - } - - public bool Available { get { return m_visible && !m_locked; } } - public override string ToString() - { - string dump = ""; - dump += "Order: " + m_orderId + "\n"; - dump += "Name: " + m_name + "\n"; - dump += " Type: " + m_dataType; - dump += " NodeId : " + m_nodeId; - dump += " PortId : " + m_portId; - dump += "\nConnections:\n"; - foreach( WireReference wirePort in m_externalReferences ) - { - dump += wirePort + "\n"; - } - return dump; - } - - public bool RepeatButtonState - { - get { return m_repeatButtonState; } - set { m_repeatButtonState = value; } - } - public bool IsDummy { get { return m_isDummy; } } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Wires/WirePort.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Wires/WirePort.cs.meta deleted file mode 100644 index d70ad881..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Wires/WirePort.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 4709687a4844c9545a254c2ddbf3ca63 -timeCreated: 1481126955 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Wires/WireReference.cs b/Assets/AmplifyShaderEditor/Plugins/Editor/Wires/WireReference.cs deleted file mode 100644 index fb2b3472..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Wires/WireReference.cs +++ /dev/null @@ -1,126 +0,0 @@ -// 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 ); - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/Editor/Wires/WireReference.cs.meta b/Assets/AmplifyShaderEditor/Plugins/Editor/Wires/WireReference.cs.meta deleted file mode 100644 index dee7f4d9..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/Editor/Wires/WireReference.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 99fb607e60678c44da002d6b694400dc -timeCreated: 1481126957 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources.meta deleted file mode 100644 index 82d54d77..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 0932db7ec1402c2489679c4b72eab5eb -folderAsset: yes -timeCreated: 1481126943 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/GUISkins.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/GUISkins.meta deleted file mode 100644 index 18ce2da9..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/GUISkins.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 0ecdc2c57c073bd4796f1ae8da7f851f -folderAsset: yes -timeCreated: 1481126943 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/GUISkins/MainSkin.guiskin b/Assets/AmplifyShaderEditor/Plugins/EditorResources/GUISkins/MainSkin.guiskin deleted file mode 100644 index 58289c64..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/GUISkins/MainSkin.guiskin +++ /dev/null @@ -1,5340 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 1 - m_Script: {fileID: 12001, guid: 0000000000000000e000000000000000, type: 0} - m_Name: MainSkin - m_EditorClassIdentifier: - m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} - m_box: - m_Name: box - m_Normal: - m_Background: {fileID: 2800000, guid: a702c1245d15ddb48b8fba73bf951a65, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.79999995, g: 0.79999995, b: 0.79999995, a: 1} - m_Hover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Active: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnNormal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnHover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Border: - m_Left: 1 - m_Right: 1 - m_Top: 1 - m_Bottom: 1 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 1 - m_Right: 1 - m_Top: 1 - m_Bottom: 1 - m_Font: {fileID: 0} - m_FontSize: 0 - m_FontStyle: 0 - m_Alignment: 1 - m_WordWrap: 0 - m_RichText: 1 - m_TextClipping: 1 - m_ImagePosition: 0 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 1 - m_StretchHeight: 0 - m_button: - m_Name: button - m_Normal: - m_Background: {fileID: 2800000, guid: 87629cdfe03457046b57a25b1ea3096d, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Hover: - m_Background: {fileID: 2800000, guid: 87629cdfe03457046b57a25b1ea3096d, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Active: - m_Background: {fileID: 2800000, guid: 87629cdfe03457046b57a25b1ea3096d, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Focused: - m_Background: {fileID: 2800000, guid: 87629cdfe03457046b57a25b1ea3096d, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnNormal: - m_Background: {fileID: 2800000, guid: 6c0712566778b3f4383fc3bb16edc880, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnHover: - m_Background: {fileID: 2800000, guid: 6c0712566778b3f4383fc3bb16edc880, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnActive: - m_Background: {fileID: 2800000, guid: 6c0712566778b3f4383fc3bb16edc880, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Border: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 0 - m_FontStyle: 0 - m_Alignment: 4 - m_WordWrap: 0 - m_RichText: 1 - m_TextClipping: 1 - m_ImagePosition: 2 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 1 - m_StretchHeight: 0 - m_toggle: - m_Name: toggle - m_Normal: - m_Background: {fileID: 11018, guid: 0000000000000000e000000000000000, type: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.89112896, g: 0.89112896, b: 0.89112896, a: 1} - m_Hover: - m_Background: {fileID: 11014, guid: 0000000000000000e000000000000000, type: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Active: - m_Background: {fileID: 11013, guid: 0000000000000000e000000000000000, type: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnNormal: - m_Background: {fileID: 11016, guid: 0000000000000000e000000000000000, type: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.8901961, g: 0.8901961, b: 0.8901961, a: 1} - m_OnHover: - m_Background: {fileID: 11015, guid: 0000000000000000e000000000000000, type: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnActive: - m_Background: {fileID: 11017, guid: 0000000000000000e000000000000000, type: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Border: - m_Left: 14 - m_Right: 0 - m_Top: 14 - m_Bottom: 0 - m_Margin: - m_Left: 4 - m_Right: 4 - m_Top: 4 - m_Bottom: 4 - m_Padding: - m_Left: 15 - m_Right: 0 - m_Top: 3 - m_Bottom: 0 - m_Overflow: - m_Left: -1 - m_Right: 0 - m_Top: -4 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 0 - m_FontStyle: 0 - m_Alignment: 0 - m_WordWrap: 0 - m_RichText: 1 - m_TextClipping: 1 - m_ImagePosition: 0 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 1 - m_StretchHeight: 0 - m_label: - m_Name: label - m_Normal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.5} - m_Hover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Active: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnNormal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnHover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Border: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 15 - m_FontStyle: 0 - m_Alignment: 3 - m_WordWrap: 0 - m_RichText: 0 - m_TextClipping: 0 - m_ImagePosition: 0 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 0 - m_StretchHeight: 0 - m_textField: - m_Name: textfield - m_Normal: - m_Background: {fileID: 11024, guid: 0000000000000000e000000000000000, type: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.79999995, g: 0.79999995, b: 0.79999995, a: 1} - m_Hover: - m_Background: {fileID: 11026, guid: 0000000000000000e000000000000000, type: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.9, g: 0.9, b: 0.9, a: 1} - m_Active: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Focused: - m_Background: {fileID: 11026, guid: 0000000000000000e000000000000000, type: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnNormal: - m_Background: {fileID: 11025, guid: 0000000000000000e000000000000000, type: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnHover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Border: - m_Left: 4 - m_Right: 4 - m_Top: 4 - m_Bottom: 4 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 3 - m_Right: 3 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 11 - m_FontStyle: 0 - m_Alignment: 3 - m_WordWrap: 0 - m_RichText: 0 - m_TextClipping: 1 - m_ImagePosition: 3 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 1 - m_StretchHeight: 0 - m_textArea: - m_Name: textarea - m_Normal: - m_Background: {fileID: 11024, guid: 0000000000000000e000000000000000, type: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.9019608, g: 0.9019608, b: 0.9019608, a: 1} - m_Hover: - m_Background: {fileID: 11026, guid: 0000000000000000e000000000000000, type: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.79999995, g: 0.79999995, b: 0.79999995, a: 1} - m_Active: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnNormal: - m_Background: {fileID: 11025, guid: 0000000000000000e000000000000000, type: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnHover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Border: - m_Left: 4 - m_Right: 4 - m_Top: 4 - m_Bottom: 4 - m_Margin: - m_Left: 4 - m_Right: 4 - m_Top: 4 - m_Bottom: 4 - m_Padding: - m_Left: 3 - m_Right: 3 - m_Top: 3 - m_Bottom: 3 - m_Overflow: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 0 - m_FontStyle: 0 - m_Alignment: 0 - m_WordWrap: 1 - m_RichText: 0 - m_TextClipping: 1 - m_ImagePosition: 0 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 1 - m_StretchHeight: 0 - m_window: - m_Name: window - m_Normal: - m_Background: {fileID: 2800000, guid: bd8a303795331fe48b05eee287c0b3e5, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Hover: - m_Background: {fileID: 2800000, guid: bd8a303795331fe48b05eee287c0b3e5, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Active: - m_Background: {fileID: 2800000, guid: 4fdd9ad2fb20f14438637f9b085fbe81, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Focused: - m_Background: {fileID: 2800000, guid: bd8a303795331fe48b05eee287c0b3e5, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnNormal: - m_Background: {fileID: 2800000, guid: bd8a303795331fe48b05eee287c0b3e5, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnHover: - m_Background: {fileID: 2800000, guid: bd8a303795331fe48b05eee287c0b3e5, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnActive: - m_Background: {fileID: 2800000, guid: 4fdd9ad2fb20f14438637f9b085fbe81, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnFocused: - m_Background: {fileID: 2800000, guid: bd8a303795331fe48b05eee287c0b3e5, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Border: - m_Left: 7 - m_Right: 7 - m_Top: 37 - m_Bottom: 7 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 10 - m_Right: 10 - m_Top: 25 - m_Bottom: 10 - m_Overflow: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 10 - m_FontStyle: 1 - m_Alignment: 1 - m_WordWrap: 0 - m_RichText: 1 - m_TextClipping: 0 - m_ImagePosition: 0 - m_ContentOffset: {x: 0, y: -18} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 1 - m_StretchHeight: 0 - m_horizontalSlider: - m_Name: horizontalslider - m_Normal: - m_Background: {fileID: 11009, guid: 0000000000000000e000000000000000, type: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Hover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Active: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnNormal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnHover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Border: - m_Left: 3 - m_Right: 3 - m_Top: 0 - m_Bottom: 0 - m_Margin: - m_Left: 4 - m_Right: 4 - m_Top: 4 - m_Bottom: 4 - m_Padding: - m_Left: -1 - m_Right: -1 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 0 - m_Right: 0 - m_Top: -2 - m_Bottom: -3 - m_Font: {fileID: 0} - m_FontSize: 0 - m_FontStyle: 0 - m_Alignment: 0 - m_WordWrap: 0 - m_RichText: 1 - m_TextClipping: 1 - m_ImagePosition: 2 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 0 - m_FixedHeight: 12 - m_StretchWidth: 1 - m_StretchHeight: 0 - m_horizontalSliderThumb: - m_Name: horizontalsliderthumb - m_Normal: - m_Background: {fileID: 11011, guid: 0000000000000000e000000000000000, type: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Hover: - m_Background: {fileID: 11012, guid: 0000000000000000e000000000000000, type: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Active: - m_Background: {fileID: 11010, guid: 0000000000000000e000000000000000, type: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnNormal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnHover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Border: - m_Left: 4 - m_Right: 4 - m_Top: 0 - m_Bottom: 0 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 7 - m_Right: 7 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: -1 - m_Right: -1 - m_Top: 0 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 0 - m_FontStyle: 0 - m_Alignment: 0 - m_WordWrap: 0 - m_RichText: 1 - m_TextClipping: 1 - m_ImagePosition: 2 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 0 - m_FixedHeight: 12 - m_StretchWidth: 1 - m_StretchHeight: 0 - m_verticalSlider: - m_Name: verticalslider - m_Normal: - m_Background: {fileID: 11021, guid: 0000000000000000e000000000000000, type: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Hover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Active: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnNormal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnHover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Border: - m_Left: 0 - m_Right: 0 - m_Top: 3 - m_Bottom: 3 - m_Margin: - m_Left: 4 - m_Right: 4 - m_Top: 4 - m_Bottom: 4 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: -1 - m_Bottom: -1 - m_Overflow: - m_Left: -2 - m_Right: -3 - m_Top: 0 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 0 - m_FontStyle: 0 - m_Alignment: 0 - m_WordWrap: 0 - m_RichText: 1 - m_TextClipping: 0 - m_ImagePosition: 0 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 12 - m_FixedHeight: 0 - m_StretchWidth: 0 - m_StretchHeight: 1 - m_verticalSliderThumb: - m_Name: verticalsliderthumb - m_Normal: - m_Background: {fileID: 11011, guid: 0000000000000000e000000000000000, type: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Hover: - m_Background: {fileID: 11012, guid: 0000000000000000e000000000000000, type: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Active: - m_Background: {fileID: 11010, guid: 0000000000000000e000000000000000, type: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnNormal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnHover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Border: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 7 - m_Bottom: 7 - m_Overflow: - m_Left: 0 - m_Right: 0 - m_Top: -1 - m_Bottom: -1 - m_Font: {fileID: 0} - m_FontSize: 0 - m_FontStyle: 0 - m_Alignment: 0 - m_WordWrap: 0 - m_RichText: 1 - m_TextClipping: 1 - m_ImagePosition: 0 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 12 - m_FixedHeight: 0 - m_StretchWidth: 0 - m_StretchHeight: 1 - m_horizontalScrollbar: - m_Name: horizontalscrollbar - m_Normal: - m_Background: {fileID: 11008, guid: 0000000000000000e000000000000000, type: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Hover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Active: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnNormal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnHover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Border: - m_Left: 9 - m_Right: 9 - m_Top: 0 - m_Bottom: 0 - m_Margin: - m_Left: 4 - m_Right: 4 - m_Top: 1 - m_Bottom: 4 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 0 - m_FontStyle: 0 - m_Alignment: 0 - m_WordWrap: 0 - m_RichText: 1 - m_TextClipping: 1 - m_ImagePosition: 2 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 0 - m_FixedHeight: 15 - m_StretchWidth: 1 - m_StretchHeight: 0 - m_horizontalScrollbarThumb: - m_Name: horizontalscrollbarthumb - m_Normal: - m_Background: {fileID: 11007, guid: 0000000000000000e000000000000000, type: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Hover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Active: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnNormal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnHover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Border: - m_Left: 6 - m_Right: 6 - m_Top: 6 - m_Bottom: 6 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 6 - m_Right: 6 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 0 - m_Right: 0 - m_Top: -1 - m_Bottom: 1 - m_Font: {fileID: 0} - m_FontSize: 0 - m_FontStyle: 0 - m_Alignment: 0 - m_WordWrap: 0 - m_RichText: 1 - m_TextClipping: 1 - m_ImagePosition: 0 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 0 - m_FixedHeight: 13 - m_StretchWidth: 1 - m_StretchHeight: 0 - m_horizontalScrollbarLeftButton: - m_Name: horizontalscrollbarleftbutton - m_Normal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Hover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Active: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnNormal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnHover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Border: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 0 - m_FontStyle: 0 - m_Alignment: 0 - m_WordWrap: 0 - m_RichText: 1 - m_TextClipping: 1 - m_ImagePosition: 0 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 1 - m_StretchHeight: 0 - m_horizontalScrollbarRightButton: - m_Name: horizontalscrollbarrightbutton - m_Normal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Hover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Active: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnNormal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnHover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Border: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 0 - m_FontStyle: 0 - m_Alignment: 0 - m_WordWrap: 0 - m_RichText: 1 - m_TextClipping: 1 - m_ImagePosition: 0 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 1 - m_StretchHeight: 0 - m_verticalScrollbar: - m_Name: verticalscrollbar - m_Normal: - m_Background: {fileID: 11020, guid: 0000000000000000e000000000000000, type: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Hover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Active: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnNormal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnHover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Border: - m_Left: 0 - m_Right: 0 - m_Top: 9 - m_Bottom: 9 - m_Margin: - m_Left: 1 - m_Right: 4 - m_Top: 4 - m_Bottom: 4 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 1 - m_Bottom: 1 - m_Overflow: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 0 - m_FontStyle: 0 - m_Alignment: 0 - m_WordWrap: 0 - m_RichText: 1 - m_TextClipping: 1 - m_ImagePosition: 0 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 15 - m_FixedHeight: 0 - m_StretchWidth: 1 - m_StretchHeight: 0 - m_verticalScrollbarThumb: - m_Name: verticalscrollbarthumb - m_Normal: - m_Background: {fileID: 11019, guid: 0000000000000000e000000000000000, type: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Hover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Active: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnNormal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnHover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Border: - m_Left: 6 - m_Right: 6 - m_Top: 6 - m_Bottom: 6 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 6 - m_Bottom: 6 - m_Overflow: - m_Left: -1 - m_Right: -1 - m_Top: 0 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 0 - m_FontStyle: 0 - m_Alignment: 0 - m_WordWrap: 0 - m_RichText: 1 - m_TextClipping: 1 - m_ImagePosition: 2 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 15 - m_FixedHeight: 0 - m_StretchWidth: 0 - m_StretchHeight: 1 - m_verticalScrollbarUpButton: - m_Name: verticalscrollbarupbutton - m_Normal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Hover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Active: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnNormal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnHover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Border: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 0 - m_FontStyle: 0 - m_Alignment: 0 - m_WordWrap: 0 - m_RichText: 1 - m_TextClipping: 1 - m_ImagePosition: 0 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 1 - m_StretchHeight: 0 - m_verticalScrollbarDownButton: - m_Name: verticalscrollbardownbutton - m_Normal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Hover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Active: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnNormal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnHover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Border: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 0 - m_FontStyle: 0 - m_Alignment: 0 - m_WordWrap: 0 - m_RichText: 1 - m_TextClipping: 1 - m_ImagePosition: 0 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 1 - m_StretchHeight: 0 - m_ScrollView: - m_Name: scrollview - m_Normal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Hover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Active: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnNormal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnHover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Border: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 0 - m_FontStyle: 0 - m_Alignment: 0 - m_WordWrap: 0 - m_RichText: 1 - m_TextClipping: 1 - m_ImagePosition: 0 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 1 - m_StretchHeight: 0 - m_CustomStyles: - - m_Name: NodeWindowOff - m_Normal: - m_Background: {fileID: 2800000, guid: 60c283ffa9a758646ab70a2fe7ff5f71, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Hover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Active: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnNormal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnHover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Border: - m_Left: 6 - m_Right: 6 - m_Top: 6 - m_Bottom: 6 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 1 - m_Right: 1 - m_Top: 1 - m_Bottom: 1 - m_Font: {fileID: 0} - m_FontSize: 13 - m_FontStyle: 1 - m_Alignment: 1 - m_WordWrap: 0 - m_RichText: 1 - m_TextClipping: 0 - m_ImagePosition: 0 - m_ContentOffset: {x: 0, y: -18} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 1 - m_StretchHeight: 0 - - m_Name: NodeWindowOn - m_Normal: - m_Background: {fileID: 2800000, guid: 24fb767323009c143a4e744a2025a27e, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Hover: - m_Background: {fileID: 2800000, guid: 24fb767323009c143a4e744a2025a27e, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Active: - m_Background: {fileID: 2800000, guid: 24fb767323009c143a4e744a2025a27e, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Focused: - m_Background: {fileID: 2800000, guid: 24fb767323009c143a4e744a2025a27e, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnNormal: - m_Background: {fileID: 2800000, guid: 24fb767323009c143a4e744a2025a27e, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnHover: - m_Background: {fileID: 2800000, guid: 24fb767323009c143a4e744a2025a27e, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnActive: - m_Background: {fileID: 2800000, guid: 24fb767323009c143a4e744a2025a27e, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnFocused: - m_Background: {fileID: 2800000, guid: 24fb767323009c143a4e744a2025a27e, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Border: - m_Left: 6 - m_Right: 6 - m_Top: 6 - m_Bottom: 6 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 2 - m_Right: 2 - m_Top: 2 - m_Bottom: 2 - m_Font: {fileID: 0} - m_FontSize: 6 - m_FontStyle: 1 - m_Alignment: 1 - m_WordWrap: 0 - m_RichText: 1 - m_TextClipping: 0 - m_ImagePosition: 0 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 1 - m_StretchHeight: 0 - - m_Name: NodeTitle - m_Normal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Hover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Active: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnNormal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnHover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Border: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 13 - m_FontStyle: 1 - m_Alignment: 1 - m_WordWrap: 0 - m_RichText: 1 - m_TextClipping: 0 - m_ImagePosition: 3 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 1 - m_StretchHeight: 1 - - m_Name: NodeHeader - m_Normal: - m_Background: {fileID: 2800000, guid: 9e88b336bd16b1e4b99de75f486126c1, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Hover: - m_Background: {fileID: 2800000, guid: 9e88b336bd16b1e4b99de75f486126c1, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Active: - m_Background: {fileID: 2800000, guid: 9e88b336bd16b1e4b99de75f486126c1, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Focused: - m_Background: {fileID: 2800000, guid: 9e88b336bd16b1e4b99de75f486126c1, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnNormal: - m_Background: {fileID: 2800000, guid: 9e88b336bd16b1e4b99de75f486126c1, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnHover: - m_Background: {fileID: 2800000, guid: 9e88b336bd16b1e4b99de75f486126c1, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnActive: - m_Background: {fileID: 2800000, guid: 9e88b336bd16b1e4b99de75f486126c1, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnFocused: - m_Background: {fileID: 2800000, guid: 9e88b336bd16b1e4b99de75f486126c1, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Border: - m_Left: 6 - m_Right: 6 - m_Top: 6 - m_Bottom: 4 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 1 - m_Right: 1 - m_Top: 1 - m_Bottom: 1 - m_Font: {fileID: 0} - m_FontSize: 13 - m_FontStyle: 1 - m_Alignment: 1 - m_WordWrap: 0 - m_RichText: 1 - m_TextClipping: 0 - m_ImagePosition: 0 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 1 - m_StretchHeight: 0 - - m_Name: CommentaryHeader - m_Normal: - m_Background: {fileID: 2800000, guid: 9e88b336bd16b1e4b99de75f486126c1, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Hover: - m_Background: {fileID: 2800000, guid: 9e88b336bd16b1e4b99de75f486126c1, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Active: - m_Background: {fileID: 2800000, guid: 9e88b336bd16b1e4b99de75f486126c1, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Focused: - m_Background: {fileID: 2800000, guid: 9e88b336bd16b1e4b99de75f486126c1, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnNormal: - m_Background: {fileID: 2800000, guid: 9e88b336bd16b1e4b99de75f486126c1, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnHover: - m_Background: {fileID: 2800000, guid: 9e88b336bd16b1e4b99de75f486126c1, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnActive: - m_Background: {fileID: 2800000, guid: 9e88b336bd16b1e4b99de75f486126c1, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnFocused: - m_Background: {fileID: 2800000, guid: 9e88b336bd16b1e4b99de75f486126c1, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Border: - m_Left: 7 - m_Right: 7 - m_Top: 7 - m_Bottom: 7 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 1 - m_Right: 1 - m_Top: 1 - m_Bottom: 1 - m_Font: {fileID: 0} - m_FontSize: 15 - m_FontStyle: 1 - m_Alignment: 3 - m_WordWrap: 0 - m_RichText: 1 - m_TextClipping: 1 - m_ImagePosition: 1 - m_ContentOffset: {x: 8, y: 0} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 1 - m_StretchHeight: 0 - - m_Name: ShaderLibraryTitle - m_Normal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Hover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Active: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnNormal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnHover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Border: - m_Left: 7 - m_Right: 7 - m_Top: 7 - m_Bottom: 7 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 0 - m_Right: 23 - m_Top: 0 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 20 - m_FontStyle: 1 - m_Alignment: 1 - m_WordWrap: 0 - m_RichText: 1 - m_TextClipping: 0 - m_ImagePosition: 0 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 1 - m_StretchHeight: 0 - - m_Name: ShaderLibraryAddToList - m_Normal: - m_Background: {fileID: 2800000, guid: cccc116a6334dc1428687697c5a11d58, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Hover: - m_Background: {fileID: 2800000, guid: cccc116a6334dc1428687697c5a11d58, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Active: - m_Background: {fileID: 2800000, guid: cccc116a6334dc1428687697c5a11d58, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Focused: - m_Background: {fileID: 2800000, guid: cccc116a6334dc1428687697c5a11d58, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnNormal: - m_Background: {fileID: 2800000, guid: cccc116a6334dc1428687697c5a11d58, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnHover: - m_Background: {fileID: 2800000, guid: cccc116a6334dc1428687697c5a11d58, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnActive: - m_Background: {fileID: 2800000, guid: cccc116a6334dc1428687697c5a11d58, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnFocused: - m_Background: {fileID: 2800000, guid: cccc116a6334dc1428687697c5a11d58, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Border: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 20 - m_FontStyle: 0 - m_Alignment: 1 - m_WordWrap: 0 - m_RichText: 0 - m_TextClipping: 1 - m_ImagePosition: 2 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 23 - m_FixedHeight: 21 - m_StretchWidth: 0 - m_StretchHeight: 0 - - m_Name: ShaderLibraryRemoveFromList - m_Normal: - m_Background: {fileID: 2800000, guid: 75f68506ba820564ea85b2620d78c097, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Hover: - m_Background: {fileID: 2800000, guid: 75f68506ba820564ea85b2620d78c097, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Active: - m_Background: {fileID: 2800000, guid: 75f68506ba820564ea85b2620d78c097, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Focused: - m_Background: {fileID: 2800000, guid: 75f68506ba820564ea85b2620d78c097, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnNormal: - m_Background: {fileID: 2800000, guid: 75f68506ba820564ea85b2620d78c097, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnHover: - m_Background: {fileID: 2800000, guid: 75f68506ba820564ea85b2620d78c097, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnActive: - m_Background: {fileID: 2800000, guid: 75f68506ba820564ea85b2620d78c097, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnFocused: - m_Background: {fileID: 2800000, guid: 75f68506ba820564ea85b2620d78c097, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Border: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 20 - m_FontStyle: 1 - m_Alignment: 2 - m_WordWrap: 0 - m_RichText: 1 - m_TextClipping: 0 - m_ImagePosition: 2 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 23 - m_FixedHeight: 21 - m_StretchWidth: 0 - m_StretchHeight: 0 - - m_Name: ShaderLibraryOpenListed - m_Normal: - m_Background: {fileID: 2800000, guid: a66917730dccde947a01140dc04b9e59, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Hover: - m_Background: {fileID: 2800000, guid: a66917730dccde947a01140dc04b9e59, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Active: - m_Background: {fileID: 2800000, guid: a66917730dccde947a01140dc04b9e59, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Focused: - m_Background: {fileID: 2800000, guid: a66917730dccde947a01140dc04b9e59, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnNormal: - m_Background: {fileID: 2800000, guid: a66917730dccde947a01140dc04b9e59, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnHover: - m_Background: {fileID: 2800000, guid: a66917730dccde947a01140dc04b9e59, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnActive: - m_Background: {fileID: 2800000, guid: a66917730dccde947a01140dc04b9e59, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnFocused: - m_Background: {fileID: 2800000, guid: a66917730dccde947a01140dc04b9e59, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Border: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 20 - m_FontStyle: 1 - m_Alignment: 1 - m_WordWrap: 0 - m_RichText: 1 - m_TextClipping: 0 - m_ImagePosition: 0 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 23 - m_FixedHeight: 21 - m_StretchWidth: 1 - m_StretchHeight: 0 - - m_Name: ShaderLibrarySelectionAsTemplate - m_Normal: - m_Background: {fileID: 2800000, guid: 8148796947da07d49906f1201f417a60, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Hover: - m_Background: {fileID: 2800000, guid: 8148796947da07d49906f1201f417a60, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Active: - m_Background: {fileID: 2800000, guid: 8148796947da07d49906f1201f417a60, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Focused: - m_Background: {fileID: 2800000, guid: 8148796947da07d49906f1201f417a60, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnNormal: - m_Background: {fileID: 2800000, guid: 8148796947da07d49906f1201f417a60, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnHover: - m_Background: {fileID: 2800000, guid: 8148796947da07d49906f1201f417a60, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnActive: - m_Background: {fileID: 2800000, guid: 8148796947da07d49906f1201f417a60, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnFocused: - m_Background: {fileID: 2800000, guid: 8148796947da07d49906f1201f417a60, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Border: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 20 - m_FontStyle: 1 - m_Alignment: 1 - m_WordWrap: 0 - m_RichText: 1 - m_TextClipping: 0 - m_ImagePosition: 0 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 23 - m_FixedHeight: 21 - m_StretchWidth: 1 - m_StretchHeight: 0 - - m_Name: ShaderLibraryItem - m_Normal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Hover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Active: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnNormal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnHover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Border: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 10 - m_Right: 10 - m_Top: 0 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 15 - m_FontStyle: 0 - m_Alignment: 0 - m_WordWrap: 0 - m_RichText: 1 - m_TextClipping: 0 - m_ImagePosition: 0 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 1 - m_StretchHeight: 0 - - m_Name: CommentaryTitle - m_Normal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Hover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Active: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnNormal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnHover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Border: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 10 - m_Right: 10 - m_Top: 0 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 15 - m_FontStyle: 1 - m_Alignment: 3 - m_WordWrap: 0 - m_RichText: 1 - m_TextClipping: 1 - m_ImagePosition: 0 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 1 - m_StretchHeight: 0 - - m_Name: PortEmptyIcon - m_Normal: - m_Background: {fileID: 2800000, guid: 56277f370fb77a448a152bcd2e3a9077, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Hover: - m_Background: {fileID: 2800000, guid: 56277f370fb77a448a152bcd2e3a9077, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Active: - m_Background: {fileID: 2800000, guid: 56277f370fb77a448a152bcd2e3a9077, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Focused: - m_Background: {fileID: 2800000, guid: 56277f370fb77a448a152bcd2e3a9077, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnNormal: - m_Background: {fileID: 2800000, guid: 56277f370fb77a448a152bcd2e3a9077, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnHover: - m_Background: {fileID: 2800000, guid: 56277f370fb77a448a152bcd2e3a9077, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnActive: - m_Background: {fileID: 2800000, guid: 56277f370fb77a448a152bcd2e3a9077, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnFocused: - m_Background: {fileID: 2800000, guid: 56277f370fb77a448a152bcd2e3a9077, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Border: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 0 - m_FontStyle: 0 - m_Alignment: 4 - m_WordWrap: 0 - m_RichText: 0 - m_TextClipping: 1 - m_ImagePosition: 2 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 0 - m_StretchHeight: 0 - - m_Name: PortFullIcon - m_Normal: - m_Background: {fileID: 2800000, guid: 8113366f9f7cec647878e3af2fb98922, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Hover: - m_Background: {fileID: 2800000, guid: 8113366f9f7cec647878e3af2fb98922, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Active: - m_Background: {fileID: 2800000, guid: 8113366f9f7cec647878e3af2fb98922, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Focused: - m_Background: {fileID: 2800000, guid: 8113366f9f7cec647878e3af2fb98922, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnNormal: - m_Background: {fileID: 2800000, guid: 8113366f9f7cec647878e3af2fb98922, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnHover: - m_Background: {fileID: 2800000, guid: 8113366f9f7cec647878e3af2fb98922, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnActive: - m_Background: {fileID: 2800000, guid: 8113366f9f7cec647878e3af2fb98922, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnFocused: - m_Background: {fileID: 2800000, guid: 8113366f9f7cec647878e3af2fb98922, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Border: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 0 - m_FontStyle: 0 - m_Alignment: 4 - m_WordWrap: 0 - m_RichText: 0 - m_TextClipping: 1 - m_ImagePosition: 2 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 0 - m_StretchHeight: 0 - - m_Name: InputPortLabel - m_Normal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} - m_Hover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Active: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnNormal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnHover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Border: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Margin: - m_Left: 4 - m_Right: 4 - m_Top: 4 - m_Bottom: 4 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 10 - m_Right: 10 - m_Top: 0 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 15 - m_FontStyle: 0 - m_Alignment: 3 - m_WordWrap: 0 - m_RichText: 1 - m_TextClipping: 0 - m_ImagePosition: 3 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 1 - m_StretchHeight: 1 - - m_Name: OutputPortLabel - m_Normal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.5} - m_Hover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Active: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnNormal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnHover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Border: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 15 - m_FontStyle: 0 - m_Alignment: 5 - m_WordWrap: 0 - m_RichText: 0 - m_TextClipping: 0 - m_ImagePosition: 0 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 0 - m_StretchHeight: 0 - - m_Name: CommentaryResizeButton - m_Normal: - m_Background: {fileID: 2800000, guid: 5321bd2b79632764286f28503db80815, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Hover: - m_Background: {fileID: 2800000, guid: 5321bd2b79632764286f28503db80815, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Active: - m_Background: {fileID: 2800000, guid: 5321bd2b79632764286f28503db80815, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Focused: - m_Background: {fileID: 2800000, guid: 5321bd2b79632764286f28503db80815, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnNormal: - m_Background: {fileID: 2800000, guid: 5321bd2b79632764286f28503db80815, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnHover: - m_Background: {fileID: 2800000, guid: 5321bd2b79632764286f28503db80815, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnActive: - m_Background: {fileID: 2800000, guid: 5321bd2b79632764286f28503db80815, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnFocused: - m_Background: {fileID: 2800000, guid: 5321bd2b79632764286f28503db80815, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Border: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 15 - m_FontStyle: 0 - m_Alignment: 4 - m_WordWrap: 0 - m_RichText: 0 - m_TextClipping: 0 - m_ImagePosition: 2 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 0 - m_StretchHeight: 0 - - m_Name: CommentaryResizeButtonInv - m_Normal: - m_Background: {fileID: 2800000, guid: b52bc320a2ff91446978a893ec738134, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Hover: - m_Background: {fileID: 2800000, guid: b52bc320a2ff91446978a893ec738134, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Active: - m_Background: {fileID: 2800000, guid: b52bc320a2ff91446978a893ec738134, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Focused: - m_Background: {fileID: 2800000, guid: b52bc320a2ff91446978a893ec738134, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnNormal: - m_Background: {fileID: 2800000, guid: b52bc320a2ff91446978a893ec738134, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnHover: - m_Background: {fileID: 2800000, guid: b52bc320a2ff91446978a893ec738134, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnActive: - m_Background: {fileID: 2800000, guid: b52bc320a2ff91446978a893ec738134, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnFocused: - m_Background: {fileID: 2800000, guid: b52bc320a2ff91446978a893ec738134, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Border: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 15 - m_FontStyle: 0 - m_Alignment: 4 - m_WordWrap: 0 - m_RichText: 0 - m_TextClipping: 0 - m_ImagePosition: 2 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 0 - m_StretchHeight: 0 - - m_Name: CommentaryBackground - m_Normal: - m_Background: {fileID: 2800000, guid: b2be9c55e7e7ba447967677c82b2cb23, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Hover: - m_Background: {fileID: 2800000, guid: b2be9c55e7e7ba447967677c82b2cb23, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Active: - m_Background: {fileID: 2800000, guid: b2be9c55e7e7ba447967677c82b2cb23, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Focused: - m_Background: {fileID: 2800000, guid: b2be9c55e7e7ba447967677c82b2cb23, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnNormal: - m_Background: {fileID: 2800000, guid: b2be9c55e7e7ba447967677c82b2cb23, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnHover: - m_Background: {fileID: 2800000, guid: b2be9c55e7e7ba447967677c82b2cb23, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnActive: - m_Background: {fileID: 2800000, guid: b2be9c55e7e7ba447967677c82b2cb23, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnFocused: - m_Background: {fileID: 2800000, guid: b2be9c55e7e7ba447967677c82b2cb23, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Border: - m_Left: 6 - m_Right: 6 - m_Top: 6 - m_Bottom: 6 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 1 - m_Right: 1 - m_Top: 1 - m_Bottom: 1 - m_Font: {fileID: 0} - m_FontSize: 15 - m_FontStyle: 0 - m_Alignment: 4 - m_WordWrap: 0 - m_RichText: 0 - m_TextClipping: 0 - m_ImagePosition: 0 - m_ContentOffset: {x: 0, y: -18} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 1 - m_StretchHeight: 0 - - m_Name: MinimizeButton - m_Normal: - m_Background: {fileID: 2800000, guid: 2aae9a02747d74d46bf98a15ac5c9b21, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Hover: - m_Background: {fileID: 2800000, guid: 2aae9a02747d74d46bf98a15ac5c9b21, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Active: - m_Background: {fileID: 2800000, guid: 2aae9a02747d74d46bf98a15ac5c9b21, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Focused: - m_Background: {fileID: 2800000, guid: 2aae9a02747d74d46bf98a15ac5c9b21, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnNormal: - m_Background: {fileID: 2800000, guid: 2aae9a02747d74d46bf98a15ac5c9b21, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnHover: - m_Background: {fileID: 2800000, guid: 2aae9a02747d74d46bf98a15ac5c9b21, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnActive: - m_Background: {fileID: 2800000, guid: 2aae9a02747d74d46bf98a15ac5c9b21, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnFocused: - m_Background: {fileID: 2800000, guid: 2aae9a02747d74d46bf98a15ac5c9b21, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Border: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 15 - m_FontStyle: 0 - m_Alignment: 4 - m_WordWrap: 0 - m_RichText: 0 - m_TextClipping: 0 - m_ImagePosition: 0 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 0 - m_StretchHeight: 0 - - m_Name: MaximizeButton - m_Normal: - m_Background: {fileID: 2800000, guid: 7a1fd3f5fef75b64385591e1890d1842, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Hover: - m_Background: {fileID: 2800000, guid: 7a1fd3f5fef75b64385591e1890d1842, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Active: - m_Background: {fileID: 2800000, guid: 7a1fd3f5fef75b64385591e1890d1842, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Focused: - m_Background: {fileID: 2800000, guid: 7a1fd3f5fef75b64385591e1890d1842, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnNormal: - m_Background: {fileID: 2800000, guid: 7a1fd3f5fef75b64385591e1890d1842, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnHover: - m_Background: {fileID: 2800000, guid: 7a1fd3f5fef75b64385591e1890d1842, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnActive: - m_Background: {fileID: 2800000, guid: 7a1fd3f5fef75b64385591e1890d1842, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnFocused: - m_Background: {fileID: 2800000, guid: 7a1fd3f5fef75b64385591e1890d1842, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Border: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 15 - m_FontStyle: 0 - m_Alignment: 4 - m_WordWrap: 0 - m_RichText: 0 - m_TextClipping: 0 - m_ImagePosition: 0 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 0 - m_StretchHeight: 0 - - m_Name: NodePropertiesTitle - m_Normal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Hover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Active: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnNormal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnHover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Border: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 15 - m_FontStyle: 1 - m_Alignment: 3 - m_WordWrap: 0 - m_RichText: 0 - m_TextClipping: 0 - m_ImagePosition: 0 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 0 - m_StretchHeight: 0 - - m_Name: ShaderModeTitle - m_Normal: - m_Background: {fileID: 2800000, guid: f4ca92d9e50d06049b7ccec2c438754d, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} - m_Hover: - m_Background: {fileID: 2800000, guid: f4ca92d9e50d06049b7ccec2c438754d, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} - m_Active: - m_Background: {fileID: 2800000, guid: f4ca92d9e50d06049b7ccec2c438754d, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} - m_Focused: - m_Background: {fileID: 2800000, guid: f4ca92d9e50d06049b7ccec2c438754d, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} - m_OnNormal: - m_Background: {fileID: 2800000, guid: f4ca92d9e50d06049b7ccec2c438754d, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} - m_OnHover: - m_Background: {fileID: 2800000, guid: f4ca92d9e50d06049b7ccec2c438754d, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} - m_OnActive: - m_Background: {fileID: 2800000, guid: f4ca92d9e50d06049b7ccec2c438754d, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} - m_OnFocused: - m_Background: {fileID: 2800000, guid: f4ca92d9e50d06049b7ccec2c438754d, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} - m_Border: - m_Left: 30 - m_Right: 0 - m_Top: 0 - m_Bottom: 38 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 14 - m_FontStyle: 1 - m_Alignment: 3 - m_WordWrap: 0 - m_RichText: 1 - m_TextClipping: 0 - m_ImagePosition: 0 - m_ContentOffset: {x: 34, y: -1} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 1 - m_StretchHeight: 1 - - m_Name: MaterialModeTitle - m_Normal: - m_Background: {fileID: 2800000, guid: 5725fa8ee04e1be449af059f5735cd81, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} - m_Hover: - m_Background: {fileID: 2800000, guid: 5725fa8ee04e1be449af059f5735cd81, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} - m_Active: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} - m_Focused: - m_Background: {fileID: 2800000, guid: 5725fa8ee04e1be449af059f5735cd81, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} - m_OnNormal: - m_Background: {fileID: 2800000, guid: 5725fa8ee04e1be449af059f5735cd81, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} - m_OnHover: - m_Background: {fileID: 2800000, guid: 5725fa8ee04e1be449af059f5735cd81, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} - m_OnFocused: - m_Background: {fileID: 2800000, guid: 5725fa8ee04e1be449af059f5735cd81, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} - m_Border: - m_Left: 0 - m_Right: 40 - m_Top: 0 - m_Bottom: 38 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 14 - m_FontStyle: 1 - m_Alignment: 5 - m_WordWrap: 0 - m_RichText: 1 - m_TextClipping: 0 - m_ImagePosition: 0 - m_ContentOffset: {x: -44, y: -1} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 1 - m_StretchHeight: 1 - - m_Name: ShaderNoMaterialModeTitle - m_Normal: - m_Background: {fileID: 2800000, guid: 7040748e1c49b9648aeeefef41c8a3d5, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} - m_Hover: - m_Background: {fileID: 2800000, guid: 7040748e1c49b9648aeeefef41c8a3d5, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} - m_Active: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} - m_Focused: - m_Background: {fileID: 2800000, guid: 7040748e1c49b9648aeeefef41c8a3d5, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} - m_OnNormal: - m_Background: {fileID: 2800000, guid: 7040748e1c49b9648aeeefef41c8a3d5, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} - m_OnHover: - m_Background: {fileID: 2800000, guid: 7040748e1c49b9648aeeefef41c8a3d5, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} - m_OnActive: - m_Background: {fileID: 2800000, guid: 7040748e1c49b9648aeeefef41c8a3d5, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} - m_OnFocused: - m_Background: {fileID: 2800000, guid: 7040748e1c49b9648aeeefef41c8a3d5, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} - m_Border: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 14 - m_FontStyle: 1 - m_Alignment: 5 - m_WordWrap: 0 - m_RichText: 0 - m_TextClipping: 0 - m_ImagePosition: 0 - m_ContentOffset: {x: -44, y: 9} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 0 - m_StretchHeight: 0 - - m_Name: PropertyValuesTitle - m_Normal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.5882353} - m_Hover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Active: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnNormal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnHover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Border: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 11 - m_FontStyle: 3 - m_Alignment: 1 - m_WordWrap: 0 - m_RichText: 1 - m_TextClipping: 0 - m_ImagePosition: 3 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 1 - m_StretchHeight: 1 - - m_Name: ShaderModeNoShader - m_Normal: - m_Background: {fileID: 2800000, guid: df81b9531d8ef704f96072ce6910db68, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} - m_Hover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} - m_Active: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} - m_OnNormal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} - m_OnHover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} - m_Border: - m_Left: 30 - m_Right: 0 - m_Top: 0 - m_Bottom: 38 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 14 - m_FontStyle: 1 - m_Alignment: 3 - m_WordWrap: 0 - m_RichText: 1 - m_TextClipping: 0 - m_ImagePosition: 0 - m_ContentOffset: {x: 34, y: -1} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 1 - m_StretchHeight: 1 - - m_Name: MainCanvasTitle - m_Normal: - m_Background: {fileID: 2800000, guid: bdb42c87b8801e94e886c5c0d60b3014, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.41911763, g: 0.41911763, b: 0.41911763, a: 1} - m_Hover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Active: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnNormal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnHover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Border: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 6 - m_Bottom: 0 - m_Overflow: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 17 - m_FontStyle: 0 - m_Alignment: 4 - m_WordWrap: 0 - m_RichText: 0 - m_TextClipping: 1 - m_ImagePosition: 1 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 0 - m_StretchHeight: 0 - - m_Name: ShaderBorder - m_Normal: - m_Background: {fileID: 2800000, guid: 555b6a287b4121b479d412e6ea92bb2e, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Hover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Active: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnNormal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnHover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Border: - m_Left: 10 - m_Right: 10 - m_Top: 10 - m_Bottom: 10 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 17 - m_FontStyle: 0 - m_Alignment: 4 - m_WordWrap: 0 - m_RichText: 0 - m_TextClipping: 0 - m_ImagePosition: 2 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 0 - m_StretchHeight: 0 - - m_Name: MaterialBorder - m_Normal: - m_Background: {fileID: 2800000, guid: 157b94751c138d84bbe1768c672b5168, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Hover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Active: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnNormal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnHover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Border: - m_Left: 10 - m_Right: 10 - m_Top: 10 - m_Bottom: 10 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 17 - m_FontStyle: 0 - m_Alignment: 4 - m_WordWrap: 0 - m_RichText: 0 - m_TextClipping: 0 - m_ImagePosition: 2 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 0 - m_StretchHeight: 0 - - m_Name: SamplerTextureRef - m_Normal: - m_Background: {fileID: 2800000, guid: f9bd85ea2601b824c87556c13e852933, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Hover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Active: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnNormal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnHover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Border: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 13 - m_FontStyle: 0 - m_Alignment: 4 - m_WordWrap: 0 - m_RichText: 0 - m_TextClipping: 0 - m_ImagePosition: 2 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 1 - m_StretchHeight: 1 - - m_Name: SamplerTextureIcon - m_Normal: - m_Background: {fileID: 2800000, guid: 7cabe27e9427ef346a6b6557106353fd, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Hover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Active: - m_Background: {fileID: 2800000, guid: 7cabe27e9427ef346a6b6557106353fd, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnNormal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnHover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Border: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 13 - m_FontStyle: 0 - m_Alignment: 4 - m_WordWrap: 0 - m_RichText: 0 - m_TextClipping: 0 - m_ImagePosition: 2 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 0 - m_StretchHeight: 0 - - m_Name: CustomExpressionAddItem - m_Normal: - m_Background: {fileID: 2800000, guid: 7eb057fdbf020504fb6c9c3c78031e5e, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} - m_Hover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} - m_Active: - m_Background: {fileID: 2800000, guid: 52bbe770f45f531419e44a69be67ccba, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} - m_OnNormal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} - m_OnHover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} - m_Border: - m_Left: 12 - m_Right: 0 - m_Top: 12 - m_Bottom: 0 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 15 - m_Right: 3 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: -2 - m_Right: 0 - m_Top: -4 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 0 - m_FontStyle: 0 - m_Alignment: 3 - m_WordWrap: 0 - m_RichText: 0 - m_TextClipping: 1 - m_ImagePosition: 2 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 0 - m_FixedHeight: 17 - m_StretchWidth: 1 - m_StretchHeight: 0 - - m_Name: CustomExpressionRemoveItem - m_Normal: - m_Background: {fileID: 2800000, guid: 839cb1530f95ad14ab58762161a9cb06, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} - m_Hover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} - m_Active: - m_Background: {fileID: 2800000, guid: 1ba096552f9cbbb418ee2286856bb352, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} - m_OnNormal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} - m_OnHover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} - m_Border: - m_Left: 12 - m_Right: 0 - m_Top: 12 - m_Bottom: 0 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 15 - m_Right: 3 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: -2 - m_Right: 0 - m_Top: -4 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 0 - m_FontStyle: 0 - m_Alignment: 3 - m_WordWrap: 0 - m_RichText: 0 - m_TextClipping: 1 - m_ImagePosition: 2 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 0 - m_FixedHeight: 17 - m_StretchWidth: 1 - m_StretchHeight: 0 - - m_Name: CustomExpressionSmallAddItem - m_Normal: - m_Background: {fileID: 2800000, guid: 1bd93c39ca74ac041b79ae289e9b9f08, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Hover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Active: - m_Background: {fileID: 2800000, guid: 1bd93c39ca74ac041b79ae289e9b9f08, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnNormal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnHover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Border: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 13 - m_FontStyle: 0 - m_Alignment: 4 - m_WordWrap: 0 - m_RichText: 0 - m_TextClipping: 0 - m_ImagePosition: 1 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 20 - m_FixedHeight: 18 - m_StretchWidth: 0 - m_StretchHeight: 0 - - m_Name: CustomExpressionSmallRemoveItem - m_Normal: - m_Background: {fileID: 2800000, guid: f4d31aa109c919d4595094f627510932, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Hover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Active: - m_Background: {fileID: 2800000, guid: f4d31aa109c919d4595094f627510932, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnNormal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnHover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Border: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 13 - m_FontStyle: 0 - m_Alignment: 4 - m_WordWrap: 0 - m_RichText: 0 - m_TextClipping: 0 - m_ImagePosition: 1 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 25 - m_FixedHeight: 18 - m_StretchWidth: 0 - m_StretchHeight: 0 - - m_Name: ResetToDefaultInspectorButton - m_Normal: - m_Background: {fileID: 2800000, guid: a51794475a883744db8d524cee84e5fc, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Hover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Active: - m_Background: {fileID: 2800000, guid: a51794475a883744db8d524cee84e5fc, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnNormal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnHover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Border: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Margin: - m_Left: 0 - m_Right: 2 - m_Top: 6 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: -2 - m_Right: 2 - m_Top: 0 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 13 - m_FontStyle: 0 - m_Alignment: 4 - m_WordWrap: 0 - m_RichText: 0 - m_TextClipping: 0 - m_ImagePosition: 2 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 10 - m_FixedHeight: 9 - m_StretchWidth: 0 - m_StretchHeight: 0 - - m_Name: SliderStyle - m_Normal: - m_Background: {fileID: 2800000, guid: 4cabb2d6785b8aa4db0c0a34e1e00f04, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Hover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Active: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnNormal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnHover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Border: - m_Left: 3 - m_Right: 3 - m_Top: 0 - m_Bottom: 0 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 0 - m_FontStyle: 0 - m_Alignment: 0 - m_WordWrap: 0 - m_RichText: 0 - m_TextClipping: 1 - m_ImagePosition: 2 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 1 - m_StretchHeight: 0 - - m_Name: ObjectPicker - m_Normal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: - - {fileID: 0} - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Hover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Active: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnNormal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnHover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Border: - m_Left: 8 - m_Right: 31 - m_Top: 0 - m_Bottom: 16 - m_Margin: - m_Left: 4 - m_Right: 4 - m_Top: 4 - m_Bottom: 4 - m_Padding: - m_Left: 0 - m_Right: 3 - m_Top: 0 - m_Bottom: 1 - m_Overflow: - m_Left: -24 - m_Right: -1 - m_Top: 0 - m_Bottom: -1 - m_Font: {fileID: 0} - m_FontSize: 0 - m_FontStyle: 0 - m_Alignment: 8 - m_WordWrap: 0 - m_RichText: 1 - m_TextClipping: 0 - m_ImagePosition: 3 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 0 - m_StretchHeight: 0 - - m_Name: NodePropertyPicker - m_Normal: - m_Background: {fileID: 2800000, guid: 94816692c85001f4dab01ec3666943c0, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Hover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Active: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnNormal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnHover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Border: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 0 - m_FontStyle: 0 - m_Alignment: 4 - m_WordWrap: 0 - m_RichText: 0 - m_TextClipping: 0 - m_ImagePosition: 2 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 16 - m_FixedHeight: 16 - m_StretchWidth: 0 - m_StretchHeight: 0 - - m_Name: NodePreviewExpander - m_Normal: - m_Background: {fileID: 2800000, guid: 1f3a46793c375864ab816c0d78061e4e, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Hover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Active: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnNormal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnHover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Border: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 0 - m_FontStyle: 0 - m_Alignment: 4 - m_WordWrap: 0 - m_RichText: 0 - m_TextClipping: 0 - m_ImagePosition: 2 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 16 - m_FixedHeight: 16 - m_StretchWidth: 0 - m_StretchHeight: 0 - - m_Name: NodePreviewCollapser - m_Normal: - m_Background: {fileID: 2800000, guid: dae54b5aa457b474e8a1599de1073d26, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Hover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Active: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnNormal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnHover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Border: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 0 - m_FontStyle: 0 - m_Alignment: 4 - m_WordWrap: 0 - m_RichText: 0 - m_TextClipping: 0 - m_ImagePosition: 2 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 16 - m_FixedHeight: 16 - m_StretchWidth: 0 - m_StretchHeight: 0 - - m_Name: SamplerButton - m_Normal: - m_Background: {fileID: 2800000, guid: b57dd36838fb19c449fd4559efe3f800, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} - m_Hover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} - m_Active: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} - m_OnNormal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} - m_OnHover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} - m_Border: - m_Left: 2 - m_Right: 0 - m_Top: 2 - m_Bottom: 0 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 1 - m_Top: 0 - m_Bottom: -1 - m_Overflow: - m_Left: 0 - m_Right: 1 - m_Top: 0 - m_Bottom: 1 - m_Font: {fileID: 3021071571035331536, guid: 0000000000000000d000000000000000, - type: 0} - m_FontSize: 9 - m_FontStyle: 0 - m_Alignment: 5 - m_WordWrap: 0 - m_RichText: 1 - m_TextClipping: 0 - m_ImagePosition: 3 - m_ContentOffset: {x: 0, y: 1} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 0 - m_StretchHeight: 0 - - m_Name: SamplerFrame - m_Normal: - m_Background: {fileID: 2800000, guid: c1912a55d2f211d468ddeb7b1386dd41, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} - m_Hover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} - m_Active: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} - m_OnNormal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} - m_OnHover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} - m_Border: - m_Left: 4 - m_Right: 4 - m_Top: 4 - m_Bottom: 4 - m_Margin: - m_Left: 4 - m_Right: 4 - m_Top: 4 - m_Bottom: 4 - m_Padding: - m_Left: 3 - m_Right: 3 - m_Top: 3 - m_Bottom: 3 - m_Overflow: - m_Left: 1 - m_Right: 1 - m_Top: 1 - m_Bottom: 1 - m_Font: {fileID: 3021071571035331536, guid: 0000000000000000d000000000000000, - type: 0} - m_FontSize: 0 - m_FontStyle: 0 - m_Alignment: 3 - m_WordWrap: 0 - m_RichText: 1 - m_TextClipping: 1 - m_ImagePosition: 0 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 1 - m_StretchHeight: 0 - - m_Name: CommentarySuperTitle - m_Normal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.5882353} - m_Hover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} - m_Active: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} - m_OnNormal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} - m_OnHover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} - m_Border: - m_Left: 4 - m_Right: 4 - m_Top: 4 - m_Bottom: 4 - m_Margin: - m_Left: 4 - m_Right: 4 - m_Top: 4 - m_Bottom: 4 - m_Padding: - m_Left: 3 - m_Right: 3 - m_Top: 3 - m_Bottom: 3 - m_Overflow: - m_Left: 1 - m_Right: 1 - m_Top: 1 - m_Bottom: 1 - m_Font: {fileID: 3021071571035331536, guid: 0000000000000000d000000000000000, - type: 0} - m_FontSize: 18 - m_FontStyle: 2 - m_Alignment: 3 - m_WordWrap: 0 - m_RichText: 1 - m_TextClipping: 0 - m_ImagePosition: 3 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 1 - m_StretchHeight: 0 - - m_Name: MiniButtonBotLeft - m_Normal: - m_Background: {fileID: 2800000, guid: 9f2d5e61dd9821b44a410f36519781d7, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} - m_Hover: - m_Background: {fileID: 2800000, guid: 6f3901bfd2342774ba74e117e43d6db7, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Active: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} - m_OnNormal: - m_Background: {fileID: 2800000, guid: 4c872bb553406fe44a9d0046a0ef9bc5, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnHover: - m_Background: {fileID: 2800000, guid: 7ef06ce40d713d34790e78278ee82dea, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} - m_Border: - m_Left: 1 - m_Right: 2 - m_Top: 2 - m_Bottom: 1 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 1 - m_Right: 0 - m_Top: 1 - m_Bottom: 0 - m_Font: {fileID: 3021071571035331536, guid: 0000000000000000d000000000000000, - type: 0} - m_FontSize: 9 - m_FontStyle: 0 - m_Alignment: 4 - m_WordWrap: 0 - m_RichText: 0 - m_TextClipping: 1 - m_ImagePosition: 0 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 1 - m_StretchHeight: 0 - - m_Name: MiniButtonBotMid - m_Normal: - m_Background: {fileID: 2800000, guid: eaf512a569994074b9b268ff098b0f03, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} - m_Hover: - m_Background: {fileID: 2800000, guid: c86cb249299fb7249b5ee7fb27ef1951, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Active: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} - m_OnNormal: - m_Background: {fileID: 2800000, guid: 133e79bed45185d408f4c5410f89dded, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnHover: - m_Background: {fileID: 2800000, guid: 542d7546736ddd244a145ef7103678fb, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} - m_Border: - m_Left: 1 - m_Right: 1 - m_Top: 2 - m_Bottom: 1 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 0 - m_Right: 0 - m_Top: 1 - m_Bottom: 0 - m_Font: {fileID: 3021071571035331536, guid: 0000000000000000d000000000000000, - type: 0} - m_FontSize: 9 - m_FontStyle: 0 - m_Alignment: 4 - m_WordWrap: 0 - m_RichText: 0 - m_TextClipping: 1 - m_ImagePosition: 0 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 1 - m_StretchHeight: 0 - - m_Name: MiniButtonBotRight - m_Normal: - m_Background: {fileID: 2800000, guid: bfcecef29876cc54db85363cf2feebb2, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} - m_Hover: - m_Background: {fileID: 2800000, guid: df6fb8448a382c743bd124cc0da55113, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Active: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} - m_OnNormal: - m_Background: {fileID: 2800000, guid: 3821e905373e9fb4aac56ad254ba5769, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnHover: - m_Background: {fileID: 2800000, guid: d3098ebd60a35494e9977bd96b923298, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} - m_Border: - m_Left: 1 - m_Right: 2 - m_Top: 2 - m_Bottom: 1 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 0 - m_Right: 1 - m_Top: 1 - m_Bottom: 0 - m_Font: {fileID: 3021071571035331536, guid: 0000000000000000d000000000000000, - type: 0} - m_FontSize: 9 - m_FontStyle: 0 - m_Alignment: 4 - m_WordWrap: 0 - m_RichText: 0 - m_TextClipping: 1 - m_ImagePosition: 0 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 1 - m_StretchHeight: 0 - - m_Name: ShaderFunctionBorder - m_Normal: - m_Background: {fileID: 2800000, guid: 94cd628d3d8e07d40a85d82b3fdad15d, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} - m_Hover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Active: - m_Background: {fileID: 0} - m_ScaledBackgrounds: - - {fileID: -3646434626659933611, guid: 0000000000000000d000000000000000, type: 0} - m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} - m_OnNormal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: - - {fileID: -3080321147634112521, guid: 0000000000000000d000000000000000, type: 0} - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnHover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: - - {fileID: -3976217546018649614, guid: 0000000000000000d000000000000000, type: 0} - m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} - m_Border: - m_Left: 10 - m_Right: 10 - m_Top: 10 - m_Bottom: 10 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 17 - m_FontStyle: 0 - m_Alignment: 4 - m_WordWrap: 0 - m_RichText: 0 - m_TextClipping: 0 - m_ImagePosition: 2 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 0 - m_StretchHeight: 0 - - m_Name: ShaderFunctionMode - m_Normal: - m_Background: {fileID: 2800000, guid: 68897d376b60748438e0ae3474ebe558, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} - m_Hover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} - m_Active: - m_Background: {fileID: 0} - m_ScaledBackgrounds: - - {fileID: -3646434626659933611, guid: 0000000000000000d000000000000000, type: 0} - m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} - m_OnNormal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: - - {fileID: -3080321147634112521, guid: 0000000000000000d000000000000000, type: 0} - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnHover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: - - {fileID: -3976217546018649614, guid: 0000000000000000d000000000000000, type: 0} - m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} - m_Border: - m_Left: 30 - m_Right: 0 - m_Top: 0 - m_Bottom: 38 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 14 - m_FontStyle: 1 - m_Alignment: 3 - m_WordWrap: 0 - m_RichText: 1 - m_TextClipping: 0 - m_ImagePosition: 0 - m_ContentOffset: {x: 34, y: -1} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 1 - m_StretchHeight: 1 - - m_Name: RightShaderMode - m_Normal: - m_Background: {fileID: 2800000, guid: 5725fa8ee04e1be449af059f5735cd81, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} - m_Hover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} - m_Active: - m_Background: {fileID: 0} - m_ScaledBackgrounds: - - {fileID: -3646434626659933611, guid: 0000000000000000d000000000000000, type: 0} - m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} - m_OnNormal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: - - {fileID: -3080321147634112521, guid: 0000000000000000d000000000000000, type: 0} - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnHover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: - - {fileID: -3976217546018649614, guid: 0000000000000000d000000000000000, type: 0} - m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} - m_Border: - m_Left: 0 - m_Right: 40 - m_Top: 0 - m_Bottom: 38 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 14 - m_FontStyle: 1 - m_Alignment: 5 - m_WordWrap: 0 - m_RichText: 1 - m_TextClipping: 0 - m_ImagePosition: 3 - m_ContentOffset: {x: -44, y: -1} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 1 - m_StretchHeight: 1 - - m_Name: FlatBackground - m_Normal: - m_Background: {fileID: 2800000, guid: 44efd0011d6a9bc4fb0b3a82753dac4e, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Hover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.4} - m_Active: - m_Background: {fileID: 0} - m_ScaledBackgrounds: - - {fileID: -3646434626659933611, guid: 0000000000000000d000000000000000, type: 0} - m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} - m_OnNormal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: - - {fileID: -3080321147634112521, guid: 0000000000000000d000000000000000, type: 0} - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnHover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: - - {fileID: -3976217546018649614, guid: 0000000000000000d000000000000000, type: 0} - m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} - m_Border: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 11 - m_FontStyle: 1 - m_Alignment: 4 - m_WordWrap: 0 - m_RichText: 1 - m_TextClipping: 0 - m_ImagePosition: 3 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 0 - m_StretchHeight: 0 - - m_Name: DocumentationLink - m_Normal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.29803923, g: 0.49019608, b: 1, a: 1} - m_Hover: - m_Background: {fileID: 2800000, guid: 1004d06b4b28f5943abdf2313a22790a, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Active: - m_Background: {fileID: 2800000, guid: 1004d06b4b28f5943abdf2313a22790a, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.7019608, g: 0.7019608, b: 0.7019608, a: 1} - m_Focused: - m_Background: {fileID: 2800000, guid: 1004d06b4b28f5943abdf2313a22790a, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.2985075, g: 0.4923412, b: 1, a: 1} - m_OnNormal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} - m_OnHover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.705, g: 0.705, b: 0.705, a: 1} - m_OnActive: - m_Background: {fileID: 2800000, guid: 1004d06b4b28f5943abdf2313a22790a, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.2985075, g: 0.4923412, b: 1, a: 1} - m_OnFocused: - m_Background: {fileID: 2800000, guid: 1004d06b4b28f5943abdf2313a22790a, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.2985075, g: 0.4923412, b: 1, a: 1} - m_Border: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Margin: - m_Left: 4 - m_Right: 4 - m_Top: 2 - m_Bottom: 2 - m_Padding: - m_Left: 2 - m_Right: 2 - m_Top: 1 - m_Bottom: 2 - m_Overflow: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 9 - m_FontStyle: 0 - m_Alignment: 1 - m_WordWrap: 0 - m_RichText: 0 - m_TextClipping: 1 - m_ImagePosition: 0 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 1 - m_StretchHeight: 0 - - m_Name: GraphButtonIcon - m_Normal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.7058824, g: 0.7058824, b: 0.7058824, a: 1} - m_Hover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Active: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.7058824, g: 0.7058824, b: 0.7058824, a: 1} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnNormal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnHover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Border: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 2 - m_Right: 2 - m_Top: 2 - m_Bottom: 2 - m_Overflow: - m_Left: 2 - m_Right: 2 - m_Top: 2 - m_Bottom: 2 - m_Font: {fileID: 0} - m_FontSize: 10 - m_FontStyle: 0 - m_Alignment: 4 - m_WordWrap: 0 - m_RichText: 0 - m_TextClipping: 1 - m_ImagePosition: 0 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 0 - m_StretchHeight: 0 - - m_Name: GraphButton - m_Normal: - m_Background: {fileID: 2800000, guid: 2b3b7485f95e8a44dab3fa9610f56cbb, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.7058824, g: 0.7058824, b: 0.7058824, a: 1} - m_Hover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Active: - m_Background: {fileID: 2800000, guid: dd3411e8d9927d3429d5872dbdbd752b, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0.7058824, g: 0.7058824, b: 0.7058824, a: 1} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnNormal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnHover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 0, g: 0, b: 0, a: 1} - m_Border: - m_Left: 3 - m_Right: 3 - m_Top: 3 - m_Bottom: 3 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 4 - m_Right: 4 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 1 - m_Right: 1 - m_Top: 1 - m_Bottom: 1 - m_Font: {fileID: 0} - m_FontSize: 10 - m_FontStyle: 0 - m_Alignment: 3 - m_WordWrap: 0 - m_RichText: 0 - m_TextClipping: 1 - m_ImagePosition: 0 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 1 - m_StretchHeight: 0 - - m_Name: NodeWindowOffSquare - m_Normal: - m_Background: {fileID: 2800000, guid: d179c8744f837da49ab92aae04d1ae1c, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Hover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Active: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnNormal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnHover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Border: - m_Left: 4 - m_Right: 4 - m_Top: 4 - m_Bottom: 4 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 1 - m_Right: 1 - m_Top: 1 - m_Bottom: 1 - m_Font: {fileID: 0} - m_FontSize: 13 - m_FontStyle: 1 - m_Alignment: 1 - m_WordWrap: 0 - m_RichText: 0 - m_TextClipping: 0 - m_ImagePosition: 0 - m_ContentOffset: {x: 0, y: -18} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 1 - m_StretchHeight: 0 - - m_Name: NodeHeaderSquare - m_Normal: - m_Background: {fileID: 2800000, guid: b16188b8a3dee8146bd9cb0bde234a24, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Hover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Active: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnNormal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnHover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Border: - m_Left: 4 - m_Right: 4 - m_Top: 4 - m_Bottom: 4 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 1 - m_Right: 1 - m_Top: 1 - m_Bottom: 1 - m_Font: {fileID: 0} - m_FontSize: 13 - m_FontStyle: 1 - m_Alignment: 1 - m_WordWrap: 0 - m_RichText: 1 - m_TextClipping: 0 - m_ImagePosition: 0 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 1 - m_StretchHeight: 0 - - m_Name: NodeWindowOnSquare - m_Normal: - m_Background: {fileID: 2800000, guid: 080a030f87555fe419ecc1fb9f509118, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Hover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Active: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnNormal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnHover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Border: - m_Left: 6 - m_Right: 6 - m_Top: 6 - m_Bottom: 6 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 2 - m_Right: 2 - m_Top: 2 - m_Bottom: 2 - m_Font: {fileID: 0} - m_FontSize: 6 - m_FontStyle: 1 - m_Alignment: 1 - m_WordWrap: 0 - m_RichText: 1 - m_TextClipping: 0 - m_ImagePosition: 0 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 1 - m_StretchHeight: 0 - - m_Name: ConsoleLogMessage - m_Normal: - m_Background: {fileID: 2800000, guid: c560c5d8ca4c353409caf2ec204f3a19, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Hover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Active: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnNormal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnHover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Border: - m_Left: 8 - m_Right: 8 - m_Top: 8 - m_Bottom: 8 - m_Margin: - m_Left: 4 - m_Right: 4 - m_Top: 4 - m_Bottom: 4 - m_Padding: - m_Left: 4 - m_Right: 4 - m_Top: 4 - m_Bottom: 4 - m_Overflow: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 10 - m_FontStyle: 0 - m_Alignment: 8 - m_WordWrap: 0 - m_RichText: 0 - m_TextClipping: 0 - m_ImagePosition: 0 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 0 - m_StretchHeight: 0 - - m_Name: ConsoleLogCircle - m_Normal: - m_Background: {fileID: 2800000, guid: c560c5d8ca4c353409caf2ec204f3a19, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} - m_Hover: - m_Background: {fileID: 2800000, guid: c560c5d8ca4c353409caf2ec204f3a19, type: 3} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Active: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Focused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnNormal: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 0.5019608} - m_OnHover: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnActive: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_OnFocused: - m_Background: {fileID: 0} - m_ScaledBackgrounds: [] - m_TextColor: {r: 1, g: 1, b: 1, a: 1} - m_Border: - m_Left: 8 - m_Right: 8 - m_Top: 8 - m_Bottom: 8 - m_Margin: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Overflow: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_Font: {fileID: 0} - m_FontSize: 10 - m_FontStyle: 0 - m_Alignment: 4 - m_WordWrap: 0 - m_RichText: 0 - m_TextClipping: 0 - m_ImagePosition: 0 - m_ContentOffset: {x: 0, y: 0} - m_FixedWidth: 0 - m_FixedHeight: 0 - m_StretchWidth: 0 - m_StretchHeight: 0 - m_Settings: - m_DoubleClickSelectsWord: 0 - m_TripleClickSelectsLine: 0 - m_CursorColor: {r: 1, g: 1, b: 1, a: 1} - m_CursorFlashSpeed: -1 - m_SelectionColor: {r: 1, g: 0.38403907, b: 0, a: 0.7} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/GUISkins/MainSkin.guiskin.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/GUISkins/MainSkin.guiskin.meta deleted file mode 100644 index 16018856..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/GUISkins/MainSkin.guiskin.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 57482289c346f104a8162a3a79aaff9d -timeCreated: 1481127067 -licenseType: Store -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Nodes.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Nodes.meta deleted file mode 100644 index 09c8ef6f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Nodes.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 74a246631cfb81b4eb720dba241ad84c -folderAsset: yes -timeCreated: 1481126944 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Nodes/Bezier1X2AA.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Nodes/Bezier1X2AA.png Binary files differdeleted file mode 100644 index ca6e05cf..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Nodes/Bezier1X2AA.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Nodes/Bezier1X2AA.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Nodes/Bezier1X2AA.png.meta deleted file mode 100644 index c2e4d986..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Nodes/Bezier1X2AA.png.meta +++ /dev/null @@ -1,59 +0,0 @@ -fileFormatVersion: 2 -guid: 06e687f68dd96f0448c6d8217bbcf608 -timeCreated: 1481126972 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 2 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - linearTexture: 0 - correctGamma: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 0 - cubemapConvolution: 0 - cubemapConvolutionSteps: 7 - cubemapConvolutionExponent: 1.5 - seamlessCubemap: 0 - textureFormat: -3 - maxTextureSize: 2048 - textureSettings: - filterMode: 2 - aniso: 16 - mipBias: -1 - wrapMode: 0 - nPOTScale: 1 - lightmap: 0 - rGBM: 0 - compressionQuality: 50 - allowsAlphaSplitting: 0 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: 5 - buildTargetSettings: [] - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Nodes/GPUInstancingIconOFF.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Nodes/GPUInstancingIconOFF.png Binary files differdeleted file mode 100644 index b97bfdb5..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Nodes/GPUInstancingIconOFF.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Nodes/GPUInstancingIconOFF.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Nodes/GPUInstancingIconOFF.png.meta deleted file mode 100644 index 5d712f10..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Nodes/GPUInstancingIconOFF.png.meta +++ /dev/null @@ -1,58 +0,0 @@ -fileFormatVersion: 2 -guid: 486c7766baaf21b46afb63c1121ef03e -timeCreated: 1481126990 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 2 - mipmaps: - mipMapMode: 1 - enableMipMap: 0 - linearTexture: 1 - correctGamma: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 0 - cubemapConvolution: 0 - cubemapConvolutionSteps: 7 - cubemapConvolutionExponent: 1.5 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 1 - aniso: 1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - rGBM: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - buildTargetSettings: [] - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Nodes/GPUInstancingIconON.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Nodes/GPUInstancingIconON.png Binary files differdeleted file mode 100644 index 0d8878a2..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Nodes/GPUInstancingIconON.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Nodes/GPUInstancingIconON.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Nodes/GPUInstancingIconON.png.meta deleted file mode 100644 index a7520562..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Nodes/GPUInstancingIconON.png.meta +++ /dev/null @@ -1,58 +0,0 @@ -fileFormatVersion: 2 -guid: 4b0c2926cc71c5846ae2a29652d54fb6 -timeCreated: 1481126990 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 2 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - linearTexture: 1 - correctGamma: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 0 - cubemapConvolution: 0 - cubemapConvolutionSteps: 7 - cubemapConvolutionExponent: 1.5 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 1 - aniso: 1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - rGBM: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - buildTargetSettings: [] - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Nodes/LinkIcon.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Nodes/LinkIcon.png Binary files differdeleted file mode 100644 index fa98d798..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Nodes/LinkIcon.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Nodes/LinkIcon.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Nodes/LinkIcon.png.meta deleted file mode 100644 index ba762b4b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Nodes/LinkIcon.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: 7cabe27e9427ef346a6b6557106353fd -timeCreated: 1481126999 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 1 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 1 - aniso: 1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Nodes/MasterNodeIconOFF.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Nodes/MasterNodeIconOFF.png Binary files differdeleted file mode 100644 index eb9426fd..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Nodes/MasterNodeIconOFF.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Nodes/MasterNodeIconOFF.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Nodes/MasterNodeIconOFF.png.meta deleted file mode 100644 index 50b756ff..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Nodes/MasterNodeIconOFF.png.meta +++ /dev/null @@ -1,58 +0,0 @@ -fileFormatVersion: 2 -guid: 712aee08d999c16438e2d694f42428e8 -timeCreated: 1481126996 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 2 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - linearTexture: 1 - correctGamma: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 0 - cubemapConvolution: 0 - cubemapConvolutionSteps: 7 - cubemapConvolutionExponent: 1.5 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 1 - aniso: 1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - rGBM: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - buildTargetSettings: [] - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Nodes/MasterNodeIconON.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Nodes/MasterNodeIconON.png Binary files differdeleted file mode 100644 index 7dc8d157..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Nodes/MasterNodeIconON.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Nodes/MasterNodeIconON.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Nodes/MasterNodeIconON.png.meta deleted file mode 100644 index 8d64d38d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Nodes/MasterNodeIconON.png.meta +++ /dev/null @@ -1,58 +0,0 @@ -fileFormatVersion: 2 -guid: 26c64fcee91024a49980ea2ee9d1a2fb -timeCreated: 1481126983 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 2 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - linearTexture: 1 - correctGamma: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 0 - cubemapConvolution: 0 - cubemapConvolutionSteps: 7 - cubemapConvolutionExponent: 1.5 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 1 - aniso: 1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - rGBM: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - buildTargetSettings: [] - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Nodes/TextureReferenceBg.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Nodes/TextureReferenceBg.png Binary files differdeleted file mode 100644 index 573cc117..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Nodes/TextureReferenceBg.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Nodes/TextureReferenceBg.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Nodes/TextureReferenceBg.png.meta deleted file mode 100644 index cc8e0617..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Nodes/TextureReferenceBg.png.meta +++ /dev/null @@ -1,58 +0,0 @@ -fileFormatVersion: 2 -guid: f9bd85ea2601b824c87556c13e852933 -timeCreated: 1481127030 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 2 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - linearTexture: 1 - correctGamma: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 0 - cubemapConvolution: 0 - cubemapConvolutionSteps: 7 - cubemapConvolutionExponent: 1.5 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 1 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - rGBM: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: 5 - buildTargetSettings: [] - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews.meta deleted file mode 100644 index 5bdab963..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 461082514f2c69d4a9cc883cd0fe7891 -folderAsset: yes -timeCreated: 1488289754 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/IndirectSpecularPreview.exr b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/IndirectSpecularPreview.exr Binary files differdeleted file mode 100644 index 90154e84..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/IndirectSpecularPreview.exr +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/IndirectSpecularPreview.exr.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/IndirectSpecularPreview.exr.meta deleted file mode 100644 index fd585500..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/IndirectSpecularPreview.exr.meta +++ /dev/null @@ -1,69 +0,0 @@ -fileFormatVersion: 2 -guid: ef7513b54a0670140b9b967af7620563 -timeCreated: 1512052044 -licenseType: Store -TextureImporter: - fileIDToRecycleName: - 8900000: generatedCubemap - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 1 - sRGBTexture: 1 - linearTexture: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 1 - seamlessCubemap: 1 - textureFormat: 1 - maxTextureSize: 2048 - textureSettings: - filterMode: 2 - aniso: 0 - mipBias: 0 - wrapMode: 1 - nPOTScale: 1 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: 0 - textureShape: 2 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 100 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/LinearPreviews.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/LinearPreviews.shader deleted file mode 100644 index 077ef3a9..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/LinearPreviews.shader +++ /dev/null @@ -1,232 +0,0 @@ -Shader "Hidden/LinearMaterial" -{ - Properties - { - _MainTex( "Texture", any ) = "" {} - _BackGround( "Back", 2D) = "white" {} - } - - SubShader - { - Lighting Off - Blend SrcAlpha OneMinusSrcAlpha - Cull Off - ZWrite Off - ZTest Always - - - Pass { - CGPROGRAM - #pragma vertex vert - #pragma fragment frag - #pragma target 2.0 - - #include "UnityCG.cginc" - - sampler2D _MainTex; - uniform float4 _MainTex_ST; - float4 _Mask; - - uniform float4x4 unity_GUIClipTextureMatrix; - sampler2D _GUIClipTexture; - - struct appdata_t { - float4 vertex : POSITION; - float2 texcoord : TEXCOORD0; - }; - - struct v2f { - float4 vertex : SV_POSITION; - float2 texcoord : TEXCOORD0; - float2 clipUV : TEXCOORD1; - }; - - v2f vert( appdata_t v ) - { - v2f o; - o.vertex = UnityObjectToClipPos( v.vertex ); - o.texcoord = TRANSFORM_TEX( v.texcoord.xy, _MainTex ); - float3 eyePos = UnityObjectToViewPos( v.vertex ); - o.clipUV = mul( unity_GUIClipTextureMatrix, float4( eyePos.xy, 0, 1.0 ) ); - return o; - } - - fixed4 frag( v2f i ) : SV_Target - { - float4 c = tex2D( _MainTex, i.texcoord ); - c.rgb *= _Mask.rgb; - - c.a = tex2D( _GUIClipTexture, i.clipUV ).a; - return c; - } - ENDCG - } - - Pass { // sphere preview = true, alpha mask = false - CGPROGRAM - #pragma vertex vert - #pragma fragment frag - #pragma target 2.0 - - #include "UnityCG.cginc" - - sampler2D _MainTex; - uniform float4 _MainTex_ST; - float _InvertedZoom; - float4 _Mask; - - uniform float4x4 unity_GUIClipTextureMatrix; - sampler2D _GUIClipTexture; - - struct appdata_t { - float4 vertex : POSITION; - float2 texcoord : TEXCOORD0; - }; - - struct v2f { - float4 vertex : SV_POSITION; - float2 texcoord : TEXCOORD0; - float2 clipUV : TEXCOORD1; - }; - - v2f vert( appdata_t v ) - { - v2f o; - o.vertex = UnityObjectToClipPos( v.vertex ); - o.texcoord = TRANSFORM_TEX( v.texcoord.xy, _MainTex ); - float3 eyePos = UnityObjectToViewPos( v.vertex ); - o.clipUV = mul( unity_GUIClipTextureMatrix, float4( eyePos.xy, 0, 1.0 ) ); - return o; - } - - fixed4 frag( v2f i ) : SV_Target - { - float2 p = 2 * i.texcoord - 1; - float r = sqrt( dot( p,p ) ); - - float alpha = saturate( ( 1 - r )*( 45 * _InvertedZoom + 5 ) ); - - float4 c = tex2D( _MainTex, i.texcoord ); - c.rgb *= _Mask.rgb; - - c.rgb *= alpha; - - c.a = tex2D( _GUIClipTexture, i.clipUV ).a; - return c; - } - ENDCG - } - - Pass { - CGPROGRAM - #pragma vertex vert - #pragma fragment frag - #pragma target 2.0 - - #include "UnityCG.cginc" - - sampler2D _MainTex; - sampler2D _BackGround; - uniform float4 _MainTex_ST; - uniform float4 _BackGround_ST; - float _InvertedZoom; - float4 _Mask; - - uniform float4x4 unity_GUIClipTextureMatrix; - sampler2D _GUIClipTexture; - - struct appdata_t { - float4 vertex : POSITION; - float2 texcoord : TEXCOORD0; - }; - - struct v2f { - float4 vertex : SV_POSITION; - float2 texcoord : TEXCOORD0; - float2 clipUV : TEXCOORD1; - }; - - v2f vert( appdata_t v ) - { - v2f o; - o.vertex = UnityObjectToClipPos( v.vertex ); - o.texcoord = TRANSFORM_TEX( v.texcoord.xy, _MainTex ); - float3 eyePos = UnityObjectToViewPos( v.vertex ); - o.clipUV = mul( unity_GUIClipTextureMatrix, float4( eyePos.xy, 0, 1.0 ) ); - return o; - } - - fixed4 frag( v2f i ) : SV_Target - { - float3 back = tex2D( _BackGround, ( i.texcoord * 2 - 1 ) * _InvertedZoom).b; - - float4 c = tex2D( _MainTex, i.texcoord ); - c.rgb *= _Mask.rgb; - c.rgb = lerp( back, c.rgb, c.a ); - - c.a = tex2D( _GUIClipTexture, i.clipUV ).a; - return c; - } - ENDCG - } - - Pass { - CGPROGRAM - #pragma vertex vert - #pragma fragment frag - #pragma target 2.0 - - #include "UnityCG.cginc" - - sampler2D _MainTex; - sampler2D _BackGround; - uniform float4 _MainTex_ST; - uniform float4 _BackGround_ST; - float _InvertedZoom; - float4 _Mask; - - uniform float4x4 unity_GUIClipTextureMatrix; - sampler2D _GUIClipTexture; - - struct appdata_t { - float4 vertex : POSITION; - float2 texcoord : TEXCOORD0; - }; - - struct v2f { - float4 vertex : SV_POSITION; - float2 texcoord : TEXCOORD0; - float2 clipUV : TEXCOORD1; - }; - - v2f vert( appdata_t v ) - { - v2f o; - o.vertex = UnityObjectToClipPos( v.vertex ); - o.texcoord = TRANSFORM_TEX( v.texcoord.xy, _MainTex ); - float3 eyePos = UnityObjectToViewPos( v.vertex ); - o.clipUV = mul( unity_GUIClipTextureMatrix, float4( eyePos.xy, 0, 1.0 ) ); - return o; - } - - fixed4 frag( v2f i ) : SV_Target - { - float2 p = 2 * i.texcoord - 1; - float3 back = tex2D( _BackGround, p * _InvertedZoom).b; - float r = sqrt( dot( p,p ) ); - - float alpha = saturate( ( 1 - r )*( 45 * _InvertedZoom + 5 ) ); - - float4 c = 0; - c = tex2D( _MainTex, i.texcoord ); - c.rgb *= _Mask.rgb; - c.rgb = lerp( back, c.rgb, c.a * alpha); - - c.a = tex2D( _GUIClipTexture, i.clipUV ).a; - return c; - } - ENDCG - } - } - Fallback Off -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/LinearPreviews.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/LinearPreviews.shader.meta deleted file mode 100644 index 03bf6e56..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/LinearPreviews.shader.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e90ef6ea05743b84baf9549874c52e47 -timeCreated: 1489078120 -licenseType: Store -ShaderImporter: - defaultTextures: - - _MainTex: {instanceID: 0} - - _BackGround: {fileID: 2800000, guid: 750b1bd7ba8bd28489650de6d0a95cc5, type: 3} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ACosOpNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ACosOpNode.shader deleted file mode 100644 index a06859d0..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ACosOpNode.shader +++ /dev/null @@ -1,25 +0,0 @@ -Shader "Hidden/ACosOpNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag(v2f_img i) : SV_Target - { - return acos(tex2D( _A, i.uv )); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ACosOpNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ACosOpNode.shader.meta deleted file mode 100644 index 8cb6d6a6..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ACosOpNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 710f3c0bbd7ba0c4aada6d7dfadd49c2 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ASinOpNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ASinOpNode.shader deleted file mode 100644 index 8273b040..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ASinOpNode.shader +++ /dev/null @@ -1,25 +0,0 @@ -Shader "Hidden/ASinOpNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag(v2f_img i) : SV_Target - { - return asin(tex2D( _A, i.uv )); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ASinOpNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ASinOpNode.shader.meta deleted file mode 100644 index 69d34bac..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ASinOpNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 2b016c135284add4cb3364d4a0bd0638 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ATan2OpNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ATan2OpNode.shader deleted file mode 100644 index f15dbcd1..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ATan2OpNode.shader +++ /dev/null @@ -1,29 +0,0 @@ -Shader "Hidden/ATan2OpNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - _B ("_B", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D( _A, i.uv ); - float4 b = tex2D( _B, i.uv ); - return atan2(a, b); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ATan2OpNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ATan2OpNode.shader.meta deleted file mode 100644 index fc57c1ad..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ATan2OpNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 02e3ff61784e38840af6313936b6a730 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ATanOpNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ATanOpNode.shader deleted file mode 100644 index acc5cdba..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ATanOpNode.shader +++ /dev/null @@ -1,25 +0,0 @@ -Shader "Hidden/ATanOpNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag(v2f_img i) : SV_Target - { - return atan(tex2D( _A, i.uv )); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ATanOpNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ATanOpNode.shader.meta deleted file mode 100644 index 178006ab..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ATanOpNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 7d7f3331a98831241b017364e80625ea -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_AbsOpNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_AbsOpNode.shader deleted file mode 100644 index ecff53d0..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_AbsOpNode.shader +++ /dev/null @@ -1,25 +0,0 @@ -Shader "Hidden/AbsOpNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag(v2f_img i) : SV_Target - { - return abs(tex2D( _A, i.uv )); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_AbsOpNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_AbsOpNode.shader.meta deleted file mode 100644 index 43b75957..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_AbsOpNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: cd6d6dfa3df214a479f68a490e177db6 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_AppendNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_AppendNode.shader deleted file mode 100644 index f91228b2..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_AppendNode.shader +++ /dev/null @@ -1,36 +0,0 @@ -Shader "Hidden/AppendNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - _B ("_B", 2D) = "white" {} - _C ("_C", 2D) = "white" {} - _D ("_D", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - sampler2D _C; - sampler2D _D; - - float4 frag(v2f_img i) : SV_Target - { - float x = tex2D(_A, i.uv).x; - float y = tex2D(_B, i.uv).y; - float z = tex2D(_C, i.uv).z; - float w = tex2D(_D, i.uv).w; - - return float4(x,y,z,w); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_AppendNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_AppendNode.shader.meta deleted file mode 100644 index fc3d21e6..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_AppendNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: d80ac81aabf643848a4eaa76f2f88d65 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_BlendNormalsNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_BlendNormalsNode.shader deleted file mode 100644 index 0d1c0182..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_BlendNormalsNode.shader +++ /dev/null @@ -1,31 +0,0 @@ -Shader "Hidden/BlendNormalsNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - _B ("_B", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - #pragma target 3.0 - #include "UnityCG.cginc" - #include "UnityStandardUtils.cginc" - - sampler2D _A; - sampler2D _B; - - float4 frag(v2f_img i) : SV_Target - { - float3 a = tex2D( _A, i.uv ).rgb; - float3 b = tex2D( _B, i.uv ).rgb; - return float4(BlendNormals(a, b), 0); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_BlendNormalsNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_BlendNormalsNode.shader.meta deleted file mode 100644 index fac57de2..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_BlendNormalsNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: bcdf750ff5f70444f98b8a3efa50dc6f -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_BlendOpsNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_BlendOpsNode.shader deleted file mode 100644 index 80665118..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_BlendOpsNode.shader +++ /dev/null @@ -1,601 +0,0 @@ -Shader "Hidden/BlendOpsNode" -{ - Properties - { - _A ("_Source", 2D) = "white" {} - _B ("_Destiny", 2D) = "white" {} - _C ("_Alpha", 2D) = "white" {} - } - SubShader - { - Pass //colorburn - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - sampler2D _C; - int _Sat; - int _Lerp; - - float4 frag(v2f_img i) : SV_Target - { - float4 src = tex2D( _A, i.uv ); - float4 des = tex2D( _B, i.uv ); - - float4 c = ( ( 1.0 - ( ( 1.0 - des) / max( src,0.00001)) ) ); - if (_Lerp == 1) - { - float alpha = tex2D (_C, i.uv).r; - c = lerp(des, c, alpha); - } - - if( _Sat == 1 ) - c = saturate( c ); - return c; - } - ENDCG - } - - Pass //colordodge - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - sampler2D _C; - int _Sat; - int _Lerp; - - float4 frag(v2f_img i) : SV_Target - { - float4 src = tex2D( _A, i.uv ); - float4 des = tex2D( _B, i.uv ); - - float4 c = ( ( des/ max( 1.0 - src,0.00001 ) ) ); - if (_Lerp == 1) - { - float alpha = tex2D (_C, i.uv).r; - c = lerp (des, c, alpha); - } - if( _Sat == 1 ) - c = saturate( c ); - return c; - } - ENDCG - } - - Pass //darken - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - sampler2D _C; - int _Sat; - int _Lerp; - - float4 frag(v2f_img i) : SV_Target - { - float4 src = tex2D( _A, i.uv ); - float4 des = tex2D( _B, i.uv ); - - float4 c = ( min( src , des ) ); - if (_Lerp == 1) - { - float alpha = tex2D (_C, i.uv).r; - c = lerp (des, c, alpha); - } - if( _Sat == 1 ) - c = saturate( c ); - return c; - } - ENDCG - } - - Pass //divide - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - sampler2D _C; - int _Sat; - int _Lerp; - - float4 frag(v2f_img i) : SV_Target - { - float4 src = tex2D( _A, i.uv ); - float4 des = tex2D( _B, i.uv ); - - float4 c = ( ( des / max( src,0.00001) ) ); - if (_Lerp == 1) - { - float alpha = tex2D (_C, i.uv).r; - c = lerp (des, c, alpha); - } - if( _Sat == 1 ) - c = saturate( c ); - return c; - } - ENDCG - } - - Pass //difference - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - sampler2D _C; - int _Sat; - int _Lerp; - - float4 frag(v2f_img i) : SV_Target - { - float4 src = tex2D( _A, i.uv ); - float4 des = tex2D( _B, i.uv ); - - float4 c = ( abs( src - des ) ); - if (_Lerp == 1) - { - float alpha = tex2D (_C, i.uv).r; - c = lerp (des, c, alpha); - } - if( _Sat == 1 ) - c = saturate( c ); - return c; - } - ENDCG - } - - Pass //exclusion - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - sampler2D _C; - int _Sat; - int _Lerp; - - float4 frag(v2f_img i) : SV_Target - { - float4 src = tex2D( _A, i.uv ); - float4 des = tex2D( _B, i.uv ); - - float4 c = ( ( 0.5 - 2.0 * ( src - 0.5 ) * ( des - 0.5 ) ) ); - if (_Lerp == 1) - { - float alpha = tex2D (_C, i.uv).r; - c = lerp (des, c, alpha); - } - if( _Sat == 1 ) - c = saturate( c ); - return c; - } - ENDCG - } - - Pass //softlight - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - sampler2D _C; - int _Sat; - int _Lerp; - - float4 frag(v2f_img i) : SV_Target - { - float4 src = tex2D( _A, i.uv ); - float4 des = tex2D( _B, i.uv ); - - float4 c = ( 2.0f*src*des + des*des*(1.0f - 2.0f*src) ); - if (_Lerp == 1) - { - float alpha = tex2D (_C, i.uv).r; - c = lerp (des, c, alpha); - } - if( _Sat == 1 ) - c = saturate( c ); - return c; - } - ENDCG - } - - Pass //hardlight - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - sampler2D _C; - int _Sat; - int _Lerp; - - float4 frag(v2f_img i) : SV_Target - { - float4 src = tex2D( _A, i.uv ); - float4 des = tex2D( _B, i.uv ); - - float4 c = ( ( src > 0.5 ? ( 1.0 - ( 1.0 - 2.0 * ( src - 0.5 ) ) * ( 1.0 - des ) ) : ( 2.0 * src * des ) ) ); - if (_Lerp == 1) - { - float alpha = tex2D (_C, i.uv).r; - c = lerp (des, c, alpha); - } - if( _Sat == 1 ) - c = saturate( c ); - return c; - } - ENDCG - } - - Pass //hardmix - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - sampler2D _C; - int _Sat; - int _Lerp; - - float4 frag(v2f_img i) : SV_Target - { - float4 src = tex2D( _A, i.uv ); - float4 des = tex2D( _B, i.uv ); - - float4 c = ( round( 0.5 * ( src + des ) ) ); - if (_Lerp == 1) - { - float alpha = tex2D (_C, i.uv).r; - c = lerp (des, c, alpha); - } - if( _Sat == 1 ) - c = saturate( c ); - return c; - } - ENDCG - } - - Pass //lighten - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - sampler2D _C; - int _Sat; - int _Lerp; - - float4 frag(v2f_img i) : SV_Target - { - float4 src = tex2D( _A, i.uv ); - float4 des = tex2D( _B, i.uv ); - - float4 c = ( max( src, des ) ); - if (_Lerp == 1) - { - float alpha = tex2D (_C, i.uv).r; - c = lerp (des, c, alpha); - } - if( _Sat == 1 ) - c = saturate( c ); - return c; - } - ENDCG - } - - Pass //linearburn - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - sampler2D _C; - int _Sat; - int _Lerp; - - float4 frag(v2f_img i) : SV_Target - { - float4 src = tex2D( _A, i.uv ); - float4 des = tex2D( _B, i.uv ); - - float4 c = ( ( src + des - 1.0 ) ); - if (_Lerp == 1) - { - float alpha = tex2D (_C, i.uv).r; - c = lerp (des, c, alpha); - } - if( _Sat == 1 ) - c = saturate( c ); - return c; - } - ENDCG - } - - Pass //lineardodge - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - sampler2D _C; - int _Sat; - int _Lerp; - - float4 frag(v2f_img i) : SV_Target - { - float4 src = tex2D( _A, i.uv ); - float4 des = tex2D( _B, i.uv ); - - float4 c = ( ( src + des ) ); - if (_Lerp == 1) - { - float alpha = tex2D (_C, i.uv).r; - c = lerp (des, c, alpha); - } - if( _Sat == 1 ) - c = saturate( c ); - return c; - } - ENDCG - } - - Pass //linearlight - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - sampler2D _C; - int _Sat; - int _Lerp; - - float4 frag(v2f_img i) : SV_Target - { - float4 src = tex2D( _A, i.uv ); - float4 des = tex2D( _B, i.uv ); - - float4 c = ( ( src > 0.5 ? ( des + 2.0 * src - 1.0 ) : ( des + 2.0 * ( src - 0.5 ) ) ) ); - if (_Lerp == 1) - { - float alpha = tex2D (_C, i.uv).r; - c = lerp (des, c, alpha); - } - if( _Sat == 1 ) - c = saturate( c ); - return c; - } - ENDCG - } - - Pass //multiply - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - sampler2D _C; - int _Sat; - int _Lerp; - - float4 frag(v2f_img i) : SV_Target - { - float4 src = tex2D( _A, i.uv ); - float4 des = tex2D( _B, i.uv ); - - float4 c = ( ( src * des ) ); - if (_Lerp == 1) - { - float alpha = tex2D (_C, i.uv).r; - c = lerp (des, c, alpha); - } - if( _Sat == 1 ) - c = saturate( c ); - return c; - } - ENDCG - } - - Pass //overlay - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - sampler2D _C; - int _Sat; - int _Lerp; - - float4 frag(v2f_img i) : SV_Target - { - float4 src = tex2D( _A, i.uv ); - float4 des = tex2D( _B, i.uv ); - - float4 c = ( ( des > 0.5 ? ( 1.0 - 2.0 * ( 1.0 - des ) * ( 1.0 - src ) ) : ( 2.0 * des * src ) ) ); - if (_Lerp == 1) - { - float alpha = tex2D (_C, i.uv).r; - c = lerp (des, c, alpha); - } - if( _Sat == 1 ) - c = saturate( c ); - return c; - } - ENDCG - } - - Pass //pinlight - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - sampler2D _C; - int _Sat; - int _Lerp; - - float4 frag(v2f_img i) : SV_Target - { - float4 src = tex2D( _A, i.uv ); - float4 des = tex2D( _B, i.uv ); - - float4 c = ( ( src > 0.5 ? max( des, 2.0 * ( src - 0.5 ) ) : min( des, 2.0 * src ) ) ); - if (_Lerp == 1) - { - float alpha = tex2D (_C, i.uv).r; - c = lerp (des, c, alpha); - } - if( _Sat == 1 ) - c = saturate( c ); - return c; - } - ENDCG - } - - Pass //subtract - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - sampler2D _C; - int _Sat; - int _Lerp; - - float4 frag(v2f_img i) : SV_Target - { - float4 src = tex2D( _A, i.uv ); - float4 des = tex2D( _B, i.uv ); - - float4 c = ( ( des - src ) ); - if (_Lerp == 1) - { - float alpha = tex2D (_C, i.uv).r; - c = lerp (des, c, alpha); - } - if( _Sat == 1 ) - c = saturate( c ); - return c; - } - ENDCG - } - - Pass //screen - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - sampler2D _C; - int _Sat; - int _Lerp; - - float4 frag(v2f_img i) : SV_Target - { - float4 src = tex2D( _A, i.uv ); - float4 des = tex2D( _B, i.uv ); - - float4 c = ( ( 1.0 - ( 1.0 - src ) * ( 1.0 - des ) ) ); - if (_Lerp == 1) - { - float alpha = tex2D (_C, i.uv).r; - c = lerp (des, c, alpha); - } - if( _Sat == 1 ) - c = saturate( c ); - return c; - } - ENDCG - } - - Pass //vividlight - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - sampler2D _C; - int _Sat; - int _Lerp; - - float4 frag(v2f_img i) : SV_Target - { - float4 src = tex2D( _A, i.uv ); - float4 des = tex2D( _B, i.uv ); - - float4 c = ( ( src > 0.5 ? ( des / max( ( 1.0 - src ) * 2.0 ,0.00001) ) : ( 1.0 - ( ( ( 1.0 - des ) * 0.5 ) / max(src,0.00001) ) ) ) ); - if (_Lerp == 1) - { - float alpha = tex2D (_C, i.uv).r; - c = lerp (des, c, alpha); - } - if( _Sat == 1 ) - c = saturate( c ); - return c; - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_BlendOpsNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_BlendOpsNode.shader.meta deleted file mode 100644 index 37d0722b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_BlendOpsNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 6d6b3518705b3ba49acdc6e18e480257 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_BreakToComponentsNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_BreakToComponentsNode.shader deleted file mode 100644 index e6306b59..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_BreakToComponentsNode.shader +++ /dev/null @@ -1,73 +0,0 @@ -Shader "Hidden/BreakToComponentsNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag(v2f_img i) : SV_Target - { - return tex2D( _A, i.uv ).x; - } - ENDCG - } - - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag(v2f_img i) : SV_Target - { - return tex2D( _A, i.uv ).y; - } - ENDCG - } - - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag(v2f_img i) : SV_Target - { - return tex2D( _A, i.uv ).z; - } - ENDCG - } - - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag(v2f_img i) : SV_Target - { - return tex2D( _A, i.uv ).w; - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_BreakToComponentsNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_BreakToComponentsNode.shader.meta deleted file mode 100644 index 05a23744..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_BreakToComponentsNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 5f58f74a202ba804daddec838b75207d -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CeilOpNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CeilOpNode.shader deleted file mode 100644 index 7065d1e4..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CeilOpNode.shader +++ /dev/null @@ -1,25 +0,0 @@ -Shader "Hidden/CeilOpNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag(v2f_img i) : SV_Target - { - return ceil(tex2D( _A, i.uv )); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CeilOpNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CeilOpNode.shader.meta deleted file mode 100644 index e278da28..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CeilOpNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: ce0588227a766a245a85291977c1f222 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ClampOpNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ClampOpNode.shader deleted file mode 100644 index df9318ec..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ClampOpNode.shader +++ /dev/null @@ -1,33 +0,0 @@ -Shader "Hidden/ClampOpNode" -{ - Properties - { - _A ("_Value", 2D) = "white" {} - _B ("_Min", 2D) = "white" {} - _C ("_Max", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - sampler2D _C; - - float4 frag(v2f_img i) : SV_Target - { - float4 value = tex2D( _A, i.uv ); - float4 min = tex2D( _B, i.uv ); - float4 max = tex2D( _C, i.uv ); - - return clamp(value, min, max); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ClampOpNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ClampOpNode.shader.meta deleted file mode 100644 index aedd754d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ClampOpNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: ab6163c4b10bfc84da8e3c486520490a -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Clip.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Clip.shader deleted file mode 100644 index 47bd6e09..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Clip.shader +++ /dev/null @@ -1,35 +0,0 @@ -Shader "Hidden/Clip" -{ - Properties - { - _A ("_A", 2D) = "white" {} - _B ("_B", 2D) = "white" {} - _C ("_C", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - sampler2D _C; - - float4 frag( v2f_img i ) : SV_Target - { - float4 a = tex2D( _A, i.uv ); - float4 b = tex2D( _B, i.uv ); - float4 c = tex2D( _C, i.uv ); - - clip(b - c); - - return a; - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Clip.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Clip.shader.meta deleted file mode 100644 index 637c32a4..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Clip.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 1fca7774f364aee4d8c64e8634ef4be4 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ClipPlanes.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ClipPlanes.shader deleted file mode 100644 index 59f55435..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ClipPlanes.shader +++ /dev/null @@ -1,25 +0,0 @@ -Shader "Hidden/ClipPlanes" -{ - Properties - { - _PlaneId ("_PlaneId", Int) = 0 - } - - SubShader - { - Pass - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - #include "UnityCG.cginc" - - int _PlaneId; - float4 frag( v2f_img i ) : SV_Target - { - return unity_CameraWorldClipPlanes[_PlaneId]; - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ClipPlanes.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ClipPlanes.shader.meta deleted file mode 100644 index 7de7975e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ClipPlanes.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 6afe5a4ad7bbd0e4ab352c758f543a09 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ColorNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ColorNode.shader deleted file mode 100644 index 4663c496..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ColorNode.shader +++ /dev/null @@ -1,24 +0,0 @@ -Shader "Hidden/ColorNode" -{ - Properties { - _InputColor ("_InputColor", Color) = (0,0,0,0) - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - float4 _InputColor; - - float4 frag( v2f_img i ) : SV_Target - { - return _InputColor; - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ColorNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ColorNode.shader.meta deleted file mode 100644 index 27cfeaf0..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ColorNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 6cf365ccc7ae776488ae8960d6d134c3 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ColorSpaceDouble.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ColorSpaceDouble.shader deleted file mode 100644 index c27833a2..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ColorSpaceDouble.shader +++ /dev/null @@ -1,19 +0,0 @@ -Shader "Hidden/ColorSpaceDouble" -{ - SubShader - { - Pass - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - #include "UnityCG.cginc" - - float4 frag( v2f_img i ) : SV_Target - { - return unity_ColorSpaceDouble; - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ColorSpaceDouble.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ColorSpaceDouble.shader.meta deleted file mode 100644 index 66ba194e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ColorSpaceDouble.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: ac680a8772bb97c46851a7f075fd04e3 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Compare.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Compare.shader deleted file mode 100644 index 7a3009bb..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Compare.shader +++ /dev/null @@ -1,48 +0,0 @@ -Shader "Hidden/TFHCCompareEqual" -{ - Properties - { - _A ("_A", 2D) = "white" {} - _B ("_B", 2D) = "white" {} - _C ("_True", 2D) = "white" {} - _D ( "_False", 2D ) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - sampler2D _C; - sampler2D _D; - int _Operator; - - float4 frag(v2f_img i) : SV_Target - { - float A = tex2D( _A, i.uv ).x; - float B = tex2D( _B, i.uv ).x; - float4 True = tex2D( _C, i.uv ); - float4 False = tex2D ( _D, i.uv ); - - if( _Operator == 0 ) - return ( ( A == B ) ? True : False ); - else if( _Operator == 1 ) - return ( ( A != B ) ? True : False ); - else if( _Operator == 2 ) - return ( ( A > B ) ? True : False ); - else if( _Operator == 3 ) - return ( ( A >= B ) ? True : False ); - else if( _Operator == 4 ) - return ( ( A < B ) ? True : False ); - else - return ( ( A <= B ) ? True : False ); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Compare.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Compare.shader.meta deleted file mode 100644 index 9e2ee0ea..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Compare.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 381937898f0c15747af1da09a751890c -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ComponentMaskNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ComponentMaskNode.shader deleted file mode 100644 index b607639b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ComponentMaskNode.shader +++ /dev/null @@ -1,62 +0,0 @@ -Shader "Hidden/ComponentMaskNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - float _Singular; - float4 _Order; - - float4 frag( v2f_img i ) : SV_Target - { - float4 a = tex2D( _A, i.uv ); - float4 r = 0; - if(_Singular == 0) - r = a.x; - else if(_Singular == 1) - r = a.y; - else if(_Singular == 2) - r = a.z; - else if(_Singular == 3) - r = a.w; - - if ( _Order.x == 0 ) - r.x = a.x; - else if(_Order.y == 0) - r.x = a.y; - else if(_Order.z == 0) - r.x = a.z; - else if(_Order.w == 0) - r.x = a.w; - - if(_Order.y == 1) - r.y = a.y; - else if(_Order.z == 1) - r.y = a.z; - else if(_Order.w == 1) - r.y = a.w; - - if(_Order.z == 2) - r.z = a.z; - else if(_Order.w == 2) - r.z = a.w; - - if(_Order.w == 3) - r.w = a.w; - - return r; - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ComponentMaskNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ComponentMaskNode.shader.meta deleted file mode 100644 index a019f585..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ComponentMaskNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: b78e2b295c265cd439c80d218fb3e88e -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ComputeScreenPos.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ComputeScreenPos.shader deleted file mode 100644 index 175ae3ba..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ComputeScreenPos.shader +++ /dev/null @@ -1,47 +0,0 @@ -Shader "Hidden/ComputeScreenPos" -{ - Properties - { - _A ("_A", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag( v2f_img i ) : SV_Target - { - float4 a = tex2D( _A, i.uv ); - float4 screenPos = ComputeScreenPos(a); - return screenPos; - } - ENDCG - } - - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag (v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - float4 screenPos = ComputeScreenPos(a); - screenPos = screenPos / screenPos.w; - screenPos.z = (UNITY_NEAR_CLIP_VALUE >= 0) ? screenPos.z : screenPos.z* 0.5 + 0.5; - return screenPos; - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ComputeScreenPos.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ComputeScreenPos.shader.meta deleted file mode 100644 index 983e7e46..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ComputeScreenPos.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 97bd4895d847d764eb21d2bf7aa13671 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ConditionalIfNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ConditionalIfNode.shader deleted file mode 100644 index 1121f0d0..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ConditionalIfNode.shader +++ /dev/null @@ -1,47 +0,0 @@ -Shader "Hidden/Preview_ConditionalIfNode" -{ - Properties - { - _A ( "_A", 2D) = "white" {} - _B ( "_B", 2D ) = "white" {} - _C ( "_AGreaterThanB", 2D ) = "white" {} - _D ( "_AEqualToB", 2D ) = "white" {} - _E ( "_ALessThanB", 2D ) = "white" {} - } - - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - uniform sampler2D _A; - uniform sampler2D _B; - uniform sampler2D _C; - uniform sampler2D _D; - uniform sampler2D _E; - - float4 frag ( v2f_img i ) : SV_Target - { - float aVal = tex2D ( _A, i.uv ).r; - float bVal = tex2D ( _B, i.uv ).r; - float4 aGreaterbVal = tex2D ( _C, i.uv ); - float4 aEqualbVal = tex2D ( _D, i.uv ); - float4 aLessbVal = tex2D ( _E, i.uv ); - - if ( aVal > bVal ) - return aGreaterbVal; - - if ( aVal == bVal ) - return aEqualbVal; - - return aLessbVal; - - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ConditionalIfNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ConditionalIfNode.shader.meta deleted file mode 100644 index 2a79ade7..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ConditionalIfNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: f6fb4d46bddf29e45a8a3ddfed75d0c0 -timeCreated: 1515424552 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CosOpNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CosOpNode.shader deleted file mode 100644 index 7db02403..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CosOpNode.shader +++ /dev/null @@ -1,25 +0,0 @@ -Shader "Hidden/CosOpNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag(v2f_img i) : SV_Target - { - return cos(tex2D( _A, i.uv )); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CosOpNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CosOpNode.shader.meta deleted file mode 100644 index 85cde2f1..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CosOpNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 3dde9e80389196f459eb94137268de4a -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CosTime.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CosTime.shader deleted file mode 100644 index 8e591b68..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CosTime.shader +++ /dev/null @@ -1,25 +0,0 @@ -Shader "Hidden/CosTime" -{ - SubShader - { - Pass - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - #include "UnityCG.cginc" - - float _EditorTime; - - float4 frag( v2f_img i ) : SV_Target - { - float4 t = _EditorTime; - t.x = _EditorTime / 8; - t.y = _EditorTime / 4; - t.z = _EditorTime / 2; - return cos(t); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CosTime.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CosTime.shader.meta deleted file mode 100644 index 4a17551b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CosTime.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 3093999b42c3c0940a71799511d7781c -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CoshOpNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CoshOpNode.shader deleted file mode 100644 index 8bdcf409..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CoshOpNode.shader +++ /dev/null @@ -1,25 +0,0 @@ -Shader "Hidden/CoshOpNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag(v2f_img i) : SV_Target - { - return cosh(tex2D( _A, i.uv )); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CoshOpNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CoshOpNode.shader.meta deleted file mode 100644 index cb2b2fe8..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CoshOpNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 154a4c85fe88657489a54a02416402c0 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CrossProductOpNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CrossProductOpNode.shader deleted file mode 100644 index 6b50b149..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CrossProductOpNode.shader +++ /dev/null @@ -1,29 +0,0 @@ -Shader "Hidden/CrossProductOpNode" -{ - Properties - { - _A ("_Lhs", 2D) = "white" {} - _B ("_Rhs", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D( _A, i.uv ); - float4 b = tex2D( _B, i.uv ); - return float4(cross(a.rgb, b.rgb),0); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CrossProductOpNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CrossProductOpNode.shader.meta deleted file mode 100644 index 8a06c644..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_CrossProductOpNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 65a9be5cc7037654db8e148d669f03ee -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DdxOpNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DdxOpNode.shader deleted file mode 100644 index d6fd37ba..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DdxOpNode.shader +++ /dev/null @@ -1,25 +0,0 @@ -Shader "Hidden/DdxOpNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag(v2f_img i) : SV_Target - { - return ddx(tex2D( _A, i.uv )); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DdxOpNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DdxOpNode.shader.meta deleted file mode 100644 index 80e1431a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DdxOpNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: b54ea73d5568b3540977557813eb9c3c -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DdyOpNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DdyOpNode.shader deleted file mode 100644 index cfffd11c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DdyOpNode.shader +++ /dev/null @@ -1,25 +0,0 @@ -Shader "Hidden/DdyOpNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag(v2f_img i) : SV_Target - { - return ddy(tex2D( _A, i.uv )); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DdyOpNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DdyOpNode.shader.meta deleted file mode 100644 index ec2c4efd..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DdyOpNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 197dcc7f05339da47b6b0e681c475c5e -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeDepthNormalNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeDepthNormalNode.shader deleted file mode 100644 index 41ee539c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeDepthNormalNode.shader +++ /dev/null @@ -1,30 +0,0 @@ -Shader "Hidden/DecodeDepthNormalNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - - float4 frag( v2f_img i ) : SV_Target - { - float4 a = tex2D( _A, i.uv ); - float depthValue = 0; - float3 normalValue = 0; - DecodeDepthNormal( a , depthValue, normalValue ); - return float4( depthValue,normalValue ); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeDepthNormalNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeDepthNormalNode.shader.meta deleted file mode 100644 index 6f6d8ac8..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeDepthNormalNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: dbf37c4d3ce0f0b41822584d6c9ba203 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeFloatRGBAHlpNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeFloatRGBAHlpNode.shader deleted file mode 100644 index e7494660..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeFloatRGBAHlpNode.shader +++ /dev/null @@ -1,27 +0,0 @@ -Shader "Hidden/DecodeFloatRGBAHlpNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - - float4 frag( v2f_img i ) : SV_Target - { - float4 a = tex2D( _A, i.uv ); - return DecodeFloatRGBA( a ); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeFloatRGBAHlpNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeFloatRGBAHlpNode.shader.meta deleted file mode 100644 index a1237f67..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeFloatRGBAHlpNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: f71b31b15ff3f2042bafbed40acd29f4 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeFloatRGHlpNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeFloatRGHlpNode.shader deleted file mode 100644 index e60788ce..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeFloatRGHlpNode.shader +++ /dev/null @@ -1,27 +0,0 @@ -Shader "Hidden/DecodeFloatRGHlpNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - - float4 frag( v2f_img i ) : SV_Target - { - float2 a = tex2D( _A, i.uv ).rg; - return DecodeFloatRG( a ); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeFloatRGHlpNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeFloatRGHlpNode.shader.meta deleted file mode 100644 index c6e62f26..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeFloatRGHlpNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 1fb3121b1c8febb4dbcc2a507a2df2db -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeLightmapHlpNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeLightmapHlpNode.shader deleted file mode 100644 index b0629e6e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeLightmapHlpNode.shader +++ /dev/null @@ -1,26 +0,0 @@ -Shader "Hidden/DecodeLighmapHlpNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag( v2f_img i ) : SV_Target - { - float4 a = tex2D( _A, i.uv ); - return float4(DecodeLightmap ( a ),0); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeLightmapHlpNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeLightmapHlpNode.shader.meta deleted file mode 100644 index e0806a2d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeLightmapHlpNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: c2d3bee1aee183343b31b9208cb402e9 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeViewNormalStereoHlpNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeViewNormalStereoHlpNode.shader deleted file mode 100644 index cf7c62fd..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeViewNormalStereoHlpNode.shader +++ /dev/null @@ -1,27 +0,0 @@ -Shader "Hidden/DecodeViewNormalStereoHlpNode" -{ - Properties - { - _A ( "_A", 2D ) = "white" {} - } - - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag ( v2f_img i ) : SV_Target - { - float4 a = tex2D ( _A, i.uv ); - return float4( DecodeViewNormalStereo ( a ),0 ); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeViewNormalStereoHlpNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeViewNormalStereoHlpNode.shader.meta deleted file mode 100644 index 409d139d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DecodeViewNormalStereoHlpNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: e996db1cc4510c84185cb9f933f916bb -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DegreesOpNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DegreesOpNode.shader deleted file mode 100644 index 9e91f8c8..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DegreesOpNode.shader +++ /dev/null @@ -1,25 +0,0 @@ -Shader "Hidden/DegreesOpNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag(v2f_img i) : SV_Target - { - return degrees(tex2D( _A, i.uv )); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DegreesOpNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DegreesOpNode.shader.meta deleted file mode 100644 index 67fd1f3b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DegreesOpNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 2a8eebb5566830c4a9d7c4b9021bb743 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DeltaTime.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DeltaTime.shader deleted file mode 100644 index 092d1f9b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DeltaTime.shader +++ /dev/null @@ -1,26 +0,0 @@ -Shader "Hidden/DeltaTime" -{ - SubShader - { - Pass - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - #include "UnityCG.cginc" - - float _EditorDeltaTime; - - float4 frag( v2f_img i ) : SV_Target - { - float4 t = _EditorDeltaTime; - t.y = 1 / _EditorDeltaTime; - t.z = _EditorDeltaTime; - t.w = 1 / _EditorDeltaTime; - return cos(t); - } - ENDCG - } - - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DeltaTime.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DeltaTime.shader.meta deleted file mode 100644 index c39cf8da..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DeltaTime.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 9d69a693042c443498f96d6da60535eb -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DesaturateNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DesaturateNode.shader deleted file mode 100644 index 1bc967fa..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DesaturateNode.shader +++ /dev/null @@ -1,34 +0,0 @@ -Shader "Hidden/DesaturateNode" -{ - Properties - { - _A ( "_RBG", 2D ) = "white" {} - _B ( "_Fraction", 2D ) = "white" {} - } - - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - uniform sampler2D _A; - uniform sampler2D _B; - - float4 frag ( v2f_img i ) : SV_Target - { - float3 rgb = tex2D ( _A, i.uv ).rgb; - float fraction = tex2D ( _B, i.uv ).r; - - float dotResult = dot ( rgb, float3( 0.299, 0.587, 0.114 ) ); - float3 finalColor = lerp ( rgb, dotResult.xxx, fraction ); - - return float4( finalColor, 1 ); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DesaturateNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DesaturateNode.shader.meta deleted file mode 100644 index 97fe8c09..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DesaturateNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: faabe9efdf44b9648a523f1742abdfd3 -timeCreated: 1515421907 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DiffuseAndSpecularFromMetallic.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DiffuseAndSpecularFromMetallic.shader deleted file mode 100644 index 9d2f4077..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DiffuseAndSpecularFromMetallic.shader +++ /dev/null @@ -1,32 +0,0 @@ -Shader "Hidden/DiffuseAndSpecularFromMetallicNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - _B ("_B", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #include "UnityStandardUtils.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag( v2f_img i ) : SV_Target - { - float4 albedo = tex2D( _A, i.uv ); - float metallic = tex2D( _A, i.uv ).r; - float3 specColor = 0; - float oneMinusReflectivity; - float3 albedoFinal = DiffuseAndSpecularFromMetallic(albedo,metallic,specColor,oneMinusReflectivity); - return float4( albedoFinal , 1 ); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DiffuseAndSpecularFromMetallic.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DiffuseAndSpecularFromMetallic.shader.meta deleted file mode 100644 index 46286ed7..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DiffuseAndSpecularFromMetallic.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: c7c4485750948a045b5dab0985896e17 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DistanceOpNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DistanceOpNode.shader deleted file mode 100644 index 0ba2dfdf..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DistanceOpNode.shader +++ /dev/null @@ -1,29 +0,0 @@ -Shader "Hidden/DistanceOpNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - _B ("_B", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D( _A, i.uv ); - float4 b = tex2D( _B, i.uv ); - return distance( a, b ); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DistanceOpNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DistanceOpNode.shader.meta deleted file mode 100644 index 6ca677b7..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DistanceOpNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 3be9a95031c0cb740ae982e465dfc242 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DotProductOpNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DotProductOpNode.shader deleted file mode 100644 index a467eed3..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DotProductOpNode.shader +++ /dev/null @@ -1,27 +0,0 @@ -Shader "Hidden/DotProductOpNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - _B ("_B", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - - float4 frag(v2f_img i) : SV_Target - { - return dot(tex2D(_A, i.uv).rgb, tex2D(_B, i.uv).rgb); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DotProductOpNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DotProductOpNode.shader.meta deleted file mode 100644 index d506912f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DotProductOpNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 85f11fd5cb9bb954c8615a45c57a3784 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DynamicAppendNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DynamicAppendNode.shader deleted file mode 100644 index d7e7b160..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DynamicAppendNode.shader +++ /dev/null @@ -1,135 +0,0 @@ -Shader "Hidden/DynamicAppendNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - _B ("_B", 2D) = "white" {} - _C ("_C", 2D) = "white" {} - _D ("_D", 2D) = "white" {} - _Mask("_Mask", Vector) = (0,0,0,0) - } - SubShader - { - CGINCLUDE - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - sampler2D _C; - sampler2D _D; - - float4 _Mask; - ENDCG - - Pass //0 - { - Name "1111" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - float4 b = tex2D(_B, i.uv); - float4 c = tex2D(_C, i.uv); - float4 d = tex2D(_D, i.uv); - return float4(a.x,b.x,c.x,d.x)*_Mask; - } - ENDCG - } - - Pass //1 - { - Name "1120" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - float4 b = tex2D(_B, i.uv); - float4 c = tex2D(_C, i.uv); - - return float4(a.x,b.x,c.xy)*_Mask; - } - ENDCG - } - - Pass //2 - { - Name "1201" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - float4 b = tex2D(_B, i.uv); - float4 d = tex2D(_D, i.uv); - return float4(a.x,b.xy,d.x)*_Mask; - } - ENDCG - } - - Pass //3 - { - Name "1300" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - float4 b = tex2D(_B, i.uv); - return float4(a.x,b.xyz)*_Mask; - } - ENDCG - } - - Pass //4 - { - Name "2011" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - float4 c = tex2D(_C, i.uv); - float4 d = tex2D(_D, i.uv); - return float4(a.xy,c.x,d.x)*_Mask; - } - ENDCG - } - - Pass //5 - { - Name "2020" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - float4 c = tex2D(_C, i.uv); - return float4(a.xy,c.xy)*_Mask; - } - ENDCG - } - - Pass //6 - { - Name "3001" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - float4 d = tex2D(_D, i.uv); - return float4(a.xyz,d.x)*_Mask; - } - ENDCG - } - - Pass //7 - { - Name "4000" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return a*_Mask; - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DynamicAppendNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DynamicAppendNode.shader.meta deleted file mode 100644 index ebe42e4d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_DynamicAppendNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: bfcd2919fe75bbf428fbbe583f463a9e -timeCreated: 1510580676 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_EncodeFloatRGBAHlpNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_EncodeFloatRGBAHlpNode.shader deleted file mode 100644 index 80e3070f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_EncodeFloatRGBAHlpNode.shader +++ /dev/null @@ -1,27 +0,0 @@ -Shader "Hidden/EncodeFloatRGBAHlpNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - - float4 frag( v2f_img i ) : SV_Target - { - float a = tex2D( _A, i.uv ).r; - return EncodeFloatRGBA( a ); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_EncodeFloatRGBAHlpNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_EncodeFloatRGBAHlpNode.shader.meta deleted file mode 100644 index 416d650e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_EncodeFloatRGBAHlpNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: c21569bf5b9371b4ca13c0c00abd5562 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_EncodeFloatRGHlpNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_EncodeFloatRGHlpNode.shader deleted file mode 100644 index f3b8ff14..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_EncodeFloatRGHlpNode.shader +++ /dev/null @@ -1,27 +0,0 @@ -Shader "Hidden/EncodeFloatRGNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - - float4 frag( v2f_img i ) : SV_Target - { - float a = tex2D( _A, i.uv ).r; - return float4( EncodeFloatRG( a ), 0,0); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_EncodeFloatRGHlpNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_EncodeFloatRGHlpNode.shader.meta deleted file mode 100644 index 8b064ebd..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_EncodeFloatRGHlpNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: a44b520baa5c39e41bc69a22ea46f24d -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_EncodeViewNormalStereoHlpNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_EncodeViewNormalStereoHlpNode.shader deleted file mode 100644 index d23d09fa..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_EncodeViewNormalStereoHlpNode.shader +++ /dev/null @@ -1,27 +0,0 @@ -Shader "Hidden/EncodeViewNormalStereoHlpNode" -{ - Properties - { - _A ( "_A", 2D ) = "white" {} - } - - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag ( v2f_img i ) : SV_Target - { - float3 a = tex2D ( _A, i.uv ).rgb; - return float4( EncodeViewNormalStereo( a ),0,0); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_EncodeViewNormalStereoHlpNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_EncodeViewNormalStereoHlpNode.shader.meta deleted file mode 100644 index 1db2cbf3..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_EncodeViewNormalStereoHlpNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 3d0b3d482b7246c4cb60fa73e6ceac6c -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Exp2OpNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Exp2OpNode.shader deleted file mode 100644 index 36ab7114..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Exp2OpNode.shader +++ /dev/null @@ -1,25 +0,0 @@ -Shader "Hidden/Exp2OpNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag(v2f_img i) : SV_Target - { - return exp2(tex2D( _A, i.uv )); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Exp2OpNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Exp2OpNode.shader.meta deleted file mode 100644 index b5c6d567..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Exp2OpNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: ceb70ed5423a36647a504a41de7dbfe6 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ExpOpNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ExpOpNode.shader deleted file mode 100644 index 83afb73c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ExpOpNode.shader +++ /dev/null @@ -1,25 +0,0 @@ -Shader "Hidden/ExpOpNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag(v2f_img i) : SV_Target - { - return exp(tex2D( _A, i.uv )); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ExpOpNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ExpOpNode.shader.meta deleted file mode 100644 index 53b5e1ef..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ExpOpNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 6416ff506137d97479a7ebde790b45e5 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FWidthOpNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FWidthOpNode.shader deleted file mode 100644 index d7116473..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FWidthOpNode.shader +++ /dev/null @@ -1,25 +0,0 @@ -Shader "Hidden/FWidthOpNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag(v2f_img i) : SV_Target - { - return fwidth(tex2D( _A, i.uv )); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FWidthOpNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FWidthOpNode.shader.meta deleted file mode 100644 index c251ea4f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FWidthOpNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 81ea481faaef9c8459a555479ba64df7 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FaceVariableNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FaceVariableNode.shader deleted file mode 100644 index 9cb44282..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FaceVariableNode.shader +++ /dev/null @@ -1,19 +0,0 @@ -Shader "Hidden/FaceVariableNode" -{ - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - float4 frag( v2f_img i, half ase_vface : VFACE ) : SV_Target - { - return ase_vface; - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FaceVariableNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FaceVariableNode.shader.meta deleted file mode 100644 index 9239bc98..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FaceVariableNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 4b0b5b9f16353b840a5f5ad2baab3c3c -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FloorOpNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FloorOpNode.shader deleted file mode 100644 index ad11b597..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FloorOpNode.shader +++ /dev/null @@ -1,25 +0,0 @@ -Shader "Hidden/FloorOpNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag(v2f_img i) : SV_Target - { - return floor(tex2D( _A, i.uv )); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FloorOpNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FloorOpNode.shader.meta deleted file mode 100644 index 11687b4f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FloorOpNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 46ae4a72a9a38de40a2d8f20cfccc67d -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FmodOpNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FmodOpNode.shader deleted file mode 100644 index 2149b14d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FmodOpNode.shader +++ /dev/null @@ -1,29 +0,0 @@ -Shader "Hidden/FmodOpNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - _B ("_B", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - - float4 frag( v2f_img i ) : SV_Target - { - float4 a = tex2D( _A, i.uv ); - float4 b = tex2D( _B, i.uv ); - return fmod(a, b); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FmodOpNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FmodOpNode.shader.meta deleted file mode 100644 index 8bbfee68..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FmodOpNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 65083930f9d7812479fd6ff203ad2992 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FogAndAmbientColors.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FogAndAmbientColors.shader deleted file mode 100644 index b2b5b937..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FogAndAmbientColors.shader +++ /dev/null @@ -1,75 +0,0 @@ -Shader "Hidden/FogAndAmbientColors" -{ - SubShader - { - Pass - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - #include "UnityCG.cginc" - - float4 frag( v2f_img i ) : SV_Target - { - return UNITY_LIGHTMODEL_AMBIENT; - } - ENDCG - } - - Pass - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - #include "UnityCG.cginc" - - float4 frag (v2f_img i) : SV_Target - { - return unity_AmbientSky; - } - ENDCG - } - - Pass - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - #include "UnityCG.cginc" - - float4 frag (v2f_img i) : SV_Target - { - return unity_AmbientEquator; - } - ENDCG - } - - Pass - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - #include "UnityCG.cginc" - - float4 frag (v2f_img i) : SV_Target - { - return unity_AmbientGround; - } - ENDCG - } - - Pass - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - #include "UnityCG.cginc" - - float4 frag (v2f_img i) : SV_Target - { - return unity_FogColor; - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FogAndAmbientColors.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FogAndAmbientColors.shader.meta deleted file mode 100644 index 40a27fe2..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FogAndAmbientColors.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 937c7bde062f0f942b600d9950d2ebb2 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FogParams.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FogParams.shader deleted file mode 100644 index c2914ce9..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FogParams.shader +++ /dev/null @@ -1,19 +0,0 @@ -Shader "Hidden/FogParams" -{ - SubShader - { - Pass - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - #include "UnityCG.cginc" - - float4 frag( v2f_img i ) : SV_Target - { - return unity_FogParams; - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FogParams.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FogParams.shader.meta deleted file mode 100644 index bef96887..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FogParams.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 42abde3281b1848438c3b53443c91a1e -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FractNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FractNode.shader deleted file mode 100644 index d85eaf69..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FractNode.shader +++ /dev/null @@ -1,25 +0,0 @@ -Shader "Hidden/FractNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag(v2f_img i) : SV_Target - { - return frac(tex2D( _A, i.uv )); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FractNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FractNode.shader.meta deleted file mode 100644 index 4de2ceeb..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FractNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 53a335f8f18d4694b8d94e8aee21fdca -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FresnelNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FresnelNode.shader deleted file mode 100644 index 256a4d66..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FresnelNode.shader +++ /dev/null @@ -1,358 +0,0 @@ -Shader "Hidden/FresnelNode" -{ - Properties - { - _A ("_Normal", 2D) = "white" {} - _B ("_Bias", 2D) = "white" {} - _C ("_Scale", 2D) = "white" {} - _D ("_Power", 2D) = "white" {} - _E ("_View", 2D) = "white" {} - } - SubShader - { - Pass //not connected world - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - //sampler2D _A; - sampler2D _B; - sampler2D _C; - sampler2D _D; - int _FresnelType; - - float4 frag(v2f_img i) : SV_Target - { - float b = tex2D( _B, i.uv ).r; - float s = tex2D( _C, i.uv ).r; - float pw = tex2D( _D, i.uv ).r; - - float2 xy = 2 * i.uv - 1; - float z = -sqrt(1-saturate(dot(xy,xy))); - float3 vertexPos = float3(xy, z); - float3 worldNormal = normalize(float3(xy, z)); - float3 worldViewDir = normalize(float3(0,0,-5) - vertexPos); - - float fresnel = 0; - if(_FresnelType == 0) - fresnel = (b + s*pow(1 - dot( worldNormal, worldViewDir ) , pw)); - else if(_FresnelType == 1) - fresnel = (b + (1-b) * pow(1 - dot( worldNormal, worldViewDir ) , 5)); - else if(_FresnelType == 2) - { - float f0 = pow((1-s)/(1+s),2); - fresnel = (f0 + (1-f0) * pow(1 - dot( worldNormal, worldViewDir ) , 5)); - } - return fresnel; - } - ENDCG - } - - Pass //connected world - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - sampler2D _C; - sampler2D _D; - int _FresnelType; - - float4 frag(v2f_img i) : SV_Target - { - float b = tex2D( _B, i.uv ).r; - float s = tex2D( _C, i.uv ).r; - float pw = tex2D( _D, i.uv ).r; - - float2 xy = 2 * i.uv - 1; - float z = -sqrt(1-saturate(dot(xy,xy))); - float3 vertexPos = float3(xy, z); - float3 worldNormal = tex2D( _A, i.uv ); - float3 worldViewDir = normalize(float3(0,0,-5) - vertexPos); - - float fresnel = 0; - if(_FresnelType == 0) - fresnel = (b + s*pow(1 - dot( worldNormal, worldViewDir ) , pw)); - else if(_FresnelType == 1) - fresnel = (b + (1-b) * pow(1 - dot( worldNormal, worldViewDir ) , 5)); - else if(_FresnelType == 2) - { - float f0 = pow((1-s)/(1+s),2); - fresnel = (f0 + (1-f0) * pow(1 - dot( worldNormal, worldViewDir ) , 5)); - } - return fresnel; - } - ENDCG - } - - Pass //connected tangent - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - sampler2D _C; - sampler2D _D; - int _FresnelType; - - float4 frag(v2f_img i) : SV_Target - { - float b = tex2D( _B, i.uv ).r; - float s = tex2D( _C, i.uv ).r; - float pw = tex2D( _D, i.uv ).r; - - float2 xy = 2 * i.uv - 1; - float z = -sqrt(1-saturate(dot(xy,xy))); - float3 vertexPos = float3(xy, z); - float3 worldNormal = normalize(float3(xy, z)); - - float3 tangent = normalize(float3( -z, xy.y*0.01, xy.x )); - float3 worldPos = mul(unity_ObjectToWorld, float4(vertexPos,1)).xyz; - float3 worldTangent = UnityObjectToWorldDir(tangent); - float tangentSign = -1; - float3 worldBinormal = normalize( cross(worldNormal, worldTangent) * tangentSign); - float4 tSpace0 = float4(worldTangent.x, worldBinormal.x, worldNormal.x, worldPos.x); - float4 tSpace1 = float4(worldTangent.y, worldBinormal.y, worldNormal.y, worldPos.y); - float4 tSpace2 = float4(worldTangent.z, worldBinormal.z, worldNormal.z, worldPos.z); - - float2 sphereUVs = i.uv; - - sphereUVs.x = (atan2(vertexPos.x, -vertexPos.z) / (UNITY_PI) + 0.5); - float3 tangentNormal = tex2D(_A, sphereUVs).xyz; - - worldNormal = fixed3( dot( tSpace0.xyz, tangentNormal ), dot( tSpace1.xyz, tangentNormal ), dot( tSpace2.xyz, tangentNormal ) ); - - float3 worldViewDir = normalize(float3(0,0,-5) - vertexPos); - - float fresnel = 0; - if(_FresnelType == 0) - fresnel = (b + s*pow(1 - dot( worldNormal, worldViewDir ) , pw)); - else if(_FresnelType == 1) - fresnel = (b + (1-b) * pow(1 - dot( worldNormal, worldViewDir ) , 5)); - else if(_FresnelType == 2) - { - float f0 = pow((1-s)/(1+s),2); - fresnel = (f0 + (1-f0) * pow(1 - dot( worldNormal, worldViewDir ) , 5)); - } - return fresnel; - } - ENDCG - } - - Pass //not connected half vector - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - //sampler2D _A; - sampler2D _B; - sampler2D _C; - sampler2D _D; - int _FresnelType; - float4 _EditorWorldLightPos; - float4 frag(v2f_img i) : SV_Target - { - float b = tex2D( _B, i.uv ).r; - float s = tex2D( _C, i.uv ).r; - float pw = tex2D( _D, i.uv ).r; - - float2 xy = 2 * i.uv - 1; - float z = -sqrt(1-(dot(xy,xy))); - float3 vertexPos = normalize(float3(xy, z)); - float3 worldViewDir = normalize(float3(0,0,-5) - vertexPos); - float3 lightDir = normalize( _EditorWorldLightPos.xyz ); - float3 halfVector = normalize(worldViewDir+lightDir); - - float fresnel = 0; - if(_FresnelType == 0) - fresnel = (b + s*pow(1 - dot( halfVector, worldViewDir ) , pw)); - else if(_FresnelType == 1) - fresnel = (b + (1-b) * pow(1 - dot( halfVector, worldViewDir ) , 5)); - else if(_FresnelType == 2) - { - float f0 = pow((1-s)/(1+s),2); - fresnel = (f0 + (1-f0) * pow(1 - dot( halfVector, worldViewDir ) , 5)); - } - return fresnel; - } - ENDCG - } - - Pass //connected both - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - sampler2D _C; - sampler2D _D; - sampler2D _E; - int _FresnelType; - - float4 frag(v2f_img i) : SV_Target - { - float b = tex2D( _B, i.uv ).r; - float s = tex2D( _C, i.uv ).r; - float pw = tex2D( _D, i.uv ).r; - - float2 xy = 2 * i.uv - 1; - float z = -sqrt(1-saturate(dot(xy,xy))); - float3 vertexPos = float3(xy, z); - float3 worldNormal = tex2D( _A, i.uv ); - float3 worldViewDir = tex2D( _E, i.uv );; - - float fresnel = 0; - if(_FresnelType == 0) - fresnel = (b + s*pow(1 - dot( worldNormal, worldViewDir ) , pw)); - else if(_FresnelType == 1) - fresnel = (b + (1-b) * pow(1 - dot( worldNormal, worldViewDir ) , 5)); - else if(_FresnelType == 2) - { - float f0 = pow((1-s)/(1+s),2); - fresnel = (f0 + (1-f0) * pow(1 - dot( worldNormal, worldViewDir ) , 5)); - } - return fresnel; - } - ENDCG - } - - Pass //not connected world and light - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - //sampler2D _A; - sampler2D _B; - sampler2D _C; - sampler2D _D; - int _FresnelType; - float4 _EditorWorldLightPos; - - float4 frag(v2f_img i) : SV_Target - { - float b = tex2D( _B, i.uv ).r; - float s = tex2D( _C, i.uv ).r; - float pw = tex2D( _D, i.uv ).r; - - float2 xy = 2 * i.uv - 1; - float z = -sqrt(1-(dot(xy,xy))); - float3 vertexPos = normalize(float3(xy, z)); - float3 normal = normalize(vertexPos); - float3 worldNormal = UnityObjectToWorldNormal(normal); - float3 lightDir = normalize( _EditorWorldLightPos.xyz ); - - float fresnel = 0; - if(_FresnelType == 0) - fresnel = (b + s*pow(1 - dot( worldNormal, lightDir ) , pw)); - else if(_FresnelType == 1) - fresnel = (b + (1-b) * pow(1 - dot( worldNormal, lightDir ) , 5)); - else if(_FresnelType == 2) - { - float f0 = pow((1-s)/(1+s),2); - fresnel = (f0 + (1-f0) * pow(1 - dot( worldNormal, lightDir ) , 5)); - } - return fresnel; - } - ENDCG - } - - Pass //connected view - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - sampler2D _C; - sampler2D _D; - sampler2D _E; - int _FresnelType; - - float4 frag(v2f_img i) : SV_Target - { - float b = tex2D( _B, i.uv ).r; - float s = tex2D( _C, i.uv ).r; - float pw = tex2D( _D, i.uv ).r; - - float2 xy = 2 * i.uv - 1; - float z = -sqrt(1-saturate(dot(xy,xy))); - float3 vertexPos = float3(xy, z); - float3 normal = normalize(vertexPos); - float3 worldNormal = UnityObjectToWorldNormal(normal); - float3 worldViewDir = tex2D( _E, i.uv ); - - float fresnel = 0; - if(_FresnelType == 0) - fresnel = (b + s*pow(1 - dot( worldNormal, worldViewDir ) , pw)); - else if(_FresnelType == 1) - fresnel = (b + (1-b) * pow(1 - dot( worldNormal, worldViewDir ) , 5)); - else if(_FresnelType == 2) - { - float f0 = pow((1-s)/(1+s),2); - fresnel = (f0 + (1-f0) * pow(1 - dot( worldNormal, worldViewDir ) , 5)); - } - return fresnel; - } - ENDCG - } - - Pass //not connected half vector with connected view - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - //sampler2D _A; - sampler2D _B; - sampler2D _C; - sampler2D _D; - sampler2D _E; - int _FresnelType; - float4 _EditorWorldLightPos; - float4 frag(v2f_img i) : SV_Target - { - float b = tex2D( _B, i.uv ).r; - float s = tex2D( _C, i.uv ).r; - float pw = tex2D( _D, i.uv ).r; - - float2 xy = 2 * i.uv - 1; - float z = -sqrt(1-(dot(xy,xy))); - float3 vertexPos = normalize(float3(xy, z)); - float3 worldViewDir = tex2D( _E, i.uv ); - float3 lightDir = normalize( _EditorWorldLightPos.xyz ); - float3 halfVector = normalize(worldViewDir+lightDir); - - float fresnel = 0; - if(_FresnelType == 0) - fresnel = (b + s*pow(1 - dot( halfVector, worldViewDir ) , pw)); - else if(_FresnelType == 1) - fresnel = (b + (1-b) * pow(1 - dot( halfVector, worldViewDir ) , 5)); - else if(_FresnelType == 2) - { - float f0 = pow((1-s)/(1+s),2); - fresnel = (f0 + (1-f0) * pow(1 - dot( halfVector, worldViewDir ) , 5)); - } - return fresnel; - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FresnelNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FresnelNode.shader.meta deleted file mode 100644 index c98c0fe3..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FresnelNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 240145eb70cf79f428015012559f4e7d -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FunctionInputNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FunctionInputNode.shader deleted file mode 100644 index 898706af..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FunctionInputNode.shader +++ /dev/null @@ -1,39 +0,0 @@ -Shader "Hidden/FunctionInputNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - int _Type; - - float4 frag(v2f_img i) : SV_Target - { - if( _Type == 1 ) - { - return tex2D( _A, i.uv ).r; - } else if( _Type == 2 ) - { - return float4(tex2D( _A, i.uv ).rg,0,0); - } else if( _Type == 3 ) - { - return float4(tex2D( _A, i.uv ).rgb,0); - } - else - { - return tex2D( _A, i.uv ); - } - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FunctionInputNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FunctionInputNode.shader.meta deleted file mode 100644 index e2cf164b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FunctionInputNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 04bc8e7b317dccb4d8da601680dd8140 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FunctionNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FunctionNode.shader deleted file mode 100644 index e8b7c4a8..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FunctionNode.shader +++ /dev/null @@ -1,25 +0,0 @@ -Shader "Hidden/FunctionNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag(v2f_img i) : SV_Target - { - return tex2D( _A, i.uv ); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FunctionNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FunctionNode.shader.meta deleted file mode 100644 index 7209bcd2..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FunctionNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: aca70c900c50c004e8ef0b47c4fac4d4 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FunctionOutputNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FunctionOutputNode.shader deleted file mode 100644 index 5fa7d2d1..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FunctionOutputNode.shader +++ /dev/null @@ -1,25 +0,0 @@ -Shader "Hidden/FunctionOutputNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag(v2f_img i) : SV_Target - { - return tex2D( _A, i.uv ); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FunctionOutputNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FunctionOutputNode.shader.meta deleted file mode 100644 index 689efb66..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_FunctionOutputNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: e6d5f64114b18e24f99dc65290c0fe98 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GammaToLinearNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GammaToLinearNode.shader deleted file mode 100644 index 585f4038..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GammaToLinearNode.shader +++ /dev/null @@ -1,27 +0,0 @@ -Shader "Hidden/GammaToLinearNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag(v2f_img i) : SV_Target - { - float4 c = tex2D( _A, i.uv ); - c.rgb = GammaToLinearSpace( c.rgb ); - return c; - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GammaToLinearNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GammaToLinearNode.shader.meta deleted file mode 100644 index 9ebe8def..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GammaToLinearNode.shader.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: e82a888a6ebdb1443823aafceaa051b9 -timeCreated: 1489078120 -licenseType: Store -ShaderImporter: - defaultTextures: - - _MainTex: {instanceID: 0} - - _BackGround: {fileID: 2800000, guid: 750b1bd7ba8bd28489650de6d0a95cc5, type: 3} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GetLocalVarNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GetLocalVarNode.shader deleted file mode 100644 index f9398ac0..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GetLocalVarNode.shader +++ /dev/null @@ -1,25 +0,0 @@ -Shader "Hidden/GetLocalVarNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag(v2f_img i) : SV_Target - { - return tex2D( _A, i.uv ); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GetLocalVarNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GetLocalVarNode.shader.meta deleted file mode 100644 index 513bcad1..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GetLocalVarNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: f21a6e44c7d7b8543afacd19751d24c6 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GradientSample.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GradientSample.shader deleted file mode 100644 index 28aebf55..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GradientSample.shader +++ /dev/null @@ -1,123 +0,0 @@ -Shader "Hidden/GradientSample" -{ - Properties - { - _GTime( "_Time", 2D ) = "white" {} - _GType( "_GType", Int ) = 0 - _GColorNum( "_GColorNum", Int ) = 0 - _GAlphaNum( "_GAlphaNum", Int ) = 0 - _Col0( "_Col0", Vector ) = ( 0, 0, 0, 0 ) - _Col1( "_Col1", Vector ) = ( 0, 0, 0, 0 ) - _Col2( "_Col2", Vector ) = ( 0, 0, 0, 0 ) - _Col3( "_Col3", Vector ) = ( 0, 0, 0, 0 ) - _Col4( "_Col4", Vector ) = ( 0, 0, 0, 0 ) - _Col5( "_Col5", Vector ) = ( 0, 0, 0, 0 ) - _Col6( "_Col6", Vector ) = ( 0, 0, 0, 0 ) - _Col7( "_Col7", Vector ) = ( 0, 0, 0, 0 ) - _Alp0( "_Alp0", Vector ) = ( 0, 0, 0, 0 ) - _Alp1( "_Alp1", Vector ) = ( 0, 0, 0, 0 ) - _Alp2( "_Alp2", Vector ) = ( 0, 0, 0, 0 ) - _Alp3( "_Alp3", Vector ) = ( 0, 0, 0, 0 ) - _Alp4( "_Alp4", Vector ) = ( 0, 0, 0, 0 ) - _Alp5( "_Alp5", Vector ) = ( 0, 0, 0, 0 ) - _Alp6( "_Alp6", Vector ) = ( 0, 0, 0, 0 ) - _Alp7( "_Alp7", Vector ) = ( 0, 0, 0, 0 ) - } - SubShader - { - Pass - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - #include "UnityCG.cginc" - - sampler2D _GTime; - int _GType; - int _GColorNum; - int _GAlphaNum; - float4 _Col0; - float4 _Col1; - float4 _Col2; - float4 _Col3; - float4 _Col4; - float4 _Col5; - float4 _Col6; - float4 _Col7; - float4 _Alp0; - float4 _Alp1; - float4 _Alp2; - float4 _Alp3; - float4 _Alp4; - float4 _Alp5; - float4 _Alp6; - float4 _Alp7; - - struct Gradient - { - int type; - int colorsLength; - int alphasLength; - float4 colors[ 8 ]; - float2 alphas[ 8 ]; - }; - - Gradient NewGradient( int type, int colorsLength, int alphasLength, - float4 colors0, float4 colors1, float4 colors2, float4 colors3, float4 colors4, float4 colors5, float4 colors6, float4 colors7, - float2 alphas0, float2 alphas1, float2 alphas2, float2 alphas3, float2 alphas4, float2 alphas5, float2 alphas6, float2 alphas7 ) - { - Gradient g; - g.type = type; - g.colorsLength = colorsLength; - g.alphasLength = alphasLength; - g.colors[ 0 ] = colors0; - g.colors[ 1 ] = colors1; - g.colors[ 2 ] = colors2; - g.colors[ 3 ] = colors3; - g.colors[ 4 ] = colors4; - g.colors[ 5 ] = colors5; - g.colors[ 6 ] = colors6; - g.colors[ 7 ] = colors7; - g.alphas[ 0 ] = alphas0; - g.alphas[ 1 ] = alphas1; - g.alphas[ 2 ] = alphas2; - g.alphas[ 3 ] = alphas3; - g.alphas[ 4 ] = alphas4; - g.alphas[ 5 ] = alphas5; - g.alphas[ 6 ] = alphas6; - g.alphas[ 7 ] = alphas7; - return g; - } - - float4 SampleGradient( Gradient gradient, float time ) - { - float3 color = gradient.colors[ 0 ].rgb; - UNITY_UNROLL - for( int c = 1; c < 8; c++ ) - { - float colorPos = saturate( ( time - gradient.colors[ c - 1 ].w ) / ( gradient.colors[ c ].w - gradient.colors[ c - 1 ].w ) ) * step( c, (float)gradient.colorsLength - 1 ); - color = lerp( color, gradient.colors[ c ].rgb, lerp( colorPos, step( 0.01, colorPos ), gradient.type ) ); - } - #ifndef UNITY_COLORSPACE_GAMMA - color = GammaToLinearSpace( color ); - #endif - float alpha = gradient.alphas[ 0 ].x; - UNITY_UNROLL - for( int a = 1; a < 8; a++ ) - { - float alphaPos = saturate( ( time - gradient.alphas[ a - 1 ].y ) / ( gradient.alphas[ a ].y - gradient.alphas[ a - 1 ].y ) ) * step( a, (float)gradient.alphasLength - 1 ); - alpha = lerp( alpha, gradient.alphas[ a ].x, lerp( alphaPos, step( 0.01, alphaPos ), gradient.type ) ); - } - return float4( color, alpha ); - } - - float4 frag( v2f_img i ) : SV_Target - { - Gradient gradient = NewGradient( _GType, _GColorNum, _GAlphaNum, _Col0, _Col1, _Col2, _Col3, _Col4, _Col5, _Col6, _Col7, _Alp0.xy, _Alp1.xy, _Alp2.xy, _Alp3.xy, _Alp4.xy, _Alp5.xy, _Alp6.xy, _Alp7.xy ); - float time = tex2D( _GTime, i.uv ).r; - return SampleGradient( gradient, time ); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GradientSample.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GradientSample.shader.meta deleted file mode 100644 index 5082a60c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GradientSample.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 8a09124cd6e4aa54a996e7487ec16b90 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GrayscaleNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GrayscaleNode.shader deleted file mode 100644 index 2f604607..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GrayscaleNode.shader +++ /dev/null @@ -1,62 +0,0 @@ -Shader "Hidden/GrayscaleNode" -{ - Properties - { - _A ("_RGB", 2D) = "white" {} - } - SubShader - { - Pass //Luminance - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag(v2f_img i) : SV_Target - { - float lum = Luminance( tex2D( _A, i.uv ) ); - return float4( lum.xxx, 1); - } - ENDCG - } - - Pass //Natural Classic - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag ( v2f_img i ) : SV_Target - { - float lum = dot ( tex2D ( _A, i.uv ), float3( 0.299,0.587,0.114 ) ); - return float4( lum.xxx, 1 ); - } - ENDCG - } - - Pass //Old School - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag ( v2f_img i ) : SV_Target - { - float3 rgbValue = tex2D ( _A, i.uv ).rgb; - float lum = ( rgbValue.r + rgbValue.g + rgbValue.b ) / 3; - return float4( lum.xxx, 1 ); - } - ENDCG - } - - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GrayscaleNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GrayscaleNode.shader.meta deleted file mode 100644 index 329b7091..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_GrayscaleNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 56781cd022be9124597f0f396a46a35f -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_HSVToRGBNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_HSVToRGBNode.shader deleted file mode 100644 index 3bb972a6..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_HSVToRGBNode.shader +++ /dev/null @@ -1,41 +0,0 @@ -Shader "Hidden/HSVToRGBNode" -{ - Properties - { - _A ( "_Hue", 2D ) = "white" {} - _B ( "_Saturation", 2D ) = "white" {} - _C ( "_Value", 2D ) = "white" {} - } - - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - uniform sampler2D _A; - uniform sampler2D _B; - uniform sampler2D _C; - - float3 HSVToRGB( float3 c ) - { - float4 K = float4( 1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0 ); - float3 p = abs( frac( c.xxx + K.xyz ) * 6.0 - K.www ); - return c.z * lerp( K.xxx, saturate( p - K.xxx ), c.y ); - } - - float4 frag ( v2f_img i ) : SV_Target - { - float h = tex2D ( _A, i.uv ).r; - float s = tex2D ( _B, i.uv ).r; - float v = tex2D ( _C, i.uv ).r; - - return float4( HSVToRGB(float3(h,s,v)), 1 ); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_HSVToRGBNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_HSVToRGBNode.shader.meta deleted file mode 100644 index 952938e0..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_HSVToRGBNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: fab445eb945d63047822a7a6b81b959d -timeCreated: 1515421907 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_HeightMapTextureBlend.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_HeightMapTextureBlend.shader deleted file mode 100644 index f15f92e6..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_HeightMapTextureBlend.shader +++ /dev/null @@ -1,33 +0,0 @@ -Shader "Hidden/HeightMapTextureBlend" -{ - Properties - { - _A ("_A", 2D) = "white" {} - _B ("_B", 2D) = "white" {} - _C ("_C", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - sampler2D _C; - - float4 frag( v2f_img i ) : SV_Target - { - float heightmap = tex2D( _A, i.uv ).x; - float splatMask = tex2D( _B, i.uv ).x; - float blendStrength = tex2D( _C, i.uv ).x; - float result = saturate( pow((( heightmap*splatMask ) * 4 ) + ( splatMask * 2 ), blendStrength )); - return float4( result.x , 0, 0, 1 ); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_HeightMapTextureBlend.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_HeightMapTextureBlend.shader.meta deleted file mode 100644 index 35ffff5c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_HeightMapTextureBlend.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: b2ac23d6d5dcb334982b6f31c2e7a734 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IndirectDiffuseLight.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IndirectDiffuseLight.shader deleted file mode 100644 index 65695576..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IndirectDiffuseLight.shader +++ /dev/null @@ -1,106 +0,0 @@ -Shader "Hidden/IndirectDiffuseLight" -{ - Properties - { - _Intensity ("Intensity", Float) = 1 - } - - SubShader - { - Pass - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - #include "UnityCG.cginc" - #include "Lighting.cginc" - #include "UnityPBSLighting.cginc" - - float _Intensity; - - float4 frag(v2f_img i) : SV_Target - { - float2 xy = 2 * i.uv - 1; - float z = -sqrt(1-saturate(dot(xy,xy))); - float3 worldNormal = normalize(float3(xy, z)); - float3 vertexPos = float3(xy, z); - float3 worldPos = mul(unity_ObjectToWorld, float4(vertexPos,1)).xyz; - float4 back = lerp(float4(0.4117,0.3843,0.3647,1),float4(0.4117,0.5059,0.6470,1),worldPos.y * 0.5 + 0.5); - return float4(GammaToLinearSpace(back.rgb * _Intensity),1); - } - ENDCG - } - - Pass // connected tangent - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - #include "UnityCG.cginc" - #include "Lighting.cginc" - #include "UnityPBSLighting.cginc" - - float _Intensity; - sampler2D _A; - - float4 frag(v2f_img i) : SV_Target - { - float2 xy = 2 * i.uv - 1; - float z = -sqrt(1-saturate(dot(xy,xy))); - float3 vertexPos = float3(xy, z); - float3 normal = normalize(vertexPos); - float3 worldNormal = UnityObjectToWorldNormal(normal); - - float3 tangent = normalize(float3( -z, xy.y*0.01, xy.x )); - float3 worldPos = mul(unity_ObjectToWorld, float4(vertexPos,1)).xyz; - float3 worldTangent = UnityObjectToWorldDir(tangent); - float tangentSign = -1; - float3 worldBinormal = normalize( cross(worldNormal, worldTangent) * tangentSign); - float4 tSpace0 = float4(worldTangent.x, worldBinormal.x, worldNormal.x, worldPos.x); - float4 tSpace1 = float4(worldTangent.y, worldBinormal.y, worldNormal.y, worldPos.y); - float4 tSpace2 = float4(worldTangent.z, worldBinormal.z, worldNormal.z, worldPos.z); - - float2 sphereUVs = i.uv; - - sphereUVs.x = (atan2(vertexPos.x, -vertexPos.z) / (UNITY_PI) + 0.5); - // Needs further checking - //float3 tangentNormal = tex2Dlod(_A, float4(sphereUVs,0,0)).xyz; - float3 tangentNormal = tex2D(_A, sphereUVs).xyz; - - worldNormal = fixed3( dot( tSpace0.xyz, tangentNormal ), dot( tSpace1.xyz, tangentNormal ), dot( tSpace2.xyz, tangentNormal ) ); - - float4 back = lerp(float4(0.4117,0.3843,0.3647,1),float4(0.4117,0.5059,0.6470,1),worldNormal.y * 0.5 + 0.5); - - return float4(GammaToLinearSpace(back.rgb * _Intensity),1); - } - ENDCG - } - - Pass // connected world - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - #include "UnityCG.cginc" - #include "Lighting.cginc" - #include "UnityPBSLighting.cginc" - - float _Intensity; - sampler2D _A; - - float4 frag( v2f_img i ) : SV_Target - { - float2 xy = 2 * i.uv - 1; - float z = -sqrt( 1 - saturate( dot( xy,xy ) ) ); - float3 vertexPos = float3( xy, z ); - float3 normal = normalize( vertexPos ); - float3 worldNormal = tex2D( _A, i.uv ); - - float4 back = lerp( float4( 0.4117,0.3843,0.3647,1 ),float4( 0.4117,0.5059,0.6470,1 ),worldNormal.y * 0.5 + 0.5 ); - - return float4( GammaToLinearSpace( back.rgb * _Intensity ),1 ); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IndirectDiffuseLight.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IndirectDiffuseLight.shader.meta deleted file mode 100644 index 59f74619..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IndirectDiffuseLight.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: b45d57fa606c1ea438fe9a2c08426bc7 -timeCreated: 1512043114 -licenseType: Store -ShaderImporter: - defaultTextures: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IndirectSpecularLight.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IndirectSpecularLight.shader deleted file mode 100644 index 6c48d9e6..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IndirectSpecularLight.shader +++ /dev/null @@ -1,128 +0,0 @@ -Shader "Hidden/IndirectSpecularLight" -{ - Properties - { - _Skybox("_Skybox", CUBE) = "white" {} - _A ("Normal", 2D) = "white" {} - _B ("Smoothness", 2D) = "white" {} - _C ("Occlusion", 2D) = "white" {} - } - - SubShader - { - Pass // not connected - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - #include "UnityCG.cginc" - #include "Lighting.cginc" - #include "UnityPBSLighting.cginc" - - uniform samplerCUBE _Skybox; - sampler2D _A; - sampler2D _B; - sampler2D _C; - - float4 frag(v2f_img i) : SV_Target - { - float2 xy = 2 * i.uv - 1; - float z = -sqrt(1-saturate(dot(xy,xy))); - float3 worldNormal = normalize(float3(xy, z)); - float3 vertexPos = float3(xy, z); - float3 worldViewDir = normalize(float3(0,0,-5) - vertexPos); - - float3 worldRefl = -worldViewDir; - worldRefl = normalize(reflect( worldRefl, worldNormal )); - - float3 sky = texCUBElod( _Skybox, float4(worldRefl, (1-saturate(tex2D(_B,i.uv).r)) * 6) ).rgb; - - return float4(sky * tex2D(_C,i.uv).r, 1); - } - ENDCG - } - - Pass // connected tangent - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - #include "UnityCG.cginc" - #include "Lighting.cginc" - #include "UnityPBSLighting.cginc" - - uniform samplerCUBE _Skybox; - sampler2D _A; - sampler2D _B; - sampler2D _C; - - float4 frag(v2f_img i) : SV_Target - { - float2 xy = 2 * i.uv - 1; - float z = -sqrt(1-saturate(dot(xy,xy))); - float3 vertexPos = float3(xy, z); - float3 normal = normalize(vertexPos); - float3 worldNormal = UnityObjectToWorldNormal(normal); - - float3 tangent = normalize(float3( -z, xy.y*0.01, xy.x )); - float3 worldPos = mul(unity_ObjectToWorld, float4(vertexPos,1)).xyz; - float3 worldViewDir = normalize(float3(0,0,-5) - vertexPos); - - float3 worldTangent = UnityObjectToWorldDir(tangent); - float tangentSign = -1; - float3 worldBinormal = normalize( cross(worldNormal, worldTangent) * tangentSign); - float4 tSpace0 = float4(worldTangent.x, worldBinormal.x, worldNormal.x, worldPos.x); - float4 tSpace1 = float4(worldTangent.y, worldBinormal.y, worldNormal.y, worldPos.y); - float4 tSpace2 = float4(worldTangent.z, worldBinormal.z, worldNormal.z, worldPos.z); - - float3 worldRefl = -worldViewDir; - - float2 sphereUVs = i.uv; - sphereUVs.x = atan2(vertexPos.x, -vertexPos.z) / (UNITY_PI) + 0.5; - - // Needs further checking - //float3 tangentNormal = tex2Dlod(_A, float4(sphereUVs,0,0)).xyz; - float3 tangentNormal = tex2D(_A, sphereUVs).xyz; - - worldRefl = reflect( worldRefl, half3( dot( tSpace0.xyz, tangentNormal ), dot( tSpace1.xyz, tangentNormal ), dot( tSpace2.xyz, tangentNormal ) ) ); - - float3 sky = texCUBElod( _Skybox, float4(worldRefl, (1-saturate(tex2D(_B,i.uv).r)) * 6) ).rgb; - - return float4(sky * tex2D(_C,i.uv).r, 1); - } - ENDCG - } - - Pass // connected world - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - #include "UnityCG.cginc" - #include "Lighting.cginc" - #include "UnityPBSLighting.cginc" - - uniform samplerCUBE _Skybox; - sampler2D _A; - sampler2D _B; - sampler2D _C; - - float4 frag(v2f_img i) : SV_Target - { - float2 xy = 2 * i.uv - 1; - float z = -sqrt(1-saturate(dot(xy,xy))); - float3 vertexPos = float3(xy, z); - float3 normal = normalize(vertexPos); - float3 worldNormal = tex2D( _A, i.uv ); - float3 worldViewDir = normalize(float3(0,0,-5) - vertexPos); - - float3 worldRefl = reflect( -worldViewDir, worldNormal ); - - float3 sky = texCUBElod( _Skybox, float4(worldRefl, (1-saturate(tex2D(_B,i.uv).r)) * 6) ).rgb; - - return float4(sky * tex2D(_C,i.uv).r, 1); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IndirectSpecularLight.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IndirectSpecularLight.shader.meta deleted file mode 100644 index 44a99df2..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IndirectSpecularLight.shader.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: d6e441d0a8608954c97fa347d3735e92 -timeCreated: 1512052132 -licenseType: Store -ShaderImporter: - defaultTextures: - - _Skybox: {fileID: 8900000, guid: ef7513b54a0670140b9b967af7620563, type: 3} - - _A: {instanceID: 0} - - _B: {instanceID: 0} - - _C: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_InstanceIDNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_InstanceIDNode.shader deleted file mode 100644 index 828da9fa..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_InstanceIDNode.shader +++ /dev/null @@ -1,24 +0,0 @@ -Shader "Hidden/InstanceIDNode" -{ - SubShader - { - Pass - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - #include "UnityCG.cginc" - - float4 frag (v2f_img i) : SV_Target - { - uint currInstanceId = 0; - #ifdef UNITY_INSTANCING_ENABLED - currInstanceId = unity_InstanceID; - #endif - - return currInstanceId; - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_InstanceIDNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_InstanceIDNode.shader.meta deleted file mode 100644 index acd68c49..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_InstanceIDNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 03febce56a8cf354b90e7d5180c1dbd7 -timeCreated: 1542641929 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IntNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IntNode.shader deleted file mode 100644 index 5e1b367d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IntNode.shader +++ /dev/null @@ -1,24 +0,0 @@ -Shader "Hidden/IntNode" -{ - Properties { - _InputInt ("_InputInt", Int) = 0 - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - int _InputInt; - - float4 frag( v2f_img i ) : SV_Target - { - return _InputInt; - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IntNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IntNode.shader.meta deleted file mode 100644 index 6854db4a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_IntNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 0f64d695b6ffacc469f2dd31432a232a -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LODFadeNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LODFadeNode.shader deleted file mode 100644 index b855246b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LODFadeNode.shader +++ /dev/null @@ -1,19 +0,0 @@ -Shader "Hidden/LODFadeNode" -{ - SubShader - { - Pass - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - #include "UnityCG.cginc" - - float4 frag( v2f_img i ) : SV_Target - { - return unity_LODFade; - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LODFadeNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LODFadeNode.shader.meta deleted file mode 100644 index 9fee1f6c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LODFadeNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: fcd4d93f57ffc51458d4ade10df2fdb4 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LayeredBlendNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LayeredBlendNode.shader deleted file mode 100644 index bf562c30..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LayeredBlendNode.shader +++ /dev/null @@ -1,90 +0,0 @@ -Shader "Hidden/LayeredBlendNode" -{ - Properties - { - _A ( "_Weights", 2D) = "white" {} - _B ( "_LayerBase", 2D) = "white" {} - _C ( "_Layer1", 2D) = "white" {} - _D ( "_Layer2", 2D ) = "white" {} - _E ( "_Layer3", 2D ) = "white" {} - _F ( "_Layer4", 2D ) = "white" {} - } - SubShader - { - - CGINCLUDE - - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - sampler2D _A; - sampler2D _B; - sampler2D _C; - - ENDCG - - Pass - { - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 Weights = tex2D( _A, i.uv ); - float4 LayerBase = tex2D( _B, i.uv ); - float4 Layer1 = tex2D( _C, i.uv ); - return lerp ( LayerBase, Layer1, Weights.x ); - } - ENDCG - } - - Pass - { - CGPROGRAM - sampler2D _D; - float4 frag ( v2f_img i ) : SV_Target - { - float4 Weights = tex2D ( _A, i.uv ); - float4 LayerBase = tex2D ( _B, i.uv ); - float4 Layer1 = tex2D ( _C, i.uv ); - float4 Layer2 = tex2D ( _D, i.uv ); - return lerp ( lerp ( LayerBase, Layer1, Weights.x ), Layer2, Weights.y ); - } - ENDCG - } - - Pass - { - CGPROGRAM - sampler2D _D; - sampler2D _E; - float4 frag ( v2f_img i ) : SV_Target - { - float4 Weights = tex2D ( _A, i.uv ); - float4 LayerBase = tex2D ( _B, i.uv ); - float4 Layer1 = tex2D ( _C, i.uv ); - float4 Layer2 = tex2D ( _D, i.uv ); - float4 Layer3 = tex2D ( _E, i.uv ); - return lerp ( lerp ( lerp ( LayerBase, Layer1, Weights.x ), Layer2, Weights.y ), Layer3, Weights.z ); - } - ENDCG - } - - Pass - { - CGPROGRAM - sampler2D _D; - sampler2D _E; - sampler2D _F; - float4 frag ( v2f_img i ) : SV_Target - { - float4 Weights = tex2D ( _A, i.uv ); - float4 LayerBase = tex2D ( _B, i.uv ); - float4 Layer1 = tex2D ( _C, i.uv ); - float4 Layer2 = tex2D ( _D, i.uv ); - float4 Layer3 = tex2D ( _E, i.uv ); - float4 Layer4 = tex2D ( _F, i.uv ); - return lerp ( lerp ( lerp ( lerp ( LayerBase, Layer1, Weights.x ), Layer2, Weights.y ), Layer3, Weights.z ), Layer4, Weights.w ); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LayeredBlendNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LayeredBlendNode.shader.meta deleted file mode 100644 index 81f601e3..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LayeredBlendNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 48faca2f6506fc44c97adb1e2b79c37d -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LengthOpNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LengthOpNode.shader deleted file mode 100644 index 213607da..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LengthOpNode.shader +++ /dev/null @@ -1,73 +0,0 @@ -Shader "Hidden/LengthOpNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag (v2f_img i) : SV_Target - { - return length( tex2D (_A, i.uv).x ); - } - ENDCG - } - - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag (v2f_img i) : SV_Target - { - return length( tex2D(_A, i.uv).xy ); - } - ENDCG - } - - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag (v2f_img i) : SV_Target - { - return length( tex2D(_A, i.uv).xyz ); - } - ENDCG - } - - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag (v2f_img i) : SV_Target - { - return length( tex2D(_A, i.uv)); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LengthOpNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LengthOpNode.shader.meta deleted file mode 100644 index 641415af..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LengthOpNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 1c1f6d6512b758942a8b9dd1bea12f34 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LerpOp.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LerpOp.shader deleted file mode 100644 index 3b95b837..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LerpOp.shader +++ /dev/null @@ -1,32 +0,0 @@ -Shader "Hidden/LerpOp" -{ - Properties - { - _A ("_A", 2D) = "white" {} - _B ("_B", 2D) = "white" {} - _C ("_Alpha", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - sampler2D _C; - - float4 frag( v2f_img i ) : SV_Target - { - float4 a = tex2D( _A, i.uv ); - float4 b = tex2D( _B, i.uv ); - float4 alpha = tex2D( _C, i.uv ); - return lerp(a,b,alpha); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LerpOp.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LerpOp.shader.meta deleted file mode 100644 index 07b4fbcc..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LerpOp.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 34d9c4cdcf1fadb49af2de3f90bbc57d -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LightAttenuation.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LightAttenuation.shader deleted file mode 100644 index a3fc3842..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LightAttenuation.shader +++ /dev/null @@ -1,26 +0,0 @@ -Shader "Hidden/LightAttenuation" -{ - SubShader - { - Pass - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - #include "UnityCG.cginc" - #include "Lighting.cginc" - - float4 _EditorWorldLightPos; - - float4 frag(v2f_img i) : SV_Target - { - float2 xy = 2 * i.uv - 1; - float z = -sqrt(1-saturate(dot(xy,xy))); - float3 worldNormal = normalize(float3(xy, z)); - float3 lightDir = normalize( _EditorWorldLightPos.xyz ); - return saturate(dot(worldNormal ,lightDir) * 10 + 0.1); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LightAttenuation.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LightAttenuation.shader.meta deleted file mode 100644 index 7f133af6..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LightAttenuation.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 4b12227498a5c8d46b6c44ea018e5b56 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LightColorNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LightColorNode.shader deleted file mode 100644 index ad3d5ebd..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LightColorNode.shader +++ /dev/null @@ -1,56 +0,0 @@ -Shader "Hidden/LightColorNode" -{ - SubShader - { - Pass - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - #include "UnityCG.cginc" - #include "Lighting.cginc" - - float4 _EditorLightColor; - - float4 frag(v2f_img i) : SV_Target - { - return _EditorLightColor; - } - ENDCG - } - - Pass - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - #include "UnityCG.cginc" - #include "Lighting.cginc" - - float4 _EditorLightColor; - - float4 frag(v2f_img i) : SV_Target - { - return float4(_EditorLightColor.rgb, 0); - } - ENDCG - } - - Pass - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - #include "UnityCG.cginc" - #include "Lighting.cginc" - - float4 _EditorLightColor; - - float4 frag(v2f_img i) : SV_Target - { - return _EditorLightColor.a; - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LightColorNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LightColorNode.shader.meta deleted file mode 100644 index fcd86897..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LightColorNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 43f5d3c033eb5044e9aeb40241358349 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LinearDepthNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LinearDepthNode.shader deleted file mode 100644 index 0bcf7794..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LinearDepthNode.shader +++ /dev/null @@ -1,43 +0,0 @@ -Shader "Hidden/LinearDepthNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag(v2f_img i) : SV_Target - { - float depthValue = tex2D( _A, i.uv ).r; - return LinearEyeDepth( depthValue ); - } - ENDCG - } - - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag(v2f_img i) : SV_Target - { - float depthValue = tex2D( _A, i.uv ).r; - return Linear01Depth( depthValue ); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LinearDepthNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LinearDepthNode.shader.meta deleted file mode 100644 index 754a2f47..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LinearDepthNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 2b0785cc8b854974ab4e45419072705a -timeCreated: 1546440865 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LinearToGammaNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LinearToGammaNode.shader deleted file mode 100644 index b2468804..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LinearToGammaNode.shader +++ /dev/null @@ -1,27 +0,0 @@ -Shader "Hidden/LinearToGammaNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag(v2f_img i) : SV_Target - { - float4 c = tex2D( _A, i.uv ); - c.rgb = LinearToGammaSpace( c.rgb ); - return c; - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LinearToGammaNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LinearToGammaNode.shader.meta deleted file mode 100644 index 2c413a8e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LinearToGammaNode.shader.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 9027c408b928c5c4d8b450712049d541 -timeCreated: 1489078120 -licenseType: Store -ShaderImporter: - defaultTextures: - - _MainTex: {instanceID: 0} - - _BackGround: {fileID: 2800000, guid: 750b1bd7ba8bd28489650de6d0a95cc5, type: 3} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Log10OpNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Log10OpNode.shader deleted file mode 100644 index 6259c6cc..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Log10OpNode.shader +++ /dev/null @@ -1,25 +0,0 @@ -Shader "Hidden/Log10OpNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag(v2f_img i) : SV_Target - { - return log10(tex2D( _A, i.uv )); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Log10OpNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Log10OpNode.shader.meta deleted file mode 100644 index 981dbc50..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Log10OpNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 9e7cfa357dd261f499d0ba8637ff2614 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Log2OpNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Log2OpNode.shader deleted file mode 100644 index 44dabdb9..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Log2OpNode.shader +++ /dev/null @@ -1,25 +0,0 @@ -Shader "Hidden/Log2OpNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag(v2f_img i) : SV_Target - { - return log2(tex2D( _A, i.uv )); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Log2OpNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Log2OpNode.shader.meta deleted file mode 100644 index a8a3888d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Log2OpNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 5975a154432d4c64cacd78d015ed08ba -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LogOpNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LogOpNode.shader deleted file mode 100644 index b95abb03..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LogOpNode.shader +++ /dev/null @@ -1,25 +0,0 @@ -Shader "Hidden/LogOpNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag(v2f_img i) : SV_Target - { - return log(tex2D( _A, i.uv )); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LogOpNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LogOpNode.shader.meta deleted file mode 100644 index 317db1f7..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LogOpNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: a3293e0a73834b24682775f5d8ee1e7c -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LuminanceNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LuminanceNode.shader deleted file mode 100644 index a56bbe32..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LuminanceNode.shader +++ /dev/null @@ -1,26 +0,0 @@ -Shader "Hidden/LuminanceNode" -{ - Properties - { - _A ("_RGB", 2D) = "white" {} - } - SubShader - { - Pass //Luminance - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag(v2f_img i) : SV_Target - { - float lum = Luminance( tex2D( _A, i.uv ) ); - return float4( lum.xxx, 1); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LuminanceNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LuminanceNode.shader.meta deleted file mode 100644 index a3039712..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_LuminanceNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 81e1d8ffeec8a4b4cabb1094bc981048 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NegateNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NegateNode.shader deleted file mode 100644 index 9d94ffbc..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NegateNode.shader +++ /dev/null @@ -1,25 +0,0 @@ -Shader "Hidden/NegateNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag(v2f_img i) : SV_Target - { - return -(tex2D( _A, i.uv )); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NegateNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NegateNode.shader.meta deleted file mode 100644 index 8cff94e0..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NegateNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: b035bc40da1ac7c4eafad4116382ec79 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NodeMasking.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NodeMasking.shader deleted file mode 100644 index b129cccb..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NodeMasking.shader +++ /dev/null @@ -1,55 +0,0 @@ -Shader "Hidden/NodeMasking" -{ - Properties { - _Ports ("_Ports", Vector) = (0,0,0,0) - _MainTex("_MainTex", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _MainTex; - float4 _Ports; - - float4 frag( v2f_img i ) : SV_Target - { - float4 a = tex2D( _MainTex, i.uv ); - return a * _Ports; - } - ENDCG - } - - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _MaskTex; - float _Port; - - float4 frag( v2f_img i ) : SV_Target - { - float4 a = tex2D( _MaskTex, i.uv ); - float4 c = 0; - if ( _Port == 1 ) - c = a.x; - else if ( _Port == 2 ) - c = a.y; - else if ( _Port == 3 ) - c = a.z; - else if ( _Port == 4 ) - c = a.w; - - return c; - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NodeMasking.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NodeMasking.shader.meta deleted file mode 100644 index 4a020c31..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NodeMasking.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 9c34f18ebe2be3e48b201b748c73dec0 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NoiseGeneratorNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NoiseGeneratorNode.shader deleted file mode 100644 index a8b92866..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NoiseGeneratorNode.shader +++ /dev/null @@ -1,267 +0,0 @@ -Shader "Hidden/NoiseGeneratorNode" -{ - Properties - { - _A ("_RGB", 2D) = "white" {} - _B ("_RGB", 2D) = "white" {} - _To01Range ("_To01Range", Float) = 0 - } - - SubShader - { - CGINCLUDE - sampler2D _A; - sampler2D _B; - float _To01Range; - ENDCG - - Pass //Simplex2D - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - - float3 mod2D289 ( float3 x ) { return x - floor ( x * ( 1.0 / 289.0 ) ) * 289.0; } - float2 mod2D289 ( float2 x ) { return x - floor ( x * ( 1.0 / 289.0 ) ) * 289.0; } - float3 permute ( float3 x ) { return mod2D289 ( ( ( x * 34.0 ) + 1.0 ) * x ); } - - float snoise ( float2 v ) - { - const float4 C = float4( 0.211324865405187, 0.366025403784439, -0.577350269189626, 0.024390243902439 ); - float2 i = floor ( v + dot ( v, C.yy ) ); - float2 x0 = v - i + dot ( i, C.xx ); - float2 i1; - i1 = ( x0.x > x0.y ) ? float2( 1.0, 0.0 ) : float2( 0.0, 1.0 ); - float4 x12 = x0.xyxy + C.xxzz; - x12.xy -= i1; - i = mod2D289 ( i ); - float3 p = permute ( permute ( i.y + float3( 0.0, i1.y, 1.0 ) ) + i.x + float3( 0.0, i1.x, 1.0 ) ); - float3 m = max ( 0.5 - float3( dot ( x0, x0 ), dot ( x12.xy, x12.xy ), dot ( x12.zw, x12.zw ) ), 0.0 ); - m = m * m; - m = m * m; - float3 x = 2.0 * frac ( p * C.www ) - 1.0; - float3 h = abs ( x ) - 0.5; - float3 ox = floor ( x + 0.5 ); - float3 a0 = x - ox; - m *= 1.79284291400159 - 0.85373472095314 * ( a0 * a0 + h * h ); - float3 g; - g.x = a0.x * x0.x + h.x * x0.y; - g.yz = a0.yz * x12.xz + h.yz * x12.yw; - return 130.0 * dot ( m, g ); - } - float4 frag(v2f_img i) : SV_Target - { - float2 size = tex2D( _A, i.uv ).rg; - float scale = tex2D (_B, i.uv).r; - float noiseVal = snoise ( size * scale ); - noiseVal = (_To01Range > 0) ? noiseVal * 0.5 + 0.5 : noiseVal; - return float4( noiseVal.xxx, 1); - } - ENDCG - } - - Pass //Simplex3D - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - float3 mod3D289 ( float3 x ) { return x - floor ( x / 289.0 ) * 289.0; } - - float4 mod3D289 ( float4 x ) { return x - floor ( x / 289.0 ) * 289.0; } - - float4 permute ( float4 x ) { return mod3D289 ( ( x * 34.0 + 1.0 ) * x ); } - - float4 taylorInvSqrt ( float4 r ) { return 1.79284291400159 - r * 0.85373472095314; } - - float snoise ( float3 v ) - { - const float2 C = float2( 1.0 / 6.0, 1.0 / 3.0 ); - float3 i = floor ( v + dot ( v, C.yyy ) ); - float3 x0 = v - i + dot ( i, C.xxx ); - float3 g = step ( x0.yzx, x0.xyz ); - float3 l = 1.0 - g; - float3 i1 = min ( g.xyz, l.zxy ); - float3 i2 = max ( g.xyz, l.zxy ); - float3 x1 = x0 - i1 + C.xxx; - float3 x2 = x0 - i2 + C.yyy; - float3 x3 = x0 - 0.5; - i = mod3D289 ( i ); - float4 p = permute ( permute ( permute ( i.z + float4( 0.0, i1.z, i2.z, 1.0 ) ) + i.y + float4( 0.0, i1.y, i2.y, 1.0 ) ) + i.x + float4( 0.0, i1.x, i2.x, 1.0 ) ); - float4 j = p - 49.0 * floor ( p / 49.0 ); // mod(p,7*7) - float4 x_ = floor ( j / 7.0 ); - float4 y_ = floor ( j - 7.0 * x_ ); // mod(j,N) - float4 x = ( x_ * 2.0 + 0.5 ) / 7.0 - 1.0; - float4 y = ( y_ * 2.0 + 0.5 ) / 7.0 - 1.0; - float4 h = 1.0 - abs ( x ) - abs ( y ); - float4 b0 = float4( x.xy, y.xy ); - float4 b1 = float4( x.zw, y.zw ); - float4 s0 = floor ( b0 ) * 2.0 + 1.0; - float4 s1 = floor ( b1 ) * 2.0 + 1.0; - float4 sh = -step ( h, 0.0 ); - float4 a0 = b0.xzyw + s0.xzyw * sh.xxyy; - float4 a1 = b1.xzyw + s1.xzyw * sh.zzww; - float3 g0 = float3( a0.xy, h.x ); - float3 g1 = float3( a0.zw, h.y ); - float3 g2 = float3( a1.xy, h.z ); - float3 g3 = float3( a1.zw, h.w ); - float4 norm = taylorInvSqrt ( float4( dot ( g0, g0 ), dot ( g1, g1 ), dot ( g2, g2 ), dot ( g3, g3 ) ) ); - g0 *= norm.x; - g1 *= norm.y; - g2 *= norm.z; - g3 *= norm.w; - float4 m = max ( 0.6 - float4( dot ( x0, x0 ), dot ( x1, x1 ), dot ( x2, x2 ), dot ( x3, x3 ) ), 0.0 ); - m = m* m; - m = m* m; - float4 px = float4( dot ( x0, g0 ), dot ( x1, g1 ), dot ( x2, g2 ), dot ( x3, g3 ) ); - return 42.0 * dot ( m, px ); - } - - float4 frag ( v2f_img i ) : SV_Target - { - float3 size = tex2D ( _A, i.uv ).rgb; - float scale = tex2D (_B, i.uv).r; - float noiseVal = snoise ( size * scale ); - noiseVal = (_To01Range > 0) ? noiseVal * 0.5 + 0.5 : noiseVal; - return float4( noiseVal.xxx, 1 ); - } - ENDCG - } - - Pass // Gradient - Shader Toy - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - //https://www.shadertoy.com/view/XdXGW8 - float2 GradientNoiseDir (float2 x) - { - const float2 k = float2(0.3183099, 0.3678794); - x = x * k + k.yx; - return -1.0 + 2.0 * frac (16.0 * k * frac (x.x * x.y * (x.x + x.y))); - } - - float GradientNoise (float2 UV, float Scale) - { - float2 p = UV * Scale; - float2 i = floor (p); - float2 f = frac (p); - float2 u = f * f * (3.0 - 2.0 * f); - return lerp (lerp (dot (GradientNoiseDir (i + float2(0.0, 0.0)), f - float2(0.0, 0.0)), - dot (GradientNoiseDir (i + float2(1.0, 0.0)), f - float2(1.0, 0.0)), u.x), - lerp (dot (GradientNoiseDir (i + float2(0.0, 1.0)), f - float2(0.0, 1.0)), - dot (GradientNoiseDir (i + float2(1.0, 1.0)), f - float2(1.0, 1.0)), u.x), u.y); - } - - float4 frag (v2f_img i) : SV_Target - { - float3 size = tex2D (_A, i.uv).rgb; - float scale = tex2D (_B, i.uv).r; - float noiseVal = GradientNoise (size , scale); - noiseVal = (_To01Range > 0) ? noiseVal * 0.5 + 0.5 : noiseVal; - return float4(noiseVal.xxx, 1); - } - ENDCG - } - - Pass // Gradient - Unity - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - float2 UnityGradientNoiseDir (float2 p) - { - p = fmod (p , 289); - float x = fmod ((34 * p.x + 1) * p.x , 289) + p.y; - x = fmod ((34 * x + 1) * x , 289); - x = frac (x / 41) * 2 - 1; - return normalize (float2(x - floor (x + 0.5), abs (x) - 0.5)); - } - - float UnityGradientNoise (float2 UV, float Scale) - { - float2 p = UV * Scale; - float2 ip = floor (p); - float2 fp = frac (p); - float d00 = dot (UnityGradientNoiseDir (ip), fp); - float d01 = dot (UnityGradientNoiseDir (ip + float2(0, 1)), fp - float2(0, 1)); - float d10 = dot (UnityGradientNoiseDir (ip + float2(1, 0)), fp - float2(1, 0)); - float d11 = dot (UnityGradientNoiseDir (ip + float2(1, 1)), fp - float2(1, 1)); - fp = fp * fp * fp * (fp * (fp * 6 - 15) + 10); - return lerp (lerp (d00, d01, fp.y), lerp (d10, d11, fp.y), fp.x) + 0.5; - } - - float4 frag (v2f_img i) : SV_Target - { - float3 size = tex2D (_A, i.uv).rgb; - float scale = tex2D (_B, i.uv).r; - float noiseVal = UnityGradientNoise(size , scale); - noiseVal = (_To01Range > 0) ? noiseVal * 0.5 + 0.5 : noiseVal; - return float4(noiseVal.xxx, 1); - } - ENDCG - } - - Pass // Simple - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - inline float noise_randomValue (float2 uv) { return frac(sin(dot(uv, float2(12.9898, 78.233)))*43758.5453); } - inline float noise_interpolate (float a, float b, float t) { return (1.0-t)*a + (t*b); } - inline float valueNoise (float2 uv) - { - float2 i = floor(uv); - float2 f = frac( uv ); - f = f* f * (3.0 - 2.0 * f); - uv = abs( frac(uv) - 0.5); - float2 c0 = i + float2( 0.0, 0.0 ); - float2 c1 = i + float2( 1.0, 0.0 ); - float2 c2 = i + float2( 0.0, 1.0 ); - float2 c3 = i + float2( 1.0, 1.0 ); - float r0 = noise_randomValue( c0 ); - float r1 = noise_randomValue( c1 ); - float r2 = noise_randomValue( c2 ); - float r3 = noise_randomValue( c3 ); - float bottomOfGrid = noise_interpolate( r0, r1, f.x ); - float topOfGrid = noise_interpolate( r2, r3, f.x ); - float t = noise_interpolate( bottomOfGrid, topOfGrid, f.y ); - return t; - } - - float SimpleNoise(float2 UV) - { - float t = 0.0; - float freq = pow( 2.0, float( 0 ) ); - float amp = pow( 0.5, float( 3 - 0 ) ); - t += valueNoise( UV/freq )*amp; - freq = pow(2.0, float(1)); - amp = pow(0.5, float(3-1)); - t += valueNoise( UV/freq )*amp; - freq = pow(2.0, float(2)); - amp = pow(0.5, float(3-2)); - t += valueNoise( UV/freq )*amp; - return t; - } - - float4 frag (v2f_img i) : SV_Target - { - float3 size = tex2D (_A, i.uv).rgb; - float scale = tex2D (_B, i.uv).r; - float noiseVal = SimpleNoise(size * scale); - noiseVal = (_To01Range == 0) ? noiseVal * 2 - 1 : noiseVal; - return float4(noiseVal.xxx, 1); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NoiseGeneratorNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NoiseGeneratorNode.shader.meta deleted file mode 100644 index d92bbfc3..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NoiseGeneratorNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: cd2d37ef5da190b42a91a5a690ba2a7d -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NormalVertexDataNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NormalVertexDataNode.shader deleted file mode 100644 index 8fce5f63..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NormalVertexDataNode.shader +++ /dev/null @@ -1,22 +0,0 @@ -Shader "Hidden/NormalVertexDataNode" -{ - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - float4 frag(v2f_img i) : SV_Target - { - float2 xy = 2 * i.uv - 1; - float z = -sqrt(1-saturate(dot(xy,xy))); - float3 normal = normalize(float3(xy, z)); - return float4(normal, 1); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NormalVertexDataNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NormalVertexDataNode.shader.meta deleted file mode 100644 index 9ec1526f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NormalVertexDataNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 6b24b06c33f9fe84c8a2393f13ab5406 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NormalizeNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NormalizeNode.shader deleted file mode 100644 index fdcc64f1..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NormalizeNode.shader +++ /dev/null @@ -1,25 +0,0 @@ -Shader "Hidden/NormalizeNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag(v2f_img i) : SV_Target - { - return normalize(tex2D( _A, i.uv )); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NormalizeNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NormalizeNode.shader.meta deleted file mode 100644 index 98ea8d36..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_NormalizeNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: a51b11dfb6b32884e930595e5f9defa8 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjSpaceLightDirHlpNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjSpaceLightDirHlpNode.shader deleted file mode 100644 index 4aa3e889..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjSpaceLightDirHlpNode.shader +++ /dev/null @@ -1,22 +0,0 @@ -Shader "Hidden/ObjSpaceLightDirHlpNode" -{ - SubShader - { - Pass - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - #include "UnityCG.cginc" - - float4 _EditorWorldLightPos; - - float4 frag( v2f_img i ) : SV_Target - { - float3 lightDir = mul(unity_WorldToObject, normalize( _EditorWorldLightPos.xyz ) ); - return float4 ( lightDir, 1); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjSpaceLightDirHlpNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjSpaceLightDirHlpNode.shader.meta deleted file mode 100644 index a1d64ecc..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjSpaceLightDirHlpNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: c7852de24cec4a744b5358921e23feee -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjSpaceViewDirHlpNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjSpaceViewDirHlpNode.shader deleted file mode 100644 index 3535052d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjSpaceViewDirHlpNode.shader +++ /dev/null @@ -1,25 +0,0 @@ -Shader "Hidden/ObjSpaceViewDirHlpNode" -{ -Properties - { - _A ("_A", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - #include "UnityCG.cginc" - - sampler2D _A; - - float4 frag( v2f_img i ) : SV_Target - { - return float4(ObjSpaceViewDir(tex2D( _A, i.uv )),0); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjSpaceViewDirHlpNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjSpaceViewDirHlpNode.shader.meta deleted file mode 100644 index 4c8fc971..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjSpaceViewDirHlpNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: b6b985e165d0dd44c96a05b46e267e64 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectScaleNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectScaleNode.shader deleted file mode 100644 index 445c6274..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectScaleNode.shader +++ /dev/null @@ -1,36 +0,0 @@ -Shader "Hidden/ObjectScaleNode" -{ - SubShader - { - - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - float4 frag(v2f_img i) : SV_Target - { - float3 objectScale = float3( length( unity_ObjectToWorld[ 0 ].xyz ), length( unity_ObjectToWorld[ 1 ].xyz ), length( unity_ObjectToWorld[ 2 ].xyz ) ); - return float4(objectScale, 1); - } - ENDCG - } - - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - float4 frag (v2f_img i) : SV_Target - { - float3 objectScale = 1.0 / float3(length (unity_WorldToObject[0].xyz), length (unity_WorldToObject[1].xyz), length (unity_WorldToObject[2].xyz)); - return float4(objectScale, 1); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectScaleNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectScaleNode.shader.meta deleted file mode 100644 index 3c410d62..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectScaleNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 5540033c6c52f51468938c1a42bd2730 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectToClipPos.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectToClipPos.shader deleted file mode 100644 index b85a4103..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectToClipPos.shader +++ /dev/null @@ -1,28 +0,0 @@ -Shader "Hidden/ObjectToClipPos" -{ - Properties - { - _A ("_A", 2D) = "white" {} - } - - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag( v2f_img i ) : SV_Target - { - float3 pos = tex2D( _A, i.uv ).xyz; - return UnityObjectToClipPos(pos); - } - ENDCG - } - - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectToClipPos.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectToClipPos.shader.meta deleted file mode 100644 index 929708b9..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectToClipPos.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 14ec765a147a53340877b489e73f1c9f -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectToViewPos.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectToViewPos.shader deleted file mode 100644 index 6acf81a9..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectToViewPos.shader +++ /dev/null @@ -1,29 +0,0 @@ -Shader "Hidden/ObjectToViewPos" -{ - Properties - { - _A ("_A", 2D) = "white" {} - } - - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag( v2f_img i ) : SV_Target - { - float3 pos = tex2D( _A, i.uv ).xyz; - float3 result = UnityObjectToViewPos(pos); - return float4(result, 1.0); - } - ENDCG - } - - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectToViewPos.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectToViewPos.shader.meta deleted file mode 100644 index 94537742..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectToViewPos.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: b790bc1d468a51840a9facef372b4729 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectToWorldTransfNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectToWorldTransfNode.shader deleted file mode 100644 index 57050b8b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectToWorldTransfNode.shader +++ /dev/null @@ -1,25 +0,0 @@ -Shader "Hidden/ObjectToWorldTransfNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag(v2f_img i) : SV_Target - { - return mul(unity_ObjectToWorld, tex2D( _A, i.uv )); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectToWorldTransfNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectToWorldTransfNode.shader.meta deleted file mode 100644 index 9aa0dd96..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ObjectToWorldTransfNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: a4044ee165813654486d0cecd0de478c -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_OneMinusNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_OneMinusNode.shader deleted file mode 100644 index 6c290ee1..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_OneMinusNode.shader +++ /dev/null @@ -1,25 +0,0 @@ -Shader "Hidden/OneMinusNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag(v2f_img i) : SV_Target - { - return 1-tex2D(_A, i.uv); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_OneMinusNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_OneMinusNode.shader.meta deleted file mode 100644 index 84d6766d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_OneMinusNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: bed5300b92e7bb0419d0f4accb853312 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_OrthoParams.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_OrthoParams.shader deleted file mode 100644 index 119867b4..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_OrthoParams.shader +++ /dev/null @@ -1,19 +0,0 @@ -Shader "Hidden/OrthoParams" -{ - SubShader - { - Pass - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - #include "UnityCG.cginc" - - float4 frag( v2f_img i ) : SV_Target - { - return unity_OrthoParams; - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_OrthoParams.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_OrthoParams.shader.meta deleted file mode 100644 index b619a3a8..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_OrthoParams.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 88a910ece3dce224793e669bb1bc158d -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PannerNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PannerNode.shader deleted file mode 100644 index be63723a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PannerNode.shader +++ /dev/null @@ -1,40 +0,0 @@ -Shader "Hidden/PannerNode" -{ - Properties - { - _A ("_UVs", 2D) = "white" {} - _B ("_PanTime", 2D) = "white" {} - _C ("_PanSpeed", 2D ) = "white" {} - } - SubShader - { - Pass - { - Name "Panner" // 14 - UV panner node - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - #include "UnityCG.cginc" - - sampler2D _A; - sampler2D _B; - sampler2D _C; - - float _UsingEditor; - float _EditorTime; - - float4 frag(v2f_img i) : SV_Target - { - float multiplier = tex2D ( _B, i.uv ).r; - float time = _EditorTime*multiplier; - if ( _UsingEditor == 0 ) - { - time = multiplier; - } - float2 speed = tex2D ( _C, i.uv ).rg; - return tex2D( _A, i.uv) + time * float4( speed, 0, 0 ); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PannerNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PannerNode.shader.meta deleted file mode 100644 index d3b5057f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PannerNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 6f89a5d96bdad114b9bbd0c236cac622 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ParallaxMappingNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ParallaxMappingNode.shader deleted file mode 100644 index 5ea1a1bb..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ParallaxMappingNode.shader +++ /dev/null @@ -1,44 +0,0 @@ -Shader "Hidden/ParallaxMappingNode" -{ - Properties - { - _A ("_UV", 2D) = "white" {} - _B ("_Height", 2D) = "white" {} - _C ("_Scale", 2D) = "white" {} - _D ("_ViewDirTan", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - sampler2D _C; - sampler2D _D; - float _ParallaxType; - - float4 frag(v2f_img i) : SV_Target - { - float2 uv = tex2D( _A, i.uv ).rg; - float h = tex2D( _B, i.uv ).r; - float s = tex2D( _C, i.uv ).r; - float3 vt = tex2D( _D, i.uv ).xyz; - float2 parallaxed = uv; - if ( _ParallaxType == 1 ) { - parallaxed = ( ( h - 1 )*( vt.xy / vt.z ) * s ) + uv; - } - else { - parallaxed = ( ( h - 1 )*( vt.xy ) * s ) + uv; - } - - return float4(parallaxed, 0 , 0); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ParallaxMappingNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ParallaxMappingNode.shader.meta deleted file mode 100644 index 35dfe966..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ParallaxMappingNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 589f12f68e00ac74286815aa56053fcc -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ParallaxOffset.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ParallaxOffset.shader deleted file mode 100644 index 0db961ad..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ParallaxOffset.shader +++ /dev/null @@ -1,35 +0,0 @@ -Shader "Hidden/ParallaxOffset" -{ - Properties - { - _A ("_A", 2D) = "white" {} - _B ("_B", 2D) = "white" {} - _C ("_C", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - sampler2D _C; - - float4 frag( v2f_img i ) : SV_Target - { - float h = tex2D( _A, i.uv ).x; - float height = tex2D( _B, i.uv ).x; - float3 viewDir = tex2D( _C, i.uv ).xyz; - float2 result = ParallaxOffset (h, height, viewDir); - return float4(result, 0, 1); - - } - ENDCG - } - - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ParallaxOffset.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ParallaxOffset.shader.meta deleted file mode 100644 index 5c74486d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ParallaxOffset.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 6085f804c6fbf354eac039c11feaa7cc -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PiNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PiNode.shader deleted file mode 100644 index 000e8c04..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PiNode.shader +++ /dev/null @@ -1,21 +0,0 @@ -Shader "Hidden/PiNode" -{ - SubShader - { - Pass - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - #include "UnityCG.cginc" - - sampler2D _A; - - float4 frag(v2f_img i) : SV_Target - { - return tex2D( _A, i.uv ).r * UNITY_PI; - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PiNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PiNode.shader.meta deleted file mode 100644 index a3cac8ce..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PiNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: bf4a65726dab3d445a69fb1d0945c33e -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PosVertexDataNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PosVertexDataNode.shader deleted file mode 100644 index 15f3ad94..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PosVertexDataNode.shader +++ /dev/null @@ -1,22 +0,0 @@ -Shader "Hidden/PosVertexDataNode" -{ - SubShader - { - Pass - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - #include "UnityCG.cginc" - - float4 frag(v2f_img i) : SV_Target - { - float2 xy = 2 * i.uv - 1; - float z = -sqrt(1-saturate(dot(xy,xy))); - float3 vertexPos = float3(xy, z); - return float4(vertexPos, 1); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PosVertexDataNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PosVertexDataNode.shader.meta deleted file mode 100644 index b86aa1a6..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PosVertexDataNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: a5c14f759dd021b4b8d4b6eeb85ac227 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PosterizeNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PosterizeNode.shader deleted file mode 100644 index 099d105c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PosterizeNode.shader +++ /dev/null @@ -1,35 +0,0 @@ -Shader "Hidden/PosterizeNode" -{ - Properties - { - _A ( "_RGBA", 2D ) = "white" {} - _B ( "_Power", 2D ) = "white" {} - } - - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - uniform sampler2D _A; - uniform sampler2D _B; - - float4 frag ( v2f_img i ) : SV_Target - { - float4 rgba = tex2D ( _B, i.uv ); - float power = tex2D ( _A, i.uv ).r; - if ( power < 1 ) - return float4(0,0,0,0); - float divideOp = 256.0 / float ( (int)power ); - float4 finalColor = ( floor ( rgba * divideOp ) / divideOp ); - - return finalColor; - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PosterizeNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PosterizeNode.shader.meta deleted file mode 100644 index e652f83e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PosterizeNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: ecb3048ef0eec1645bad1d72a98d8279 -timeCreated: 1515421907 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PowerNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PowerNode.shader deleted file mode 100644 index 721fe1d1..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PowerNode.shader +++ /dev/null @@ -1,29 +0,0 @@ -Shader "Hidden/PowerNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - _B ("_B", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - - float4 frag( v2f_img i ) : SV_Target - { - float4 a = tex2D( _A, i.uv ); - float4 b = tex2D( _B, i.uv ); - return pow(a, b); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PowerNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PowerNode.shader.meta deleted file mode 100644 index 205e0379..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PowerNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 758cc2f8b537b4e4b93d9833075d138c -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PrimitiveIDVariableNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PrimitiveIDVariableNode.shader deleted file mode 100644 index 30dc0ca9..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PrimitiveIDVariableNode.shader +++ /dev/null @@ -1,19 +0,0 @@ -Shader "Hidden/PrimitiveIDVariableNode" -{ - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - float4 frag( v2f_img i, uint ase_primitiveId : SV_PrimitiveID ) : SV_Target - { - return ase_primitiveId; - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PrimitiveIDVariableNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PrimitiveIDVariableNode.shader.meta deleted file mode 100644 index f2438c30..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_PrimitiveIDVariableNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 92c1b588d7658594cb219696f593f64b -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ProjectionParams.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ProjectionParams.shader deleted file mode 100644 index 835f8865..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ProjectionParams.shader +++ /dev/null @@ -1,19 +0,0 @@ -Shader "Hidden/ProjectionParams" -{ - SubShader - { - Pass - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - #include "UnityCG.cginc" - - float4 frag( v2f_img i ) : SV_Target - { - return _ProjectionParams; - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ProjectionParams.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ProjectionParams.shader.meta deleted file mode 100644 index acd54338..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ProjectionParams.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 97ae846cb0a6b044388fad3bc03bb4c2 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RGBToHSVNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RGBToHSVNode.shader deleted file mode 100644 index 510fb753..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RGBToHSVNode.shader +++ /dev/null @@ -1,37 +0,0 @@ -Shader "Hidden/RGBToHSVNode" -{ - Properties - { - _A ( "_RGB", 2D ) = "white" {} - } - - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - uniform sampler2D _A; - - float3 RGBToHSV(float3 c) - { - float4 K = float4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0); - float4 p = lerp( float4( c.bg, K.wz ), float4( c.gb, K.xy ), step( c.b, c.g ) ); - float4 q = lerp( float4( p.xyw, c.r ), float4( c.r, p.yzx ), step( p.x, c.r ) ); - float d = q.x - min( q.w, q.y ); - float e = 1.0e-10; - return float3( abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x); - } - - float4 frag ( v2f_img i ) : SV_Target - { - float3 rgb = tex2D ( _A, i.uv ).rgb; - return float4( RGBToHSV(rgb), 1 ); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RGBToHSVNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RGBToHSVNode.shader.meta deleted file mode 100644 index 87cdb899..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RGBToHSVNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 0f2f09b49bf4954428aafa2dfe1a9a09 -timeCreated: 1515423140 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RadiansOpNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RadiansOpNode.shader deleted file mode 100644 index 48c8343d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RadiansOpNode.shader +++ /dev/null @@ -1,25 +0,0 @@ -Shader "Hidden/RadiansOpNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag(v2f_img i) : SV_Target - { - return radians(tex2D( _A, i.uv )); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RadiansOpNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RadiansOpNode.shader.meta deleted file mode 100644 index aa740942..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RadiansOpNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: d27d189eaf6eeb04fae9913d9617ece5 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RangedFloatNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RangedFloatNode.shader deleted file mode 100644 index 62a378ed..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RangedFloatNode.shader +++ /dev/null @@ -1,24 +0,0 @@ -Shader "Hidden/RangedFloatNode" -{ - Properties { - _InputFloat ("_InputFloat", Float) = 0 - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - float _InputFloat; - - float4 frag( v2f_img i ) : SV_Target - { - return _InputFloat; - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RangedFloatNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RangedFloatNode.shader.meta deleted file mode 100644 index 35db24d8..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RangedFloatNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: d9ca47581ac157145bff6f72ac5dd73e -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ReflectOpNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ReflectOpNode.shader deleted file mode 100644 index c9f2a559..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ReflectOpNode.shader +++ /dev/null @@ -1,29 +0,0 @@ -Shader "Hidden/ReflectOpNode" -{ - Properties - { - _A ("_Incident", 2D) = "white" {} - _B ("_Normal", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D( _A, i.uv ); - float4 b = tex2D( _B, i.uv ); - return reflect(a, b); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ReflectOpNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ReflectOpNode.shader.meta deleted file mode 100644 index 48ebfd45..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ReflectOpNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: fb520f2145c0fa0409320a9e6d720758 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RefractOpVec.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RefractOpVec.shader deleted file mode 100644 index 0aee3cf1..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RefractOpVec.shader +++ /dev/null @@ -1,32 +0,0 @@ -Shader "Hidden/RefractOpVec" -{ - Properties - { - _A ("_Incident", 2D) = "white" {} - _B ("_Normal", 2D) = "white" {} - _C ("_Eta", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - sampler2D _C; - - float4 frag(v2f_img i) : SV_Target - { - float4 inc = tex2D( _A, i.uv ); - float4 nor = tex2D( _B, i.uv ); - float4 eta = tex2D( _C, i.uv ); - return refract( inc, nor, eta ); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RefractOpVec.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RefractOpVec.shader.meta deleted file mode 100644 index 47b5f3d3..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RefractOpVec.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 5ab44ca484bed8b4884b03b1c00fdc3d -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RegisterLocalVarNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RegisterLocalVarNode.shader deleted file mode 100644 index 8538155e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RegisterLocalVarNode.shader +++ /dev/null @@ -1,25 +0,0 @@ -Shader "Hidden/RegisterLocalVarNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag(v2f_img i) : SV_Target - { - return tex2D( _A, i.uv ); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RegisterLocalVarNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RegisterLocalVarNode.shader.meta deleted file mode 100644 index af9e1bed..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RegisterLocalVarNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 5aaa1d3ea9e1fa64781647e035a82334 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RelayNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RelayNode.shader deleted file mode 100644 index 598f22bd..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RelayNode.shader +++ /dev/null @@ -1,25 +0,0 @@ -Shader "Hidden/RelayNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag(v2f_img i) : SV_Target - { - return tex2D( _A, i.uv ); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RelayNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RelayNode.shader.meta deleted file mode 100644 index 29421efd..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RelayNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 74e4d859fbdb2c0468de3612145f4929 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RotatorNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RotatorNode.shader deleted file mode 100644 index 59c2d434..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RotatorNode.shader +++ /dev/null @@ -1,43 +0,0 @@ -Shader "Hidden/RotatorNode" -{ - Properties - { - _A ("_UVs", 2D) = "white" {} - _B ("_Anchor", 2D) = "white" {} - _C ("_RotTimeTex", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - #include "UnityCG.cginc" - - sampler2D _A; - sampler2D _B; - sampler2D _C; - float _UsingEditor; - float _EditorTime; - - float4 frag(v2f_img i) : SV_Target - { - float multiplier = tex2D ( _C, i.uv ).r; - float time = _EditorTime*multiplier; - - if ( _UsingEditor == 0 ) - { - time = multiplier; - } - - float cosT = cos( time ); - float sinT = sin( time ); - - float2 a = tex2D( _B, i.uv ).rg; - return float4( mul( tex2D( _A, i.uv ).xy - a, float2x2( cosT, -sinT, sinT, cosT ) ) + a, 0, 1 ); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RotatorNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RotatorNode.shader.meta deleted file mode 100644 index c9a283ee..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RotatorNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: e21408a1c7f12f14bbc2652f69bce1fc -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RoundOpNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RoundOpNode.shader deleted file mode 100644 index 85226ad2..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RoundOpNode.shader +++ /dev/null @@ -1,25 +0,0 @@ -Shader "Hidden/RoundOpNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag(v2f_img i) : SV_Target - { - return round(tex2D( _A, i.uv )); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RoundOpNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RoundOpNode.shader.meta deleted file mode 100644 index 21a0a034..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RoundOpNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 554d561417b207c4bb3cd4a0c86b6907 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RsqrtOpNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RsqrtOpNode.shader deleted file mode 100644 index b15f1ebc..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RsqrtOpNode.shader +++ /dev/null @@ -1,25 +0,0 @@ -Shader "Hidden/RSqrtOpNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag(v2f_img i) : SV_Target - { - return rsqrt(tex2D( _A, i.uv )); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RsqrtOpNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RsqrtOpNode.shader.meta deleted file mode 100644 index 077ff4f7..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_RsqrtOpNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: c58c17cb1f7f6e6429a2c7a6cdaef87d -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SamplerNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SamplerNode.shader deleted file mode 100644 index ca573ce4..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SamplerNode.shader +++ /dev/null @@ -1,141 +0,0 @@ -Shader "Hidden/SamplerNode" -{ - Properties - { - _B ("_UVs", 2D) = "white" {} - _C ("_Level", 2D) = "white" {} - _F ("_NormalScale", 2D) = "white" {} - _CustomUVs ("_CustomUVs", Int) = 0 - _Unpack ("_Unpack", Int) = 0 - _LodType ("_LodType", Int) = 0 - - _Sampler ("_Sampler", 2D) = "white" {} - _Sampler3D ("_Sampler3D", 3D) = "white" {} - _Array ("_Array", 2DArray) = "white" {} - _Cube( "_Cube", CUBE) = "white" {} - _Default ("_Default", Int) = 0 - _Type ("_Type", Int) = 0 - } - SubShader - { - Pass - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - #pragma exclude_renderers d3d9 - #pragma target 3.5 - #include "UnityCG.cginc" - #include "UnityStandardUtils.cginc" - - sampler2D _F; - int _CustomUVs; - int _Unpack; - int _Default; - - float4 frag( v2f_img i ) : SV_Target - { - if( _Default == 1 ) - { - return 1; - } - else if( _Default == 2 ) - { - return 0; - } - else if( _Default == 3 ) - { - return 0.5f; - } - else if( _Default == 4 ) - { - float4 h = float4(0.5,0.5,1,1); - if ( _Unpack == 1 ) - { - h.rgb = UnpackScaleNormal( h.xxyy, tex2D( _F, i.uv ).r ); - } - return h; - } - return 1; - } - ENDCG - } - - Pass - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - #pragma exclude_renderers d3d9 - #pragma target 3.5 - #include "UnityCG.cginc" - #include "UnityStandardUtils.cginc" - - sampler2D _B; - sampler2D _C; - sampler2D _F; - int _CustomUVs; - int _Unpack; - int _LodType; - - UNITY_DECLARE_TEX2DARRAY (_Array); - samplerCUBE _Cube; - sampler2D _Sampler; - sampler3D _Sampler3D; - int _Type; - - float4 frag (v2f_img i) : SV_Target - { - if (_Type == 4) - { - return UNITY_SAMPLE_TEX2DARRAY (_Array, float3(i.uv, 0)); - } - else if (_Type == 3) - { - float3 uvs = float3(i.uv,0); - - if (_CustomUVs == 1) - uvs = tex2D (_B, i.uv).xyz; - - return texCUBE (_Cube, uvs); - } - else if (_Type == 2) - { - return tex3D (_Sampler3D, float3(i.uv,0)); - } - else - { - float2 uvs = i.uv; - float4 c = 0; - - if (_CustomUVs == 1) - uvs = tex2D (_B, i.uv).xy; - - if (_LodType == 1) - { - float lod = tex2D (_C, i.uv).r; - c = tex2Dlod (_Sampler, float4(uvs,0,lod)); - } - else if (_LodType == 2) - { - float bias = tex2D (_C, i.uv).r; - c = tex2Dbias (_Sampler, float4(uvs,0,bias)); - } - else - { - c = tex2D (_Sampler, uvs); - } - - if (_Unpack == 1) - { - float nscale = tex2D (_F, i.uv).r; - c.rgb = UnpackScaleNormal (c, nscale); - } - - return c; - } - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SamplerNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SamplerNode.shader.meta deleted file mode 100644 index c212b3bd..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SamplerNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 7b4e86a89b70ae64993bf422eb406422 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SaturateNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SaturateNode.shader deleted file mode 100644 index 53af8e0a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SaturateNode.shader +++ /dev/null @@ -1,25 +0,0 @@ -Shader "Hidden/SaturateNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag(v2f_img i) : SV_Target - { - return saturate(tex2D( _A, i.uv )); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SaturateNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SaturateNode.shader.meta deleted file mode 100644 index 9dc04ea1..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SaturateNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: d9e53418dc8b9d34fb395e3ea3c75985 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScaleAndOffsetNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScaleAndOffsetNode.shader deleted file mode 100644 index fadf9919..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScaleAndOffsetNode.shader +++ /dev/null @@ -1,33 +0,0 @@ -Shader "Hidden/ScaleAndOffsetNode" -{ - Properties - { - _A ("_Value", 2D) = "white" {} - _B ("_Scale", 2D) = "white" {} - _C ("_Offset", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - sampler2D _C; - - float4 frag(v2f_img i) : SV_Target - { - float4 v = tex2D( _A, i.uv ); - float4 s = tex2D( _B, i.uv ); - float4 o = tex2D( _C, i.uv ); - - return v * s + o; - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScaleAndOffsetNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScaleAndOffsetNode.shader.meta deleted file mode 100644 index 6bb63824..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScaleAndOffsetNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: a1f1053d4d9c3be439e0382038b74771 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScaleNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScaleNode.shader deleted file mode 100644 index 4a8f15cb..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScaleNode.shader +++ /dev/null @@ -1,27 +0,0 @@ -Shader "Hidden/ScaleNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - float _ScaleFloat; - - float4 frag( v2f_img i ) : SV_Target - { - float4 a = tex2D( _A, i.uv ); - return a * _ScaleFloat; - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScaleNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScaleNode.shader.meta deleted file mode 100644 index 1f8ba8e7..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScaleNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 6d8ec9d9dab62c44aa2dcc0e3987760d -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScreenParams.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScreenParams.shader deleted file mode 100644 index 65e42baf..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScreenParams.shader +++ /dev/null @@ -1,19 +0,0 @@ -Shader "Hidden/ScreenParams" -{ - SubShader - { - Pass - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - #include "UnityCG.cginc" - - float4 frag( v2f_img i ) : SV_Target - { - return _ScreenParams; - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScreenParams.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScreenParams.shader.meta deleted file mode 100644 index 697cc330..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScreenParams.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 78173633b803de4419206191fed3d61e -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScreenPosInputsNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScreenPosInputsNode.shader deleted file mode 100644 index 4c0338c4..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScreenPosInputsNode.shader +++ /dev/null @@ -1,62 +0,0 @@ -Shader "Hidden/ScreenPosInputsNode" -{ - SubShader - { - CGINCLUDE - #include "UnityCG.cginc" - inline float4 PrevComputeNonStereoScreenPos (float4 pos) { - float4 o = pos * 0.5f; - o.xy = float2(o.x, o.y*_ProjectionParams.x) + o.w; - o.zw = pos.zw; - return o; - } - - inline float4 CalculateScreenPos (float2 uv) - { - float2 xy = 2 * uv - 1; - float z = -sqrt (1 - saturate (dot (xy,xy))); - float3 vertexPos = float3(xy, z); - float4x4 P = float4x4(1,0,0,0,0,-1,0,0,0,0,1,0,0,0,0,1); //UNITY_MATRIX_P - float4x4 V = UNITY_MATRIX_V;//float4x4(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1); //UNITY_MATRIX_V - float4x4 M = unity_ObjectToWorld;//float4x4(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1); //unity_ObjectToWorld - float4x4 VPmatrix = mul (P, V); - float4 clipPos = mul (VPmatrix, mul (M, float4(vertexPos, 1.0))); //same as object to clip pos - float4 screenPos = ComputeScreenPos (clipPos); - return screenPos; - } - ENDCG - - //Normalized - Pass - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - - - float4 frag( v2f_img i ) : SV_Target - { - return CalculateScreenPos(i.uv); - } - ENDCG - } - - //Screen - Pass - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - - uniform float4 _ASEPreviewSize; - - float4 frag (v2f_img i) : SV_Target - { - float4 screenPos = CalculateScreenPos (i.uv); - screenPos.xy *= _ASEPreviewSize.xy; - return screenPos; - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScreenPosInputsNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScreenPosInputsNode.shader.meta deleted file mode 100644 index f6c791da..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ScreenPosInputsNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: a5e7295278a404175b732f1516fb68a6 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ShadeVertexLights.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ShadeVertexLights.shader deleted file mode 100644 index 23dc3b3f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ShadeVertexLights.shader +++ /dev/null @@ -1,34 +0,0 @@ -Shader "Hidden/ShadeVertexLights" -{ - Properties - { - _A ("_A", 2D) = "white" {} - _B ("_B", 2D) = "white" {} - _LightCount( "_LightCount", Int ) = 4 - _IsSpotlight ("_IsSpotlight", Int) = 0 - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - int _LightCount; - int _IsSpotlight; - - float4 frag( v2f_img i ) : SV_Target - { - float4 vertexPosition = tex2D( _A, i.uv ); - float3 vertexNormal = tex2D( _B, i.uv ).xyz; - float3 result = ShadeVertexLightsFull (vertexPosition, vertexNormal, _LightCount, (_IsSpotlight > 0)); - return float4(result, 1); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ShadeVertexLights.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ShadeVertexLights.shader.meta deleted file mode 100644 index 73b03f3b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ShadeVertexLights.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 3b6075034a85ad047be2d31dd213fb4f -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SignOpNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SignOpNode.shader deleted file mode 100644 index 45da74aa..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SignOpNode.shader +++ /dev/null @@ -1,25 +0,0 @@ -Shader "Hidden/SignOpNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag(v2f_img i) : SV_Target - { - return sign(tex2D( _A, i.uv )); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SignOpNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SignOpNode.shader.meta deleted file mode 100644 index 6a6b6fdd..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SignOpNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 3aca80b49aadf5046b7133730818e18f -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleAddOpNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleAddOpNode.shader deleted file mode 100644 index e8965d92..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleAddOpNode.shader +++ /dev/null @@ -1,66 +0,0 @@ -Shader "Hidden/SimpleAddOpNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - _B ("_B", 2D) = "white" {} - _C ("_C", 2D) = "white" {} - _D ("_D", 2D) = "white" {} - _E ("_E", 2D) = "white" {} - _F ("_F", 2D) = "white" {} - _G ("_G", 2D) = "white" {} - _H ("_H", 2D) = "white" {} - _I ("_I", 2D) = "white" {} - _J ("_J", 2D) = "white" {} - _Count ("_Count", Int) = 0 - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - sampler2D _C; - sampler2D _D; - sampler2D _E; - sampler2D _F; - sampler2D _G; - sampler2D _H; - sampler2D _I; - sampler2D _J; - int _Count; - - float4 frag( v2f_img i ) : SV_Target - { - float4 a = tex2D( _A, i.uv ); - float4 b = tex2D( _B, i.uv ); - float4 final = a + b; - - if( _Count > 2 ) - final += tex2D( _C, i.uv ); - if( _Count > 3 ) - final += tex2D( _D, i.uv ); - if( _Count > 4 ) - final += tex2D( _E, i.uv ); - if( _Count > 5 ) - final += tex2D( _F, i.uv ); - if( _Count > 6 ) - final += tex2D( _G, i.uv ); - if( _Count > 7 ) - final += tex2D( _H, i.uv ); - if( _Count > 8 ) - final += tex2D( _I, i.uv ); - if( _Count > 9 ) - final += tex2D( _J, i.uv ); - - return final; - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleAddOpNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleAddOpNode.shader.meta deleted file mode 100644 index acd038b4..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleAddOpNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 9eb150cbc752cbc458a0a37984b9934a -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleContrastNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleContrastNode.shader deleted file mode 100644 index 96fa3b1b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleContrastNode.shader +++ /dev/null @@ -1,39 +0,0 @@ -Shader "Hidden/SimpleContrastNode" -{ - Properties - { - _A ( "_RBG", 2D ) = "white" {} - _B ( "_Fraction", 2D ) = "white" {} - } - - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - uniform sampler2D _A; - uniform sampler2D _B; - - float4 CalculateContrast ( float contrastValue, float4 colorTarget ) - { - float t = 0.5 * ( 1.0 - contrastValue ); - return mul ( float4x4( contrastValue, 0, 0, t, 0, contrastValue, 0, t, 0, 0, contrastValue, t, 0, 0, 0, 1 ), colorTarget ); - } - - float4 frag ( v2f_img i ) : SV_Target - { - float4 rgba = tex2D ( _B, i.uv ); - float value = tex2D ( _A, i.uv ).r; - - float4 finalColor = CalculateContrast( value , rgba ); - - return finalColor; - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleContrastNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleContrastNode.shader.meta deleted file mode 100644 index 5c780fe9..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleContrastNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 8d76799413f9f0547ac9b1de7ba798f1 -timeCreated: 1515421907 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleDivideOpNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleDivideOpNode.shader deleted file mode 100644 index 5f414cd8..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleDivideOpNode.shader +++ /dev/null @@ -1,29 +0,0 @@ -Shader "Hidden/SimpleDivideOpNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - _B ("_B", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - - float4 frag( v2f_img i ) : SV_Target - { - float4 a = tex2D( _A, i.uv ); - float4 b = tex2D( _B, i.uv ); - return a / b; - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleDivideOpNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleDivideOpNode.shader.meta deleted file mode 100644 index 582a69b2..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleDivideOpNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 409f06d00d1094849b0834c52791fa72 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleMaxOp.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleMaxOp.shader deleted file mode 100644 index f9739070..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleMaxOp.shader +++ /dev/null @@ -1,29 +0,0 @@ -Shader "Hidden/SimpleMaxOp" -{ - Properties - { - _A ("_A", 2D) = "white" {} - _B ("_B", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D( _A, i.uv ); - float4 b = tex2D( _B, i.uv ); - return max( a, b ); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleMaxOp.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleMaxOp.shader.meta deleted file mode 100644 index 9575af56..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleMaxOp.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 79d7f2a11092ac84a95ef6823b34adf2 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleMinNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleMinNode.shader deleted file mode 100644 index 183d0dd6..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleMinNode.shader +++ /dev/null @@ -1,29 +0,0 @@ -Shader "Hidden/SimpleMinNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - _B ("_B", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D( _A, i.uv ); - float4 b = tex2D( _B, i.uv ); - return min( a, b ); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleMinNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleMinNode.shader.meta deleted file mode 100644 index 0f2a2665..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleMinNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: d6033298044f0f14aa9932ca46e58ce6 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleMultiplyOpNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleMultiplyOpNode.shader deleted file mode 100644 index 5bd25e3e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleMultiplyOpNode.shader +++ /dev/null @@ -1,272 +0,0 @@ -Shader "Hidden/SimpleMultiplyOpNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - _B ("_B", 2D) = "white" {} - _C ("_C", 2D) = "white" {} - _D ("_D", 2D) = "white" {} - _E ("_E", 2D) = "white" {} - _F ("_F", 2D) = "white" {} - _G ("_G", 2D) = "white" {} - _H ("_H", 2D) = "white" {} - _I ("_I", 2D) = "white" {} - _J ("_J", 2D) = "white" {} - _Count ("_Count", Int) = 0 - } - - SubShader - { - Pass //2 - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - - float4 frag( v2f_img i ) : SV_Target - { - float4 a = tex2D( _A, i.uv ); - float4 b = tex2D( _B, i.uv ); - - return a * b; - } - ENDCG - } - - Pass //3 - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - sampler2D _C; - - float4 frag( v2f_img i ) : SV_Target - { - float4 a = tex2D( _A, i.uv ); - float4 b = tex2D( _B, i.uv ); - float4 c = tex2D( _C, i.uv ); - - return a * b * c; - } - ENDCG - } - - Pass //4 - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - sampler2D _C; - sampler2D _D; - - float4 frag( v2f_img i ) : SV_Target - { - float4 a = tex2D( _A, i.uv ); - float4 b = tex2D( _B, i.uv ); - float4 c = tex2D( _C, i.uv ); - float4 d = tex2D( _D, i.uv ); - - return a * b * c * d; - } - ENDCG - } - - Pass //5 - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - sampler2D _C; - sampler2D _D; - sampler2D _E; - - float4 frag( v2f_img i ) : SV_Target - { - float4 a = tex2D( _A, i.uv ); - float4 b = tex2D( _B, i.uv ); - float4 c = tex2D( _C, i.uv ); - float4 d = tex2D( _D, i.uv ); - float4 e = tex2D( _E, i.uv ); - - return a * b * c * d * e; - } - ENDCG - } - - Pass //6 - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - sampler2D _C; - sampler2D _D; - sampler2D _E; - sampler2D _F; - - float4 frag( v2f_img i ) : SV_Target - { - float4 a = tex2D( _A, i.uv ); - float4 b = tex2D( _B, i.uv ); - float4 c = tex2D( _C, i.uv ); - float4 d = tex2D( _D, i.uv ); - float4 e = tex2D( _E, i.uv ); - float4 f = tex2D( _F, i.uv ); - - return a * b * c * d * e * f; - } - ENDCG - } - - Pass //7 - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - sampler2D _C; - sampler2D _D; - sampler2D _E; - sampler2D _F; - sampler2D _G; - - float4 frag( v2f_img i ) : SV_Target - { - float4 a = tex2D( _A, i.uv ); - float4 b = tex2D( _B, i.uv ); - float4 c = tex2D( _C, i.uv ); - float4 d = tex2D( _D, i.uv ); - float4 e = tex2D( _E, i.uv ); - float4 f = tex2D( _F, i.uv ); - float4 g = tex2D( _G, i.uv ); - - return a * b * c * d * e * f * g; - } - ENDCG - } - - Pass //8 - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - sampler2D _C; - sampler2D _D; - sampler2D _E; - sampler2D _F; - sampler2D _G; - sampler2D _H; - - float4 frag( v2f_img i ) : SV_Target - { - float4 a = tex2D( _A, i.uv ); - float4 b = tex2D( _B, i.uv ); - float4 c = tex2D( _C, i.uv ); - float4 d = tex2D( _D, i.uv ); - float4 e = tex2D( _E, i.uv ); - float4 f = tex2D( _F, i.uv ); - float4 g = tex2D( _G, i.uv ); - float4 h = tex2D( _H, i.uv ); - - return a * b * c * d * e * f * g * h; - } - ENDCG - } - - Pass //9 - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - sampler2D _C; - sampler2D _D; - sampler2D _E; - sampler2D _F; - sampler2D _G; - sampler2D _H; - sampler2D _I; - - float4 frag( v2f_img i ) : SV_Target - { - float4 a = tex2D( _A, i.uv ); - float4 b = tex2D( _B, i.uv ); - float4 c = tex2D( _C, i.uv ); - float4 d = tex2D( _D, i.uv ); - float4 e = tex2D( _E, i.uv ); - float4 f = tex2D( _F, i.uv ); - float4 g = tex2D( _G, i.uv ); - float4 h = tex2D( _H, i.uv ); - float4 is = tex2D( _I, i.uv ); - - return a * b * c * d * e * f * g * h * is; - } - ENDCG - } - - Pass //10 - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - sampler2D _C; - sampler2D _D; - sampler2D _E; - sampler2D _F; - sampler2D _G; - sampler2D _H; - sampler2D _I; - sampler2D _J; - - float4 frag( v2f_img i ) : SV_Target - { - float4 a = tex2D( _A, i.uv ); - float4 b = tex2D( _B, i.uv ); - float4 c = tex2D( _C, i.uv ); - float4 d = tex2D( _D, i.uv ); - float4 e = tex2D( _E, i.uv ); - float4 f = tex2D( _F, i.uv ); - float4 g = tex2D( _G, i.uv ); - float4 h = tex2D( _H, i.uv ); - float4 is = tex2D( _I, i.uv ); - float4 j = tex2D( _J, i.uv ); - - return a * b * c * d * e * f * g * h * is * j; - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleMultiplyOpNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleMultiplyOpNode.shader.meta deleted file mode 100644 index 721b5dfc..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleMultiplyOpNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 1ba1e43e86415ff4bbdf4d81dfcf035b -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleRemainderNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleRemainderNode.shader deleted file mode 100644 index b62c655f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleRemainderNode.shader +++ /dev/null @@ -1,29 +0,0 @@ -Shader "Hidden/SimpleRemainderNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - _B ("_B", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - - float4 frag( v2f_img i ) : SV_Target - { - float4 a = tex2D( _A, i.uv ); - float4 b = tex2D( _B, i.uv ); - return a % b; - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleRemainderNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleRemainderNode.shader.meta deleted file mode 100644 index 1cf624d8..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleRemainderNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 8fdfc429d6b191c4985c9531364c1a95 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleSubtractOpNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleSubtractOpNode.shader deleted file mode 100644 index 7282f978..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleSubtractOpNode.shader +++ /dev/null @@ -1,29 +0,0 @@ -Shader "Hidden/SimpleSubtractOpNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - _B ("_B", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - - float4 frag( v2f_img i ) : SV_Target - { - float4 a = tex2D( _A, i.uv ); - float4 b = tex2D( _B, i.uv ); - return a - b; - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleSubtractOpNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleSubtractOpNode.shader.meta deleted file mode 100644 index 89565019..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleSubtractOpNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 5725e8300be208449973f771ab6682f2 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleTimeNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleTimeNode.shader deleted file mode 100644 index 428eea6c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleTimeNode.shader +++ /dev/null @@ -1,29 +0,0 @@ -Shader "Hidden/SimpleTimeNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - _Count ("_Count", Int) = 0 - } - SubShader - { - Pass - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - #include "UnityCG.cginc" - - sampler2D _A; - float _EditorTime; - - float4 frag( v2f_img i ) : SV_Target - { - float4 a = tex2D( _A, i.uv ); - float4 t = _EditorTime; - return t * a.x; - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleTimeNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleTimeNode.shader.meta deleted file mode 100644 index 2fa56549..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimpleTimeNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 45b7107d5d11f124fad92bcb1fa53661 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimplifiedFModOpNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimplifiedFModOpNode.shader deleted file mode 100644 index 8cc3d4ab..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimplifiedFModOpNode.shader +++ /dev/null @@ -1,29 +0,0 @@ -Shader "Hidden/SimplifiedFModOpNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - _B ("_B", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D( _A, i.uv ); - float4 b = tex2D( _B, i.uv ); - return frac( a / b ) * b; - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimplifiedFModOpNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimplifiedFModOpNode.shader.meta deleted file mode 100644 index 29f7167c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SimplifiedFModOpNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 2688236fb4f37ce47b81cc818c53321d -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SinOpNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SinOpNode.shader deleted file mode 100644 index 0645bf41..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SinOpNode.shader +++ /dev/null @@ -1,25 +0,0 @@ -Shader "Hidden/SinOpNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag(v2f_img i) : SV_Target - { - return sin(tex2D( _A, i.uv )); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SinOpNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SinOpNode.shader.meta deleted file mode 100644 index bf7ab483..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SinOpNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: bcd9f8749ddd3ac4f94f4c2071c1d0d4 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SinTimeNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SinTimeNode.shader deleted file mode 100644 index 443f807f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SinTimeNode.shader +++ /dev/null @@ -1,25 +0,0 @@ -Shader "Hidden/SinTimeNode" -{ - SubShader - { - Pass - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - #include "UnityCG.cginc" - - float _EditorTime; - - float4 frag( v2f_img i ) : SV_Target - { - float4 t = _EditorTime; - t.x = _EditorTime / 8; - t.y = _EditorTime / 4; - t.z = _EditorTime / 2; - return sin(t); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SinTimeNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SinTimeNode.shader.meta deleted file mode 100644 index 2cbb3c16..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SinTimeNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: e4ba809e0badeb94994170b2cbbbba10 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SinhOpNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SinhOpNode.shader deleted file mode 100644 index b1c09847..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SinhOpNode.shader +++ /dev/null @@ -1,25 +0,0 @@ -Shader "Hidden/SinhOpNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag(v2f_img i) : SV_Target - { - return sinh(tex2D( _A, i.uv )); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SinhOpNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SinhOpNode.shader.meta deleted file mode 100644 index e9890543..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SinhOpNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 4e9c00e6dceb4024f80d4e3d7786abad -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SmoothstepOpNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SmoothstepOpNode.shader deleted file mode 100644 index bcfb8763..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SmoothstepOpNode.shader +++ /dev/null @@ -1,32 +0,0 @@ -Shader "Hidden/SmoothstepOpNode" -{ - Properties - { - _A ("_Alpha", 2D) = "white" {} - _B ("_Min", 2D) = "white" {} - _C ("_Max", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - sampler2D _C; - - float4 frag(v2f_img i) : SV_Target - { - float4 alpha = tex2D( _A, i.uv ); - float4 min = tex2D( _B, i.uv ); - float4 max = tex2D( _C, i.uv ); - return smoothstep(min, max, alpha); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SmoothstepOpNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SmoothstepOpNode.shader.meta deleted file mode 100644 index 817fd470..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SmoothstepOpNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 954cdd40a7a528344a0a4d3ff1db5176 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SqrtOpNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SqrtOpNode.shader deleted file mode 100644 index b45f3251..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SqrtOpNode.shader +++ /dev/null @@ -1,25 +0,0 @@ -Shader "Hidden/SqrtOpNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag(v2f_img i) : SV_Target - { - return sqrt(tex2D( _A, i.uv )); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SqrtOpNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SqrtOpNode.shader.meta deleted file mode 100644 index a5ab372b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SqrtOpNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 1791e2fbf36af084da7ecfc289e89b6e -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_StaticSwitchNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_StaticSwitchNode.shader deleted file mode 100644 index 4931a07c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_StaticSwitchNode.shader +++ /dev/null @@ -1,59 +0,0 @@ -Shader "Hidden/StaticSwitchNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - _B ("_B", 2D) = "white" {} - _C ("_C", 2D) = "white" {} - _D ("_D", 2D) = "white" {} - _E ("_E", 2D) = "white" {} - _F ("_F", 2D) = "white" {} - _G ("_G", 2D) = "white" {} - _H ("_H", 2D) = "white" {} - _I ("_I", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - sampler2D _C; - sampler2D _D; - sampler2D _E; - sampler2D _F; - sampler2D _G; - sampler2D _H; - sampler2D _I; - int _Condition; - - float4 frag( v2f_img i ) : SV_Target - { - if( _Condition == 0) - return tex2D( _B, i.uv ); // A nd B are switched - else if( _Condition == 1 ) - return tex2D( _A, i.uv ); - else if( _Condition == 2 ) - return tex2D( _C, i.uv ); - else if( _Condition == 3 ) - return tex2D( _D, i.uv ); - else if( _Condition == 4 ) - return tex2D( _E, i.uv ); - else if( _Condition == 5 ) - return tex2D( _F, i.uv ); - else if( _Condition == 6 ) - return tex2D( _G, i.uv ); - else if( _Condition == 7 ) - return tex2D( _H, i.uv ); - else - return tex2D( _I, i.uv ); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_StaticSwitchNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_StaticSwitchNode.shader.meta deleted file mode 100644 index 306b9811..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_StaticSwitchNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 0b708c11c68e6a9478ac97fe3643eab1 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_StepOpNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_StepOpNode.shader deleted file mode 100644 index 86fdf066..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_StepOpNode.shader +++ /dev/null @@ -1,29 +0,0 @@ -Shader "Hidden/StepOpNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - _B ("_B", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - - float4 frag( v2f_img i ) : SV_Target - { - float4 a = tex2D( _A, i.uv ); - float4 b = tex2D( _B, i.uv ); - return step(a, b); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_StepOpNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_StepOpNode.shader.meta deleted file mode 100644 index a23d36dc..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_StepOpNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 2c757add7f97ecd4abd9ce6ec4659697 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SubstanceSamplerNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SubstanceSamplerNode.shader deleted file mode 100644 index 86a2adcc..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SubstanceSamplerNode.shader +++ /dev/null @@ -1,53 +0,0 @@ -Shader "Hidden/SubstanceSamplerNode" -{ - Properties - { - _A ("_UV", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _GenTex; - int _CustomUVs; - - float4 frag( v2f_img i ) : SV_Target - { - float2 uvs = i.uv; - if( _CustomUVs == 1 ) - uvs = tex2D( _A, i.uv ).xy; - float4 genTex = tex2D( _GenTex, uvs); - return genTex; - } - ENDCG - } - - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _GenTex; - int _CustomUVs; - - float4 frag( v2f_img i ) : SV_Target - { - float2 uvs = i.uv; - if( _CustomUVs == 1 ) - uvs = tex2D( _A, i.uv ).xy; - float3 genTex = UnpackNormal( tex2D( _GenTex, uvs ) ); - return float4( genTex, 0 ); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SubstanceSamplerNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SubstanceSamplerNode.shader.meta deleted file mode 100644 index 322d7848..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SubstanceSamplerNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 6f322c1da33f1e744941aafcb0ad1a2d -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SummedBlendNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SummedBlendNode.shader deleted file mode 100644 index 4f3b670d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SummedBlendNode.shader +++ /dev/null @@ -1,85 +0,0 @@ -Shader "Hidden/SummedBlendNode" -{ - Properties - { - _A ( "_Weights", 2D) = "white" {} - _B ( "_Layer1", 2D) = "white" {} - _C ( "_Layer2", 2D ) = "white" {} - _D ( "_Layer3", 2D ) = "white" {} - _E ( "_Layer4", 2D ) = "white" {} - } - - SubShader - { - - CGINCLUDE - - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - sampler2D _A; - sampler2D _B; - - ENDCG - - Pass - { - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 Weights = tex2D ( _A, i.uv ); - float4 Layer1 = tex2D( _B, i.uv ); - return Weights*Layer1; - } - ENDCG - } - - Pass - { - CGPROGRAM - sampler2D _C; - float4 frag ( v2f_img i ) : SV_Target - { - float4 Weights = tex2D ( _A, i.uv ); - float4 Layer1 = tex2D ( _B, i.uv ); - float4 Layer2 = tex2D ( _C, i.uv ); - return ( Weights.x*Layer1 + Weights.y*Layer2 ); - } - ENDCG - } - - Pass - { - CGPROGRAM - sampler2D _C; - sampler2D _D; - float4 frag ( v2f_img i ) : SV_Target - { - float4 Weights = tex2D( _A, i.uv ); - float4 Layer1 = tex2D( _B, i.uv ); - float4 Layer2 = tex2D( _C, i.uv ); - float4 Layer3 = tex2D( _D, i.uv ); - return ( Weights.x*Layer1 + Weights.y*Layer2 + Weights.z*Layer3 ); - } - ENDCG - } - - Pass - { - CGPROGRAM - sampler2D _C; - sampler2D _D; - sampler2D _E; - float4 frag ( v2f_img i ) : SV_Target - { - float4 Weights = tex2D ( _A, i.uv ); - float4 Layer1 = tex2D ( _B, i.uv ); - float4 Layer2 = tex2D ( _C, i.uv ); - float4 Layer3 = tex2D ( _D, i.uv ); - float4 Layer4 = tex2D ( _E, i.uv ); - return ( Weights.x*Layer1 + Weights.y*Layer2 + Weights.z*Layer3 + Weights.w*Layer4 ); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SummedBlendNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SummedBlendNode.shader.meta deleted file mode 100644 index 700d2e68..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SummedBlendNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: eda18b96e13f78b49bbdaa4da3fead19 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SwitchByFaceNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SwitchByFaceNode.shader deleted file mode 100644 index 0f8176c3..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SwitchByFaceNode.shader +++ /dev/null @@ -1,29 +0,0 @@ -Shader "Hidden/SwitchByFaceNode" -{ - Properties - { - _A ("_Front", 2D) = "white" {} - _B ("_Back", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - - float4 frag( v2f_img i, half ase_vface : VFACE ) : SV_Target - { - float4 front = tex2D( _A, i.uv ); - float4 back = tex2D( _B, i.uv ); - return ( ( ase_vface > 0 ) ? ( front ) : ( back ) ); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SwitchByFaceNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SwitchByFaceNode.shader.meta deleted file mode 100644 index 1dbf813d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SwitchByFaceNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: f4edf6febb54dc743b25bd5b56facea8 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SwitchNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SwitchNode.shader deleted file mode 100644 index d7978725..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SwitchNode.shader +++ /dev/null @@ -1,59 +0,0 @@ -Shader "Hidden/SwitchNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - _B ("_B", 2D) = "white" {} - _C ("_C", 2D) = "white" {} - _D ("_D", 2D) = "white" {} - _E ("_E", 2D) = "white" {} - _F ("_F", 2D) = "white" {} - _G ("_G", 2D) = "white" {} - _H ("_H", 2D) = "white" {} - _I ("_I", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - sampler2D _C; - sampler2D _D; - sampler2D _E; - sampler2D _F; - sampler2D _G; - sampler2D _H; - sampler2D _I; - float _Current; - - float4 frag( v2f_img i ) : SV_Target - { - if( _Current == 0 ) - return tex2D( _A, i.uv ); - else if( _Current == 1 ) - return tex2D( _B, i.uv ); - else if( _Current == 2 ) - return tex2D( _C, i.uv ); - else if( _Current == 3 ) - return tex2D( _D, i.uv ); - else if( _Current == 4 ) - return tex2D( _E, i.uv ); - else if( _Current == 5 ) - return tex2D( _F, i.uv ); - else if( _Current == 6 ) - return tex2D( _G, i.uv ); - else if( _Current == 7 ) - return tex2D( _H, i.uv ); - else - return tex2D( _I, i.uv ); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SwitchNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SwitchNode.shader.meta deleted file mode 100644 index 8319d2a0..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SwitchNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: a58e46feaa5e3d14383bfeac24d008bc -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SwizzleNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SwizzleNode.shader deleted file mode 100644 index 9433c797..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SwizzleNode.shader +++ /dev/null @@ -1,3103 +0,0 @@ -Shader "Hidden/SwizzleNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - _Mask("_Mask", Vector) = (0,0,0,0) - } - SubShader - { - CGINCLUDE - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - sampler2D _C; - sampler2D _D; - - float4 _Mask; - ENDCG - /////////////////////////////////////////////////////////////////////////////// - Pass - { - Name "xxxx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.x,a.x,a.x)*_Mask; - } - ENDCG - } - - Pass - { - Name "xxxy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.x,a.x,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "xxxz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.x,a.x,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "xxxw" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.x,a.x,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "xxyx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.x,a.y,a.x)*_Mask; - } - ENDCG - } - - - Pass - { - Name "xxyy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.x,a.y,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "xxyz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.x,a.y,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "xxyw" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.x,a.y,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "xxzx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.x,a.z,a.x)*_Mask; - } - ENDCG - } - - Pass - { - Name "xxzy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.x,a.z,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "xxzz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.x,a.z,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "xxzw" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.x,a.z,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "xxwx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.x,a.w,a.x)*_Mask; - } - ENDCG - } - - Pass - { - Name "xxwy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.x,a.w,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "xxwz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.x,a.w,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "xxww" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.x,a.w,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "xyxx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.y,a.x,a.x)*_Mask; - } - ENDCG - } - - Pass - { - Name "xyxy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.y,a.x,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "xyxz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.y,a.x,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "xyxw" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.y,a.x,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "xyyx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.y,a.y,a.x)*_Mask; - } - ENDCG - } - - Pass - { - Name "xyyy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.y,a.y,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "xyyz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.y,a.y,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "xyyw" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.y,a.y,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "xyzx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.y,a.z,a.x)*_Mask; - } - ENDCG - } - - Pass - { - Name "xyzy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.y,a.z,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "xyzz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.y,a.z,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "xyzw" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.y,a.z,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "xywx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.y,a.w,a.x)*_Mask; - } - ENDCG - } - - Pass - { - Name "xywy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.y,a.w,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "xywz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.y,a.w,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "xyww" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.y,a.w,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "xzxx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.z,a.x,a.x)*_Mask; - } - ENDCG - } - - Pass - { - Name "xzxy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.z,a.x,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "xzxz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.z,a.x,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "xzxw" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.z,a.x,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "xzyx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.z,a.y,a.x)*_Mask; - } - ENDCG - } - - Pass - { - Name "xzyy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.z,a.y,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "xzyz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.z,a.y,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "xzyw" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.z,a.y,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "xzzx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.z,a.z,a.x)*_Mask; - } - ENDCG - } - - Pass - { - Name "xzzy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.z,a.z,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "xzzz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.z,a.z,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "xzzw" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.z,a.z,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "xzwx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.z,a.w,a.x)*_Mask; - } - ENDCG - } - - Pass - { - Name "xzwy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.z,a.w,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "xzwz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.z,a.w,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "xzww" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.z,a.w,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "xwxx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.w,a.x,a.x)*_Mask; - } - ENDCG - } - - Pass - { - Name "xwxy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.w,a.x,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "xwxz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.w,a.x,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "xwxw" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.w,a.x,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "xwyx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.w,a.y,a.x)*_Mask; - } - ENDCG - } - - - Pass - { - Name "xwyy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.w,a.y,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "xwyz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.w,a.y,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "xwyw" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.w,a.y,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "xwzx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.w,a.z,a.x)*_Mask; - } - ENDCG - } - - Pass - { - Name "xwzy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.w,a.z,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "xwzz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.w,a.z,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "xwzw" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.w,a.z,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "xwwx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.w,a.w,a.x)*_Mask; - } - ENDCG - } - - Pass - { - Name "xwwy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.w,a.w,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "xwwz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.w,a.w,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "xwww" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.x,a.w,a.w,a.w)*_Mask; - } - ENDCG - } - /////////////////////////////////////////////////////////////////////////////// - Pass - { - Name "yxxx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.x,a.x,a.x)*_Mask; - } - ENDCG - } - - Pass - { - Name "yxxy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.x,a.x,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "yxxz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.x,a.x,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "yxxw" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.x,a.x,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "yxyx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.x,a.y,a.x)*_Mask; - } - ENDCG - } - - - Pass - { - Name "yxyy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.x,a.y,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "yxyz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.x,a.y,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "yxyw" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.x,a.y,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "yxzx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.x,a.z,a.x)*_Mask; - } - ENDCG - } - - Pass - { - Name "yxzy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.x,a.z,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "yxzz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.x,a.z,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "yxzw" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.x,a.z,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "yxwx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.x,a.w,a.x)*_Mask; - } - ENDCG - } - - Pass - { - Name "yxwy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.x,a.w,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "yxwz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.x,a.w,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "yxww" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.x,a.w,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "yyxx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.y,a.x,a.x)*_Mask; - } - ENDCG - } - - Pass - { - Name "yyxy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.y,a.x,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "yyxz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.y,a.x,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "yyxw" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.y,a.x,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "yyyx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.y,a.y,a.x)*_Mask; - } - ENDCG - } - - Pass - { - Name "yyyy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.y,a.y,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "yyyz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.y,a.y,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "yyyw" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.y,a.y,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "yyzx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.y,a.z,a.x)*_Mask; - } - ENDCG - } - - Pass - { - Name "yyzy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.y,a.z,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "yyzz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.y,a.z,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "yyzw" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.y,a.z,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "yywx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.y,a.w,a.x)*_Mask; - } - ENDCG - } - - Pass - { - Name "yywy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.y,a.w,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "yywz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.y,a.w,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "yyww" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.y,a.w,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "yzxx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.z,a.x,a.x)*_Mask; - } - ENDCG - } - - Pass - { - Name "yzxy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.z,a.x,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "yzxz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.z,a.x,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "yzxw" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.z,a.x,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "yzyx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.z,a.y,a.x)*_Mask; - } - ENDCG - } - - Pass - { - Name "yzyy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.z,a.y,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "yzyz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.z,a.y,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "yzyw" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.z,a.y,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "yzzx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.z,a.z,a.x)*_Mask; - } - ENDCG - } - - Pass - { - Name "yzzy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.z,a.z,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "yzzz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.z,a.z,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "yzzw" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.z,a.z,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "yzwx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.z,a.w,a.x)*_Mask; - } - ENDCG - } - - Pass - { - Name "yzwy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.z,a.w,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "yzwz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.z,a.w,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "yzww" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.z,a.w,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "ywxx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.w,a.x,a.x)*_Mask; - } - ENDCG - } - - Pass - { - Name "ywxy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.w,a.x,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "ywxz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.w,a.x,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "ywxw" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.w,a.x,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "ywyx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.w,a.y,a.x)*_Mask; - } - ENDCG - } - - - Pass - { - Name "ywyy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.w,a.y,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "ywyz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.w,a.y,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "ywyw" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.w,a.y,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "ywzx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.w,a.z,a.x)*_Mask; - } - ENDCG - } - - Pass - { - Name "ywzy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.w,a.z,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "ywzz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.w,a.z,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "ywzw" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.w,a.z,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "ywwx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.w,a.w,a.x)*_Mask; - } - ENDCG - } - - Pass - { - Name "ywwy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.w,a.w,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "ywwz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.w,a.w,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "ywww" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.y,a.w,a.w,a.w)*_Mask; - } - ENDCG - } - /////////////////////////////////////////////////////////////////////////////// - Pass - { - Name "zxxx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.x,a.x,a.x)*_Mask; - } - ENDCG - } - - Pass - { - Name "zxxy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.x,a.x,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "zxxz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.x,a.x,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "zxxw" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.x,a.x,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "zxyx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.x,a.y,a.x)*_Mask; - } - ENDCG - } - - - Pass - { - Name "zxyy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.x,a.y,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "zxyz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.x,a.y,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "zxyw" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.x,a.y,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "zxzx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.x,a.z,a.x)*_Mask; - } - ENDCG - } - - Pass - { - Name "zxzy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.x,a.z,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "zxzz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.x,a.z,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "zxzw" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.x,a.z,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "zxwx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.x,a.w,a.x)*_Mask; - } - ENDCG - } - - Pass - { - Name "zxwy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.x,a.w,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "zxwz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.x,a.w,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "zxww" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.x,a.w,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "zyxx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.y,a.x,a.x)*_Mask; - } - ENDCG - } - - Pass - { - Name "zyxy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.y,a.x,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "zyxz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.y,a.x,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "zyxw" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.y,a.x,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "zyyx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.y,a.y,a.x)*_Mask; - } - ENDCG - } - - Pass - { - Name "zyyy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.y,a.y,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "zyyz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.y,a.y,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "zyyw" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.y,a.y,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "zyzx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.y,a.z,a.x)*_Mask; - } - ENDCG - } - - Pass - { - Name "zyzy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.y,a.z,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "zyzz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.y,a.z,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "zyzw" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.y,a.z,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "zywx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.y,a.w,a.x)*_Mask; - } - ENDCG - } - - Pass - { - Name "zywy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.y,a.w,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "zywz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.y,a.w,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "zyww" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.y,a.w,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "zzxx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.z,a.x,a.x)*_Mask; - } - ENDCG - } - - Pass - { - Name "zzxy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.z,a.x,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "zzxz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.z,a.x,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "zzxw" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.z,a.x,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "zzyx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.z,a.y,a.x)*_Mask; - } - ENDCG - } - - Pass - { - Name "zzyy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.z,a.y,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "zzyz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.z,a.y,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "zzyw" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.z,a.y,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "zzzx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.z,a.z,a.x)*_Mask; - } - ENDCG - } - - Pass - { - Name "zzzy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.z,a.z,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "zzzz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.z,a.z,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "zzzw" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.z,a.z,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "zzwx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.z,a.w,a.x)*_Mask; - } - ENDCG - } - - Pass - { - Name "zzwy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.z,a.w,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "zzwz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.z,a.w,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "zzww" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.z,a.w,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "zwxx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.w,a.x,a.x)*_Mask; - } - ENDCG - } - - Pass - { - Name "zwxy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.w,a.x,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "zwxz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.w,a.x,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "zwxw" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.w,a.x,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "zwyx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.w,a.y,a.x)*_Mask; - } - ENDCG - } - - - Pass - { - Name "zwyy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.w,a.y,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "zwyz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.w,a.y,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "zwyw" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.w,a.y,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "zwzx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.w,a.z,a.x)*_Mask; - } - ENDCG - } - - Pass - { - Name "zwzy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.w,a.z,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "zwzz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.w,a.z,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "zwzw" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.w,a.z,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "zwwx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.w,a.w,a.x)*_Mask; - } - ENDCG - } - - Pass - { - Name "zwwy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.w,a.w,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "zwwz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.w,a.w,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "zwww" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.z,a.w,a.w,a.w)*_Mask; - } - ENDCG - } - /////////////////////////////////////////////////////////////////////////////// - Pass - { - Name "wxxx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.x,a.x,a.x)*_Mask; - } - ENDCG - } - - Pass - { - Name "wxxy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.x,a.x,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "wxxz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.x,a.x,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "wxxw" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.x,a.x,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "wxyx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.x,a.y,a.x)*_Mask; - } - ENDCG - } - - - Pass - { - Name "wxyy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.x,a.y,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "wxyz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.x,a.y,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "wxyw" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.x,a.y,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "wxzx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.x,a.z,a.x)*_Mask; - } - ENDCG - } - - Pass - { - Name "wxzy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.x,a.z,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "wxzz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.x,a.z,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "wxzw" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.x,a.z,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "wxwx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.x,a.w,a.x)*_Mask; - } - ENDCG - } - - Pass - { - Name "wxwy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.x,a.w,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "wxwz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.x,a.w,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "wxww" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.x,a.w,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "wyxx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.y,a.x,a.x)*_Mask; - } - ENDCG - } - - Pass - { - Name "wyxy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.y,a.x,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "wyxz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.y,a.x,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "wyxw" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.y,a.x,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "wyyx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.y,a.y,a.x)*_Mask; - } - ENDCG - } - - Pass - { - Name "wyyy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.y,a.y,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "wyyz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.y,a.y,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "wyyw" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.y,a.y,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "wyzx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.y,a.z,a.x)*_Mask; - } - ENDCG - } - - Pass - { - Name "wyzy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.y,a.z,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "wyzz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.y,a.z,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "wyzw" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.y,a.z,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "wywx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.y,a.w,a.x)*_Mask; - } - ENDCG - } - - Pass - { - Name "wywy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.y,a.w,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "wywz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.y,a.w,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "wyww" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.y,a.w,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "wzxx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.z,a.x,a.x)*_Mask; - } - ENDCG - } - - Pass - { - Name "wzxy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.z,a.x,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "wzxz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.z,a.x,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "wzxw" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.z,a.x,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "wzyx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.z,a.y,a.x)*_Mask; - } - ENDCG - } - - Pass - { - Name "wzyy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.z,a.y,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "wzyz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.z,a.y,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "wzyw" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.z,a.y,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "wzzx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.z,a.z,a.x)*_Mask; - } - ENDCG - } - - Pass - { - Name "wzzy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.z,a.z,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "wzzz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.z,a.z,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "wzzw" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.z,a.z,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "wzwx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.z,a.w,a.x)*_Mask; - } - ENDCG - } - - Pass - { - Name "wzwy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.z,a.w,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "wzwz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.z,a.w,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "wzww" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.z,a.w,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "wwxx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.w,a.x,a.x)*_Mask; - } - ENDCG - } - - Pass - { - Name "wwxy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.w,a.x,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "wwxz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.w,a.x,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "wwxw" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.w,a.x,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "wwyx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.w,a.y,a.x)*_Mask; - } - ENDCG - } - - - Pass - { - Name "wwyy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.w,a.y,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "wwyz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.w,a.y,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "wwyw" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.w,a.y,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "wwzx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.w,a.z,a.x)*_Mask; - } - ENDCG - } - - Pass - { - Name "wwzy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.w,a.z,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "wwzz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.w,a.z,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "wwzw" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.w,a.z,a.w)*_Mask; - } - ENDCG - } - - Pass - { - Name "wwwx" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.w,a.w,a.x)*_Mask; - } - ENDCG - } - - Pass - { - Name "wwwy" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.w,a.w,a.y)*_Mask; - } - ENDCG - } - - Pass - { - Name "wwwz" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.w,a.w,a.z)*_Mask; - } - ENDCG - } - - Pass - { - Name "wwww" - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 a = tex2D(_A, i.uv); - return float4(a.w,a.w,a.w,a.w)*_Mask; - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SwizzleNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SwizzleNode.shader.meta deleted file mode 100644 index 0fdc1114..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_SwizzleNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: d20531704ce28b14bafb296f291f6608 -timeCreated: 1510580676 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareEqual.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareEqual.shader deleted file mode 100644 index 83bf4a8f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareEqual.shader +++ /dev/null @@ -1,35 +0,0 @@ -Shader "Hidden/TFHCCompareEqual" -{ - Properties - { - _A ("_A", 2D) = "white" {} - _B ("_B", 2D) = "white" {} - _C ("_True", 2D) = "white" {} - _D ( "_False", 2D ) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - sampler2D _C; - sampler2D _D; - - float4 frag(v2f_img i) : SV_Target - { - float A = tex2D( _A, i.uv ).x; - float B = tex2D( _B, i.uv ).x; - float4 True = tex2D( _C, i.uv ); - float4 False = tex2D ( _D, i.uv ); - return ( ( A == B ) ? True : False ); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareEqual.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareEqual.shader.meta deleted file mode 100644 index 730c9a8a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareEqual.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 6904de6cf8c08e7439672390b425ab50 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareGreater.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareGreater.shader deleted file mode 100644 index 3c5d9349..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareGreater.shader +++ /dev/null @@ -1,35 +0,0 @@ -Shader "Hidden/TFHCCompareGreater" -{ - Properties - { - _A ("_A", 2D) = "white" {} - _B ("_B", 2D) = "white" {} - _C ("_True", 2D) = "white" {} - _D ( "_False", 2D ) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - sampler2D _C; - sampler2D _D; - - float4 frag(v2f_img i) : SV_Target - { - float A = tex2D( _A, i.uv ).x; - float B = tex2D( _B, i.uv ).x; - float4 True = tex2D( _C, i.uv ); - float4 False = tex2D ( _D, i.uv ); - return ( ( A > B ) ? True : False ); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareGreater.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareGreater.shader.meta deleted file mode 100644 index bd60bd3a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareGreater.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 363192dbd019ad2478f2fe6c277b7e48 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareGreaterEqual.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareGreaterEqual.shader deleted file mode 100644 index 9da87b1f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareGreaterEqual.shader +++ /dev/null @@ -1,35 +0,0 @@ -Shader "Hidden/TFHCCompareGreaterEqual" -{ - Properties - { - _A ("_A", 2D) = "white" {} - _B ("_B", 2D) = "white" {} - _C ("_True", 2D) = "white" {} - _D ( "_False", 2D ) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - sampler2D _C; - sampler2D _D; - - float4 frag(v2f_img i) : SV_Target - { - float A = tex2D( _A, i.uv ).x; - float B = tex2D( _B, i.uv ).x; - float4 True = tex2D( _C, i.uv ); - float4 False = tex2D ( _D, i.uv ); - return ( ( A >= B ) ? True : False ); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareGreaterEqual.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareGreaterEqual.shader.meta deleted file mode 100644 index 0b28956f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareGreaterEqual.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: f4ff76282a117c2429a1bcd8ba3a9112 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareLessNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareLessNode.shader deleted file mode 100644 index e5eb1987..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareLessNode.shader +++ /dev/null @@ -1,35 +0,0 @@ -Shader "Hidden/TFHCCompareLess" -{ - Properties - { - _A ("_A", 2D) = "white" {} - _B ("_B", 2D) = "white" {} - _C ("_True", 2D) = "white" {} - _D ( "_False", 2D ) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - sampler2D _C; - sampler2D _D; - - float4 frag(v2f_img i) : SV_Target - { - float A = tex2D( _A, i.uv ).x; - float B = tex2D( _B, i.uv ).x; - float4 True = tex2D( _C, i.uv ); - float4 False = tex2D ( _D, i.uv ); - return ( ( A < B ) ? True : False ); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareLessNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareLessNode.shader.meta deleted file mode 100644 index 6cca1105..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareLessNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 8024509244392ed44b37c28473e66a8a -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareLowerEqual.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareLowerEqual.shader deleted file mode 100644 index be9b7f0e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareLowerEqual.shader +++ /dev/null @@ -1,35 +0,0 @@ -Shader "Hidden/TFHCCompareLessEqual" -{ - Properties - { - _A ("_A", 2D) = "white" {} - _B ("_B", 2D) = "white" {} - _C ("_True", 2D) = "white" {} - _D ( "_False", 2D ) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - sampler2D _C; - sampler2D _D; - - float4 frag(v2f_img i) : SV_Target - { - float A = tex2D( _A, i.uv ).x; - float B = tex2D( _B, i.uv ).x; - float4 True = tex2D( _C, i.uv ); - float4 False = tex2D ( _D, i.uv ); - return ( ( A <= B ) ? True : False ); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareLowerEqual.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareLowerEqual.shader.meta deleted file mode 100644 index 471968d7..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareLowerEqual.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 9a3e17508793b9d42b1efaaf5bcd2554 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareNotEqual.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareNotEqual.shader deleted file mode 100644 index b40f85e5..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareNotEqual.shader +++ /dev/null @@ -1,35 +0,0 @@ -Shader "Hidden/TFHCCompareNotEqual" -{ - Properties - { - _A ("_A", 2D) = "white" {} - _B ("_B", 2D) = "white" {} - _C ("_True", 2D) = "white" {} - _D ( "_False", 2D ) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - sampler2D _C; - sampler2D _D; - - float4 frag(v2f_img i) : SV_Target - { - float A = tex2D( _A, i.uv ).x; - float B = tex2D( _B, i.uv ).x; - float4 True = tex2D( _C, i.uv ); - float4 False = tex2D ( _D, i.uv ); - return ( ( A != B ) ? True : False ); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareNotEqual.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareNotEqual.shader.meta deleted file mode 100644 index 44e64f91..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareNotEqual.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 75f433376eef1ad4a881d99124e08008 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareWithRange.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareWithRange.shader deleted file mode 100644 index 516727f2..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareWithRange.shader +++ /dev/null @@ -1,38 +0,0 @@ -Shader "Hidden/TFHCCompareWithRange" -{ - Properties - { - _A ("_Value", 2D) = "white" {} - _B ("_RangeMin", 2D) = "white" {} - _C ("_RangeMax", 2D) = "white" {} - _D ( "_True", 2D ) = "white" {} - _E ( "_False", 2D ) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - sampler2D _C; - sampler2D _D; - sampler2D _E; - - float4 frag(v2f_img i) : SV_Target - { - float4 Value = tex2D( _A, i.uv ).x; - float4 RangeMin = tex2D( _B, i.uv ).x; - float4 RangeMax = tex2D( _C, i.uv ); - float4 True = tex2D ( _D, i.uv ); - float4 False = tex2D ( _E, i.uv ); - return ( ( Value >= RangeMin && Value <= RangeMax ) ? True : False ); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareWithRange.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareWithRange.shader.meta deleted file mode 100644 index 65b4bf68..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCCompareWithRange.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 127d114eed178d7409f900134a6c00d1 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCFlipBookUVAnimation.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCFlipBookUVAnimation.shader deleted file mode 100644 index a3778980..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCFlipBookUVAnimation.shader +++ /dev/null @@ -1,89 +0,0 @@ -Shader "Hidden/TFHCFlipBookUVAnimation" -{ - Properties - { - _A ("_UV", 2D) = "white" {} - _B ("_Columns", 2D) = "white" {} - _C ("_Rows", 2D) = "white" {} - _D ("_Speed", 2D) = "white" {} - _E ("_StartFrame", 2D) = "white" {} - _F ("_Speed", 2D) = "white" {} - } - SubShader - { - CGINCLUDE - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - sampler2D _A; - sampler2D _B; - sampler2D _C; - sampler2D _D; - sampler2D _E; - sampler2D _F; - float _EditorTime; - ENDCG - - //Time port disconnected - Pass - { - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float2 uv = tex2D( _A, i.uv ).rg; - float col = tex2D( _B, i.uv ).r; - float row = tex2D( _C, i.uv ).r; - float spd = tex2D( _D, i.uv ).r; - float str = tex2D( _E, i.uv ).r; - - float fbtotaltiles = col * row; - float fbcolsoffset = 1.0f / col; - float fbrowsoffset = 1.0f / row; - float fbspeed = _EditorTime * spd; - float2 fbtiling = float2(fbcolsoffset, fbrowsoffset); - float fbcurrenttileindex = round( fmod( fbspeed + str, fbtotaltiles) ); - fbcurrenttileindex += ( fbcurrenttileindex < 0) ? fbtotaltiles : 0; - float fblinearindextox = round ( fmod ( fbcurrenttileindex, col ) ); - float fboffsetx = fblinearindextox * fbcolsoffset; - float fblinearindextoy = round( fmod( ( fbcurrenttileindex - fblinearindextox ) / col, row ) ); - fblinearindextoy = (int)(row-1) - fblinearindextoy; - float fboffsety = fblinearindextoy * fbrowsoffset; - float2 fboffset = float2(fboffsetx, fboffsety); - float2 fbuv = float4( uv, 0.0 , 0.0 ) * fbtiling + fboffset; - return float4(fbuv, 0 , 0); - } - ENDCG - } - - //Time port connected - Pass - { - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float2 uv = tex2D( _A, i.uv ).rg; - float col = tex2D( _B, i.uv ).r; - float row = tex2D( _C, i.uv ).r; - float spd = tex2D( _D, i.uv ).r; - float str = tex2D( _E, i.uv ).r; - float time = tex2D( _F, i.uv ).r; - float fbtotaltiles = col * row; - float fbcolsoffset = 1.0f / col; - float fbrowsoffset = 1.0f / row; - float fbspeed = time * spd; - float2 fbtiling = float2(fbcolsoffset, fbrowsoffset); - float fbcurrenttileindex = round( fmod( fbspeed + str, fbtotaltiles) ); - fbcurrenttileindex += ( fbcurrenttileindex < 0) ? fbtotaltiles : 0; - float fblinearindextox = round ( fmod ( fbcurrenttileindex, col ) ); - float fboffsetx = fblinearindextox * fbcolsoffset; - float fblinearindextoy = round( fmod( ( fbcurrenttileindex - fblinearindextox ) / col, row ) ); - fblinearindextoy = (int)(row-1) - fblinearindextoy; - float fboffsety = fblinearindextoy * fbrowsoffset; - float2 fboffset = float2(fboffsetx, fboffsety); - float2 fbuv = float4( uv, 0.0 , 0.0 ) * fbtiling + fboffset; - return float4(fbuv, 0 , 0); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCFlipBookUVAnimation.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCFlipBookUVAnimation.shader.meta deleted file mode 100644 index 9f796804..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCFlipBookUVAnimation.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 04fe24be792bfd5428b92132d7cf0f7d -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCIf.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCIf.shader deleted file mode 100644 index fb605cb2..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCIf.shader +++ /dev/null @@ -1,41 +0,0 @@ -Shader "Hidden/TFHCIf" -{ - Properties - { - _A ("_A", 2D) = "white" {} - _B ("_B", 2D) = "white" {} - _C ("_AGreaterB", 2D) = "white" {} - _D ( "_AEqualsB", 2D ) = "white" {} - _E ( "_ALessB", 2D ) = "white" {} - _F ( "_EqualThreshold", 2D ) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - sampler2D _C; - sampler2D _D; - sampler2D _E; - sampler2D _F; - - float4 frag(v2f_img i) : SV_Target - { - float4 A = tex2D( _A, i.uv ).x; - float4 B = tex2D( _B, i.uv ).x; - float4 AGreaterB = tex2D( _C, i.uv ); - float4 AEqualsB = tex2D ( _D, i.uv ); - float4 ALessB = tex2D ( _E, i.uv ); - float4 EqualThreshold = tex2D ( _F, i.uv ); - return ( A - EqualThreshold > B ? AGreaterB : A - EqualThreshold <= B && A + EqualThreshold >= B ? AEqualsB : ALessB ); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCIf.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCIf.shader.meta deleted file mode 100644 index 5d187167..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCIf.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 5c7bc7e3cab81da499e4864ace0d86c5 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCPixelateUV.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCPixelateUV.shader deleted file mode 100644 index f9d3d8a6..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCPixelateUV.shader +++ /dev/null @@ -1,35 +0,0 @@ -Shader "Hidden/TFHCPixelateUV" -{ - Properties - { - _A ("_UV", 2D) = "white" {} - _B ("_PixelX", 2D) = "white" {} - _C ("_PixelY", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - sampler2D _C; - - float4 frag(v2f_img i) : SV_Target - { - float2 uv = tex2D( _A, i.uv ).rg; - float pix = tex2D( _B, i.uv ).r; - float piy = tex2D( _C, i.uv ).r; - - float2 steppedPixel = float2( pix, piy ); - float2 pixelatedUV = floor( uv * steppedPixel ) / steppedPixel; - return float4(pixelatedUV, 0 , 0); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCPixelateUV.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCPixelateUV.shader.meta deleted file mode 100644 index bfaaa63c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCPixelateUV.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: e2f7e3c513ed18340868b8cbd0d85cfb -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCRemap.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCRemap.shader deleted file mode 100644 index bf10c8a1..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCRemap.shader +++ /dev/null @@ -1,49 +0,0 @@ -Shader "Hidden/TFHCRemap" -{ - Properties - { - _A ("_Value", 2D) = "white" {} - _B ("_MinOld", 2D) = "white" {} - _C ("_MaxOld", 2D) = "white" {} - _D ("_MinNew", 2D) = "white" {} - _E ("_MaxNew", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - sampler2D _C; - sampler2D _D; - sampler2D _E; - - float4 frag(v2f_img i) : SV_Target - { - float4 value = tex2D( _A, i.uv ); - float4 minold = tex2D( _B, i.uv ); - float4 maxold = tex2D( _C, i.uv ); - float4 minnew = tex2D( _D, i.uv ); - float4 maxnew = tex2D( _E, i.uv ); - - float4 denom = maxold - minold; - if(denom.x == 0) - denom.x = 0.000001; - if(denom.y == 0) - denom.y = 0.000001; - if(denom.z == 0) - denom.z = 0.000001; - if(denom.w == 0) - denom.w = 0.000001; - - return (minnew + (value - minold) * (maxnew - minnew) / denom); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCRemap.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCRemap.shader.meta deleted file mode 100644 index 8ebceb4a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TFHCRemap.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 72dd1cbea889fa047b929d5191e360c0 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TanOpNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TanOpNode.shader deleted file mode 100644 index 475be371..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TanOpNode.shader +++ /dev/null @@ -1,25 +0,0 @@ -Shader "Hidden/TanOpNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag(v2f_img i) : SV_Target - { - return tan(tex2D( _A, i.uv )); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TanOpNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TanOpNode.shader.meta deleted file mode 100644 index f7a22d2c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TanOpNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 312e291832cac5749a3626547dfc8607 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TangentSignVertexDataNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TangentSignVertexDataNode.shader deleted file mode 100644 index c84d7f2f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TangentSignVertexDataNode.shader +++ /dev/null @@ -1,31 +0,0 @@ -Shader "Hidden/TangentVertexDataNode" -{ - SubShader - { - Pass - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - #include "UnityCG.cginc" - - float4 frag( v2f_img i ) : SV_Target - { - //float2 tp = 2 * i.uv - 1; - //float tr = sqrt( dot(tp,tp) ); - //tr = saturate( tr ); - - //float2 tuvs; - //float f = ( 1 - sqrt( 1 - tr ) ) / tr; - - //float3 tangent = normalize(float3( (1-f)*2, tp.y*0.01, tp.x )); - - //float4((tangent), 1); - - //TODO: needs revision at some point - return -1; - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TangentSignVertexDataNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TangentSignVertexDataNode.shader.meta deleted file mode 100644 index 15b2740c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TangentSignVertexDataNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: f5466d126f4bb1f49917eac88b1cb6af -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TangentVertexDataNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TangentVertexDataNode.shader deleted file mode 100644 index e465eaf2..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TangentVertexDataNode.shader +++ /dev/null @@ -1,22 +0,0 @@ -Shader "Hidden/TangentVertexDataNode" -{ - SubShader - { - Pass - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - #include "UnityCG.cginc" - - float4 frag( v2f_img i ) : SV_Target - { - float2 xy = 2 * i.uv - 1; - float z = -sqrt(1-saturate(dot(xy,xy))); - float3 tangent = normalize(float3( -z, xy.y*0.01, xy.x )); - return float4((tangent), 1); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TangentVertexDataNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TangentVertexDataNode.shader.meta deleted file mode 100644 index f3c7c387..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TangentVertexDataNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 0a44bb521d06d6143a4acbc3602037f8 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TanhOpNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TanhOpNode.shader deleted file mode 100644 index f4c54f82..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TanhOpNode.shader +++ /dev/null @@ -1,25 +0,0 @@ -Shader "Hidden/TanhOpNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag(v2f_img i) : SV_Target - { - return tanh(tex2D( _A, i.uv )); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TanhOpNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TanhOpNode.shader.meta deleted file mode 100644 index b3565b6b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TanhOpNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 52f78d3a1c66d1c489cd63b0a9300b38 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TauNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TauNode.shader deleted file mode 100644 index 4bd66c51..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TauNode.shader +++ /dev/null @@ -1,19 +0,0 @@ -Shader "Hidden/TauNode" -{ - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - float4 frag(v2f_img i) : SV_Target - { - return UNITY_PI * 2; - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TauNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TauNode.shader.meta deleted file mode 100644 index e46f21a7..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TauNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 701bc295c0d75d8429eabcf45e8e008d -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TemplateShaderProperty.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TemplateShaderProperty.shader deleted file mode 100644 index 9285b9b8..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TemplateShaderProperty.shader +++ /dev/null @@ -1,47 +0,0 @@ -Shader "Hidden/TemplateShaderProperty" -{ - Properties - { - [HideFromInspector]_IntData ( "_IntData", Int ) = 0 - [HideFromInspector]_FloatData ( "_FloatData", Float ) = 0 - [HideFromInspector]_VectorData ( "_VectorData", Vector ) = ( 0,0,0,0 ) - [HideFromInspector]_Sampler2DData ( "_Sampler2DData", 2D ) = "white" {} - [HideFromInspector]_Sampler3DData ( "_Sampler3DData", 3D ) = "white" {} - [HideFromInspector]_SamplerCubeData ( "_SamplerCubeData", Cube ) = "white" {} - } - - CGINCLUDE - #include "UnityCG.cginc" - uniform int _IntData; - uniform float _FloatData; - uniform float4 _VectorData; - uniform sampler2D _Sampler2DData; - uniform sampler3D _Sampler3DData; - uniform samplerCUBE _SamplerCubeData; - - #pragma vertex vert_img - #pragma fragment frag - - float4 CalculatePreviewColor ( v2f_img i, const int dataType ) - { - /*Int*/ if ( dataType == 0 ) return float4( _IntData.xxx,1); - /*Float*/ if ( dataType == 1 ) return float4( _FloatData.xxx, 1 ); - /*Vector4/Color*/ if ( dataType == 2 ) return _VectorData; - /*Sampler 2D*/ if ( dataType == 3 ) return tex2D ( _Sampler2DData, i.uv ); - /*Sampler 3D*/ if ( dataType == 4 ) return tex3D ( _Sampler3DData, float3( i.uv, 0.0 ) ); - /*Sampler Cube*/ if ( dataType == 5 ) return texCUBE ( _SamplerCubeData, float3( i.uv, 0.0 ) ); - return (0).xxxx; - } - - ENDCG - - SubShader - { - Pass{ CGPROGRAM float4 frag ( v2f_img i ) : SV_Target { return CalculatePreviewColor(i,0); } ENDCG } - Pass{ CGPROGRAM float4 frag ( v2f_img i ) : SV_Target { return CalculatePreviewColor(i,1); } ENDCG } - Pass{ CGPROGRAM float4 frag ( v2f_img i ) : SV_Target { return CalculatePreviewColor(i,2); } ENDCG } - Pass{ CGPROGRAM float4 frag ( v2f_img i ) : SV_Target { return CalculatePreviewColor(i,3); } ENDCG } - Pass{ CGPROGRAM float4 frag ( v2f_img i ) : SV_Target { return CalculatePreviewColor(i,4); } ENDCG } - Pass{ CGPROGRAM float4 frag ( v2f_img i ) : SV_Target { return CalculatePreviewColor(i,5); } ENDCG } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TemplateShaderProperty.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TemplateShaderProperty.shader.meta deleted file mode 100644 index 4a4090d5..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TemplateShaderProperty.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 4feb2016be0ece148b8bf234508f6aa4 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TexCoordVertexDataNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TexCoordVertexDataNode.shader deleted file mode 100644 index e03aca73..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TexCoordVertexDataNode.shader +++ /dev/null @@ -1,19 +0,0 @@ -Shader "Hidden/TexCoordVertexDataNode" -{ - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - float4 frag( v2f_img i ) : SV_Target - { - return float4( i.uv, 0, 0 ); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TexCoordVertexDataNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TexCoordVertexDataNode.shader.meta deleted file mode 100644 index 01ddea9f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TexCoordVertexDataNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 6c1bee77276896041bbb73b1b9e7f8ac -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TexelSize.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TexelSize.shader deleted file mode 100644 index b3e43ff4..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TexelSize.shader +++ /dev/null @@ -1,80 +0,0 @@ -Shader "Hidden/TexelSize" -{ - Properties - { - _Sampler ("_Sampler", 2D) = "white" {} - _Sampler3D ("_Sampler3D", 3D) = "white" {} - _Array ("_Array", 2DArray) = "white" {} - _Cube ("_Cube", CUBE) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _Sampler; - float4 _Sampler_TexelSize; - - float4 frag( v2f_img i ) : SV_Target - { - return _Sampler_TexelSize; - } - ENDCG - } - - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler3D _Sampler3D; - float4 _Sampler3D_TexelSize; - - float4 frag (v2f_img i) : SV_Target - { - return _Sampler3D_TexelSize; - } - ENDCG - } - - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - UNITY_DECLARE_TEX2DARRAY (_Array); - float4 _Array_TexelSize; - - float4 frag (v2f_img i) : SV_Target - { - return _Array_TexelSize; - } - ENDCG - } - - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - samplerCUBE _Cube; - float4 _Cube_TexelSize; - - float4 frag (v2f_img i) : SV_Target - { - return _Cube_TexelSize; - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TexelSize.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TexelSize.shader.meta deleted file mode 100644 index b4773e81..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TexelSize.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 6b20226576a059443b58aa2d0b942276 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Texture2D.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Texture2D.shader deleted file mode 100644 index b1f48be2..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Texture2D.shader +++ /dev/null @@ -1,19 +0,0 @@ -Shader "Hidden/Texture2D" -{ - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - float4 frag( v2f_img i ) : SV_Target - { - return 0; - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Texture2D.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Texture2D.shader.meta deleted file mode 100644 index 92979229..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Texture2D.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 13bd295c44d04e1419f20f792d331e33 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TextureArrayNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TextureArrayNode.shader deleted file mode 100644 index 9b9c8bec..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TextureArrayNode.shader +++ /dev/null @@ -1,63 +0,0 @@ -Shader "Hidden/TextureArrayNode" -{ - Properties - { - _A ("_UVs", 2D) = "white" {} - _B ("_Index", 2D) = "white" {} - _C ("_Lod", 2D) = "white" {} - _D ("_NormalScale", 2D) = "white" {} - _G ("_Tex", 2D) = "white" {} - _TexConnected ("_TexConnected", Int) = 0 - } - SubShader - { - Pass - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - #pragma target 3.5 - #include "UnityCG.cginc" - #include "UnityStandardUtils.cginc" - - uniform UNITY_DECLARE_TEX2DARRAY( _Sampler ); - sampler2D _A; - sampler2D _B; - sampler2D _C; - sampler2D _D; - sampler2D _G; - float _CustomUVs; - float _LodType; - float _Unpack; - int _TexConnected; - - float4 frag( v2f_img i ) : SV_Target - { - float2 uvs = i.uv; - if ( _CustomUVs == 1 ) - uvs = tex2D( _A, i.uv ).xy; - - float n = tex2D( _D, i.uv ).r; - float4 c = 0; - if ( _LodType == 1 ) { - float lod = tex2D( _C, i.uv ).r; - c = UNITY_SAMPLE_TEX2DARRAY_LOD( _Sampler, float3( uvs, tex2D( _B, i.uv ).r ), lod ); - } - else if( _TexConnected == 0) { - c = UNITY_SAMPLE_TEX2DARRAY( _Sampler, float3( uvs, tex2D( _B, i.uv ).r ) ); - } - else { - c = tex2D( _G, uvs ); - } - - if ( _Unpack == 1 ) - { - c.rgb = UnpackScaleNormal(c, n); - } - - return c; - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TextureArrayNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TextureArrayNode.shader.meta deleted file mode 100644 index 936540b3..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TextureArrayNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 2e6d093df2d289f47b827b36efb31a81 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TextureCoordinatesNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TextureCoordinatesNode.shader deleted file mode 100644 index aaa78e0b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TextureCoordinatesNode.shader +++ /dev/null @@ -1,29 +0,0 @@ -Shader "Hidden/TextureCoordinatesNode" -{ - Properties - { - _A ("_Tilling", 2D) = "white" {} - _B ("_Offset", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - - float4 frag( v2f_img i ) : SV_Target - { - float4 t = tex2D( _A, i.uv ); - float4 o = tex2D( _B, i.uv ); - return float4( i.uv * t.xy + o.xy, 0, 0 ); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TextureCoordinatesNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TextureCoordinatesNode.shader.meta deleted file mode 100644 index 656fedd4..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TextureCoordinatesNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 085e462b2de441a42949be0e666cf5d2 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TexturePropertyNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TexturePropertyNode.shader deleted file mode 100644 index 28079d64..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TexturePropertyNode.shader +++ /dev/null @@ -1,84 +0,0 @@ -Shader "Hidden/TexturePropertyNode" -{ - Properties - { - _Sampler ("_Sampler", 2D) = "white" {} - _Sampler3D ("_Sampler3D", 3D) = "white" {} - _Array ("_Array", 2DArray) = "white" {} - _Cube( "_Cube", CUBE) = "white" {} - _Default ("_Default", Int) = 0 - _Type ("_Type", Int) = 0 - } - SubShader - { - Pass - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - #pragma exclude_renderers d3d9 - #pragma target 3.5 - #include "UnityCG.cginc" - int _Default; - float4 frag( v2f_img i ) : SV_Target - { - if(_Default == 1) - { - return 1; - } - else if(_Default == 2) - { - return 0; - } - else if(_Default == 3) - { - return 0.5f; - } - else if(_Default == 4) - { - return float4(0.5,0.5,1,1); - } - - return 1; - } - ENDCG - } - - Pass - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - #pragma exclude_renderers d3d9 - #pragma target 3.5 - #include "UnityCG.cginc" - - UNITY_DECLARE_TEX2DARRAY (_Array); - samplerCUBE _Cube; - sampler2D _Sampler; - sampler3D _Sampler3D; - int _Type; - - float4 frag (v2f_img i) : SV_Target - { - if (_Type == 4) - { - return UNITY_SAMPLE_TEX2DARRAY (_Array, float3(i.uv, 0)); - } - else if (_Type == 3) - { - return texCUBE (_Cube, float3(i.uv,0)); - } - else if (_Type == 2) - { - return tex3D (_Sampler3D, float3(i.uv,0)); - } - else - { - return tex2D (_Sampler, i.uv); - } - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TexturePropertyNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TexturePropertyNode.shader.meta deleted file mode 100644 index c2ac2c0e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TexturePropertyNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: e53988745ec6e034694ee2640cd3d372 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TextureTransform.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TextureTransform.shader deleted file mode 100644 index 55adec1b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TextureTransform.shader +++ /dev/null @@ -1,87 +0,0 @@ -Shader "Hidden/TextureTransform" -{ - Properties - { - _Sampler ("_Sampler", 2D) = "white" {} - _Sampler3D ("_Sampler3D", 3D) = "white" {} - _Array ("_Array", 2DArray) = "white" {} - _Cube ("_Cube", CUBE) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - int _PreviewID = 0; - sampler2D _Sampler; - float4 _Sampler_ST; - - float4 frag( v2f_img i ) : SV_Target - { - return _PreviewID == 0?float4(_Sampler_ST.xy,0,0): float4(_Sampler_ST.zw,0,0); - } - ENDCG - } - - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - int _PreviewID = 0; - sampler3D _Sampler3D; - float4 _Sampler3D_ST; - - float4 frag (v2f_img i) : SV_Target - { - return _Sampler3D_ST; - return _PreviewID == 0 ? float4(_Sampler3D_ST.xy, 0, 0) : float4(_Sampler3D_ST.zw, 0, 0); - } - ENDCG - } - - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - int _PreviewID = 0; - UNITY_DECLARE_TEX2DARRAY (_Array); - float4 _Array_ST; - - float4 frag (v2f_img i) : SV_Target - { - return _Array_ST; - return _PreviewID == 0 ? float4(_Array_ST.xy, 0, 0) : float4(_Array_ST.zw, 0, 0); - } - ENDCG - } - - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - int _PreviewID = 0; - samplerCUBE _Cube; - float4 _Cube_ST; - - float4 frag (v2f_img i) : SV_Target - { - return _Cube_ST; - return _PreviewID == 0 ? float4(_Cube_ST.xy, 0, 0) : float4(_Cube_ST.zw, 0, 0); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TextureTransform.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TextureTransform.shader.meta deleted file mode 100644 index 6d5bc4e4..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TextureTransform.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 25ba2903568b00343ae06788994cab54 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TimeNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TimeNode.shader deleted file mode 100644 index 7a5fc9ef..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TimeNode.shader +++ /dev/null @@ -1,25 +0,0 @@ -Shader "Hidden/TimeNode" -{ - SubShader - { - Pass - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - #include "UnityCG.cginc" - - float _EditorTime; - - float4 frag( v2f_img i ) : SV_Target - { - float4 t = _EditorTime; - t.x = _EditorTime / 20; - t.z = _EditorTime * 2; - t.w = _EditorTime * 3; - return t; - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TimeNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TimeNode.shader.meta deleted file mode 100644 index 43a36984..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TimeNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 73abc10c8d1399444827a7eeb9c24c2a -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ToggleSwitchNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ToggleSwitchNode.shader deleted file mode 100644 index e9d0eec4..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ToggleSwitchNode.shader +++ /dev/null @@ -1,30 +0,0 @@ -Shader "Hidden/ToggleSwitchNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - _B ("_B", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - sampler2D _B; - float _Current; - - float4 frag( v2f_img i ) : SV_Target - { - float4 a = tex2D( _A, i.uv ); - float4 b = tex2D( _B, i.uv ); - return lerp(a,b,_Current); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ToggleSwitchNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ToggleSwitchNode.shader.meta deleted file mode 100644 index a6c388c0..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ToggleSwitchNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: beeb138daeb592a4887454f81dba2b3f -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TriplanarNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TriplanarNode.shader deleted file mode 100644 index b5fc2b69..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TriplanarNode.shader +++ /dev/null @@ -1,103 +0,0 @@ -Shader "Hidden/TriplanarNode" -{ - Properties - { - _A ("_TopTex", 2D) = "white" {} - _B ("_MidTex", 2D) = "white" {} - _C ("_BotTex", 2D) = "white" {} - _D ("_Tilling", 2D) = "white" {} - _E ("_Falloff", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - #pragma target 3.0 - #include "UnityCG.cginc" - #include "UnityStandardUtils.cginc" - - sampler2D _A; - sampler2D _B; - sampler2D _C; - sampler2D _D; - sampler2D _E; - float _IsNormal; - float _IsSpherical; - - inline float3 TriplanarSamplingCNF( sampler2D topTexMap, sampler2D midTexMap, sampler2D botTexMap, float3 worldPos, float3 worldNormal, float falloff, float tilling ) - { - float3 projNormal = ( pow( abs( worldNormal ), falloff ) ); - projNormal /= projNormal.x + projNormal.y + projNormal.z; - float3 nsign = sign( worldNormal ); - float negProjNormalY = max( 0, projNormal.y * -nsign.y ); - projNormal.y = max( 0, projNormal.y * nsign.y ); - half4 xNorm; half4 yNorm; half4 yNormN; half4 zNorm; - xNorm = ( tex2D( midTexMap, tilling * worldPos.zy * float2( nsign.x, 1.0 ) ) ); - yNorm = ( tex2D( topTexMap, tilling * worldPos.xz * float2( nsign.y, 1.0 ) ) ); - yNormN = ( tex2D( botTexMap, tilling * worldPos.xz * float2( nsign.y, 1.0 ) ) ); - zNorm = ( tex2D( midTexMap, tilling * worldPos.xy * float2( -nsign.z, 1.0 ) ) ); - xNorm.xyz = half3( UnpackNormal( xNorm ).xy * float2( nsign.x, 1.0 ) + worldNormal.zy, worldNormal.x ).zyx; - yNorm.xyz = half3( UnpackNormal( yNorm ).xy * float2( nsign.y, 1.0 ) + worldNormal.xz, worldNormal.y ).xzy; - zNorm.xyz = half3( UnpackNormal( zNorm ).xy * float2( -nsign.z, 1.0 ) + worldNormal.xy, worldNormal.z ).xyz; - yNormN.xyz = half3( UnpackNormal( yNormN ).xy * float2( nsign.y, 1.0 ) + worldNormal.xz, worldNormal.y ).xzy; - return normalize( xNorm.xyz * projNormal.x + yNorm.xyz * projNormal.y + yNormN.xyz * negProjNormalY + zNorm.xyz * projNormal.z ); - } - - inline float4 TriplanarSamplingCF( sampler2D topTexMap, sampler2D midTexMap, sampler2D botTexMap, float3 worldPos, float3 worldNormal, float falloff, float tilling ) - { - float3 projNormal = ( pow( abs( worldNormal ), falloff ) ); - projNormal /= projNormal.x + projNormal.y + projNormal.z; - float3 nsign = sign( worldNormal ); - float negProjNormalY = max( 0, projNormal.y * -nsign.y ); - projNormal.y = max( 0, projNormal.y * nsign.y ); - half4 xNorm; half4 yNorm; half4 yNormN; half4 zNorm; - xNorm = ( tex2D( midTexMap, tilling * worldPos.zy * float2( nsign.x, 1.0 ) ) ); - yNorm = ( tex2D( topTexMap, tilling * worldPos.xz * float2( nsign.y, 1.0 ) ) ); - yNormN = ( tex2D( botTexMap, tilling * worldPos.xz * float2( nsign.y, 1.0 ) ) ); - zNorm = ( tex2D( midTexMap, tilling * worldPos.xy * float2( -nsign.z, 1.0 ) ) ); - return xNorm * projNormal.x + yNorm * projNormal.y + yNormN * negProjNormalY + zNorm * projNormal.z; - } - - float4 frag( v2f_img i ) : SV_Target - { - float2 xy = 2 * i.uv - 1; - float z = -sqrt(1-saturate(dot(xy,xy))); - float3 vertexPos = float3(xy, z); - float3 normal = normalize(vertexPos); - float3 worldNormal = UnityObjectToWorldNormal(normal); - float3 worldPos = mul(unity_ObjectToWorld, vertexPos).xyz; - - float falloff = tex2D( _E, xy ).r; - float tilling = tex2D( _D, xy ).r * 0.625; - float4 triplanar = 1; - - if ( _IsNormal == 1 ) { - float3 tangent = normalize(float3( -z, xy.y*0.01, xy.x )); - float3 worldTangent = UnityObjectToWorldDir(tangent); - float tangentSign = -1; - float3 worldBinormal = normalize( cross(worldNormal, worldTangent) * tangentSign); - float3x3 worldToTangent = float3x3( worldTangent, worldBinormal, worldNormal ); - if ( _IsSpherical == 1 ) - triplanar.xyz = TriplanarSamplingCNF( _A, _A, _A, worldPos, worldNormal, falloff, tilling ); - else - triplanar.xyz = TriplanarSamplingCNF( _A, _B, _C, worldPos, worldNormal, falloff, tilling ); - - triplanar.xyz = mul( worldToTangent, triplanar.xyz ); - } - else - { - if ( _IsSpherical == 1 ) - triplanar = TriplanarSamplingCF( _A, _A, _A, worldPos, worldNormal, falloff, tilling ); - else - triplanar = TriplanarSamplingCF( _A, _B, _C, worldPos, worldNormal, falloff, tilling ); - } - - return triplanar; - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TriplanarNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TriplanarNode.shader.meta deleted file mode 100644 index d990502b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TriplanarNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 8723015ec59743143aadfbe480e34391 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TruncOpNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TruncOpNode.shader deleted file mode 100644 index 31b23c11..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TruncOpNode.shader +++ /dev/null @@ -1,25 +0,0 @@ -Shader "Hidden/TruncOpNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag(v2f_img i) : SV_Target - { - return trunc(tex2D( _A, i.uv )); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TruncOpNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TruncOpNode.shader.meta deleted file mode 100644 index 40189d21..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_TruncOpNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: c717aaa68f4ac9e469b15763e82933e1 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_UnpackScaleNormalNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_UnpackScaleNormalNode.shader deleted file mode 100644 index 72e2fcf6..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_UnpackScaleNormalNode.shader +++ /dev/null @@ -1,33 +0,0 @@ -Shader "Hidden/UnpackScaleNormalNode" -{ - Properties - { - _A ("_Value", 2D) = "white" {} - _B ("_NormalScale", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - #pragma target 3.0 - #include "UnityCG.cginc" - #include "UnityStandardUtils.cginc" - - sampler2D _A; - sampler2D _B; - - float4 frag( v2f_img i ) : SV_Target - { - float4 c = tex2D( _A, i.uv ); - float n = tex2D( _B, i.uv ).r; - c.rgb = UnpackScaleNormal( c, n ); - - return float4(c.rgb, 0); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_UnpackScaleNormalNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_UnpackScaleNormalNode.shader.meta deleted file mode 100644 index 7cf87f1e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_UnpackScaleNormalNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 8b0ae05e25d280c45af81ded56f8012e -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Vector2Node.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Vector2Node.shader deleted file mode 100644 index 4edf77fe..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Vector2Node.shader +++ /dev/null @@ -1,24 +0,0 @@ -Shader "Hidden/Vector2Node" -{ - Properties { - _InputVector ("_InputVector", Vector) = (0,0,0,0) - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - float4 _InputVector; - - float4 frag( v2f_img i ) : SV_Target - { - return float4(_InputVector.x,_InputVector.y,0,0); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Vector2Node.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Vector2Node.shader.meta deleted file mode 100644 index b9e7d39e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Vector2Node.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 88b4191eb06084d4da85d1dd2f984085 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Vector3Node.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Vector3Node.shader deleted file mode 100644 index 299f3adb..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Vector3Node.shader +++ /dev/null @@ -1,24 +0,0 @@ -Shader "Hidden/Vector3Node" -{ - Properties { - _InputVector ("_InputVector", Vector) = (0,0,0,0) - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - float4 _InputVector; - - float4 frag( v2f_img i ) : SV_Target - { - return float4(_InputVector.x,_InputVector.y,_InputVector.z,0); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Vector3Node.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Vector3Node.shader.meta deleted file mode 100644 index 677eadca..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Vector3Node.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 8a44d38f06246bf48944b3f314bc7920 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Vector4Node.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Vector4Node.shader deleted file mode 100644 index 044be7a4..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Vector4Node.shader +++ /dev/null @@ -1,24 +0,0 @@ -Shader "Hidden/Vector4Node" -{ - Properties { - _InputVector ("_InputVector", Vector) = (0,0,0,0) - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - float4 _InputVector; - - float4 frag( v2f_img i ) : SV_Target - { - return _InputVector; - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Vector4Node.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Vector4Node.shader.meta deleted file mode 100644 index e90efaf2..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_Vector4Node.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: aac241d0e47a5a84fbd2edcd640788dc -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexBinormalNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexBinormalNode.shader deleted file mode 100644 index f54cf44b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexBinormalNode.shader +++ /dev/null @@ -1,31 +0,0 @@ -Shader "Hidden/VertexBinormalNode" -{ - SubShader - { - Pass - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - #include "UnityCG.cginc" - - float4 frag( v2f_img i ) : SV_Target - { - float2 xy = 2 * i.uv - 1; - float z = -sqrt(1-saturate(dot(xy,xy))); - float3 vertexPos = float3(xy, z); - float3 normal = normalize(vertexPos); - float3 worldNormal = UnityObjectToWorldNormal(normal); - - float3 tangent = normalize(float3( -z, xy.y*0.01, xy.x )); - float3 worldPos = mul(unity_ObjectToWorld, vertexPos).xyz; - float3 worldTangent = UnityObjectToWorldDir(tangent); - float tangentSign = -1; - float3 worldBinormal = normalize( cross(worldNormal, worldTangent) * tangentSign); - - return float4(worldBinormal, 1); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexBinormalNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexBinormalNode.shader.meta deleted file mode 100644 index ec27e263..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexBinormalNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 76873532ab67d2947beaf07151383cbe -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexColorNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexColorNode.shader deleted file mode 100644 index 99b62ca8..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexColorNode.shader +++ /dev/null @@ -1,19 +0,0 @@ -Shader "Hidden/VertexColorNode" -{ - SubShader - { - Pass - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - #include "UnityCG.cginc" - - float4 frag( v2f_img i ) : SV_Target - { - return 1; - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexColorNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexColorNode.shader.meta deleted file mode 100644 index 0ac109c2..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexColorNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: ca1d22db6470c5f4d9f93a9873b4f5bc -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexIdVariableNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexIdVariableNode.shader deleted file mode 100644 index a3ef76f5..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexIdVariableNode.shader +++ /dev/null @@ -1,39 +0,0 @@ -Shader "Hidden/VertexIdVariableNode" -{ - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert - #pragma fragment frag - - struct appdata_custom - { - float4 vertex : POSITION; - uint vertexId : SV_VertexID; - }; - - struct v2f_custom - { - float4 pos : SV_POSITION; - half vertexId : TEXCOORD0; - }; - - v2f_custom vert( appdata_custom v ) - { - v2f_custom o; - o.pos = UnityObjectToClipPos (v.vertex); - o.vertexId = v.vertexId; - return o; - } - - float4 frag( v2f_custom i ) : SV_Target - { - return i.vertexId; - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexIdVariableNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexIdVariableNode.shader.meta deleted file mode 100644 index e7ac67a5..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexIdVariableNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 5934bf2c10b127a459177a3b622cea65 -timeCreated: 1542641929 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexTangentNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexTangentNode.shader deleted file mode 100644 index 3769192e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexTangentNode.shader +++ /dev/null @@ -1,31 +0,0 @@ -Shader "Hidden/VertexTangentNode" -{ - SubShader - { - Pass - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - #include "UnityCG.cginc" - - float4 frag( v2f_img i ) : SV_Target - { - float2 tp = 2 * i.uv - 1; - float tr = sqrt( dot(tp,tp) ); - tr = saturate( tr ); - //if ( tr < 1 ) { - float2 tuvs; - float f = ( 1 - sqrt( 1 - tr ) ) / tr; - - float3 tangent = normalize(float3( (1-f)*2, tp.y*0.01, tp.x )); - return float4((tangent), 1); - //} - //else { - // return 0; - //} - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexTangentNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexTangentNode.shader.meta deleted file mode 100644 index 93c49b13..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VertexTangentNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 61f0b80493c9b404d8c7bf56d59c3f81 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ViewDirInputsCoordNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ViewDirInputsCoordNode.shader deleted file mode 100644 index 7bf6d619..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ViewDirInputsCoordNode.shader +++ /dev/null @@ -1,57 +0,0 @@ -Shader "Hidden/WorldPosInputsNode" -{ - SubShader - { - Pass //world space - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - float4 frag(v2f_img i) : SV_Target - { - float2 xy = 2 * i.uv - 1; - float z = -sqrt(1-saturate(dot(xy,xy))); - float3 vertexPos = float3(xy, z); - float3 worldViewDir = normalize(float3(0,0,-5) - vertexPos); - - return float4(worldViewDir, 1); - } - ENDCG - } - - Pass //tangent space - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - float4 frag(v2f_img i) : SV_Target - { - float2 xy = 2 * i.uv - 1; - float z = -sqrt(1-saturate(dot(xy,xy))); - float3 vertexPos = float3(xy, z); - float3 worldViewDir = normalize(float3(0,0,-5) - vertexPos); - - float3 normal = normalize(vertexPos); - float3 worldNormal = UnityObjectToWorldNormal(normal); - - float3 tangent = normalize(float3( -z, xy.y*0.01, xy.x )); - float3 worldPos = mul(unity_ObjectToWorld, float4(vertexPos,1)).xyz; - float3 worldTangent = UnityObjectToWorldDir(tangent); - float tangentSign = -1; - float3 worldBinormal = normalize( cross(worldNormal, worldTangent) * tangentSign); - float4 tSpace0 = float4(worldTangent.x, worldBinormal.x, worldNormal.x, worldPos.x); - float4 tSpace1 = float4(worldTangent.y, worldBinormal.y, worldNormal.y, worldPos.y); - float4 tSpace2 = float4(worldTangent.z, worldBinormal.z, worldNormal.z, worldPos.z); - - fixed3 viewDirTan = tSpace0.xyz * worldViewDir.x + tSpace1.xyz * worldViewDir.y + tSpace2.xyz * worldViewDir.z; - - return float4(viewDirTan, 1); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ViewDirInputsCoordNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ViewDirInputsCoordNode.shader.meta deleted file mode 100644 index 6fdc1d17..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ViewDirInputsCoordNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 07b57d9823df4bd4d8fe6dcb29fca36a -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VoronoiNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VoronoiNode.shader deleted file mode 100644 index 81543702..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VoronoiNode.shader +++ /dev/null @@ -1,251 +0,0 @@ -Shader "Hidden/VoronoiNode" -{ - Properties - { - _A("_RGB", 2D) = "white" {} - _B("_RGB", 2D) = "white" {} - _C("_RGB", 2D) = "white" {} - _D ("_RGB", 2D) = "white" {} - _UseTileScale("_UseTileScale", Float) = 0 - _TileScale ("_TileScale", Int) = 1 - _MinkowskiPower("_MinkowskiPower", Float) = 0 - _DistFunc("_DistFunc", Int) = 0 - _MethodType("_MethodType", Int) = 0 - _SearchQuality("_SearchQuality", Int) = 1 - _Octaves("_Octaves", Int) = 1 - _UseSmoothness("_UseSmoothness", Int ) = 0 - } - SubShader - { - Tags { "RenderType"="Opaque" } - CGINCLUDE - sampler2D _A; - sampler2D _B; - sampler2D _C; - sampler2D _D; - float _UseTileScale = 0; - int _TileScale = 1; - float _MinkowskiPower = 1; - int _DistFunc = 0; - int _MethodType = 0; - int _SearchQuality = 0; - int _Octaves = 1; - int _PreviewID = 0; - int _UseSmoothness = 0; - - float2 VoronoiHash( float2 p ) - { - p = lerp( p, p - _TileScale * floor (p / _TileScale), _UseTileScale ); - p = float2(dot (p, float2(127.1, 311.7)), dot (p, float2(269.5, 183.3))); - return frac (sin (p) *43758.5453); - } - - float Voronoi( float2 v, float time, inout float2 id , float smoothness ) - { - float2 n = floor(v); - float2 f = frac(v); - float F1 = 8.0; - float F2 = 8.0; - float2 mr = 0; - float2 mg = 0; - for (int j = -_SearchQuality; j <= _SearchQuality; j++) - { - for (int i = -_SearchQuality; i <= _SearchQuality; i++) - { - float2 g = float2(i, j); - float2 o = VoronoiHash (n + g); - o = (sin (time + o * 6.2831) * 0.5 + 0.5); float2 r = g - f + o; - float d = 0; - //Euclidean^2 - if (_DistFunc == 0) - { - d = 0.5 * dot (r, r); - } - //Euclidean - else if (_DistFunc == 1) - { - d = 0.707 * sqrt (dot (r, r)); - } - //Manhattan - else if (_DistFunc == 2) - { - d = 0.5 * (abs (r.x) + abs (r.y)); - } - //Chebyshev - else if (_DistFunc == 3) - { - d = max (abs (r.x), abs (r.y)); - } - //Minkowski - else if (_DistFunc == 4) - { - d = (1 / pow(2, 1 / _MinkowskiPower)) * pow( ( pow( abs( r.x ), _MinkowskiPower) + pow( abs( r.y ), _MinkowskiPower) ), (1 / _MinkowskiPower)); - } - - if (_MethodType == 0 && _UseSmoothness == 1) - { - float h = smoothstep (0.0, 1.0, 0.5 + 0.5 * (F1 - d) / smoothness); - F1 = lerp (F1, d, h) - smoothness * h * (1.0 - h); - mg = g; mr = r; id = o; - } - else - { - if (d < F1) - { - F2 = F1; - F1 = d; mg = g; mr = r; id = o; - } - else if (d < F2) - { - F2 = d; - } - - } - - } - } - - //Cells - if(_MethodType == 0) - { - return F1; - } - //Crystal - else if (_MethodType == 1) - { - return F2; - } - //Glass - else if (_MethodType == 2) - { - return F2 - F1; - } - //Caustic - else if (_MethodType == 3) - { - return (F2 + F1) * 0.5; - } - //Distance - else if (_MethodType == 4) - { - F1 = 8.0; - for (int j = -2; j <= 2; j++) - { - for (int i = -2; i <= 2; i++) - { - float2 g = mg + float2(i, j); - float2 o = VoronoiHash (n + g); - o = ( sin (time + o * 6.2831) * 0.5 + 0.5); - float2 r = g - f + o; - float d = dot (0.5 * (mr + r), normalize (r - mr)); - F1 = min (F1, d); - } - } - return F1; - } - else - return F1; - } - - - ENDCG - - Pass // Voronoi - Unity - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - inline float2 UnityVoronoiRandomVector (float2 UV, float offset) - { - float2x2 m = float2x2(15.27, 47.63, 99.41, 89.98); - UV = frac (sin (mul (UV, m)) * 46839.32); - return float2(sin (UV.y* +offset) * 0.5 + 0.5, cos (UV.x* offset) * 0.5 + 0.5); - } - - //x - Out y - Cells - float3 UnityVoronoi (float2 UV, float AngleOffset, float CellDensity) - { - float2 g = floor (UV * CellDensity); - float2 f = frac (UV * CellDensity); - float t = 8.0; - float3 res = float3(8.0, 0.0, 0.0); - - for (int y = -1; y <= 1; y++) - { - for (int x = -1; x <= 1; x++) - { - float2 lattice = float2(x, y); - float2 offset = UnityVoronoiRandomVector (lattice + g, AngleOffset); - float d = distance (lattice + offset, f); - - if (d < res.x) - { - res = float3(d, offset.x, offset.y); - } - } - } - return res; - } - - float4 frag (v2f_img i) : SV_Target - { - float2 uvValue = tex2D(_A, i.uv).rg; - float angleOffset = tex2D(_B, i.uv).r; - float cellDensity = tex2D(_C, i.uv).r; - float3 voronoiVal = UnityVoronoi( uvValue, angleOffset , cellDensity ); - if( _PreviewID == 1 ) - return float4( voronoiVal.yz, 0, 1 ); - else - return float4( voronoiVal.xxx, 1); - } - ENDCG - } - - Pass // Voronoi - ASE - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - float4 frag (v2f_img i) : SV_Target - { - float2 uvValue = tex2D (_A, i.uv).rg; - float time = tex2D (_B, i.uv).r; - float scale = tex2D (_C, i.uv).r; - float smoothness = tex2D (_D, i.uv).r; - - float2 id = 0; - float voronoiVal = Voronoi( uvValue*scale,time, id, smoothness ); - if (_Octaves == 1) - { - if( _PreviewID == 1) - return float4( id, 0, 1 ); - else - return float4(voronoiVal.xxx, 1); - } - else - { - float fade = 0.5; - float voroi = 0; - float rest = 0; - for (int it = 0; it < _Octaves; it++) - { - voroi += fade * Voronoi( uvValue*scale, time, id, smoothness); - rest += fade; - uvValue *= 2; - fade *= 0.5; - } - voroi /= rest; - if( _PreviewID == 1 ) - return float4( id, 0, 1 ); - else - return float4(voroi.xxx, 1); - } - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VoronoiNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VoronoiNode.shader.meta deleted file mode 100644 index 420e71ca..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_VoronoiNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: bc1498ccdade442479038b24982fc946 -timeCreated: 1566905239 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WeightedBlendNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WeightedBlendNode.shader deleted file mode 100644 index e0a46b51..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WeightedBlendNode.shader +++ /dev/null @@ -1,84 +0,0 @@ -Shader "Hidden/WeightedBlendNode" -{ - Properties - { - _A ( "_Weights", 2D) = "white" {} - _B ( "_Layer1", 2D) = "white" {} - _C ( "_Layer2", 2D ) = "white" {} - _D ( "_Layer3", 2D ) = "white" {} - _E ( "_Layer4", 2D ) = "white" {} - } - - SubShader - { - - CGINCLUDE - - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - sampler2D _A; - sampler2D _B; - - ENDCG - - Pass - { - CGPROGRAM - float4 frag(v2f_img i) : SV_Target - { - float4 Layer1 = tex2D( _B, i.uv ); - return Layer1; - } - ENDCG - } - - Pass - { - CGPROGRAM - sampler2D _C; - float4 frag ( v2f_img i ) : SV_Target - { - float4 Weights = tex2D ( _A, i.uv ); - float4 Layer1 = tex2D ( _B, i.uv ); - float4 Layer2 = tex2D ( _C, i.uv ); - return ( Weights.x*Layer1 + Weights.y*Layer2 ) / ( Weights.x + Weights.y ); - } - ENDCG - } - - Pass - { - CGPROGRAM - sampler2D _C; - sampler2D _D; - float4 frag ( v2f_img i ) : SV_Target - { - float4 Weights = tex2D( _A, i.uv ); - float4 Layer1 = tex2D( _B, i.uv ); - float4 Layer2 = tex2D( _C, i.uv ); - float4 Layer3 = tex2D( _D, i.uv ); - return ( Weights.x*Layer1 + Weights.y*Layer2 + Weights.z*Layer3 ) / ( Weights.x + Weights.y + Weights.z ); - } - ENDCG - } - - Pass - { - CGPROGRAM - sampler2D _C; - sampler2D _D; - sampler2D _E; - float4 frag ( v2f_img i ) : SV_Target - { - float4 Weights = tex2D ( _A, i.uv ); - float4 Layer1 = tex2D ( _B, i.uv ); - float4 Layer2 = tex2D ( _C, i.uv ); - float4 Layer3 = tex2D ( _D, i.uv ); - float4 Layer4 = tex2D ( _E, i.uv ); - return ( Weights.x*Layer1 + Weights.y*Layer2 + Weights.z*Layer3 + Weights.w*Layer4 ) / ( Weights.x + Weights.y + Weights.z + Weights.w ); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WeightedBlendNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WeightedBlendNode.shader.meta deleted file mode 100644 index 9738a46c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WeightedBlendNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 6076cbeaa41ebb14c85ff81b58df7d88 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WireNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WireNode.shader deleted file mode 100644 index 7d040599..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WireNode.shader +++ /dev/null @@ -1,25 +0,0 @@ -Shader "Hidden/WireNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag(v2f_img i) : SV_Target - { - return tex2D( _A, i.uv ); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WireNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WireNode.shader.meta deleted file mode 100644 index 255c3362..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WireNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: fa1e3e404e6b3c243b5527b82739d682 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldNormalVector.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldNormalVector.shader deleted file mode 100644 index 7a6983b8..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldNormalVector.shader +++ /dev/null @@ -1,66 +0,0 @@ -Shader "Hidden/WorldNormalVector" -{ - Properties - { - _A ("_WorldNormal", 2D) = "white" {} - } - SubShader - { - Pass //not connected - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - float4 frag(v2f_img i) : SV_Target - { - float2 xy = 2 * i.uv - 1; - float z = -sqrt(1-saturate(dot(xy,xy))); - float3 worldNormal = normalize(float3(xy, z)); - return float4(worldNormal, 1); - } - ENDCG - } - - Pass //connected - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag(v2f_img i) : SV_Target - { - float2 xy = 2 * i.uv - 1; - float z = -sqrt(1-saturate(dot(xy,xy))); - float3 vertexPos = float3(xy, z); - float3 normal = normalize(vertexPos); - float3 worldNormal = UnityObjectToWorldNormal(normal); - - float3 tangent = normalize(float3( -z, xy.y*0.01, xy.x )); - float3 worldPos = mul(unity_ObjectToWorld, float4(vertexPos,1)).xyz; - float3 worldTangent = UnityObjectToWorldDir(tangent); - float tangentSign = -1; - float3 worldBinormal = normalize( cross(worldNormal, worldTangent) * tangentSign); - float4 tSpace0 = float4(worldTangent.x, worldBinormal.x, worldNormal.x, worldPos.x); - float4 tSpace1 = float4(worldTangent.y, worldBinormal.y, worldNormal.y, worldPos.y); - float4 tSpace2 = float4(worldTangent.z, worldBinormal.z, worldNormal.z, worldPos.z); - - float2 sphereUVs = i.uv; - - sphereUVs.x = (atan2(vertexPos.x, -vertexPos.z) / (UNITY_PI) + 0.5); - // Needs further checking - //float3 tangentNormal = tex2Dlod(_A, float4(sphereUVs,0,0)).xyz; - float3 tangentNormal = tex2D(_A, sphereUVs).xyz; - - worldNormal = fixed3( dot( tSpace0.xyz, tangentNormal ), dot( tSpace1.xyz, tangentNormal ), dot( tSpace2.xyz, tangentNormal ) ); - - return float4(worldNormal, 1); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldNormalVector.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldNormalVector.shader.meta deleted file mode 100644 index dfc9ffac..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldNormalVector.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 5f55f4841abb61e45967957788593a9d -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldPosInputsNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldPosInputsNode.shader deleted file mode 100644 index c36df0f5..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldPosInputsNode.shader +++ /dev/null @@ -1,23 +0,0 @@ -Shader "Hidden/WorldPosInputsNode" -{ - SubShader - { - Pass - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - #include "UnityCG.cginc" - - float4 frag( v2f_img i ) : SV_Target - { - float2 xy = 2 * i.uv - 1; - float z = -sqrt(1-saturate(dot(xy,xy))); - float4 vertexPos = float4(xy, z,1); - float4 worldPos = mul(unity_ObjectToWorld, vertexPos); - return float4 (worldPos.xyz, 1); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldPosInputsNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldPosInputsNode.shader.meta deleted file mode 100644 index 713d2ac0..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldPosInputsNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 70d5405009b31a349a4d8285f30cf5d9 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldReflectionVector.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldReflectionVector.shader deleted file mode 100644 index e3cfb4e2..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldReflectionVector.shader +++ /dev/null @@ -1,77 +0,0 @@ -Shader "Hidden/WorldReflectionVector" -{ - Properties - { - _A ("_TangentNormal", 2D) = "white" {} - } - SubShader - { - Pass //not connected - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - #include "UnityCG.cginc" - - float4 frag(v2f_img i) : SV_Target - { - float2 xy = 2 * i.uv - 1; - float z = -sqrt(1-saturate(dot(xy,xy))); - float3 vertexPos = float3(xy, z); - float3 normal = normalize(vertexPos); - float3 worldNormal = UnityObjectToWorldNormal(normal); - - float3 worldViewDir = normalize(float3(0,0,-5) - vertexPos); - float3 worldRefl = -worldViewDir; - worldRefl = reflect( worldRefl, worldNormal ); - - return float4((worldRefl), 1); - } - ENDCG - } - - Pass //connected - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - #include "UnityCG.cginc" - - sampler2D _A; - - float4 frag(v2f_img i) : SV_Target - { - float2 xy = 2 * i.uv - 1; - float z = -sqrt(1-saturate(dot(xy,xy))); - float3 vertexPos = float3(xy, z); - float3 normal = normalize(vertexPos); - float3 worldNormal = UnityObjectToWorldNormal(normal); - - float3 tangent = normalize(float3( -z, xy.y*0.01, xy.x )); - float3 worldPos = mul(unity_ObjectToWorld, float4(vertexPos,1)).xyz; - float3 worldViewDir = normalize(float3(0,0,-5) - vertexPos); - - float3 worldTangent = UnityObjectToWorldDir(tangent); - float tangentSign = -1; - float3 worldBinormal = normalize( cross(worldNormal, worldTangent) * tangentSign); - float4 tSpace0 = float4(worldTangent.x, worldBinormal.x, worldNormal.x, worldPos.x); - float4 tSpace1 = float4(worldTangent.y, worldBinormal.y, worldNormal.y, worldPos.y); - float4 tSpace2 = float4(worldTangent.z, worldBinormal.z, worldNormal.z, worldPos.z); - - float3 worldRefl = -worldViewDir; - - float2 sphereUVs = i.uv; - sphereUVs.x = atan2(vertexPos.x, -vertexPos.z) / (UNITY_PI) + 0.5; - - // Needs further checking - //float3 tangentNormal = tex2Dlod(_A, float4(sphereUVs,0,0)).xyz; - float3 tangentNormal = tex2D(_A, sphereUVs).xyz; - - worldRefl = reflect( worldRefl, half3( dot( tSpace0.xyz, tangentNormal ), dot( tSpace1.xyz, tangentNormal ), dot( tSpace2.xyz, tangentNormal ) ) ); - - return float4((worldRefl), 1); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldReflectionVector.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldReflectionVector.shader.meta deleted file mode 100644 index 44034b50..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldReflectionVector.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 8e267e9aa545eeb418585a730f50273e -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceCameraPos.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceCameraPos.shader deleted file mode 100644 index 9f04ac18..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceCameraPos.shader +++ /dev/null @@ -1,20 +0,0 @@ -Shader "Hidden/WorldSpaceCameraPos" -{ - SubShader - { - Pass - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - #include "UnityCG.cginc" - - float4 frag( v2f_img i ) : SV_Target - { - //_WorldSpaceCameraPos - return float4(float3(0,0,-5),0); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceCameraPos.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceCameraPos.shader.meta deleted file mode 100644 index 78177cec..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceCameraPos.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 6b0c78411043dd24dac1152c84bb63ba -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceLightDirHlpNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceLightDirHlpNode.shader deleted file mode 100644 index 742e4928..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceLightDirHlpNode.shader +++ /dev/null @@ -1,22 +0,0 @@ -Shader "Hidden/WorldSpaceLightDirHlpNode" -{ - SubShader - { - Pass - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - #include "UnityCG.cginc" - - float4 _EditorWorldLightPos; - - float4 frag( v2f_img i ) : SV_Target - { - float3 lightDir = normalize( _EditorWorldLightPos.xyz ); - return float4 ( lightDir, 1); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceLightDirHlpNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceLightDirHlpNode.shader.meta deleted file mode 100644 index 10ed2757..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceLightDirHlpNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 2e8dc46eb6fb2124d9f0007caf9567e3 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceLightPosNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceLightPosNode.shader deleted file mode 100644 index 3bb5ef16..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceLightPosNode.shader +++ /dev/null @@ -1,33 +0,0 @@ -Shader "Hidden/WorldSpaceLightPosNode" -{ - SubShader - { - CGINCLUDE - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - ENDCG - - Pass - { - CGPROGRAM - float4 _EditorWorldLightPos; - float4 frag( v2f_img i ) : SV_Target - { - float3 lightDir = normalize( _EditorWorldLightPos.xyz ); - return float4 ( lightDir, 0); - } - ENDCG - } - - Pass - { - CGPROGRAM - float4 frag( v2f_img i ) : SV_Target - { - return (0).xxxx; - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceLightPosNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceLightPosNode.shader.meta deleted file mode 100644 index f9fa58c7..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceLightPosNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 2292a614672283c41a367b22cdde4620 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceViewDirHlpNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceViewDirHlpNode.shader deleted file mode 100644 index e90bacb6..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceViewDirHlpNode.shader +++ /dev/null @@ -1,25 +0,0 @@ -Shader "Hidden/WorldSpaceViewDirHlpNode" -{ -Properties - { - _A ("_A", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - #include "UnityCG.cginc" - - sampler2D _A; - - float4 frag( v2f_img i ) : SV_Target - { - return float4( float3( 0,0,-5 ) - tex2D( _A, i.uv ).rgb,1); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceViewDirHlpNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceViewDirHlpNode.shader.meta deleted file mode 100644 index edeada69..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldSpaceViewDirHlpNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: fe0e09756a8a0ba408015b43e66cb8a6 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldToObjectTransfNode.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldToObjectTransfNode.shader deleted file mode 100644 index d3ff2a76..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldToObjectTransfNode.shader +++ /dev/null @@ -1,25 +0,0 @@ -Shader "Hidden/WorldToObjectTransfNode" -{ - Properties - { - _A ("_A", 2D) = "white" {} - } - SubShader - { - Pass - { - CGPROGRAM - #include "UnityCG.cginc" - #pragma vertex vert_img - #pragma fragment frag - - sampler2D _A; - - float4 frag(v2f_img i) : SV_Target - { - return mul(unity_WorldToObject, tex2D( _A, i.uv )); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldToObjectTransfNode.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldToObjectTransfNode.shader.meta deleted file mode 100644 index 069ac0b0..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldToObjectTransfNode.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 79a5efd1e3309f54d8ba3e7fdf5e459b -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldTransformParams.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldTransformParams.shader deleted file mode 100644 index 92726760..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldTransformParams.shader +++ /dev/null @@ -1,20 +0,0 @@ -Shader "Hidden/WorldTransformParams" -{ - SubShader - { - Pass - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - #include "UnityCG.cginc" - - float4 frag( v2f_img i ) : SV_Target - { - return unity_WorldTransformParams; - } - ENDCG - } - - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldTransformParams.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldTransformParams.shader.meta deleted file mode 100644 index b6b2479d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_WorldTransformParams.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 5a2642605f085da458d6e03ade47b87a -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ZBufferParams.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ZBufferParams.shader deleted file mode 100644 index 9f817b1e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ZBufferParams.shader +++ /dev/null @@ -1,19 +0,0 @@ -Shader "Hidden/ZBufferParams" -{ - SubShader - { - Pass - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - #include "UnityCG.cginc" - - float4 frag( v2f_img i ) : SV_Target - { - return _ZBufferParams; - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ZBufferParams.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ZBufferParams.shader.meta deleted file mode 100644 index c7caf5ec..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/Preview_ZBufferParams.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 56c42c106bcb497439187f5bb6b6f94d -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/TextureArrayInspector.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/TextureArrayInspector.shader deleted file mode 100644 index 408050d1..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/TextureArrayInspector.shader +++ /dev/null @@ -1,30 +0,0 @@ -Shader "Hidden/TextureArrayEditor" -{ - Properties - { - _MainTex ("_MainTex", 2DArray) = "white" {} - _Index ("_Index", Int) = 0 - } - SubShader - { - Pass - { - CGPROGRAM - #pragma vertex vert_img - #pragma fragment frag - #pragma target 3.5 - #include "UnityCG.cginc" - #include "UnityStandardUtils.cginc" - - uniform UNITY_DECLARE_TEX2DARRAY( _MainTex ); - int _Index; - - float4 frag( v2f_img i ) : SV_Target - { - //return UNITY_SAMPLE_TEX2DARRAY_LOD( _MainTex, float3( i.uv, _Index), 0 ); - return UNITY_SAMPLE_TEX2DARRAY( _MainTex, float3( i.uv, _Index) ); - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/TextureArrayInspector.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/TextureArrayInspector.shader.meta deleted file mode 100644 index 8f6ce0ae..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Previews/TextureArrayInspector.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 610c24aad350fba4583068c6c22fa428 -timeCreated: 1488289785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions.meta deleted file mode 100644 index 96c839a5..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: e21dd05d276e6c8438cc722d4559a0c3 -folderAsset: yes -timeCreated: 1507301549 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bacteria.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bacteria.asset deleted file mode 100644 index 56013f75..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bacteria.asset +++ /dev/null @@ -1,38 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: Bacteria - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=17902\n-1440;-254;1004;726;5555.52;2071.572;5.733906;True;False\nNode;AmplifyShaderEditor.SimpleAddOpNode;40;-512,-224;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SmoothstepOpNode;42;-912,0;Inherit;False;3;0;FLOAT;0;False;1;FLOAT;0.6;False;2;FLOAT;0.55;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;55;-512,320;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SmoothstepOpNode;41;-912,-128;Inherit;False;3;0;FLOAT;0;False;1;FLOAT;0.7;False;2;FLOAT;0.65;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;44;-256,0;Inherit;True;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SmoothstepOpNode;45;-912,144;Inherit;False;3;0;FLOAT;0;False;1;FLOAT;0.2;False;2;FLOAT;0.15;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;33;-704,-320;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;2;-3872,160;Inherit;False;Tiling;2;0;False;1;0;FLOAT2;5,5;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SmoothstepOpNode;32;-912,-384;Inherit;False;3;0;FLOAT;0;False;1;FLOAT;0.45;False;2;FLOAT;0.4;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SmoothstepOpNode;46;-912,272;Inherit;False;3;0;FLOAT;0;False;1;FLOAT;0.1;False;2;FLOAT;0.05;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;43;-704,-80;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SmoothstepOpNode;34;-912,-256;Inherit;False;3;0;FLOAT;0;False;1;FLOAT;0.35;False;2;FLOAT;0.3;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SmoothstepOpNode;49;-912,400;Inherit;False;3;0;FLOAT;0;False;1;FLOAT;0.2;False;2;FLOAT;0.15;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SmoothstepOpNode;50;-912,528;Inherit;False;3;0;FLOAT;0;False;1;FLOAT;0.1;False;2;FLOAT;0.05;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;47;-704,208;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;48;-704,464;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.LengthOpNode;53;-1120,464;Inherit;False;1;0;FLOAT2;0,0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.LengthOpNode;51;-1120,224;Inherit;False;1;0;FLOAT2;0,0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;52;-1280,224;Inherit;False;2;0;FLOAT2;0,0;False;1;FLOAT2;0.5,1;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;54;-1280,464;Inherit;False;2;0;FLOAT2;0,0;False;1;FLOAT2;1,0.5;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.LengthOpNode;37;-1152,-176;Inherit;False;1;0;FLOAT2;0,0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;31;-1616,0;Inherit;True;3;3;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;2;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.TexCoordVertexDataNode;4;-3920,0;Inherit;False;0;2;0;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;3;-3680,64;Inherit;False;2;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FloorOpNode;6;-3520,-128;Inherit;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionInput;5;-3504,-48;Inherit;False;Seed;1;1;False;1;0;FLOAT;560;False;1;FLOAT;0\nNode;AmplifyShaderEditor.NoiseGeneratorNode;7;-3344,-112;Inherit;False;Simple;False;False;2;0;FLOAT2;0,0;False;1;FLOAT;560;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FractNode;12;-3088,-112;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FractNode;13;-3072,64;Inherit;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.StepOpNode;14;-2848,-192;Inherit;False;2;0;FLOAT;0.75;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.OneMinusNode;17;-2848,-80;Inherit;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.StepOpNode;16;-2800,304;Inherit;False;2;0;FLOAT;0.25;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.BreakToComponentsNode;1;-2816,176;Inherit;False;FLOAT2;1;0;FLOAT2;0,0;False;16;FLOAT;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT;5;FLOAT;6;FLOAT;7;FLOAT;8;FLOAT;9;FLOAT;10;FLOAT;11;FLOAT;12;FLOAT;13;FLOAT;14;FLOAT;15\nNode;AmplifyShaderEditor.OneMinusNode;19;-2528,160;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.DynamicAppendNode;20;-2352,176;Inherit;False;FLOAT2;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.StepOpNode;15;-2832,32;Inherit;False;2;0;FLOAT;0.5;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.OneMinusNode;23;-2208,96;Inherit;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;22;-2208,-16;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;24;-2032,16;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;21;-2160,-176;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;25;-1840,-112;Inherit;False;2;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;26;-1904,176;Inherit;False;2;2;0;FLOAT2;0,0;False;1;FLOAT;0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;27;-2144,256;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.OneMinusNode;28;-2112,352;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;29;-1888,384;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.WireNode;30;-2832,432;Inherit;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionOutput;0;0,0;Inherit;False;True;-1;Out;0;False;1;0;FLOAT;0;False;1;FLOAT;0\nWireConnection;40;0;33;0\nWireConnection;40;1;43;0\nWireConnection;42;0;37;0\nWireConnection;55;0;47;0\nWireConnection;55;1;48;0\nWireConnection;41;0;37;0\nWireConnection;44;0;40;0\nWireConnection;44;1;55;0\nWireConnection;45;0;51;0\nWireConnection;33;0;32;0\nWireConnection;33;1;34;0\nWireConnection;32;0;37;0\nWireConnection;46;0;51;0\nWireConnection;43;0;41;0\nWireConnection;43;1;42;0\nWireConnection;34;0;37;0\nWireConnection;49;0;53;0\nWireConnection;50;0;53;0\nWireConnection;47;0;45;0\nWireConnection;47;1;46;0\nWireConnection;48;0;49;0\nWireConnection;48;1;50;0\nWireConnection;53;0;54;0\nWireConnection;51;0;52;0\nWireConnection;52;0;31;0\nWireConnection;54;0;31;0\nWireConnection;37;0;31;0\nWireConnection;31;0;25;0\nWireConnection;31;1;26;0\nWireConnection;31;2;29;0\nWireConnection;3;0;4;0\nWireConnection;3;1;2;0\nWireConnection;6;0;3;0\nWireConnection;7;0;6;0\nWireConnection;7;1;5;0\nWireConnection;12;0;7;0\nWireConnection;13;0;3;0\nWireConnection;14;1;12;0\nWireConnection;17;0;13;0\nWireConnection;16;1;12;0\nWireConnection;1;0;13;0\nWireConnection;19;0;1;0\nWireConnection;20;0;19;0\nWireConnection;20;1;1;1\nWireConnection;15;1;12;0\nWireConnection;23;0;20;0\nWireConnection;22;0;15;0\nWireConnection;22;1;14;0\nWireConnection;24;0;22;0\nWireConnection;24;1;23;0\nWireConnection;21;0;14;0\nWireConnection;21;1;17;0\nWireConnection;25;0;21;0\nWireConnection;25;1;24;0\nWireConnection;26;0;20;0\nWireConnection;26;1;27;0\nWireConnection;27;0;16;0\nWireConnection;27;1;15;0\nWireConnection;28;0;16;0\nWireConnection;29;0;28;0\nWireConnection;29;1;30;0\nWireConnection;30;0;13;0\nWireConnection;0;0;44;0\nASEEND*/\n//CHKSM=A7931AF4EE98C9341AB309047876D23C8E9396B7" - m_functionName: - m_description: - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_additionalDirectives: - m_validData: 0 - m_isDirty: 0 - m_moduleName: ' Additional Directives' - m_independentModule: 1 - m_additionalDirectives: [] - m_shaderFunctionDirectives: [] - m_nativeDirectives: [] - m_nativeDirectivesIndex: -1 - m_nativeDirectivesFoldout: 0 - m_directivesSaveItems: [] - m_nodeCategory: 9 - m_customNodeCategory: - m_previewPosition: 0 - m_hidden: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bacteria.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bacteria.asset.meta deleted file mode 100644 index 3cd0009a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bacteria.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: c4b8e21d0aca1b04d843e80ebaf2ba67 -timeCreated: 1586867844 -licenseType: Store -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bidirectional Parallax Mapping.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bidirectional Parallax Mapping.asset deleted file mode 100644 index f4eae3e1..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bidirectional Parallax Mapping.asset +++ /dev/null @@ -1,28 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: Bidirectional Parallax Mapping - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=13705\n487;610;979;408;2081.306;97.63176;1.710001;True;False\nNode;AmplifyShaderEditor.TextureCoordinatesNode;22;-1295.124,60.47374;Float;False;0;-1;2;3;2;SAMPLER2D;;False;0;FLOAT2;1,1;False;1;FLOAT2;0,0;False;5;FLOAT2;FLOAT;FLOAT;FLOAT;FLOAT\nNode;AmplifyShaderEditor.FunctionInput;9;-1152.312,532.149;Float;False;Parallax - Scale;1;2;False;1;0;FLOAT;0.0;False;1;FLOAT\nNode;AmplifyShaderEditor.CustomExpressionNode;27;-800,0;Float;False;UVs - += plane * scale * refp * ite@$for(int i = 0@ i < ite@ i++)${$\tUVs += (tex2D(tex, - UVs).g - 1) * plane * scale@$}$return UVs@;2;False;6;True;tex;SAMPLER2D;0.0;In;True;UVs;FLOAT2;0,0;In;True;plane;FLOAT2;0,0;In;True;ite;INT;0;In;True;refp;FLOAT;0.0;In;True;scale;FLOAT;0.0;In;IterativeParallax;6;0;SAMPLER2D;0.0;False;1;FLOAT2;0,0;False;2;FLOAT2;0,0;False;3;INT;0;False;4;FLOAT;0.0;False;5;FLOAT;0.0;False;1;FLOAT2\nNode;AmplifyShaderEditor.SimpleDivideOpNode;4;-1166.738,231.9931;Float;False;2;0;FLOAT2;0,0;False;1;FLOAT;0.0,0;False;1;FLOAT2\nNode;AmplifyShaderEditor.FunctionInput;25;-1169.823,366.4736;Float;False;Iterations;0;3;False;1;0;INT;1;False;1;INT\nNode;AmplifyShaderEditor.DynamicAppendNode;2;-1371.897,195.5105;Float;False;FLOAT2;4;0;FLOAT2;0,0;False;1;FLOAT;0.0;False;2;FLOAT;0.0;False;3;FLOAT;0.0;False;1;FLOAT2\nNode;AmplifyShaderEditor.ViewDirInputsCoordNode;1;-1618.191,180.3121;Float;False;Tangent;0;4;FLOAT3;FLOAT;FLOAT;FLOAT\nNode;AmplifyShaderEditor.FunctionInput;10;-1193.709,445.5891;Float;False;Reference - Plane;1;1;False;1;0;FLOAT;0.0;False;1;FLOAT\nNode;AmplifyShaderEditor.FunctionInput;11;-1488,0;Float;False;Heightmap - Tex;9;0;False;1;0;SAMPLER2D;0.0;False;1;SAMPLER2D\nNode;AmplifyShaderEditor.FunctionOutput;0;-512,0;Float;False;True;Out;0;1;0;FLOAT2;0,0;False;0\nWireConnection;22;2;11;0\nWireConnection;27;0;11;0\nWireConnection;27;1;22;0\nWireConnection;27;2;4;0\nWireConnection;27;3;25;0\nWireConnection;27;4;10;0\nWireConnection;27;5;9;0\nWireConnection;4;0;2;0\nWireConnection;4;1;1;3\nWireConnection;2;0;1;0\nWireConnection;0;0;27;0\nASEEND*/\n//CHKSM=2048ACCD3EDF74303C30AF727B4CFB3C868B5231" - m_functionName: - m_description: Creates a parallax mapping effect with user defined iterations and - reference plane. - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_nodeCategory: 15 - m_customNodeCategory: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bidirectional Parallax Mapping.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bidirectional Parallax Mapping.asset.meta deleted file mode 100644 index bfca1245..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bidirectional Parallax Mapping.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: ab457a4ccb6d8f745b63ef50e1417242 -timeCreated: 1507301651 -licenseType: Store -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Blinn-Phong Half Vector.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Blinn-Phong Half Vector.asset deleted file mode 100644 index 567173c3..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Blinn-Phong Half Vector.asset +++ /dev/null @@ -1,23 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: Blinn-Phong Half Vector - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=13705\n487;506;979;512;774.2847;195.955;1;False;False\nNode;AmplifyShaderEditor.WorldSpaceLightDirHlpNode;2;-640,96;Float;False;1;0;FLOAT;0.0;False;4;FLOAT3;FLOAT;FLOAT;FLOAT\nNode;AmplifyShaderEditor.ViewDirInputsCoordNode;1;-592,-64;Float;False;World;0;4;FLOAT3;FLOAT;FLOAT;FLOAT\nNode;AmplifyShaderEditor.SimpleAddOpNode;3;-336,0;Float;False;2;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0.0,0,0;False;1;FLOAT3\nNode;AmplifyShaderEditor.NormalizeNode;4;-176,0;Float;False;1;0;FLOAT3;0,0,0,0;False;1;FLOAT3\nNode;AmplifyShaderEditor.FunctionOutput;0;0,0;Float;False;True;XYZ;0;1;0;FLOAT3;0,0,0;False;0\nWireConnection;3;0;1;0\nWireConnection;3;1;2;0\nWireConnection;4;0;3;0\nWireConnection;0;0;4;0\nASEEND*/\n//CHKSM=CDF922191A60D2395104E4F539CAFDF78289C070" - m_functionName: - m_description: Calculates the halfway vector between view direction and light direction - in world space. - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_nodeCategory: 11 - m_customNodeCategory: Custom Lighting diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Blinn-Phong Half Vector.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Blinn-Phong Half Vector.asset.meta deleted file mode 100644 index ddcbca91..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Blinn-Phong Half Vector.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 91a149ac9d615be429126c95e20753ce -timeCreated: 1509361778 -licenseType: Store -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Blinn-Phong Light.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Blinn-Phong Light.asset deleted file mode 100644 index d5779fb4..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Blinn-Phong Light.asset +++ /dev/null @@ -1,41 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: Blinn-Phong Light - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=16306\n716;346;1066;687;501.1261;294.544;1;False;False\nNode;AmplifyShaderEditor.ComponentMaskNode;29;48,-496;Float;False;True;True;True;False;1;0;COLOR;0,0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.RangedFloatNode;22;-352,-224;Float;False;Property;_Shininess;Shininess;2;0;Create;True;0;0;False;0;0.1;0;0.01;1;0;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;37;609.1547,-34.90417;Float;False;2;2;0;COLOR;0,0,0,0;False;1;FLOAT3;0,0,0;False;1;COLOR;0\nNode;AmplifyShaderEditor.SimpleMaxOpNode;59;-336,-320;Float;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionNode;51;-832,-288;Float;False;Blinn-Phong - Half Vector;-1;;2;91a149ac9d615be429126c95e20753ce;0;0;1;FLOAT3;0\nNode;AmplifyShaderEditor.ComponentMaskNode;44;48,-416;Float;False;False;False;False;True;1;0;COLOR;0,0,0,0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.ColorNode;24;-368,-496;Float;False;Property;_SpecularColor;Specular - Color;1;0;Create;True;0;0;False;0;0.3921569,0.3921569,0.3921569,1;0,0,0,0;False;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.PowerNode;21;112,-320;Float;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.IndirectDiffuseLighting;34;337.1547,77.09583;Float;False;World;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;36;417.1547,-34.90417;Float;False;2;2;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;1;COLOR;0\nNode;AmplifyShaderEditor.LightColorNode;17;14.82559,-84.1315;Float;False;0;3;COLOR;0;FLOAT3;1;FLOAT;2\nNode;AmplifyShaderEditor.LightAttenuation;10;-27.48053,45.50479;Float;False;0;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;38;1009.155,-34.90417;Float;False;2;2;0;COLOR;0,0,0,0;False;1;FLOAT3;0,0,0;False;1;COLOR;0\nNode;AmplifyShaderEditor.ComponentMaskNode;47;769.1547,93.09583;Float;False;True;True;True;False;1;0;COLOR;0,0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.ComponentMaskNode;50;769.1547,189.0958;Float;False;False;False;False;True;1;0;COLOR;0,0,0,0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;25;801.1547,-274.9042;Float;False;4;4;0;FLOAT3;0,0,0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;COLOR;0,0,0,0;False;1;COLOR;0\nNode;AmplifyShaderEditor.DotProductOpNode;19;-512,-240;Float;False;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.WorldNormalVector;12;-937.117,-98.03006;Float;False;False;1;0;FLOAT3;0,0,0;False;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3\nNode;AmplifyShaderEditor.WireNode;67;395.671,-128.7589;Float;False;1;0;COLOR;0,0,0,0;False;1;COLOR;0\nNode;AmplifyShaderEditor.WireNode;55;-518.842,331.2534;Float;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.NormalizeNode;64;-729.1198,-98.03006;Float;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.ColorNode;26;353.1547,189.0958;Float;False;Property;_MainColor;Main - Color;0;0;Create;True;0;0;False;0;0.3921569,0.3921569,0.3921569,1;0,0,0,0;False;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.SimpleMaxOpNode;15;-65.18457,141.2409;Float;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;40;232.9505,-46.9381;Float;False;2;2;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;1;COLOR;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;39;1185.155,-162.9042;Float;False;2;2;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;COLOR;0\nNode;AmplifyShaderEditor.FunctionInput;42;625.1547,189.0958;Float;False;Diffuse;5;0;False;1;0;COLOR;0,0,0,0;False;1;COLOR;0\nNode;AmplifyShaderEditor.FunctionInput;52;-1065.115,-98.03006;Float;False;Normal;3;1;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FunctionInput;43;-128,-496;Float;False;Specular;5;2;False;1;0;COLOR;0,0,0,0;False;1;COLOR;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;60;-48,-256;Float;False;2;2;0;FLOAT;0;False;1;FLOAT;128;False;1;FLOAT;0\nNode;AmplifyShaderEditor.WireNode;56;165.1989,329.8424;Float;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.WorldSpaceLightDirHlpNode;13;-487.8197,165.9312;Float;False;False;1;0;FLOAT;0;False;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3\nNode;AmplifyShaderEditor.Vector3Node;53;-1273.115,-98.03006;Float;False;Constant;_DefaultNormal;DefaultNormal;3;0;Create;True;0;0;False;0;0,0,1;0,0,0;0;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3\nNode;AmplifyShaderEditor.DotProductOpNode;14;-210.7447,112.9567;Float;False;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionOutput;0;1329.155,-162.9042;Float;False;True;RGB;0;False;1;0;COLOR;0,0,0,0;False;1;COLOR;0\nNode;AmplifyShaderEditor.FunctionOutput;57;1329.155,-82.90417;Float;False;True;Alpha;1;False;1;0;FLOAT;0;False;1;FLOAT;0\nWireConnection;29;0;43;0\nWireConnection;37;0;36;0\nWireConnection;37;1;34;0\nWireConnection;59;0;19;0\nWireConnection;44;0;43;0\nWireConnection;21;0;59;0\nWireConnection;21;1;60;0\nWireConnection;34;0;56;0\nWireConnection;36;0;40;0\nWireConnection;36;1;15;0\nWireConnection;38;0;37;0\nWireConnection;38;1;47;0\nWireConnection;47;0;42;0\nWireConnection;50;0;42;0\nWireConnection;25;0;29;0\nWireConnection;25;1;44;0\nWireConnection;25;2;21;0\nWireConnection;25;3;67;0\nWireConnection;19;0;51;0\nWireConnection;19;1;64;0\nWireConnection;12;0;52;0\nWireConnection;67;0;40;0\nWireConnection;55;0;64;0\nWireConnection;64;0;12;0\nWireConnection;15;0;14;0\nWireConnection;40;0;17;0\nWireConnection;40;1;10;0\nWireConnection;39;0;25;0\nWireConnection;39;1;38;0\nWireConnection;42;0;26;0\nWireConnection;52;0;53;0\nWireConnection;43;0;24;0\nWireConnection;60;0;22;0\nWireConnection;56;0;55;0\nWireConnection;14;0;64;0\nWireConnection;14;1;13;0\nWireConnection;0;0;39;0\nWireConnection;57;0;50;0\nASEEND*/\n//CHKSM=57C0C1F3D628A2FE0988ED3E128E1C80E9BEE859" - m_functionName: - m_description: Generates a lighting model using Blinn-Phong reflectance model and - closely resembles Unity legacy shaders. - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_additionalDirectives: - m_validData: 0 - m_isDirty: 0 - m_moduleName: ' Additional Directives' - m_independentModule: 1 - m_additionalDirectives: [] - m_shaderFunctionDirectives: [] - m_nativeDirectives: [] - m_nativeDirectivesFoldout: 0 - m_directivesSaveItems: [] - m_nodeCategory: 5 - m_customNodeCategory: - m_previewPosition: 0 - m_hidden: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Blinn-Phong Light.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Blinn-Phong Light.asset.meta deleted file mode 100644 index af90b623..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Blinn-Phong Light.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: cf814dba44d007a4e958d2ddd5813da6 -timeCreated: 1510331168 -licenseType: Store -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/BlinnPhongLightWrap.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/BlinnPhongLightWrap.asset deleted file mode 100644 index 5ae17466..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/BlinnPhongLightWrap.asset +++ /dev/null @@ -1,48 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: BlinnPhongLightWrap - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=16205\n234;92;1063;705;1563.922;447.6829;2.241337;True;False\nNode;AmplifyShaderEditor.CommentaryNode;82;-868.7166,1513.25;Float;False;615.7619;256.2104;;4;0;73;72;71;Diffuse - + Specular;1,1,1,1;0;0\nNode;AmplifyShaderEditor.CommentaryNode;62;-874.5117,944.6415;Float;False;2334.29;521.7126;Comment;20;60;1;69;66;68;67;61;56;55;47;50;53;51;52;49;48;45;46;44;70;Diffuse - Color;1,1,1,1;0;0\nNode;AmplifyShaderEditor.CommentaryNode;43;-873.949,406.1891;Float;False;1347.446;439.3573;;11;41;40;42;2;33;34;36;37;39;38;32;Specular - Color;1,1,1,1;0;0\nNode;AmplifyShaderEditor.CommentaryNode;31;-871.1387,-356.8812;Float;False;1192.721;289.2242;;7;21;20;18;23;19;4;17;NDotL;1,1,1,1;0;0\nNode;AmplifyShaderEditor.CommentaryNode;30;-875.0961,-9.355102;Float;False;977.2441;332.3028;;6;26;29;28;27;77;76;Half - Dir;1,1,1,1;0;0\nNode;AmplifyShaderEditor.CommentaryNode;15;-856.0029,-727.2549;Float;False;924;294;;7;3;10;12;13;11;9;14;Gloss;1,1,1,1;0;0\nNode;AmplifyShaderEditor.CommentaryNode;16;-866.0001,-1064.568;Float;False;748.5;272;;4;8;7;5;6;Light - Attenuation;1,1,1,1;0;0\nNode;AmplifyShaderEditor.Exp2OpNode;9;-310.0023,-612.2548;Float;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.LightColorNode;6;-768.0001,-1014.568;Float;False;0;3;COLOR;0;FLOAT3;1;FLOAT;2\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;61;351.8147,1114.297;Float;False;2;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;40;22.70839,527.0504;Float;False;3;3;0;FLOAT3;0,0,0;False;1;FLOAT;0;False;2;FLOAT;0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.SimpleMaxOpNode;36;-412.9491,536.5466;Float;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMaxOpNode;55;193.8148,1072.297;Float;False;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.RangedFloatNode;46;-819.0866,1078.04;Float;False;Constant;_Float3;Float - 3;0;0;Create;True;0;0;False;0;0.5;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.GetLocalVarNode;34;-823.949,563.5466;Float;False;23;CurrentNormal;1;0;OBJECT;0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.SwizzleNode;48;-461.0868,1017.04;Float;False;FLOAT3;0;0;0;0;1;0;FLOAT;0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;45;-614.0866,1015.04;Float;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.GetLocalVarNode;33;-809.7029,474.5466;Float;False;29;HalfDirection;1;0;OBJECT;0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FunctionInput;44;-824.5117,994.6415;Float;False;Light - Wrapping;1;4;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.GetLocalVarNode;41;-314.718,456.1892;Float;False;8;AttenuationColor;1;0;OBJECT;0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.DotProductOpNode;32;-562.3635,499.8815;Float;False;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;51;-189.0866,1179.04;Float;False;2;2;0;FLOAT3;0,0,0;False;1;FLOAT;0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.RegisterLocalVarNode;47;-292.0868,1021.04;Float;False;LightWrapVector;-1;True;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.GetLocalVarNode;50;-605.0866,1170.04;Float;False;47;LightWrapVector;1;0;OBJECT;0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.OneMinusNode;49;-358.0868,1176.04;Float;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FogAndAmbientColorsNode;67;339.0064,1220.623;Float;False;UNITY_LIGHTMODEL_AMBIENT;0;1;COLOR;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;73;-560,1600;Float;False;2;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.GetLocalVarNode;72;-832,1664;Float;False;42;specularFinalColor;1;0;OBJECT;0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.GetLocalVarNode;71;-832,1568;Float;False;70;DiffuseColor;1;0;OBJECT;0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.RangedFloatNode;37;-566.9489,632.5466;Float;False;Constant;_Float2;Float - 2;0;0;Create;True;0;0;False;0;0;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;66;790.0066,1122.623;Float;False;2;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.Vector3Node;56;-16.18523,1193.297;Float;False;Constant;_Vector1;Vector - 1;0;0;Create;True;0;0;False;0;0,0,0;0,0,0;0;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3\nNode;AmplifyShaderEditor.GetLocalVarNode;60;9.172014,1340.574;Float;False;8;AttenuationColor;1;0;OBJECT;0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;10;-614.0029,-660.2548;Float;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.RangedFloatNode;12;-806.0029,-564.2547;Float;False;Constant;_Float0;Float - 0;0;0;Create;True;0;0;False;0;10;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;53;-20.54932,1092.818;Float;False;2;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.RegisterLocalVarNode;70;1146.801,1151.155;Float;False;DiffuseColor;-1;True;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.RegisterLocalVarNode;42;200.4974,524.5294;Float;False;specularFinalColor;-1;True;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.RangedFloatNode;13;-630.0029,-548.2548;Float;False;Constant;_Float1;Float - 1;0;0;Create;True;0;0;False;0;1;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.RegisterLocalVarNode;14;-182.0024,-628.2548;Float;False;SpecularPower;-1;True;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SwizzleNode;68;609.0066,1209.623;Float;False;FLOAT3;0;1;2;3;1;0;COLOR;0,0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;7;-576.0001,-950.5679;Float;False;2;2;0;FLOAT3;0,0,0;False;1;FLOAT;0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FunctionInput;1;736.0968,1302.828;Float;False;Diffuse;3;0;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.GetLocalVarNode;52;-398.0868,1262.04;Float;False;21;NDotL;1;0;OBJECT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;69;976.0066,1143.623;Float;False;2;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;11;-454.0023,-612.2548;Float;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.PowerNode;38;-239.3654,550.192;Float;False;2;0;FLOAT;0;False;1;FLOAT;1;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;2;-234.7179,664.1893;Float;False;Specular;1;2;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.GetLocalVarNode;39;-516.949,730.5465;Float;False;14;SpecularPower;1;0;OBJECT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.WorldSpaceLightPos;76;-854.467,61.70709;Float;False;0;3;FLOAT4;0;FLOAT3;1;FLOAT;2\nNode;AmplifyShaderEditor.NormalizeNode;77;-598.467,61.70709;Float;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.WorldNormalVector;19;-521.2433,-309.2914;Float;False;True;1;0;FLOAT3;0,0,1;False;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3\nNode;AmplifyShaderEditor.RegisterLocalVarNode;23;-329.2433,-309.2914;Float;False;CurrentNormal;-1;True;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.Vector3Node;17;-857.2433,-309.2914;Float;False;Constant;_Vector0;Vector - 0;0;0;Create;True;0;0;False;0;0,0,1;0,0,0;0;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3\nNode;AmplifyShaderEditor.FunctionInput;4;-681.2433,-309.2914;Float;False;Normal;3;1;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FunctionInput;3;-785.0029,-677.2548;Float;False;Gloss;1;3;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.LightAttenuation;5;-816.0001,-886.5679;Float;False;0;1;FLOAT;0\nNode;AmplifyShaderEditor.RegisterLocalVarNode;8;-400,-966.5679;Float;False;AttenuationColor;-1;True;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.WorldSpaceLightDirHlpNode;18;-329.2433,-213.2914;Float;False;False;1;0;FLOAT;0;False;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3\nNode;AmplifyShaderEditor.DotProductOpNode;20;-57.24332,-277.2914;Float;False;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.RegisterLocalVarNode;21;86.75671,-261.2914;Float;False;NDotL;-1;True;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.ViewDirInputsCoordNode;26;-800,160;Float;False;World;False;0;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3\nNode;AmplifyShaderEditor.SimpleAddOpNode;27;-422.467,77.70709;Float;False;2;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.NormalizeNode;28;-294.467,77.70709;Float;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.RegisterLocalVarNode;29;-134.467,77.70709;Float;False;HalfDirection;-1;True;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FunctionOutput;0;-416,1616;Float;False;True;Output;0;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nWireConnection;9;0;11;0\nWireConnection;61;0;55;0\nWireConnection;61;1;60;0\nWireConnection;40;0;41;0\nWireConnection;40;1;38;0\nWireConnection;40;2;2;0\nWireConnection;36;0;32;0\nWireConnection;36;1;37;0\nWireConnection;55;0;53;0\nWireConnection;55;1;56;0\nWireConnection;48;0;45;0\nWireConnection;45;0;44;0\nWireConnection;45;1;46;0\nWireConnection;32;0;33;0\nWireConnection;32;1;34;0\nWireConnection;51;0;49;0\nWireConnection;51;1;52;0\nWireConnection;47;0;48;0\nWireConnection;49;0;50;0\nWireConnection;73;0;71;0\nWireConnection;73;1;72;0\nWireConnection;66;0;61;0\nWireConnection;66;1;68;0\nWireConnection;10;0;3;0\nWireConnection;10;1;12;0\nWireConnection;53;0;47;0\nWireConnection;53;1;51;0\nWireConnection;70;0;69;0\nWireConnection;42;0;40;0\nWireConnection;14;0;9;0\nWireConnection;68;0;67;0\nWireConnection;7;0;6;1\nWireConnection;7;1;5;0\nWireConnection;69;0;66;0\nWireConnection;69;1;1;0\nWireConnection;11;0;10;0\nWireConnection;11;1;13;0\nWireConnection;38;0;36;0\nWireConnection;38;1;39;0\nWireConnection;77;0;76;1\nWireConnection;19;0;4;0\nWireConnection;23;0;19;0\nWireConnection;4;0;17;0\nWireConnection;8;0;7;0\nWireConnection;20;0;23;0\nWireConnection;20;1;18;0\nWireConnection;21;0;20;0\nWireConnection;27;0;77;0\nWireConnection;27;1;26;0\nWireConnection;28;0;27;0\nWireConnection;29;0;28;0\nWireConnection;0;0;73;0\nASEEND*/\n//CHKSM=2875532B381E030A9F10046AE6BB0271C00931BB" - m_functionName: - m_description: - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_additionalDirectives: - m_validData: 0 - m_isDirty: 0 - m_moduleName: ' Additional Directives' - m_independentModule: 1 - m_additionalDirectives: [] - m_shaderFunctionDirectives: [] - m_nativeDirectives: [] - m_nativeDirectivesFoldout: 0 - m_directivesSaveItems: [] - m_nodeCategory: 3 - m_customNodeCategory: - m_previewPosition: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/BlinnPhongLightWrap.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/BlinnPhongLightWrap.asset.meta deleted file mode 100644 index ec6b34ed..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/BlinnPhongLightWrap.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 139fed909c1bc1a42a96c42d8cf09006 -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 11400000 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/BoxMask.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/BoxMask.asset deleted file mode 100644 index 2de5098f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/BoxMask.asset +++ /dev/null @@ -1,27 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: BoxMask - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=14205\n585;92;1335;966;841.4062;390.9513;1;True;False\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;3;-770.7323,-83.37894;Float;False;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0.0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;7;-359.1361,-15.58681;Float;False;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.AbsOpNode;6;-536.6868,-59.16749;Float;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.SimpleDivideOpNode;15;268.7505,-15.58675;Float;False;2;0;FLOAT;0.0;False;1;FLOAT;0.0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMaxOpNode;12;-99.26636,-15.5865;Float;False;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FunctionInput;1;-1107.93,-142.7251;Float;False;World - Position;3;0;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FunctionInput;10;-880.4891,142.5947;Float;False;Size;3;2;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FunctionInput;4;-1091.939,-4.288156;Float;False;Center;3;1;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FunctionInput;17;37.9352,82.87358;Float;False;Falloff;1;3;False;1;0;FLOAT;0.0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.DistanceOpNode;13;36.31915,-15.58687;Float;False;2;0;FLOAT3;0,0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;8;-599.6362,161.9639;Float;False;2;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0.5,0.5,0.5;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FunctionOutput;0;461.6318,-16.14097;Float;False;True;Output;0;False;1;0;FLOAT;0.0;False;1;FLOAT;0\nWireConnection;3;0;1;0\nWireConnection;3;1;4;0\nWireConnection;7;0;6;0\nWireConnection;7;1;8;0\nWireConnection;6;0;3;0\nWireConnection;15;0;13;0\nWireConnection;15;1;17;0\nWireConnection;12;0;7;0\nWireConnection;13;0;12;0\nWireConnection;8;0;10;0\nWireConnection;0;0;15;0\nASEEND*/\n//CHKSM=B3B832D729B3AA37648FFC3D368D473533835BDC" - m_functionName: - m_description: Box Mask - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_nodeCategory: 3 - m_customNodeCategory: - m_previewPosition: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/BoxMask.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/BoxMask.asset.meta deleted file mode 100644 index ab3c8b13..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/BoxMask.asset.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 9dce4093ad5a42b4aa255f0153c4f209 -timeCreated: 1516621733 -licenseType: Store -NativeFormatImporter: - mainObjectFileID: 11400000 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bricks Pattern.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bricks Pattern.asset deleted file mode 100644 index 123cc594..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bricks Pattern.asset +++ /dev/null @@ -1,41 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: Bricks Pattern - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=17902\n-1462;-370;1004;726;3880.583;1484.979;4.133047;True;False\nNode;AmplifyShaderEditor.FractNode;23;-1104,-16;Inherit;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.DynamicAppendNode;27;-1296,-80;Inherit;False;FLOAT2;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;30;-1472,-192;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FloorOpNode;32;-928,-256;Inherit;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.BreakToComponentsNode;12;-1760,192;Inherit;False;FLOAT2;1;0;FLOAT2;0,0;False;16;FLOAT;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT;5;FLOAT;6;FLOAT;7;FLOAT;8;FLOAT;9;FLOAT;10;FLOAT;11;FLOAT;12;FLOAT;13;FLOAT;14;FLOAT;15\nNode;AmplifyShaderEditor.BreakToComponentsNode;31;-736,-176;Inherit;False;FLOAT2;1;0;FLOAT2;0,0;False;16;FLOAT;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT;5;FLOAT;6;FLOAT;7;FLOAT;8;FLOAT;9;FLOAT;10;FLOAT;11;FLOAT;12;FLOAT;13;FLOAT;14;FLOAT;15\nNode;AmplifyShaderEditor.FunctionInput;17;-960,-160;Inherit;False;Luminance - Range;2;3;False;1;0;FLOAT2;0,1;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;29;-1648,-192;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;19;-2464,48;Inherit;False;2;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionInput;15;-2640,176;Inherit;False;Tiling;2;0;False;1;0;FLOAT2;2,4;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.TexCoordVertexDataNode;18;-2704,48;Inherit;False;0;2;0;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.StepOpNode;28;-1808,-192;Inherit;False;2;0;FLOAT;1;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.BreakToComponentsNode;26;-2272,-80;Inherit;False;FLOAT2;1;0;FLOAT2;0,0;False;16;FLOAT;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT;5;FLOAT;6;FLOAT;7;FLOAT;8;FLOAT;9;FLOAT;10;FLOAT;11;FLOAT;12;FLOAT;13;FLOAT;14;FLOAT;15\nNode;AmplifyShaderEditor.SimpleRemainderNode;25;-2000,-160;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;2;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;16;-1808,-272;Inherit;False;Offset;1;2;False;1;0;FLOAT;0.5;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;22;-1504,368;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;14;-832,192;Inherit;False;Size;1;1;False;1;0;FLOAT;0.65;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;4;-672,80;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;6;-928,80;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionNode;2;-448,0;Inherit;False;Rectangle;-1;;1;6b23e0c975270fb4084c354b2c83366a;0;3;1;FLOAT2;0,0;False;2;FLOAT;0.5;False;3;FLOAT;0.5;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionNode;24;-448,-256;Inherit;False;Random - Range;-1;;2;7b754edb8aebbfb4a9ace907af661cfc;0;3;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT;1;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;1;-160,-256;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;5;-672,256;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleDivideOpNode;9;-1104,288;Inherit;False;2;0;FLOAT;-1;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMinOpNode;20;-1104,384;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SignOpNode;21;-1360,368;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleDivideOpNode;8;-1104,80;Inherit;False;2;0;FLOAT;1;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;7;-928,288;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMaxOpNode;11;-1104,192;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionOutput;0;0,0;Inherit;True;True;-1;Bricks;0;True;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionOutput;3;0,-256;Inherit;True;False;-1;Luminance;1;False;1;0;FLOAT;0;False;1;FLOAT;0\nWireConnection;23;0;27;0\nWireConnection;27;0;30;0\nWireConnection;27;1;26;1\nWireConnection;30;0;29;0\nWireConnection;30;1;26;0\nWireConnection;32;0;27;0\nWireConnection;12;0;15;0\nWireConnection;31;0;17;0\nWireConnection;29;0;16;0\nWireConnection;29;1;28;0\nWireConnection;19;0;18;0\nWireConnection;19;1;15;0\nWireConnection;28;1;25;0\nWireConnection;26;0;19;0\nWireConnection;25;0;26;1\nWireConnection;22;0;12;1\nWireConnection;22;1;12;0\nWireConnection;4;0;6;0\nWireConnection;4;1;14;0\nWireConnection;6;0;8;0\nWireConnection;6;1;11;0\nWireConnection;2;1;23;0\nWireConnection;2;2;4;0\nWireConnection;2;3;5;0\nWireConnection;24;1;32;0\nWireConnection;24;2;31;0\nWireConnection;24;3;31;1\nWireConnection;1;0;24;0\nWireConnection;1;1;2;0\nWireConnection;5;0;14;0\nWireConnection;5;1;7;0\nWireConnection;9;1;12;0\nWireConnection;20;0;21;0\nWireConnection;21;0;22;0\nWireConnection;8;1;12;1\nWireConnection;7;0;9;0\nWireConnection;7;1;20;0\nWireConnection;11;0;21;0\nWireConnection;0;0;2;0\nWireConnection;3;0;1;0\nASEEND*/\n//CHKSM=27789CFA7C579B24211E55A89520C287602B2C4E" - m_functionName: - m_description: Creates a repeated bricks pattern with alternating offsetted lines - of bricks. - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_additionalDirectives: - m_validData: 0 - m_isDirty: 0 - m_moduleName: ' Additional Directives' - m_independentModule: 1 - m_additionalDirectives: [] - m_shaderFunctionDirectives: [] - m_nativeDirectives: [] - m_nativeDirectivesIndex: -1 - m_nativeDirectivesFoldout: 0 - m_directivesSaveItems: [] - m_nodeCategory: 9 - m_customNodeCategory: - m_previewPosition: 0 - m_hidden: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bricks Pattern.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bricks Pattern.asset.meta deleted file mode 100644 index a3829133..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Bricks Pattern.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 7d219d3a79fd53a48987a86fa91d6bac -timeCreated: 1586861586 -licenseType: Store -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Checkerboard.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Checkerboard.asset deleted file mode 100644 index c3a6f654..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Checkerboard.asset +++ /dev/null @@ -1,56 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: Checkerboard - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=17500\n2092;369;1066;673;519.6959;768.1077;1.3;True;False\nNode;AmplifyShaderEditor.CommentaryNode;18;-1101.678,-1164.645;Inherit;False;1511.133;506.8259;;12;6;1;10;11;12;4;9;13;14;15;16;17;UV - and Derivatives;1,1,1,1;0;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;39;-1068.804,243.1458;Inherit;False;2;2;0;FLOAT2;0,0;False;1;FLOAT;0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.RangedFloatNode;40;-1228.804,307.1458;Inherit;False;Constant;_Float4;Float - 4;0;0;Create;True;0;0;False;0;4;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.AbsOpNode;32;-1208.804,195.1458;Inherit;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.RangedFloatNode;42;-1068.804,355.1458;Inherit;False;Constant;_Float5;Float - 5;0;0;Create;True;0;0;False;0;1;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;3;95.94269,118.7242;Inherit;False;Color - B;5;2;False;1;0;COLOR;0,0,0,0;False;1;COLOR;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;37;-1340.804,195.1458;Inherit;False;2;0;FLOAT2;0,0;False;1;FLOAT;0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.RangedFloatNode;38;-1532.805,275.1458;Inherit;False;Constant;_Float3;Float - 3;0;0;Create;True;0;0;False;0;0.5;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.RangedFloatNode;66;-60.19727,349.9423;Inherit;False;Constant;_Float9;Float - 9;0;0;Create;True;0;0;False;0;0.5;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.ColorNode;8;-112.0574,118.7242;Inherit;False;Constant;_Color1;Color - 1;0;0;Create;True;0;0;False;0;0.6980392,0.6980392,0.6980392,0;0,0,0,0;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.RangedFloatNode;50;-829.9077,762.2733;Inherit;False;Constant;_Float6;Float - 6;0;0;Create;True;0;0;False;0;1.1;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;68;-56.59735,495.6422;Inherit;False;4;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;67;95.94269,422.7241;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.ColorNode;7;-112.0574,-73.27585;Inherit;False;Constant;_Color0;Color - 0;0;0;Create;True;0;0;False;0;0.2,0.2,0.2,0;0,0,0,0;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.BreakToComponentsNode;71;-302.0974,513.8422;Inherit;False;FLOAT2;1;0;FLOAT2;0,0;False;16;FLOAT;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT;5;FLOAT;6;FLOAT;7;FLOAT;8;FLOAT;9;FLOAT;10;FLOAT;11;FLOAT;12;FLOAT;13;FLOAT;14;FLOAT;15\nNode;AmplifyShaderEditor.FractNode;33;-1484.805,163.1458;Inherit;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SqrtOpNode;48;-366.826,795.2014;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SaturateNode;49;-517.6261,801.4014;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.GetLocalVarNode;53;-1232.34,860.269;Inherit;False;29;derivativesLength;1;0;OBJECT;;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.BreakToComponentsNode;55;-1036.94,854.6689;Inherit;False;FLOAT2;1;0;FLOAT2;0,0;False;16;FLOAT;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT;5;FLOAT;6;FLOAT;7;FLOAT;8;FLOAT;9;FLOAT;10;FLOAT;11;FLOAT;12;FLOAT;13;FLOAT;14;FLOAT;15\nNode;AmplifyShaderEditor.RangedFloatNode;58;-637.4819,548.7932;Inherit;False;Constant;_Float7;Float - 7;0;0;Create;True;0;0;False;0;-1;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;35;-1596.804,163.1458;Inherit;False;2;2;0;FLOAT2;0,0;False;1;FLOAT;0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;51;-662.9076,794.273;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.ClampOpNode;57;-477.4815,516.7932;Inherit;False;3;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;2;FLOAT2;1,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;63;-637.4819,452.7921;Inherit;False;2;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;41;-924.8043,291.1458;Inherit;False;2;0;FLOAT2;0,0;False;1;FLOAT;0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.GetLocalVarNode;45;-987.7781,549.8922;Inherit;False;29;derivativesLength;1;0;OBJECT;;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.RangedFloatNode;59;-637.4819,628.7933;Inherit;False;Constant;_Float8;Float - 8;0;0;Create;True;0;0;False;0;1;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.RangedFloatNode;43;-956.7781,452.0911;Inherit;False;Constant;_Float1;Float - 1;0;0;Create;True;0;0;False;0;0.35;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleDivideOpNode;44;-774.1779,498.6923;Inherit;False;2;0;FLOAT;0;False;1;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.LerpOp;73;383.9426,22.72415;Inherit;False;3;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;FLOAT;0;False;1;COLOR;0\nNode;AmplifyShaderEditor.SqrtOpNode;26;-160,-448;Inherit;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.DynamicAppendNode;19;-593.6686,-565.8171;Inherit;False;FLOAT2;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.DynamicAppendNode;21;-592,-368;Inherit;False;FLOAT2;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.DynamicAppendNode;25;-288,-448;Inherit;False;FLOAT2;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.BreakToComponentsNode;28;-966.1454,-418.2566;Inherit;False;FLOAT4;1;0;FLOAT4;0,0,0,0;False;16;FLOAT;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT;5;FLOAT;6;FLOAT;7;FLOAT;8;FLOAT;9;FLOAT;10;FLOAT;11;FLOAT;12;FLOAT;13;FLOAT;14;FLOAT;15\nNode;AmplifyShaderEditor.DotProductOpNode;23;-448,-336;Inherit;False;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;2;95.94269,-73.27585;Inherit;False;Color - A;5;1;False;1;0;COLOR;0,0,0,0;False;1;COLOR;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;10;-678.6784,-881.8192;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.DynamicAppendNode;22;-592,-272;Inherit;False;FLOAT2;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.DynamicAppendNode;20;-592,-464;Inherit;False;FLOAT2;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;12;-549.6785,-980.8192;Inherit;False;2;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.TexCoordVertexDataNode;6;-1051.678,-816.8192;Inherit;False;0;2;0;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.DdyOpNode;15;-140.6784,-877.8192;Inherit;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.GetLocalVarNode;27;-1139.145,-405.2566;Inherit;False;17;UVDerivatives;1;0;OBJECT;;False;1;FLOAT4;0\nNode;AmplifyShaderEditor.RangedFloatNode;11;-833.6784,-945.8192;Inherit;False;Constant;_Float0;Float - 0;0;0;Create;True;0;0;False;0;0.5;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.RangedFloatNode;69;-223.9972,434.8422;Inherit;False;Constant;_Float10;Float - 10;0;0;Create;True;0;0;False;0;0.5;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.RangedFloatNode;36;-1740.804,211.1458;Inherit;False;Constant;_Float2;Float - 2;0;0;Create;True;0;0;False;0;0.25;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.GetLocalVarNode;34;-1755.153,114.0224;Inherit;False;13;FinalUV;1;0;OBJECT;;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SaturateNode;65;253.0029,341.8422;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMaxOpNode;52;-810.9399,854.6689;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.RegisterLocalVarNode;29;-48,-448;Inherit;False;derivativesLength;-1;True;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.DotProductOpNode;24;-448,-544;Inherit;False;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.Vector2Node;9;-994.1925,-1114.645;Inherit;False;Constant;_Vector0;Vector - 0;0;0;Create;True;0;0;False;0;1,1;0,0;0;3;FLOAT2;0;FLOAT;1;FLOAT;2\nNode;AmplifyShaderEditor.FunctionInput;1;-855.6784,-822.8192;Inherit;False;UV;2;0;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionInput;4;-828.1924,-1094.645;Inherit;False;Frequency;2;3;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.RegisterLocalVarNode;13;-395.1576,-957.8666;Inherit;False;FinalUV;-1;True;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.DynamicAppendNode;16;17.45426,-967.288;Inherit;False;FLOAT4;4;0;FLOAT2;0,0;False;1;FLOAT;0;False;2;FLOAT2;0,0;False;3;FLOAT;0;False;1;FLOAT4;0\nNode;AmplifyShaderEditor.RegisterLocalVarNode;17;185.4542,-971.288;Inherit;False;UVDerivatives;-1;True;1;0;FLOAT4;0,0,0,0;False;1;FLOAT4;0\nNode;AmplifyShaderEditor.DdxOpNode;14;-140.6784,-1005.819;Inherit;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionOutput;0;612.215,21.62323;Inherit;False;True;-1;Out;0;False;1;0;COLOR;0,0,0,0;False;1;COLOR;0\nWireConnection;39;0;32;0\nWireConnection;39;1;40;0\nWireConnection;32;0;37;0\nWireConnection;3;0;8;0\nWireConnection;37;0;33;0\nWireConnection;37;1;38;0\nWireConnection;68;0;69;0\nWireConnection;68;1;71;0\nWireConnection;68;2;71;1\nWireConnection;68;3;48;0\nWireConnection;67;0;66;0\nWireConnection;67;1;68;0\nWireConnection;71;0;57;0\nWireConnection;33;0;35;0\nWireConnection;48;0;49;0\nWireConnection;49;0;51;0\nWireConnection;55;0;53;0\nWireConnection;35;0;34;0\nWireConnection;35;1;36;0\nWireConnection;51;0;50;0\nWireConnection;51;1;52;0\nWireConnection;57;0;63;0\nWireConnection;57;1;58;0\nWireConnection;57;2;59;0\nWireConnection;63;0;41;0\nWireConnection;63;1;44;0\nWireConnection;41;0;39;0\nWireConnection;41;1;42;0\nWireConnection;44;0;43;0\nWireConnection;44;1;45;0\nWireConnection;73;0;2;0\nWireConnection;73;1;3;0\nWireConnection;73;2;65;0\nWireConnection;26;0;25;0\nWireConnection;19;0;28;0\nWireConnection;19;1;28;2\nWireConnection;21;0;28;1\nWireConnection;21;1;28;3\nWireConnection;25;0;24;0\nWireConnection;25;1;23;0\nWireConnection;28;0;27;0\nWireConnection;23;0;21;0\nWireConnection;23;1;22;0\nWireConnection;2;0;7;0\nWireConnection;10;0;11;0\nWireConnection;10;1;1;0\nWireConnection;22;0;28;1\nWireConnection;22;1;28;3\nWireConnection;20;0;28;0\nWireConnection;20;1;28;2\nWireConnection;12;0;4;0\nWireConnection;12;1;10;0\nWireConnection;15;0;13;0\nWireConnection;65;0;67;0\nWireConnection;52;0;55;0\nWireConnection;52;1;55;1\nWireConnection;29;0;26;0\nWireConnection;24;0;19;0\nWireConnection;24;1;20;0\nWireConnection;1;0;6;0\nWireConnection;4;0;9;0\nWireConnection;13;0;12;0\nWireConnection;16;0;14;0\nWireConnection;16;2;15;0\nWireConnection;17;0;16;0\nWireConnection;14;0;13;0\nWireConnection;0;0;73;0\nASEEND*/\n//CHKSM=2A92AA4C137FA7B827E342AC45B5BF06C4CEEF0A" - m_functionName: - m_description: Created a checkerboard pattern with given colors where Frequency - controls its tiling - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_additionalDirectives: - m_validData: 0 - m_isDirty: 0 - m_moduleName: ' Additional Directives' - m_independentModule: 1 - m_additionalDirectives: [] - m_shaderFunctionDirectives: [] - m_nativeDirectives: [] - m_nativeDirectivesIndex: -1 - m_nativeDirectivesFoldout: 0 - m_directivesSaveItems: [] - m_nodeCategory: 9 - m_customNodeCategory: - m_previewPosition: 0 - m_hidden: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Checkerboard.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Checkerboard.asset.meta deleted file mode 100644 index bc0c9912..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Checkerboard.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 43dad715d66e03a4c8ad5f9564018081 -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 0 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Color Mask.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Color Mask.asset deleted file mode 100644 index c2303208..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Color Mask.asset +++ /dev/null @@ -1,37 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: Color Mask - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=15401\n346;92;1025;714;609.2212;273.3323;1.054284;True;False\nNode;AmplifyShaderEditor.FunctionInput;1;-653.5797,-106.7027;Float;False;In;3;0;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.DistanceOpNode;6;-448.5804,-174.703;Float;False;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SaturateNode;14;608.4777,116.7526;Float;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;3;-640.5798,-192.703;Float;False;Mask - Color;3;1;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FunctionInput;4;-658.4253,3.963058;Float;False;Range;1;2;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMaxOpNode;11;90.87174,229.5228;Float;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;5;-114.1282,184.5228;Float;False;Fuzziness;1;3;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.RangedFloatNode;12;-74.12819,316.5228;Float;False;Constant;_Float0;Float - 0;0;0;Create;True;0;0;False;0;1E-05;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;8;-172.7711,-116.3855;Float;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleDivideOpNode;10;224.5456,-26.87407;Float;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.OneMinusNode;7;382.857,35.49149;Float;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionOutput;0;773.5771,78.81425;Float;False;True;Output;0;False;1;0;FLOAT;0;False;1;FLOAT;0\nWireConnection;6;0;3;0\nWireConnection;6;1;1;0\nWireConnection;14;0;7;0\nWireConnection;11;0;5;0\nWireConnection;11;1;12;0\nWireConnection;8;0;6;0\nWireConnection;8;1;4;0\nWireConnection;10;0;8;0\nWireConnection;10;1;11;0\nWireConnection;7;0;10;0\nWireConnection;0;0;14;0\nASEEND*/\n//CHKSM=17BE7B1AD5B755695D444DE4E62340591EEA3488" - m_functionName: - m_description: - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_additionalDirectives: - m_validData: 0 - m_isDirty: 0 - m_moduleName: ' Additional Directives' - m_independentModule: 1 - m_additionalDirectives: [] - m_shaderFunctionDirectives: [] - m_nativeDirectives: [] - m_nativeDirectivesFoldout: 0 - m_nodeCategory: 3 - m_customNodeCategory: - m_previewPosition: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Color Mask.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Color Mask.asset.meta deleted file mode 100644 index 363f1041..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Color Mask.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: eec747d987850564c95bde0e5a6d1867 -timeCreated: 1529242750 -licenseType: Store -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/ComputeFilterWidth.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/ComputeFilterWidth.asset deleted file mode 100644 index 286a8b8f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/ComputeFilterWidth.asset +++ /dev/null @@ -1,22 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: ComputeFilterWidth - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=14001\n389;92;1064;673;507.116;202.918;1;True;False\nNode;AmplifyShaderEditor.DotProductOpNode;4;-216,-85;Float;False;2;0;FLOAT3;0,0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SqrtOpNode;7;263,-7;Float;False;1;0;FLOAT;0.0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.ConditionalIfNode;6;38,-37;Float;False;False;5;0;FLOAT;0.0;False;1;FLOAT;0.0;False;2;FLOAT;0.0;False;3;FLOAT;0.0;False;4;FLOAT;0.0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.DotProductOpNode;5;-185,84;Float;False;2;0;FLOAT3;0,0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.DdxOpNode;2;-398,-75;Float;False;1;0;FLOAT3;0.0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FunctionInput;1;-610,-13;Float;False;In;3;0;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.DdyOpNode;3;-372,94;Float;False;1;0;FLOAT3;0.0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FunctionOutput;0;411,14;Float;False;True;Result;0;False;1;0;FLOAT;0.0;False;1;FLOAT;0\nWireConnection;4;0;2;0\nWireConnection;4;1;2;0\nWireConnection;7;0;6;0\nWireConnection;6;0;4;0\nWireConnection;6;1;5;0\nWireConnection;6;2;4;0\nWireConnection;6;3;5;0\nWireConnection;6;4;5;0\nWireConnection;5;0;3;0\nWireConnection;5;1;3;0\nWireConnection;2;0;1;0\nWireConnection;3;0;1;0\nWireConnection;0;0;7;0\nASEEND*/\n//CHKSM=492807FC2E3C8BD5838861DEE6C6EDB10A2FF2D2" - m_functionName: - m_description: - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_nodeCategory: 7 - m_customNodeCategory: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/ComputeFilterWidth.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/ComputeFilterWidth.asset.meta deleted file mode 100644 index 799467fd..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/ComputeFilterWidth.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 326bea850683cca44ae7af083d880d70 -timeCreated: 1512498793 -licenseType: Store -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/ConstantBiasScale.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/ConstantBiasScale.asset deleted file mode 100644 index a7250c5f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/ConstantBiasScale.asset +++ /dev/null @@ -1,26 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: ConstantBiasScale - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=14407\n389;92;1064;673;789;458;1;True;False\nNode;AmplifyShaderEditor.SimpleAddOpNode;6;-227,-128;Float;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;3;-392,-184;Float;False;Input;1;0;True;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;1;-391,-91;Float;False;Bias;1;1;True;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;7;-102,-19;Float;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;2;-392,16;Float;False;Scale;1;2;True;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionOutput;0;78,-35;Float;False;True;Output;0;False;1;0;FLOAT;0;False;1;FLOAT;0\nWireConnection;6;0;3;0\nWireConnection;6;1;1;0\nWireConnection;7;0;6;0\nWireConnection;7;1;2;0\nWireConnection;0;0;7;0\nASEEND*/\n//CHKSM=917F8D80859772EF16ACCF69C2333B732B3FBEF4" - m_functionName: - m_description: Simple Bias and Scale operation. Output = (Input + Bias) * Scale - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_nodeCategory: 3 - m_customNodeCategory: - m_previewPosition: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/ConstantBiasScale.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/ConstantBiasScale.asset.meta deleted file mode 100644 index c1fa681d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/ConstantBiasScale.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 63208df05c83e8e49a48ffbdce2e43a0 -timeCreated: 1519302963 -licenseType: Store -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/CotangentFrame.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/CotangentFrame.asset deleted file mode 100644 index ab1673a5..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/CotangentFrame.asset +++ /dev/null @@ -1,37 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: CotangentFrame - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=15103\n344;92;1056;673;1041.108;554.3792;1;True;False\nNode;AmplifyShaderEditor.FunctionInput;2;-613.4943,-271.5543;Float;False;View - Dir;3;1;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FunctionInput;1;-608.4943,-157.5543;Float;False;UV;2;2;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionInput;4;-592.4943,-397.5543;Float;False;World - Normal;3;0;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.CustomExpressionNode;3;-421.4942,-290.5543;Float;False;float3 - dp1 = ddx ( position )@$float3 dp2 = ddy ( position )@$float2 duv1 = ddx ( uv - )@$float2 duv2 = ddy ( uv )@$float3 dp2perp = cross ( dp2, normal )@$float3 dp1perp - = cross ( normal, dp1 )@$float3 tangent = dp2perp * duv1.x + dp1perp * duv2.x@$float3 - bitangent = dp2perp * duv1.y + dp1perp * duv2.y@$float invmax = rsqrt ( max ( - dot ( tangent, tangent ), dot ( bitangent, bitangent ) ) )@$tangent *= invmax@$bitangent - *= invmax@$return float3x3 (\ttangent.x, bitangent.x, normal.x,$\t\t\t\t\ttangent.y, - bitangent.y, normal.y,$\t\t\t\t\ttangent.z, bitangent.z, normal.z )@;5;False;3;True;normal;FLOAT3;0,0,0;In;True;position;FLOAT3;0,0,0;In;True;uv;FLOAT2;0,0;In;CotangentFrame;False;False;3;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT2;0,0;False;1;FLOAT3x3;0\nNode;AmplifyShaderEditor.FunctionOutput;5;-204.4942,-327.5543;Float;False;True;TBN;0;False;1;0;FLOAT3x3;0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1;False;1;FLOAT3x3;0\nWireConnection;3;0;4;0\nWireConnection;3;1;2;0\nWireConnection;3;2;1;0\nWireConnection;5;0;3;0\nASEEND*/\n//CHKSM=D848432022B91999196CE4B6F7A8557013863A11" - m_functionName: - m_description: 'Calculating Cotangent frame without precomputed data - - http://www.thetenthplanet.de/archives/1180' - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_nodeCategory: 3 - m_customNodeCategory: - m_previewPosition: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/CotangentFrame.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/CotangentFrame.asset.meta deleted file mode 100644 index d33591f0..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/CotangentFrame.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 62ce0f00f1417804bb4f2b38501ba0d0 -timeCreated: 1522316215 -licenseType: Store -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Create Orthogonal Vector.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Create Orthogonal Vector.asset deleted file mode 100644 index ad111c80..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Create Orthogonal Vector.asset +++ /dev/null @@ -1,33 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: Create Orthogonal Vector - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=15104\n465;615;1039;403;1446.756;132.3935;1.734783;True;False\nNode;AmplifyShaderEditor.CrossProductOpNode;28;-512,192;Float;False;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FunctionInput;26;-896,208;Float;False;Vector - 2;3;1;False;1;0;FLOAT3;0,1,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.CrossProductOpNode;30;-96,128;Float;False;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.NormalizeNode;29;-336,192;Float;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.NormalizeNode;27;-720,0;Float;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FunctionInput;25;-896,0;Float;False;Vector - 1;3;0;False;1;0;FLOAT3;1,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.NormalizeNode;31;-720,208;Float;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FunctionOutput;0;128,0;Float;False;True;Vector - 1;0;True;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FunctionOutput;2;128,256;Float;False;False;Vector - 3;2;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FunctionOutput;1;128,128;Float;False;False;Vector - 2;1;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nWireConnection;28;0;27;0\nWireConnection;28;1;31;0\nWireConnection;30;0;29;0\nWireConnection;30;1;27;0\nWireConnection;29;0;28;0\nWireConnection;27;0;25;0\nWireConnection;31;0;26;0\nWireConnection;0;0;27;0\nWireConnection;2;0;29;0\nWireConnection;1;0;30;0\nASEEND*/\n//CHKSM=18CFF9C2BBF194BC2C63D4F07354C52613D46DD0" - m_functionName: - m_description: Providing two vectors creates a third one which is orthogonal to - the first two. It uses the first vector as the main guiding vector changing the - second accordingly. All results are normalized. - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_nodeCategory: 16 - m_customNodeCategory: - m_previewPosition: 1 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Create Orthogonal Vector.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Create Orthogonal Vector.asset.meta deleted file mode 100644 index 7cd33340..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Create Orthogonal Vector.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 83358ef05db30f04ba825a1be5f469d8 -timeCreated: 1518189974 -licenseType: Store -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Decode Directional Lighmap.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Decode Directional Lighmap.asset deleted file mode 100644 index 54f3072a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Decode Directional Lighmap.asset +++ /dev/null @@ -1,45 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: Decode Directional Lighmap - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=17701\n412;73;1609;802;1389.521;361.4048;1;True;False\nNode;AmplifyShaderEditor.CustomExpressionNode;1;-135.5,-181;Float;False;return - DecodeDirectionalLightmap( Color,DirTex,NormalWorld)@;3;False;3;True;Color;FLOAT3;0,0,0;In;;Float;False;True;DirTex;FLOAT4;0,0,0,0;In;;Float;False;True;NormalWorld;FLOAT3;0,0,0;In;;Float;False;ASEDecodeDirectionalLightmap;False;False;0;3;0;FLOAT3;0,0,0;False;1;FLOAT4;0,0,0,0;False;2;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.RegisterLocalVarNode;23;-622.1301,-200.5;Inherit;False;inputColor;-1;True;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FunctionInput;4;-466.5,-12;Inherit;False;NormalWorld;3;2;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.RangedFloatNode;9;-480,240;Inherit;False;Constant;_Float0;Float - 0;0;0;Create;True;0;0;False;0;0.5;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;13;293.7467,121.8659;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.SimpleMaxOpNode;16;356.1465,405.266;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.RangedFloatNode;17;190.3352,367.6559;Inherit;False;Constant;_Float2;Float - 2;0;0;Create;True;0;0;False;0;0.0001;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.SwizzleNode;18;176.3352,467.6559;Inherit;False;FLOAT;3;1;2;3;1;0;FLOAT4;0,0,0,0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.WireNode;20;-527.6785,372.98;Inherit;False;1;0;FLOAT4;0,0,0,0;False;1;FLOAT4;0\nNode;AmplifyShaderEditor.SimpleDivideOpNode;15;502.8605,106.8558;Inherit;False;2;0;FLOAT3;0,0,0;False;1;FLOAT;0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FunctionSwitchByPipeline;5;682.8613,-173.207;Inherit;False;4;0;FLOAT3;0,0,0;False;3;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.SwizzleNode;6;-480,160;Inherit;False;FLOAT3;0;1;2;3;1;0;FLOAT4;0,0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.DotProductOpNode;7;-144,64;Inherit;False;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;8;-320,176;Inherit;False;2;0;FLOAT3;0,0,0;False;1;FLOAT;0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.RangedFloatNode;12;-140.6092,173.8985;Inherit;False;Constant;_Float1;Float - 1;0;0;Create;True;0;0;False;0;0.5;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;11;48,96;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;2;-857.1957,-104.1015;Inherit;False;DirTex;4;1;False;1;0;FLOAT4;0,0,0,0;False;1;FLOAT4;0\nNode;AmplifyShaderEditor.FunctionInput;3;-852.2914,-189.0047;Inherit;False;Color;3;0;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.GetLocalVarNode;24;40.90209,216.6535;Inherit;False;23;inputColor;1;0;OBJECT;;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FunctionOutput;0;916.3615,-183.7863;Inherit;False;True;-1;Output;0;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nWireConnection;1;0;23;0\nWireConnection;1;1;2;0\nWireConnection;1;2;4;0\nWireConnection;23;0;3;0\nWireConnection;13;0;11;0\nWireConnection;13;1;24;0\nWireConnection;16;0;17;0\nWireConnection;16;1;18;0\nWireConnection;18;0;20;0\nWireConnection;20;0;2;0\nWireConnection;15;0;13;0\nWireConnection;15;1;16;0\nWireConnection;5;0;1;0\nWireConnection;5;3;1;0\nWireConnection;5;1;15;0\nWireConnection;5;2;15;0\nWireConnection;6;0;2;0\nWireConnection;7;0;4;0\nWireConnection;7;1;8;0\nWireConnection;8;0;6;0\nWireConnection;8;1;9;0\nWireConnection;11;0;7;0\nWireConnection;11;1;12;0\nWireConnection;0;0;5;0\nASEEND*/\n//CHKSM=887A7A2BA5CFB5CBB9854D026B260CA7971382E5" - m_functionName: - m_description: 'Calls Unity internal DecodeDirectionalLightmap function. - - Uses custom graph on all other pipelines' - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_additionalDirectives: - m_validData: 0 - m_isDirty: 0 - m_moduleName: ' Additional Directives' - m_independentModule: 1 - m_additionalDirectives: [] - m_shaderFunctionDirectives: [] - m_nativeDirectives: [] - m_nativeDirectivesIndex: -1 - m_nativeDirectivesFoldout: 0 - m_directivesSaveItems: [] - m_nodeCategory: 3 - m_customNodeCategory: - m_previewPosition: 0 - m_hidden: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Decode Directional Lighmap.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Decode Directional Lighmap.asset.meta deleted file mode 100644 index b33de370..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Decode Directional Lighmap.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 8132441d5c7c63f479ea1c42855420a8 -timeCreated: 1550589461 -licenseType: Store -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Derive Tangent Basis.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Derive Tangent Basis.asset deleted file mode 100644 index 3a739110..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Derive Tangent Basis.asset +++ /dev/null @@ -1,64 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: Derive Tangent Basis - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=17102\n0;731;1536;630;1714.5;318.7658;1;True;False\nNode;AmplifyShaderEditor.WorldNormalVector;10;-821.4876,20.21545;Inherit;False;False;1;0;FLOAT3;0,0,1;False;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3\nNode;AmplifyShaderEditor.FunctionInput;5;-784.8259,164.9036;Inherit;False;UV;2;0;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.WorldPosInputsNode;13;-823.4999,-127.2658;Inherit;False;0;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3\nNode;AmplifyShaderEditor.CustomExpressionNode;1;-529.4937,-4.008303;Inherit;False;#if - (SHADER_TARGET >= 45)$float3 dPdx = ddx_fine( WorldPosition )@$float3 dPdy = ddy_fine( - WorldPosition )@$#else$float3 dPdx = ddx( WorldPosition )@$float3 dPdy = ddy( - WorldPosition )@$#endif$$float3 sigmaX = dPdx - dot( dPdx, WorldNormal ) * WorldNormal@$float3 - sigmaY = dPdy - dot( dPdy, WorldNormal ) * WorldNormal@$$float flip_sign = dot( - dPdy, cross( WorldNormal, dPdx ) ) < 0 ? -1 : 1@$$#if (SHADER_TARGET >= 45)$float2 - dSTdx = ddx_fine( UV )@$float2 dSTdy = ddy_fine( UV )@$#else$float2 dSTdx = ddx( - UV )@$float2 dSTdy = ddy( UV )@$#endif$$float det = dot( dSTdx, float2( dSTdy.y, - -dSTdy.x ) )@$float sign_det = ( det < 0 ) ? -1 : 1@$$float2 invC0 = sign_det - * float2( dSTdy.y, -dSTdx.y )@$$float3 T = sigmaX * invC0.x + sigmaY * invC0.y@$if - ( abs( det ) > 0 ) T = normalize( T )@$$float3 B = ( sign_det * flip_sign ) * - cross( WorldNormal, T )@$$WorldToTangent = float3x3( T, B, WorldNormal )@$TangentToWorld - = transpose( WorldToTangent )@$return@;7;False;5;True;WorldPosition;FLOAT3;0,0,0;In;;Float;False;True;WorldNormal;FLOAT3;0,0,0;In;;Float;False;True;UV;FLOAT2;0,0;In;;Float;False;True;TangentToWorld;FLOAT3x3;1,0,0,1,1,1,1,0,1;Out;;Float;False;True;WorldToTangent;FLOAT3x3;1,0,0,1,1,1,1,0,1;Out;;Float;False;Derive - Tangent Basis;False;False;0;6;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT3;0,0,0;False;3;FLOAT2;0,0;False;4;FLOAT3x3;1,0,0,1,1,1,1,0,1;False;5;FLOAT3x3;1,0,0,1,1,1,1,0,1;False;3;FLOAT3;0;FLOAT3x3;5;FLOAT3x3;6\nNode;AmplifyShaderEditor.FunctionOutput;0;-147.9617,-6.546963;Inherit;False;True;Tangent - To World;0;False;1;0;FLOAT3x3;0,0,0,1,1,1,1,0,1;False;1;FLOAT3x3;0\nNode;AmplifyShaderEditor.FunctionOutput;6;-143.2227,68.66327;Inherit;False;False;World - To Tangent;1;False;1;0;FLOAT3x3;0,0,0,1,1,1,1,0,1;False;1;FLOAT3x3;0\nWireConnection;1;1;13;0\nWireConnection;1;2;10;0\nWireConnection;1;3;5;0\nWireConnection;0;0;1;5\nWireConnection;6;0;1;6\nASEEND*/\n//CHKSM=AEDC509876FA685886EABAB4978B0630E667D50E" - m_functionName: - m_description: 'This function derives a per-pixel tangent basis for a specific set - of UV coordinates. The built-in tangent basis is based on UV0. This function allows - normal mapping for UV1 or any other UV set, including runtime generated. - - - Typical usage case: - - Blending additional normal mapped layers that require non-UV0 coordinates. - - - Based on "Surface Gradient Based Bump Mapping Framework" by Morten S. Mikkelsen' - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_additionalDirectives: - m_validData: 0 - m_isDirty: 0 - m_moduleName: ' Additional Directives' - m_independentModule: 1 - m_additionalDirectives: [] - m_shaderFunctionDirectives: [] - m_nativeDirectives: [] - m_nativeDirectivesIndex: -1 - m_nativeDirectivesFoldout: 0 - m_directivesSaveItems: [] - m_nodeCategory: 3 - m_customNodeCategory: - m_previewPosition: 0 - m_hidden: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Derive Tangent Basis.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Derive Tangent Basis.asset.meta deleted file mode 100644 index 89b545c4..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Derive Tangent Basis.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: fee816718ad753c4f9b25822c0d67438 -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 0 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Detail Albedo.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Detail Albedo.asset deleted file mode 100644 index 785378ce..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Detail Albedo.asset +++ /dev/null @@ -1,30 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: Detail Albedo - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=15308\n234;92;1334;669;1058.943;684.4172;1.391955;True;False\nNode;AmplifyShaderEditor.FunctionInput;11;-791.7281,-222.1082;Float;False;Detail - Albedo;3;1;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.ComponentMaskNode;10;-1044.388,-263.2733;Float;False;True;True;True;False;1;0;COLOR;0,0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.SamplerNode;2;-1374.942,-264.6411;Float;True;Property;_DetailAlbedo;Detail - Albedo;1;0;Create;True;0;0;False;0;None;bdbe94d7623ec3940947b62544306f1c;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.SamplerNode;7;-917.0518,-585.9581;Float;True;Property;_Albedo;Albedo;0;0;Create;True;0;0;False;0;None;37e6f91f3efb0954cbdce254638862ea;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.ComponentMaskNode;5;-897.4531,2.035467;Float;False;True;True;True;False;1;0;COLOR;0,0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.ComponentMaskNode;13;-545.7818,-575.8773;Float;False;True;True;True;False;1;0;COLOR;0,0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;3;-621.8271,-138.6786;Float;False;2;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.ColorSpaceDouble;1;-1143.392,22.29117;Float;False;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.FunctionInput;9;-388.3632,289.7231;Float;False;Detail - Mask;1;2;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SamplerNode;4;-724.7507,221.7417;Float;True;Property;_DetailMask;Detail - Mask;2;0;Create;True;0;0;False;0;None;37e6f91f3efb0954cbdce254638862ea;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.FunctionInput;12;-215.2053,-435.8505;Float;False;Albedo;3;0;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.DynamicAppendNode;16;116.0423,225.5565;Float;False;FLOAT3;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;17;-72.95755,102.5566;Float;False;2;2;0;FLOAT3;0,0,0;False;1;FLOAT;0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.OneMinusNode;18;-88.95757,230.5565;Float;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;15;311.0422,102.5566;Float;False;2;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;8;487.2353,-311.0565;Float;False;2;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FunctionOutput;0;677.5877,-317.7978;Float;False;True;Output;0;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nWireConnection;11;0;10;0\nWireConnection;10;0;2;0\nWireConnection;5;0;1;0\nWireConnection;13;0;7;0\nWireConnection;3;0;11;0\nWireConnection;3;1;5;0\nWireConnection;9;0;4;4\nWireConnection;12;0;13;0\nWireConnection;16;0;18;0\nWireConnection;16;1;18;0\nWireConnection;16;2;18;0\nWireConnection;17;0;3;0\nWireConnection;17;1;9;0\nWireConnection;18;0;9;0\nWireConnection;15;0;17;0\nWireConnection;15;1;16;0\nWireConnection;8;0;12;0\nWireConnection;8;1;15;0\nWireConnection;0;0;8;0\nASEEND*/\n//CHKSM=98DA4DD57D5904F6ADF4806CACEF92157BC023C5" - m_functionName: - m_description: Adds Detail Abledo X2 map, similar to Standard Material - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_nodeCategory: 3 - m_customNodeCategory: - m_previewPosition: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Detail Albedo.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Detail Albedo.asset.meta deleted file mode 100644 index 4f4f8d9c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Detail Albedo.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 29e5a290b15a7884983e27c8f1afaa8c -timeCreated: 1527501568 -licenseType: Store -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Dots Pattern.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Dots Pattern.asset deleted file mode 100644 index aee150d2..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Dots Pattern.asset +++ /dev/null @@ -1,42 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: Dots Pattern - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=17902\n-1462;-370;1004;726;3436.004;1250.192;3.58226;True;False\nNode;AmplifyShaderEditor.FunctionInput;4;-1216,-64;Inherit;False;Offset - X;1;3;False;1;0;FLOAT;0.5;False;1;FLOAT;0\nNode;AmplifyShaderEditor.BreakToComponentsNode;16;-1712,-128;Inherit;False;FLOAT2;1;0;FLOAT2;0,0;False;16;FLOAT;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT;5;FLOAT;6;FLOAT;7;FLOAT;8;FLOAT;9;FLOAT;10;FLOAT;11;FLOAT;12;FLOAT;13;FLOAT;14;FLOAT;15\nNode;AmplifyShaderEditor.FractNode;6;-400,0;Inherit;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionInput;2;-400,96;Inherit;False;Size;1;2;False;1;0;FLOAT;0.9;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionNode;1;-256,0;Inherit;True;Ellipse;-1;;1;3ba94b7b3cfd5f447befde8107c04d52;0;3;2;FLOAT2;0,0;False;7;FLOAT;0.5;False;9;FLOAT;0.5;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionSwitch;22;-1953.205,-105.9789;Inherit;False;Custom - UVs;True;0;2;0;In 0;In 1;Object;-1;9;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT;0;False;4;FLOAT;0;False;5;FLOAT;0;False;6;FLOAT;0;False;7;FLOAT;0;False;8;FLOAT;0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionInput;21;-2144,-16;Inherit;False;UV;2;0;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.TexCoordVertexDataNode;13;-2416,-128;Inherit;False;0;2;0;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.FunctionInput;3;-2368,0;Inherit;False;Tiling;2;1;False;1;0;FLOAT2;8,8;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;15;-2144,-128;Inherit;False;2;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;17;-896,128;Inherit;True;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleRemainderNode;11;-1408,32;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;2;False;1;FLOAT;0\nNode;AmplifyShaderEditor.StepOpNode;10;-1216,16;Inherit;False;2;0;FLOAT;1;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;8;-896,-128;Inherit;True;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;9;-1056,-32;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;18;-1056,208;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.DynamicAppendNode;7;-560,0;Inherit;False;FLOAT2;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionInput;5;-1216,176;Inherit;False;Offset - Y;1;4;False;1;0;FLOAT;1;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleRemainderNode;20;-1408,288;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;2;False;1;FLOAT;0\nNode;AmplifyShaderEditor.StepOpNode;19;-1216,272;Inherit;False;2;0;FLOAT;1;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionOutput;0;0,0;Inherit;False;True;-1;Out;0;False;1;0;FLOAT;0;False;1;FLOAT;0\nWireConnection;16;0;22;0\nWireConnection;6;0;7;0\nWireConnection;1;2;6;0\nWireConnection;1;7;2;0\nWireConnection;1;9;2;0\nWireConnection;22;0;15;0\nWireConnection;22;1;21;0\nWireConnection;21;0;13;0\nWireConnection;15;0;13;0\nWireConnection;15;1;3;0\nWireConnection;17;0;16;1\nWireConnection;17;1;18;0\nWireConnection;11;0;16;1\nWireConnection;10;1;11;0\nWireConnection;8;0;16;0\nWireConnection;8;1;9;0\nWireConnection;9;0;4;0\nWireConnection;9;1;10;0\nWireConnection;18;0;5;0\nWireConnection;18;1;19;0\nWireConnection;7;0;8;0\nWireConnection;7;1;17;0\nWireConnection;20;0;16;0\nWireConnection;19;1;20;0\nWireConnection;0;0;1;0\nASEEND*/\n//CHKSM=26E6410FBC1EBC56E76C21CF54FC55DEAFFEA95F" - m_functionName: - m_description: Creates a repeated dots pattern with alternating offsetted lines - or columns of dots. - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_additionalDirectives: - m_validData: 0 - m_isDirty: 0 - m_moduleName: ' Additional Directives' - m_independentModule: 1 - m_additionalDirectives: [] - m_shaderFunctionDirectives: [] - m_nativeDirectives: [] - m_nativeDirectivesIndex: -1 - m_nativeDirectivesFoldout: 0 - m_directivesSaveItems: [] - m_nodeCategory: 9 - m_customNodeCategory: - m_previewPosition: 0 - m_hidden: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Dots Pattern.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Dots Pattern.asset.meta deleted file mode 100644 index dad79058..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Dots Pattern.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 7d8d5e315fd9002418fb41741d3a59cb -timeCreated: 1586787388 -licenseType: Store -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Ellipse.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Ellipse.asset deleted file mode 100644 index 4891837c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Ellipse.asset +++ /dev/null @@ -1,40 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: Ellipse - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=17902\n-1410;-481;1109;726;1067.283;573.8351;2;True;False\nNode;AmplifyShaderEditor.SimpleDivideOpNode;15;736,128;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.OneMinusNode;13;560,128;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.DynamicAppendNode;11;64,304;Inherit;False;FLOAT2;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SaturateNode;16;880,128;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FWidthOpNode;14;560,208;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.LengthOpNode;17;384,128;Inherit;False;1;0;FLOAT2;0,0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleDivideOpNode;12;240,128;Inherit;False;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionInput;9;-112,384;Inherit;False;Height;1;2;False;1;0;FLOAT;0.5;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;7;-112,304;Inherit;False;Width;1;1;False;1;0;FLOAT;0.5;False;1;FLOAT;0\nNode;AmplifyShaderEditor.ScaleAndOffsetNode;3;-48,32;Inherit;True;3;0;FLOAT2;0,0;False;1;FLOAT;2;False;2;FLOAT;-1;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.RangedFloatNode;5;-272,128;Inherit;False;Constant;_Float1;Float - 1;0;0;Create;True;0;0;False;0;-1;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.RangedFloatNode;4;-272,32;Inherit;False;Constant;_Float0;Float - 0;0;0;Create;True;0;0;False;0;2;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;2;-272,-64;Inherit;False;UV;2;0;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.TexCoordVertexDataNode;1;-496,-64;Inherit;False;0;2;0;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.FunctionOutput;0;1024,128;Inherit;False;True;-1;Out;0;False;1;0;FLOAT;0;False;1;FLOAT;0\nWireConnection;15;0;13;0\nWireConnection;15;1;14;0\nWireConnection;13;0;17;0\nWireConnection;11;0;7;0\nWireConnection;11;1;9;0\nWireConnection;16;0;15;0\nWireConnection;14;0;17;0\nWireConnection;17;0;12;0\nWireConnection;12;0;3;0\nWireConnection;12;1;11;0\nWireConnection;3;0;2;0\nWireConnection;3;1;4;0\nWireConnection;3;2;5;0\nWireConnection;2;0;1;0\nWireConnection;0;0;16;0\nASEEND*/\n//CHKSM=00B1FD172E8372FBCF36CB9A133FB643740A4B46" - m_functionName: - m_description: Creates an ellipse based on given uv and dimensions - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_additionalDirectives: - m_validData: 0 - m_isDirty: 0 - m_moduleName: ' Additional Directives' - m_independentModule: 1 - m_additionalDirectives: [] - m_shaderFunctionDirectives: [] - m_nativeDirectives: [] - m_nativeDirectivesIndex: -1 - m_nativeDirectivesFoldout: 0 - m_directivesSaveItems: [] - m_nodeCategory: 9 - m_customNodeCategory: - m_previewPosition: 0 - m_hidden: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Ellipse.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Ellipse.asset.meta deleted file mode 100644 index 4899a58d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Ellipse.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 3ba94b7b3cfd5f447befde8107c04d52 -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 0 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/FetchHDColorPyramid.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/FetchHDColorPyramid.asset deleted file mode 100644 index 58671c7b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/FetchHDColorPyramid.asset +++ /dev/null @@ -1,40 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: FetchHDColorPyramid - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=15502\n460;92;961;705;422.5;427.5;1;True;False\nNode;AmplifyShaderEditor.FunctionSwitchByPipeline;4;192.5,-174.5;Float;False;3;0;FLOAT4;0,0,0,0;False;1;FLOAT4;0,0,0,0;False;2;FLOAT4;0,0,0,0;False;1;FLOAT4;0\nNode;AmplifyShaderEditor.Vector4Node;5;-38.5,-232.5;Float;False;Constant;_Vector0;Vector - 0;0;0;Create;True;0;0;False;0;0,0,0,0;0,0,0,0;0;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.CustomExpressionNode;1;-33.5,-23.5;Float;False;LOAD_TEXTURE2D_LOD(\r - \ _ColorPyramidTexture,UV,LOD);4;False;2;True;UV;FLOAT2;0,0;In;;True;LOD;FLOAT;0;In;;FetchColorPyramid;True;False;0;2;0;FLOAT2;0,0;False;1;FLOAT;0;False;1;FLOAT4;0\nNode;AmplifyShaderEditor.FunctionInput;2;-195.5,35.5;Float;False;LOD;1;1;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;3;-227.5,-119.5;Float;False;UV;2;0;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionOutput;0;432,-54;Float;False;True;Output;0;False;1;0;FLOAT4;0,0,0,0;False;1;FLOAT4;0\nWireConnection;4;0;5;0\nWireConnection;4;1;5;0\nWireConnection;4;2;1;0\nWireConnection;1;0;3;0\nWireConnection;1;1;2;0\nWireConnection;0;0;4;0\nASEEND*/\n//CHKSM=FCEB018C27BAF233C7FC33A2B4BB473BEB28E231" - m_functionName: - m_description: 'Fetches the _ColorPyramidTexture texture of the HDRP pipeline. - - Using this over LW or default pipelines will result in incorrect behaviors.' - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_additionalDirectives: - m_validData: 0 - m_isDirty: 0 - m_moduleName: ' Additional Directives' - m_independentModule: 1 - m_additionalDirectives: [] - m_shaderFunctionDirectives: [] - m_nativeDirectives: [] - m_nativeDirectivesFoldout: 0 - m_directivesSaveItems: [] - m_nodeCategory: 3 - m_customNodeCategory: - m_previewPosition: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/FetchHDColorPyramid.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/FetchHDColorPyramid.asset.meta deleted file mode 100644 index 29497bee..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/FetchHDColorPyramid.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: e17d5b1cd6898394dbe1f30e05022025 -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 11400000 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/FetchLightmapValue.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/FetchLightmapValue.asset deleted file mode 100644 index 330da53d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/FetchLightmapValue.asset +++ /dev/null @@ -1,44 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: FetchLightmapValue - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=16205\n234;92;1295;716;-169.6277;375.1745;1.3;True;False\nNode;AmplifyShaderEditor.SwizzleNode;9;-188.546,133.5814;Float;False;FLOAT2;2;3;2;3;1;0;FLOAT4;0,0,0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.VertexToFragmentNode;10;368,-112;Float;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.Vector4Node;8;-500.423,19.56814;Float;False;Global;unity_LightmapST;unity_LightmapST;2;0;Fetch;True;0;0;False;0;0,0,0,0;1,1,0,0;0;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;5;-28.547,-122.4186;Float;False;2;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SwizzleNode;4;-188.546,21.5814;Float;False;FLOAT2;0;1;2;3;1;0;FLOAT4;0,0,0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.StaticSwitch;13;981.1006,204.6251;Float;False;Property;_Keyword0;Keyword - 0;1;0;Fetch;True;0;0;False;0;0;0;0;False;UNITY_LIGHTMAP_FULL_HDR;Toggle;2;Key0;Key1;9;1;FLOAT4;0,0,0,0;False;0;FLOAT4;0,0,0,0;False;2;FLOAT4;0,0,0,0;False;3;FLOAT4;0,0,0,0;False;4;FLOAT4;0,0,0,0;False;5;FLOAT4;0,0,0,0;False;6;FLOAT4;0,0,0,0;False;7;FLOAT4;0,0,0,0;False;8;FLOAT4;0,0,0,0;False;1;FLOAT4;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;3;224,-32;Float;False;2;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SamplerNode;7;654.0723,-337.4277;Float;True;Property;_TextureSample0;Texture - Sample 0;0;0;Create;True;0;0;False;0;None;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.TextureCoordinatesNode;2;-528,-128;Float;False;1;-1;2;3;2;SAMPLER2D;;False;0;FLOAT2;1,1;False;1;FLOAT2;0,0;False;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.StaticSwitch;15;602.9202,151.7659;Float;False;Property;_Keyword2;Keyword - 2;2;0;Fetch;True;0;0;False;0;0;0;0;False;UNITY_LIGHTMAP_RGBM_ENCODING;Toggle;2;Key0;Key1;9;1;FLOAT4;0,0,0,0;False;0;FLOAT4;0,0,0,0;False;2;FLOAT4;0,0,0,0;False;3;FLOAT4;0,0,0,0;False;4;FLOAT4;0,0,0,0;False;5;FLOAT4;0,0,0,0;False;6;FLOAT4;0,0,0,0;False;7;FLOAT4;0,0,0,0;False;8;FLOAT4;0,0,0,0;False;1;FLOAT4;0\nNode;AmplifyShaderEditor.Vector4Node;17;329.9202,94.76587;Float;False;Constant;_Vector2;Vector - 2;3;0;Create;True;0;0;False;0;2,2.2,0,0;0,0,0,0;0;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.TexturePropertyNode;1;314.5027,-433.4464;Float;True;Global;unity_Lightmap;unity_Lightmap;0;0;Create;True;0;0;False;0;None;None;False;white;Auto;Texture2D;0;1;SAMPLER2D;0\nNode;AmplifyShaderEditor.Vector4Node;18;322.9202,307.7659;Float;False;Constant;_Vector3;Vector - 3;3;0;Create;True;0;0;False;0;34.49324,2.2,0,0;0,0,0,0;0;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.DecodeLightmapHlpNode;6;1313.549,-194.924;Float;False;2;0;FLOAT4;0,0,0,0;False;1;FLOAT4;0,0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.Vector4Node;16;754.9202,321.7659;Float;False;Constant;_Vector1;Vector - 1;3;0;Create;True;0;0;False;0;0,0,0,0;0,0,0,0;0;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.CustomExpressionNode;11;735.7104,-21.51056;Float;False;return - SAMPLE_TEXTURE2D( unity_Lightmap, samplerunity_Lightmap, UV )@;4;False;1;True;UV;FLOAT2;0,0;In;;Float;SampleLightmapHD;True;False;0;1;0;FLOAT2;0,0;False;1;FLOAT4;0\nNode;AmplifyShaderEditor.FunctionSwitchByPipeline;12;1027.71,-224.5106;Float;False;3;0;COLOR;0,0,0,0;False;1;FLOAT4;0,0,0,0;False;2;FLOAT4;0,0,0,0;False;1;COLOR;0\nNode;AmplifyShaderEditor.FunctionOutput;0;1545.852,-190.3676;Float;False;True;Output;0;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nWireConnection;9;0;8;0\nWireConnection;10;0;3;0\nWireConnection;5;0;2;0\nWireConnection;5;1;4;0\nWireConnection;4;0;8;0\nWireConnection;13;1;15;0\nWireConnection;13;0;16;0\nWireConnection;3;0;5;0\nWireConnection;3;1;9;0\nWireConnection;7;0;1;0\nWireConnection;7;1;10;0\nWireConnection;15;1;17;0\nWireConnection;15;0;18;0\nWireConnection;6;0;12;0\nWireConnection;6;1;13;0\nWireConnection;11;0;10;0\nWireConnection;12;0;7;0\nWireConnection;12;1;11;0\nWireConnection;12;2;11;0\nWireConnection;0;0;6;0\nASEEND*/\n//CHKSM=F6FA52D482B850462FBD099367992FDE64BDD469" - m_functionName: - m_description: 'Fetches the value from the lightmap. Multiply the fetched value - by the final fragment color. ' - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_additionalDirectives: - m_validData: 0 - m_isDirty: 0 - m_moduleName: ' Additional Directives' - m_independentModule: 1 - m_additionalDirectives: [] - m_shaderFunctionDirectives: [] - m_nativeDirectives: [] - m_nativeDirectivesFoldout: 0 - m_directivesSaveItems: [] - m_nodeCategory: 3 - m_customNodeCategory: - m_previewPosition: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/FetchLightmapValue.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/FetchLightmapValue.asset.meta deleted file mode 100644 index af3eb8d8..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/FetchLightmapValue.asset.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 43de3d4ae59f645418fdd020d1b8e78e -timeCreated: 1528994083 -licenseType: Store -NativeFormatImporter: - mainObjectFileID: 11400000 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Flipbook.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Flipbook.asset deleted file mode 100644 index 7c8153f7..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Flipbook.asset +++ /dev/null @@ -1,36 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: Flipbook - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=14204\n487;595;979;423;2696.247;1459.301;4.894685;True;False\nNode;AmplifyShaderEditor.GetLocalVarNode;50;-816,96;Float;False;39;0;1;FLOAT;0\nNode;AmplifyShaderEditor.ClampOpNode;42;-992,80;Float;False;3;0;FLOAT;0.0;False;1;FLOAT;0.0001;False;2;FLOAT;8.0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.DynamicAppendNode;8;-128,-128;Float;False;FLOAT2;4;0;FLOAT;0.0;False;1;FLOAT;0.0;False;2;FLOAT;0.0;False;3;FLOAT;0.0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.BreakToComponentsNode;49;640,-112;Float;False;FLOAT2;1;0;FLOAT2;0,0;False;16;FLOAT;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT;5;FLOAT;6;FLOAT;7;FLOAT;8;FLOAT;9;FLOAT;10;FLOAT;11;FLOAT;12;FLOAT;13;FLOAT;14;FLOAT;15\nNode;AmplifyShaderEditor.SimpleDivideOpNode;27;-608,0;Float;False;2;0;FLOAT;0.0;False;1;FLOAT;9.0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FractNode;35;-464,0;Float;False;1;0;FLOAT;0.0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;44;-1168,160;Float;False;2;0;FLOAT;0.0;False;1;FLOAT;1.0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;2;-992,0;Float;False;Time;1;5;False;1;0;FLOAT;0.0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FloorOpNode;10;160,-64;Float;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionInput;24;-1200,80;Float;False;Start - Frame;1;4;False;1;0;FLOAT;0.0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.RegisterLocalVarNode;39;-464,-176;Float;False;totalFrames;-1;True;1;0;FLOAT;0.0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionSwitch;68;1408,-720;Float;False;Mip - Mode;False;0;3;1;Auto;Bias;Level;8;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;COLOR;0,0,0,0;False;3;FLOAT;0.0;False;4;FLOAT;0.0;False;5;FLOAT;0.0;False;6;FLOAT;0.0;False;7;FLOAT;0.0;False;1;COLOR;0\nNode;AmplifyShaderEditor.OneMinusNode;38;-304,64;Float;False;1;0;FLOAT;0.0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.GetLocalVarNode;40;-1376,160;Float;False;39;0;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleTimeNode;3;-1200,0;Float;False;1;0;FLOAT;1.0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;9;16,-64;Float;False;2;2;0;FLOAT2;0,0;False;1;FLOAT2;0.0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;15;480,-224;Float;False;2;2;0;FLOAT2;0,0;False;1;FLOAT2;0.0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.DynamicAppendNode;7;-128,-256;Float;False;FLOAT2;4;0;FLOAT;0.0;False;1;FLOAT;0.0;False;2;FLOAT;0.0;False;3;FLOAT;0.0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.TexCoordVertexDataNode;14;-128,-384;Float;False;0;2;0;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;67;-304,160;Float;False;2;2;0;FLOAT;0.0;False;1;FLOAT;0.0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;5;-768,-96;Float;False;Rows;1;3;False;1;0;FLOAT;3.0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;6;-624,-176;Float;False;2;2;0;FLOAT;0.0;False;1;FLOAT;0.0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;4;-768,-256;Float;False;Colums;1;2;False;1;0;FLOAT;3.0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.DynamicAppendNode;29;-128,0;Float;False;FLOAT2;4;0;FLOAT;0.0;False;1;FLOAT;0.0;False;2;FLOAT;0.0;False;3;FLOAT;0.0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionInput;13;128,-384;Float;False;UV;2;1;False;1;0;FLOAT2;1,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SamplerNode;69;896,-512;Float;True;Property;_SamplerLevel;Sampler - Level;0;0;Create;True;None;None;True;0;False;white;Auto;False;Object;-1;MipLevel;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0.0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1.0;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.SimpleDivideOpNode;12;320,-288;Float;False;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionInput;51;512,-896;Float;False;Tex;9;0;False;1;0;SAMPLER2D;0.0;False;1;SAMPLER2D;0\nNode;AmplifyShaderEditor.SimpleDivideOpNode;11;320,-160;Float;False;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;22;-768,0;Float;False;2;2;0;FLOAT;0.0;False;1;FLOAT;0.0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;70;512,-512;Float;False;Mip - Level;1;7;False;1;0;FLOAT;0.0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SamplerNode;52;896,-896;Float;True;Property;_SamplerAuto;Sampler - Auto;0;0;Create;True;None;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0.0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1.0;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.SamplerNode;57;896,-704;Float;True;Property;_SamplerBias;Sampler - Bias;0;0;Create;True;None;None;True;0;False;white;Auto;False;Object;-1;MipBias;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0.0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1.0;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.FunctionInput;55;512,-704;Float;False;Mip - Bias;1;6;False;1;0;FLOAT;0.0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionSwitch;71;1654.729,-742.7292;Float;False;Use - Texture;True;0;2;0;False;True;8;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;FLOAT;0.0;False;3;FLOAT;0.0;False;4;FLOAT;0.0;False;5;FLOAT;0.0;False;6;FLOAT;0.0;False;7;FLOAT;0.0;False;1;COLOR;0\nNode;AmplifyShaderEditor.FunctionOutput;0;896,-224;Float;False;True;UV;1;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionOutput;53;1882.438,-748.9789;Float;False;False;RGBA;0;True;1;0;COLOR;0,0,0,0;False;1;COLOR;0\nNode;AmplifyShaderEditor.FunctionOutput;47;896,-128;Float;False;False;U;2;False;1;0;FLOAT;0,0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionOutput;62;-112,160;Float;False;False;Cur - Frame;4;False;1;0;FLOAT;0,0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionOutput;48;896,-64;Float;False;False;V;3;False;1;0;FLOAT;0,0;False;1;FLOAT;0\nWireConnection;42;0;24;0\nWireConnection;42;2;44;0\nWireConnection;8;0;39;0\nWireConnection;8;1;5;0\nWireConnection;49;0;15;0\nWireConnection;27;0;22;0\nWireConnection;27;1;50;0\nWireConnection;35;0;27;0\nWireConnection;44;0;40;0\nWireConnection;2;0;3;0\nWireConnection;10;0;9;0\nWireConnection;39;0;6;0\nWireConnection;68;0;52;0\nWireConnection;68;1;57;0\nWireConnection;68;2;69;0\nWireConnection;38;0;35;0\nWireConnection;9;0;8;0\nWireConnection;9;1;29;0\nWireConnection;15;0;12;0\nWireConnection;15;1;11;0\nWireConnection;7;0;4;0\nWireConnection;7;1;5;0\nWireConnection;67;0;35;0\nWireConnection;67;1;50;0\nWireConnection;6;0;4;0\nWireConnection;6;1;5;0\nWireConnection;29;0;35;0\nWireConnection;29;1;38;0\nWireConnection;13;0;14;0\nWireConnection;69;0;51;0\nWireConnection;69;1;15;0\nWireConnection;69;2;70;0\nWireConnection;12;0;13;0\nWireConnection;12;1;7;0\nWireConnection;11;0;10;0\nWireConnection;11;1;7;0\nWireConnection;22;0;2;0\nWireConnection;22;1;42;0\nWireConnection;52;0;51;0\nWireConnection;52;1;15;0\nWireConnection;57;0;51;0\nWireConnection;57;1;15;0\nWireConnection;57;2;55;0\nWireConnection;71;1;68;0\nWireConnection;0;0;15;0\nWireConnection;53;0;71;0\nWireConnection;47;0;49;0\nWireConnection;62;0;67;0\nWireConnection;48;0;49;1\nASEEND*/\n//CHKSM=312D1CE7E23C444F9583CB6B462131FEE8B66987" - m_functionName: - m_description: This node generates either UVs or a final color which scroll through - a texture sheet. Make sure your texture wrap mode is set to repeat. - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_nodeCategory: 0 - m_customNodeCategory: - m_previewPosition: 1 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Flipbook.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Flipbook.asset.meta deleted file mode 100644 index c24f34ab..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Flipbook.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 53c2488c220f6564ca6c90721ee16673 -timeCreated: 1515152873 -licenseType: Store -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Flow.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Flow.asset deleted file mode 100644 index 1e3c7086..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Flow.asset +++ /dev/null @@ -1,50 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: Flow - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=17500\n368;498;1477;895;2968.752;895.1555;2.383106;True;False\nNode;AmplifyShaderEditor.CommentaryNode;47;-1168,448;Inherit;False;527;247;Linear - Blend;3;32;30;31;;1,1,1,1;0;0\nNode;AmplifyShaderEditor.FunctionInput;18;-1712,80;Inherit;False;Flow - Direction;2;2;False;1;0;FLOAT2;0,1;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;41;-1472,80;Inherit;False;2;2;0;FLOAT2;0,0;False;1;FLOAT;0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.NegateNode;46;-1872,80;Inherit;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.RangedFloatNode;42;-1728,176;Float;False;Constant;_Rescalevectors;Rescale - vectors;3;0;Create;True;0;0;False;0;0.5;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleTimeNode;22;-1792,416;Inherit;False;1;0;FLOAT;1;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FractNode;27;-1440,416;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;28;-1584,528;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;24;-1984,416;Inherit;False;Flow - Speed;1;4;False;1;0;FLOAT;0.2;False;1;FLOAT;0\nNode;AmplifyShaderEditor.RangedFloatNode;26;-1776,624;Float;False;Constant;_Float0;Float - 0;1;0;Create;True;0;0;False;0;0.5;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;17;-1488,272;Inherit;False;Flow - Strength;2;3;False;1;0;FLOAT2;1,1;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;12;-896,224;Inherit;False;2;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;14;-1184,256;Inherit;False;3;3;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionInput;2;-1696,-160;Inherit;False;UVs;2;1;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.VertexColorNode;45;-2288,80;Inherit;False;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.ComponentMaskNode;44;-2096,80;Inherit;False;True;True;False;False;1;0;COLOR;0,0,0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.TexCoordVertexDataNode;43;-1920,-160;Inherit;False;0;2;0;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.SimpleDivideOpNode;37;-1472,-48;Inherit;False;2;0;FLOAT2;0,0;False;1;FLOAT;0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SamplerNode;49;-544,384;Inherit;True;Property;_TextureSample3;Texture - Sample 3;3;0;Create;True;0;0;False;0;-1;None;None;True;0;False;bump;Auto;True;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;5;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.SamplerNode;8;-544,192;Inherit;True;Property;_TextureSample1;Texture - Sample 1;1;0;Create;True;0;0;False;0;-1;e28dc97a9541e3642a48c0e3886688c5;e28dc97a9541e3642a48c0e3886688c5;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.LerpOp;9;144,112;Inherit;False;3;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT;0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.SamplerNode;48;-544,-64;Inherit;True;Property;_TextureSample2;Texture - Sample 2;2;0;Create;True;0;0;False;0;-1;None;None;True;0;False;bump;Auto;True;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;5;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;30;-1120,496;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleDivideOpNode;32;-800,560;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SamplerNode;7;-544,-256;Inherit;True;Property;_TextureSample0;Texture - Sample 0;1;0;Create;True;0;0;False;0;-1;e28dc97a9541e3642a48c0e3886688c5;e28dc97a9541e3642a48c0e3886688c5;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.AbsOpNode;31;-944,496;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.ComponentMaskNode;4;-1200,-16;Inherit;False;True;True;True;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;13;-1184,80;Inherit;False;3;3;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.RangedFloatNode;38;-1808,-16;Float;False;Property;_Size;Size;1;0;Create;True;0;0;False;0;1;0;0;10;0;1;FLOAT;0\nNode;AmplifyShaderEditor.FractNode;29;-1440,528;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;11;-896,-16;Inherit;False;2;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.WireNode;52;0,528;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;5;-1008,-256;Inherit;False;Tex;9;0;False;1;0;SAMPLER2D;0,0;False;1;SAMPLER2D;0\nNode;AmplifyShaderEditor.TexturePropertyNode;6;-1248,-256;Float;True;Property;_Tex;Tex;0;0;Create;True;0;0;False;0;e28dc97a9541e3642a48c0e3886688c5;e28dc97a9541e3642a48c0e3886688c5;False;white;Auto;Texture2D;-1;0;1;SAMPLER2D;0\nNode;AmplifyShaderEditor.FunctionSwitch;50;-160,16;Inherit;False;Is - Normal;True;1;2;-1;In 0;In 1;Object;-1;9;0;COLOR;0,0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT;0;False;3;FLOAT;0;False;4;FLOAT;0;False;5;FLOAT;0;False;6;FLOAT;0;False;7;FLOAT;0;False;8;FLOAT;0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FunctionSwitch;51;-160,192;Inherit;False;Is - Normal;True;1;2;-1;In 0;In 1;Instance;50;9;0;COLOR;0,0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT;0;False;3;FLOAT;0;False;4;FLOAT;0;False;5;FLOAT;0;False;6;FLOAT;0;False;7;FLOAT;0;False;8;FLOAT;0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FunctionOutput;0;320,112;Inherit;True;True;-1;Output;0;True;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nWireConnection;18;0;46;0\nWireConnection;41;0;18;0\nWireConnection;41;1;42;0\nWireConnection;46;0;44;0\nWireConnection;22;0;24;0\nWireConnection;27;0;22;0\nWireConnection;28;0;22;0\nWireConnection;28;1;26;0\nWireConnection;12;0;4;0\nWireConnection;12;1;14;0\nWireConnection;14;0;41;0\nWireConnection;14;1;17;0\nWireConnection;14;2;29;0\nWireConnection;2;0;43;0\nWireConnection;44;0;45;0\nWireConnection;37;0;2;0\nWireConnection;37;1;38;0\nWireConnection;49;0;5;0\nWireConnection;49;1;12;0\nWireConnection;8;0;5;0\nWireConnection;8;1;12;0\nWireConnection;9;0;50;0\nWireConnection;9;1;51;0\nWireConnection;9;2;52;0\nWireConnection;48;0;5;0\nWireConnection;48;1;11;0\nWireConnection;30;0;27;0\nWireConnection;30;1;26;0\nWireConnection;32;0;31;0\nWireConnection;32;1;26;0\nWireConnection;7;0;5;0\nWireConnection;7;1;11;0\nWireConnection;31;0;30;0\nWireConnection;4;0;37;0\nWireConnection;13;0;41;0\nWireConnection;13;1;17;0\nWireConnection;13;2;27;0\nWireConnection;29;0;28;0\nWireConnection;11;0;4;0\nWireConnection;11;1;13;0\nWireConnection;52;0;32;0\nWireConnection;5;0;6;0\nWireConnection;50;0;7;0\nWireConnection;50;1;48;0\nWireConnection;51;0;8;0\nWireConnection;51;1;49;0\nWireConnection;0;0;9;0\nASEEND*/\n//CHKSM=E084CD7EC3DACA44AFB695EB557ABBE5C34C5A63" - m_functionName: - m_description: Creates a flow effect which can be given from a flow map. - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_additionalDirectives: - m_validData: 0 - m_isDirty: 0 - m_moduleName: ' Additional Directives' - m_independentModule: 1 - m_additionalDirectives: [] - m_shaderFunctionDirectives: [] - m_nativeDirectives: [] - m_nativeDirectivesIndex: -1 - m_nativeDirectivesFoldout: 0 - m_directivesSaveItems: [] - m_nodeCategory: 9 - m_customNodeCategory: My noise category - m_previewPosition: 0 - m_hidden: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Flow.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Flow.asset.meta deleted file mode 100644 index 1bf29973..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Flow.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: acad10cc8145e1f4eb8042bebe2d9a42 -timeCreated: 1575558674 -licenseType: Store -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Four Splats First Pass Terrain.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Four Splats First Pass Terrain.asset deleted file mode 100644 index 308763cf..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Four Splats First Pass Terrain.asset +++ /dev/null @@ -1,54 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: Four Splats First Pass Terrain - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=16303\n269;92;950;489;406.2998;-1023.924;1;True;False\nNode;AmplifyShaderEditor.CommentaryNode;65;-1778.84,-1982.8;Float;False;1796.164;1789.144;;24;60;28;9;41;44;33;32;6;34;37;30;39;31;29;4;40;35;43;42;7;38;36;3;0;Albedo;1,1,1,1;0;0\nNode;AmplifyShaderEditor.CommentaryNode;64;-1838.406,612.7104;Float;False;1582.024;883.2601;;12;11;73;71;72;10;1;70;14;12;8;2;61;Normal;1,1,1,1;0;0\nNode;AmplifyShaderEditor.CommentaryNode;63;-2707.89,-60.62326;Float;False;1541.744;509.7666;Comment;10;21;20;59;22;26;23;24;5;25;74;Control;1,1,1,1;0;0\nNode;AmplifyShaderEditor.CommentaryNode;66;-75.88382,1489.471;Float;False;1257.518;515.4562;;9;56;57;50;48;49;53;54;55;51;Metallic;1,1,1,1;0;0\nNode;AmplifyShaderEditor.CommentaryNode;69;-84.57178,789.2581;Float;False;1026.953;190.4067;;4;45;58;47;46;Smoothness;1,1,1,1;0;0\nNode;AmplifyShaderEditor.CommentaryNode;68;-84.15448,1030.644;Float;False;1134.33;398.6418;Comment;8;17;77;80;75;78;16;76;81;Tangents;1,1,1,1;0;0\nNode;AmplifyShaderEditor.CommentaryNode;67;-76.81078,419.6177;Float;False;686.1986;184.0211;;3;27;19;62;Alpha;1,1,1,1;0;0\nNode;AmplifyShaderEditor.SimpleDivideOpNode;23;-1712,16;Float;False;2;0;COLOR;0,0,0,0;False;1;FLOAT;0;False;1;COLOR;0\nNode;AmplifyShaderEditor.SwizzleNode;47;177.4824,840.8884;Float;False;FLOAT;3;1;2;3;1;0;FLOAT4;0,0,0,0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.DotProductOpNode;20;-2392.622,167.361;Float;False;2;0;COLOR;0,0,0,0;False;1;FLOAT4;0,0,0,0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.TextureCoordinatesNode;72;-1808,1072;Float;False;0;6;2;3;2;SAMPLER2D;;False;0;FLOAT2;1,1;False;1;FLOAT2;0,0;False;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.RangedFloatNode;29;-1728.84,-1854.911;Float;False;Property;_Smoothness0;Smoothness0;11;1;[HideInInspector];Create;True;0;0;False;0;1;0;0;1;0;1;FLOAT;0\nNode;AmplifyShaderEditor.GetLocalVarNode;46;-34.57174,839.2581;Float;False;28;MixDiffuse;1;0;OBJECT;0;False;1;FLOAT4;0\nNode;AmplifyShaderEditor.SamplerNode;10;-1568,1072;Float;True;Property;_Normal2;Normal2;7;1;[HideInInspector];Create;True;0;0;False;0;None;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.TextureCoordinatesNode;73;-1808,1312;Float;False;0;7;2;3;2;SAMPLER2D;;False;0;FLOAT2;1,1;False;1;FLOAT2;0,0;False;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.FunctionInput;58;447.5828,854.8762;Float;False;Custom - Smoothness;1;4;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;61;-637.6442,821.6487;Float;False;Custom - Normal;3;2;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.RangedFloatNode;37;-1553.258,-1504.617;Float;False;Constant;_Float2;Float - 2;13;0;Create;True;0;0;False;0;1;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.RegisterLocalVarNode;28;-629.0479,-660.6064;Float;False;MixDiffuse;-1;True;1;0;FLOAT4;0,0,0,0;False;1;FLOAT4;0\nNode;AmplifyShaderEditor.RegisterLocalVarNode;26;-1568,16;Float;False;SplatControl;-1;True;1;0;COLOR;0,0,0,0;False;1;COLOR;0\nNode;AmplifyShaderEditor.TextureCoordinatesNode;70;-1808,688;Float;False;0;4;2;3;2;SAMPLER2D;;False;0;FLOAT2;1,1;False;1;FLOAT2;0,0;False;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.RangedFloatNode;25;-2144,256;Float;False;Constant;_Float0;Float - 0;9;0;Create;True;0;0;False;0;0.001;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;59;-1356.444,20.82132;Float;False;Custom - Control;4;0;False;1;0;FLOAT4;0,0,0,0;False;1;FLOAT4;0\nNode;AmplifyShaderEditor.RangedFloatNode;48;-25.88388,1619.345;Float;False;Property;_Metallic0;Metallic0;13;2;[HideInInspector];[Gamma];Create;True;0;0;False;0;0;0;0;1;0;1;FLOAT;0\nNode;AmplifyShaderEditor.GetLocalVarNode;54;234.9312,1539.471;Float;False;26;SplatControl;1;0;OBJECT;0;False;1;COLOR;0\nNode;AmplifyShaderEditor.RangedFloatNode;51;-8.215824,1904.193;Float;False;Property;_Metallic3;Metallic3;15;2;[HideInInspector];[Gamma];Create;True;0;0;False;0;0;0;0;1;0;1;FLOAT;0\nNode;AmplifyShaderEditor.RangedFloatNode;50;-19.21585,1806.193;Float;False;Property;_Metallic2;Metallic2;14;2;[HideInInspector];[Gamma];Create;True;0;0;False;0;0;0;0;1;0;1;FLOAT;0\nNode;AmplifyShaderEditor.NormalVertexDataNode;81;-66.2998,1212.924;Float;False;0;5;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.RangedFloatNode;80;-45.98957,1349.331;Float;False;Constant;_Float5;Float - 5;17;0;Create;True;0;0;False;0;0;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.DotProductOpNode;53;506.9309,1630.471;Float;False;2;0;COLOR;0,0,0,0;False;1;FLOAT4;0,0,0,0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.TangentVertexDataNode;77;-72.23888,1072.639;Float;False;0;0;5;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.RegisterLocalVarNode;22;-2261.105,164.0728;Float;False;SplatWeight;-1;True;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.Vector4Node;21;-2689.97,184.6759;Float;False;Constant;_Vector0;Vector - 0;9;0;Create;True;0;0;False;0;1,1,1,1;0,0,0,0;0;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;78;152.2551,1153.509;Float;False;3;3;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT;0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FunctionSwitchByPipeline;75;647.9054,1106.737;Float;False;4;0;FLOAT;0;False;3;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.RangedFloatNode;49;-24.21591,1708.193;Float;False;Property;_Metallic1;Metallic1;16;2;[HideInInspector];[Gamma];Create;True;0;0;False;0;0;0;0;1;0;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;57;647.6302,1617.727;Float;False;Custom - Metallic;1;3;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SamplerNode;1;-1568,864;Float;True;Property;_Normal1;Normal1;6;1;[HideInInspector];Create;True;0;0;False;0;None;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.DynamicAppendNode;55;333.931,1727.471;Float;False;FLOAT4;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT4;0\nNode;AmplifyShaderEditor.RangedFloatNode;40;-1595.099,-1079.418;Float;False;Constant;_Float3;Float - 3;13;0;Create;True;0;0;False;0;1;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.DynamicAppendNode;39;-1432.712,-1076.035;Float;False;FLOAT4;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT4;0\nNode;AmplifyShaderEditor.RangedFloatNode;30;-1677.401,-1423.224;Float;False;Property;_Smoothness1;Smoothness1;10;1;[HideInInspector];Create;True;0;0;False;0;1;0;0;1;0;1;FLOAT;0\nNode;AmplifyShaderEditor.RangedFloatNode;31;-1704.334,-987.735;Float;False;Property;_Smoothness2;Smoothness2;12;1;[HideInInspector];Create;True;0;0;False;0;1;0;0;1;0;1;FLOAT;0\nNode;AmplifyShaderEditor.RangedFloatNode;43;-1591.952,-656.6342;Float;False;Constant;_Float4;Float - 4;13;0;Create;True;0;0;False;0;1;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;60;-369.0532,-738.7761;Float;False;Custom - Albedo;4;1;False;1;0;FLOAT4;0,0,0,0;False;1;FLOAT4;0\nNode;AmplifyShaderEditor.SamplerNode;6;-1575.096,-907.3033;Float;True;Property;_Splat2;Splat2;2;1;[HideInInspector];Create;True;0;0;False;0;None;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.SamplerNode;7;-1563.881,-422.9568;Float;True;Property;_Splat3;Splat3;1;1;[HideInInspector];Create;True;0;0;False;0;None;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.DynamicAppendNode;33;-1437.993,-1929.072;Float;False;FLOAT4;4;0;FLOAT;1;False;1;FLOAT;1;False;2;FLOAT;1;False;3;FLOAT;0;False;1;FLOAT4;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;38;-1208.126,-1416.042;Float;False;2;2;0;FLOAT4;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;FLOAT4;0\nNode;AmplifyShaderEditor.DynamicAppendNode;36;-1399.088,-1520.375;Float;False;FLOAT4;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT4;0\nNode;AmplifyShaderEditor.SamplerNode;4;-1571.735,-1779.668;Float;True;Property;_Splat0;Splat0;4;1;[HideInInspector];Create;True;0;0;False;0;None;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;35;-1204.12,-1877.288;Float;False;2;2;0;FLOAT4;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;FLOAT4;0\nNode;AmplifyShaderEditor.RangedFloatNode;32;-1705.907,-528.7023;Float;False;Property;_Smoothness3;Smoothness3;9;1;[HideInInspector];Create;True;0;0;False;0;1;0;0;1;0;1;FLOAT;0\nNode;AmplifyShaderEditor.SamplerNode;5;-2698.008,-13.10038;Float;True;Property;_Control;Control;0;1;[HideInInspector];Create;True;0;0;False;0;None;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.SummedBlendNode;8;-1106.425,902.7103;Float;False;5;0;FLOAT4;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;COLOR;0,0,0,0;False;3;COLOR;0,0,0,0;False;4;COLOR;0,0,0,0;False;1;COLOR;0\nNode;AmplifyShaderEditor.SamplerNode;11;-1568,1280;Float;True;Property;_Normal3;Normal3;8;1;[HideInInspector];Create;True;0;0;False;0;None;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.SimpleAddOpNode;24;-1836.506,177.3755;Float;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.RangedFloatNode;34;-1585.608,-1932.8;Float;False;Constant;_Float1;Float - 1;13;0;Create;True;0;0;False;0;1;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.SummedBlendNode;9;-835.2949,-654.9649;Float;False;5;0;FLOAT4;0,0,0,0;False;1;FLOAT4;0,0,0,0;False;2;FLOAT4;0,0,0,0;False;3;FLOAT4;0,0,0,0;False;4;FLOAT4;0,0,0,0;False;1;FLOAT4;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;44;-1252.967,-522.7264;Float;False;2;2;0;FLOAT4;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;FLOAT4;0\nNode;AmplifyShaderEditor.GetLocalVarNode;27;-26.81078,469.6178;Float;False;22;SplatWeight;1;0;OBJECT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SamplerNode;2;-1570.425,662.7104;Float;True;Property;_Normal0;Normal0;5;1;[HideInInspector];Create;True;0;0;False;0;None;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.UnpackScaleNormalNode;12;-898.4255,806.7103;Float;False;2;0;FLOAT4;0,0,0,0;False;1;FLOAT;1;False;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3\nNode;AmplifyShaderEditor.CustomExpressionNode;74;-2041.122,125.4553;Float;False;#if - !defined(SHADER_API_MOBILE) && defined(TERRAIN_SPLAT_ADDPASS)$\tclip(SplatWeight - == 0.0f ? -1 : 1)@$#endif;1;True;1;True;SplatWeight;FLOAT;0;In;;Float;SplatClip;False;False;0;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.TextureCoordinatesNode;71;-1808,880;Float;False;0;3;2;3;2;SAMPLER2D;;False;0;FLOAT2;1,1;False;1;FLOAT2;0,0;False;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.CustomExpressionNode;16;395.9061,1093.737;Float;False;v.tangent.xyz - = cross ( v.normal, float3( 0, 0, 1 ) )@$v.tangent.w = -1@;1;True;0;CalculateTangentsStandard;True;False;0;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.DynamicAppendNode;42;-1414.952,-615.6342;Float;False;FLOAT4;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT4;0\nNode;AmplifyShaderEditor.CustomExpressionNode;76;346.3839,1191.393;Float;False;v.ase_tangent.xyz - = cross ( v.ase_normal, float3( 0, 0, 1 ) )@$v.ase_tangent.w = -1@;1;True;0;CalculateTangentsSRP;True;False;0;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.SamplerNode;3;-1584.171,-1329.939;Float;True;Property;_Splat1;Splat1;3;1;[HideInInspector];Create;True;0;0;False;0;None;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.FunctionInput;62;235.3716,471.4964;Float;False;Custom - Alpha;1;5;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;41;-1260.513,-932.1429;Float;False;2;2;0;FLOAT4;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;FLOAT4;0\nNode;AmplifyShaderEditor.FunctionOutput;17;887.9049,1074.737;Float;False;False;Tangents;5;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FunctionOutput;0;-129.3863,-743.9177;Float;False;True;Albedo;0;False;1;0;FLOAT4;0,0,0,0;False;1;FLOAT4;0\nNode;AmplifyShaderEditor.FunctionOutput;45;734.1545,848.3605;Float;False;False;Smoothness;3;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionOutput;14;-417.8965,837.867;Float;False;False;Normal;1;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FunctionOutput;19;440.2847,459.2127;Float;False;False;Alpha;4;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionOutput;56;896.053,1594.737;Float;False;False;Metallic;2;False;1;0;FLOAT;0;False;1;FLOAT;0\nWireConnection;23;0;5;0\nWireConnection;23;1;24;0\nWireConnection;47;0;46;0\nWireConnection;20;0;5;0\nWireConnection;20;1;21;0\nWireConnection;10;1;72;0\nWireConnection;58;0;47;0\nWireConnection;61;0;12;0\nWireConnection;28;0;9;0\nWireConnection;26;0;23;0\nWireConnection;59;0;26;0\nWireConnection;53;0;54;0\nWireConnection;53;1;55;0\nWireConnection;22;0;20;0\nWireConnection;78;0;77;0\nWireConnection;78;1;81;0\nWireConnection;78;2;80;0\nWireConnection;75;0;16;0\nWireConnection;75;3;76;0\nWireConnection;75;1;76;0\nWireConnection;75;2;76;0\nWireConnection;57;0;53;0\nWireConnection;1;1;71;0\nWireConnection;55;0;48;0\nWireConnection;55;1;49;0\nWireConnection;55;2;50;0\nWireConnection;55;3;51;0\nWireConnection;39;0;40;0\nWireConnection;39;1;40;0\nWireConnection;39;2;40;0\nWireConnection;39;3;31;0\nWireConnection;60;0;28;0\nWireConnection;33;0;34;0\nWireConnection;33;1;34;0\nWireConnection;33;2;34;0\nWireConnection;33;3;29;0\nWireConnection;38;0;36;0\nWireConnection;38;1;3;0\nWireConnection;36;0;37;0\nWireConnection;36;1;37;0\nWireConnection;36;2;37;0\nWireConnection;36;3;30;0\nWireConnection;35;0;33;0\nWireConnection;35;1;4;0\nWireConnection;8;0;59;0\nWireConnection;8;1;2;0\nWireConnection;8;2;1;0\nWireConnection;8;3;10;0\nWireConnection;8;4;11;0\nWireConnection;11;1;73;0\nWireConnection;24;0;74;0\nWireConnection;24;1;25;0\nWireConnection;9;0;59;0\nWireConnection;9;1;35;0\nWireConnection;9;2;38;0\nWireConnection;9;3;41;0\nWireConnection;9;4;44;0\nWireConnection;44;0;42;0\nWireConnection;44;1;7;0\nWireConnection;2;1;70;0\nWireConnection;12;0;8;0\nWireConnection;74;0;22;0\nWireConnection;74;1;22;0\nWireConnection;42;0;43;0\nWireConnection;42;1;43;0\nWireConnection;42;2;43;0\nWireConnection;42;3;32;0\nWireConnection;76;0;78;0\nWireConnection;62;0;27;0\nWireConnection;41;0;39;0\nWireConnection;41;1;6;0\nWireConnection;17;0;75;0\nWireConnection;0;0;60;0\nWireConnection;45;0;58;0\nWireConnection;14;0;61;0\nWireConnection;19;0;62;0\nWireConnection;56;0;57;0\nASEEND*/\n//CHKSM=07FA67DCDC69D3439DCDAAFBB05E1E7B5C53F611" - m_functionName: - m_description: Creates a Standard Terrain shader. On main shader the tag SplatCount - must be created with a value of 4. - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_additionalDirectives: - m_validData: 0 - m_isDirty: 0 - m_moduleName: ' Additional Directives' - m_independentModule: 1 - m_additionalDirectives: [] - m_shaderFunctionDirectives: [] - m_nativeDirectives: [] - m_nativeDirectivesFoldout: 0 - m_directivesSaveItems: [] - m_nodeCategory: 9 - m_customNodeCategory: Terrain - m_previewPosition: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Four Splats First Pass Terrain.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Four Splats First Pass Terrain.asset.meta deleted file mode 100644 index e85e4e6a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Four Splats First Pass Terrain.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 37452fdfb732e1443b7e39720d05b708 -timeCreated: 1513337564 -licenseType: Store -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Grid.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Grid.asset deleted file mode 100644 index 6ed5ad43..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Grid.asset +++ /dev/null @@ -1,38 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: Grid - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=17902\n-1462;-370;1004;726;1341.279;420.1091;1.453505;True;False\nNode;AmplifyShaderEditor.TexCoordVertexDataNode;3;-928,0;Inherit;False;0;2;0;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.ScaleAndOffsetNode;4;-656,0;Inherit;False;3;0;FLOAT2;0,0;False;1;FLOAT2;1,0;False;2;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionInput;6;-848,208;Inherit;False;Offset;2;1;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionInput;5;-864,128;Inherit;False;Tiling;2;0;False;1;0;FLOAT2;8,8;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionNode;1;-240,0;Inherit;True;Rectangle;-1;;1;6b23e0c975270fb4084c354b2c83366a;0;3;1;FLOAT2;0,0;False;2;FLOAT;0.5;False;3;FLOAT;0.5;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;2;-415,77;Inherit;False;Size;1;2;False;1;0;FLOAT;0.9;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FractNode;7;-416,0;Inherit;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionOutput;0;0,0;Inherit;False;True;-1;Out;0;False;1;0;FLOAT;0;False;1;FLOAT;0\nWireConnection;4;0;3;0\nWireConnection;4;1;5;0\nWireConnection;4;2;6;0\nWireConnection;1;1;7;0\nWireConnection;1;2;2;0\nWireConnection;1;3;2;0\nWireConnection;7;0;4;0\nWireConnection;0;0;1;0\nASEEND*/\n//CHKSM=8522C6065F43CA9B41D4DCA7DB4B032BEE05BFF8" - m_functionName: - m_description: Creates a rectangular shaped grid. - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_additionalDirectives: - m_validData: 0 - m_isDirty: 0 - m_moduleName: ' Additional Directives' - m_independentModule: 1 - m_additionalDirectives: [] - m_shaderFunctionDirectives: [] - m_nativeDirectives: [] - m_nativeDirectivesIndex: -1 - m_nativeDirectivesFoldout: 0 - m_directivesSaveItems: [] - m_nodeCategory: 9 - m_customNodeCategory: - m_previewPosition: 0 - m_hidden: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Grid.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Grid.asset.meta deleted file mode 100644 index 393f3621..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Grid.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: a9240ca2be7e49e4f9fa3de380c0dbe9 -timeCreated: 1586860862 -licenseType: Store -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Half Lambert Term.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Half Lambert Term.asset deleted file mode 100644 index f28ec2cc..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Half Lambert Term.asset +++ /dev/null @@ -1,25 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: Half Lambert Term - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=13705\n487;595;979;423;884.665;200.5353;1.013844;True;False\nNode;AmplifyShaderEditor.FunctionInput;3;-640,-32;Float;False;World - Normal;3;0;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3\nNode;AmplifyShaderEditor.ScaleAndOffsetNode;6;-208,0;Float;False;3;0;FLOAT;0.0;False;1;FLOAT;1.0;False;2;FLOAT;0.0;False;1;FLOAT\nNode;AmplifyShaderEditor.WorldSpaceLightDirHlpNode;8;-672,64;Float;False;1;0;FLOAT;0.0;False;4;FLOAT3;FLOAT;FLOAT;FLOAT\nNode;AmplifyShaderEditor.RangedFloatNode;7;-416,96;Float;False;Constant;_RemapValue;Remap - Value;0;0;0.5;0;0;0;1;FLOAT\nNode;AmplifyShaderEditor.DotProductOpNode;5;-416,0;Float;False;2;0;FLOAT3;0,0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT\nNode;AmplifyShaderEditor.WorldNormalVector;2;-864,-32;Float;False;1;0;FLOAT3;0,0,0;False;4;FLOAT3;FLOAT;FLOAT;FLOAT\nNode;AmplifyShaderEditor.FunctionOutput;0;16,0;Float;False;True;Out;0;1;0;FLOAT;0.0;False;0\nWireConnection;3;0;2;0\nWireConnection;6;0;5;0\nWireConnection;6;1;7;0\nWireConnection;6;2;7;0\nWireConnection;5;0;3;0\nWireConnection;5;1;8;0\nWireConnection;0;0;6;0\nASEEND*/\n//CHKSM=D225A64D2A31472128B6D003C45B4417097300C7" - m_functionName: - m_description: Generates a linear gradient from black to white that represents the - surface facing term to a light. Useful for cloth shading, skin or toon ramps. - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_nodeCategory: 11 - m_customNodeCategory: Lighting Models diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Half Lambert Term.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Half Lambert Term.asset.meta deleted file mode 100644 index 568356ef..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Half Lambert Term.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 86299dc21373a954aa5772333626c9c1 -timeCreated: 1510234721 -licenseType: Store -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Height-based Blending.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Height-based Blending.asset deleted file mode 100644 index 8158f318..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Height-based Blending.asset +++ /dev/null @@ -1,44 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: Height-based Blending - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=17102\n1280.5;1;1278;1369;-764.8537;728.8295;1.036422;True;False\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;7;413,-443;Inherit;False;3;3;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;1;164.1368,-535.239;Inherit;False;Alpha;1;3;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;4;162.6766,-437.1684;Inherit;False;Height;1;2;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;5;236.3459,-320.3895;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;1;False;1;FLOAT;0\nNode;AmplifyShaderEditor.RangedFloatNode;6;47.11577,-341;Float;False;Constant;_Float0;Float - 0;0;0;Create;True;0;0;False;0;1;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;2;22.54278,-256.0706;Inherit;False;Blend - Factor;1;4;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.PowerNode;8;886.6812,-337.8587;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;1;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SaturateNode;9;1092.221,-338.2482;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMaxOpNode;10;663.4116,-374.5408;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;3;27.04797,-99.6286;Inherit;False;Blend - Falloff;1;5;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.WireNode;11;422.4116,-240.5408;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.LerpOp;14;1512.113,-459.3596;Inherit;False;3;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;FLOAT;0;False;1;COLOR;0\nNode;AmplifyShaderEditor.FunctionInput;12;1247.828,-566.1115;Inherit;False;Bottom;5;1;True;1;0;COLOR;0,0,0,0;False;1;COLOR;0\nNode;AmplifyShaderEditor.FunctionInput;13;1246.79,-467.6507;Inherit;False;Top;5;0;True;1;0;COLOR;0,0,0,0;False;1;COLOR;0\nNode;AmplifyShaderEditor.FunctionOutput;15;1711.107,-460.3962;Inherit;False;False;Result;0;False;1;0;COLOR;0,0,0,0;False;1;COLOR;0\nNode;AmplifyShaderEditor.FunctionOutput;0;1519.228,-232.7731;Inherit;False;True;Alpha;1;False;1;0;FLOAT;0;False;1;FLOAT;0\nWireConnection;7;0;1;0\nWireConnection;7;1;4;0\nWireConnection;7;2;5;0\nWireConnection;5;0;6;0\nWireConnection;5;1;2;0\nWireConnection;8;0;10;0\nWireConnection;8;1;11;0\nWireConnection;9;0;8;0\nWireConnection;10;0;7;0\nWireConnection;11;0;3;0\nWireConnection;14;0;12;0\nWireConnection;14;1;13;0\nWireConnection;14;2;9;0\nWireConnection;15;0;14;0\nWireConnection;0;0;9;0\nASEEND*/\n//CHKSM=EAEFB89C4A5CD1A06A1578CB7E39D908044F001C" - m_functionName: - m_description: Implements height-based blending to allow blending a bottom layer - to a top layer using a height map and a few control parameters, including alpha, - which can be from vertex color channel. - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_additionalDirectives: - m_validData: 0 - m_isDirty: 0 - m_moduleName: ' Additional Directives' - m_independentModule: 1 - m_additionalDirectives: [] - m_shaderFunctionDirectives: [] - m_nativeDirectives: [] - m_nativeDirectivesIndex: -1 - m_nativeDirectivesFoldout: 0 - m_directivesSaveItems: [] - m_nodeCategory: 3 - m_customNodeCategory: - m_previewPosition: 0 - m_hidden: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Height-based Blending.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Height-based Blending.asset.meta deleted file mode 100644 index a7845b24..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Height-based Blending.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 31c0084e26e17dc4c963d2f60261c022 -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 11400000 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Herringbone.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Herringbone.asset deleted file mode 100644 index 1b94b606..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Herringbone.asset +++ /dev/null @@ -1,38 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: Herringbone - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=17902\n-1478;80;1004;726;3587.759;1370.986;3.835479;True;False\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;10;-1072,16;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0.5;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;9;-1248,16;Inherit;False;Width;1;1;False;1;0;FLOAT;0.2;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;3;-400,-176;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SmoothstepOpNode;4;-624,-304;Inherit;False;3;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;1;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;35;-928,128;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0.5;False;1;FLOAT;0\nNode;AmplifyShaderEditor.RoundOpNode;36;-1104,128;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleRemainderNode;29;-1248,-128;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMaxOpNode;1;-208,0;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;2;-416,192;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SmoothstepOpNode;5;-640,240;Inherit;False;3;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;1;False;1;FLOAT;0\nNode;AmplifyShaderEditor.AbsOpNode;14;-880,240;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.StepOpNode;12;-640,368;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleRemainderNode;33;-880,400;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleRemainderNode;34;-880,-128;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleRemainderNode;31;-1264,400;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.StepOpNode;11;-624,-160;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;30;-1056,-128;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;32;-1056,400;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;6;-857.5597,0.1007617;Inherit;False;2;2;0;FLOAT;0.05;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.AbsOpNode;26;-880,-304;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;28;-1440,192;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;2;False;1;FLOAT;0\nNode;AmplifyShaderEditor.RoundOpNode;18;-1760,-192;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;22;-1600,-304;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;27;-1408,-128;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;-1;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;23;-1568,-128;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.RoundOpNode;20;-1760,352;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;25;-1520,416;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.TexCoordVertexDataNode;15;-2496,64;Inherit;False;0;2;0;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;16;-2256,128;Inherit;False;2;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.BreakToComponentsNode;17;-2112,128;Inherit;False;FLOAT2;1;0;FLOAT2;0,0;False;16;FLOAT;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT;5;FLOAT;6;FLOAT;7;FLOAT;8;FLOAT;9;FLOAT;10;FLOAT;11;FLOAT;12;FLOAT;13;FLOAT;14;FLOAT;15\nNode;AmplifyShaderEditor.WireNode;38;-1810.665,-224.2363;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;24;-1520,304;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FloorOpNode;21;-1760,432;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FloorOpNode;19;-1760,-112;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;7;-2448,224;Inherit;False;Tiling;2;0;False;1;0;FLOAT2;6,6;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionInput;8;-1600,128;Inherit;False;Cells;1;2;False;1;0;FLOAT;3;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionOutput;0;0,0;Inherit;True;True;-1;Out;0;False;1;0;FLOAT;0;False;1;FLOAT;0\nWireConnection;10;0;9;0\nWireConnection;3;0;4;0\nWireConnection;3;1;11;0\nWireConnection;4;0;26;0\nWireConnection;4;1;6;0\nWireConnection;4;2;10;0\nWireConnection;35;0;36;0\nWireConnection;36;0;8;0\nWireConnection;29;0;27;0\nWireConnection;29;1;28;0\nWireConnection;1;0;3;0\nWireConnection;1;1;2;0\nWireConnection;2;0;5;0\nWireConnection;2;1;12;0\nWireConnection;5;0;14;0\nWireConnection;5;1;6;0\nWireConnection;5;2;10;0\nWireConnection;14;0;24;0\nWireConnection;12;0;35;0\nWireConnection;12;1;33;0\nWireConnection;33;0;32;0\nWireConnection;33;1;28;0\nWireConnection;34;0;30;0\nWireConnection;34;1;28;0\nWireConnection;31;0;25;0\nWireConnection;31;1;28;0\nWireConnection;11;0;35;0\nWireConnection;11;1;34;0\nWireConnection;30;0;29;0\nWireConnection;30;1;28;0\nWireConnection;32;0;31;0\nWireConnection;32;1;28;0\nWireConnection;6;1;10;0\nWireConnection;26;0;22;0\nWireConnection;28;0;8;0\nWireConnection;18;0;17;0\nWireConnection;22;0;38;0\nWireConnection;22;1;18;0\nWireConnection;27;0;23;0\nWireConnection;23;0;18;0\nWireConnection;23;1;19;0\nWireConnection;20;0;17;1\nWireConnection;25;0;20;0\nWireConnection;25;1;21;0\nWireConnection;16;0;15;0\nWireConnection;16;1;7;0\nWireConnection;17;0;16;0\nWireConnection;38;0;17;0\nWireConnection;24;0;17;1\nWireConnection;24;1;20;0\nWireConnection;21;0;17;0\nWireConnection;19;0;17;1\nWireConnection;0;0;1;0\nASEEND*/\n//CHKSM=BCB7F728B16C2B7BFFF600A14B7FC9C20F79CED1" - m_functionName: - m_description: Creates a herringbone rectangular floor tile pattern. - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_additionalDirectives: - m_validData: 0 - m_isDirty: 0 - m_moduleName: ' Additional Directives' - m_independentModule: 1 - m_additionalDirectives: [] - m_shaderFunctionDirectives: [] - m_nativeDirectives: [] - m_nativeDirectivesIndex: -1 - m_nativeDirectivesFoldout: 0 - m_directivesSaveItems: [] - m_nodeCategory: 9 - m_customNodeCategory: - m_previewPosition: 0 - m_hidden: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Herringbone.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Herringbone.asset.meta deleted file mode 100644 index 112fc8da..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Herringbone.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: dbdb22f3b40ddf6459baf32842f7168a -timeCreated: 1586866005 -licenseType: Store -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Hex Lattice.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Hex Lattice.asset deleted file mode 100644 index 98614937..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Hex Lattice.asset +++ /dev/null @@ -1,40 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: Hex Lattice - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=17902\n-1451;-120;1004;726;5300.028;1982.368;5.575107;True;False\nNode;AmplifyShaderEditor.SmoothstepOpNode;1;-192,0;Inherit;False;3;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;1;False;1;FLOAT;0\nNode;AmplifyShaderEditor.AbsOpNode;6;-512,0;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.AbsOpNode;13;-1616,64;Inherit;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;7;-688,0;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMaxOpNode;8;-841,3;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;5;-352,0;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;2;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;3;-3664,256;Inherit;False;Tiling;2;0;False;1;0;FLOAT2;10,10;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionInput;2;-864,112;Inherit;False;Hex - Scale;1;1;False;1;0;FLOAT;1;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;4;-368,96;Inherit;False;Edge - Width;1;2;False;1;0;FLOAT;0.2;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;11;-1184,-16;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;1.5;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;9;-1008,-16;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;10;-1024,80;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;2;False;1;FLOAT;0\nNode;AmplifyShaderEditor.DynamicAppendNode;14;-2144,64;Inherit;False;FLOAT2;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SimpleRemainderNode;15;-1968,64;Inherit;False;2;0;FLOAT2;0,0;False;1;FLOAT2;1,1;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;24;-2304,144;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;23;-2448,224;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0.5;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleRemainderNode;22;-2656,224;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;2;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FloorOpNode;21;-2800,224;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;16;-1760,64;Inherit;False;2;0;FLOAT2;0,0;False;1;FLOAT2;0.5,0.5;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.BreakToComponentsNode;19;-3312,128;Inherit;False;FLOAT2;1;0;FLOAT2;0,0;False;16;FLOAT;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT;5;FLOAT;6;FLOAT;7;FLOAT;8;FLOAT;9;FLOAT;10;FLOAT;11;FLOAT;12;FLOAT;13;FLOAT;14;FLOAT;15\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;18;-3472,128;Inherit;False;2;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.TexCoordVertexDataNode;17;-3712,128;Inherit;False;0;2;0;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.BreakToComponentsNode;12;-1472,64;Inherit;False;FLOAT2;1;0;FLOAT2;0,0;False;16;FLOAT;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT;5;FLOAT;6;FLOAT;7;FLOAT;8;FLOAT;9;FLOAT;10;FLOAT;11;FLOAT;12;FLOAT;13;FLOAT;14;FLOAT;15\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;20;-3008,64;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;1.5;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionOutput;0;0,0;Inherit;True;True;-1;Out;0;False;1;0;FLOAT;0;False;1;FLOAT;0\nWireConnection;1;0;5;0\nWireConnection;1;2;4;0\nWireConnection;6;0;7;0\nWireConnection;13;0;16;0\nWireConnection;7;0;8;0\nWireConnection;7;1;2;0\nWireConnection;8;0;9;0\nWireConnection;8;1;10;0\nWireConnection;5;0;6;0\nWireConnection;11;0;12;0\nWireConnection;9;0;11;0\nWireConnection;9;1;12;1\nWireConnection;10;0;12;1\nWireConnection;14;0;20;0\nWireConnection;14;1;24;0\nWireConnection;15;0;14;0\nWireConnection;24;0;19;1\nWireConnection;24;1;23;0\nWireConnection;23;0;22;0\nWireConnection;22;0;21;0\nWireConnection;21;0;20;0\nWireConnection;16;0;15;0\nWireConnection;19;0;18;0\nWireConnection;18;0;17;0\nWireConnection;18;1;3;0\nWireConnection;12;0;13;0\nWireConnection;20;0;19;0\nWireConnection;0;0;1;0\nASEEND*/\n//CHKSM=3C3A7331726678319E055DBE5F0CE1A326E34C29" - m_functionName: - m_description: Creates a hexagonal lattice pattern. - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_additionalDirectives: - m_validData: 0 - m_isDirty: 0 - m_moduleName: ' Additional Directives' - m_independentModule: 1 - m_additionalDirectives: [] - m_shaderFunctionDirectives: [] - m_nativeDirectives: [] - m_nativeDirectivesIndex: -1 - m_nativeDirectivesFoldout: 0 - m_directivesSaveItems: [] - m_nodeCategory: 9 - m_customNodeCategory: - m_previewPosition: 0 - m_hidden: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Hex Lattice.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Hex Lattice.asset.meta deleted file mode 100644 index 27875ae1..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Hex Lattice.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 56d977fb137832a498dced8436cf6708 -timeCreated: 1586863236 -licenseType: Store -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Houndstooth.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Houndstooth.asset deleted file mode 100644 index ffacb655..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Houndstooth.asset +++ /dev/null @@ -1,39 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: Houndstooth - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=17902\n-1451;-120;1004;726;3255.592;1165.008;3.399142;True;False\nNode;AmplifyShaderEditor.TexCoordVertexDataNode;1;-2288,0;Inherit;False;0;2;0;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.FunctionInput;25;-2240,144;Inherit;False;Tiling;2;0;False;1;0;FLOAT2;5,5;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.DynamicAppendNode;68;-1280,0;Inherit;False;FLOAT3;4;0;FLOAT2;0,0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;24;-2048,0;Inherit;False;2;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;63;-1456,96;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;20;-1600,208;Inherit;False;Teeth;1;1;False;1;0;FLOAT;2;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;66;-1600,96;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.BreakToComponentsNode;65;-1856,96;Inherit;False;FLOAT2;1;0;FLOAT2;0,0;False;16;FLOAT;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT;5;FLOAT;6;FLOAT;7;FLOAT;8;FLOAT;9;FLOAT;10;FLOAT;11;FLOAT;12;FLOAT;13;FLOAT;14;FLOAT;15\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;11;-624,0;Inherit;False;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.BreakToComponentsNode;16;-480,0;Inherit;False;FLOAT3;1;0;FLOAT3;0,0,0;False;16;FLOAT;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT;5;FLOAT;6;FLOAT;7;FLOAT;8;FLOAT;9;FLOAT;10;FLOAT;11;FLOAT;12;FLOAT;13;FLOAT;14;FLOAT;15\nNode;AmplifyShaderEditor.LerpOp;15;-240,0;Inherit;True;3;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SmoothstepOpNode;10;-848,0;Inherit;False;3;0;FLOAT3;0,0,0;False;1;FLOAT3;0.5,0.5,0;False;2;FLOAT3;0.55,0.55,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.Vector4Node;23;-1184,96;Inherit;False;Constant;_Vector0;Vector - 0;0;0;Create;True;0;0;False;0;0.5,0.55,0.95,1;0,0,0,0;0;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.FractNode;8;-1088,0;Inherit;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.SmoothstepOpNode;12;-848,128;Inherit;False;3;0;FLOAT3;0,0,0;False;1;FLOAT3;0.95,0.95,0;False;2;FLOAT3;1,1,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FunctionOutput;0;0,0;Inherit;False;True;-1;Out;0;False;1;0;FLOAT;0;False;1;FLOAT;0\nWireConnection;68;0;24;0\nWireConnection;68;2;63;0\nWireConnection;24;0;1;0\nWireConnection;24;1;25;0\nWireConnection;63;0;66;0\nWireConnection;63;1;20;0\nWireConnection;66;0;65;0\nWireConnection;66;1;65;1\nWireConnection;65;0;24;0\nWireConnection;11;0;10;0\nWireConnection;11;1;12;0\nWireConnection;16;0;11;0\nWireConnection;15;0;16;0\nWireConnection;15;1;16;1\nWireConnection;15;2;16;2\nWireConnection;10;0;8;0\nWireConnection;10;1;23;1\nWireConnection;10;2;23;2\nWireConnection;8;0;68;0\nWireConnection;12;0;8;0\nWireConnection;12;1;23;3\nWireConnection;12;2;23;4\nWireConnection;0;0;15;0\nASEEND*/\n//CHKSM=85441DDEF3C9BF306BA13CF583CEBD72A1CEC9B0" - m_functionName: - m_description: Creates a duotone textile pattern. - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_additionalDirectives: - m_validData: 0 - m_isDirty: 0 - m_moduleName: ' Additional Directives' - m_independentModule: 1 - m_additionalDirectives: [] - m_shaderFunctionDirectives: [] - m_nativeDirectives: [] - m_nativeDirectivesIndex: -1 - m_nativeDirectivesFoldout: 0 - m_directivesSaveItems: [] - m_nodeCategory: 9 - m_customNodeCategory: - m_previewPosition: 0 - m_hidden: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Houndstooth.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Houndstooth.asset.meta deleted file mode 100644 index 3fc5c8b4..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Houndstooth.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 179b3e2dbd7f5a247afe15a7315e0707 -timeCreated: 1586788750 -licenseType: Store -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Inverse Lerp.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Inverse Lerp.asset deleted file mode 100644 index 8c80dc84..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Inverse Lerp.asset +++ /dev/null @@ -1,41 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: Inverse Lerp - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=17706\n435;95;1527;761;970.3008;288.0356;1;True;False\nNode;AmplifyShaderEditor.FunctionInput;3;-512,160;Inherit;False;Alpha;1;2;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;1;-512,0;Inherit;False;A;1;0;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;2;-512,80;Inherit;False;B;1;1;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;5;-320,0;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleDivideOpNode;4;-144,0;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;6;-320,96;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionOutput;0;0,0;Inherit;False;True;-1;;0;False;1;0;FLOAT;0;False;1;FLOAT;0\nWireConnection;5;0;3;0\nWireConnection;5;1;1;0\nWireConnection;4;0;5;0\nWireConnection;4;1;6;0\nWireConnection;6;0;2;0\nWireConnection;6;1;1;0\nWireConnection;0;0;4;0\nASEEND*/\n//CHKSM=9FE4353E1EA15E40F1B4D54618C26A1738EFB700" - m_functionName: - m_description: "Returns the linear parameter that produces the interpolant specified - by input Alpha within the range of input A to input B.\r Inverse Lerp is the inverse - operation of the Lerp Node. It can be used to determine what the input to a Lerp - was based on its output. " - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_additionalDirectives: - m_validData: 0 - m_isDirty: 0 - m_moduleName: ' Additional Directives' - m_independentModule: 1 - m_additionalDirectives: [] - m_shaderFunctionDirectives: [] - m_nativeDirectives: [] - m_nativeDirectivesIndex: -1 - m_nativeDirectivesFoldout: 0 - m_directivesSaveItems: [] - m_nodeCategory: 7 - m_customNodeCategory: - m_previewPosition: 0 - m_hidden: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Inverse Lerp.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Inverse Lerp.asset.meta deleted file mode 100644 index 7f71a942..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Inverse Lerp.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 09cbe79402f023141a4dc1fddd4c9511 -timeCreated: 1582898085 -licenseType: Store -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Lerp White To.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Lerp White To.asset deleted file mode 100644 index 7b85d322..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Lerp White To.asset +++ /dev/null @@ -1,26 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: Lerp White To - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=15308\n7;358;1906;673;1715.98;594.084;1.39994;False;False\nNode;AmplifyShaderEditor.FunctionInput;2;-544,-16;Float;False;T;1;1;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;5;48,-128;Float;False;2;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.DynamicAppendNode;7;-147,-5;Float;False;FLOAT3;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;6;-336,-128;Float;False;2;2;0;FLOAT3;0,0,0;False;1;FLOAT;0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FunctionInput;1;-544,-160;Float;False;B;3;0;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.OneMinusNode;3;-352,0;Float;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionOutput;0;224,-128;Float;False;True;Output;0;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nWireConnection;5;0;6;0\nWireConnection;5;1;7;0\nWireConnection;7;0;3;0\nWireConnection;7;1;3;0\nWireConnection;7;2;3;0\nWireConnection;6;0;1;0\nWireConnection;6;1;2;0\nWireConnection;3;0;2;0\nWireConnection;0;0;5;0\nASEEND*/\n//CHKSM=D1DB2171EF0B926DCE56994508D5E925AFAC6AD5" - m_functionName: - m_description: - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_nodeCategory: 3 - m_customNodeCategory: - m_previewPosition: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Lerp White To.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Lerp White To.asset.meta deleted file mode 100644 index 3a348fbe..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Lerp White To.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 047d7c189c36a62438973bad9d37b1c2 -timeCreated: 1527498692 -licenseType: Store -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Midtones Control.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Midtones Control.asset deleted file mode 100644 index 8a4ee248..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Midtones Control.asset +++ /dev/null @@ -1,35 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: Midtones Control - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=14205\n666;208;1066;728;2931.866;781.7222;2.2203;True;False\nNode;AmplifyShaderEditor.RangedFloatNode;3;-1907.899,-289.42;Float;False;Constant;_b;b;5;0;Create;True;0.333;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.RangedFloatNode;5;-1973.299,6.039673;Float;False;Constant;_a;a;5;0;Create;True;0.25;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.RangedFloatNode;20;-1191.009,82.84344;Float;False;Constant;_scale;scale;5;0;Create;True;0.7;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;22;-808.6494,-114.4888;Float;False;4;4;0;FLOAT;0.0;False;1;FLOAT;0.0;False;2;FLOAT;0.0;False;3;FLOAT3;0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;23;-642.6191,-517.399;Float;False;2;2;0;COLOR;0,0,0,0;False;1;FLOAT3;0.0,0,0,0;False;1;COLOR;0\nNode;AmplifyShaderEditor.SaturateNode;24;-440.7793,-523.3648;Float;False;1;0;COLOR;0,0,0,0;False;1;COLOR;0\nNode;AmplifyShaderEditor.FunctionInput;26;-1138.585,215.9016;Float;False;Red - Shift;1;1;False;1;0;FLOAT;0.0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;27;-1136.361,311.5068;Float;False;Green - Shift;1;2;False;1;0;FLOAT;0.0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;28;-1092.291,436.1535;Float;False;Blue - Shift;1;3;False;1;0;FLOAT;0.0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SamplerNode;1;-2162.971,-543.0989;Float;True;Property;_TextureSample0;Texture - Sample 0;3;0;Create;True;None;cc818fab9e6e24a40b931f8701ae2c12;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0.0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1.0;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.FunctionInput;25;-2376.585,-567.5209;Float;False;Input;9;0;False;1;0;SAMPLER2D;0.0;False;1;SAMPLER2D;0\nNode;AmplifyShaderEditor.DynamicAppendNode;17;-898.4647,265.9574;Float;False;FLOAT3;4;0;FLOAT;0.0;False;1;FLOAT;0.0;False;2;FLOAT;0.0;False;3;FLOAT;0.0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.WireNode;21;-1276.049,-548.8137;Float;False;1;0;COLOR;0,0,0,0;False;1;COLOR;0\nNode;AmplifyShaderEditor.NegateNode;7;-1550.52,151.5848;Float;False;1;0;FLOAT;0.0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;8;-1535.909,-477.3485;Float;False;2;0;FLOAT;0.0;False;1;FLOAT;0.0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.RangedFloatNode;4;-1724.909,10.69427;Float;False;Constant;_Float1;Float - 1;5;0;Create;True;-1;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;6;-1560.319,-92.27643;Float;False;3;3;0;FLOAT;0.0;False;1;FLOAT;0.0;False;2;FLOAT;0.0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;15;-1207.399,-318.7663;Float;False;2;2;0;FLOAT;0.0;False;1;FLOAT;0.0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;16;-1161.829,-75.91486;Float;False;2;2;0;FLOAT;0.0;False;1;FLOAT;0.0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleDivideOpNode;10;-1380.099,-330.7704;Float;False;2;0;FLOAT;0.0;False;1;FLOAT;0.0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SaturateNode;18;-1061.339,-331.9753;Float;False;1;0;FLOAT;0.0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SaturateNode;19;-1008.659,-73.86804;Float;False;1;0;FLOAT;0.0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleDivideOpNode;9;-1363.329,-47.31543;Float;False;2;0;FLOAT;0.0;False;1;FLOAT;0.0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.CustomExpressionNode;2;-1772.049,-470.1264;Float;False;float - fmin = min(min(Color.r, Color.g), Color.b)@$float fmax = max(max(Color.r, Color.g), - Color.b)@$return (fmax + fmin) / 2.0@;1;False;1;True;Color;FLOAT3;0,0,0;In;RBGToLuminance;1;0;FLOAT3;0,0,0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.RangedFloatNode;11;-1366.299,-194.0069;Float;False;Constant;_Float3;Float - 3;5;0;Create;True;0.5;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionOutput;0;-271.7024,-592.2229;Float;False;True;Output;0;False;1;0;COLOR;0,0,0,0;False;1;COLOR;0\nWireConnection;22;0;18;0\nWireConnection;22;1;19;0\nWireConnection;22;2;20;0\nWireConnection;22;3;17;0\nWireConnection;23;0;21;0\nWireConnection;23;1;22;0\nWireConnection;24;0;23;0\nWireConnection;1;0;25;0\nWireConnection;17;0;26;0\nWireConnection;17;1;27;0\nWireConnection;17;2;28;0\nWireConnection;21;0;1;0\nWireConnection;7;0;5;0\nWireConnection;8;0;2;0\nWireConnection;8;1;3;0\nWireConnection;6;0;2;0\nWireConnection;6;1;3;0\nWireConnection;6;2;4;0\nWireConnection;15;0;10;0\nWireConnection;15;1;11;0\nWireConnection;16;0;11;0\nWireConnection;16;1;9;0\nWireConnection;10;0;8;0\nWireConnection;10;1;5;0\nWireConnection;18;0;15;0\nWireConnection;19;0;16;0\nWireConnection;9;0;6;0\nWireConnection;9;1;7;0\nWireConnection;2;0;1;0\nWireConnection;0;0;24;0\nASEEND*/\n//CHKSM=75F383819F22C7DE4B23FB26DA48A8B24E31CDAE" - m_functionName: - m_description: Can change midtones but does not preserve luminosity (still under - construction ) - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_nodeCategory: 3 - m_customNodeCategory: - m_previewPosition: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Midtones Control.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Midtones Control.asset.meta deleted file mode 100644 index 03d02503..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Midtones Control.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 1862d12003a80d24ab048da83dc4e4d5 -timeCreated: 1516025195 -licenseType: Store -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Noise Sine Wave.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Noise Sine Wave.asset deleted file mode 100644 index e9b8ffa0..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Noise Sine Wave.asset +++ /dev/null @@ -1,43 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: Noise Sine Wave - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=17500\n508;100;994;700;-752.6482;31.0816;1;True;False\nNode;AmplifyShaderEditor.GetLocalVarNode;23;1004.148,255.9184;Inherit;False;7;sinIn;1;0;OBJECT;;False;1;FLOAT;0\nNode;AmplifyShaderEditor.RegisterLocalVarNode;7;599.5011,526.1053;Inherit;False;sinIn;-1;True;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;15;704,256;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SinOpNode;24;576,640;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;1;272,576;Inherit;False;In;1;0;True;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.RangedFloatNode;5;272,672;Inherit;False;Constant;_Float0;Float - 0;0;0;Create;True;0;0;False;0;1;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.RegisterLocalVarNode;6;704,624;Inherit;False;sinInOffset;-1;True;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;4;448,624;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FractNode;17;848,224;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SinOpNode;3;448,544;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.RangedFloatNode;12;224,336;Inherit;False;Constant;_Float1;Float - 1;0;0;Create;True;0;0;False;0;91.2228;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;21;1198.957,186.5331;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;2;599.7036,112.5256;Inherit;False;Min - Max;2;1;False;1;0;FLOAT2;-0.5,0.5;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.GetLocalVarNode;9;80,176;Inherit;False;7;sinIn;1;0;OBJECT;;False;1;FLOAT;0\nNode;AmplifyShaderEditor.LerpOp;20;985.5731,116.8529;Inherit;False;3;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.GetLocalVarNode;10;64,256;Inherit;False;6;sinInOffset;1;0;OBJECT;;False;1;FLOAT;0\nNode;AmplifyShaderEditor.BreakToComponentsNode;19;743.0641,109.0836;Inherit;False;FLOAT2;1;0;FLOAT2;0,0;False;16;FLOAT;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT;5;FLOAT;6;FLOAT;7;FLOAT;8;FLOAT;9;FLOAT;10;FLOAT;11;FLOAT;12;FLOAT;13;FLOAT;14;FLOAT;15\nNode;AmplifyShaderEditor.SinOpNode;14;576,256;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.RangedFloatNode;16;416,368;Inherit;False;Constant;_Float2;Float - 2;0;0;Create;True;0;0;False;0;43758.55;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;13;416,256;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;8;272,208;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionOutput;0;1372,141;Inherit;False;True;-1;Out;0;False;1;0;FLOAT;0;False;1;FLOAT;0\nWireConnection;7;0;3;0\nWireConnection;15;0;14;0\nWireConnection;15;1;16;0\nWireConnection;24;0;4;0\nWireConnection;6;0;24;0\nWireConnection;4;0;1;0\nWireConnection;4;1;5;0\nWireConnection;17;0;15;0\nWireConnection;3;0;1;0\nWireConnection;21;0;20;0\nWireConnection;21;1;23;0\nWireConnection;20;0;19;0\nWireConnection;20;1;19;1\nWireConnection;20;2;17;0\nWireConnection;19;0;2;0\nWireConnection;14;0;13;0\nWireConnection;13;0;8;0\nWireConnection;13;1;12;0\nWireConnection;8;0;9;0\nWireConnection;8;1;10;0\nWireConnection;0;0;21;0\nASEEND*/\n//CHKSM=19A53C6E7C22AEDCEB7C9748D639AD32E25A4747" - m_functionName: - m_description: Creates a sine wave from a given input with an added pseudo-random - value - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_additionalDirectives: - m_validData: 0 - m_isDirty: 0 - m_moduleName: ' Additional Directives' - m_independentModule: 1 - m_additionalDirectives: [] - m_shaderFunctionDirectives: [] - m_nativeDirectives: [] - m_nativeDirectivesIndex: -1 - m_nativeDirectivesFoldout: 0 - m_directivesSaveItems: [] - m_nodeCategory: 9 - m_customNodeCategory: - m_previewPosition: 0 - m_hidden: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Noise Sine Wave.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Noise Sine Wave.asset.meta deleted file mode 100644 index 30059cb3..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Noise Sine Wave.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: a6eff29f739ced848846e3b648af87bd -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 0 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Non Stereo Screen Pos.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Non Stereo Screen Pos.asset deleted file mode 100644 index 90bc02d3..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Non Stereo Screen Pos.asset +++ /dev/null @@ -1,41 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: Non Stereo Screen Pos - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=17005\n1931;362;1056;538;1167.983;206.851;1.3;True;False\nNode;AmplifyShaderEditor.FunctionInput;23;-544,0;Inherit;False;Screen - Pos;4;0;False;1;0;FLOAT4;0,0,0,0;False;1;FLOAT4;0\nNode;AmplifyShaderEditor.ScreenPosInputsNode;21;-752,0;Inherit;False;0;False;0;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.CustomExpressionNode;22;-384,0;Inherit;False;#if - UNITY_SINGLE_PASS_STEREO$float4 scaleOffset = unity_StereoScaleOffset[ unity_StereoEyeIndex - ]@$UV.xy = (UV.xy - scaleOffset.zw) / scaleOffset.xy@$#endif$return UV@;2;False;1;True;UV;FLOAT2;0,0;In;;Float;False;UnStereo;False;False;0;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionOutput;0;-224,0;Inherit;False;True;UV;0;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nWireConnection;23;0;21;0\nWireConnection;22;0;23;0\nWireConnection;0;0;22;0\nASEEND*/\n//CHKSM=C807B44314507262BB266549414C48D41B38178A" - m_functionName: - m_description: Transforms a Screen Position values from VR Stereo to non Stereo - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_additionalDirectives: - m_validData: 0 - m_isDirty: 0 - m_moduleName: ' Additional Directives' - m_independentModule: 1 - m_additionalDirectives: [] - m_shaderFunctionDirectives: [] - m_nativeDirectives: [] - m_nativeDirectivesIndex: -1 - m_nativeDirectivesFoldout: 0 - m_directivesSaveItems: [] - m_nodeCategory: 3 - m_customNodeCategory: - m_previewPosition: 0 - m_hidden: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Non Stereo Screen Pos.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Non Stereo Screen Pos.asset.meta deleted file mode 100644 index ae29d031..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Non Stereo Screen Pos.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 1731ee083b93c104880efc701e11b49b -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 11400000 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Normal From Height.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Normal From Height.asset deleted file mode 100644 index 07a2d40c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Normal From Height.asset +++ /dev/null @@ -1,43 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: Normal From Height - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=17402\n283;92;1358;776;2752.412;932.453;2.468136;True;False\nNode;AmplifyShaderEditor.CommentaryNode;1;-1948.508,-603.7302;Inherit;False;1457.903;657.2;;12;19;18;17;16;15;14;13;12;11;5;4;2;World - Derivatives;1,1,1,1;0;0\nNode;AmplifyShaderEditor.RangedFloatNode;11;-1882.507,-212.0133;Inherit;False;Constant;_Float1;Float - 0;0;0;Create;True;0;0;False;0;100;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.WorldNormalVector;12;-1148.604,-244.7312;Inherit;False;False;1;0;FLOAT3;0,0,1;False;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3\nNode;AmplifyShaderEditor.GetLocalVarNode;24;-1571.111,700.105;Inherit;False;18;crossY;1;0;OBJECT;;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.DdyOpNode;4;-1173.105,-56.53116;Inherit;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.CrossProductOpNode;13;-935.6047,-151.7312;Inherit;False;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;16;-1644.654,-298.9562;Inherit;False;2;2;0;FLOAT3;0,0,0;False;1;FLOAT;0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.WorldPosInputsNode;17;-1898.507,-372.0132;Inherit;False;0;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3\nNode;AmplifyShaderEditor.WorldNormalVector;14;-1191.604,-553.7302;Inherit;False;False;1;0;FLOAT3;0,0,1;False;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3\nNode;AmplifyShaderEditor.CrossProductOpNode;15;-936.6047,-465.7307;Inherit;False;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;23;-1388.111,627.105;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.DdxOpNode;22;-1521.111,627.105;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;20;-1774.622,618.5387;Inherit;False;Height;1;0;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.GetLocalVarNode;35;-221.1819,104.3337;Inherit;False;34;crossYDotWorldDerivX;1;0;OBJECT;;False;1;FLOAT;0\nNode;AmplifyShaderEditor.RegisterLocalVarNode;34;-1338.339,338.6215;Inherit;False;crossYDotWorldDerivX;-1;True;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.DdxOpNode;5;-1409.61,-361.4313;Inherit;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.GetLocalVarNode;27;-1573.836,982.0717;Inherit;False;19;crossX;1;0;OBJECT;;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;26;-1378.836,900.0717;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.RegisterLocalVarNode;2;-1208.275,-377.5297;Inherit;False;worldDerivativeX;-1;True;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.DdyOpNode;25;-1527.836,899.0717;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;28;-1161.352,779.9282;Inherit;False;2;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;8;-802.5332,428.9792;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.BreakToComponentsNode;29;-625.3132,431.1143;Inherit;False;FLOAT3;1;0;FLOAT3;0,0,0;False;16;FLOAT;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT;5;FLOAT;6;FLOAT;7;FLOAT;8;FLOAT;9;FLOAT;10;FLOAT;11;FLOAT;12;FLOAT;13;FLOAT;14;FLOAT;15\nNode;AmplifyShaderEditor.DynamicAppendNode;30;-149.3132,435.1143;Inherit;False;FLOAT3;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.NegateNode;31;-332.3132,456.1144;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.WireNode;32;-295.3132,398.1143;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.WireNode;33;-291.3132,517.1144;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SignOpNode;7;-974.6677,358.6231;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.AbsOpNode;10;-1497.017,330.5656;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.GetLocalVarNode;3;-1820.433,311.4443;Inherit;False;18;crossY;1;0;OBJECT;;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.GetLocalVarNode;9;-1883.114,385.166;Inherit;False;2;worldDerivativeX;1;0;OBJECT;;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.DotProductOpNode;6;-1621.032,325.9442;Inherit;False;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.RegisterLocalVarNode;18;-733.6067,-155.7312;Inherit;False;crossY;-1;True;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.RegisterLocalVarNode;19;-739.6067,-452.7308;Inherit;False;crossX;-1;True;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;36;118.8212,150.0486;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.NormalizeNode;39;437.1517,415.3573;Inherit;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.WorldNormalVector;37;-128.5671,232.4986;Inherit;False;False;1;0;FLOAT3;0,0,1;False;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;38;280.0078,405.3571;Inherit;False;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.TransformDirectionNode;42;695.7273,615.3592;Inherit;False;World;Tangent;False;Fast;1;0;FLOAT3;0,0,0;False;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3\nNode;AmplifyShaderEditor.FunctionOutput;40;1008.587,649.6452;Inherit;False;False;-1;Tangent - Normal;0;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FunctionOutput;0;681.4341,348.574;Inherit;False;True;-1;World - Normal;1;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nWireConnection;4;0;16;0\nWireConnection;13;0;12;0\nWireConnection;13;1;4;0\nWireConnection;16;0;17;0\nWireConnection;16;1;11;0\nWireConnection;15;0;14;0\nWireConnection;15;1;2;0\nWireConnection;23;0;22;0\nWireConnection;23;1;24;0\nWireConnection;22;0;20;0\nWireConnection;34;0;10;0\nWireConnection;5;0;16;0\nWireConnection;26;0;25;0\nWireConnection;26;1;27;0\nWireConnection;2;0;5;0\nWireConnection;25;0;20;0\nWireConnection;28;0;23;0\nWireConnection;28;1;26;0\nWireConnection;8;0;7;0\nWireConnection;8;1;28;0\nWireConnection;29;0;8;0\nWireConnection;30;0;32;0\nWireConnection;30;1;31;0\nWireConnection;30;2;33;0\nWireConnection;31;0;29;1\nWireConnection;32;0;29;0\nWireConnection;33;0;29;2\nWireConnection;7;0;34;0\nWireConnection;10;0;6;0\nWireConnection;6;0;3;0\nWireConnection;6;1;9;0\nWireConnection;18;0;13;0\nWireConnection;19;0;15;0\nWireConnection;36;0;35;0\nWireConnection;36;1;37;0\nWireConnection;39;0;38;0\nWireConnection;38;0;36;0\nWireConnection;38;1;30;0\nWireConnection;42;0;39;0\nWireConnection;40;0;42;0\nWireConnection;0;0;39;0\nASEEND*/\n//CHKSM=461BF8B439D55414FE05F420EE44B6D050784D89" - m_functionName: - m_description: Extrapolate a normal vector from an heigh value. Based on Unity own - Normal From Height. - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_additionalDirectives: - m_validData: 0 - m_isDirty: 0 - m_moduleName: ' Additional Directives' - m_independentModule: 1 - m_additionalDirectives: [] - m_shaderFunctionDirectives: [] - m_nativeDirectives: [] - m_nativeDirectivesIndex: -1 - m_nativeDirectivesFoldout: 0 - m_directivesSaveItems: [] - m_nodeCategory: 3 - m_customNodeCategory: - m_previewPosition: 0 - m_hidden: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Normal From Height.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Normal From Height.asset.meta deleted file mode 100644 index d8ae7da1..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Normal From Height.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 1942fe2c5f1a1f94881a33d532e4afeb -timeCreated: 1575458539 -licenseType: Store -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/NormalCreate.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/NormalCreate.asset deleted file mode 100644 index 65a41ca7..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/NormalCreate.asset +++ /dev/null @@ -1,29 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: NormalCreate - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=14504\n355;526;1066;579;2449.117;567.652;1.195803;True;False\nNode;AmplifyShaderEditor.SimpleAddOpNode;10;-653.5344,187.1665;Float;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.PowerNode;24;-1044.8,149.3853;Float;False;2;0;FLOAT;0;False;1;FLOAT;3;False;1;FLOAT;0\nNode;AmplifyShaderEditor.ScaleNode;25;-863.0129,158.0113;Float;False;0.1;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SamplerNode;12;-300.427,-32.63319;Float;True;Property;_TextureSample1;Texture - Sample 1;0;0;Create;True;0;0;False;0;None;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.SamplerNode;11;-297.0564,-267.8521;Float;True;Property;_TextureSample0;Texture - Sample 0;0;0;Create;True;0;0;False;0;None;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.SamplerNode;14;-289.2554,-557.6742;Float;True;Property;_TextureSample2;Texture - Sample 2;0;0;Create;True;0;0;False;0;None;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.DynamicAppendNode;9;-510.4005,165.5482;Float;False;FLOAT2;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionInput;1;-1609.853,-367.2421;Float;False;Tex;9;0;False;1;0;SAMPLER2D;0;False;1;SAMPLER2D;0\nNode;AmplifyShaderEditor.TexturePropertyNode;26;-1891.178,-373.9199;Float;True;Property;_Normal;Height;0;0;Create;True;0;0;False;0;None;None;False;white;Auto;0;1;SAMPLER2D;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;18;248.1256,-271.7343;Float;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;3;-1194.829,150.4831;Float;False;Offset;1;2;False;1;0;FLOAT;0.5;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;4;33.9635,-213.628;Float;False;Strength;1;3;False;1;0;FLOAT;2;False;1;FLOAT;0\nNode;AmplifyShaderEditor.CrossProductOpNode;21;591.7831,-218.9246;Float;False;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.DynamicAppendNode;13;430.6205,-320.9595;Float;False;FLOAT3;4;0;FLOAT;1;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.TextureCoordinatesNode;23;-1414.536,38.33293;Float;False;0;-1;2;3;2;SAMPLER2D;;False;0;FLOAT2;1,1;False;1;FLOAT2;0,0;False;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;19;232.3673,-128.4985;Float;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;17;50.32483,-85.61093;Float;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;7;-642.9897,42.01196;Float;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.DynamicAppendNode;16;457.5351,-92.18595;Float;False;FLOAT3;4;0;FLOAT;0;False;1;FLOAT;1;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FunctionInput;2;-1101.952,36.79971;Float;False;UV;2;1;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.BreakToComponentsNode;6;-958.3405,44.83144;Float;False;FLOAT2;1;0;FLOAT2;0,0;False;16;FLOAT;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT;5;FLOAT;6;FLOAT;7;FLOAT;8;FLOAT;9;FLOAT;10;FLOAT;11;FLOAT;12;FLOAT;13;FLOAT;14;FLOAT;15\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;15;56.50588,-318.4448;Float;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.NormalizeNode;22;751.4589,-201.3778;Float;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.DynamicAppendNode;8;-490.1855,39.45096;Float;False;FLOAT2;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionOutput;0;959.5413,-203.6477;Float;False;True;Output;0;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nWireConnection;10;0;6;1\nWireConnection;10;1;25;0\nWireConnection;24;0;3;0\nWireConnection;25;0;24;0\nWireConnection;12;0;1;0\nWireConnection;12;1;9;0\nWireConnection;11;0;1;0\nWireConnection;11;1;8;0\nWireConnection;14;0;1;0\nWireConnection;14;1;2;0\nWireConnection;9;0;6;0\nWireConnection;9;1;10;0\nWireConnection;1;0;26;0\nWireConnection;18;0;15;0\nWireConnection;18;1;4;0\nWireConnection;21;0;13;0\nWireConnection;21;1;16;0\nWireConnection;13;2;18;0\nWireConnection;23;2;1;0\nWireConnection;19;0;17;0\nWireConnection;19;1;4;0\nWireConnection;17;0;12;2\nWireConnection;17;1;14;2\nWireConnection;7;0;6;0\nWireConnection;7;1;25;0\nWireConnection;16;2;19;0\nWireConnection;2;0;23;0\nWireConnection;6;0;2;0\nWireConnection;15;0;11;2\nWireConnection;15;1;14;2\nWireConnection;22;0;21;0\nWireConnection;8;0;7;0\nWireConnection;8;1;6;1\nWireConnection;0;0;22;0\nASEEND*/\n//CHKSM=E15D8591709274A59C7536FD5BB9577CCD09C4B4" - m_functionName: - m_description: - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_nodeCategory: 3 - m_customNodeCategory: - m_previewPosition: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/NormalCreate.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/NormalCreate.asset.meta deleted file mode 100644 index a0802e32..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/NormalCreate.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: e12f7ae19d416b942820e3932b56220f -timeCreated: 1520619538 -licenseType: Store -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/PerturbNormal.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/PerturbNormal.asset deleted file mode 100644 index a4365063..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/PerturbNormal.asset +++ /dev/null @@ -1,29 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: PerturbNormal - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=15103\n344;92;1056;673;575.1386;503.1177;1.033186;True;False\nNode;AmplifyShaderEditor.BreakToComponentsNode;27;760.8596,55.21472;Float;False;FLOAT3;1;0;FLOAT3;0,0,0;False;16;FLOAT;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT;5;FLOAT;6;FLOAT;7;FLOAT;8;FLOAT;9;FLOAT;10;FLOAT;11;FLOAT;12;FLOAT;13;FLOAT;14;FLOAT;15\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;24;567.4818,-78.97424;Float;False;2;2;0;FLOAT3x3;0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FunctionNode;31;80,-272;Float;False;CotangentFrame;-1;;7;62ce0f00f1417804bb4f2b38501ba0d0;0;3;4;FLOAT3;0,0,0;False;2;FLOAT3;0,0,0;False;1;FLOAT2;0,0;False;1;FLOAT3x3;5\nNode;AmplifyShaderEditor.FunctionInput;6;-160,48;Float;False;Normal;3;0;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.WorldNormalVector;13;-176,-400;Float;False;True;1;0;FLOAT3;0,0,0;False;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3\nNode;AmplifyShaderEditor.NormalizeNode;8;64,112;Float;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.ViewDirInputsCoordNode;12;-160,-256;Float;False;World;0;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3\nNode;AmplifyShaderEditor.TexCoordVertexDataNode;11;-176,-96;Float;False;0;2;0;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.FunctionSwitch;26;256,48;Float;False;Normalize;True;0;2;-1;In - 0;In 1;Object;-1;9;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT;0;False;3;FLOAT;0;False;4;FLOAT;0;False;5;FLOAT;0;False;6;FLOAT;0;False;7;FLOAT;0;False;8;FLOAT;0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FunctionOutput;29;1040,80;Float;False;False;Y;2;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionOutput;28;1040,0;Float;False;False;X;1;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionOutput;9;1040,-80;Float;False;True;XYZ;0;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FunctionOutput;30;1040,160;Float;False;False;Z;3;False;1;0;FLOAT;0;False;1;FLOAT;0\nWireConnection;27;0;24;0\nWireConnection;24;0;31;5\nWireConnection;24;1;26;0\nWireConnection;31;4;13;0\nWireConnection;31;2;12;0\nWireConnection;31;1;11;0\nWireConnection;8;0;6;0\nWireConnection;26;0;6;0\nWireConnection;26;1;8;0\nWireConnection;29;0;27;1\nWireConnection;28;0;27;0\nWireConnection;9;0;24;0\nWireConnection;30;0;27;2\nASEEND*/\n//CHKSM=82B74CD48F60956E292CC6A0881ADA96C894E5CD" - m_functionName: - m_description: 'Perturbing normals without Precomputed Tangents - - http://www.thetenthplanet.de/archives/1180' - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_nodeCategory: 3 - m_customNodeCategory: - m_previewPosition: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/PerturbNormal.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/PerturbNormal.asset.meta deleted file mode 100644 index 16594f7e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/PerturbNormal.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: c8b64dd82fb09f542943a895dffb6c06 -timeCreated: 1522256219 -licenseType: Store -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/PerturbNormalHQ.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/PerturbNormalHQ.asset deleted file mode 100644 index 15f7c85e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/PerturbNormalHQ.asset +++ /dev/null @@ -1,44 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: PerturbNormalHQ - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=15901\n262;107;1149;682;1154.028;517.2542;2.484015;False;False\nNode;AmplifyShaderEditor.FunctionInput;3;-416,16;Float;False;Bump - One Pixel Down;1;2;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.DdxOpNode;9;-122.6414,307.0036;Float;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FunctionInput;2;-416,-96;Float;False;Bump - Center;1;1;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;11;259.3586,-190.9964;Float;False;2;2;0;FLOAT;0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;6;-112,-192;Float;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;1;-406.5,-209.5;Float;False;Bump - One Pixel Right;1;0;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.AbsOpNode;25;650.9295,79.78731;Float;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.DotProductOpNode;21;451.7501,209.2307;Float;False;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.CrossProductOpNode;15;240,528;Float;False;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;16;323.3586,-7.996399;Float;False;2;2;0;FLOAT;0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.WorldNormalVector;5;-569.6414,488.0036;Float;False;False;1;0;FLOAT3;0,0,1;False;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3\nNode;AmplifyShaderEditor.CrossProductOpNode;14;90.53894,177.7209;Float;False;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;12;527.3586,-157.9964;Float;False;2;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.WorldPosInputsNode;8;-394.6414,238.0036;Float;False;0;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3\nNode;AmplifyShaderEditor.FunctionInput;4;-309.4063,534.0479;Float;False;World - Space Normal;3;3;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.ConditionalIfNode;17;843.8935,337.3362;Float;False;False;5;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;4;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.RangedFloatNode;18;632.8947,365.3362;Float;False;Constant;_Float0;Float - 0;0;0;Create;True;0;0;False;0;0;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.RangedFloatNode;20;644.8946,607.3355;Float;False;Constant;_Float2;Float - 2;0;0;Create;True;0;0;False;0;-1;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.RangedFloatNode;19;627.8946,497.3361;Float;False;Constant;_Float1;Float - 1;0;0;Create;True;0;0;False;0;1;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;22;1232,176;Float;False;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.DdyOpNode;10;-113.6414,183.0036;Float;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;7;-112,-16;Float;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;13;1077.014,199.0213;Float;False;2;2;0;FLOAT3;0,0,0;False;1;FLOAT;0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.NormalizeNode;23;1424,176;Float;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;24;1054.02,41.71672;Float;False;2;2;0;FLOAT;0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FunctionOutput;0;1600,176;Float;False;True;World - Space Normal;0;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nWireConnection;9;0;8;0\nWireConnection;11;0;6;0\nWireConnection;11;1;14;0\nWireConnection;6;0;1;0\nWireConnection;6;1;2;0\nWireConnection;25;0;21;0\nWireConnection;21;0;14;0\nWireConnection;21;1;9;0\nWireConnection;15;0;4;0\nWireConnection;15;1;9;0\nWireConnection;16;0;7;0\nWireConnection;16;1;15;0\nWireConnection;14;0;10;0\nWireConnection;14;1;4;0\nWireConnection;12;0;11;0\nWireConnection;12;1;16;0\nWireConnection;4;0;5;0\nWireConnection;17;0;21;0\nWireConnection;17;1;18;0\nWireConnection;17;2;19;0\nWireConnection;17;3;18;0\nWireConnection;17;4;20;0\nWireConnection;22;0;24;0\nWireConnection;22;1;13;0\nWireConnection;10;0;8;0\nWireConnection;7;0;3;0\nWireConnection;7;1;2;0\nWireConnection;13;0;12;0\nWireConnection;13;1;17;0\nWireConnection;23;0;22;0\nWireConnection;24;0;25;0\nWireConnection;24;1;4;0\nWireConnection;0;0;23;0\nASEEND*/\n//CHKSM=EDC100B8D8E2AD6CDE38D95EB0F332AE4D644559" - m_functionName: - m_description: Based on Perturb Normal HQ UE4 Material Expression - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_additionalDirectives: - m_validData: 0 - m_isDirty: 0 - m_moduleName: ' Additional Directives' - m_independentModule: 1 - m_additionalDirectives: [] - m_shaderFunctionDirectives: [] - m_nativeDirectives: [] - m_nativeDirectivesFoldout: 0 - m_directivesSaveItems: [] - m_nodeCategory: 3 - m_customNodeCategory: - m_previewPosition: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/PerturbNormalHQ.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/PerturbNormalHQ.asset.meta deleted file mode 100644 index 48842442..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/PerturbNormalHQ.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 45dff16e78a0685469fed8b5b46e4d96 -timeCreated: 1542724676 -licenseType: Store -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Polar Coordinates.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Polar Coordinates.asset deleted file mode 100644 index 4e53b3ff..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Polar Coordinates.asset +++ /dev/null @@ -1,43 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: Polar Coordinates - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=17902\n-1476;-250;1004;726;2152.682;1112.438;2.835857;True;False\nNode;AmplifyShaderEditor.ATan2OpNode;14;-528,-128;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.BreakToComponentsNode;17;-832,-128;Inherit;False;FLOAT2;1;0;FLOAT2;0,0;False;16;FLOAT;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT;5;FLOAT;6;FLOAT;7;FLOAT;8;FLOAT;9;FLOAT;10;FLOAT;11;FLOAT;12;FLOAT;13;FLOAT;14;FLOAT;15\nNode;AmplifyShaderEditor.FunctionInput;2;-1104,-432;Inherit;False;Center;2;1;False;1;0;FLOAT2;0.5,0.5;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;18;-304,-128;Inherit;True;3;3;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.GetLocalVarNode;16;-1056,-128;Inherit;False;15;CenteredUV;1;0;OBJECT;;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.TauNode;22;-688,64;Inherit;False;0;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;4;-528,96;Inherit;False;Length - Scale;1;3;False;1;0;FLOAT;1;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleDivideOpNode;20;-528,-16;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.RangedFloatNode;21;-736,-16;Inherit;False;Constant;_Float3;Float - 3;0;0;Create;True;0;0;False;0;1;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;1;-1104,-512;Inherit;False;UV;2;0;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.RangedFloatNode;13;-528,-288;Inherit;False;Constant;_Float2;Float - 2;0;0;Create;True;0;0;False;0;2;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;3;-544,-384;Inherit;False;Radial - Scale;1;2;False;1;0;FLOAT;1;False;1;FLOAT;0\nNode;AmplifyShaderEditor.DynamicAppendNode;23;0,-256;Inherit;True;FLOAT2;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;10;-304,-384;Inherit;True;3;3;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;9;-928,-512;Inherit;False;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.TexCoordVertexDataNode;5;-1328,-512;Inherit;False;0;2;0;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.LengthOpNode;11;-544,-512;Inherit;False;1;0;FLOAT2;0,0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.RegisterLocalVarNode;15;-768,-512;Inherit;False;CenteredUV;-1;True;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionOutput;0;256,-256;Inherit;False;True;-1;Out;0;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nWireConnection;14;0;17;0\nWireConnection;14;1;17;1\nWireConnection;17;0;16;0\nWireConnection;18;0;14;0\nWireConnection;18;1;20;0\nWireConnection;18;2;4;0\nWireConnection;20;0;21;0\nWireConnection;20;1;22;0\nWireConnection;1;0;5;0\nWireConnection;23;0;10;0\nWireConnection;23;1;18;0\nWireConnection;10;0;11;0\nWireConnection;10;1;3;0\nWireConnection;10;2;13;0\nWireConnection;9;0;1;0\nWireConnection;9;1;2;0\nWireConnection;11;0;15;0\nWireConnection;15;0;9;0\nWireConnection;0;0;23;0\nASEEND*/\n//CHKSM=7C36C8C8F3864BFA86D86EABF6E84D60184CCBC6" - m_functionName: - m_description: Transforms the given UVs into polar coordinates and returns both - distance to center (X) and angle(Y) - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_additionalDirectives: - m_validData: 0 - m_isDirty: 0 - m_moduleName: ' Additional Directives' - m_independentModule: 1 - m_additionalDirectives: [] - m_shaderFunctionDirectives: [] - m_nativeDirectives: [] - m_nativeDirectivesIndex: -1 - m_nativeDirectivesFoldout: 0 - m_directivesSaveItems: [] - m_nodeCategory: 14 - m_customNodeCategory: - m_previewPosition: 0 - m_hidden: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Polar Coordinates.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Polar Coordinates.asset.meta deleted file mode 100644 index f75fc94d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Polar Coordinates.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 7dab8e02884cf104ebefaa2e788e4162 -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 0 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Polygon.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Polygon.asset deleted file mode 100644 index 59fcbf09..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Polygon.asset +++ /dev/null @@ -1,45 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: Polygon - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity - Asset Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=17500\n776;81;858;790;607.6838;-337.546;1.3;True;False\nNode;AmplifyShaderEditor.RegisterLocalVarNode;12;-192,-496;Inherit;False;cosSides;-1;True;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;2;-896.0001,-468.8;Inherit;False;Sides;1;1;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.DynamicAppendNode;25;576,-112;Inherit;False;FLOAT2;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.PiNode;9;-600.1328,-531.7235;Inherit;False;1;0;FLOAT;1;False;1;FLOAT;0\nNode;AmplifyShaderEditor.GetLocalVarNode;43;112.5215,865.7967;Inherit;False;30;polarCoords;1;0;OBJECT;;False;1;FLOAT;0\nNode;AmplifyShaderEditor.ATan2OpNode;27;606.6644,49.34894;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.RegisterLocalVarNode;29;732.6644,-113.6511;Inherit;False;finalUVs;-1;True;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SimpleDivideOpNode;37;-240.4785,767.7967;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.RangedFloatNode;20;-368,-224;Inherit;False;Constant;_Float3;Float - 3;0;0;Create;True;0;0;False;0;2;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;42;314.5215,754.7967;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.RegisterLocalVarNode;30;735.6644,34.34894;Inherit;False;polarCoords;-1;True;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;38;-117.4785,719.7967;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.RangedFloatNode;21;-368,-144;Inherit;False;Constant;_Float4;Float - 4;0;0;Create;True;0;0;False;0;-1;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.ScaleAndOffsetNode;19;-208,-240;Inherit;False;3;0;FLOAT2;0,0;False;1;FLOAT;1;False;2;FLOAT;0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.TexCoordVertexDataNode;5;-560,-304;Inherit;False;0;2;0;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.RangedFloatNode;8;-621.4227,144.4016;Inherit;False;Constant;_Float2;Float - 2;0;0;Create;True;0;0;False;0;0.5;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.WireNode;28;425.6644,54.34894;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.GetLocalVarNode;14;-552.0002,37.50001;Inherit;False;12;cosSides;1;0;OBJECT;;False;1;FLOAT;0\nNode;AmplifyShaderEditor.RangedFloatNode;7;-648.0002,-42.49999;Inherit;False;Constant;_Float1;Float - 1;0;0;Create;True;0;0;False;0;0.5;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;15;-369.5999,170.3;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.CosOpNode;53;466.3291,788.9124;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.WireNode;55;-474.633,867.5168;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.RangedFloatNode;6;-1020.8,-468.8;Inherit;False;Constant;_Float0;Float - 0;0;0;Create;True;0;0;False;0;6;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleDivideOpNode;52;-641.1151,595.2535;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.GetLocalVarNode;16;-529.6003,234.3001;Inherit;False;12;cosSides;1;0;OBJECT;;False;1;FLOAT;0\nNode;AmplifyShaderEditor.GetLocalVarNode;35;-431.4811,738.2798;Inherit;False;30;polarCoords;1;0;OBJECT;;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;3;-504.0001,-42.49999;Inherit;False;Width;1;2;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.DynamicAppendNode;18;-192.8964,46.80437;Inherit;False;FLOAT2;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.CosOpNode;11;-304,-496;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleDivideOpNode;10;-427.0461,-493.8062;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleDivideOpNode;22;48,-112;Inherit;False;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.NegateNode;26;442,-37;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;13;-376,-10.5;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;4;-487.6001,145.3;Inherit;False;Height;1;3;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FloorOpNode;40;9.521484,720.7967;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;1;-368,-304;Inherit;False;UV;2;0;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;44;610.5215,816.7967;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FWidthOpNode;50;784,880;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleDivideOpNode;49;944,816;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SaturateNode;51;1072,816;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.GetLocalVarNode;45;224,960;Inherit;False;29;finalUVs;1;0;OBJECT;;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.LengthOpNode;46;400,960;Inherit;False;1;0;FLOAT2;0,0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.RangedFloatNode;39;-320,656;Inherit;False;Constant;_Float5;Float - 5;0;0;Create;True;0;0;False;0;0.5;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.TauNode;31;-749.1282,559.6296;Inherit;False;0;1;FLOAT;0\nNode;AmplifyShaderEditor.WireNode;33;-837.237,553.755;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.WireNode;54;-468.628,792.4522;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.BreakToComponentsNode;23;161.6644,-112.6511;Inherit;False;FLOAT2;1;0;FLOAT2;0,0;False;16;FLOAT;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT;5;FLOAT;6;FLOAT;7;FLOAT;8;FLOAT;9;FLOAT;10;FLOAT;11;FLOAT;12;FLOAT;13;FLOAT;14;FLOAT;15\nNode;AmplifyShaderEditor.OneMinusNode;48;784,800;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;41;144.5215,747.7967;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionOutput;0;1216,816;Inherit;False;True;-1;Out;0;False;1;0;FLOAT;0;False;1;FLOAT;0\nWireConnection;12;0;11;0\nWireConnection;2;0;6;0\nWireConnection;25;0;23;0\nWireConnection;25;1;26;0\nWireConnection;27;0;28;0\nWireConnection;27;1;26;0\nWireConnection;29;0;25;0\nWireConnection;37;0;35;0\nWireConnection;37;1;54;0\nWireConnection;42;0;41;0\nWireConnection;42;1;43;0\nWireConnection;30;0;27;0\nWireConnection;38;0;39;0\nWireConnection;38;1;37;0\nWireConnection;19;0;1;0\nWireConnection;19;1;20;0\nWireConnection;19;2;21;0\nWireConnection;28;0;23;0\nWireConnection;15;0;4;0\nWireConnection;15;1;16;0\nWireConnection;53;0;42;0\nWireConnection;55;0;52;0\nWireConnection;52;0;31;0\nWireConnection;52;1;33;0\nWireConnection;3;0;7;0\nWireConnection;18;0;13;0\nWireConnection;18;1;15;0\nWireConnection;11;0;10;0\nWireConnection;10;0;9;0\nWireConnection;10;1;2;0\nWireConnection;22;0;19;0\nWireConnection;22;1;18;0\nWireConnection;26;0;23;1\nWireConnection;13;0;3;0\nWireConnection;13;1;14;0\nWireConnection;4;0;8;0\nWireConnection;40;0;38;0\nWireConnection;1;0;5;0\nWireConnection;44;0;53;0\nWireConnection;44;1;46;0\nWireConnection;50;0;44;0\nWireConnection;49;0;48;0\nWireConnection;49;1;50;0\nWireConnection;51;0;49;0\nWireConnection;46;0;45;0\nWireConnection;33;0;2;0\nWireConnection;54;0;52;0\nWireConnection;23;0;22;0\nWireConnection;48;0;44;0\nWireConnection;41;0;40;0\nWireConnection;41;1;55;0\nWireConnection;0;0;51;0\nASEEND*/\n//CHKSM=4217BFEBCCECAD2073A228BB92D684CF54BC2E87" - m_functionName: - m_description: Creates a polygon shape with a specified amount of sides - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_additionalDirectives: - m_validData: 0 - m_isDirty: 0 - m_moduleName: ' Additional Directives' - m_independentModule: 1 - m_additionalDirectives: [] - m_shaderFunctionDirectives: [] - m_nativeDirectives: [] - m_nativeDirectivesIndex: -1 - m_nativeDirectivesFoldout: 0 - m_directivesSaveItems: [] - m_nodeCategory: 9 - m_customNodeCategory: - m_previewPosition: 0 - m_hidden: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Polygon.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Polygon.asset.meta deleted file mode 100644 index 0621162b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Polygon.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 6906ef7087298c94c853d6753e182169 -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 0 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/PreparePerturbNormalHQ.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/PreparePerturbNormalHQ.asset deleted file mode 100644 index f7e8a703..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/PreparePerturbNormalHQ.asset +++ /dev/null @@ -1,39 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: PreparePerturbNormalHQ - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=15901\n262;107;1149;682;1369.136;129.7274;1;True;False\nNode;AmplifyShaderEditor.SimpleAddOpNode;3;-153,-151;Float;False;2;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.WireNode;5;-365,-117;Float;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.DotProductOpNode;10;-109,392;Float;False;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.DdxOpNode;2;-344,-36;Float;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.DotProductOpNode;11;-153,564;Float;False;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;8;-141,142;Float;False;2;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.SqrtOpNode;13;248,484;Float;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.DdyOpNode;7;-368,180;Float;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.ConditionalIfNode;12;54,479;Float;False;False;5;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;4;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;1;-653,45;Float;False;Value;3;0;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FunctionOutput;9;401,452;Float;False;False;Filter - Width;3;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionOutput;6;128,158;Float;False;False;Value - One Pixel Down;2;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FunctionOutput;4;116,61;Float;False;False;Value;1;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FunctionOutput;0;46,-150;Float;False;True;Value - One Pixel Right;0;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nWireConnection;3;0;5;0\nWireConnection;3;1;2;0\nWireConnection;5;0;1;0\nWireConnection;10;0;2;0\nWireConnection;10;1;2;0\nWireConnection;2;0;1;0\nWireConnection;11;0;7;0\nWireConnection;11;1;7;0\nWireConnection;8;0;1;0\nWireConnection;8;1;7;0\nWireConnection;13;0;12;0\nWireConnection;7;0;1;0\nWireConnection;12;0;10;0\nWireConnection;12;1;11;0\nWireConnection;12;2;10;0\nWireConnection;12;4;11;0\nWireConnection;9;0;13;0\nWireConnection;6;0;8;0\nWireConnection;4;0;1;0\nWireConnection;0;0;3;0\nASEEND*/\n//CHKSM=F843D9238DE3D976B8A55531C9D75AAF0B29A25D" - m_functionName: - m_description: Based on Prepare Perturb Normal HQ UE4 Material Expression - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_additionalDirectives: - m_validData: 0 - m_isDirty: 0 - m_moduleName: ' Additional Directives' - m_independentModule: 1 - m_additionalDirectives: [] - m_shaderFunctionDirectives: [] - m_nativeDirectives: [] - m_nativeDirectivesFoldout: 0 - m_directivesSaveItems: [] - m_nodeCategory: 3 - m_customNodeCategory: - m_previewPosition: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/PreparePerturbNormalHQ.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/PreparePerturbNormalHQ.asset.meta deleted file mode 100644 index 6f9cd75c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/PreparePerturbNormalHQ.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: ce0790c3228f3654b818a19dd51453a4 -timeCreated: 1542716511 -licenseType: Store -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Radial Shear.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Radial Shear.asset deleted file mode 100644 index eac209de..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Radial Shear.asset +++ /dev/null @@ -1,42 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: Radial Shear - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity - Asset Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=17500\n747;81;640;789;142.1275;882.7152;1.3;True;False\nNode;AmplifyShaderEditor.FunctionInput;1;-114,-240.5;Inherit;False;UV;2;0;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionInput;4;816,-48;Inherit;False;Offset;2;3;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.Vector2Node;10;624,-16;Inherit;False;Constant;_Vector2;Vector - 2;0;0;Create;True;0;0;False;0;0,0;0,0;0;3;FLOAT2;0;FLOAT;1;FLOAT;2\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;21;823.5911,-159.5089;Inherit;False;2;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.WireNode;23;868.5839,-379.9765;Inherit;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.WireNode;22;301.9583,-397.5442;Inherit;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.Vector2Node;9;128,-64;Inherit;False;Constant;_Vector1;Vector - 1;0;0;Create;True;0;0;False;0;10,10;0,0;0;3;FLOAT2;0;FLOAT;1;FLOAT;2\nNode;AmplifyShaderEditor.FunctionInput;3;304,-64;Inherit;False;Strength;2;2;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;16;1024,-224;Inherit;False;3;3;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;2;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionInput;2;-130,-121.5;Inherit;False;Center;2;1;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.Vector2Node;6;-288,-128;Inherit;False;Constant;_Vector0;Vector - 0;0;0;Create;True;0;0;False;0;0.5,0.5;0,0;0;3;FLOAT2;0;FLOAT;1;FLOAT;2\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;11;48,-192;Inherit;False;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.DotProductOpNode;12;272,-207;Inherit;False;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.BreakToComponentsNode;18;272,-304;Inherit;False;FLOAT2;1;0;FLOAT2;0,0;False;16;FLOAT;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT;5;FLOAT;6;FLOAT;7;FLOAT;8;FLOAT;9;FLOAT;10;FLOAT;11;FLOAT;12;FLOAT;13;FLOAT;14;FLOAT;15\nNode;AmplifyShaderEditor.NegateNode;20;533.0646,-334.0239;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.DynamicAppendNode;19;684.8169,-283.6713;Inherit;False;FLOAT2;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;15;480,-128;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.TexCoordVertexDataNode;5;-304,-256;Inherit;False;0;2;0;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.FunctionOutput;0;1168,-224;Inherit;True;True;-1;Out;0;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nWireConnection;1;0;5;0\nWireConnection;4;0;10;0\nWireConnection;21;0;19;0\nWireConnection;21;1;15;0\nWireConnection;23;0;22;0\nWireConnection;22;0;1;0\nWireConnection;3;0;9;0\nWireConnection;16;0;23;0\nWireConnection;16;1;21;0\nWireConnection;16;2;4;0\nWireConnection;2;0;6;0\nWireConnection;11;0;1;0\nWireConnection;11;1;2;0\nWireConnection;12;0;11;0\nWireConnection;12;1;11;0\nWireConnection;18;0;11;0\nWireConnection;20;0;18;0\nWireConnection;19;0;18;1\nWireConnection;19;1;20;0\nWireConnection;15;0;12;0\nWireConnection;15;1;3;0\nWireConnection;0;0;16;0\nASEEND*/\n//CHKSM=A89AF2681F84C95F847B2DABF2152AEDA506C9E8" - m_functionName: - m_description: Creates a radial shear warp based on given UVs - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_additionalDirectives: - m_validData: 0 - m_isDirty: 0 - m_moduleName: ' Additional Directives' - m_independentModule: 1 - m_additionalDirectives: [] - m_shaderFunctionDirectives: [] - m_nativeDirectives: [] - m_nativeDirectivesIndex: -1 - m_nativeDirectivesFoldout: 0 - m_directivesSaveItems: [] - m_nodeCategory: 14 - m_customNodeCategory: - m_previewPosition: 0 - m_hidden: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Radial Shear.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Radial Shear.asset.meta deleted file mode 100644 index ae5f48f8..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Radial Shear.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: c6dc9fc7fa9b08c4d95138f2ae88b526 -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 0 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/RadialUVDistortion.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/RadialUVDistortion.asset deleted file mode 100644 index ee087508..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/RadialUVDistortion.asset +++ /dev/null @@ -1,37 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: RadialUVDistortion - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=13706\n234;92;1307;805;1057.718;-728.6741;2.742884;True;False\nNode;AmplifyShaderEditor.CommentaryNode;59;277.4049,1612.7;Float;False;1535;395;;11;47;50;53;52;51;48;55;54;58;56;57;Ring - Panner;1,1,1,1;0;0\nNode;AmplifyShaderEditor.CommentaryNode;27;-1156.5,-315;Float;False;1765;958;;20;19;12;15;1;11;13;16;18;17;3;5;8;9;10;21;23;24;25;80;81;Normal - map 1 Panner/Size;1,1,1,1;0;0\nNode;AmplifyShaderEditor.CommentaryNode;46;-1152,800;Float;False;1692;591.2493;;13;32;34;39;38;36;33;31;29;70;69;78;79;86;Radial - Math;1,1,1,1;0;0\nNode;AmplifyShaderEditor.PannerNode;18;-218.5,203;Float;False;3;0;FLOAT2;0,0;False;2;FLOAT2;1,0;False;1;FLOAT;1.0;False;1;FLOAT2\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;16;-499.5,260;Float;False;2;2;0;FLOAT;0.0;False;1;FLOAT;0.0;False;1;FLOAT\nNode;AmplifyShaderEditor.ComponentMaskNode;3;-713.5,-240;Float;False;True;False;True;True;1;0;FLOAT2;0,0,0,0;False;1;FLOAT\nNode;AmplifyShaderEditor.DynamicAppendNode;10;16,-80;Float;False;FLOAT2;4;0;FLOAT;0.0;False;1;FLOAT;0.0;False;2;FLOAT;0.0;False;3;FLOAT;0.0;False;1;FLOAT2\nNode;AmplifyShaderEditor.PannerNode;19;-213.5,487;Float;False;3;0;FLOAT2;0,0;False;2;FLOAT2;0,1;False;1;FLOAT;1.0;False;1;FLOAT2\nNode;AmplifyShaderEditor.DynamicAppendNode;24;271.5,348;Float;False;FLOAT2;4;0;FLOAT;0.0;False;1;FLOAT;0.0;False;2;FLOAT;0.0;False;3;FLOAT;0.0;False;1;FLOAT2\nNode;AmplifyShaderEditor.ComponentMaskNode;23;10.5,476;Float;False;False;True;True;True;1;0;FLOAT2;0,0,0,0;False;1;FLOAT\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;17;-518.5,501;Float;False;2;2;0;FLOAT;0.0;False;1;FLOAT;0.0;False;1;FLOAT\nNode;AmplifyShaderEditor.ComponentMaskNode;5;-709.5,65;Float;False;False;True;True;True;1;0;FLOAT2;0,0,0,0;False;1;FLOAT\nNode;AmplifyShaderEditor.ComponentMaskNode;21;-0.5,205;Float;False;True;False;True;True;1;0;FLOAT2;0,0,0,0;False;1;FLOAT\nNode;AmplifyShaderEditor.TextureCoordinatesNode;81;-515.3643,364.2482;Float;False;0;-1;2;3;2;SAMPLER2D;;False;0;FLOAT2;1,1;False;1;FLOAT2;0,0;False;5;FLOAT2;FLOAT;FLOAT;FLOAT;FLOAT\nNode;AmplifyShaderEditor.SimpleAddOpNode;25;454.5,190;Float;False;2;2;0;FLOAT2;0,0;False;1;FLOAT2;0.0,0;False;1;FLOAT2\nNode;AmplifyShaderEditor.PannerNode;54;1156.405,1662.7;Float;False;3;0;FLOAT2;0,0;False;2;FLOAT2;1,0;False;1;FLOAT;1.0;False;1;FLOAT2\nNode;AmplifyShaderEditor.PannerNode;55;1151.405,1851.699;Float;False;3;0;FLOAT2;0,0;False;2;FLOAT2;0,1;False;1;FLOAT;1.0;False;1;FLOAT2\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;52;919.5789,1859.739;Float;False;2;2;0;FLOAT;0.0;False;1;FLOAT;0.0;False;1;FLOAT\nNode;AmplifyShaderEditor.TextureCoordinatesNode;80;-490.1459,-126.2656;Float;False;0;-1;2;3;2;SAMPLER2D;;False;0;FLOAT2;1,1;False;1;FLOAT2;0,0;False;5;FLOAT2;FLOAT;FLOAT;FLOAT;FLOAT\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;8;-168,-227;Float;False;2;2;0;FLOAT;0.0;False;1;FLOAT;0.0;False;1;FLOAT\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;9;-157,48;Float;False;2;2;0;FLOAT;0.0;False;1;FLOAT;0.0;False;1;FLOAT\nNode;AmplifyShaderEditor.FractNode;38;208,944;Float;False;1;0;FLOAT;0.0;False;1;FLOAT\nNode;AmplifyShaderEditor.FunctionInput;29;-736,960;Float;False;UV - Channel;2;6;False;1;0;FLOAT2;0,0;False;1;FLOAT2\nNode;AmplifyShaderEditor.SimpleDivideOpNode;36;24.17026,866.1562;Float;False;2;0;FLOAT;0.0;False;1;FLOAT;0.0;False;1;FLOAT\nNode;AmplifyShaderEditor.TextureCoordinatesNode;78;-976,1024;Float;False;0;-1;2;3;2;SAMPLER2D;;False;0;FLOAT2;1,1;False;1;FLOAT2;0,0;False;5;FLOAT2;FLOAT;FLOAT;FLOAT;FLOAT\nNode;AmplifyShaderEditor.TauNode;70;-134.649,977.495;Float;False;0;1;FLOAT\nNode;AmplifyShaderEditor.Vector2Node;79;-1136,1040;Float;False;Constant;_Vector1;Vector - 1;0;0;2,2;0;3;FLOAT2;FLOAT;FLOAT\nNode;AmplifyShaderEditor.ATan2OpNode;34;-139.461,862.9785;Float;False;2;0;FLOAT;0.0;False;1;FLOAT;0.0;False;1;FLOAT\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;67;2008.955,1176.914;Float;False;2;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT2\nNode;AmplifyShaderEditor.FunctionInput;47;327.4049,1740.699;Float;False;Ring - panner speed;2;5;False;1;0;FLOAT2;1,1;False;1;FLOAT2\nNode;AmplifyShaderEditor.ComponentMaskNode;63;1601.903,863.11;Float;False;True;True;False;False;1;0;COLOR;0,0,0,0;False;1;FLOAT2\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;64;1860.937,863.1101;Float;False;2;2;0;FLOAT2;0,0;False;1;FLOAT;0,0;False;1;FLOAT2\nNode;AmplifyShaderEditor.ComponentMaskNode;50;572.5789,1870.739;Float;False;False;True;True;True;1;0;FLOAT2;0,0,0,0;False;1;FLOAT\nNode;AmplifyShaderEditor.Vector2Node;69;-750.9933,1135.168;Float;False;Constant;_Vector0;Vector - 0;0;0;1,1;0;3;FLOAT2;FLOAT;FLOAT\nNode;AmplifyShaderEditor.SimpleAddOpNode;66;2122.934,960.8027;Float;False;2;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT2\nNode;AmplifyShaderEditor.ComponentMaskNode;57;1396.404,1844.699;Float;False;False;True;True;True;1;0;FLOAT2;0,0;False;1;FLOAT\nNode;AmplifyShaderEditor.WireNode;62;881.3285,841.1897;Float;False;1;0;FLOAT2;0,0;False;1;FLOAT2\nNode;AmplifyShaderEditor.ComponentMaskNode;56;1395.404,1666.7;Float;False;True;False;True;True;1;0;FLOAT2;0,0;False;1;FLOAT\nNode;AmplifyShaderEditor.ComponentMaskNode;48;556.5789,1678.739;Float;False;True;False;True;True;1;0;FLOAT2;0,0,0,0;False;1;FLOAT\nNode;AmplifyShaderEditor.SamplerNode;61;1273.3,858.6689;Float;True;Property;_TextureSample0;Texture - Sample 0;0;0;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0.0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1.0;False;5;COLOR;FLOAT;FLOAT;FLOAT;FLOAT\nNode;AmplifyShaderEditor.FunctionInput;11;-1097.5,295;Float;False;Noise - map panner speed;2;2;False;1;0;FLOAT2;0,0;False;1;FLOAT2\nNode;AmplifyShaderEditor.FunctionInput;65;1581.182,996.3248;Float;False;Combined - Noise Map Strength;1;3;False;1;0;FLOAT;1.0;False;1;FLOAT\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;31;-593.5078,943.7484;Float;False;2;0;FLOAT2;0,0;False;1;FLOAT2;0.0,0;False;1;FLOAT2\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;51;929.3787,1738.541;Float;False;2;2;0;FLOAT;0.0;False;1;FLOAT;0.0;False;1;FLOAT\nNode;AmplifyShaderEditor.ComponentMaskNode;33;-384,944;Float;False;False;True;True;True;1;0;FLOAT2;0,0,0,0;False;1;FLOAT\nNode;AmplifyShaderEditor.SimpleTimeNode;15;-773.5,372;Float;False;1;0;FLOAT;1.0;False;1;FLOAT\nNode;AmplifyShaderEditor.DynamicAppendNode;58;1645.404,1804.699;Float;False;FLOAT2;4;0;FLOAT;0.0;False;1;FLOAT;0.0;False;2;FLOAT;0.0;False;3;FLOAT;0.0;False;1;FLOAT2\nNode;AmplifyShaderEditor.FunctionInput;1;-1106.5,-75;Float;False;Noise - map size;2;1;False;1;0;FLOAT2;1,1;False;1;FLOAT2\nNode;AmplifyShaderEditor.SimpleTimeNode;53;652.579,1790.739;Float;False;1;0;FLOAT;1.0;False;1;FLOAT\nNode;AmplifyShaderEditor.DynamicAppendNode;39;339.0049,1105.292;Float;False;FLOAT2;4;0;FLOAT;0.0;False;1;FLOAT;0.0;False;2;FLOAT;0.0;False;3;FLOAT;0.0;False;1;FLOAT2\nNode;AmplifyShaderEditor.ComponentMaskNode;32;-384,864;Float;False;True;False;True;True;1;0;FLOAT2;0,0,0,0;False;1;FLOAT\nNode;AmplifyShaderEditor.FunctionInput;60;974.1886,744.1376;Float;False;Noise - Map;9;0;False;1;0;SAMPLER2D;0.0;False;1;SAMPLER2D\nNode;AmplifyShaderEditor.LengthOpNode;86;-146.1864,1204.794;Float;False;1;0;FLOAT2;0,0,0,0;False;1;FLOAT\nNode;AmplifyShaderEditor.ComponentMaskNode;12;-814,240;Float;False;True;False;True;True;1;0;FLOAT2;0,0,0,0;False;1;FLOAT\nNode;AmplifyShaderEditor.FunctionInput;68;1781.573,1218.733;Float;False;Texture - Coordination;2;4;False;1;0;FLOAT2;1,1;False;1;FLOAT2\nNode;AmplifyShaderEditor.ComponentMaskNode;13;-800,512;Float;False;False;True;True;True;1;0;FLOAT2;0,0;False;1;FLOAT\nNode;AmplifyShaderEditor.FunctionOutput;0;2475.644,909.1371;Float;False;True;UV - Output;0;1;0;FLOAT2;0,0;False;0\nWireConnection;18;0;81;0\nWireConnection;18;1;16;0\nWireConnection;16;0;12;0\nWireConnection;16;1;15;0\nWireConnection;3;0;1;0\nWireConnection;10;0;8;0\nWireConnection;10;1;9;0\nWireConnection;19;0;81;0\nWireConnection;19;1;17;0\nWireConnection;24;0;21;0\nWireConnection;24;1;23;0\nWireConnection;23;0;19;0\nWireConnection;17;0;15;0\nWireConnection;17;1;13;0\nWireConnection;5;0;1;0\nWireConnection;21;0;18;0\nWireConnection;25;0;10;0\nWireConnection;25;1;24;0\nWireConnection;54;0;39;0\nWireConnection;54;1;51;0\nWireConnection;55;0;39;0\nWireConnection;55;1;52;0\nWireConnection;52;0;53;0\nWireConnection;52;1;50;0\nWireConnection;8;0;3;0\nWireConnection;8;1;80;1\nWireConnection;9;0;80;2\nWireConnection;9;1;5;0\nWireConnection;38;0;36;0\nWireConnection;29;0;78;0\nWireConnection;36;0;34;0\nWireConnection;36;1;70;0\nWireConnection;78;0;79;0\nWireConnection;34;0;32;0\nWireConnection;34;1;33;0\nWireConnection;67;0;68;0\nWireConnection;67;1;58;0\nWireConnection;63;0;61;0\nWireConnection;64;0;63;0\nWireConnection;64;1;65;0\nWireConnection;50;0;47;0\nWireConnection;66;0;64;0\nWireConnection;66;1;67;0\nWireConnection;57;0;55;0\nWireConnection;62;0;25;0\nWireConnection;56;0;54;0\nWireConnection;48;0;47;0\nWireConnection;61;0;60;0\nWireConnection;61;1;62;0\nWireConnection;31;0;29;0\nWireConnection;31;1;69;0\nWireConnection;51;0;48;0\nWireConnection;51;1;53;0\nWireConnection;33;0;31;0\nWireConnection;58;0;56;0\nWireConnection;58;1;57;0\nWireConnection;39;0;38;0\nWireConnection;39;1;86;0\nWireConnection;32;0;31;0\nWireConnection;86;0;31;0\nWireConnection;12;0;11;0\nWireConnection;13;0;11;0\nWireConnection;0;0;66;0\nASEEND*/\n//CHKSM=6E93501F5310904D0620611C1184B482F2F90DC7" - m_functionName: - m_description: "Radial UV Distortion originally created by:\nYoeri - Luos_83 - Vleer\r\n - Luos@woodenswordstudios.com" - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_nodeCategory: 3 - m_customNodeCategory: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/RadialUVDistortion.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/RadialUVDistortion.asset.meta deleted file mode 100644 index 4c5e3c31..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/RadialUVDistortion.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 051d65e7699b41a4c800363fd0e822b2 -timeCreated: 1510748744 -licenseType: Store -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Random Range.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Random Range.asset deleted file mode 100644 index e13bf2b9..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Random Range.asset +++ /dev/null @@ -1,41 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: Random Range - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=17803\n388;132;1046;800;1433.178;491.644;1.608637;True;False\nNode;AmplifyShaderEditor.SinOpNode;6;-544,176;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.RangedFloatNode;8;-640,272;Inherit;False;Constant;_Float0;Float - 0;0;0;Create;True;0;0;False;0;43758.55;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.DotProductOpNode;4;-704,176;Inherit;False;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;1;-928,176;Inherit;False;Seed;2;0;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.Vector2Node;5;-976,256;Inherit;False;Constant;_Vector0;Vector - 0;0;0;Create;True;0;0;False;0;12.9898,78.233;0,0;0;3;FLOAT2;0;FLOAT;1;FLOAT;2\nNode;AmplifyShaderEditor.FunctionInput;3;-256,80;Inherit;False;Max;1;2;False;1;0;FLOAT;1;False;1;FLOAT;0\nNode;AmplifyShaderEditor.LerpOp;10;-64,0;Inherit;False;3;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;2;-256,0;Inherit;False;Min;1;1;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;7;-400,176;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FractNode;9;-256,176;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionOutput;0;128,0;Inherit;False;True;-1;Out;0;False;1;0;FLOAT;0;False;1;FLOAT;0\nWireConnection;6;0;4;0\nWireConnection;4;0;1;0\nWireConnection;4;1;5;0\nWireConnection;10;0;2;0\nWireConnection;10;1;3;0\nWireConnection;10;2;9;0\nWireConnection;7;0;6;0\nWireConnection;7;1;8;0\nWireConnection;9;0;7;0\nWireConnection;0;0;10;0\nASEEND*/\n//CHKSM=66CE582F1B0E5425FE558D38A8279477232CEB3A" - m_functionName: - m_description: Returns a pseudo-random number value based on input Seed that is - between the minimum and maximum values defined by inputs Min and Max respectively - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_additionalDirectives: - m_validData: 0 - m_isDirty: 0 - m_moduleName: ' Additional Directives' - m_independentModule: 1 - m_additionalDirectives: [] - m_shaderFunctionDirectives: [] - m_nativeDirectives: [] - m_nativeDirectivesIndex: -1 - m_nativeDirectivesFoldout: 0 - m_directivesSaveItems: [] - m_nodeCategory: 9 - m_customNodeCategory: - m_previewPosition: 0 - m_hidden: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Random Range.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Random Range.asset.meta deleted file mode 100644 index bfb6cb3a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Random Range.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 7b754edb8aebbfb4a9ace907af661cfc -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 0 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Reconstruct World Position From Depth.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Reconstruct World Position From Depth.asset deleted file mode 100644 index a8887e4a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Reconstruct World Position From Depth.asset +++ /dev/null @@ -1,43 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: Reconstruct World Position From Depth - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=17005\n1931;362;1056;538;4001.36;681.6086;2.740022;True;False\nNode;AmplifyShaderEditor.SimpleDivideOpNode;46;-929.051,-434.7967;Inherit;False;2;0;FLOAT3;0,0,0;False;1;FLOAT;0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.ScreenPosInputsNode;35;-3147.479,-316.2966;Float;False;0;False;0;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.CustomExpressionNode;60;-2820.389,78.77567;Float;False;return - SampleCameraDepth( UV )@;1;False;1;True;UV;FLOAT2;0,0;In;;Float;False;CallSampleCameraDepth;False;False;0;1;0;FLOAT2;0,0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.DynamicAppendNode;49;-609.0508,-434.7967;Inherit;False;FLOAT4;4;0;FLOAT3;0,0,0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;1;False;1;FLOAT4;0\nNode;AmplifyShaderEditor.CameraToWorldMatrix;48;-673.0508,-514.7968;Inherit;False;0;1;FLOAT4x4;0\nNode;AmplifyShaderEditor.ScaleAndOffsetNode;40;-1737.396,-386.7965;Inherit;False;3;0;FLOAT3;0,0,0;False;1;FLOAT;2;False;2;FLOAT;-1;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FunctionNode;67;-2816,-384;Inherit;False;Non - Stereo Screen Pos;-1;;3;1731ee083b93c104880efc701e11b49b;0;1;23;FLOAT4;0,0,0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;47;-753.0508,-434.7967;Inherit;False;2;2;0;FLOAT3;0,0,0;False;1;FLOAT3;1,1,-1;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.ComponentMaskNode;45;-1169.051,-370.7965;Inherit;False;False;False;False;True;1;0;FLOAT4;0,0,0,0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.DynamicAppendNode;39;-1890.207,-393.7536;Inherit;False;FLOAT3;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;1;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.ComponentMaskNode;44;-1169.051,-482.7967;Inherit;False;True;True;True;False;1;0;FLOAT4;0,0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.StaticSwitch;38;-2106.277,-215.9235;Float;False;Property;_Keyword0;Keyword - 0;3;0;Fetch;True;0;0;False;0;0;0;0;False;UNITY_REVERSED_Z;Toggle;2;Key0;Key1;Fetch;False;9;1;COLOR;0,0,0,0;False;0;COLOR;0,0,0,0;False;2;COLOR;0,0,0,0;False;3;COLOR;0,0,0,0;False;4;COLOR;0,0,0,0;False;5;COLOR;0,0,0,0;False;6;COLOR;0,0,0,0;False;7;COLOR;0,0,0,0;False;8;COLOR;0,0,0,0;False;1;COLOR;0\nNode;AmplifyShaderEditor.SamplerNode;36;-2826.844,-233.3465;Inherit;True;Global;_CameraDepthTexture;_CameraDepthTexture;0;0;Create;True;0;0;False;0;None;;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.FunctionSwitchByPipeline;59;-2514.247,-211.2117;Inherit;False;4;0;COLOR;0,0,0,0;False;3;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;FLOAT;0;False;1;COLOR;0\nNode;AmplifyShaderEditor.OneMinusNode;37;-2297.287,-54.65176;Inherit;False;1;0;COLOR;0,0,0,0;False;1;COLOR;0\nNode;AmplifyShaderEditor.CameraProjectionNode;41;-1625.628,-482.7967;Inherit;False;unity_CameraInvProjection;0;1;FLOAT4x4;0\nNode;AmplifyShaderEditor.DynamicAppendNode;42;-1506.904,-386.7965;Inherit;False;FLOAT4;4;0;FLOAT3;0,0,0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;1;False;1;FLOAT4;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;43;-1329.051,-418.7966;Inherit;False;2;2;0;FLOAT4x4;0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1;False;1;FLOAT4;0,0,0,0;False;1;FLOAT4;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;50;-449.0509,-482.7967;Inherit;False;2;2;0;FLOAT4x4;0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1;False;1;FLOAT4;0,0,0,0;False;1;FLOAT4;0\nNode;AmplifyShaderEditor.BreakToComponentsNode;64;-2512,-384;Inherit;False;FLOAT2;1;0;FLOAT2;0,0;False;16;FLOAT;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT;5;FLOAT;6;FLOAT;7;FLOAT;8;FLOAT;9;FLOAT;10;FLOAT;11;FLOAT;12;FLOAT;13;FLOAT;14;FLOAT;15\nNode;AmplifyShaderEditor.FunctionOutput;0;-256,-480;Inherit;False;True;XYZW;0;False;1;0;FLOAT4;0,0,0,0;False;1;FLOAT4;0\nWireConnection;46;0;44;0\nWireConnection;46;1;45;0\nWireConnection;60;0;35;0\nWireConnection;49;0;47;0\nWireConnection;40;0;39;0\nWireConnection;67;23;35;0\nWireConnection;47;0;46;0\nWireConnection;45;0;43;0\nWireConnection;39;0;64;0\nWireConnection;39;1;64;1\nWireConnection;39;2;38;0\nWireConnection;44;0;43;0\nWireConnection;38;1;59;0\nWireConnection;38;0;37;0\nWireConnection;36;1;35;0\nWireConnection;59;0;36;0\nWireConnection;59;3;36;0\nWireConnection;59;1;36;0\nWireConnection;59;2;60;0\nWireConnection;37;0;59;0\nWireConnection;42;0;40;0\nWireConnection;43;0;41;0\nWireConnection;43;1;42;0\nWireConnection;50;0;48;0\nWireConnection;50;1;49;0\nWireConnection;64;0;67;0\nWireConnection;0;0;50;0\nASEEND*/\n//CHKSM=415E3114CA55A98C7DEB7ABCA71E8F950A996E7A" - m_functionName: - m_description: Reconstructs world position from the depth of the scene. If depth - is unconnected a default screen depth will be calculated. For best results, zwrite - should be OFF and ztest should be ALWAYS. - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_additionalDirectives: - m_validData: 0 - m_isDirty: 0 - m_moduleName: ' Additional Directives' - m_independentModule: 1 - m_additionalDirectives: [] - m_shaderFunctionDirectives: [] - m_nativeDirectives: [] - m_nativeDirectivesIndex: -1 - m_nativeDirectivesFoldout: 0 - m_directivesSaveItems: [] - m_nodeCategory: 9 - m_customNodeCategory: - m_previewPosition: 0 - m_hidden: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Reconstruct World Position From Depth.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Reconstruct World Position From Depth.asset.meta deleted file mode 100644 index 1ff88bc9..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Reconstruct World Position From Depth.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: e7094bcbcc80eb140b2a3dbe6a861de8 -timeCreated: 1507625018 -licenseType: Store -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Rectangle.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Rectangle.asset deleted file mode 100644 index ce3fc580..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Rectangle.asset +++ /dev/null @@ -1,38 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: Rectangle - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=17902\n-1462;-64;1004;726;585.2094;505.7291;2.101326;True;False\nNode;AmplifyShaderEditor.FunctionInput;3;-272,80;Inherit;False;Height;1;2;False;1;0;FLOAT;0.5;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;2;-272,0;Inherit;False;Width;1;1;False;1;0;FLOAT;0.5;False;1;FLOAT;0\nNode;AmplifyShaderEditor.DynamicAppendNode;10;-80,0;Inherit;False;FLOAT2;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.ScaleAndOffsetNode;7;-288,-128;Inherit;False;3;0;FLOAT2;0,0;False;1;FLOAT;2;False;2;FLOAT;-1;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.TexCoordVertexDataNode;4;-688,-128;Inherit;False;0;2;0;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.FunctionInput;1;-464,-128;Inherit;False;UV;2;0;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.AbsOpNode;18;-80,-128;Inherit;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;11;96,-64;Inherit;False;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.BreakToComponentsNode;16;720,-64;Inherit;False;FLOAT2;1;0;FLOAT2;0,0;False;16;FLOAT;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT;5;FLOAT;6;FLOAT;7;FLOAT;8;FLOAT;9;FLOAT;10;FLOAT;11;FLOAT;12;FLOAT;13;FLOAT;14;FLOAT;15\nNode;AmplifyShaderEditor.SimpleMinOpNode;15;960,-64;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SaturateNode;17;1088,-64;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FWidthOpNode;14;272,32;Inherit;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SimpleDivideOpNode;13;416,-64;Inherit;False;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.OneMinusNode;12;560,-64;Inherit;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionOutput;0;1248,-64;Inherit;False;True;-1;Out;0;False;1;0;FLOAT;0;False;1;FLOAT;0\nWireConnection;10;0;2;0\nWireConnection;10;1;3;0\nWireConnection;7;0;1;0\nWireConnection;1;0;4;0\nWireConnection;18;0;7;0\nWireConnection;11;0;18;0\nWireConnection;11;1;10;0\nWireConnection;16;0;12;0\nWireConnection;15;0;16;0\nWireConnection;15;1;16;1\nWireConnection;17;0;15;0\nWireConnection;14;0;11;0\nWireConnection;13;0;11;0\nWireConnection;13;1;14;0\nWireConnection;12;0;13;0\nWireConnection;0;0;17;0\nASEEND*/\n//CHKSM=B118B72CF8CE06CB57B6E2BDED3062642C9B7509" - m_functionName: - m_description: Creates a rectangle shape with a specified size - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_additionalDirectives: - m_validData: 0 - m_isDirty: 0 - m_moduleName: ' Additional Directives' - m_independentModule: 1 - m_additionalDirectives: [] - m_shaderFunctionDirectives: [] - m_nativeDirectives: [] - m_nativeDirectivesIndex: -1 - m_nativeDirectivesFoldout: 0 - m_directivesSaveItems: [] - m_nodeCategory: 9 - m_customNodeCategory: - m_previewPosition: 0 - m_hidden: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Rectangle.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Rectangle.asset.meta deleted file mode 100644 index d2858541..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Rectangle.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 6b23e0c975270fb4084c354b2c83366a -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 0 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Replace Color.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Replace Color.asset deleted file mode 100644 index 243f7756..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Replace Color.asset +++ /dev/null @@ -1,46 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: Replace Color - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity - Asset Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=17500\n731;73;658;709;498.7031;575.9198;1.332954;True;False\nNode;AmplifyShaderEditor.FunctionSwitch;12;160,-208;Inherit;False;Compare - Alpha;True;0;2;-1;In 0;In 1;Object;-1;9;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;4;FLOAT;0;False;5;FLOAT;0;False;6;FLOAT;0;False;7;FLOAT;0;False;8;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleDivideOpNode;24;603.7781,-62.30967;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SaturateNode;20;752,-64;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.LerpOp;21;959.2881,-109.705;Inherit;True;3;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;FLOAT;0;False;1;COLOR;0\nNode;AmplifyShaderEditor.WireNode;23;314.2856,-334.9587;Inherit;False;1;0;COLOR;0,0,0,0;False;1;COLOR;0\nNode;AmplifyShaderEditor.SimpleMaxOpNode;18;432,48;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.RangedFloatNode;19;304,128;Inherit;False;Constant;_Float2;Float - 2;0;0;Create;True;0;0;False;0;1E-05;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;5;288,16;Inherit;False;Fuzziness;1;4;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.RangedFloatNode;10;144,16;Inherit;False;Constant;_Float1;Float - 1;0;0;Create;True;0;0;False;0;0;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;16;416,-160;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.ColorNode;8;528,-432;Inherit;False;Constant;_Color2;Color - 2;0;0;Create;True;0;0;False;0;0,0,0,0;0,0,0,0;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.ColorNode;6;-608,-192;Inherit;False;Constant;_Color0;Color - 0;0;0;Create;True;0;0;False;0;0,0,0,0;0,0,0,0;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.FunctionInput;1;-416,-192;Inherit;False;In;5;0;False;1;0;COLOR;0,0,0,0;False;1;COLOR;0\nNode;AmplifyShaderEditor.FunctionInput;2;-416,0;Inherit;False;From;5;1;False;1;0;COLOR;0,0,0,0;False;1;COLOR;0\nNode;AmplifyShaderEditor.ColorNode;7;-608,0;Inherit;False;Constant;_Color1;Color - 1;0;0;Create;True;0;0;False;0;0,0,0,0;0,0,0,0;True;0;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.DistanceOpNode;11;-160,-64;Inherit;False;2;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SwizzleNode;14;-176,-176;Inherit;False;FLOAT3;0;1;2;3;1;0;COLOR;0,0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.SwizzleNode;13;-176,-272;Inherit;False;FLOAT3;0;1;2;3;1;0;COLOR;0,0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.DistanceOpNode;15;0,-240;Inherit;False;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.WireNode;22;-142.4747,-355.8744;Inherit;False;1;0;COLOR;0,0,0,0;False;1;COLOR;0\nNode;AmplifyShaderEditor.RangedFloatNode;9;144,-96;Inherit;False;Constant;_Float0;Float - 0;0;0;Create;True;0;0;False;0;0;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;3;768,-304;Inherit;False;To;5;2;False;1;0;COLOR;0,0,0,0;False;1;COLOR;0\nNode;AmplifyShaderEditor.FunctionInput;4;272,-96;Inherit;False;Range;1;3;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionOutput;0;1224.459,-102.2181;Inherit;False;True;-1;Out;0;False;1;0;COLOR;0,0,0,0;False;1;COLOR;0\nWireConnection;12;0;15;0\nWireConnection;12;1;11;0\nWireConnection;24;0;16;0\nWireConnection;24;1;18;0\nWireConnection;20;0;24;0\nWireConnection;21;0;3;0\nWireConnection;21;1;23;0\nWireConnection;21;2;20;0\nWireConnection;23;0;22;0\nWireConnection;18;0;5;0\nWireConnection;18;1;19;0\nWireConnection;5;0;10;0\nWireConnection;16;0;11;0\nWireConnection;16;1;4;0\nWireConnection;1;0;6;0\nWireConnection;2;0;7;0\nWireConnection;11;0;1;0\nWireConnection;11;1;2;0\nWireConnection;14;0;2;0\nWireConnection;13;0;1;0\nWireConnection;15;0;13;0\nWireConnection;15;1;14;0\nWireConnection;22;0;1;0\nWireConnection;3;0;8;0\nWireConnection;4;0;9;0\nWireConnection;0;0;21;0\nASEEND*/\n//CHKSM=6A90827C59AE8E0E59809A229392575842D7BEF8" - m_functionName: - m_description: Replaces colors from given In which are equal to From to color To - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_additionalDirectives: - m_validData: 0 - m_isDirty: 0 - m_moduleName: ' Additional Directives' - m_independentModule: 1 - m_additionalDirectives: [] - m_shaderFunctionDirectives: [] - m_nativeDirectives: [] - m_nativeDirectivesIndex: -1 - m_nativeDirectivesFoldout: 0 - m_directivesSaveItems: [] - m_nodeCategory: 9 - m_customNodeCategory: - m_previewPosition: 0 - m_hidden: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Replace Color.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Replace Color.asset.meta deleted file mode 100644 index 53b47d9c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Replace Color.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 896dccb3016c847439def376a728b869 -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 0 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Rounded Rectangle.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Rounded Rectangle.asset deleted file mode 100644 index 9d384bb0..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Rounded Rectangle.asset +++ /dev/null @@ -1,46 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: Rounded Rectangle - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity - Asset Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=17500\n776;81;858;790;239.8782;396.9632;2.892348;True;False\nNode;AmplifyShaderEditor.FunctionInput;1;616.5462,415.359;Inherit;False;UV;2;0;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionInput;3;-32,352;Inherit;False;Height;1;2;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.DynamicAppendNode;21;189.5313,424.008;Inherit;False;FLOAT2;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.WireNode;23;482.2314,693.308;Inherit;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;22;1300.805,516.7463;Inherit;False;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.WireNode;36;1147.975,717.6099;Inherit;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.GetLocalVarNode;26;1280,640;Inherit;False;25;Radius;1;0;OBJECT;;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;24;1472,560;Inherit;False;2;2;0;FLOAT2;0,0;False;1;FLOAT;0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SimpleMaxOpNode;27;1648,608;Inherit;False;2;0;FLOAT2;0,0;False;1;FLOAT;0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.RangedFloatNode;28;1472,688;Inherit;False;Constant;_Float6;Float - 6;0;0;Create;True;0;0;False;0;0;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.LengthOpNode;29;1776,608;Inherit;False;1;0;FLOAT2;0,0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleDivideOpNode;30;1936,624;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.GetLocalVarNode;31;1744,704;Inherit;False;25;Radius;1;0;OBJECT;;False;1;FLOAT;0\nNode;AmplifyShaderEditor.OneMinusNode;32;2096,576;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FWidthOpNode;34;2096,704;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleDivideOpNode;33;2288,608;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.RangedFloatNode;7;-192,352;Inherit;False;Constant;_Float1;Float - 1;0;0;Create;True;0;0;False;0;0.5;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.SaturateNode;35;2416,624;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.RangedFloatNode;6;-176,240;Inherit;False;Constant;_Float0;Float - 0;0;0;Create;True;0;0;False;0;0.5;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.RangedFloatNode;8;-256,96;Inherit;False;Constant;_Float2;Float - 2;0;0;Create;True;0;0;False;0;0.1;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.TexCoordVertexDataNode;5;427.5291,412.736;Inherit;False;0;2;0;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.RangedFloatNode;18;624,496;Inherit;False;Constant;_Float4;Float - 4;0;0;Create;True;0;0;False;0;2;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.RangedFloatNode;19;640,592;Inherit;False;Constant;_Float5;Float - 5;0;0;Create;True;0;0;False;0;-1;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.ScaleAndOffsetNode;17;800,448;Inherit;False;3;0;FLOAT2;0,0;False;1;FLOAT;1;False;2;FLOAT;0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.AbsOpNode;20;1014.086,440.2351;Inherit;True;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SimpleMinOpNode;11;288,128;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.AbsOpNode;12;160,208;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.AbsOpNode;13;240,320;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMinOpNode;14;448,192;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMaxOpNode;15;624,224;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.RangedFloatNode;16;464,320;Inherit;False;Constant;_Float3;Float - 3;0;0;Create;True;0;0;False;0;1E-05;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.RegisterLocalVarNode;25;784,272;Inherit;False;Radius;-1;True;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.AbsOpNode;9;160,96;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;4;-112,96;Inherit;False;Radius;1;3;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.ScaleNode;10;16,96;Inherit;False;2;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;2;-32,240;Inherit;False;Width;1;1;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionOutput;0;2544,624;Inherit;False;True;-1;Out;0;False;1;0;FLOAT;0;False;1;FLOAT;0\nWireConnection;1;0;5;0\nWireConnection;3;0;7;0\nWireConnection;21;0;2;0\nWireConnection;21;1;3;0\nWireConnection;23;0;21;0\nWireConnection;22;0;20;0\nWireConnection;22;1;36;0\nWireConnection;36;0;23;0\nWireConnection;24;0;22;0\nWireConnection;24;1;26;0\nWireConnection;27;0;24;0\nWireConnection;27;1;28;0\nWireConnection;29;0;27;0\nWireConnection;30;0;29;0\nWireConnection;30;1;31;0\nWireConnection;32;0;30;0\nWireConnection;34;0;30;0\nWireConnection;33;0;32;0\nWireConnection;33;1;34;0\nWireConnection;35;0;33;0\nWireConnection;17;0;1;0\nWireConnection;17;1;18;0\nWireConnection;17;2;19;0\nWireConnection;20;0;17;0\nWireConnection;11;0;9;0\nWireConnection;11;1;12;0\nWireConnection;12;0;2;0\nWireConnection;13;0;3;0\nWireConnection;14;0;11;0\nWireConnection;14;1;13;0\nWireConnection;15;0;14;0\nWireConnection;15;1;16;0\nWireConnection;25;0;15;0\nWireConnection;9;0;10;0\nWireConnection;4;0;8;0\nWireConnection;10;0;4;0\nWireConnection;2;0;6;0\nWireConnection;0;0;35;0\nASEEND*/\n//CHKSM=6DC878F2DF725F7361203E76F473DF65D786CAD0" - m_functionName: - m_description: Creates a round rectangle shape from a given size and radius - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_additionalDirectives: - m_validData: 0 - m_isDirty: 0 - m_moduleName: ' Additional Directives' - m_independentModule: 1 - m_additionalDirectives: [] - m_shaderFunctionDirectives: [] - m_nativeDirectives: [] - m_nativeDirectivesIndex: -1 - m_nativeDirectivesFoldout: 0 - m_directivesSaveItems: [] - m_nodeCategory: 9 - m_customNodeCategory: - m_previewPosition: 0 - m_hidden: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Rounded Rectangle.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Rounded Rectangle.asset.meta deleted file mode 100644 index 01c3ee86..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Rounded Rectangle.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 8679f72f5be758f47babb3ba1d5f51d3 -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 0 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/SRP Additional Light.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/SRP Additional Light.asset deleted file mode 100644 index a8a58bea..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/SRP Additional Light.asset +++ /dev/null @@ -1,79 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: SRP Additional Light - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=17503\n385;373;1413;749;2027.142;507.6773;1.942238;True;False\nNode;AmplifyShaderEditor.FunctionInput;14;-736,368;Inherit;False;Specular - Color;3;3;False;1;0;FLOAT3;1,1,1;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.WorldNormalVector;12;-1116,127;Inherit;False;False;1;0;FLOAT3;0,0,1;False;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3\nNode;AmplifyShaderEditor.WorldNormalVector;4;-1312,288;Inherit;False;False;1;0;FLOAT3;0,0,1;False;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3\nNode;AmplifyShaderEditor.Vector3Node;10;-1472,128;Inherit;False;Constant;_Vector0;Vector - 0;0;0;Create;True;0;0;False;0;0,0,1;0,0,0;0;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3\nNode;AmplifyShaderEditor.FunctionInput;18;-736,448;Inherit;False;Smoothness;1;4;False;1;0;FLOAT;0.5;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;15;-736,272;Inherit;False;View - Dir;3;2;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.CustomExpressionNode;22;-496,208;Inherit;False;float3 - Color = 0@$#ifdef _ADDITIONAL_LIGHTS$int numLights = GetAdditionalLightsCount()@$for(int - i = 0@ i<numLights@i++)${$\tLight light = GetAdditionalLight(i, WorldPosition)@$\thalf3 - AttLightColor = light.color *(light.distanceAttenuation * light.shadowAttenuation)@$\tColor - +=(dot(light.direction, WorldNormal)*0.5+0.5 )* AttLightColor@$\t$}$#endif$return - Color@;3;False;2;True;WorldPosition;FLOAT3;0,0,0;In;;Float;False;True;WorldNormal;FLOAT3;0,0,0;In;;Float;False;AdditionalLightsHalfLambert;False;False;0;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.WorldPosInputsNode;3;-736,0;Inherit;False;0;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3\nNode;AmplifyShaderEditor.FunctionSwitch;9;-848,160;Inherit;False;Normal - Space;False;0;2;1;Tangent Space;World Space;Object;-1;9;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT;0;False;3;FLOAT;0;False;4;FLOAT;0;False;5;FLOAT;0;False;6;FLOAT;0;False;7;FLOAT;0;False;8;FLOAT;0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.ViewDirInputsCoordNode;16;-1088,384;Inherit;False;World;False;0;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3\nNode;AmplifyShaderEditor.CustomExpressionNode;13;-496,320;Inherit;False;float3 - Color = 0@$#ifdef _ADDITIONAL_LIGHTS$Smoothness = exp2(10 * Smoothness + 1)@$int - numLights = GetAdditionalLightsCount()@$for(int i = 0@ i<numLights@i++)${$\tLight - light = GetAdditionalLight(i, WorldPosition)@$\thalf3 AttLightColor = light.color - *(light.distanceAttenuation * light.shadowAttenuation)@$\tColor += LightingSpecular(AttLightColor, - light.direction, WorldNormal, WorldView, half4(SpecColor, 0), Smoothness)@\t$}$#endif$return - Color@;3;False;5;True;WorldPosition;FLOAT3;0,0,0;In;;Float;False;True;WorldNormal;FLOAT3;0,0,0;In;;Float;False;True;WorldView;FLOAT3;0,0,0;In;;Float;False;True;SpecColor;FLOAT3;0,0,0;In;;Float;False;True;Smoothness;FLOAT;0.5;In;;Float;False;AdditionalLightsSpecular;False;False;0;5;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT3;0,0,0;False;3;FLOAT3;0,0,0;False;4;FLOAT;0.5;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FunctionSwitch;23;-234.1137,81.67668;Inherit;False;Half - Lambert;True;0;2;2;In 0;In 1;Object;-1;9;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT;0;False;3;FLOAT;0;False;4;FLOAT;0;False;5;FLOAT;0;False;6;FLOAT;0;False;7;FLOAT;0;False;8;FLOAT;0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FunctionInput;11;-1104,288;Inherit;False;World - Normal;3;1;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.CustomExpressionNode;8;-496,0;Inherit;False;float3 - Color = 0@$#ifdef _ADDITIONAL_LIGHTS$int numLights = GetAdditionalLightsCount()@$for(int - i = 0@ i<numLights@i++)${$\tLight light = GetAdditionalLight(i, WorldPosition)@$\tColor - += light.color *(light.distanceAttenuation * light.shadowAttenuation)@$\t$}$#endif$return - Color@;3;False;1;True;WorldPosition;FLOAT3;0,0,0;In;;Float;False;AdditionalLightsFlat;False;False;0;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.Vector3Node;21;144,128;Inherit;False;Constant;_Vector1;Vector - 1;0;0;Create;True;0;0;False;0;0,0,0;0,0,0;0;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3\nNode;AmplifyShaderEditor.FunctionInput;2;-1302,128;Inherit;False;Normal;3;0;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.CustomExpressionNode;5;-496,96;Inherit;False;float3 - Color = 0@$#ifdef _ADDITIONAL_LIGHTS$int numLights = GetAdditionalLightsCount()@$for(int - i = 0@ i<numLights@i++)${$\tLight light = GetAdditionalLight(i, WorldPosition)@$\thalf3 - AttLightColor = light.color *(light.distanceAttenuation * light.shadowAttenuation)@$\tColor - +=LightingLambert(AttLightColor, light.direction, WorldNormal)@$\t$}$#endif$return - Color@;3;False;2;True;WorldPosition;FLOAT3;0,0,0;In;;Float;False;True;WorldNormal;FLOAT3;0,0,0;In;;Float;False;AdditionalLightsLambert;False;False;0;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FunctionSwitchByPipeline;19;368,0;Inherit;False;4;0;FLOAT3;0,0,0;False;3;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FunctionSwitch;6;64,0;Inherit;False;Lighting - Mode;False;0;3;0;Flat;Lambert;Specular;Object;-1;9;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT3;0,0,0;False;3;FLOAT;0;False;4;FLOAT;0;False;5;FLOAT;0;False;6;FLOAT;0;False;7;FLOAT;0;False;8;FLOAT;0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FunctionOutput;0;592,0;Inherit;False;True;-1;Out;0;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nWireConnection;12;0;2;0\nWireConnection;15;0;16;0\nWireConnection;22;0;3;0\nWireConnection;22;1;9;0\nWireConnection;9;0;12;0\nWireConnection;9;1;11;0\nWireConnection;13;0;3;0\nWireConnection;13;1;9;0\nWireConnection;13;2;15;0\nWireConnection;13;3;14;0\nWireConnection;13;4;18;0\nWireConnection;23;0;5;0\nWireConnection;23;1;22;0\nWireConnection;11;0;4;0\nWireConnection;8;0;3;0\nWireConnection;2;0;10;0\nWireConnection;5;0;3;0\nWireConnection;5;1;9;0\nWireConnection;19;0;21;0\nWireConnection;19;3;21;0\nWireConnection;19;1;6;0\nWireConnection;19;2;21;0\nWireConnection;6;0;8;0\nWireConnection;6;1;23;0\nWireConnection;6;2;13;0\nWireConnection;0;0;19;0\nASEEND*/\n//CHKSM=21AD7F10AE383CB3691A52293A399724359D1F3D" - m_functionName: - m_description: Returns SRP's additional lights information calculated with the selected - lighting mode - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_additionalDirectives: - m_validData: 0 - m_isDirty: 1 - m_moduleName: ' Additional Directives' - m_independentModule: 1 - m_additionalDirectives: - - {fileID: 0} - - {fileID: 0} - m_shaderFunctionDirectives: [] - m_nativeDirectives: [] - m_nativeDirectivesIndex: -1 - m_nativeDirectivesFoldout: 0 - m_directivesSaveItems: - - LineType: 2 - LineValue: multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS - GUIDToggle: 0 - GUIDValue: - Origin: 2 - - LineType: 2 - LineValue: multi_compile _ _ADDITIONAL_LIGHT_SHADOWS - GUIDToggle: 0 - GUIDValue: - Origin: 2 - m_nodeCategory: 3 - m_customNodeCategory: - m_previewPosition: 0 - m_hidden: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/SRP Additional Light.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/SRP Additional Light.asset.meta deleted file mode 100644 index 75b7d2b8..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/SRP Additional Light.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 6c86746ad131a0a408ca599df5f40861 -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 11400000 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Sawtooth Wave.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Sawtooth Wave.asset deleted file mode 100644 index 7a9db0d5..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Sawtooth Wave.asset +++ /dev/null @@ -1,39 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: Sawtooth Wave - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=17500\n508;100;994;700;746.5329;443.6693;1;True;False\nNode;AmplifyShaderEditor.FunctionInput;1;-591,-88;Inherit;False;In;1;0;True;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;4;-368,-16;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.RangedFloatNode;3;-528,32;Inherit;False;Constant;_Float0;Float - 0;0;0;Create;True;0;0;False;0;0.5;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.FloorOpNode;2;-240,-16;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;5;-112,-80;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.ScaleNode;7;32,-80;Inherit;False;2;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionOutput;0;176,-80;Inherit;False;True;-1;Out;0;False;1;0;FLOAT;0;False;1;FLOAT;0\nWireConnection;4;0;1;0\nWireConnection;4;1;3;0\nWireConnection;2;0;4;0\nWireConnection;5;0;1;0\nWireConnection;5;1;2;0\nWireConnection;7;0;5;0\nWireConnection;0;0;7;0\nASEEND*/\n//CHKSM=CD22F0B45C0FC6CDCBADEDB7C0D7C1285F12B773" - m_functionName: - m_description: Creates a sawtooth wave from a given input - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_additionalDirectives: - m_validData: 0 - m_isDirty: 0 - m_moduleName: ' Additional Directives' - m_independentModule: 1 - m_additionalDirectives: [] - m_shaderFunctionDirectives: [] - m_nativeDirectives: [] - m_nativeDirectivesIndex: -1 - m_nativeDirectivesFoldout: 0 - m_directivesSaveItems: [] - m_nodeCategory: 9 - m_customNodeCategory: - m_previewPosition: 0 - m_hidden: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Sawtooth Wave.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Sawtooth Wave.asset.meta deleted file mode 100644 index 9e62bed5..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Sawtooth Wave.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 289adb816c3ac6d489f255fc3caf5016 -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 0 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Simple HUE.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Simple HUE.asset deleted file mode 100644 index 08743491..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Simple HUE.asset +++ /dev/null @@ -1,18 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: Simple HUE - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=7207\n848;92;1072;626;663.3998;365.3001;1;True;False\nNode;AmplifyShaderEditor.RangedFloatNode;2;-413.5179,6.410728;Float;False;Constant;_Float1;Float - 1;0;0;1;0;0;0;1;FLOAT\nNode;AmplifyShaderEditor.FunctionInput;1;-408.5179,-209.5893;Float;False;Input;1;0;True;1;0;FLOAT;0.0;False;1;FLOAT\nNode;AmplifyShaderEditor.HSVToRGBNode;3;-201.5179,-187.5893;Float;False;3;0;FLOAT;0.0;False;1;FLOAT;0.0;False;2;FLOAT;0.0;False;4;FLOAT3;FLOAT;FLOAT;FLOAT\nNode;AmplifyShaderEditor.FunctionOutput;6;110.9821,-215.5893;Float;False;True;RGB;0;1;0;FLOAT3;0.0;False;0\nNode;AmplifyShaderEditor.FunctionOutput;7;111.4821,-128.5893;Float;False;False;R;1;1;0;FLOAT;0.0;False;0\nNode;AmplifyShaderEditor.FunctionOutput;8;114.4821,35.41073;Float;False;True;B;3;1;0;FLOAT;0.0;False;0\nNode;AmplifyShaderEditor.FunctionOutput;5;113.4821,-55.58927;Float;False;False;G;2;1;0;FLOAT;0.0;False;0\nWireConnection;3;0;1;0\nWireConnection;3;1;2;0\nWireConnection;3;2;2;0\nWireConnection;6;0;3;0\nWireConnection;7;0;3;1\nWireConnection;8;0;3;3\nWireConnection;5;0;3;2\nASEEND*/\n//CHKSM=47A5570DFC4487C498F141EA313AD2D9825590BD" - m_functionName: - m_description: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Simple HUE.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Simple HUE.asset.meta deleted file mode 100644 index 03b42509..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Simple HUE.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 32abb5f0db087604486c2db83a2e817a -timeCreated: 1497273339 -licenseType: Store -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Smooth Wave.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Smooth Wave.asset deleted file mode 100644 index 1abe4b07..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Smooth Wave.asset +++ /dev/null @@ -1,40 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: Smooth Wave - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=17902\n-1451;-120;1004;726;4133.806;1549.814;4.291845;True;False\nNode;AmplifyShaderEditor.StepOpNode;2;-560,-240;Inherit;True;2;0;FLOAT;0.5;False;1;FLOAT;0.5;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionSwitch;3;-272,0;Inherit;False;Anti - Aliasing;False;1;3;1;None;Smoothstep;Derivative;Object;-1;9;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;4;FLOAT;0;False;5;FLOAT;0;False;6;FLOAT;0;False;7;FLOAT;0;False;8;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionNode;4;-560,224;Inherit;True;Step - Antialiasing;-1;;4;2a825e80dfb3290468194f83380797bd;0;2;1;FLOAT;0.5;False;2;FLOAT;0.5;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SmoothstepOpNode;1;-560,0;Inherit;True;3;0;FLOAT;0;False;1;FLOAT;0.5;False;2;FLOAT;0.55;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;5;-832,0;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;2;False;1;FLOAT;0\nNode;AmplifyShaderEditor.AbsOpNode;6;-1008,0;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;7;-1184,0;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.RoundOpNode;8;-1328,80;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;9;-1504,0;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleDivideOpNode;19;-1696,0;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;21;-2672,0;Inherit;False;2;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionInput;18;-1888,64;Inherit;False;Amplitude;1;2;False;1;0;FLOAT;0.25;False;1;FLOAT;0\nNode;AmplifyShaderEditor.ScaleAndOffsetNode;11;-1744,176;Inherit;False;3;0;FLOAT;0;False;1;FLOAT;0.5;False;2;FLOAT;0.5;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SinOpNode;12;-1904,176;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;13;-2064,176;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleDivideOpNode;15;-2224,176;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.TexCoordVertexDataNode;20;-2912,0;Inherit;False;0;2;0;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.FunctionInput;16;-2416,256;Inherit;False;Wavelength;1;1;False;1;0;FLOAT;0.5;False;1;FLOAT;0\nNode;AmplifyShaderEditor.BreakToComponentsNode;22;-2512,0;Inherit;False;FLOAT2;1;0;FLOAT2;0,0;False;16;FLOAT;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT;5;FLOAT;6;FLOAT;7;FLOAT;8;FLOAT;9;FLOAT;10;FLOAT;11;FLOAT;12;FLOAT;13;FLOAT;14;FLOAT;15\nNode;AmplifyShaderEditor.TauNode;14;-2224,288;Inherit;False;0;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;17;-2864,128;Inherit;False;Tiling;2;0;False;1;0;FLOAT2;1,1;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionOutput;0;0,0;Inherit;False;True;-1;Out;0;False;1;0;FLOAT;0;False;1;FLOAT;0\nWireConnection;2;1;5;0\nWireConnection;3;0;2;0\nWireConnection;3;1;1;0\nWireConnection;3;2;4;0\nWireConnection;4;2;5;0\nWireConnection;1;0;5;0\nWireConnection;5;0;6;0\nWireConnection;6;0;7;0\nWireConnection;7;0;9;0\nWireConnection;7;1;8;0\nWireConnection;8;0;9;0\nWireConnection;9;0;19;0\nWireConnection;9;1;11;0\nWireConnection;19;0;22;1\nWireConnection;19;1;18;0\nWireConnection;21;0;20;0\nWireConnection;21;1;17;0\nWireConnection;11;0;12;0\nWireConnection;12;0;13;0\nWireConnection;13;0;15;0\nWireConnection;13;1;14;0\nWireConnection;15;0;22;0\nWireConnection;15;1;16;0\nWireConnection;22;0;21;0\nWireConnection;0;0;3;0\nASEEND*/\n//CHKSM=892F129365FB301F688609519A07B0C40D936DB3" - m_functionName: - m_description: Creates a smooth wave pattern. - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_additionalDirectives: - m_validData: 0 - m_isDirty: 0 - m_moduleName: ' Additional Directives' - m_independentModule: 1 - m_additionalDirectives: [] - m_shaderFunctionDirectives: [] - m_nativeDirectives: [] - m_nativeDirectivesIndex: -1 - m_nativeDirectivesFoldout: 0 - m_directivesSaveItems: [] - m_nodeCategory: 9 - m_customNodeCategory: - m_previewPosition: 0 - m_hidden: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Smooth Wave.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Smooth Wave.asset.meta deleted file mode 100644 index 55598e8c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Smooth Wave.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 45d5b33902fbc0848a1166b32106db74 -timeCreated: 1586862423 -licenseType: Store -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/SphereMask.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/SphereMask.asset deleted file mode 100644 index 4c661d76..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/SphereMask.asset +++ /dev/null @@ -1,39 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: SphereMask - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=17803\n269;89;1530;884;1386.415;349.8481;1;True;False\nNode;AmplifyShaderEditor.SaturateNode;16;-352,0;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.DotProductOpNode;8;-496,0;Inherit;False;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;12;-384,144;Inherit;False;Hardness;1;2;True;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;14;-816,144;Inherit;False;Radius;1;1;True;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.WorldPosInputsNode;1;-1088,0;Float;False;0;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;3;-848,0;Inherit;False;2;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.PowerNode;11;-176,0;Inherit;False;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleDivideOpNode;5;-656,0;Inherit;False;2;0;FLOAT3;0,0,0;False;1;FLOAT;0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FunctionInput;15;-1088,160;Inherit;False;Sphere - Center;3;0;True;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FunctionOutput;0;0,0;Inherit;False;True;-1;Output;0;False;1;0;FLOAT;0;False;1;FLOAT;0\nWireConnection;16;0;8;0\nWireConnection;8;0;5;0\nWireConnection;8;1;5;0\nWireConnection;3;0;1;0\nWireConnection;3;1;15;0\nWireConnection;11;0;16;0\nWireConnection;11;1;12;0\nWireConnection;5;0;3;0\nWireConnection;5;1;14;0\nWireConnection;0;0;11;0\nASEEND*/\n//CHKSM=F2ED75A8184A51CCDCD716ADE2ADF2B74D08414C" - m_functionName: - m_description: - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_additionalDirectives: - m_validData: 0 - m_isDirty: 0 - m_moduleName: ' Additional Directives' - m_independentModule: 1 - m_additionalDirectives: [] - m_shaderFunctionDirectives: [] - m_nativeDirectives: [] - m_nativeDirectivesIndex: -1 - m_nativeDirectivesFoldout: 0 - m_directivesSaveItems: [] - m_nodeCategory: 3 - m_customNodeCategory: - m_previewPosition: 0 - m_hidden: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/SphereMask.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/SphereMask.asset.meta deleted file mode 100644 index 5356f25e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/SphereMask.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 988803ee12caf5f4690caee3c8c4a5bb -timeCreated: 1497273339 -licenseType: Store -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Spherize.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Spherize.asset deleted file mode 100644 index 7edede37..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Spherize.asset +++ /dev/null @@ -1,42 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: Spherize - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity - Asset Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=17500\n747;81;887;789;35.74168;1084.006;1.494906;False;False\nNode;AmplifyShaderEditor.TexCoordVertexDataNode;6;-451,-504.5;Inherit;False;0;2;0;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.FunctionInput;3;-208,-336;Inherit;False;Center;2;1;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.Vector2Node;7;-448,-336;Inherit;False;Constant;_Vector0;Vector - 0;0;0;Create;True;0;0;False;0;0.5,0.5;0,0;0;3;FLOAT2;0;FLOAT;1;FLOAT;2\nNode;AmplifyShaderEditor.FunctionInput;2;-224,-512;Inherit;False;UV;2;0;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;11;-48,-448;Inherit;False;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.DotProductOpNode;12;128,-384;Inherit;False;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.Vector2Node;8;-64,-224;Inherit;False;Constant;_Vector1;Vector - 1;0;0;Create;True;0;0;False;0;10,10;0,0;0;3;FLOAT2;0;FLOAT;1;FLOAT;2\nNode;AmplifyShaderEditor.FunctionInput;4;96,-224;Inherit;False;Strength;2;2;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;13;272,-384;Inherit;True;3;3;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;16;528,-512;Inherit;True;2;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;14;800,-560;Inherit;False;3;3;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;2;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionInput;5;672,-272;Inherit;False;Offset;2;3;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.Vector2Node;9;496,-272;Inherit;False;Constant;_Vector2;Vector - 2;0;0;Create;True;0;0;False;0;0,0;0,0;0;3;FLOAT2;0;FLOAT;1;FLOAT;2\nNode;AmplifyShaderEditor.WireNode;17;475.96,-558.8504;Inherit;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionOutput;0;928,-592;Inherit;False;True;-1;Out;0;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nWireConnection;3;0;7;0\nWireConnection;2;0;6;0\nWireConnection;11;0;2;0\nWireConnection;11;1;3;0\nWireConnection;12;0;11;0\nWireConnection;12;1;11;0\nWireConnection;4;0;8;0\nWireConnection;13;0;12;0\nWireConnection;13;1;12;0\nWireConnection;13;2;4;0\nWireConnection;16;0;11;0\nWireConnection;16;1;13;0\nWireConnection;14;0;17;0\nWireConnection;14;1;16;0\nWireConnection;14;2;5;0\nWireConnection;5;0;9;0\nWireConnection;17;0;2;0\nWireConnection;0;0;14;0\nASEEND*/\n//CHKSM=D018B0F4362C188C557966F417A11556B9BFFA27" - m_functionName: - m_description: Creates a sphere type warping effect from given UVs - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_additionalDirectives: - m_validData: 0 - m_isDirty: 0 - m_moduleName: ' Additional Directives' - m_independentModule: 1 - m_additionalDirectives: [] - m_shaderFunctionDirectives: [] - m_nativeDirectives: [] - m_nativeDirectivesIndex: -1 - m_nativeDirectivesFoldout: 0 - m_directivesSaveItems: [] - m_nodeCategory: 14 - m_customNodeCategory: - m_previewPosition: 0 - m_hidden: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Spherize.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Spherize.asset.meta deleted file mode 100644 index dfd44fea..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Spherize.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 1488bb72d8899174ba0601b595d32b07 -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 0 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Spiral.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Spiral.asset deleted file mode 100644 index b6720059..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Spiral.asset +++ /dev/null @@ -1,41 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: Spiral - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=17902\n-1451;-120;1004;726;4246.446;1553.644;4.406295;True;False\nNode;AmplifyShaderEditor.FunctionSwitch;2;-272,0;Inherit;False;Anti - Aliasing;False;1;3;1;None;Smoothstep;Derivative;Object;-1;9;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;4;FLOAT;0;False;5;FLOAT;0;False;6;FLOAT;0;False;7;FLOAT;0;False;8;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.StepOpNode;3;-544,-192;Inherit;True;2;0;FLOAT;0.5;False;1;FLOAT;0.5;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionNode;1;-544,256;Inherit;True;Step - Antialiasing;-1;;8;2a825e80dfb3290468194f83380797bd;0;2;1;FLOAT;0.5;False;2;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.AbsOpNode;12;-928,32;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;20;-1744,32;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SmoothstepOpNode;4;-544,32;Inherit;True;3;0;FLOAT;0;False;1;FLOAT;0.4;False;2;FLOAT;0.6;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;6;-768,32;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;13;-1088,32;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;14;-1280,32;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.RoundOpNode;17;-1424,96;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.WireNode;19;-1157.289,239.4264;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;10;-928,112;Inherit;False;Width;1;3;False;1;0;FLOAT;0.6;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleDivideOpNode;18;-1568,32;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.WireNode;26;-1632.98,191.0273;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;22;-1920,96;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;21;-1920,-16;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.BreakToComponentsNode;24;-2192,32;Inherit;False;FLOAT2;1;0;FLOAT2;0,0;False;16;FLOAT;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT;5;FLOAT;6;FLOAT;7;FLOAT;8;FLOAT;9;FLOAT;10;FLOAT;11;FLOAT;12;FLOAT;13;FLOAT;14;FLOAT;15\nNode;AmplifyShaderEditor.PiNode;25;-2128,-48;Inherit;False;1;0;FLOAT;1;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;23;-2096,144;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;15;-2272,272;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;11;-2448,272;Inherit;False;Separation;1;4;False;1;0;FLOAT;0.5;False;1;FLOAT;0\nNode;AmplifyShaderEditor.TauNode;16;-2400,352;Inherit;False;0;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;9;-2258,145;Inherit;False;Number;1;2;False;1;0;FLOAT;1;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionNode;27;-2512,32;Inherit;False;Polar - Coordinates;-1;;7;7dab8e02884cf104ebefaa2e788e4162;0;4;1;FLOAT2;0,0;False;2;FLOAT2;0.5,0.5;False;3;FLOAT;1;False;4;FLOAT;1;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;29;-2720,32;Inherit;False;2;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.TexCoordVertexDataNode;28;-2992,32;Inherit;False;0;2;0;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.FunctionInput;7;-2960,160;Inherit;False;Tiling;2;0;False;1;0;FLOAT2;3,3;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionInput;8;-2720,160;Inherit;False;Position;2;1;False;1;0;FLOAT2;1.5,1.5;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionOutput;0;0,0;Inherit;False;True;-1;Out;0;False;1;0;FLOAT;0;False;1;FLOAT;0\nWireConnection;2;0;3;0\nWireConnection;2;1;4;0\nWireConnection;2;2;1;0\nWireConnection;3;1;6;0\nWireConnection;1;2;6;0\nWireConnection;12;0;13;0\nWireConnection;20;0;21;0\nWireConnection;20;1;22;0\nWireConnection;4;0;6;0\nWireConnection;6;0;12;0\nWireConnection;6;1;10;0\nWireConnection;13;0;14;0\nWireConnection;13;1;19;0\nWireConnection;14;0;18;0\nWireConnection;14;1;17;0\nWireConnection;17;0;18;0\nWireConnection;19;0;15;0\nWireConnection;18;0;20;0\nWireConnection;18;1;26;0\nWireConnection;26;0;15;0\nWireConnection;22;0;24;1\nWireConnection;22;1;23;0\nWireConnection;21;0;25;0\nWireConnection;21;1;24;0\nWireConnection;24;0;27;0\nWireConnection;23;0;9;0\nWireConnection;23;1;15;0\nWireConnection;15;0;11;0\nWireConnection;15;1;16;0\nWireConnection;27;1;29;0\nWireConnection;27;2;8;0\nWireConnection;29;0;28;0\nWireConnection;29;1;7;0\nWireConnection;0;0;2;0\nASEEND*/\n//CHKSM=AE166C1ED4D74A88DA5347C878A6607CE24AB3DC" - m_functionName: - m_description: Creates a duotone spiral. - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_additionalDirectives: - m_validData: 0 - m_isDirty: 0 - m_moduleName: ' Additional Directives' - m_independentModule: 1 - m_additionalDirectives: [] - m_shaderFunctionDirectives: [] - m_nativeDirectives: [] - m_nativeDirectivesIndex: -1 - m_nativeDirectivesFoldout: 0 - m_directivesSaveItems: [] - m_nodeCategory: 9 - m_customNodeCategory: - m_previewPosition: 0 - m_hidden: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Spiral.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Spiral.asset.meta deleted file mode 100644 index fd02fa28..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Spiral.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 310c5f1537fa4c44699ebaf10a65d8a2 -timeCreated: 1586860260 -licenseType: Store -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Square Wave.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Square Wave.asset deleted file mode 100644 index e5b03740..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Square Wave.asset +++ /dev/null @@ -1,39 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: Square Wave - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=17500\n508;100;994;700;447.1031;292.2682;1;True;False\nNode;AmplifyShaderEditor.RangedFloatNode;2;112,-16;Inherit;False;Constant;_Float0;Float - 0;0;0;Create;True;0;0;False;0;1;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;3;240,0;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.ScaleNode;4;96,64;Inherit;False;2;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.RoundOpNode;6;-16,64;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FractNode;5;-128,64;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;1;-240,64;Inherit;False;In;1;0;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionOutput;0;380,1;Inherit;False;True;-1;Out;0;False;1;0;FLOAT;0;False;1;FLOAT;0\nWireConnection;3;0;2;0\nWireConnection;3;1;4;0\nWireConnection;4;0;6;0\nWireConnection;6;0;5;0\nWireConnection;5;0;1;0\nWireConnection;0;0;3;0\nASEEND*/\n//CHKSM=A3216B4840DFB3FEAB230591EBAFD041F839FDD7" - m_functionName: - m_description: Creates a square wave from a given input - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_additionalDirectives: - m_validData: 0 - m_isDirty: 0 - m_moduleName: ' Additional Directives' - m_independentModule: 1 - m_additionalDirectives: [] - m_shaderFunctionDirectives: [] - m_nativeDirectives: [] - m_nativeDirectivesIndex: -1 - m_nativeDirectivesFoldout: 0 - m_directivesSaveItems: [] - m_nodeCategory: 9 - m_customNodeCategory: - m_previewPosition: 0 - m_hidden: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Square Wave.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Square Wave.asset.meta deleted file mode 100644 index 802bda62..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Square Wave.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 6f8df4c09ccca5d42b0d3d422aad9cbd -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 0 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Step Antialiasing.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Step Antialiasing.asset deleted file mode 100644 index 411acb05..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Step Antialiasing.asset +++ /dev/null @@ -1,26 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: Step Antialiasing - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=14402\n487;595;979;423;1184.914;257.4179;1.312046;True;False\nNode;AmplifyShaderEditor.FWidthOpNode;4;-464,64;Float;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;1;-832,48;Float;False;A;1;0;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;2;-832,-32;Float;False;B;1;1;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;3;-640,0;Float;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SaturateNode;6;-160,0;Float;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleDivideOpNode;5;-304,0;Float;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionOutput;0;0,0;Float;False;True;;0;False;1;0;FLOAT;0;False;1;FLOAT;0\nWireConnection;4;0;3;0\nWireConnection;3;0;2;0\nWireConnection;3;1;1;0\nWireConnection;6;0;5;0\nWireConnection;5;0;3;0\nWireConnection;5;1;4;0\nWireConnection;0;0;6;0\nASEEND*/\n//CHKSM=CEE60F123DADF4170FDE560D2BD03F012DC8D775" - m_functionName: - m_description: Same as Step but provides an antialiased edge. - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_nodeCategory: 7 - m_customNodeCategory: - m_previewPosition: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Step Antialiasing.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Step Antialiasing.asset.meta deleted file mode 100644 index 1947ed7c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Step Antialiasing.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 2a825e80dfb3290468194f83380797bd -timeCreated: 1517571460 -licenseType: Store -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Stripes.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Stripes.asset deleted file mode 100644 index 8887616b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Stripes.asset +++ /dev/null @@ -1,38 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: Stripes - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=17902\n-1451;-120;1004;726;2464.405;901.6481;2.690987;True;False\nNode;AmplifyShaderEditor.RotatorNode;10;-1344,0;Inherit;True;3;0;FLOAT2;0,0;False;1;FLOAT2;0.5,0.5;False;2;FLOAT;1;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionInput;4;-1040,176;Inherit;False;Offset;1;1;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.DynamicAppendNode;9;-864,176;Inherit;False;FLOAT2;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionInput;12;-1696,128;Inherit;False;Rotation;1;3;False;1;0;FLOAT;45;False;1;FLOAT;0\nNode;AmplifyShaderEditor.RadiansOpNode;13;-1552,128;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.TexCoordVertexDataNode;11;-1616,0;Inherit;False;0;2;0;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.FunctionInput;5;-1056,64;Inherit;False;Frequency;1;0;False;1;0;FLOAT;6;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FractNode;6;-416,0;Inherit;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionNode;2;-224,0;Inherit;False;Rectangle;-1;;2;6b23e0c975270fb4084c354b2c83366a;0;3;1;FLOAT2;0,0;False;2;FLOAT;0.5;False;3;FLOAT;1;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;3;-432,80;Inherit;False;Thickness;1;2;False;1;0;FLOAT;0.5;False;1;FLOAT;0\nNode;AmplifyShaderEditor.DynamicAppendNode;8;-864,64;Inherit;False;FLOAT2;4;0;FLOAT;0;False;1;FLOAT;1;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.ScaleAndOffsetNode;7;-656,0;Inherit;False;3;0;FLOAT2;0,0;False;1;FLOAT2;1,0;False;2;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionOutput;0;0,0;Inherit;True;True;-1;Out;0;False;1;0;FLOAT;0;False;1;FLOAT;0\nWireConnection;10;0;11;0\nWireConnection;10;2;13;0\nWireConnection;9;0;4;0\nWireConnection;13;0;12;0\nWireConnection;6;0;7;0\nWireConnection;2;1;6;0\nWireConnection;2;2;3;0\nWireConnection;8;0;5;0\nWireConnection;7;0;10;0\nWireConnection;7;1;8;0\nWireConnection;7;2;9;0\nWireConnection;0;0;2;0\nASEEND*/\n//CHKSM=595F81C41E70086403DC08E5F39B901F2C31A726" - m_functionName: - m_description: Creates a stripes pattern. - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_additionalDirectives: - m_validData: 0 - m_isDirty: 0 - m_moduleName: ' Additional Directives' - m_independentModule: 1 - m_additionalDirectives: [] - m_shaderFunctionDirectives: [] - m_nativeDirectives: [] - m_nativeDirectivesIndex: -1 - m_nativeDirectivesFoldout: 0 - m_directivesSaveItems: [] - m_nodeCategory: 9 - m_customNodeCategory: - m_previewPosition: 0 - m_hidden: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Stripes.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Stripes.asset.meta deleted file mode 100644 index 207a1c4c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Stripes.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 8e73a71cdf24db740864b4c3f3357e7f -timeCreated: 1586859731 -licenseType: Store -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/SubstanceBlendMetallic.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/SubstanceBlendMetallic.asset deleted file mode 100644 index e8449e7e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/SubstanceBlendMetallic.asset +++ /dev/null @@ -1,55 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: SubstanceBlendMetallic - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=15701\n1927;-171;1755;1044;4944.894;2298.292;3.922265;True;False\nNode;AmplifyShaderEditor.CommentaryNode;75;-2140.3,165.0382;Float;False;1438.676;390.7817;;8;64;25;22;23;7;26;8;50;Blending;0.1089965,0.8235294,0.2026249,1;0;0\nNode;AmplifyShaderEditor.CommentaryNode;74;-2122.365,668.0774;Float;False;1089.531;337.4497;;5;37;40;36;52;13;Smoothness;1,1,1,1;0;0\nNode;AmplifyShaderEditor.CommentaryNode;73;-2062.092,1136.985;Float;False;815.4429;395.7837;;5;70;69;71;72;41;Metallic;0.6176471,0.6176471,0.6176471,1;0;0\nNode;AmplifyShaderEditor.CommentaryNode;76;-913.6868,684.1127;Float;False;1032.627;404.9763;;6;53;29;30;32;33;12;Normal;0,0.2965517,1,1;0;0\nNode;AmplifyShaderEditor.CommentaryNode;79;-2178.365,-418.924;Float;False;1444.215;475.3517;;8;20;1;62;63;68;59;48;60;Height;0.7794118,0.5321501,0,1;0;0\nNode;AmplifyShaderEditor.CommentaryNode;78;-644.9852,-402.4992;Float;False;851.1305;427.6555;;5;10;56;27;9;0;Albedo;0.8308824,0.2810338,0.2810338,1;0;0\nNode;AmplifyShaderEditor.CommentaryNode;77;-596.2914,188.0575;Float;False;802.3574;335.5521;;5;45;46;54;44;47;Occlusion;0.08088237,0.08088237,0.08088237,1;0;0\nNode;AmplifyShaderEditor.GetLocalVarNode;54;-508.9551,408.6093;Float;False;50;Mask;1;0;OBJECT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.LerpOp;46;-266.7092,286.337;Float;False;3;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;10;-594.9857,-215.7596;Float;False;M2 - Albedo;3;9;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FunctionInput;44;-546.2911,238.0574;Float;False;M1 - Occlusion;1;8;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;45;-537.6957,316.0335;Float;False;M2 - Occlusion;1;13;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;30;-858.4458,974.089;Float;False;M2 - Normal;3;10;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FunctionInput;29;-863.6868,868.3461;Float;False;M1 - Normal;3;4;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.NormalizeNode;33;-308.887,751.9397;Float;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.LayeredBlendNode;32;-626.5039,827.4257;Float;False;6;0;FLOAT;0;False;1;FLOAT3;0,0,0;False;2;FLOAT3;0,0,0;False;3;FLOAT3;0,0,0;False;4;FLOAT;0;False;5;FLOAT;0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.GetLocalVarNode;56;-470.663,-89.84428;Float;False;50;Mask;1;0;OBJECT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;68;-1565.192,-129.3357;Float;False;Height;1;0;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;63;-1139.765,-368.924;Float;False;2;2;0;FLOAT;0;False;1;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.ScaleAndOffsetNode;60;-1692.467,-280.4159;Float;False;3;0;FLOAT;0;False;1;FLOAT;1;False;2;FLOAT;-0.5;False;1;FLOAT;0\nNode;AmplifyShaderEditor.NormalVertexDataNode;59;-1363.017,-122.572;Float;False;0;5;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;62;-1362.51,-314.935;Float;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;9;-586.3267,-352.4984;Float;False;M1 - Albedo;3;3;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.LerpOp;27;-212.9957,-265.2253;Float;False;3;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT;0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FunctionInput;1;-2128.365,-104.1909;Float;False;M1 - Height;3;7;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.ComponentMaskNode;20;-1903.539,-98.68884;Float;False;True;False;False;False;1;0;FLOAT3;0,0,0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.LerpOp;71;-1693.327,1251.971;Float;False;3;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.GetLocalVarNode;52;-1714.363,890.5271;Float;False;50;Mask;1;0;OBJECT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.RegisterLocalVarNode;64;-1850.772,226.6873;Float;False;Height1;-1;True;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;69;-2012.092,1186.985;Float;False;M1 - Metallic;1;6;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;40;-2072.365,861.0316;Float;False;M2 - Smoothness;1;11;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;37;-2058.345,730.4346;Float;False;M1 - Smoothness;1;5;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.GetLocalVarNode;72;-1953.641,1417.769;Float;False;50;Mask;1;0;OBJECT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.LerpOp;36;-1528.141,718.0774;Float;False;3;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.TFHCRemapNode;25;-1444.829,264.7208;Float;True;5;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;1;False;3;FLOAT;0;False;4;FLOAT;2.69;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;8;-1706.795,440.8203;Float;False;Blend - Hardness;1;1;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SaturateNode;26;-1152.618,215.0382;Float;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.GetLocalVarNode;53;-857.4697,767.5581;Float;False;50;Mask;1;0;OBJECT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.RegisterLocalVarNode;50;-944.6227,238.2931;Float;False;Mask;-1;True;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;70;-2007.1,1301.496;Float;False;M2 - Metallic;1;12;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.OneMinusNode;22;-1611.744,230.6643;Float;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.OneMinusNode;23;-1693.643,349.4193;Float;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;7;-2090.301,395.7402;Float;False;Blend - Amount;1;2;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionOutput;48;-927.1483,-364.2609;Float;False;False;Height - OUT;5;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FunctionOutput;47;-8.933975,238.2769;Float;False;False;Occlusion - OUT;4;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionOutput;12;-78.05887,734.1125;Float;False;False;Normal - OUT;1;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FunctionOutput;13;-1267.832,719.8586;Float;False;False;Smoothness - OUT;3;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionOutput;0;11.14432,-267.8937;Float;False;True;Albedo - OUT;0;True;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FunctionOutput;41;-1447.649,1238.483;Float;False;False;Metallic - OUT;2;False;1;0;FLOAT;0;False;1;FLOAT;0\nWireConnection;46;0;44;0\nWireConnection;46;1;45;0\nWireConnection;46;2;54;0\nWireConnection;33;0;32;0\nWireConnection;32;0;53;0\nWireConnection;32;1;29;0\nWireConnection;32;2;30;0\nWireConnection;63;0;62;0\nWireConnection;63;1;59;0\nWireConnection;60;0;20;0\nWireConnection;62;0;60;0\nWireConnection;62;1;68;0\nWireConnection;27;0;9;0\nWireConnection;27;1;10;0\nWireConnection;27;2;56;0\nWireConnection;20;0;1;0\nWireConnection;71;0;69;0\nWireConnection;71;1;70;0\nWireConnection;71;2;72;0\nWireConnection;64;0;20;0\nWireConnection;36;0;37;0\nWireConnection;36;1;40;0\nWireConnection;36;2;52;0\nWireConnection;25;0;22;0\nWireConnection;25;1;23;0\nWireConnection;25;4;8;0\nWireConnection;26;0;25;0\nWireConnection;50;0;26;0\nWireConnection;22;0;64;0\nWireConnection;23;0;7;0\nWireConnection;48;0;63;0\nWireConnection;47;0;46;0\nWireConnection;12;0;33;0\nWireConnection;13;0;36;0\nWireConnection;0;0;27;0\nWireConnection;41;0;71;0\nASEEND*/\n//CHKSM=CB70D7609C0CE7FF39409B2F5F3B4C63A7232E07" - m_functionName: - m_description: - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_additionalDirectives: - m_validData: 0 - m_isDirty: 0 - m_moduleName: ' Additional Directives' - m_independentModule: 1 - m_additionalDirectives: [] - m_shaderFunctionDirectives: [] - m_nativeDirectives: [] - m_nativeDirectivesFoldout: 0 - m_directivesSaveItems: [] - m_nodeCategory: 3 - m_customNodeCategory: - m_previewPosition: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/SubstanceBlendMetallic.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/SubstanceBlendMetallic.asset.meta deleted file mode 100644 index 5a1b542b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/SubstanceBlendMetallic.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 48f32255bf4aabb4bb7933a1266a4646 -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 11400000 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Terrain Wind Animate Vertex.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Terrain Wind Animate Vertex.asset deleted file mode 100644 index 57b2ea06..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Terrain Wind Animate Vertex.asset +++ /dev/null @@ -1,44 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: Terrain Wind Animate Vertex - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=16103\n279;100;1002;701;934;430;1;True;False\nNode;AmplifyShaderEditor.PosVertexDataNode;5;-706,-228;Float;False;1;0;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.FunctionInput;2;-477,-116;Float;False;Pos;4;0;False;1;0;FLOAT4;0,0,0,0;False;1;FLOAT4;0\nNode;AmplifyShaderEditor.CustomExpressionNode;1;-253,-72;Float;False;return - AnimateVertex(Pos,Normal,AnimParams)@;4;False;3;True;Pos;FLOAT4;0,0,0,0;In;;Float;True;Normal;FLOAT3;0,0,0;In;;Float;True;AnimParams;FLOAT4;0,0,0,0;In;;Float;WindAnimateVertex;True;False;0;3;0;FLOAT4;0,0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT4;0,0,0,0;False;1;FLOAT4;0\nNode;AmplifyShaderEditor.NormalVertexDataNode;6;-712,2;Float;False;0;5;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.FunctionInput;3;-491,-27;Float;False;Normal;3;1;False;1;0;FLOAT3;0,0,0;False;1;FLOAT3;0\nNode;AmplifyShaderEditor.FunctionInput;4;-512,143;Float;False;Anim - Params;4;2;False;1;0;FLOAT4;0,0,0,0;False;1;FLOAT4;0\nNode;AmplifyShaderEditor.FunctionOutput;0;-21,-86;Float;False;True;Output;0;False;1;0;FLOAT4;0,0,0,0;False;1;FLOAT4;0\nWireConnection;2;0;5;0\nWireConnection;1;0;2;0\nWireConnection;1;1;3;0\nWireConnection;1;2;4;0\nWireConnection;3;0;6;0\nWireConnection;0;0;1;0\nASEEND*/\n//CHKSM=A559079493ADDD12988F7585C781D01E1B32CCBB" - m_functionName: - m_description: "Uses Unity AnimateVertex(...) function \nAnimation parameters\nx - = branch phase\ny = edge flutter factor\nz = primary factor\nw = secondary factor" - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_additionalDirectives: - m_validData: 0 - m_isDirty: 1 - m_moduleName: ' Additional Directives' - m_independentModule: 1 - m_additionalDirectives: - - {fileID: 0} - m_shaderFunctionDirectives: [] - m_nativeDirectives: [] - m_nativeDirectivesFoldout: 0 - m_directivesSaveItems: - - LineType: 0 - LineValue: TerrainEngine.cginc - GUIDToggle: 0 - GUIDValue: - m_nodeCategory: 3 - m_customNodeCategory: - m_previewPosition: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Terrain Wind Animate Vertex.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Terrain Wind Animate Vertex.asset.meta deleted file mode 100644 index 3b9d084c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Terrain Wind Animate Vertex.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 3bc81bd4568a7094daabf2ccd6a7e125 -timeCreated: 1544624630 -licenseType: Store -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Terrain Wind Value.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Terrain Wind Value.asset deleted file mode 100644 index 4d107c3d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Terrain Wind Value.asset +++ /dev/null @@ -1,41 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: Terrain Wind Value - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=16103\n282;100;993;689;732.5;318;1;True;False\nNode;AmplifyShaderEditor.Vector4Node;2;-275,-56;Float;False;Global;_Wind;_Wind;0;0;Fetch;True;0;0;False;0;0,0,0,0;0,0,0,0;0;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.FunctionOutput;0;1,-32;Float;False;True;Value;0;False;1;0;FLOAT4;0,0,0,0;False;1;FLOAT4;0\nWireConnection;0;0;2;0\nASEEND*/\n//CHKSM=BA65DE015BF1BA5B4089E1D34F116B49DF410865" - m_functionName: - m_description: 'Returns terrain current wind value ' - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_additionalDirectives: - m_validData: 0 - m_isDirty: 1 - m_moduleName: ' Additional Directives' - m_independentModule: 1 - m_additionalDirectives: - - {fileID: 0} - m_shaderFunctionDirectives: [] - m_nativeDirectives: [] - m_nativeDirectivesFoldout: 0 - m_directivesSaveItems: - - LineType: 0 - LineValue: TerrainEngine.cginc - GUIDToggle: 0 - GUIDValue: - m_nodeCategory: 3 - m_customNodeCategory: - m_previewPosition: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Terrain Wind Value.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Terrain Wind Value.asset.meta deleted file mode 100644 index 642905a6..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Terrain Wind Value.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: c7f50c5b53423ac408959a9a25532d8c -timeCreated: 1544624092 -licenseType: Store -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Triangle Wave.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Triangle Wave.asset deleted file mode 100644 index 4df8a72e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Triangle Wave.asset +++ /dev/null @@ -1,40 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: Triangle Wave - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=17500\n508;100;994;700;66.71295;546.0343;1;True;False\nNode;AmplifyShaderEditor.FunctionInput;1;-493,-231;Inherit;False;In;1;0;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;5;-88.3874,-220.5811;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;3;-352,-128;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FloorOpNode;2;-224,-128;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.RangedFloatNode;4;-528,-112;Inherit;False;Constant;_Float0;Float - 0;0;0;Create;True;0;0;False;0;0.5;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.ScaleNode;6;48,-224;Inherit;False;2;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.AbsOpNode;7;192,-224;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.ScaleNode;8;304,-224;Inherit;False;2;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.RangedFloatNode;10;320,-144;Inherit;False;Constant;_Float1;Float - 1;0;0;Create;True;0;0;False;0;1;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;9;464,-224;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionOutput;0;608,-224;Inherit;False;True;-1;Out;0;False;1;0;FLOAT;0;False;1;FLOAT;0\nWireConnection;5;0;1;0\nWireConnection;5;1;2;0\nWireConnection;3;0;1;0\nWireConnection;3;1;4;0\nWireConnection;2;0;3;0\nWireConnection;6;0;5;0\nWireConnection;7;0;6;0\nWireConnection;8;0;7;0\nWireConnection;9;0;8;0\nWireConnection;9;1;10;0\nWireConnection;0;0;9;0\nASEEND*/\n//CHKSM=590E74ADE111A4C2E167952E95AB6AA949211EC5" - m_functionName: - m_description: Creates a triangle wave from a given input - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_additionalDirectives: - m_validData: 0 - m_isDirty: 0 - m_moduleName: ' Additional Directives' - m_independentModule: 1 - m_additionalDirectives: [] - m_shaderFunctionDirectives: [] - m_nativeDirectives: [] - m_nativeDirectivesIndex: -1 - m_nativeDirectivesFoldout: 0 - m_directivesSaveItems: [] - m_nodeCategory: 9 - m_customNodeCategory: - m_previewPosition: 0 - m_hidden: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Triangle Wave.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Triangle Wave.asset.meta deleted file mode 100644 index 706bce34..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Triangle Wave.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 51ec3c8d117f3ec4fa3742c3e00d535b -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 0 - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Truchet.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Truchet.asset deleted file mode 100644 index af05af9a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Truchet.asset +++ /dev/null @@ -1,40 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: Truchet - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=17902\n-1451;-120;1004;726;4353.539;1501.093;4.613734;True;False\nNode;AmplifyShaderEditor.CosOpNode;17;-2128,0;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.CeilOpNode;22;-2624,0;Inherit;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.LengthOpNode;8;-1136,0;Inherit;False;1;0;FLOAT2;0,0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;25;-2992,256;Inherit;False;Tiling;2;0;False;1;0;FLOAT2;8,8;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.LengthOpNode;9;-1136,96;Inherit;False;1;0;FLOAT2;0,0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SignOpNode;16;-1984,0;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.OneMinusNode;10;-1312,96;Inherit;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.DynamicAppendNode;12;-1616,0;Inherit;False;FLOAT2;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionInput;34;-864,448;Inherit;False;Line - Edge;1;3;False;1;0;FLOAT;0.1;False;1;FLOAT;0\nNode;AmplifyShaderEditor.OneMinusNode;32;-864,352;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;33;-1040,272;Inherit;False;Line - Width;1;2;False;1;0;FLOAT;0.7;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;31;-608,448;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;1;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;28;-592,128;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;27;-592,240;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;1;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;30;-592,336;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;18;-2304,0;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.BreakToComponentsNode;14;-2096,128;Inherit;False;FLOAT2;1;0;FLOAT2;0,0;False;16;FLOAT;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT;5;FLOAT;6;FLOAT;7;FLOAT;8;FLOAT;9;FLOAT;10;FLOAT;11;FLOAT;12;FLOAT;13;FLOAT;14;FLOAT;15\nNode;AmplifyShaderEditor.LengthOpNode;21;-2480,0;Inherit;False;1;0;FLOAT2;0,0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;19;-2480,96;Inherit;False;Seed;1;4;False;1;0;FLOAT;163;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;13;-1824,0;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FractNode;4;-592,0;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.TexCoordVertexDataNode;23;-3040,128;Inherit;False;0;2;0;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;24;-2784,128;Inherit;False;2;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SmoothstepOpNode;3;-384,128;Inherit;False;3;0;FLOAT;0.4;False;1;FLOAT;0.4;False;2;FLOAT;0.2;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SmoothstepOpNode;2;-384,0;Inherit;False;3;0;FLOAT;0;False;1;FLOAT;0.8;False;2;FLOAT;0.6;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FractNode;11;-1456,0;Inherit;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionInput;6;-944,128;Inherit;False;Repetition;1;1;False;1;0;FLOAT;3;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMinOpNode;7;-928,0;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;5;-752,0;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;1;-160,0;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionOutput;0;0,0;Inherit;True;True;-1;Out;0;False;1;0;FLOAT;0;False;1;FLOAT;0\nWireConnection;17;0;18;0\nWireConnection;22;0;24;0\nWireConnection;8;0;11;0\nWireConnection;9;0;10;0\nWireConnection;16;0;17;0\nWireConnection;10;0;11;0\nWireConnection;12;0;13;0\nWireConnection;12;1;14;1\nWireConnection;32;0;33;0\nWireConnection;31;0;32;0\nWireConnection;31;1;34;0\nWireConnection;28;0;33;0\nWireConnection;28;1;34;0\nWireConnection;27;0;33;0\nWireConnection;27;1;34;0\nWireConnection;30;0;32;0\nWireConnection;30;1;34;0\nWireConnection;18;0;21;0\nWireConnection;18;1;19;0\nWireConnection;14;0;24;0\nWireConnection;21;0;22;0\nWireConnection;13;0;16;0\nWireConnection;13;1;14;0\nWireConnection;4;0;5;0\nWireConnection;24;0;23;0\nWireConnection;24;1;25;0\nWireConnection;3;0;4;0\nWireConnection;3;1;30;0\nWireConnection;3;2;31;0\nWireConnection;2;0;4;0\nWireConnection;2;1;28;0\nWireConnection;2;2;27;0\nWireConnection;11;0;12;0\nWireConnection;7;0;8;0\nWireConnection;7;1;9;0\nWireConnection;5;0;7;0\nWireConnection;5;1;6;0\nWireConnection;1;0;2;0\nWireConnection;1;1;3;0\nWireConnection;0;0;1;0\nASEEND*/\n//CHKSM=71BCBEAE6BE593A152630FFE597CDB7E884F9637" - m_functionName: - m_description: Creates a circular truchet pattern - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_additionalDirectives: - m_validData: 0 - m_isDirty: 0 - m_moduleName: ' Additional Directives' - m_independentModule: 1 - m_additionalDirectives: [] - m_shaderFunctionDirectives: [] - m_nativeDirectives: [] - m_nativeDirectivesIndex: -1 - m_nativeDirectivesFoldout: 0 - m_directivesSaveItems: [] - m_nodeCategory: 9 - m_customNodeCategory: - m_previewPosition: 0 - m_hidden: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Truchet.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Truchet.asset.meta deleted file mode 100644 index 6bad17b7..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Truchet.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 600b4e63537aa56498ba8983340930ed -timeCreated: 1586859036 -licenseType: Store -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Twirl.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Twirl.asset deleted file mode 100644 index c651418e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Twirl.asset +++ /dev/null @@ -1,41 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: Twirl - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=17402\n283;92;1224;567;1716.085;694.8059;1;True;False\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;26;-229.45,1014.038;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.RegisterLocalVarNode;23;126.1965,470.1173;Float;False;x;-1;True;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;4;-141.4665,141.677;Inherit;False;Offset;2;3;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.BreakToComponentsNode;30;-544.0643,1393.266;Inherit;False;FLOAT2;1;0;FLOAT2;0,0;False;16;FLOAT;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT;5;FLOAT;6;FLOAT;7;FLOAT;8;FLOAT;9;FLOAT;10;FLOAT;11;FLOAT;12;FLOAT;13;FLOAT;14;FLOAT;15\nNode;AmplifyShaderEditor.BreakToComponentsNode;40;27.03977,43.70857;Inherit;False;FLOAT2;1;0;FLOAT2;0,0;False;16;FLOAT;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT;5;FLOAT;6;FLOAT;7;FLOAT;8;FLOAT;9;FLOAT;10;FLOAT;11;FLOAT;12;FLOAT;13;FLOAT;14;FLOAT;15\nNode;AmplifyShaderEditor.SimpleAddOpNode;36;-42.68103,1196.398;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;31;-222.9422,1321.077;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.BreakToComponentsNode;41;18.78442,147.4395;Inherit;False;FLOAT2;1;0;FLOAT2;0,0;False;16;FLOAT;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT;5;FLOAT;6;FLOAT;7;FLOAT;8;FLOAT;9;FLOAT;10;FLOAT;11;FLOAT;12;FLOAT;13;FLOAT;14;FLOAT;15\nNode;AmplifyShaderEditor.GetLocalVarNode;32;-641.9422,1255.077;Inherit;False;10;angle;1;0;OBJECT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.CosOpNode;28;-419.744,1284.469;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SinOpNode;33;-421.45,979.0385;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;2;-1094.728,-436.1572;Inherit;False;Center;2;1;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.Vector2Node;48;-1273.182,-434.3912;Float;False;Constant;_Vector0;Vector - 0;0;0;Create;True;0;0;False;0;0.5,0.5;0,0;0;3;FLOAT2;0;FLOAT;1;FLOAT;2\nNode;AmplifyShaderEditor.TextureCoordinatesNode;47;-1177.182,-594.3912;Inherit;False;0;-1;2;3;2;SAMPLER2D;;False;0;FLOAT2;1,1;False;1;FLOAT2;0,0;False;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.RangedFloatNode;49;-940.182,-10.39124;Float;False;Constant;_Float0;Float - 0;0;0;Create;True;0;0;False;0;0;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;9;-598.4258,-82.49329;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;38;347.1208,5.87381;Inherit;False;3;3;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.GetLocalVarNode;46;-169.4436,36.13173;Inherit;False;45;center;1;0;OBJECT;0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.GetLocalVarNode;37;85.72414,-54.41926;Inherit;False;23;x;1;0;OBJECT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;42;345.0738,199.996;Inherit;False;3;3;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.GetLocalVarNode;43;79.00623,250.3625;Inherit;False;35;y;1;0;OBJECT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.RegisterLocalVarNode;35;124.55,1199.038;Float;False;y;-1;True;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.DynamicAppendNode;44;503.8386,114.5915;Inherit;False;FLOAT2;4;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;5;-692.6281,-495.1572;Inherit;False;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.BreakToComponentsNode;12;-581.9256,372.3068;Inherit;False;FLOAT2;1;0;FLOAT2;0,0;False;16;FLOAT;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT;5;FLOAT;6;FLOAT;7;FLOAT;8;FLOAT;9;FLOAT;10;FLOAT;11;FLOAT;12;FLOAT;13;FLOAT;14;FLOAT;15\nNode;AmplifyShaderEditor.GetLocalVarNode;14;-679.8035,234.1173;Inherit;False;10;angle;1;0;OBJECT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.GetLocalVarNode;16;-788.419,674.3449;Inherit;False;6;delta;1;0;OBJECT;0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.GetLocalVarNode;27;-648.45,948.0384;Inherit;False;10;angle;1;0;OBJECT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.GetLocalVarNode;24;-763.5733,1081.228;Inherit;False;6;delta;1;0;OBJECT;0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.GetLocalVarNode;7;-964.4258,-150.4933;Inherit;False;6;delta;1;0;OBJECT;0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionInput;3;-776,-11.5;Inherit;False;Strength;1;2;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.LengthOpNode;8;-758.4258,-144.4933;Inherit;False;1;0;FLOAT2;0,0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.GetLocalVarNode;11;-794.9268,367.3068;Inherit;False;6;delta;1;0;OBJECT;0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.RegisterLocalVarNode;10;-432.4258,-86.49329;Float;False;angle;-1;True;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;18;-254.2957,607.1554;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.BreakToComponentsNode;17;-575.4178,679.3449;Inherit;False;FLOAT2;1;0;FLOAT2;0,0;False;16;FLOAT;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT;5;FLOAT;6;FLOAT;7;FLOAT;8;FLOAT;9;FLOAT;10;FLOAT;11;FLOAT;12;FLOAT;13;FLOAT;14;FLOAT;15\nNode;AmplifyShaderEditor.FunctionInput;1;-901.6281,-546.1571;Inherit;False;UV;2;0;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.RegisterLocalVarNode;6;-514.6281,-499.1572;Float;False;delta;-1;True;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.GetLocalVarNode;29;-757.0655,1388.266;Inherit;False;6;delta;1;0;OBJECT;0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.BreakToComponentsNode;25;-550.5721,1086.228;Inherit;False;FLOAT2;1;0;FLOAT2;0,0;False;16;FLOAT;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT;5;FLOAT;6;FLOAT;7;FLOAT;8;FLOAT;9;FLOAT;10;FLOAT;11;FLOAT;12;FLOAT;13;FLOAT;14;FLOAT;15\nNode;AmplifyShaderEditor.RegisterLocalVarNode;45;-919.5434,-437.0681;Float;False;center;-1;True;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SinOpNode;21;-445.8035,549.1173;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.GetLocalVarNode;19;-673.2957,541.1554;Inherit;False;10;angle;1;0;OBJECT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;22;-54.80347,475.1173;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.CosOpNode;13;-469.0975,241.5478;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;15;-260.8035,300.1173;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionOutput;0;755.2719,118.0862;Inherit;False;True;-1;Out;0;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nWireConnection;26;0;33;0\nWireConnection;26;1;25;0\nWireConnection;23;0;22;0\nWireConnection;30;0;29;0\nWireConnection;40;0;46;0\nWireConnection;36;0;26;0\nWireConnection;36;1;31;0\nWireConnection;31;0;28;0\nWireConnection;31;1;30;1\nWireConnection;41;0;4;0\nWireConnection;28;0;32;0\nWireConnection;33;0;27;0\nWireConnection;2;0;48;0\nWireConnection;9;0;8;0\nWireConnection;9;1;3;0\nWireConnection;38;0;37;0\nWireConnection;38;1;40;0\nWireConnection;38;2;41;0\nWireConnection;42;0;40;1\nWireConnection;42;1;41;1\nWireConnection;42;2;43;0\nWireConnection;35;0;36;0\nWireConnection;44;0;38;0\nWireConnection;44;1;42;0\nWireConnection;5;0;1;0\nWireConnection;5;1;45;0\nWireConnection;12;0;11;0\nWireConnection;3;0;49;0\nWireConnection;8;0;7;0\nWireConnection;10;0;9;0\nWireConnection;18;0;21;0\nWireConnection;18;1;17;1\nWireConnection;17;0;16;0\nWireConnection;1;0;47;0\nWireConnection;6;0;5;0\nWireConnection;25;0;24;0\nWireConnection;45;0;2;0\nWireConnection;21;0;19;0\nWireConnection;22;0;15;0\nWireConnection;22;1;18;0\nWireConnection;13;0;14;0\nWireConnection;15;0;13;0\nWireConnection;15;1;12;0\nWireConnection;0;0;44;0\nASEEND*/\n//CHKSM=F53C1E2142313F47DAA6F7B6F1940C955AD15150" - m_functionName: - m_description: Sets a twirl effect to a given input UV. Created by The C.reator - @cayou66 - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_additionalDirectives: - m_validData: 0 - m_isDirty: 0 - m_moduleName: ' Additional Directives' - m_independentModule: 1 - m_additionalDirectives: [] - m_shaderFunctionDirectives: [] - m_nativeDirectives: [] - m_nativeDirectivesIndex: -1 - m_nativeDirectivesFoldout: 0 - m_directivesSaveItems: [] - m_nodeCategory: 3 - m_customNodeCategory: - m_previewPosition: 0 - m_hidden: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Twirl.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Twirl.asset.meta deleted file mode 100644 index c1d44ba7..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Twirl.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 90936742ac32db8449cd21ab6dd337c8 -timeCreated: 1575562904 -licenseType: Store -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/UI-Sprite Effect Layer.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/UI-Sprite Effect Layer.asset deleted file mode 100644 index 6902d2fb..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/UI-Sprite Effect Layer.asset +++ /dev/null @@ -1,71 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: UI-Sprite Effect Layer - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=14301\n487;594;979;424;3607.895;518.2078;1.589382;True;False\nNode;AmplifyShaderEditor.CommentaryNode;223;-6464.406,-405.0316;Float;False;1173;245;Comment;5;221;219;218;222;225;UVs;1,1,1,1;0;0\nNode;AmplifyShaderEditor.CommentaryNode;133;-3799.791,-542.9508;Float;False;2592.219;432.9557;Comment;14;33;43;228;14;18;199;203;92;93;20;72;248;249;250;Flow;1,1,1,1;0;0\nNode;AmplifyShaderEditor.CommentaryNode;141;-4706.676,155.4364;Float;False;4042.436;693;Comment;35;114;122;130;129;30;99;115;116;126;98;125;100;102;101;103;57;6;2;3;8;13;11;4;7;12;17;97;205;200;236;237;239;240;242;246;Rotate;1,1,1,1;0;0\nNode;AmplifyShaderEditor.CommentaryNode;86;-4791.083,-1656.615;Float;False;4027.944;807.3318;Comment;31;229;230;80;190;183;198;184;182;75;83;202;224;185;187;179;84;71;65;181;188;96;189;77;82;186;177;234;233;232;235;231;Distortion;1,1,1,1;0;0\nNode;AmplifyShaderEditor.CommentaryNode;209;-6158.292,-709.5029;Float;False;714.7412;175.0351;Comment;3;59;40;197;Time;1,1,1,1;0;0\nNode;AmplifyShaderEditor.CommentaryNode;208;-6188.004,-1135.091;Float;False;775.5483;285.9527;Comment;3;37;201;207;Main - FX Texture;1,1,1,1;0;0\nNode;AmplifyShaderEditor.ComponentMaskNode;6;-4144.676,573.4364;Float;False;True;True;False;False;1;0;FLOAT4;0,0,0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionSwitch;191;128,-800;Float;False;Tint - Effect;True;0;2;1;In 0;In 1;Object;-1;8;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;FLOAT;0.0;False;3;FLOAT;0.0;False;4;FLOAT;0.0;False;5;FLOAT;0.0;False;6;FLOAT;0.0;False;7;FLOAT;0.0;False;1;COLOR;0\nNode;AmplifyShaderEditor.TextureCoordinatesNode;228;-3264,-400;Float;False;0;-1;2;3;2;SAMPLER2D;;False;0;FLOAT2;1,1;False;1;FLOAT2;0,0;False;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.DynamicAppendNode;82;-3060.073,-1576.615;Float;False;FLOAT4;4;0;FLOAT;0.0;False;1;FLOAT;0.0;False;2;FLOAT;0.0;False;3;FLOAT;0.0;False;1;FLOAT4;0\nNode;AmplifyShaderEditor.StepOpNode;115;-2640.676,653.4366;Float;False;2;0;FLOAT;0.0;False;1;FLOAT;0.0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.TexturePropertyNode;77;-4745.313,-1609.291;Float;True;Property;_DistortionNormal;Distortion - Normal;2;2;[NoScaleOffset];[Normal];Create;True;dd2fd2df93418444c8e280f1d34deeb5;9f3c58d3e4da749499d5cf376feb6225;True;bump;Auto;0;1;SAMPLER2D;0\nNode;AmplifyShaderEditor.FunctionInput;192;128,-688;Float;False;Color;5;0;False;1;0;COLOR;1,1,1,1;False;1;COLOR;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;71;-1780.073,-1160.615;Float;False;2;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SamplerNode;14;-3008,-480;Float;True;Property;_FlowandMaskSampler;Flow - and Mask Sampler;11;1;[NoScaleOffset];Create;True;None;db10d612ce611ae47a896290b6c40f26;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0.0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1.0;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.ComponentMaskNode;27;320,-512;Float;False;False;False;False;True;1;0;COLOR;0,0,0,0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;30;-2170.379,545.9249;Float;False;Opacity;1;17;False;1;0;FLOAT;1.0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.OneMinusNode;122;-2448.676,733.4366;Float;False;1;0;FLOAT;0.0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SamplerNode;96;-1588.073,-1336.615;Float;True;Property;_DistortionSampler;Distortion - Sampler;0;1;[NoScaleOffset];Create;True;None;None;True;0;False;black;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0.0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1.0;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.FunctionInput;188;-3700.073,-1320.615;Float;False;Distortion - Mask;9;9;False;1;0;SAMPLER2D;0.0;False;1;SAMPLER2D;0\nNode;AmplifyShaderEditor.FunctionInput;181;-4132.074,-968.615;Float;False;Move - Vector;2;5;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionInput;57;-4432.676,605.4365;Float;False;Position - Scale;4;14;False;1;0;FLOAT4;0,0,0,0;False;1;FLOAT4;0\nNode;AmplifyShaderEditor.FunctionInput;33;-3536,-480;Float;False;Flow - (RG) Mask (A);9;10;False;1;0;SAMPLER2D;0.0;False;1;SAMPLER2D;0\nNode;AmplifyShaderEditor.FunctionInput;101;-2688.676,429.4364;Float;False;Rotation - Mask;9;13;False;1;0;SAMPLER2D;0.0;False;1;SAMPLER2D;0\nNode;AmplifyShaderEditor.ScaleNode;7;-3712.676,685.4366;Float;False;0.5;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.TexturePropertyNode;43;-3776,-480;Float;True;Property;_FlowandMask;Flow - and Mask;3;1;[NoScaleOffset];Create;True;90cbb44e451af6f44acb32a4c63486ec;db10d612ce611ae47a896290b6c40f26;False;white;Auto;0;1;SAMPLER2D;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;193;752,-608;Float;False;2;2;0;COLOR;0,0,0,0;False;1;COLOR;0.0,0,0,0;False;1;COLOR;0\nNode;AmplifyShaderEditor.FunctionSwitch;186;-2116.073,-1368.615;Float;False;Use - Distortion Mask;True;0;2;6;In 0;In 1;Object;-1;8;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;2;FLOAT;0.0;False;3;FLOAT;0.0;False;4;FLOAT;0.0;False;5;FLOAT;0.0;False;6;FLOAT;0.0;False;7;FLOAT;0.0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.GetLocalVarNode;203;-2304,-480;Float;False;201;0;1;SAMPLER2D;0\nNode;AmplifyShaderEditor.ComponentMaskNode;84;-2596.073,-1576.615;Float;True;True;True;False;False;1;0;FLOAT3;0,0,0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;195;560,-528;Float;False;2;2;0;COLOR;0,0,0,0;False;1;FLOAT;0.0,0,0,0;False;1;COLOR;0\nNode;AmplifyShaderEditor.FunctionInput;39;-320,-608;Float;False;Tint - Color;5;1;False;1;0;COLOR;1,1,1,1;False;1;COLOR;0\nNode;AmplifyShaderEditor.SamplerNode;102;-2480.676,429.4364;Float;True;Property;_RotateMaskSampler;Rotate - Mask Sampler;11;1;[NoScaleOffset];Create;True;None;db10d612ce611ae47a896290b6c40f26;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0.0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1.0;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.SimpleAddOpNode;196;752,-720;Float;False;2;2;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;COLOR;0\nNode;AmplifyShaderEditor.FunctionInput;37;-5881.824,-1082.837;Float;False;Tex;9;2;False;1;0;SAMPLER2D;0.0;False;1;SAMPLER2D;0\nNode;AmplifyShaderEditor.FunctionSwitch;242;-2326.053,204.1207;Float;False;Vertex - UVs;False;0;2;3;Fragment;Vertex;Object;-1;8;0;FLOAT2;0.0;False;1;FLOAT2;0.0;False;2;FLOAT2;0.0;False;3;FLOAT;0.0;False;4;FLOAT;0.0;False;5;FLOAT;0.0;False;6;FLOAT;0.0;False;7;FLOAT;0.0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.RotatorNode;17;-3216,208;Float;False;3;0;FLOAT2;0,0;False;1;FLOAT2;0.5,0.5;False;2;FLOAT;1.0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionSwitch;74;-400,-800;Float;False;Effect;False;0;3;0;Distortion;Flow;Rotate;Object;-1;8;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;COLOR;0,0,0,0;False;3;FLOAT;0.0;False;4;FLOAT;0.0;False;5;FLOAT;0.0;False;6;FLOAT;0.0;False;7;FLOAT;0.0;False;1;COLOR;0\nNode;AmplifyShaderEditor.GetLocalVarNode;224;-4464,-1120;Float;False;222;0;1;FLOAT2;0\nNode;AmplifyShaderEditor.TexCoordVertexDataNode;236;-4480,368;Float;False;0;2;0;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.SimpleTimeNode;250;-2976,-192;Float;False;1;0;FLOAT;1.0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;13;-3376.676,365.4364;Float;False;2;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionInput;239;-4432,496;Float;False;UV;2;4;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.VertexToFragmentNode;246;-2592,272;Float;False;1;0;FLOAT2;0.0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionSwitch;31;976,-800;Float;False;Blend - Mode;False;0;3;16;None;Additive;Additive With Alpha Blend;Object;-1;8;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;COLOR;0,0,0,0;False;3;FLOAT;0.0;False;4;FLOAT;0.0;False;5;FLOAT;0.0;False;6;FLOAT;0.0;False;7;FLOAT;0.0;False;1;COLOR;0\nNode;AmplifyShaderEditor.RegisterLocalVarNode;222;-5536,-352;Float;False;MainUvs;-1;True;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SamplerNode;65;-3412.073,-1608.615;Float;True;Property;_DistortionNormalSampler;Distortion - Normal Sampler;3;1;[NoScaleOffset];Create;True;None;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0.0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1.0;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.SimpleAddOpNode;8;-3792.676,365.4364;Float;False;2;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.TexturePropertyNode;100;-2976.676,301.4365;Float;True;Property;_RotateMask;Rotate - Mask;5;1;[NoScaleOffset];Create;True;800ff50c9cc42bb4c99ea4b57ccd019e;db10d612ce611ae47a896290b6c40f26;False;white;Auto;0;1;SAMPLER2D;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;26;-96,-688;Float;False;2;2;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;1;COLOR;0\nNode;AmplifyShaderEditor.FunctionSwitch;98;-944.6762,205.4365;Float;False;Use - Mask;True;0;2;11;In 0;In 1;Object;-1;8;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;FLOAT;0.0;False;3;FLOAT;0.0;False;4;FLOAT;0.0;False;5;FLOAT;0.0;False;6;FLOAT;0.0;False;7;FLOAT;0.0;False;1;COLOR;0\nNode;AmplifyShaderEditor.FunctionSwitch;126;-1984.676,477.4364;Float;False;Mask - Type;False;0;2;13;Texture;Color;Object;-1;8;0;FLOAT;0.0;False;1;FLOAT;0.0;False;2;FLOAT;0.0;False;3;FLOAT;0.0;False;4;FLOAT;0.0;False;5;FLOAT;0.0;False;6;FLOAT;0.0;False;7;FLOAT;0.0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;99;-1168,320;Float;False;3;3;0;COLOR;0,0,0,0;False;1;FLOAT;0,0,0,0;False;2;FLOAT;0,0,0,0;False;1;COLOR;0\nNode;AmplifyShaderEditor.FunctionSwitch;204;-368,-240;Float;False;Option;False;0;2;-1;In - 0;In 1;Instance;74;8;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;2;FLOAT2;0,0;False;3;FLOAT;0.0;False;4;FLOAT;0.0;False;5;FLOAT;0.0;False;6;FLOAT;0.0;False;7;FLOAT;0.0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.PannerNode;179;-3860.073,-1032.615;Float;False;3;0;FLOAT2;0,0;False;2;FLOAT2;0,-0.1;False;1;FLOAT;1.0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SamplerNode;72;-2004.572,-476.025;Float;True;Property;_FlowSampler;Flow - Sampler;0;1;[NoScaleOffset];Create;True;None;None;True;0;False;black;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0.0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1.0;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.Vector4Node;103;-4656.676,605.4365;Float;False;Constant;_Vector0;Vector - 0;4;0;Create;True;0,0,1,1;0,0,0,0;0;5;FLOAT4;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.LerpOp;125;-1715.194,611.3666;Float;False;3;0;FLOAT;1.0;False;1;FLOAT;1.0;False;2;FLOAT;0.0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionSwitch;130;-2224.676,653.4366;Float;False;Invert - Middle Point;True;0;2;15;In 0;In 1;Object;-1;8;0;FLOAT;0.0;False;1;FLOAT;0.0;False;2;FLOAT;0.0;False;3;FLOAT;0.0;False;4;FLOAT;0.0;False;5;FLOAT;0.0;False;6;FLOAT;0.0;False;7;FLOAT;0.0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.RegisterLocalVarNode;201;-5655.456,-1085.091;Float;False;FxTexVar;-1;True;1;0;SAMPLER2D;0.0;False;1;SAMPLER2D;0\nNode;AmplifyShaderEditor.SamplerNode;187;-3428.073,-1320.615;Float;True;Property;_DistortionMaskSampler;Distortion - Mask Sampler;3;1;[NoScaleOffset];Create;True;None;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0.0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1.0;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.FunctionInput;40;-5900.292,-649.4677;Float;False;Time;1;15;False;1;0;FLOAT;0.01;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;185;-4164.074,-1432.615;Float;False;2;2;0;FLOAT2;0,0;False;1;FLOAT;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;116;-2832.676,653.4366;Float;False;2;2;0;FLOAT;0.0;False;1;FLOAT;-0.5;False;1;FLOAT;0\nNode;AmplifyShaderEditor.GetLocalVarNode;205;-1840.676,301.4365;Float;False;201;0;1;SAMPLER2D;0\nNode;AmplifyShaderEditor.GetLocalVarNode;202;-1802.593,-1350.938;Float;False;201;0;1;SAMPLER2D;0\nNode;AmplifyShaderEditor.ComponentMaskNode;114;-3152.676,653.4366;Float;False;False;True;True;True;1;0;FLOAT2;0,0,0,0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.UnpackScaleNormalNode;83;-2852.073,-1576.615;Float;False;2;0;FLOAT4;0,0,0,0;False;1;FLOAT;1.0;False;4;FLOAT3;0;FLOAT;1;FLOAT;2;FLOAT;3\nNode;AmplifyShaderEditor.FunctionSwitch;225;-5792,-352;Float;False;Custom - UVs;True;0;2;2;In 0;In 1;Object;-1;8;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;2;FLOAT;0.0;False;3;FLOAT;0.0;False;4;FLOAT;0.0;False;5;FLOAT;0.0;False;6;FLOAT;0.0;False;7;FLOAT;0.0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.RegisterLocalVarNode;197;-5686.55,-659.5028;Float;False;TimeVar;-1;True;1;0;FLOAT;0.0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;75;-3700.073,-1608.615;Float;False;Distortion - Normal;9;6;False;1;0;SAMPLER2D;0.0;False;1;SAMPLER2D;0\nNode;AmplifyShaderEditor.FunctionSwitch;182;-3700.073,-1464.615;Float;False;Move - Distortion;True;0;2;8;In 0;In 1;Object;-1;8;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;2;FLOAT;0.0;False;3;FLOAT;0.0;False;4;FLOAT;0.0;False;5;FLOAT;0.0;False;6;FLOAT;0.0;False;7;FLOAT;0.0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SimpleAddOpNode;184;-3924.073,-1432.615;Float;False;2;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionSwitch;92;-1444.572,-476.025;Float;False;Use - Mask;True;0;2;10;In 0;In 1;Object;-1;8;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;FLOAT;0.0;False;3;FLOAT;0.0;False;4;FLOAT;0.0;False;5;FLOAT;0.0;False;6;FLOAT;0.0;False;7;FLOAT;0.0;False;1;COLOR;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;93;-1652.572,-300.025;Float;False;2;2;0;COLOR;0,0,0,0;False;1;FLOAT;0.0,0,0,0;False;1;COLOR;0\nNode;AmplifyShaderEditor.GetLocalVarNode;198;-4471.64,-1349.006;Float;False;197;0;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;183;-4484.074,-1432.615;Float;False;Move - Distortion Vector;2;8;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;190;-2324.073,-1304.615;Float;False;2;2;0;FLOAT2;0,0;False;1;FLOAT;0.0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SimpleTimeNode;59;-6108.292,-649.4677;Float;False;1;0;FLOAT;1.0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;80;-3124.073,-1416.615;Float;False;Distortion - Amount;1;7;False;1;0;FLOAT;1.0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionSwitch;177;-3600,-1120;Float;False;Move - Background;True;0;2;7;Simple;Moving Background;Object;-1;8;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;2;FLOAT;0.0;False;3;FLOAT;0.0;False;4;FLOAT;0.0;False;5;FLOAT;0.0;False;6;FLOAT;0.0;False;7;FLOAT;0.0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.TexturePropertyNode;235;-2688,-1056;Float;True;Property;_DistortionBlendMask;Distortion - Blend Mask;4;1;[NoScaleOffset];Create;True;800ff50c9cc42bb4c99ea4b57ccd019e;db10d612ce611ae47a896290b6c40f26;False;white;Auto;0;1;SAMPLER2D;0\nNode;AmplifyShaderEditor.NegateNode;12;-3552.676,685.4366;Float;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;230;-1184,-1184;Float;False;3;3;0;COLOR;0,0,0,0;False;1;FLOAT;0.0,0,0,0;False;2;FLOAT;0,0,0,0;False;1;COLOR;0\nNode;AmplifyShaderEditor.GetLocalVarNode;200;-3601.361,241.9365;Float;False;197;0;1;FLOAT;0\nNode;AmplifyShaderEditor.TextureCoordinatesNode;219;-6219.89,-355.0316;Float;False;0;-1;2;3;2;SAMPLER2D;;False;0;FLOAT2;1,1;False;1;FLOAT2;0,0;False;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;11;-3568.676,365.4364;Float;False;2;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.TexturePropertyNode;207;-6138.004,-1079.138;Float;True;Property;_FXTexture;FX - Texture;0;1;[NoScaleOffset];Create;True;84508b93f15f2b64386ec07486afc7a3;f7e96904e8667e1439548f0f86389447;False;white;Auto;0;1;SAMPLER2D;0\nNode;AmplifyShaderEditor.ComponentMaskNode;2;-4144.676,653.4366;Float;False;False;False;True;True;1;0;FLOAT4;0,0,0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionSwitch;129;-1504.676,477.4364;Float;False;Use - Middle Point Cut;True;1;2;14;In 0;In 1;Object;-1;8;0;FLOAT;0.0;False;1;FLOAT;0.0;False;2;FLOAT;0.0;False;3;FLOAT;0.0;False;4;FLOAT;0.0;False;5;FLOAT;0.0;False;6;FLOAT;0.0;False;7;FLOAT;0.0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;231;-1792,-944;Float;False;Opacity;1;16;False;1;0;FLOAT;1.0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;4;-3872.676,685.4366;Float;False;2;0;FLOAT2;0,0;False;1;FLOAT;0.0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionSwitch;234;-1584,-1008;Float;False;Mask - Type;False;0;2;12;Texture;Color;Object;-1;8;0;FLOAT;0.0;False;1;FLOAT;0.0;False;2;FLOAT;0.0;False;3;FLOAT;0.0;False;4;FLOAT;0.0;False;5;FLOAT;0.0;False;6;FLOAT;0.0;False;7;FLOAT;0.0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.GetLocalVarNode;221;-6414.406,-355.0316;Float;False;201;0;1;SAMPLER2D;0\nNode;AmplifyShaderEditor.FunctionSwitch;229;-1008,-1328;Float;False;Use - Mask;True;0;2;9;In 0;In 1;Object;-1;8;0;COLOR;0,0,0,0;False;1;COLOR;0,0,0,0;False;2;FLOAT;0.0;False;3;FLOAT;0.0;False;4;FLOAT;0.0;False;5;FLOAT;0.0;False;6;FLOAT;0.0;False;7;FLOAT;0.0;False;1;COLOR;0\nNode;AmplifyShaderEditor.TexturePropertyNode;189;-4745.313,-1321.291;Float;True;Property;_DistortionMask;Distortion - Mask;1;1;[NoScaleOffset];Create;True;23d106e42b09f48ecb609eb2d6032f0a;9f3c58d3e4da749499d5cf376feb6225;False;white;Auto;0;1;SAMPLER2D;0\nNode;AmplifyShaderEditor.FunctionInput;218;-5968,-256;Float;False;UV;2;3;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SamplerNode;97;-1520.676,205.4365;Float;True;Property;_RotateSampler;Rotate - Sampler;4;1;[NoScaleOffset];Create;True;None;None;True;0;False;black;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0.0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1.0;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.FunctionInput;248;-2788.04,-193.6505;Float;False;Move - Dir;2;11;False;1;0;FLOAT2;1,1;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionSwitch;237;-4144,464;Float;False;Custom - UVs;True;0;2;4;In 0;In 1;Object;-1;8;0;FLOAT2;0.0;False;1;FLOAT2;0.0;False;2;FLOAT;0.0;False;3;FLOAT;0.0;False;4;FLOAT;0.0;False;5;FLOAT;0.0;False;6;FLOAT;0.0;False;7;FLOAT;0.0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.RelayNode;240;-1897.553,209.827;Float;False;1;0;FLOAT2;0.0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionInput;233;-2448,-1056;Float;False;Distortion - Blend Mask;9;12;False;1;0;SAMPLER2D;0.0;False;1;SAMPLER2D;0\nNode;AmplifyShaderEditor.DynamicAppendNode;20;-2496.058,-413.0761;Float;False;FLOAT2;4;0;FLOAT;0.0;False;1;FLOAT;0.0;False;2;FLOAT;0.0;False;3;FLOAT;0.0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;18;-2312.529,-412.6489;Float;False;2;0;FLOAT2;0.0;False;1;FLOAT;0.0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SamplerNode;232;-2176,-1056;Float;True;Property;_DistortionBlendMaskSampler;Distortion - Blend Mask Sampler;11;1;[NoScaleOffset];Create;True;None;db10d612ce611ae47a896290b6c40f26;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0.0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1.0;False;5;COLOR;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.FunctionSwitch;249;-2592,-272;Float;False;Separate - XY Time;True;0;2;5;In 0;In 1;Object;-1;8;0;FLOAT;0.0;False;1;FLOAT2;0.0;False;2;FLOAT;0.0;False;3;FLOAT;0.0;False;4;FLOAT;0.0;False;5;FLOAT;0.0;False;6;FLOAT;0.0;False;7;FLOAT;0.0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.GetLocalVarNode;199;-2979.91,-269.36;Float;False;197;0;1;FLOAT;0\nNode;AmplifyShaderEditor.RangedFloatNode;3;-4096.676,733.4366;Float;False;Constant;_Float0;Float - 0;3;0;Create;True;1;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionOutput;0;1344,-800;Float;False;True;RGBA;0;True;1;0;COLOR;0,0,0,0;False;1;COLOR;0\nNode;AmplifyShaderEditor.FunctionOutput;172;16,-240;Float;False;False;UV;1;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nWireConnection;6;0;57;0\nWireConnection;191;0;74;0\nWireConnection;191;1;26;0\nWireConnection;228;2;33;0\nWireConnection;82;1;65;2\nWireConnection;82;3;65;1\nWireConnection;115;0;116;0\nWireConnection;71;0;186;0\nWireConnection;71;1;177;0\nWireConnection;14;0;33;0\nWireConnection;14;1;228;0\nWireConnection;27;0;192;0\nWireConnection;122;0;115;0\nWireConnection;96;0;202;0\nWireConnection;96;1;71;0\nWireConnection;188;0;189;0\nWireConnection;57;0;103;0\nWireConnection;33;0;43;0\nWireConnection;101;0;100;0\nWireConnection;7;0;4;0\nWireConnection;193;0;192;0\nWireConnection;193;1;195;0\nWireConnection;186;0;84;0\nWireConnection;186;1;190;0\nWireConnection;84;0;83;0\nWireConnection;195;0;191;0\nWireConnection;195;1;27;0\nWireConnection;102;0;101;0\nWireConnection;102;1;237;0\nWireConnection;196;0;191;0\nWireConnection;196;1;192;0\nWireConnection;37;0;207;0\nWireConnection;242;0;17;0\nWireConnection;242;1;246;0\nWireConnection;17;0;13;0\nWireConnection;17;2;200;0\nWireConnection;74;0;229;0\nWireConnection;74;1;92;0\nWireConnection;74;2;98;0\nWireConnection;13;0;11;0\nWireConnection;13;1;12;0\nWireConnection;246;0;17;0\nWireConnection;31;0;191;0\nWireConnection;31;1;196;0\nWireConnection;31;2;193;0\nWireConnection;222;0;225;0\nWireConnection;65;0;75;0\nWireConnection;65;1;182;0\nWireConnection;8;0;237;0\nWireConnection;8;1;6;0\nWireConnection;26;0;74;0\nWireConnection;26;1;39;0\nWireConnection;98;0;97;0\nWireConnection;98;1;99;0\nWireConnection;126;0;102;2\nWireConnection;126;1;30;0\nWireConnection;99;0;97;0\nWireConnection;99;1;129;0\nWireConnection;99;2;97;4\nWireConnection;204;0;71;0\nWireConnection;204;1;18;0\nWireConnection;204;2;240;0\nWireConnection;179;0;224;0\nWireConnection;179;2;181;0\nWireConnection;72;0;203;0\nWireConnection;72;1;18;0\nWireConnection;125;1;126;0\nWireConnection;125;2;130;0\nWireConnection;130;0;115;0\nWireConnection;130;1;122;0\nWireConnection;201;0;37;0\nWireConnection;187;0;188;0\nWireConnection;187;1;182;0\nWireConnection;40;0;59;0\nWireConnection;185;0;183;0\nWireConnection;185;1;198;0\nWireConnection;116;0;114;0\nWireConnection;114;0;13;0\nWireConnection;83;0;82;0\nWireConnection;83;1;80;0\nWireConnection;225;0;219;0\nWireConnection;225;1;218;0\nWireConnection;197;0;40;0\nWireConnection;75;0;77;0\nWireConnection;182;0;224;0\nWireConnection;182;1;184;0\nWireConnection;184;0;185;0\nWireConnection;184;1;224;0\nWireConnection;92;0;72;0\nWireConnection;92;1;93;0\nWireConnection;93;0;72;0\nWireConnection;93;1;14;4\nWireConnection;190;0;84;0\nWireConnection;190;1;187;2\nWireConnection;177;0;224;0\nWireConnection;177;1;179;0\nWireConnection;12;0;7;0\nWireConnection;230;0;96;0\nWireConnection;230;1;96;4\nWireConnection;230;2;234;0\nWireConnection;219;2;221;0\nWireConnection;11;0;8;0\nWireConnection;11;1;2;0\nWireConnection;2;0;57;0\nWireConnection;129;0;126;0\nWireConnection;129;1;125;0\nWireConnection;4;0;2;0\nWireConnection;4;1;3;0\nWireConnection;234;0;232;2\nWireConnection;234;1;231;0\nWireConnection;229;0;96;0\nWireConnection;229;1;230;0\nWireConnection;218;0;219;0\nWireConnection;97;0;205;0\nWireConnection;97;1;240;0\nWireConnection;248;0;250;0\nWireConnection;237;0;236;0\nWireConnection;237;1;239;0\nWireConnection;240;0;242;0\nWireConnection;233;0;235;0\nWireConnection;20;0;14;1\nWireConnection;20;1;14;2\nWireConnection;18;0;20;0\nWireConnection;18;1;249;0\nWireConnection;232;0;233;0\nWireConnection;249;0;199;0\nWireConnection;249;1;248;0\nWireConnection;0;0;31;0\nWireConnection;172;0;204;0\nASEEND*/\n//CHKSM=3897411E214292FD4588680A344DD01F3BE97598" - m_functionName: - m_description: - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_nodeCategory: 3 - m_customNodeCategory: - m_previewPosition: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/UI-Sprite Effect Layer.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/UI-Sprite Effect Layer.asset.meta deleted file mode 100644 index fcf96ccf..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/UI-Sprite Effect Layer.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 789bf62641c5cfe4ab7126850acc22b8 -timeCreated: 1516025397 -licenseType: Store -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Whirl.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Whirl.asset deleted file mode 100644 index 7a06b52a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Whirl.asset +++ /dev/null @@ -1,42 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: Whirl - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=18004\n447;214;1178;691;4557.838;1918.107;5.505805;True;True\nNode;AmplifyShaderEditor.FunctionNode;6;-1968,-16;Inherit;False;Polar - Coordinates;-1;;3;7dab8e02884cf104ebefaa2e788e4162;0;4;1;FLOAT2;0,0;False;2;FLOAT2;0.5,0.5;False;3;FLOAT;1;False;4;FLOAT;1;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;3;-2192,-16;Inherit;False;2;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionInput;10;-1744,-176;Inherit;False;Rotation;1;5;False;1;0;FLOAT;1;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleDivideOpNode;9;-1552,-160;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.TauNode;8;-1712,-96;Inherit;False;0;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;7;-2192,112;Inherit;False;Position;2;2;False;1;0;FLOAT2;0.5,0.5;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionSwitch;25;64,0;Inherit;False;Anti - Aliasing;False;1;3;1;None;Smoothstep;Derivative;Object;-1;9;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;4;FLOAT;0;False;5;FLOAT;0;False;6;FLOAT;0;False;7;FLOAT;0;False;8;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionNode;23;-224,224;Inherit;True;Step - Antialiasing;-1;;4;2a825e80dfb3290468194f83380797bd;0;2;1;FLOAT;0.5;False;2;FLOAT;0.5;False;1;FLOAT;0\nNode;AmplifyShaderEditor.StepOpNode;24;-224,-240;Inherit;True;2;0;FLOAT;0.5;False;1;FLOAT;0.5;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;21;-560,80;Inherit;False;Width;1;4;False;1;0;FLOAT;2;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;1;-2432,112;Inherit;False;Tiling;2;1;False;1;0;FLOAT2;1,1;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.AbsOpNode;19;-560,0;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SmoothstepOpNode;22;-224,0;Inherit;True;3;0;FLOAT;0;False;1;FLOAT;0.45;False;2;FLOAT;0.55;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;20;-400,0;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;17;-736,0;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;15;-1040,0;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;11;-1392,-112;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.BreakToComponentsNode;12;-1669.078,-23.10936;Inherit;False;FLOAT2;1;0;FLOAT2;0,0;False;16;FLOAT;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT;5;FLOAT;6;FLOAT;7;FLOAT;8;FLOAT;9;FLOAT;10;FLOAT;11;FLOAT;12;FLOAT;13;FLOAT;14;FLOAT;15\nNode;AmplifyShaderEditor.FunctionInput;16;-1216,96;Inherit;False;Number;1;3;False;1;0;FLOAT;8;False;1;FLOAT;0\nNode;AmplifyShaderEditor.RoundOpNode;18;-880,64;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;14;-1216,0;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;27;-2656,64;Inherit;False;UV;2;0;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.TexCoordVertexDataNode;28;-2880,-16;Inherit;False;0;2;0;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.FunctionSwitch;26;-2464,-16;Inherit;False;Custom - UVs;True;0;2;0;In 0;In 1;Object;-1;9;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT;0;False;4;FLOAT;0;False;5;FLOAT;0;False;6;FLOAT;0;False;7;FLOAT;0;False;8;FLOAT;0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionOutput;0;352,0;Inherit;False;True;-1;Out;0;False;1;0;FLOAT;0;False;1;FLOAT;0\nWireConnection;6;1;3;0\nWireConnection;6;2;7;0\nWireConnection;3;0;26;0\nWireConnection;3;1;1;0\nWireConnection;9;0;10;0\nWireConnection;9;1;8;0\nWireConnection;25;0;24;0\nWireConnection;25;1;22;0\nWireConnection;25;2;23;0\nWireConnection;23;2;20;0\nWireConnection;24;1;20;0\nWireConnection;19;0;17;0\nWireConnection;22;0;20;0\nWireConnection;20;0;19;0\nWireConnection;20;1;21;0\nWireConnection;17;0;15;0\nWireConnection;17;1;18;0\nWireConnection;15;0;14;0\nWireConnection;15;1;16;0\nWireConnection;11;0;9;0\nWireConnection;11;1;12;0\nWireConnection;12;0;6;0\nWireConnection;18;0;15;0\nWireConnection;14;0;12;1\nWireConnection;14;1;11;0\nWireConnection;27;0;28;0\nWireConnection;26;0;28;0\nWireConnection;26;1;27;0\nWireConnection;0;0;25;0\nASEEND*/\n//CHKSM=524C524527FFD24280A66E7E271E61FCDCEBCBFD" - m_functionName: - m_description: Creates a duotone whirl. - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_additionalDirectives: - m_validData: 0 - m_isDirty: 0 - m_moduleName: ' Additional Directives' - m_independentModule: 1 - m_additionalDirectives: [] - m_shaderFunctionDirectives: [] - m_nativeDirectives: [] - m_nativeDirectivesIndex: -1 - m_nativeDirectivesFoldout: 0 - m_directivesSaveItems: [] - m_nodeCategory: 9 - m_customNodeCategory: - m_previewPosition: 0 - m_hidden: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Whirl.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Whirl.asset.meta deleted file mode 100644 index 38536667..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Whirl.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 7d75aee9e4d352a4299928ac98404afc -timeCreated: 1586858124 -licenseType: Store -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Zig Zag.asset b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Zig Zag.asset deleted file mode 100644 index eaa142d6..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Zig Zag.asset +++ /dev/null @@ -1,43 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 78b2425a2284af743826c689403a4924, type: 3} - m_Name: Zig Zag - m_EditorClassIdentifier: - m_functionInfo: "// Made with Amplify Shader Editor\n// Available at the Unity Asset - Store - http://u3d.as/y3X \n/*ASEBEGIN\nVersion=17902\n-1451;-120;1004;726;3953.281;1395.555;3.991293;True;False\nNode;AmplifyShaderEditor.BreakToComponentsNode;20;-2336,-32;Inherit;False;FLOAT2;1;0;FLOAT2;0,0;False;16;FLOAT;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4;FLOAT;5;FLOAT;6;FLOAT;7;FLOAT;8;FLOAT;9;FLOAT;10;FLOAT;11;FLOAT;12;FLOAT;13;FLOAT;14;FLOAT;15\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;11;-912,32;Inherit;False;2;2;0;FLOAT;0;False;1;FLOAT;2;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionNode;4;-1824,144;Inherit;False;Triangle - Wave;-1;;5;51ec3c8d117f3ec4fa3742c3e00d535b;0;1;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;7;-1600,32;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;16;-2032,64;Inherit;False;Amplitude;1;3;False;1;0;FLOAT;0.2;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleDivideOpNode;2;-1984,160;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionInput;15;-2208,176;Inherit;False;Wavelength;1;2;False;1;0;FLOAT;0.5;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SmoothstepOpNode;14;-656,32;Inherit;True;3;0;FLOAT;0;False;1;FLOAT;0.5;False;2;FLOAT;0.55;False;1;FLOAT;0\nNode;AmplifyShaderEditor.RoundOpNode;9;-1408,144;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.AbsOpNode;10;-1088,32;Inherit;False;1;0;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleDivideOpNode;5;-1792,-16;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.RangedFloatNode;18;-1104,144;Inherit;False;Constant;_Float2;Float - 2;0;0;Create;True;0;0;False;0;2;0;0;0;0;1;FLOAT;0\nNode;AmplifyShaderEditor.StepOpNode;12;-656,-192;Inherit;True;2;0;FLOAT;0.5;False;1;FLOAT;0.5;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionSwitch;17;-304,0;Inherit;False;Anti - Aliasing;False;1;3;1;None;Smoothstep;Derivative;Object;-1;9;0;FLOAT;0;False;1;FLOAT;0;False;2;FLOAT;0;False;3;FLOAT;0;False;4;FLOAT;0;False;5;FLOAT;0;False;6;FLOAT;0;False;7;FLOAT;0;False;8;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.SimpleSubtractOpNode;8;-1264,32;Inherit;False;2;0;FLOAT;0;False;1;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionNode;13;-656,256;Inherit;True;Step - Antialiasing;-1;;4;2a825e80dfb3290468194f83380797bd;0;2;1;FLOAT;0.5;False;2;FLOAT;0;False;1;FLOAT;0\nNode;AmplifyShaderEditor.FunctionSwitch;24;-2560,-32;Inherit;False;Custom - UVs;True;0;2;0;In 0;In 1;Object;-1;9;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;2;FLOAT;0;False;3;FLOAT;0;False;4;FLOAT;0;False;5;FLOAT;0;False;6;FLOAT;0;False;7;FLOAT;0;False;8;FLOAT;0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionInput;22;-2944,112;Inherit;False;Tiling;2;1;False;1;0;FLOAT2;1,1;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.SimpleMultiplyOpNode;25;-2752,96;Inherit;False;2;2;0;FLOAT2;0,0;False;1;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.FunctionInput;19;-2752,-32;Inherit;False;UV;2;0;False;1;0;FLOAT2;0,0;False;1;FLOAT2;0\nNode;AmplifyShaderEditor.TexCoordVertexDataNode;1;-3024,-32;Inherit;False;0;2;0;5;FLOAT2;0;FLOAT;1;FLOAT;2;FLOAT;3;FLOAT;4\nNode;AmplifyShaderEditor.FunctionOutput;0;0,0;Inherit;True;True;-1;Out;0;False;1;0;FLOAT;0;False;1;FLOAT;0\nWireConnection;20;0;24;0\nWireConnection;11;0;10;0\nWireConnection;11;1;18;0\nWireConnection;4;1;2;0\nWireConnection;7;0;5;0\nWireConnection;7;1;4;0\nWireConnection;2;0;20;0\nWireConnection;2;1;15;0\nWireConnection;14;0;11;0\nWireConnection;9;0;7;0\nWireConnection;10;0;8;0\nWireConnection;5;0;20;1\nWireConnection;5;1;16;0\nWireConnection;12;1;11;0\nWireConnection;17;0;12;0\nWireConnection;17;1;14;0\nWireConnection;17;2;13;0\nWireConnection;8;0;7;0\nWireConnection;8;1;9;0\nWireConnection;13;2;11;0\nWireConnection;24;0;25;0\nWireConnection;24;1;19;0\nWireConnection;25;0;1;0\nWireConnection;25;1;22;0\nWireConnection;19;0;1;0\nWireConnection;0;0;17;0\nASEEND*/\n//CHKSM=81E39E7D2F7FF85E045BB45FDBBBB9CFD0B58BC3" - m_functionName: - m_description: Creates a zig zag pattern. - m_additionalIncludes: - m_additionalIncludes: [] - m_outsideIncludes: [] - m_additionalPragmas: - m_additionalPragmas: [] - m_outsidePragmas: [] - m_additionalDirectives: - m_validData: 0 - m_isDirty: 0 - m_moduleName: ' Additional Directives' - m_independentModule: 1 - m_additionalDirectives: [] - m_shaderFunctionDirectives: [] - m_nativeDirectives: [] - m_nativeDirectivesIndex: -1 - m_nativeDirectivesFoldout: 0 - m_directivesSaveItems: [] - m_nodeCategory: 9 - m_customNodeCategory: - m_previewPosition: 0 - m_hidden: 0 diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Zig Zag.asset.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Zig Zag.asset.meta deleted file mode 100644 index 79e99a92..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderFunctions/Zig Zag.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 8cd734fbcae021148a58931ed7d68679 -timeCreated: 1586786476 -licenseType: Store -NativeFormatImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderLibrary.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderLibrary.meta deleted file mode 100644 index 11a87f3b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderLibrary.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: c7d59e8c9057675458e07a7d532c321b -folderAsset: yes -timeCreated: 1481126944 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderLibrary/ShaderLibrary.txt b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderLibrary/ShaderLibrary.txt deleted file mode 100644 index b3bd7975..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderLibrary/ShaderLibrary.txt +++ /dev/null @@ -1 +0,0 @@ -CustomCategory/ricardo#Hidden/CubeMapReflection#Hidden/DoLSimpleTexture
\ No newline at end of file diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderLibrary/ShaderLibrary.txt.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderLibrary/ShaderLibrary.txt.meta deleted file mode 100644 index 92684e74..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/ShaderLibrary/ShaderLibrary.txt.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 608872e34785abb4aa0eafeb5515ec3b -timeCreated: 1481127071 -licenseType: Store -TextScriptImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Shaders.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Shaders.meta deleted file mode 100644 index 5fce785d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Shaders.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: dd999f0c55d995740a0376d84237f80c -folderAsset: yes -timeCreated: 1481126945 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Shaders/ASESShaderSelectorUnlit.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Shaders/ASESShaderSelectorUnlit.shader deleted file mode 100644 index a0a93f4c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Shaders/ASESShaderSelectorUnlit.shader +++ /dev/null @@ -1,39 +0,0 @@ -Shader "Hidden/ASESShaderSelectorUnlit" -{ - SubShader - { - Tags { "RenderType"="Opaque" } - Pass - { - CGPROGRAM - #pragma vertex vert - #pragma fragment frag - #include "UnityCG.cginc" - - struct appdata - { - float4 vertex : POSITION; - }; - - struct v2f - { - float4 vertex : SV_POSITION; - }; - - uniform fixed4 _Color; - - v2f vert (appdata v) - { - v2f o; - o.vertex = UnityObjectToClipPos(v.vertex); - return o; - } - - fixed4 frag (v2f i) : SV_Target - { - return _Color; - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Shaders/ASESShaderSelectorUnlit.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Shaders/ASESShaderSelectorUnlit.shader.meta deleted file mode 100644 index 1a85ab1c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Shaders/ASESShaderSelectorUnlit.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: b83de440f4e137948bdb40a67a2f6dbe -timeCreated: 1490375492 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Shaders/Unlit-ColoredAlpha.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Shaders/Unlit-ColoredAlpha.shader deleted file mode 100644 index 7638151f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Shaders/Unlit-ColoredAlpha.shader +++ /dev/null @@ -1,165 +0,0 @@ -Shader "Unlit/Colored Transparent" { - Properties { - _MainTex ("Base (RGB) Trans (A)", 2D) = "white" {} - _SecondTex ("Second (RGB) Trans (A)", 2D) = "white" {} - _ThirdTex ("Third (RGB) Trans (A)", 2D) = "white" {} - _FourthTex ("Fourth (RGB) Trans (A)", 2D) = "white" {} - _Color ("Color", Color) = (1,1,1,1) - } - - SubShader { - Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"} - LOD 100 - - ZWrite Off - Blend SrcAlpha OneMinusSrcAlpha - - Pass { // SINGLE LINE - CGPROGRAM - #pragma vertex vert - #pragma fragment frag - #pragma target 2.0 - #include "UnityCG.cginc" - - struct appdata_t { - float4 vertex : POSITION; - float4 color : COLOR; - float2 texcoord : TEXCOORD0; - }; - - struct v2f { - float4 vertex : SV_Position; - fixed4 color : COLOR; - half2 texcoord : TEXCOORD0; - float2 clipUV : TEXCOORD1; - }; - - sampler2D _MainTex; - float4 _MainTex_ST; - float4 _Color; - uniform float4x4 unity_GUIClipTextureMatrix; - sampler2D _GUIClipTexture; - - v2f vert (appdata_t v) - { - v2f o; - o.vertex = UnityObjectToClipPos(v.vertex); - o.color = v.color * _Color; - o.texcoord = TRANSFORM_TEX(v.texcoord, _MainTex); - float3 eyePos = UnityObjectToViewPos( v.vertex ); - o.clipUV = mul( unity_GUIClipTextureMatrix, float4( eyePos.xy, 0, 1.0 ) ); - return o; - } - - fixed4 frag( v2f i ) : SV_Target - { - float4 l1 = tex2D( _MainTex, i.texcoord); - float clipAlpha = tex2D( _GUIClipTexture, i.clipUV ).a; - l1.rgb *= i.color.rgb; - l1.a *= clipAlpha; - return l1; - } - ENDCG - } - - Pass { // MULTI LINE - CGPROGRAM - #pragma vertex vert - #pragma fragment frag - #pragma target 2.0 - #include "UnityCG.cginc" - - struct appdata_t { - float4 vertex : POSITION; - float4 color : COLOR; - float2 texcoord : TEXCOORD0; - }; - - struct v2f { - float4 vertex : SV_Position; - fixed4 color : COLOR; - half2 texcoord : TEXCOORD0; - float2 clipUV : TEXCOORD1; - }; - - sampler2D _MainTex; - float4 _MainTex_ST; - sampler2D _SecondTex; - float4 _SecondTex_ST; - sampler2D _ThirdTex; - float4 _ThirdTex_ST; - sampler2D _FourthTex; - float4 _FourthTex_ST; - float4 _Color; - uniform float4x4 unity_GUIClipTextureMatrix; - sampler2D _GUIClipTexture; - float _InvertedZoom; - - v2f vert (appdata_t v) - { - v2f o; - o.vertex = UnityObjectToClipPos(v.vertex); - o.color = v.color * _Color; - o.texcoord = TRANSFORM_TEX(v.texcoord, _MainTex); - float3 eyePos = UnityObjectToViewPos( v.vertex ); - o.clipUV = mul( unity_GUIClipTextureMatrix, float4( eyePos.xy, 0, 1.0 ) ); - return o; - } - - fixed4 frag( v2f i ) : SV_Target - { - float4 l1 = tex2D( _MainTex, i.texcoord); - float clipAlpha = tex2D( _GUIClipTexture, i.clipUV ).a; - l1.rgb *= i.color.rgb; - l1.a *= clipAlpha; - - float4 l2 = tex2D( _SecondTex, i.texcoord); - float4 l3 = tex2D( _ThirdTex, i.texcoord); - float4 l4 = tex2D( _FourthTex, i.texcoord); - - float2 coords2 = i.texcoord; - coords2.y *= 2; - float4 m2 = tex2D( _MainTex, coords2 ); - m2 = pow( m2, 0.9 ); - - float2 coords3 = i.texcoord; - coords3.y *= 3; - float4 m3 = tex2D( _MainTex, coords3 ); - m3 = pow( m3, 0.8 ); - - float2 coords4 = i.texcoord; - coords4.y *= 4; - float4 m4 = tex2D( _MainTex, coords4 ); - m4 = pow( m4, 0.7 ); - - l2.rgb *= i.color.rgb; - l3.rgb *= i.color.rgb; - l4.rgb *= i.color.rgb; - - m2.rgb *= i.color.rgb; - m3.rgb *= i.color.rgb; - m4.rgb *= i.color.rgb; - - l2.a *= clipAlpha; - l3.a *= clipAlpha; - l4.a *= clipAlpha; - - m2.a *= clipAlpha; - m3.a *= clipAlpha; - m4.a *= clipAlpha; - - float zoomLerp = saturate( ( ( _InvertedZoom ) * 2 ) - 0.0 ); - - if ( i.color.a >= 1 ) - return lerp( l4, m4, zoomLerp ); - else if ( i.color.a >= 0.75 ) - return lerp( l3, m3, zoomLerp ); - else if ( i.color.a >= 0.5 ) - return lerp( l2, m2, zoomLerp ); - else - return l1; - } - ENDCG - } - } -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Shaders/Unlit-ColoredAlpha.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Shaders/Unlit-ColoredAlpha.shader.meta deleted file mode 100644 index 528ef296..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Shaders/Unlit-ColoredAlpha.shader.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 50fc796413bac8b40aff70fb5a886273 -timeCreated: 1491397480 -licenseType: Store -ShaderImporter: - defaultTextures: - - _MainTex: {fileID: 2800000, guid: 02f71419854c0d845a930c9e0a0bf775, type: 3} - - _SecondTex: {fileID: 2800000, guid: 03a7d169469c1af41bb03241a7b7e23d, type: 3} - - _ThirdTex: {fileID: 2800000, guid: c3512c25766a40245ac94c6b1722d76e, type: 3} - - _FourthTex: {fileID: 2800000, guid: e0f922c44762291498cc62e0917609be, type: 3} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates.meta deleted file mode 100644 index f5784b72..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 211faf49d0bea6c4081e4e1135d19686 -folderAsset: yes -timeCreated: 1481126944 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/CustomRTTemplates.unitypackage b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/CustomRTTemplates.unitypackage Binary files differdeleted file mode 100644 index 41ce47b3..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/CustomRTTemplates.unitypackage +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/CustomRTTemplates.unitypackage.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/CustomRTTemplates.unitypackage.meta deleted file mode 100644 index 0ca30b9d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/CustomRTTemplates.unitypackage.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 191365b4aece81443875ae2bb7243b55 -timeCreated: 1539791396 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDSRPTemplates.unitypackage b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDSRPTemplates.unitypackage Binary files differdeleted file mode 100644 index 0fc50bfa..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDSRPTemplates.unitypackage +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDSRPTemplates.unitypackage.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDSRPTemplates.unitypackage.meta deleted file mode 100644 index f46c626f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/HDSRPTemplates.unitypackage.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 9a5e61a8b3421b944863d0946e32da0a -timeCreated: 1531836588 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/LWSRPTemplates.unitypackage b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/LWSRPTemplates.unitypackage Binary files differdeleted file mode 100644 index 131fb679..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/LWSRPTemplates.unitypackage +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/LWSRPTemplates.unitypackage.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/LWSRPTemplates.unitypackage.meta deleted file mode 100644 index 89ca7fea..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/LWSRPTemplates.unitypackage.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 4c816894a3147d343891060451241bfe -timeCreated: 1520621352 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy.meta deleted file mode 100644 index 55a974ea..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 6e848a1cd56b4c4489af03626db2de58 -folderAsset: yes -timeCreated: 1527085590 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/DefaultUnlit.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/DefaultUnlit.shader deleted file mode 100644 index cac22d89..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/DefaultUnlit.shader +++ /dev/null @@ -1,78 +0,0 @@ -Shader /*ase_name*/ "Hidden/Templates/Legacy/DefaultUnlit" /*end*/ -{ - Properties - { - _MainTex ("Sprite Texture", 2D) = "white" {} - _Color ("Tint", Color) = (1,1,1,1) - /*ase_props*/ - } - - SubShader - { - Tags { "RenderType"="Opaque" } - LOD 100 - Cull Off - - /*ase_pass*/ - Pass - { - CGPROGRAM - #pragma target 3.0 - #pragma vertex vert - #pragma fragment frag - #include "UnityCG.cginc" - /*ase_pragma*/ - - struct appdata - { - float4 vertex : POSITION; - float4 texcoord : TEXCOORD0; - float4 texcoord1 : TEXCOORD1; - UNITY_VERTEX_INPUT_INSTANCE_ID - /*ase_vdata:p=p;uv0=tc0.xy;uv1=tc1.xy*/ - }; - - struct v2f - { - float4 vertex : SV_POSITION; - float4 texcoord : TEXCOORD0; - UNITY_VERTEX_INPUT_INSTANCE_ID - UNITY_VERTEX_OUTPUT_STEREO - /*ase_interp(1,):sp=sp.xyzw;uv0=tc0.xy;uv1=tc0.zw*/ - }; - - uniform sampler2D _MainTex; - uniform fixed4 _Color; - /*ase_globals*/ - - v2f vert ( appdata v /*ase_vert_input*/) - { - v2f o; - UNITY_SETUP_INSTANCE_ID(v); - UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); - UNITY_TRANSFER_INSTANCE_ID(v, o); - o.texcoord.xy = v.texcoord.xy; - o.texcoord.zw = v.texcoord1.xy; - - // ase common template code - /*ase_vert_code:v=appdata;o=v2f*/ - - v.vertex.xyz += /*ase_vert_out:Local Vertex;Float3*/ float3(0,0,0) /*end*/; - o.vertex = UnityObjectToClipPos(v.vertex); - return o; - } - - fixed4 frag (v2f i /*ase_frag_input*/) : SV_Target - { - fixed4 myColorVar; - // ase common template code - /*ase_frag_code:i=v2f*/ - - myColorVar = /*ase_frag_out:Frag Color;Float4*/fixed4(1,0,0,1)/*end*/; - return myColorVar; - } - ENDCG - } - } - CustomEditor "ASEMaterialInspector" -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/DefaultUnlit.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/DefaultUnlit.shader.meta deleted file mode 100644 index 05481633..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/DefaultUnlit.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 6e114a916ca3e4b4bb51972669d463bf -timeCreated: 1496328687 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/MultiPassUnlit.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/MultiPassUnlit.shader deleted file mode 100644 index b0eab5dd..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/MultiPassUnlit.shader +++ /dev/null @@ -1,289 +0,0 @@ -Shader /*ase_name*/ "Hidden/Templates/Legacy/Multi Pass Unlit" /*end*/ -{ - Properties - { - /*ase_props*/ - } - - SubShader - { - Tags { "RenderType"="Opaque" } - LOD 100 - - Cull Off - CGINCLUDE - #pragma target 3.0 - ENDCG - - /*ase_pass*/ - Pass - { - /*ase_main_pass*/ - Name "ForwardBase" - Tags { "LightMode"="ForwardBase" } - - /*ase_all_modules*/ - CGPROGRAM - #pragma vertex vert - #pragma fragment frag - #pragma multi_compile_fwdbase - #define UNITY_PASS_FORWARDBASE - #include "UnityCG.cginc" - /*ase_pragma*/ - /*ase_globals*/ - - struct appdata - { - float4 vertex : POSITION; - float3 normal : NORMAL; - UNITY_VERTEX_INPUT_INSTANCE_ID - /*ase_vdata:p=p;n=n*/ - }; - - struct v2f - { - float4 pos : SV_POSITION; - UNITY_VERTEX_INPUT_INSTANCE_ID - UNITY_VERTEX_OUTPUT_STEREO - /*ase_interp(1,):sp=sp.xyzw*/ - }; - - v2f vert ( appdata v /*ase_vert_input*/) - { - v2f o; - UNITY_INITIALIZE_OUTPUT(v2f,o); - UNITY_SETUP_INSTANCE_ID(v); - UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); - UNITY_TRANSFER_INSTANCE_ID(v, o); - - /*ase_vert_code:v=appdata;o=v2f*/ - - v.vertex.xyz += /*ase_vert_out:Local Vertex;Float3;_Vertex*/ float3(0,0,0) /*end*/; - o.pos = UnityObjectToClipPos(v.vertex); - #if ASE_SHADOWS - #if UNITY_VERSION >= 560 - UNITY_TRANSFER_SHADOW( o, v.texcoord ); - #else - TRANSFER_SHADOW( o ); - #endif - #endif - return o; - } - - float4 frag (v2f i /*ase_frag_input*/) : SV_Target - { - float3 outColor; - float outAlpha; - - /*ase_frag_code:i=v2f*/ - - outColor = /*ase_frag_out:Color;Float3;_Color*/float3(1,1,1)/*end*/; - outAlpha = /*ase_frag_out:Alpha;Float;_Alpha*/1/*end*/; - clip(outAlpha); - return float4(outColor,outAlpha); - } - ENDCG - } - - /*ase_pass*/ - Pass - { - Name "ForwardAdd" - Tags { "LightMode" = "ForwardAdd" } - ZWrite Off - Blend One One - CGPROGRAM - #pragma vertex vert - #pragma fragment frag - #pragma multi_compile_fwdadd_fullshadows - #define UNITY_PASS_FORWARDADD - #include "UnityCG.cginc" - /*ase_pragma*/ - /*ase_globals*/ - - struct appdata - { - float4 vertex : POSITION; - float3 normal : NORMAL; - UNITY_VERTEX_INPUT_INSTANCE_ID - /*ase_vdata:p=p;n=n*/ - }; - - struct v2f - { - float4 pos : SV_POSITION; - UNITY_VERTEX_INPUT_INSTANCE_ID - UNITY_VERTEX_OUTPUT_STEREO - /*ase_interp(1,):sp=sp.xyzw*/ - }; - - v2f vert ( appdata v /*ase_vert_input*/) - { - v2f o; - UNITY_INITIALIZE_OUTPUT(v2f,o); - UNITY_SETUP_INSTANCE_ID(v); - UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); - UNITY_TRANSFER_INSTANCE_ID(v, o); - - /*ase_vert_code:v=appdata;o=v2f*/ - - v.vertex.xyz += /*ase_vert_out:Local Vertex;Float3;_Vertex*/ float3(0,0,0) /*end*/; - o.pos = UnityObjectToClipPos(v.vertex); - #if ASE_SHADOWS - #if UNITY_VERSION >= 560 - UNITY_TRANSFER_SHADOW( o, v.texcoord ); - #else - TRANSFER_SHADOW( o ); - #endif - #endif - return o; - } - - float4 frag (v2f i /*ase_frag_input*/) : SV_Target - { - float3 outColor; - float outAlpha; - - /*ase_frag_code:i=v2f*/ - - outColor = /*ase_frag_out:Color;Float3;_Color*/float3(1,1,1)/*end*/; - outAlpha = /*ase_frag_out:Alpha;Float;_Alpha*/1/*end*/; - clip(outAlpha); - return float4(outColor,outAlpha); - } - ENDCG - } - - /*ase_pass*/ - Pass - { - Name "Deferred" - Tags { "LightMode" = "Deferred" } - - /*ase_all_modules*/ - CGPROGRAM - #pragma vertex vert - #pragma fragment frag - #pragma multi_compile_prepassfinal - #define UNITY_PASS_DEFERRED - #include "UnityCG.cginc" - /*ase_pragma*/ - /*ase_globals*/ - - struct appdata - { - float4 vertex : POSITION; - float3 normal : NORMAL; - UNITY_VERTEX_INPUT_INSTANCE_ID - /*ase_vdata:p=p;n=n*/ - }; - - struct v2f - { - float4 pos : SV_POSITION; - UNITY_VERTEX_INPUT_INSTANCE_ID - UNITY_VERTEX_OUTPUT_STEREO - /*ase_interp(1,):sp=sp.xyzw*/ - }; - - v2f vert ( appdata v /*ase_vert_input*/) - { - v2f o; - UNITY_INITIALIZE_OUTPUT(v2f,o); - UNITY_SETUP_INSTANCE_ID(v); - UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); - UNITY_TRANSFER_INSTANCE_ID(v, o); - - /*ase_vert_code:v=appdata;o=v2f*/ - - v.vertex.xyz += /*ase_vert_out:Local Vertex;Float3;_Vertex*/ float3(0,0,0) /*end*/; - o.pos = UnityObjectToClipPos(v.vertex); - #if ASE_SHADOWS - #if UNITY_VERSION >= 560 - UNITY_TRANSFER_SHADOW( o, v.texcoord ); - #else - TRANSFER_SHADOW( o ); - #endif - #endif - return o; - } - - void frag (v2f i /*ase_frag_input*/, out half4 outGBuffer0 : SV_Target0, out half4 outGBuffer1 : SV_Target1, out half4 outGBuffer2 : SV_Target2, out half4 outGBuffer3 : SV_Target3) - { - /*ase_frag_code:i=v2f*/ - - outGBuffer0 = /*ase_frag_out:GBuffer0;Float4*/0/*end*/; - outGBuffer1 = /*ase_frag_out:GBuffer1;Float4*/0/*end*/; - outGBuffer2 = /*ase_frag_out:GBuffer2;Float4*/0/*end*/; - outGBuffer3 = /*ase_frag_out:GBuffer3;Float4*/0/*end*/; - } - ENDCG - } - - /*ase_pass*/ - Pass - { - /*ase_hide_pass:SyncP*/ - Name "ShadowCaster" - Tags { "LightMode"="ShadowCaster" } - ZWrite On - ZTest LEqual - CGPROGRAM - #pragma vertex vert - #pragma fragment frag - #pragma multi_compile_shadowcaster - #define UNITY_PASS_SHADOWCASTER - #include "UnityCG.cginc" - /*ase_pragma*/ - /*ase_globals*/ - - struct appdata - { - float4 vertex : POSITION; - float3 normal : NORMAL; - UNITY_VERTEX_INPUT_INSTANCE_ID - /*ase_vdata:p=p;n=n*/ - }; - - struct v2f - { - V2F_SHADOW_CASTER; - UNITY_VERTEX_INPUT_INSTANCE_ID - UNITY_VERTEX_OUTPUT_STEREO - /*ase_interp(1,):sp=sp.xyzw*/ - }; - - - v2f vert ( appdata v /*ase_vert_input*/) - { - v2f o; - UNITY_INITIALIZE_OUTPUT(v2f,o); - UNITY_SETUP_INSTANCE_ID(v); - UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); - UNITY_TRANSFER_INSTANCE_ID(v, o); - - /*ase_vert_code:v=appdata;o=v2f*/ - - v.vertex.xyz += /*ase_vert_out:Local Vertex;Float3;_Vertex*/ float3(0,0,0) /*end*/; - TRANSFER_SHADOW_CASTER_NORMALOFFSET(o) - return o; - } - - float4 frag (v2f i /*ase_frag_input*/) : SV_Target - { - float3 outColor; - float outAlpha; - - /*ase_frag_code:i=v2f*/ - - outColor = /*ase_frag_out:Color;Float3;_Color*/float3(1,1,1)/*end*/; - outAlpha = /*ase_frag_out:Alpha;Float;_Alpha*/1/*end*/; - clip(outAlpha); - SHADOW_CASTER_FRAGMENT(i) - } - ENDCG - } - /*ase_pass_end*/ - } - CustomEditor "ASEMaterialInspector" -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/MultiPassUnlit.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/MultiPassUnlit.shader.meta deleted file mode 100644 index aab11e92..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/MultiPassUnlit.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: e1de45c0d41f68c41b2cc20c8b9c05ef -timeCreated: 1496328687 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/Particle Alpha Blend.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/Particle Alpha Blend.shader deleted file mode 100644 index c501235e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/Particle Alpha Blend.shader +++ /dev/null @@ -1,123 +0,0 @@ -Shader /*ase_name*/ "Hidden/Templates/Legacy/Particles Alpha Blended" /*end*/ -{ - Properties - { - _TintColor ("Tint Color", Color) = (0.5,0.5,0.5,0.5) - _MainTex ("Particle Texture", 2D) = "white" {} - _InvFade ("Soft Particles Factor", Range(0.01,3.0)) = 1.0 - /*ase_props*/ - } - - - Category - { - SubShader - { - Tags{ "Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" = "Transparent" "PreviewType" = "Plane" } - Blend SrcAlpha OneMinusSrcAlpha - ColorMask RGB - Cull Off - Lighting Off - ZWrite Off - ZTest LEqual - /*ase_pass*/ - Pass { - - CGPROGRAM - #ifndef UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX - #define UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input) - #endif - - #pragma vertex vert - #pragma fragment frag - #pragma target 2.0 - #pragma multi_compile_instancing - #pragma multi_compile_particles - #pragma multi_compile_fog - /*ase_pragma*/ - - #include "UnityCG.cginc" - - struct appdata_t - { - float4 vertex : POSITION; - fixed4 color : COLOR; - float4 texcoord : TEXCOORD0; - UNITY_VERTEX_INPUT_INSTANCE_ID - /*ase_vdata:p=p;uv0=tc0;c=c*/ - }; - - struct v2f - { - float4 vertex : SV_POSITION; - fixed4 color : COLOR; - float4 texcoord : TEXCOORD0; - UNITY_FOG_COORDS(1) - #ifdef SOFTPARTICLES_ON - float4 projPos : TEXCOORD2; - #endif - UNITY_VERTEX_INPUT_INSTANCE_ID - UNITY_VERTEX_OUTPUT_STEREO - /*ase_interp(3,):sp=sp.xyzw;uv0=tc0;c=c*/ - }; - - - #if UNITY_VERSION >= 560 - UNITY_DECLARE_DEPTH_TEXTURE( _CameraDepthTexture ); - #else - uniform sampler2D_float _CameraDepthTexture; - #endif - - //Don't delete this comment - // uniform sampler2D_float _CameraDepthTexture; - - uniform sampler2D _MainTex; - uniform fixed4 _TintColor; - uniform float4 _MainTex_ST; - uniform float _InvFade; - /*ase_globals*/ - - v2f vert ( appdata_t v /*ase_vert_input*/ ) - { - v2f o; - UNITY_SETUP_INSTANCE_ID(v); - UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); - UNITY_TRANSFER_INSTANCE_ID(v, o); - /*ase_vert_code:v=appdata_t;o=v2f*/ - - v.vertex.xyz += /*ase_vert_out:Offset;Float3*/ float3( 0, 0, 0 ) /*end*/; - o.vertex = UnityObjectToClipPos(v.vertex); - #ifdef SOFTPARTICLES_ON - o.projPos = ComputeScreenPos (o.vertex); - COMPUTE_EYEDEPTH(o.projPos.z); - #endif - o.color = v.color; - o.texcoord = v.texcoord; - UNITY_TRANSFER_FOG(o,o.vertex); - return o; - } - - fixed4 frag ( v2f i /*ase_frag_input*/ ) : SV_Target - { - UNITY_SETUP_INSTANCE_ID( i ); - UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX( i ); - - #ifdef SOFTPARTICLES_ON - float sceneZ = LinearEyeDepth (SAMPLE_DEPTH_TEXTURE_PROJ(_CameraDepthTexture, UNITY_PROJ_COORD(i.projPos))); - float partZ = i.projPos.z; - float fade = saturate (_InvFade * (sceneZ-partZ)); - i.color.a *= fade; - #endif - - /*ase_frag_code:i=v2f*/ - - fixed4 col = /*ase_frag_out:Color;Float4*/2.0f * i.color * _TintColor * tex2D(_MainTex, i.texcoord.xy*_MainTex_ST.xy + _MainTex_ST.zw )/*end*/; - UNITY_APPLY_FOG(i.fogCoord, col); - return col; - } - ENDCG - } - } - } - CustomEditor "ASEMaterialInspector" -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/Particle Alpha Blend.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/Particle Alpha Blend.shader.meta deleted file mode 100644 index 8880a98e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/Particle Alpha Blend.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 0b6a9f8b4f707c74ca64c0be8e590de0 -timeCreated: 1496654572 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/PostProcess.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/PostProcess.shader deleted file mode 100644 index e862731a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/PostProcess.shader +++ /dev/null @@ -1,94 +0,0 @@ -Shader /*ase_name*/ "Hidden/Templates/Legacy/PostProcess" /*end*/ -{ - Properties - { - _MainTex ( "Screen", 2D ) = "black" {} - /*ase_props*/ - } - - SubShader - { - Tags{ } - - ZTest Always - Cull Off - ZWrite Off - - /*ase_pass*/ - Pass - { - CGPROGRAM - - #pragma vertex vert_img_custom - #pragma fragment frag - #pragma target 3.0 - #include "UnityCG.cginc" - /*ase_pragma*/ - - struct appdata_img_custom - { - float4 vertex : POSITION; - half2 texcoord : TEXCOORD0; - /*ase_vdata:p=p;uv0=tc0*/ - }; - - struct v2f_img_custom - { - float4 pos : SV_POSITION; - half2 uv : TEXCOORD0; - half2 stereoUV : TEXCOORD2; - #if UNITY_UV_STARTS_AT_TOP - half4 uv2 : TEXCOORD1; - half4 stereoUV2 : TEXCOORD3; - #endif - /*ase_interp(4,):sp=sp.xyzw;uv0=tc0.xy;uv1=tc1;uv2=tc2;uv3=tc3*/ - }; - - uniform sampler2D _MainTex; - uniform half4 _MainTex_TexelSize; - uniform half4 _MainTex_ST; - - /*ase_globals*/ - - v2f_img_custom vert_img_custom ( appdata_img_custom v /*ase_vert_input*/ ) - { - v2f_img_custom o; - /*ase_vert_code:v=appdata_img_custom;o=v2f_img_custom*/ - o.pos = UnityObjectToClipPos( v.vertex ); - o.uv = float4( v.texcoord.xy, 1, 1 ); - - #if UNITY_UV_STARTS_AT_TOP - o.uv2 = float4( v.texcoord.xy, 1, 1 ); - o.stereoUV2 = UnityStereoScreenSpaceUVAdjust ( o.uv2, _MainTex_ST ); - - if ( _MainTex_TexelSize.y < 0.0 ) - o.uv.y = 1.0 - o.uv.y; - #endif - o.stereoUV = UnityStereoScreenSpaceUVAdjust ( o.uv, _MainTex_ST ); - return o; - } - - half4 frag ( v2f_img_custom i /*ase_frag_input*/) : SV_Target - { - #ifdef UNITY_UV_STARTS_AT_TOP - half2 uv = i.uv2; - half2 stereoUV = i.stereoUV2; - #else - half2 uv = i.uv; - half2 stereoUV = i.stereoUV; - #endif - - half4 finalColor; - - // ase common template code - /*ase_frag_code:i=v2f_img_custom*/ - - finalColor = /*ase_frag_out:Frag Color;Float4*/half4( 1, 1, 1, 1 )/*end*/; - - return finalColor; - } - ENDCG - } - } - CustomEditor "ASEMaterialInspector" -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/PostProcess.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/PostProcess.shader.meta deleted file mode 100644 index 010915cf..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/PostProcess.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: c71b220b631b6344493ea3cf87110c93 -timeCreated: 1499337997 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/Sprites-Default.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/Sprites-Default.shader deleted file mode 100644 index 89b5eac5..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/Sprites-Default.shader +++ /dev/null @@ -1,108 +0,0 @@ -Shader /*ase_name*/"Hidden/Templates/Legacy/Sprites Default"/*end*/ -{ - Properties - { - [PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {} - _Color ("Tint", Color) = (1,1,1,1) - [MaterialToggle] PixelSnap ("Pixel snap", Float) = 0 - [PerRendererData] _AlphaTex ("External Alpha", 2D) = "white" {} - /*ase_props*/ - } - - SubShader - { - Tags - { - "Queue"="Transparent" - "IgnoreProjector"="True" - "RenderType"="Transparent" - "PreviewType"="Plane" - "CanUseSpriteAtlas"="True" - } - - Cull Off - Lighting Off - ZWrite Off - Blend One OneMinusSrcAlpha - - /*ase_pass*/ - Pass - { - CGPROGRAM - #pragma vertex vert - #pragma fragment frag - #pragma target 3.0 - #pragma multi_compile _ PIXELSNAP_ON - #pragma multi_compile _ ETC1_EXTERNAL_ALPHA - #include "UnityCG.cginc" - /*ase_pragma*/ - - struct appdata_t - { - float4 vertex : POSITION; - float4 color : COLOR; - float2 texcoord : TEXCOORD0; - UNITY_VERTEX_INPUT_INSTANCE_ID - /*ase_vdata:p=p;uv0=tc0.xy;c=c*/ - }; - - struct v2f - { - float4 vertex : SV_POSITION; - fixed4 color : COLOR; - float2 texcoord : TEXCOORD0; - UNITY_VERTEX_INPUT_INSTANCE_ID - UNITY_VERTEX_OUTPUT_STEREO - /*ase_interp(1,):sp=sp.xyzw;uv0=tc0.xy;c=c*/ - }; - - uniform fixed4 _Color; - uniform float _EnableExternalAlpha; - uniform sampler2D _MainTex; - uniform sampler2D _AlphaTex; - /*ase_globals*/ - - v2f vert( appdata_t IN /*ase_vert_input*/ ) - { - v2f OUT; - UNITY_SETUP_INSTANCE_ID(IN); - UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(OUT); - UNITY_TRANSFER_INSTANCE_ID(IN, OUT); - /*ase_vert_code:IN=appdata_t;OUT=v2f*/ - - IN.vertex.xyz += /*ase_vert_out:Offset;Float3*/ float3(0,0,0) /*end*/; - OUT.vertex = UnityObjectToClipPos(IN.vertex); - OUT.texcoord = IN.texcoord; - OUT.color = IN.color * _Color; - #ifdef PIXELSNAP_ON - OUT.vertex = UnityPixelSnap (OUT.vertex); - #endif - - return OUT; - } - - fixed4 SampleSpriteTexture (float2 uv) - { - fixed4 color = tex2D (_MainTex, uv); - -#if ETC1_EXTERNAL_ALPHA - // get the color from an external texture (usecase: Alpha support for ETC1 on android) - fixed4 alpha = tex2D (_AlphaTex, uv); - color.a = lerp (color.a, alpha.r, _EnableExternalAlpha); -#endif //ETC1_EXTERNAL_ALPHA - - return color; - } - - fixed4 frag(v2f IN /*ase_frag_input*/ ) : SV_Target - { - /*ase_frag_code:IN=v2f*/ - fixed4 c = /*ase_frag_out:Color;Float4*/SampleSpriteTexture (IN.texcoord) * IN.color/*end*/; - c.rgb *= c.a; - return c; - } - ENDCG - } - } - CustomEditor "ASEMaterialInspector" -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/Sprites-Default.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/Sprites-Default.shader.meta deleted file mode 100644 index 560e691d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/Sprites-Default.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 0f8ba0101102bb14ebf021ddadce9b49 -timeCreated: 1500572363 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/UIDefault.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/UIDefault.shader deleted file mode 100644 index 7fa34ee5..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/UIDefault.shader +++ /dev/null @@ -1,127 +0,0 @@ -Shader /*ase_name*/"Hidden/Templates/Legacy/UIDefault"/*end*/ -{ - Properties - { - [PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {} - _Color ("Tint", Color) = (1,1,1,1) - - _StencilComp ("Stencil Comparison", Float) = 8 - _Stencil ("Stencil ID", Float) = 0 - _StencilOp ("Stencil Operation", Float) = 0 - _StencilWriteMask ("Stencil Write Mask", Float) = 255 - _StencilReadMask ("Stencil Read Mask", Float) = 255 - - _ColorMask ("Color Mask", Float) = 15 - - [Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0 - /*ase_props*/ - } - - SubShader - { - Tags - { - "Queue"="Transparent" - "IgnoreProjector"="True" - "RenderType"="Transparent" - "PreviewType"="Plane" - "CanUseSpriteAtlas"="True" - } - - Stencil - { - Ref [_Stencil] - Comp [_StencilComp] - Pass [_StencilOp] - ReadMask [_StencilReadMask] - WriteMask [_StencilWriteMask] - } - - Cull Off - Lighting Off - ZWrite Off - ZTest [unity_GUIZTestMode] - Blend SrcAlpha OneMinusSrcAlpha - ColorMask [_ColorMask] - - /*ase_pass*/ - Pass - { - Name "Default" - CGPROGRAM - #pragma vertex vert - #pragma fragment frag - #pragma target 3.0 - - #include "UnityCG.cginc" - #include "UnityUI.cginc" - - #pragma multi_compile __ UNITY_UI_CLIP_RECT - #pragma multi_compile __ UNITY_UI_ALPHACLIP - - /*ase_pragma*/ - - struct appdata_t - { - float4 vertex : POSITION; - float4 color : COLOR; - float2 texcoord : TEXCOORD0; - UNITY_VERTEX_INPUT_INSTANCE_ID - /*ase_vdata:p=p;uv0=tc0.xy;c=c*/ - }; - - struct v2f - { - float4 vertex : SV_POSITION; - fixed4 color : COLOR; - half2 texcoord : TEXCOORD0; - float4 worldPosition : TEXCOORD1; - UNITY_VERTEX_INPUT_INSTANCE_ID - UNITY_VERTEX_OUTPUT_STEREO - /*ase_interp(2,):sp=sp.xyzw;uv0=tc0.xy;c=c;uv1=tc1.xyzw*/ - }; - - uniform fixed4 _Color; - uniform fixed4 _TextureSampleAdd; - uniform float4 _ClipRect; - uniform sampler2D _MainTex; - /*ase_globals*/ - - v2f vert( appdata_t IN /*ase_vert_input*/ ) - { - v2f OUT; - UNITY_SETUP_INSTANCE_ID( IN ); - UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(OUT); - UNITY_TRANSFER_INSTANCE_ID(IN, OUT); - OUT.worldPosition = IN.vertex; - /*ase_vert_code:IN=appdata_t;OUT=v2f*/ - - OUT.worldPosition.xyz += /*ase_vert_out:Offset;Float3*/ float3( 0, 0, 0 ) /*end*/; - OUT.vertex = UnityObjectToClipPos(OUT.worldPosition); - - OUT.texcoord = IN.texcoord; - - OUT.color = IN.color * _Color; - return OUT; - } - - fixed4 frag(v2f IN /*ase_frag_input*/ ) : SV_Target - { - /*ase_frag_code:IN=v2f*/ - half4 color = /*ase_frag_out:Color;Float4*/(tex2D(_MainTex, IN.texcoord) + _TextureSampleAdd) * IN.color/*end*/; - - #ifdef UNITY_UI_CLIP_RECT - color.a *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect); - #endif - - #ifdef UNITY_UI_ALPHACLIP - clip (color.a - 0.001); - #endif - - return color; - } - ENDCG - } - } - CustomEditor "ASEMaterialInspector" -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/UIDefault.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/UIDefault.shader.meta deleted file mode 100644 index 0d8bdf79..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/UIDefault.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 5056123faa0c79b47ab6ad7e8bf059a4 -timeCreated: 1496313583 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/Unlit.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/Unlit.shader deleted file mode 100644 index 6f6ba830..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/Unlit.shader +++ /dev/null @@ -1,103 +0,0 @@ -Shader /*ase_name*/ "Hidden/Templates/Unlit" /*end*/ -{ - Properties - { - /*ase_props*/ - } - - SubShader - { - /*ase_subshader_options:Name=Additional Options - Option:Vertex Position,InvertActionOnDeselection:Absolute,Relative:Relative - Absolute:SetDefine:ASE_ABSOLUTE_VERTEX_POS 1 - Absolute:SetPortName:1,Vertex Position - Relative:SetPortName:1,Vertex Offset - */ - - Tags { "RenderType"="Opaque" } - LOD 100 - - /*ase_all_modules*/ - - /*ase_pass*/ - Pass - { - Name "Unlit" - Tags { "LightMode" = "ForwardBase" } - CGPROGRAM - - #ifndef UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX - //only defining to not throw compilation error over Unity 5.5 - #define UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(input) - #endif - #pragma vertex vert - #pragma fragment frag - #pragma multi_compile_instancing - #include "UnityCG.cginc" - /*ase_pragma*/ - - struct appdata - { - float4 vertex : POSITION; - float4 color : COLOR; - UNITY_VERTEX_INPUT_INSTANCE_ID - /*ase_vdata:p=p;c=c*/ - }; - - struct v2f - { - float4 vertex : SV_POSITION; -#ifdef ASE_NEEDS_FRAG_WORLD_POSITION - float3 worldPos : TEXCOORD0; -#endif - UNITY_VERTEX_INPUT_INSTANCE_ID - UNITY_VERTEX_OUTPUT_STEREO - /*ase_interp(1,):sp=sp.xyzw;wp=tc0*/ - }; - - /*ase_globals*/ - - v2f vert ( appdata v /*ase_vert_input*/) - { - v2f o; - UNITY_SETUP_INSTANCE_ID(v); - UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); - UNITY_TRANSFER_INSTANCE_ID(v, o); - - /*ase_vert_code:v=appdata;o=v2f*/ - float3 vertexValue = float3(0, 0, 0); - #if ASE_ABSOLUTE_VERTEX_POS - vertexValue = v.vertex.xyz; - #endif - vertexValue = /*ase_vert_out:Vertex Offset;Float3*/vertexValue/*end*/; - #if ASE_ABSOLUTE_VERTEX_POS - v.vertex.xyz = vertexValue; - #else - v.vertex.xyz += vertexValue; - #endif - o.vertex = UnityObjectToClipPos(v.vertex); - -#ifdef ASE_NEEDS_FRAG_WORLD_POSITION - o.worldPos = mul(unity_ObjectToWorld, v.vertex).xyz; -#endif - return o; - } - - fixed4 frag (v2f i /*ase_frag_input*/) : SV_Target - { - UNITY_SETUP_INSTANCE_ID(i); - UNITY_SETUP_STEREO_EYE_INDEX_POST_VERTEX(i); - fixed4 finalColor; -#ifdef ASE_NEEDS_FRAG_WORLD_POSITION - /*ase_local_var:wp*/float3 WorldPosition = i.worldPos; -#endif - /*ase_frag_code:i=v2f*/ - - finalColor = /*ase_frag_out:Frag Color;Float4*/fixed4(1,1,1,1)/*end*/; - return finalColor; - } - ENDCG - } - } - CustomEditor "ASEMaterialInspector" -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/Unlit.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/Unlit.shader.meta deleted file mode 100644 index 0c928b0a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/Unlit.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 0770190933193b94aaa3065e307002fa -timeCreated: 1496328687 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/UnlitLightmap.shader b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/UnlitLightmap.shader deleted file mode 100644 index 562ad4e1..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/UnlitLightmap.shader +++ /dev/null @@ -1,119 +0,0 @@ -Shader /*ase_name*/ "Hidden/Templates/Legacy/UnlitLightmap" /*end*/ -{ - Properties - { - /*ase_props*/ - } - - SubShader - { - Tags { "RenderType"="Opaque" } - LOD 100 - /*ase_all_modules*/ - - Pass - { - /*ase_main_pass*/ - Tags{ "LightMode" = "VertexLMRGBM" "RenderType" = "Opaque" } - Name "Unlit LM" - CGPROGRAM - #pragma target 2.0 - #pragma vertex vert - #pragma fragment frag - #include "UnityCG.cginc" - /*ase_pragma*/ - - struct appdata - { - float4 vertex : POSITION; - UNITY_VERTEX_INPUT_INSTANCE_ID - /*ase_vdata:p=p*/ - }; - - struct v2f - { - float4 vertex : SV_POSITION; - UNITY_VERTEX_INPUT_INSTANCE_ID - UNITY_VERTEX_OUTPUT_STEREO - /*ase_interp(0,):sp=sp.xyzw*/ - }; - - /*ase_globals*/ - - v2f vert ( appdata v /*ase_vert_input*/) - { - v2f o; - UNITY_SETUP_INSTANCE_ID(v); - UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); - UNITY_TRANSFER_INSTANCE_ID(v, o); - /*ase_vert_code:v=appdata;o=v2f*/ - - v.vertex.xyz += /*ase_vert_out:Local Vertex;Float3;_Vertex*/ float3(0,0,0) /*end*/; - o.vertex = UnityObjectToClipPos(v.vertex); - return o; - } - - fixed4 frag (v2f i /*ase_frag_input*/) : SV_Target - { - fixed4 finalColor; - /*ase_frag_code:i=v2f*/ - - finalColor = /*ase_frag_out:Frag Color;Float4;_Color*/fixed4(1,1,1,1)/*end*/; - return finalColor; - } - ENDCG - } - - Pass - { - /*ase_hide_pass*/ - Tags{ "LightMode" = "VertexLM" "RenderType" = "Opaque" } - Name "Unlit LM Mobile" - CGPROGRAM - #pragma target 2.0 - #pragma vertex vert - #pragma fragment frag - #include "UnityCG.cginc" - /*ase_pragma*/ - - struct appdata - { - float4 vertex : POSITION; - UNITY_VERTEX_INPUT_INSTANCE_ID - /*ase_vdata:p=p*/ - }; - - struct v2f - { - float4 vertex : SV_POSITION; - UNITY_VERTEX_OUTPUT_STEREO - /*ase_interp(0,):sp=sp.xyzw*/ - }; - - /*ase_globals*/ - - v2f vert ( appdata v /*ase_vert_input*/) - { - v2f o; - UNITY_SETUP_INSTANCE_ID(v); - UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o); - /*ase_vert_code:v=appdata;o=v2f*/ - - v.vertex.xyz += /*ase_vert_out:Local Vertex;Float3;_Vertex*/ float3(0,0,0) /*end*/; - o.vertex = UnityObjectToClipPos(v.vertex); - return o; - } - - fixed4 frag (v2f i /*ase_frag_input*/) : SV_Target - { - fixed4 finalColor; - /*ase_frag_code:i=v2f*/ - - finalColor = /*ase_frag_out:Frag Color;Float4;_Color*/fixed4(1,1,1,1)/*end*/; - return finalColor; - } - ENDCG - } - } - CustomEditor "ASEMaterialInspector" -} diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/UnlitLightmap.shader.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/UnlitLightmap.shader.meta deleted file mode 100644 index 38c7e305..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/Legacy/UnlitLightmap.shader.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 899e609c083c74c4ca567477c39edef0 -timeCreated: 1528987785 -licenseType: Store -ShaderImporter: - defaultTextures: [] - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/PPStackTemplates.unitypackage b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/PPStackTemplates.unitypackage Binary files differdeleted file mode 100644 index 9f38ece8..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/PPStackTemplates.unitypackage +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/PPStackTemplates.unitypackage.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/PPStackTemplates.unitypackage.meta deleted file mode 100644 index d2aa6b0f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/PPStackTemplates.unitypackage.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: f86c907c9d9e85846835ba31e656bd60 -timeCreated: 1550245105 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/SRP (Legacy).meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/SRP (Legacy).meta deleted file mode 100644 index 1d7537c6..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/SRP (Legacy).meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: cc9e432e1a0a4764f80870c080173cb7 -folderAsset: yes -timeCreated: 1520621311 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/SRP (Legacy)/HDSRPTemplates 3xx (Legacy).unitypackage b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/SRP (Legacy)/HDSRPTemplates 3xx (Legacy).unitypackage Binary files differdeleted file mode 100644 index bf432af5..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/SRP (Legacy)/HDSRPTemplates 3xx (Legacy).unitypackage +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/SRP (Legacy)/HDSRPTemplates 3xx (Legacy).unitypackage.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/SRP (Legacy)/HDSRPTemplates 3xx (Legacy).unitypackage.meta deleted file mode 100644 index 36f907ad..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/SRP (Legacy)/HDSRPTemplates 3xx (Legacy).unitypackage.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 4dc1afbcc68875c4780502f5e6b80158 -timeCreated: 1540292246 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant:
\ No newline at end of file diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/SRP (Legacy)/HDSRPTemplates 4xx (Legacy).unitypackage b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/SRP (Legacy)/HDSRPTemplates 4xx (Legacy).unitypackage Binary files differdeleted file mode 100644 index 5e8f93ce..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/SRP (Legacy)/HDSRPTemplates 4xx (Legacy).unitypackage +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/SRP (Legacy)/HDSRPTemplates 4xx (Legacy).unitypackage.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/SRP (Legacy)/HDSRPTemplates 4xx (Legacy).unitypackage.meta deleted file mode 100644 index 723e586d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/SRP (Legacy)/HDSRPTemplates 4xx (Legacy).unitypackage.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 5d615bf612f33364e96fb9fd2959ae9c -timeCreated: 1555497476 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/SRP (Legacy)/HDSRPTemplates 572 (Legacy).unitypackage b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/SRP (Legacy)/HDSRPTemplates 572 (Legacy).unitypackage Binary files differdeleted file mode 100644 index 4e4e509f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/SRP (Legacy)/HDSRPTemplates 572 (Legacy).unitypackage +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/SRP (Legacy)/HDSRPTemplates 572 (Legacy).unitypackage.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/SRP (Legacy)/HDSRPTemplates 572 (Legacy).unitypackage.meta deleted file mode 100644 index e1e2fdf1..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/SRP (Legacy)/HDSRPTemplates 572 (Legacy).unitypackage.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: f51b7b861facbc3429fcc5f1f6f91183 -timeCreated: 1557327368 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/SRP (Legacy)/HDSRPTemplates 5xx (Legacy).unitypackage b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/SRP (Legacy)/HDSRPTemplates 5xx (Legacy).unitypackage Binary files differdeleted file mode 100644 index 9aee1ad5..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/SRP (Legacy)/HDSRPTemplates 5xx (Legacy).unitypackage +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/SRP (Legacy)/HDSRPTemplates 5xx (Legacy).unitypackage.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/SRP (Legacy)/HDSRPTemplates 5xx (Legacy).unitypackage.meta deleted file mode 100644 index 70832901..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/SRP (Legacy)/HDSRPTemplates 5xx (Legacy).unitypackage.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: 2d7fe4f7c19e90f41b893bc01fc17230 -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/SRP (Legacy)/HDSRPTemplates 6xx (Legacy).unitypackage b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/SRP (Legacy)/HDSRPTemplates 6xx (Legacy).unitypackage Binary files differdeleted file mode 100644 index 484784d4..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/SRP (Legacy)/HDSRPTemplates 6xx (Legacy).unitypackage +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/SRP (Legacy)/HDSRPTemplates 6xx (Legacy).unitypackage.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/SRP (Legacy)/HDSRPTemplates 6xx (Legacy).unitypackage.meta deleted file mode 100644 index 152e7efa..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/SRP (Legacy)/HDSRPTemplates 6xx (Legacy).unitypackage.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: e137dba02f4d0f542ab09dcedea27314 -timeCreated: 1583243128 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/SRP (Legacy)/LWSRPTemplates 3xx (Legacy).unitypackage b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/SRP (Legacy)/LWSRPTemplates 3xx (Legacy).unitypackage Binary files differdeleted file mode 100644 index 8ec17ecd..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/SRP (Legacy)/LWSRPTemplates 3xx (Legacy).unitypackage +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/SRP (Legacy)/LWSRPTemplates 3xx (Legacy).unitypackage.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/SRP (Legacy)/LWSRPTemplates 3xx (Legacy).unitypackage.meta deleted file mode 100644 index e46ecb35..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/SRP (Legacy)/LWSRPTemplates 3xx (Legacy).unitypackage.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: b53d2f3b156ff104f90d4d7693d769c8 -timeCreated: 1540215707 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/SRP (Legacy)/LWSRPTemplates 4xx (Legacy).unitypackage b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/SRP (Legacy)/LWSRPTemplates 4xx (Legacy).unitypackage Binary files differdeleted file mode 100644 index 1db1be92..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/SRP (Legacy)/LWSRPTemplates 4xx (Legacy).unitypackage +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/SRP (Legacy)/LWSRPTemplates 4xx (Legacy).unitypackage.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/SRP (Legacy)/LWSRPTemplates 4xx (Legacy).unitypackage.meta deleted file mode 100644 index 5dc90742..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/SRP (Legacy)/LWSRPTemplates 4xx (Legacy).unitypackage.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 3e8eabcfae1e5aa4397de89fedeb48db -timeCreated: 1555497476 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/SRP (Legacy)/README.txt b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/SRP (Legacy)/README.txt deleted file mode 100644 index e2c4956c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/SRP (Legacy)/README.txt +++ /dev/null @@ -1,36 +0,0 @@ -Both High Definition and Lightweight rendering pipelines are in development and in a preview state, so Amplify Shader Editor may have some nodes that are not fully updated for them. -At the moment there are, for each SRP, two separate packages inside Amplify Shader Editor. They contemplate two major SRP versions that exist at the moment. -For Unity 2018.2 and below, users can only install v3.x.x for both HD and LW rendering pipelines and as such they will need to unpack the unity packages containing the 3xx (Legacy) tag. -For Unity 2018.3, users can only install v4.x.x for both HD and LW rendering pipelines and as such they will need to unpack the unity packages containing the 4xx (Legacy) tag. -For Unity 2019.1 and above, users can only install v5.x.x for both HD and LW rendering pipelines and as such they will need to unpack the unity packages NOT containing the (Legacy) tag. - -Unity 2018.2.x, HD and LW v3.x.x: -* HDSRPTemplates 3xx (Legacy).unitypackage - * HD PBR - * HD Unlit - -* LWSRPTemplates 3xx (Legacy).unitypackage - * Lightweight PBR - * Lightweight Unlit - -Unity 2018.3.x, HD and LW v4.x.x: -* HDSRPTemplates 4xx (Legacy).unitypackage - * HD Lit - * HD PBR - * HD Unlit - -* LWSRPTemplates 4xx (Legacy).unitypackage - * Lightweight PBR - * Lightweight Unlit - -Unity 2019.1.x, HD and LW v5.x.x: -* HDSRPTemplates.unitypackage - * HD Lit - * HD PBR - * HD Unlit - -* LWSRPTemplates.unitypackage - * Lightweight PBR - * Lightweight Unlit - -Upon unpacking, the templates they may not be instantly available at the ( Create > Amplify Shader > ... ) menu over you project view, but a user can create p.e. a new Amplify Surface Shader, go to its Shader Type menu over the left Node Properties window and select its newly installed template.
\ No newline at end of file diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/SRP (Legacy)/README.txt.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/SRP (Legacy)/README.txt.meta deleted file mode 100644 index 0357e65a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/SRP (Legacy)/README.txt.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 2700348f89ce70c45a61d215e6999fee -timeCreated: 1541774040 -licenseType: Store -TextScriptImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/USRPTemplates.unitypackage b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/USRPTemplates.unitypackage Binary files differdeleted file mode 100644 index 51088c72..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/USRPTemplates.unitypackage +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/USRPTemplates.unitypackage.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/USRPTemplates.unitypackage.meta deleted file mode 100644 index cc3f5dd0..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Templates/USRPTemplates.unitypackage.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 57fcea0ed8b5eb347923c4c21fa31b57 -timeCreated: 1569420442 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures.meta deleted file mode 100644 index f2b28c6b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: c7eb84ba37e424945bd8c7221dc5b55a -folderAsset: yes -timeCreated: 1481126944 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/About.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/About.png Binary files differdeleted file mode 100644 index 55b5017b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/About.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/About.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/About.png.meta deleted file mode 100644 index 1caa32d3..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/About.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: 8aba6bb20faf8824d9d81946542f1ce1 -timeCreated: 1481127003 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: -1 - aniso: 1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/Icon64.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/Icon64.png Binary files differdeleted file mode 100644 index d8f46d38..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/Icon64.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/Icon64.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/Icon64.png.meta deleted file mode 100644 index 0ca0e8c6..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/Icon64.png.meta +++ /dev/null @@ -1,82 +0,0 @@ -fileFormatVersion: 2 -guid: 2c6536772776dd84f872779990273bfc -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: 1 - maxTextureSize: 2048 - textureSettings: - filterMode: -1 - aniso: -1 - mipBias: -100 - wrapMode: -1 - nPOTScale: 1 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 64 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 64 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: WebGL - maxTextureSize: 64 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/black.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/black.png Binary files differdeleted file mode 100644 index bc9d9b91..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/black.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/black.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/black.png.meta deleted file mode 100644 index 47736ae0..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/black.png.meta +++ /dev/null @@ -1,59 +0,0 @@ -fileFormatVersion: 2 -guid: 7a170cdb7cc88024cb628cfcdbb6705c -timeCreated: 1481126998 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 2 - mipmaps: - mipMapMode: 0 - enableMipMap: 1 - linearTexture: 0 - correctGamma: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 0 - cubemapConvolution: 0 - cubemapConvolutionSteps: 7 - cubemapConvolutionExponent: 1.5 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: -1 - aniso: -1 - mipBias: -1 - wrapMode: -1 - nPOTScale: 1 - lightmap: 0 - rGBM: 0 - compressionQuality: 50 - allowsAlphaSplitting: 0 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: -1 - buildTargetSettings: [] - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/blue.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/blue.png Binary files differdeleted file mode 100644 index 3d77530c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/blue.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/blue.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/blue.png.meta deleted file mode 100644 index bf20fa3d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/blue.png.meta +++ /dev/null @@ -1,59 +0,0 @@ -fileFormatVersion: 2 -guid: 826f80ee0ad07444c8558af826a4df2e -timeCreated: 1481127000 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 2 - mipmaps: - mipMapMode: 0 - enableMipMap: 1 - linearTexture: 0 - correctGamma: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 0 - cubemapConvolution: 0 - cubemapConvolutionSteps: 7 - cubemapConvolutionExponent: 1.5 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: -1 - aniso: -1 - mipBias: -1 - wrapMode: -1 - nPOTScale: 1 - lightmap: 0 - rGBM: 0 - compressionQuality: 50 - allowsAlphaSplitting: 0 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: -1 - buildTargetSettings: [] - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/flat.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/flat.png Binary files differdeleted file mode 100644 index ce71188c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/flat.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/flat.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/flat.png.meta deleted file mode 100644 index 723b4604..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/flat.png.meta +++ /dev/null @@ -1,59 +0,0 @@ -fileFormatVersion: 2 -guid: 194a51ad3c0179644abea3f196c5ebe6 -timeCreated: 1481126977 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 2 - mipmaps: - mipMapMode: 0 - enableMipMap: 1 - linearTexture: 0 - correctGamma: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 0 - cubemapConvolution: 0 - cubemapConvolutionSteps: 7 - cubemapConvolutionExponent: 1.5 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: -1 - aniso: -1 - mipBias: -1 - wrapMode: -1 - nPOTScale: 1 - lightmap: 0 - rGBM: 0 - compressionQuality: 50 - allowsAlphaSplitting: 0 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: -1 - buildTargetSettings: [] - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/green.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/green.png Binary files differdeleted file mode 100644 index 2128cfbf..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/green.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/green.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/green.png.meta deleted file mode 100644 index be190367..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/green.png.meta +++ /dev/null @@ -1,59 +0,0 @@ -fileFormatVersion: 2 -guid: 352167e52fa3b0c43ac690f5e2debc2b -timeCreated: 1481126984 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 2 - mipmaps: - mipMapMode: 0 - enableMipMap: 1 - linearTexture: 0 - correctGamma: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 0 - cubemapConvolution: 0 - cubemapConvolutionSteps: 7 - cubemapConvolutionExponent: 1.5 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: -1 - aniso: -1 - mipBias: -1 - wrapMode: -1 - nPOTScale: 1 - lightmap: 0 - rGBM: 0 - compressionQuality: 50 - allowsAlphaSplitting: 0 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: -1 - buildTargetSettings: [] - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/grey.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/grey.png Binary files differdeleted file mode 100644 index 4c317fd3..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/grey.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/grey.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/grey.png.meta deleted file mode 100644 index 43efb49a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/grey.png.meta +++ /dev/null @@ -1,59 +0,0 @@ -fileFormatVersion: 2 -guid: 31d5a2d79390ab542a81a6699a999758 -timeCreated: 1481126984 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 2 - mipmaps: - mipMapMode: 0 - enableMipMap: 1 - linearTexture: 0 - correctGamma: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 0 - cubemapConvolution: 0 - cubemapConvolutionSteps: 7 - cubemapConvolutionExponent: 1.5 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: -1 - aniso: -1 - mipBias: -1 - wrapMode: -1 - nPOTScale: 1 - lightmap: 0 - rGBM: 0 - compressionQuality: 50 - allowsAlphaSplitting: 0 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: -1 - buildTargetSettings: [] - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/red.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/red.png Binary files differdeleted file mode 100644 index 47fd9a48..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/red.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/red.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/red.png.meta deleted file mode 100644 index d3d0d164..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/red.png.meta +++ /dev/null @@ -1,59 +0,0 @@ -fileFormatVersion: 2 -guid: af5ab63a69b074347be0e4c17fb9dc1b -timeCreated: 1481127009 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 2 - mipmaps: - mipMapMode: 0 - enableMipMap: 1 - linearTexture: 0 - correctGamma: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 0 - cubemapConvolution: 0 - cubemapConvolutionSteps: 7 - cubemapConvolutionExponent: 1.5 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: -1 - aniso: -1 - mipBias: -1 - wrapMode: -1 - nPOTScale: 1 - lightmap: 0 - rGBM: 0 - compressionQuality: 50 - allowsAlphaSplitting: 0 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: -1 - buildTargetSettings: [] - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/white.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/white.png Binary files differdeleted file mode 100644 index 393b83bf..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/white.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/white.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/white.png.meta deleted file mode 100644 index d361ab0e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/Textures/white.png.meta +++ /dev/null @@ -1,59 +0,0 @@ -fileFormatVersion: 2 -guid: 37e6f91f3efb0954cbdce254638862ea -timeCreated: 1481126984 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 2 - mipmaps: - mipMapMode: 0 - enableMipMap: 1 - linearTexture: 0 - correctGamma: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 0 - cubemapConvolution: 0 - cubemapConvolutionSteps: 7 - cubemapConvolutionExponent: 1.5 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: -1 - aniso: -1 - mipBias: -1 - wrapMode: -1 - nPOTScale: 1 - lightmap: 0 - rGBM: 0 - compressionQuality: 50 - allowsAlphaSplitting: 0 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: -1 - buildTargetSettings: [] - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI.meta deleted file mode 100644 index a5bdca46..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: b4971ff9c9d7bfd488d84e355318f683 -folderAsset: yes -timeCreated: 1481126944 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons.meta deleted file mode 100644 index 2652961c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: f0f8f4a0c1ef2d14d975ace997712605 -folderAsset: yes -timeCreated: 1481126946 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/AddToList.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/AddToList.png Binary files differdeleted file mode 100644 index 996a7146..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/AddToList.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/AddToList.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/AddToList.png.meta deleted file mode 100644 index 35967810..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/AddToList.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: cccc116a6334dc1428687697c5a11d58 -timeCreated: 1481127016 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 0 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Checkmark.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Checkmark.png Binary files differdeleted file mode 100644 index fa6b9dcf..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Checkmark.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Checkmark.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Checkmark.png.meta deleted file mode 100644 index 8c8f28fb..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Checkmark.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: e9c4642eaa083a54ab91406d8449e6ac -timeCreated: 1506956323 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 1 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: -1 - aniso: 1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: 5 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 1 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CircularToggle_OFF_Dark.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CircularToggle_OFF_Dark.png Binary files differdeleted file mode 100644 index af81db4e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CircularToggle_OFF_Dark.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CircularToggle_OFF_Dark.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CircularToggle_OFF_Dark.png.meta deleted file mode 100644 index 10bde391..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CircularToggle_OFF_Dark.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: 1aaca50d084b0bb43854f075ce2f302b -timeCreated: 1526466929 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: 1 - maxTextureSize: 2048 - textureSettings: - filterMode: -1 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CircularToggle_ON_Dark.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CircularToggle_ON_Dark.png Binary files differdeleted file mode 100644 index da7b0662..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CircularToggle_ON_Dark.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CircularToggle_ON_Dark.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CircularToggle_ON_Dark.png.meta deleted file mode 100644 index 17e618a7..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CircularToggle_ON_Dark.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: ac0860a6a77e29d4091ba790a17daa0f -timeCreated: 1526466092 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: 1 - maxTextureSize: 2048 - textureSettings: - filterMode: -1 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupOFF.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupOFF.png Binary files differdeleted file mode 100644 index 18a8f62d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupOFF.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupOFF.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupOFF.png.meta deleted file mode 100644 index 6dc17c9d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupOFF.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: f62c0c3a5ddcd844e905fb2632fdcb15 -timeCreated: 1481127028 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 1 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupOFFNew.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupOFFNew.png Binary files differdeleted file mode 100644 index f3d4d94d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupOFFNew.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupOFFNew.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupOFFNew.png.meta deleted file mode 100644 index 9a6ba5e5..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupOFFNew.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: df0f2e2030492c14d9237317aef419cd -timeCreated: 1481127018 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 0 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupON.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupON.png Binary files differdeleted file mode 100644 index b5f6667d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupON.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupON.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupON.png.meta deleted file mode 100644 index 616afa0c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupON.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: 615d853995cf2344d8641fd19cb09b5d -timeCreated: 1481126993 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 1 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupONNew.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupONNew.png Binary files differdeleted file mode 100644 index 53ae18c8..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupONNew.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupONNew.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupONNew.png.meta deleted file mode 100644 index 6d1f63fb..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CleanupONNew.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: e86ba70d2363b9443beac28a6a370b87 -timeCreated: 1481127021 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 0 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpAddIconActive.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpAddIconActive.png Binary files differdeleted file mode 100644 index ce67536d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpAddIconActive.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpAddIconActive.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpAddIconActive.png.meta deleted file mode 100644 index 554a30f5..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpAddIconActive.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: 52bbe770f45f531419e44a69be67ccba -timeCreated: 1498144034 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 0 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpAddIconNormal.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpAddIconNormal.png Binary files differdeleted file mode 100644 index 256c479f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpAddIconNormal.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpAddIconNormal.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpAddIconNormal.png.meta deleted file mode 100644 index 9aa4918a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpAddIconNormal.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: 7eb057fdbf020504fb6c9c3c78031e5e -timeCreated: 1498144034 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 0 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpRemoveIconActive.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpRemoveIconActive.png Binary files differdeleted file mode 100644 index 7a45197d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpRemoveIconActive.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpRemoveIconActive.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpRemoveIconActive.png.meta deleted file mode 100644 index 3034b681..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpRemoveIconActive.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: 1ba096552f9cbbb418ee2286856bb352 -timeCreated: 1498144034 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 0 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpRemoveIconNormal.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpRemoveIconNormal.png Binary files differdeleted file mode 100644 index 03274002..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpRemoveIconNormal.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpRemoveIconNormal.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpRemoveIconNormal.png.meta deleted file mode 100644 index ca972800..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/CustomExpRemoveIconNormal.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: 839cb1530f95ad14ab58762161a9cb06 -timeCreated: 1498144034 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 0 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/FitView.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/FitView.png Binary files differdeleted file mode 100644 index b3b1dd91..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/FitView.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/FitView.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/FitView.png.meta deleted file mode 100644 index 924177ee..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/FitView.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: 1def740f2314c6b4691529cadeee2e9c -timeCreated: 1481126978 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 1 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/FocusNode.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/FocusNode.png Binary files differdeleted file mode 100644 index ae4dd158..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/FocusNode.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/FocusNode.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/FocusNode.png.meta deleted file mode 100644 index 78dc8da3..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/FocusNode.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: da673e6179c67d346abb220a6935e359 -timeCreated: 1481127018 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 1 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Help.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Help.png Binary files differdeleted file mode 100644 index 6c55f1ad..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Help.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Help.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Help.png.meta deleted file mode 100644 index dfb1fdeb..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Help.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: 066674048bbb1e64e8cdcc6c3b4abbeb -timeCreated: 1481126971 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 0 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Help2.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Help2.png Binary files differdeleted file mode 100644 index 46b80b3f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Help2.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Help2.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Help2.png.meta deleted file mode 100644 index e499d502..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Help2.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: 77af20044e9766840a6be568806dc22e -timeCreated: 1488470300 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 1 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ItemCleanupOFF.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ItemCleanupOFF.png Binary files differdeleted file mode 100644 index 3bf7e28d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ItemCleanupOFF.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ItemCleanupOFF.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ItemCleanupOFF.png.meta deleted file mode 100644 index 8923ad77..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ItemCleanupOFF.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: 8b6b4ff52c49a2a43a602895465e107c -timeCreated: 1481127003 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 0 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ItemCleanupON.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ItemCleanupON.png Binary files differdeleted file mode 100644 index 2c5ee35f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ItemCleanupON.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ItemCleanupON.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ItemCleanupON.png.meta deleted file mode 100644 index 67db3ecc..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ItemCleanupON.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: f4d31aa109c919d4595094f627510932 -timeCreated: 1481127025 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 0 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Library.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Library.png Binary files differdeleted file mode 100644 index 465a0088..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Library.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Library.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Library.png.meta deleted file mode 100644 index 7df33cbe..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Library.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: 9a81d7df8e62c044a9d1cada0c8a2131 -timeCreated: 1481127004 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 0 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/LiveOFF.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/LiveOFF.png Binary files differdeleted file mode 100644 index 52c92d4b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/LiveOFF.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/LiveOFF.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/LiveOFF.png.meta deleted file mode 100644 index b29c03ea..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/LiveOFF.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: bb16faf366bcc6c4fbf0d7666b105354 -timeCreated: 1481127011 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 1 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/LiveON.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/LiveON.png Binary files differdeleted file mode 100644 index d792d288..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/LiveON.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/LiveON.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/LiveON.png.meta deleted file mode 100644 index 57c55032..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/LiveON.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: 6a0ae1d7892333142aeb09585572202c -timeCreated: 1481126996 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 1 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/LivePending.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/LivePending.png Binary files differdeleted file mode 100644 index 524e87a7..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/LivePending.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/LivePending.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/LivePending.png.meta deleted file mode 100644 index b146db2b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/LivePending.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: e3182200efb67114eb5050f8955e1746 -timeCreated: 1481127019 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 1 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MaximizeWindow.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MaximizeWindow.png Binary files differdeleted file mode 100644 index 27d01c54..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MaximizeWindow.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MaximizeWindow.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MaximizeWindow.png.meta deleted file mode 100644 index 2d1168d6..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MaximizeWindow.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: 7a1fd3f5fef75b64385591e1890d1842 -timeCreated: 1481126998 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 0 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOff.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOff.png Binary files differdeleted file mode 100644 index 78d327e1..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOff.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOff.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOff.png.meta deleted file mode 100644 index 2c2774b6..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOff.png.meta +++ /dev/null @@ -1,63 +0,0 @@ -fileFormatVersion: 2 -guid: 9f2d5e61dd9821b44a410f36519781d7 -timeCreated: 1489663385 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 2 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - linearTexture: 1 - correctGamma: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 0 - cubemapConvolution: 0 - cubemapConvolutionSteps: 7 - cubemapConvolutionExponent: 1.5 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: -1 - aniso: 1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - rGBM: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - buildTargetSettings: - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -3 - compressionQuality: 50 - allowsAlphaSplitting: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOffHover.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOffHover.png Binary files differdeleted file mode 100644 index bc019a8c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOffHover.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOffHover.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOffHover.png.meta deleted file mode 100644 index 473f5258..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOffHover.png.meta +++ /dev/null @@ -1,63 +0,0 @@ -fileFormatVersion: 2 -guid: 6f3901bfd2342774ba74e117e43d6db7 -timeCreated: 1489663938 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 2 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - linearTexture: 1 - correctGamma: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 0 - cubemapConvolution: 0 - cubemapConvolutionSteps: 7 - cubemapConvolutionExponent: 1.5 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: -1 - aniso: 1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - rGBM: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - buildTargetSettings: - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -3 - compressionQuality: 50 - allowsAlphaSplitting: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOn.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOn.png Binary files differdeleted file mode 100644 index 4aec22d4..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOn.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOn.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOn.png.meta deleted file mode 100644 index a3bc748a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOn.png.meta +++ /dev/null @@ -1,63 +0,0 @@ -fileFormatVersion: 2 -guid: 4c872bb553406fe44a9d0046a0ef9bc5 -timeCreated: 1489662998 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 2 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - linearTexture: 1 - correctGamma: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 0 - cubemapConvolution: 0 - cubemapConvolutionSteps: 7 - cubemapConvolutionExponent: 1.5 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: -1 - aniso: 1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - rGBM: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - buildTargetSettings: - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -3 - compressionQuality: 50 - allowsAlphaSplitting: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOnHover.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOnHover.png Binary files differdeleted file mode 100644 index af773f42..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOnHover.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOnHover.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOnHover.png.meta deleted file mode 100644 index c12a3d35..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotLeftOnHover.png.meta +++ /dev/null @@ -1,63 +0,0 @@ -fileFormatVersion: 2 -guid: 7ef06ce40d713d34790e78278ee82dea -timeCreated: 1489663938 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 2 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - linearTexture: 1 - correctGamma: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 0 - cubemapConvolution: 0 - cubemapConvolutionSteps: 7 - cubemapConvolutionExponent: 1.5 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: -1 - aniso: 1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - rGBM: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - buildTargetSettings: - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -3 - compressionQuality: 50 - allowsAlphaSplitting: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOff.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOff.png Binary files differdeleted file mode 100644 index 94c1cadc..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOff.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOff.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOff.png.meta deleted file mode 100644 index a010f2f0..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOff.png.meta +++ /dev/null @@ -1,63 +0,0 @@ -fileFormatVersion: 2 -guid: eaf512a569994074b9b268ff098b0f03 -timeCreated: 1489663385 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 2 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - linearTexture: 1 - correctGamma: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 0 - cubemapConvolution: 0 - cubemapConvolutionSteps: 7 - cubemapConvolutionExponent: 1.5 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: -1 - aniso: 1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - rGBM: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - buildTargetSettings: - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -3 - compressionQuality: 50 - allowsAlphaSplitting: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOffHover.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOffHover.png Binary files differdeleted file mode 100644 index 2b1e15c3..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOffHover.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOffHover.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOffHover.png.meta deleted file mode 100644 index 77daf752..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOffHover.png.meta +++ /dev/null @@ -1,63 +0,0 @@ -fileFormatVersion: 2 -guid: c86cb249299fb7249b5ee7fb27ef1951 -timeCreated: 1489663938 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 2 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - linearTexture: 1 - correctGamma: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 0 - cubemapConvolution: 0 - cubemapConvolutionSteps: 7 - cubemapConvolutionExponent: 1.5 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: -1 - aniso: 1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - rGBM: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - buildTargetSettings: - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -3 - compressionQuality: 50 - allowsAlphaSplitting: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOn.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOn.png Binary files differdeleted file mode 100644 index 08a870bc..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOn.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOn.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOn.png.meta deleted file mode 100644 index b4400606..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOn.png.meta +++ /dev/null @@ -1,63 +0,0 @@ -fileFormatVersion: 2 -guid: 133e79bed45185d408f4c5410f89dded -timeCreated: 1489662998 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 2 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - linearTexture: 1 - correctGamma: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 0 - cubemapConvolution: 0 - cubemapConvolutionSteps: 7 - cubemapConvolutionExponent: 1.5 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: -1 - aniso: 1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - rGBM: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - buildTargetSettings: - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -3 - compressionQuality: 50 - allowsAlphaSplitting: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOnHover.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOnHover.png Binary files differdeleted file mode 100644 index 315747b4..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOnHover.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOnHover.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOnHover.png.meta deleted file mode 100644 index 8ec7c944..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotMidOnHover.png.meta +++ /dev/null @@ -1,63 +0,0 @@ -fileFormatVersion: 2 -guid: 542d7546736ddd244a145ef7103678fb -timeCreated: 1489663938 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 2 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - linearTexture: 1 - correctGamma: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 0 - cubemapConvolution: 0 - cubemapConvolutionSteps: 7 - cubemapConvolutionExponent: 1.5 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: -1 - aniso: 1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - rGBM: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - buildTargetSettings: - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -3 - compressionQuality: 50 - allowsAlphaSplitting: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOff.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOff.png Binary files differdeleted file mode 100644 index 1517b42c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOff.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOff.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOff.png.meta deleted file mode 100644 index 7a358ff1..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOff.png.meta +++ /dev/null @@ -1,63 +0,0 @@ -fileFormatVersion: 2 -guid: bfcecef29876cc54db85363cf2feebb2 -timeCreated: 1489663385 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 2 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - linearTexture: 1 - correctGamma: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 0 - cubemapConvolution: 0 - cubemapConvolutionSteps: 7 - cubemapConvolutionExponent: 1.5 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: -1 - aniso: 1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - rGBM: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - buildTargetSettings: - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -3 - compressionQuality: 50 - allowsAlphaSplitting: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOffHover.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOffHover.png Binary files differdeleted file mode 100644 index 9f7e57c3..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOffHover.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOffHover.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOffHover.png.meta deleted file mode 100644 index 4e68ae39..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOffHover.png.meta +++ /dev/null @@ -1,63 +0,0 @@ -fileFormatVersion: 2 -guid: df6fb8448a382c743bd124cc0da55113 -timeCreated: 1489663604 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 2 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - linearTexture: 1 - correctGamma: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 0 - cubemapConvolution: 0 - cubemapConvolutionSteps: 7 - cubemapConvolutionExponent: 1.5 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: -1 - aniso: 1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - rGBM: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - buildTargetSettings: - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -3 - compressionQuality: 50 - allowsAlphaSplitting: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOn.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOn.png Binary files differdeleted file mode 100644 index 265ae072..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOn.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOn.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOn.png.meta deleted file mode 100644 index bcdde129..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOn.png.meta +++ /dev/null @@ -1,63 +0,0 @@ -fileFormatVersion: 2 -guid: 3821e905373e9fb4aac56ad254ba5769 -timeCreated: 1489662832 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 2 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - linearTexture: 1 - correctGamma: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 0 - cubemapConvolution: 0 - cubemapConvolutionSteps: 7 - cubemapConvolutionExponent: 1.5 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: -1 - aniso: 1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - rGBM: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - buildTargetSettings: - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -3 - compressionQuality: 50 - allowsAlphaSplitting: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOnHover.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOnHover.png Binary files differdeleted file mode 100644 index e6368471..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOnHover.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOnHover.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOnHover.png.meta deleted file mode 100644 index 9044f162..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MiniBotRightOnHover.png.meta +++ /dev/null @@ -1,63 +0,0 @@ -fileFormatVersion: 2 -guid: d3098ebd60a35494e9977bd96b923298 -timeCreated: 1489663938 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 2 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - linearTexture: 1 - correctGamma: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 0 - cubemapConvolution: 0 - cubemapConvolutionSteps: 7 - cubemapConvolutionExponent: 1.5 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: -1 - aniso: 1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - rGBM: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - buildTargetSettings: - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -3 - compressionQuality: 50 - allowsAlphaSplitting: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MinimizeWindow.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MinimizeWindow.png Binary files differdeleted file mode 100644 index bbb09217..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MinimizeWindow.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MinimizeWindow.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MinimizeWindow.png.meta deleted file mode 100644 index 20aa6ede..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/MinimizeWindow.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: 2aae9a02747d74d46bf98a15ac5c9b21 -timeCreated: 1481126984 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 0 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/New.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/New.png Binary files differdeleted file mode 100644 index 8dc9857a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/New.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/New.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/New.png.meta deleted file mode 100644 index 4dd27096..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/New.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: 1bd93c39ca74ac041b79ae289e9b9f08 -timeCreated: 1481126977 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 0 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Open.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Open.png Binary files differdeleted file mode 100644 index 0d1ba829..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Open.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Open.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Open.png.meta deleted file mode 100644 index e7503e36..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Open.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: d8b538796c7980843b59d62dbcdebef5 -timeCreated: 1481127018 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 0 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/OpenListedShader.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/OpenListedShader.png Binary files differdeleted file mode 100644 index 19b5b31f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/OpenListedShader.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/OpenListedShader.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/OpenListedShader.png.meta deleted file mode 100644 index ff29cce9..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/OpenListedShader.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: a66917730dccde947a01140dc04b9e59 -timeCreated: 1481127005 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 0 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/OpenSourceCodeOFF.PNG b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/OpenSourceCodeOFF.PNG Binary files differdeleted file mode 100644 index f93eae3f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/OpenSourceCodeOFF.PNG +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/OpenSourceCodeOFF.PNG.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/OpenSourceCodeOFF.PNG.meta deleted file mode 100644 index 5258ce31..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/OpenSourceCodeOFF.PNG.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: f7e8834b42791124095a8b7f2d4daac2 -timeCreated: 1481127028 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 1 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/OpenSourceCodeON.PNG b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/OpenSourceCodeON.PNG Binary files differdeleted file mode 100644 index 21394dbf..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/OpenSourceCodeON.PNG +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/OpenSourceCodeON.PNG.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/OpenSourceCodeON.PNG.meta deleted file mode 100644 index 338ef2da..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/OpenSourceCodeON.PNG.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: 8b114792ff84f6546880c031eda42bc0 -timeCreated: 1481127003 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 1 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Options.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Options.png Binary files differdeleted file mode 100644 index 9295dcb4..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Options.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Options.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Options.png.meta deleted file mode 100644 index 6b30fb15..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/Options.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: 36aa64354f0ba4844af761a937eea4df -timeCreated: 1481126984 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 0 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/RemoveFromList.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/RemoveFromList.png Binary files differdeleted file mode 100644 index 8d9c0bd7..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/RemoveFromList.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/RemoveFromList.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/RemoveFromList.png.meta deleted file mode 100644 index 6aff920d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/RemoveFromList.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: 75f68506ba820564ea85b2620d78c097 -timeCreated: 1481126998 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 0 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ResetInspectorIcon.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ResetInspectorIcon.png Binary files differdeleted file mode 100644 index 89cb506c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ResetInspectorIcon.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ResetInspectorIcon.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ResetInspectorIcon.png.meta deleted file mode 100644 index 2c9ee1c5..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ResetInspectorIcon.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: a51794475a883744db8d524cee84e5fc -timeCreated: 1481127005 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 0 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SaveOFF.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SaveOFF.png Binary files differdeleted file mode 100644 index 99b45585..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SaveOFF.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SaveOFF.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SaveOFF.png.meta deleted file mode 100644 index 4327db03..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SaveOFF.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: 4e4a13447ac514c4ca21e7232bac5486 -timeCreated: 1481126990 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 0 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SaveON.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SaveON.png Binary files differdeleted file mode 100644 index d98884cd..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SaveON.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SaveON.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SaveON.png.meta deleted file mode 100644 index 94e941ce..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SaveON.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: 2c938a89586d41f4081284e4b25243c2 -timeCreated: 1481126984 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 0 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SelectionAsTemplate.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SelectionAsTemplate.png Binary files differdeleted file mode 100644 index b0eef875..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SelectionAsTemplate.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SelectionAsTemplate.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SelectionAsTemplate.png.meta deleted file mode 100644 index fb719f49..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SelectionAsTemplate.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: 8148796947da07d49906f1201f417a60 -timeCreated: 1481127000 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 0 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ShaderSelectOFF.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ShaderSelectOFF.png Binary files differdeleted file mode 100644 index 80640b38..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ShaderSelectOFF.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ShaderSelectOFF.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ShaderSelectOFF.png.meta deleted file mode 100644 index e2982cfb..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ShaderSelectOFF.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: ce7d95fa4e635f943a73ce1b19312cc5 -timeCreated: 1481127016 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 0 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ShaderSelectON.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ShaderSelectON.png Binary files differdeleted file mode 100644 index ceb781ff..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ShaderSelectON.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ShaderSelectON.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ShaderSelectON.png.meta deleted file mode 100644 index ac50fe70..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ShaderSelectON.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: e737e4bfd0859a946b0c5feddb61d29f -timeCreated: 1481127019 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 0 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ShareOFF.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ShareOFF.png Binary files differdeleted file mode 100644 index 82805ea6..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ShareOFF.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ShareOFF.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ShareOFF.png.meta deleted file mode 100644 index def19ac4..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/ShareOFF.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: bc5bd469748466a459badfab23915cb0 -timeCreated: 1560784373 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: 1 - maxTextureSize: 2048 - textureSettings: - filterMode: 1 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SliderHoriz.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SliderHoriz.png Binary files differdeleted file mode 100644 index f995de6e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SliderHoriz.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SliderHoriz.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SliderHoriz.png.meta deleted file mode 100644 index fd71d590..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/SliderHoriz.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: 4cabb2d6785b8aa4db0c0a34e1e00f04 -timeCreated: 1481126990 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 1 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -3 - maxTextureSize: 2048 - textureSettings: - filterMode: 1 - aniso: 1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/TakeScreenshotOFF.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/TakeScreenshotOFF.png Binary files differdeleted file mode 100644 index b38c88e4..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/TakeScreenshotOFF.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/TakeScreenshotOFF.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/TakeScreenshotOFF.png.meta deleted file mode 100644 index b41d15f3..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/TakeScreenshotOFF.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: 7587de2e3bec8bf4d973109524ccc6b1 -timeCreated: 1560359851 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: 1 - maxTextureSize: 2048 - textureSettings: - filterMode: 1 - aniso: -1 - mipBias: -1 - wrapMode: -1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/TransparentPixel.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/TransparentPixel.png Binary files differdeleted file mode 100644 index 427fb75b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/TransparentPixel.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/TransparentPixel.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/TransparentPixel.png.meta deleted file mode 100644 index f20de9f4..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/TransparentPixel.png.meta +++ /dev/null @@ -1,58 +0,0 @@ -fileFormatVersion: 2 -guid: 1004d06b4b28f5943abdf2313a22790a -timeCreated: 1496682298 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 2 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - linearTexture: 1 - correctGamma: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 0 - cubemapConvolution: 0 - cubemapConvolutionSteps: 7 - cubemapConvolutionExponent: 1.5 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: -1 - aniso: 1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - rGBM: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - buildTargetSettings: [] - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/UpdateOFF.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/UpdateOFF.png Binary files differdeleted file mode 100644 index 48557860..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/UpdateOFF.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/UpdateOFF.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/UpdateOFF.png.meta deleted file mode 100644 index f16fd175..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/UpdateOFF.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: 99d70ac09b4db9742b404c3f92d8564b -timeCreated: 1481127004 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 1 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/UpdateOutdated.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/UpdateOutdated.png Binary files differdeleted file mode 100644 index ffc3484a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/UpdateOutdated.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/UpdateOutdated.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/UpdateOutdated.png.meta deleted file mode 100644 index 54e51757..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/UpdateOutdated.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: cce638be049286c41bcbd0a26c356b18 -timeCreated: 1481127016 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 1 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/UpdateUpToDated.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/UpdateUpToDated.png Binary files differdeleted file mode 100644 index a60c4351..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/UpdateUpToDated.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/UpdateUpToDated.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/UpdateUpToDated.png.meta deleted file mode 100644 index db066db9..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Buttons/UpdateUpToDated.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: ce30b12fbb3223746bcfef9ea82effe3 -timeCreated: 1481127016 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 1 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas.meta deleted file mode 100644 index 9cfcde5a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: c956b1443ae5df54485c68a775928f3e -folderAsset: yes -timeCreated: 1481126946 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/CircleBackground.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/CircleBackground.png Binary files differdeleted file mode 100644 index 961d196a..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/CircleBackground.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/CircleBackground.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/CircleBackground.png.meta deleted file mode 100644 index 80bf31b3..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/CircleBackground.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: c560c5d8ca4c353409caf2ec204f3a19 -timeCreated: 1566998352 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: 1 - maxTextureSize: 2048 - textureSettings: - filterMode: -1 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 1 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/Grid128.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/Grid128.png Binary files differdeleted file mode 100644 index b71a7046..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/Grid128.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/Grid128.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/Grid128.png.meta deleted file mode 100644 index 211cf275..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/Grid128.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: 881c304491028ea48b5027ac6c62cf73 -timeCreated: 1481127003 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 1 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: 4 - maxTextureSize: 2048 - textureSettings: - filterMode: -1 - aniso: -1 - mipBias: -1 - wrapMode: -1 - nPOTScale: 1 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex 2.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex 2.png Binary files differdeleted file mode 100644 index 4f94e411..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex 2.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex 2.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex 2.png.meta deleted file mode 100644 index f0ef6b03..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex 2.png.meta +++ /dev/null @@ -1,84 +0,0 @@ -fileFormatVersion: 2 -guid: 03a7d169469c1af41bb03241a7b7e23d -timeCreated: 1486740437 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 1 - enableMipMap: 1 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 0 - mipMapFadeDistanceEnd: 10 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 1 - aniso: 4 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: 5 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 1 - - buildTarget: WebGL - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex 3.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex 3.png Binary files differdeleted file mode 100644 index ef9865ba..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex 3.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex 3.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex 3.png.meta deleted file mode 100644 index fb6886d0..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex 3.png.meta +++ /dev/null @@ -1,84 +0,0 @@ -fileFormatVersion: 2 -guid: c3512c25766a40245ac94c6b1722d76e -timeCreated: 1491391706 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 1 - enableMipMap: 1 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: -1 - aniso: 4 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: 5 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 1 - - buildTarget: WebGL - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex 4.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex 4.png Binary files differdeleted file mode 100644 index 9e913665..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex 4.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex 4.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex 4.png.meta deleted file mode 100644 index a8c3128f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex 4.png.meta +++ /dev/null @@ -1,84 +0,0 @@ -fileFormatVersion: 2 -guid: e0f922c44762291498cc62e0917609be -timeCreated: 1491397409 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 1 - enableMipMap: 1 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 1 - aniso: 4 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: 5 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 1 - - buildTarget: WebGL - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex.png Binary files differdeleted file mode 100644 index 69c7e0d9..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex.png.meta deleted file mode 100644 index 832ec725..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/LineTex.png.meta +++ /dev/null @@ -1,84 +0,0 @@ -fileFormatVersion: 2 -guid: 02f71419854c0d845a930c9e0a0bf775 -timeCreated: 1486740437 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 1 - enableMipMap: 1 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 7 - mipMapFadeDistanceEnd: 10 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 2 - aniso: 4 - mipBias: -1 - wrapMode: 0 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: 5 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 1 - - buildTarget: WebGL - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/MainCanvasTitleBg.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/MainCanvasTitleBg.png Binary files differdeleted file mode 100644 index 2f696ad4..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/MainCanvasTitleBg.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/MainCanvasTitleBg.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/MainCanvasTitleBg.png.meta deleted file mode 100644 index 4173ef49..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/MainCanvasTitleBg.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: bdb42c87b8801e94e886c5c0d60b3014 -timeCreated: 1481127012 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 0 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/Material.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/Material.png Binary files differdeleted file mode 100644 index e73d6b0c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/Material.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/Material.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/Material.png.meta deleted file mode 100644 index 2db05097..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/Material.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: 157b94751c138d84bbe1768c672b5168 -timeCreated: 1481126977 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 0 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/MaterialModeIcon.PNG b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/MaterialModeIcon.PNG Binary files differdeleted file mode 100644 index 95efd603..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/MaterialModeIcon.PNG +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/MaterialModeIcon.PNG.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/MaterialModeIcon.PNG.meta deleted file mode 100644 index afabc46c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/MaterialModeIcon.PNG.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: 5725fa8ee04e1be449af059f5735cd81 -timeCreated: 1481126993 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 0 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/MaterialModeIconOFF.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/MaterialModeIconOFF.png Binary files differdeleted file mode 100644 index ebb35892..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/MaterialModeIconOFF.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/MaterialModeIconOFF.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/MaterialModeIconOFF.png.meta deleted file mode 100644 index 38d362eb..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/MaterialModeIconOFF.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: 7040748e1c49b9648aeeefef41c8a3d5 -timeCreated: 1481126996 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 0 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/SelectionBox.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/SelectionBox.png Binary files differdeleted file mode 100644 index 8e841e41..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/SelectionBox.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/SelectionBox.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/SelectionBox.png.meta deleted file mode 100644 index 83a3c4e1..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/SelectionBox.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: a702c1245d15ddb48b8fba73bf951a65 -timeCreated: 1575977950 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: 1 - maxTextureSize: 2048 - textureSettings: - filterMode: 0 - aniso: 1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/Shader.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/Shader.png Binary files differdeleted file mode 100644 index 4dd6cb38..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/Shader.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/Shader.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/Shader.png.meta deleted file mode 100644 index 14d9a6f9..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/Shader.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: 555b6a287b4121b479d412e6ea92bb2e -timeCreated: 1481126991 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 0 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunction.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunction.png Binary files differdeleted file mode 100644 index 20927720..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunction.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunction.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunction.png.meta deleted file mode 100644 index 320e52ad..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunction.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: 94cd628d3d8e07d40a85d82b3fdad15d -timeCreated: 1481126991 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 0 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunctionIcon.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunctionIcon.png Binary files differdeleted file mode 100644 index 2d133914..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunctionIcon.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunctionIcon.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunctionIcon.png.meta deleted file mode 100644 index ef16bf9d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunctionIcon.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: 50be8291f9514914aa55c66c49da67cf -timeCreated: 1492693836 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 1 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 2 - aniso: 1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: 5 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 1 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunctionModeIcon.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunctionModeIcon.png Binary files differdeleted file mode 100644 index a7724e96..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunctionModeIcon.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunctionModeIcon.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunctionModeIcon.png.meta deleted file mode 100644 index 6b790d71..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunctionModeIcon.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: 68897d376b60748438e0ae3474ebe558 -timeCreated: 1494003400 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: -1 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunctionModeIconOFF.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunctionModeIconOFF.png Binary files differdeleted file mode 100644 index 53128586..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunctionModeIconOFF.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunctionModeIconOFF.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunctionModeIconOFF.png.meta deleted file mode 100644 index 9735d2b7..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderFunctionModeIconOFF.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: ff637d399b504ac4999b770f24ef4d56 -timeCreated: 1494003400 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: -1 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderModeIcon.PNG b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderModeIcon.PNG Binary files differdeleted file mode 100644 index fe8ea72f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderModeIcon.PNG +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderModeIcon.PNG.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderModeIcon.PNG.meta deleted file mode 100644 index 1e94d8f2..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderModeIcon.PNG.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: f4ca92d9e50d06049b7ccec2c438754d -timeCreated: 1481127025 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 0 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderModeIconOFF.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderModeIconOFF.png Binary files differdeleted file mode 100644 index f0282e45..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderModeIconOFF.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderModeIconOFF.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderModeIconOFF.png.meta deleted file mode 100644 index aa63312d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderModeIconOFF.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: df81b9531d8ef704f96072ce6910db68 -timeCreated: 1481127018 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 0 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderModeMatIcon.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderModeMatIcon.png Binary files differdeleted file mode 100644 index a2ac1b08..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderModeMatIcon.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderModeMatIcon.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderModeMatIcon.png.meta deleted file mode 100644 index d7ffa717..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/ShaderModeMatIcon.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: 6f410c15ce9be2741bae77a30a336748 -timeCreated: 1481126996 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 0 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/TransparentOverlay.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/TransparentOverlay.png Binary files differdeleted file mode 100644 index c43bb103..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/TransparentOverlay.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/TransparentOverlay.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/TransparentOverlay.png.meta deleted file mode 100644 index 3a4635f9..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Canvas/TransparentOverlay.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: 8c4a7fca2884fab419769ccc0355c0c1 -timeCreated: 1481127003 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: -1 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes.meta deleted file mode 100644 index bc11f3dd..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 2bec2ea1b48d47846930d3eedd9a80ca -folderAsset: yes -timeCreated: 1481126945 -licenseType: Store -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalBase.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalBase.png Binary files differdeleted file mode 100644 index 8c81b522..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalBase.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalBase.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalBase.png.meta deleted file mode 100644 index 1c13e097..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalBase.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: 60c283ffa9a758646ab70a2fe7ff5f71 -timeCreated: 1483554830 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -3 - maxTextureSize: 2048 - textureSettings: - filterMode: 1 - aniso: 1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalBaseLeft.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalBaseLeft.png Binary files differdeleted file mode 100644 index 3e25124e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalBaseLeft.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalBaseLeft.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalBaseLeft.png.meta deleted file mode 100644 index ee8cd749..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalBaseLeft.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: 330fd0c8f074a3c4f8042114a61a73d9 -timeCreated: 1522611116 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: 1 - maxTextureSize: 2048 - textureSettings: - filterMode: -1 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 1 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: 4 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 1 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalBaseSquare.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalBaseSquare.png Binary files differdeleted file mode 100644 index 2ddfe241..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalBaseSquare.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalBaseSquare.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalBaseSquare.png.meta deleted file mode 100644 index d9fa5ac3..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalBaseSquare.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: d179c8744f837da49ab92aae04d1ae1c -timeCreated: 1520606221 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: 1 - maxTextureSize: 2048 - textureSettings: - filterMode: 1 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 1 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalHeader.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalHeader.png Binary files differdeleted file mode 100644 index 66d50c61..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalHeader.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalHeader.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalHeader.png.meta deleted file mode 100644 index 2e78ec1d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/BlueNormalHeader.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: bd910a1d744309b499b59062db7891ab -timeCreated: 1483555205 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -3 - maxTextureSize: 2048 - textureSettings: - filterMode: 0 - aniso: 1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/ButtonBackground.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/ButtonBackground.png Binary files differdeleted file mode 100644 index a5d9baa5..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/ButtonBackground.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/ButtonBackground.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/ButtonBackground.png.meta deleted file mode 100644 index 15a665b3..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/ButtonBackground.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: b57dd36838fb19c449fd4559efe3f800 -timeCreated: 1487608374 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: -1 - aniso: 1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: 5 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 1 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/CommentNodeBase.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/CommentNodeBase.png Binary files differdeleted file mode 100644 index a960d704..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/CommentNodeBase.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/CommentNodeBase.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/CommentNodeBase.png.meta deleted file mode 100644 index b40c1024..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/CommentNodeBase.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: b2be9c55e7e7ba447967677c82b2cb23 -timeCreated: 1481127009 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 0 - aniso: -1 - mipBias: -1 - wrapMode: -1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/CommentaryResizeIcon.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/CommentaryResizeIcon.png Binary files differdeleted file mode 100644 index c4034d01..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/CommentaryResizeIcon.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/CommentaryResizeIcon.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/CommentaryResizeIcon.png.meta deleted file mode 100644 index 3feafe25..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/CommentaryResizeIcon.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: 5321bd2b79632764286f28503db80815 -timeCreated: 1481126991 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: 5 - maxTextureSize: 2048 - textureSettings: - filterMode: 0 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/CommentaryResizeIconInv.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/CommentaryResizeIconInv.png Binary files differdeleted file mode 100644 index bf96dc94..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/CommentaryResizeIconInv.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/CommentaryResizeIconInv.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/CommentaryResizeIconInv.png.meta deleted file mode 100644 index cb3575db..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/CommentaryResizeIconInv.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: b52bc320a2ff91446978a893ec738134 -timeCreated: 1481127009 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: 5 - maxTextureSize: 2048 - textureSettings: - filterMode: 0 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/FlatBackground.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/FlatBackground.png Binary files differdeleted file mode 100644 index 393b83bf..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/FlatBackground.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/FlatBackground.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/FlatBackground.png.meta deleted file mode 100644 index 86eb5644..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/FlatBackground.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: 44efd0011d6a9bc4fb0b3a82753dac4e -timeCreated: 1481126984 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 1 - sRGBTexture: 0 - linearTexture: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: -1 - aniso: -1 - mipBias: -1 - wrapMode: -1 - nPOTScale: 1 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 0 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GraphButton.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GraphButton.png Binary files differdeleted file mode 100644 index 38fe4e6d..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GraphButton.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GraphButton.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GraphButton.png.meta deleted file mode 100644 index 76350fc1..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GraphButton.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: 2b3b7485f95e8a44dab3fa9610f56cbb -timeCreated: 1513873202 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: 1 - maxTextureSize: 2048 - textureSettings: - filterMode: -1 - aniso: -1 - mipBias: -1 - wrapMode: -1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GraphButtonActive.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GraphButtonActive.png Binary files differdeleted file mode 100644 index 67cce687..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GraphButtonActive.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GraphButtonActive.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GraphButtonActive.png.meta deleted file mode 100644 index 8e8e14d6..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GraphButtonActive.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: dd3411e8d9927d3429d5872dbdbd752b -timeCreated: 1513877265 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: 1 - maxTextureSize: 2048 - textureSettings: - filterMode: -1 - aniso: -1 - mipBias: -1 - wrapMode: -1 - nPOTScale: 1 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GraphPopup.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GraphPopup.png Binary files differdeleted file mode 100644 index 89ea7dd2..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GraphPopup.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GraphPopup.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GraphPopup.png.meta deleted file mode 100644 index 400f36b9..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GraphPopup.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: 2ae607812d722ec46b48647c2a800779 -timeCreated: 1515435226 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: 1 - maxTextureSize: 2048 - textureSettings: - filterMode: -1 - aniso: -1 - mipBias: -1 - wrapMode: -1 - nPOTScale: 1 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GrayNormalHeader.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GrayNormalHeader.png Binary files differdeleted file mode 100644 index a1f1ca7b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GrayNormalHeader.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GrayNormalHeader.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GrayNormalHeader.png.meta deleted file mode 100644 index fab11a77..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GrayNormalHeader.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: 9e88b336bd16b1e4b99de75f486126c1 -timeCreated: 1481127004 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: 5 - maxTextureSize: 2048 - textureSettings: - filterMode: 1 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GrayNormalHeaderSquare.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GrayNormalHeaderSquare.png Binary files differdeleted file mode 100644 index a150e5bb..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GrayNormalHeaderSquare.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GrayNormalHeaderSquare.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GrayNormalHeaderSquare.png.meta deleted file mode 100644 index 328f79c3..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/GrayNormalHeaderSquare.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: b16188b8a3dee8146bd9cb0bde234a24 -timeCreated: 1520606407 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: 1 - maxTextureSize: 2048 - textureSettings: - filterMode: 1 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/NoPreview.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/NoPreview.png Binary files differdeleted file mode 100644 index 77a8e4b9..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/NoPreview.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/NoPreview.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/NoPreview.png.meta deleted file mode 100644 index 28815f65..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/NoPreview.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: 750b1bd7ba8bd28489650de6d0a95cc5 -timeCreated: 1487590795 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 1 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: 0 - aniso: 1 - mipBias: -1 - wrapMode: 0 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: 3 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 1 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/NodeSelected.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/NodeSelected.png Binary files differdeleted file mode 100644 index abb8c702..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/NodeSelected.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/NodeSelected.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/NodeSelected.png.meta deleted file mode 100644 index 891c14b5..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/NodeSelected.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: 24fb767323009c143a4e744a2025a27e -timeCreated: 1481126983 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: 5 - maxTextureSize: 2048 - textureSettings: - filterMode: 1 - aniso: -1 - mipBias: -1 - wrapMode: -1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/NodeSelectedSquare.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/NodeSelectedSquare.png Binary files differdeleted file mode 100644 index 7db90362..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/NodeSelectedSquare.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/NodeSelectedSquare.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/NodeSelectedSquare.png.meta deleted file mode 100644 index 326cfc61..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/NodeSelectedSquare.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: 080a030f87555fe419ecc1fb9f509118 -timeCreated: 1520612755 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: 1 - maxTextureSize: 2048 - textureSettings: - filterMode: -1 - aniso: -1 - mipBias: -1 - wrapMode: -1 - nPOTScale: 1 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/ObjectPickerBackgroundOutline.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/ObjectPickerBackgroundOutline.png Binary files differdeleted file mode 100644 index 7d594455..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/ObjectPickerBackgroundOutline.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/ObjectPickerBackgroundOutline.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/ObjectPickerBackgroundOutline.png.meta deleted file mode 100644 index 13ecffbe..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/ObjectPickerBackgroundOutline.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: c1912a55d2f211d468ddeb7b1386dd41 -timeCreated: 1487618370 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -1 - maxTextureSize: 2048 - textureSettings: - filterMode: -1 - aniso: 1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: 5 - textureCompression: 1 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 1 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PopupPicker.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PopupPicker.png Binary files differdeleted file mode 100644 index 8c826a96..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PopupPicker.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PopupPicker.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PopupPicker.png.meta deleted file mode 100644 index 4d05be2c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PopupPicker.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: d2384a227b4ac4943b73c8151393e502 -timeCreated: 1515513996 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 1 - sRGBTexture: 0 - linearTexture: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: 1 - maxTextureSize: 2048 - textureSettings: - filterMode: -1 - aniso: -1 - mipBias: -1 - wrapMode: -1 - nPOTScale: 1 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PreviewOff.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PreviewOff.png Binary files differdeleted file mode 100644 index e336ea4e..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PreviewOff.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PreviewOff.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PreviewOff.png.meta deleted file mode 100644 index 97da0a2c..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PreviewOff.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: 1f3a46793c375864ab816c0d78061e4e -timeCreated: 1486488219 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 1 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -3 - maxTextureSize: 2048 - textureSettings: - filterMode: -1 - aniso: 1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PreviewOn.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PreviewOn.png Binary files differdeleted file mode 100644 index 0b8ed9d3..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PreviewOn.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PreviewOn.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PreviewOn.png.meta deleted file mode 100644 index 704441e9..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PreviewOn.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: dae54b5aa457b474e8a1599de1073d26 -timeCreated: 1486488219 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 1 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -3 - maxTextureSize: 2048 - textureSettings: - filterMode: -1 - aniso: -1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PropertyPicker.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PropertyPicker.png Binary files differdeleted file mode 100644 index f8bbfe61..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PropertyPicker.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PropertyPicker.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PropertyPicker.png.meta deleted file mode 100644 index 60b4b85b..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/PropertyPicker.png.meta +++ /dev/null @@ -1,76 +0,0 @@ -fileFormatVersion: 2 -guid: 94816692c85001f4dab01ec3666943c0 -timeCreated: 1486470997 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 0 - enableMipMap: 1 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 0 - mipMapFadeDistanceEnd: 10 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: -3 - maxTextureSize: 2048 - textureSettings: - filterMode: -1 - aniso: 1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/SliderButton.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/SliderButton.png Binary files differdeleted file mode 100644 index 29e767a7..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/SliderButton.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/SliderButton.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/SliderButton.png.meta deleted file mode 100644 index f016d54f..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/SliderButton.png.meta +++ /dev/null @@ -1,58 +0,0 @@ -fileFormatVersion: 2 -guid: dd563e33152bb6443b099b4139ceecb9 -timeCreated: 1501088039 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 2 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - linearTexture: 1 - correctGamma: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 0 - cubemapConvolution: 0 - cubemapConvolutionSteps: 7 - cubemapConvolutionExponent: 1.5 - seamlessCubemap: 0 - textureFormat: -3 - maxTextureSize: 2048 - textureSettings: - filterMode: -1 - aniso: 1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - rGBM: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - buildTargetSettings: [] - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/WhitePortOutline.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/WhitePortOutline.png Binary files differdeleted file mode 100644 index dcd640db..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/WhitePortOutline.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/WhitePortOutline.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/WhitePortOutline.png.meta deleted file mode 100644 index b16ea8b6..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/WhitePortOutline.png.meta +++ /dev/null @@ -1,84 +0,0 @@ -fileFormatVersion: 2 -guid: 56277f370fb77a448a152bcd2e3a9077 -timeCreated: 1481126991 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 1 - enableMipMap: 1 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 1 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: 5 - maxTextureSize: 2048 - textureSettings: - filterMode: 1 - aniso: 4 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: WebGL - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/WhitePortSolid.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/WhitePortSolid.png Binary files differdeleted file mode 100644 index b755f5e4..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/WhitePortSolid.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/WhitePortSolid.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/WhitePortSolid.png.meta deleted file mode 100644 index 9ead42d1..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/WhitePortSolid.png.meta +++ /dev/null @@ -1,84 +0,0 @@ -fileFormatVersion: 2 -guid: 8113366f9f7cec647878e3af2fb98922 -timeCreated: 1481127000 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 4 - mipmaps: - mipMapMode: 1 - enableMipMap: 1 - sRGBTexture: 0 - linearTexture: 1 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 6 - cubemapConvolution: 0 - seamlessCubemap: 0 - textureFormat: 5 - maxTextureSize: 2048 - textureSettings: - filterMode: 1 - aniso: 4 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaUsage: 1 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - textureShape: 1 - maxTextureSizeSet: 0 - compressionQualitySet: 0 - textureFormatSet: 0 - platformSettings: - - buildTarget: DefaultTexturePlatform - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: Standalone - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - - buildTarget: WebGL - maxTextureSize: 2048 - textureFormat: -1 - textureCompression: 0 - compressionQuality: 50 - crunchedCompression: 0 - allowsAlphaSplitting: 0 - overridden: 0 - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/WireNodeSelection.png b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/WireNodeSelection.png Binary files differdeleted file mode 100644 index 9dd1e738..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/WireNodeSelection.png +++ /dev/null diff --git a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/WireNodeSelection.png.meta b/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/WireNodeSelection.png.meta deleted file mode 100644 index 44efba85..00000000 --- a/Assets/AmplifyShaderEditor/Plugins/EditorResources/UI/Nodes/WireNodeSelection.png.meta +++ /dev/null @@ -1,58 +0,0 @@ -fileFormatVersion: 2 -guid: bfe0b03d5d60cea4f9d4b2d1d121e592 -timeCreated: 1504005445 -licenseType: Store -TextureImporter: - fileIDToRecycleName: {} - serializedVersion: 2 - mipmaps: - mipMapMode: 0 - enableMipMap: 0 - linearTexture: 1 - correctGamma: 0 - fadeOut: 0 - borderMipMap: 0 - mipMapFadeDistanceStart: 1 - mipMapFadeDistanceEnd: 3 - bumpmap: - convertToNormalMap: 0 - externalNormalMap: 0 - heightScale: 0.25 - normalMapFilter: 0 - isReadable: 0 - grayScaleToAlpha: 0 - generateCubemap: 0 - cubemapConvolution: 0 - cubemapConvolutionSteps: 7 - cubemapConvolutionExponent: 1.5 - seamlessCubemap: 0 - textureFormat: -3 - maxTextureSize: 2048 - textureSettings: - filterMode: -1 - aniso: 1 - mipBias: -1 - wrapMode: 1 - nPOTScale: 0 - lightmap: 0 - rGBM: 0 - compressionQuality: 50 - spriteMode: 0 - spriteExtrude: 1 - spriteMeshType: 1 - alignment: 0 - spritePivot: {x: 0.5, y: 0.5} - spriteBorder: {x: 0, y: 0, z: 0, w: 0} - spritePixelsToUnits: 100 - alphaIsTransparency: 1 - spriteTessellationDetail: -1 - textureType: 2 - buildTargetSettings: [] - spriteSheet: - serializedVersion: 2 - sprites: [] - outline: [] - spritePackingTag: - userData: - assetBundleName: - assetBundleVariant: |