shader条进度

This commit is contained in:
xdy 2025-04-30 14:05:31 +08:00
parent bb78e18164
commit fa73c471c8
2053 changed files with 255337 additions and 7 deletions

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: daca988099666ec40aaa2cde22bb4935
folderAsset: yes
timeCreated: 1441276737
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,15 @@
{
"name": "AmplifyShaderEditor",
"references": [],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": true,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: f540dafdfbc0586439d98823585550d4
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 580cccd3e608b7f4cac35ea46d62d429
timeCreated: 1481127071
licenseType: Store
TextScriptImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 425c3aed47dd05444960ca41af18e591
folderAsset: yes
timeCreated: 1481126943
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e00e6f90ab8233e46a41c5e33917c642
timeCreated: 1585839223
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
Fire texture - http://suicidecrew.deviantart.com/art/Fire-Seamless-tile-116721709
Screen Space Curvature - http://madebyevan.com/shaders/curvature/
Grass Blades texture from:
http://www.fuzzimo.com/free-hi-res-ornamental-grass-blade-textures/
Keep them coming, contribute today!
http://amplify.pt/unity/amplify-shader-editor/contribute

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 451790f45b4e5434586d16e924540ee7
timeCreated: 1481127071
licenseType: Store
TextScriptImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 9da5530d5ebfab24c8ecad68795e720f
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: aa102d640b98b5d4781710a3a3dd6983
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 7a0bb33169d95ec499136d59cb25918b
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 641c955d37d2fac4f87e00ac5c9d9bd8
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 2690f45490c175045bbdc63395bf6278
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: f42c2bc4dab4723429b0d30b635c3035
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d1c0b77896049554fa4b635531caf741
timeCreated: 1533059192
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,24 @@
How to Install Samples
Samples are provided by pipeline. To import the samples please use the "Start Screen" to do so instead of
unpacking manually, this will ensure that they are imported correctly:
Go to Windows > Amplify Shader Editor > Start Screen and under "Shader Samples" select the ones you wish to
import. Do be aware that importing any SRP samples requires to first install the respective pipeline using
the package manager.
Please notice that in some cases the sample may have been created in a different version from the SRP that
you are using which can produce "pink" shaders. If that happens it's usually the case that you only need to
open the shader in ASE and save it to update it.
Additional Samples for FREE
A large number of additional shader samples can be found in Amplify Shader Pack (ASP), available on the Asset Store:
This sample pack is made available free of charge, if you already own Amplify Shader Editor (ASE).
1. Login with your Unity account that owns a ASE license
2. Go to the ASP page at the Asset Store: https://assetstore.unity.com/publishers/707
3. Add ASP to your cart
4. Go to checkout and ASP should be FREE (make sure that the value is 0, do not proceed otherwise)
5. Have fun!

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 5c5208e121a880c4fbb9de7aaeaa8aa2
timeCreated: 1541776170
licenseType: Store
TextScriptImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c0a0a980c9ba86345bc15411db88d34f
timeCreated: 1585839223
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 2edbf4a9b9544774bbef617e92429664
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 13ab599a7bda4e54fba3e92a13c9580a
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: f6f268949ccf3f34fa4d18e92501ed82
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 69bc3229216b1504ea3e28b5820bbb0d
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 4f665a06c5a2aa5499fa1c79ac058999
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 47fc5ccecd261894994c1e9e827cf553
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a9d68dd8913f05d4d9ce75e7b40c6044
timeCreated: 1575902011
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 3306ce0ede814a84c8d289893da72b7a
folderAsset: yes
timeCreated: 1481126943
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 4a66239afbf6d2c4eb99238642c8d40f
folderAsset: yes
timeCreated: 1481126943
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: a2ba8588f45692f4ea2fa5afa9faf434
folderAsset: yes
timeCreated: 1481126944
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,336 @@
// 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;
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 29204f353101f46439a93f1c503d3197
timeCreated: 1481126954
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,58 @@
// 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;
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: bc089a69595d8994cb89946a919517c2
timeCreated: 1481126958
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,39 @@
// 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; } }
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 43bd963fa46ee9c4680dacff1d8dc0b9
timeCreated: 1481126955
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,673 @@
// 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 RenderTextureFormat PreviewFormat = RenderTextureFormat.ARGBFloat;
public readonly static int PreviewSize = 128;
public readonly static List<string> UnityNativeInspectors = new List<string>
{
"Rendering.HighDefinition.LightingShaderGraphGUI",
"Rendering.HighDefinition.HDUnlitGUI",
"UnityEditor.Rendering.HighDefinition.HDLitGUI",
"UnityEditor.ShaderGraph.PBRMasterGUI",
"UnityEditor.Rendering.HighDefinition.DecalGUI",
"UnityEditor.Rendering.HighDefinition.FabricGUI",
"UnityEditor.Experimental.Rendering.HDPipeline.HDLitGUI",
"Rendering.HighDefinition.DecalGUI",
"Rendering.HighDefinition.LitShaderGraphGUI",
"Rendering.HighDefinition.DecalShaderGraphGUI",
"UnityEditor.ShaderGraphUnlitGUI",
"UnityEditor.ShaderGraphLitGUI",
"UnityEditor.Rendering.Universal.DecalShaderGraphGUI"
};
public readonly static Dictionary<string, string> CustomInspectorHD7To10 = new Dictionary<string, string>
{
{ "UnityEditor.Rendering.HighDefinition.DecalGUI","Rendering.HighDefinition.DecalGUI"},
{ "UnityEditor.Rendering.HighDefinition.FabricGUI","Rendering.HighDefinition.LightingShaderGraphGUI"},
{ "UnityEditor.Rendering.HighDefinition.HDLitGUI","Rendering.HighDefinition.LitShaderGraphGUI"},
{ "UnityEditor.Experimental.Rendering.HDPipeline.HDLitGUI","Rendering.HighDefinition.LitShaderGraphGUI"},
};
public readonly static Dictionary<string , string> CustomInspectorURP10To12 = new Dictionary<string , string>
{
{ "UnityEditor.ShaderGraph.PBRMasterGUI","UnityEditor.ShaderGraphLitGUI"},
};
public readonly static Dictionary<string , string> CustomInspectorHDLegacyTo11 = new Dictionary<string , string>
{
{ "UnityEditor.Rendering.HighDefinition.DecalGUI","Rendering.HighDefinition.DecalShaderGraphGUI"},
{ "Rendering.HighDefinition.DecalGUI","Rendering.HighDefinition.DecalShaderGraphGUI"},
{ "UnityEditor.Rendering.HighDefinition.FabricGUI","Rendering.HighDefinition.LightingShaderGraphGUI"},
{ "UnityEditor.Rendering.HighDefinition.HDLitGUI","Rendering.HighDefinition.LitShaderGraphGUI"},
{ "UnityEditor.Experimental.Rendering.HDPipeline.HDLitGUI","Rendering.HighDefinition.LitShaderGraphGUI"},
};
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 =
{
"#if defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (defined(SHADER_TARGET_SURFACE_ANALYSIS) && !defined(SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER))//3D SRP MACROS",
"#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)",
"#else//3D SRP MACROS",
"#define SAMPLE_TEXTURE3D_GRAD(textureName, samplerName, coord3, dpdx, dpdy) SAMPLE_TEXTURE3D(textureName, samplerName, coord3)",
"#define SAMPLE_TEXTURE3D_BIAS(textureName, samplerName, coord3, bias) SAMPLE_TEXTURE3D(textureName, samplerName, coord3)",
"#endif//3D SRP MACROS\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}, {2}, {3} )"},
{ TextureType.Texture3D,"SAMPLE_TEXTURE3D{0}( {1}, {2}, {3} )"},
{ TextureType.Cube,"SAMPLE_TEXTURECUBE{0}( {1}, {2}, {3} )"},
{ TextureType.Texture2DArray,"SAMPLE_TEXTURE2D_ARRAY{0}( {1}, {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})"},
};
public readonly static Dictionary<WirePortDataType, TextureType> WireToTexture = new Dictionary<WirePortDataType, TextureType>
{
{ WirePortDataType.SAMPLER1D,TextureType.Texture1D},
{ WirePortDataType.SAMPLER2D,TextureType.Texture2D},
{ WirePortDataType.SAMPLER3D,TextureType.Texture3D},
{ WirePortDataType.SAMPLERCUBE,TextureType.Cube},
{ WirePortDataType.SAMPLER2DARRAY,TextureType.Texture2DArray},
};
public readonly static Dictionary<TextureType, WirePortDataType> TextureToWire = new Dictionary<TextureType, WirePortDataType>
{
{ TextureType.Texture1D,WirePortDataType.SAMPLER1D},
{ TextureType.Texture2D,WirePortDataType.SAMPLER2D},
{ TextureType.Texture3D, WirePortDataType.SAMPLER3D},
{ TextureType.Cube,WirePortDataType.SAMPLERCUBE},
{ TextureType.Texture2DArray,WirePortDataType.SAMPLER2DARRAY},
{ TextureType.ProceduralTexture,WirePortDataType.SAMPLER2D},
};
public readonly static string SamplingMacrosDirective = "#define ASE_USING_SAMPLING_MACROS 1";
// STANDARD
public readonly static string[] CustomASEStandarSamplingMacrosHelper =
{
"#if defined(SHADER_API_D3D11) || defined(SHADER_API_XBOXONE) || defined(UNITY_COMPILER_HLSLCC) || defined(SHADER_API_PSSL) || (defined(SHADER_TARGET_SURFACE_ANALYSIS) && !defined(SHADER_TARGET_SURFACE_ANALYSIS_MOJOSHADER))//ASE Sampler Macros",
"#else//ASE Sampling Macros",
"#endif//ASE Sampling Macros\n"
};
public readonly static string[] CustomASEArraySamplingMacrosRecent =
{
"#define UNITY_SAMPLE_TEX2DARRAY(tex,coord) tex.Sample(sampler##tex,coord)",
"#define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) tex.SampleLevel(sampler##tex,coord, lod)",
"#define UNITY_SAMPLE_TEX2DARRAY_BIAS(tex,coord,bias) tex.SampleBias(sampler##tex,coord,bias)",
"#define UNITY_SAMPLE_TEX2DARRAY_GRAD(tex,coord,ddx,ddy) tex.SampleGrad(sampler##tex,coord,ddx,ddy)",
};
public readonly static string[] CustomASEArraySamplingMacrosOlder =
{
"#define UNITY_SAMPLE_TEX2DARRAY(tex,coord) tex2DArray(tex,coord)",
"#define UNITY_SAMPLE_TEX2DARRAY_LOD(tex,coord,lod) tex2DArraylod(tex, float4(coord,lod))",
"#define UNITY_SAMPLE_TEX2DARRAY_BIAS(tex,coord,bias) tex2DArray(tex,coord)",
"#define UNITY_SAMPLE_TEX2DARRAY_GRAD(tex,coord,ddx,ddy) tex2DArray(tex,coord)",
};
public readonly static string[] CustomASEStandarSamplingMacrosRecent =
{
"#define SAMPLE_TEXTURE2D(tex,samplerTex,coord) tex.Sample(samplerTex,coord)",
"#define SAMPLE_TEXTURE2D_LOD(tex,samplerTex,coord,lod) tex.SampleLevel(samplerTex,coord, lod)",
"#define SAMPLE_TEXTURE2D_BIAS(tex,samplerTex,coord,bias) tex.SampleBias(samplerTex,coord,bias)",
"#define SAMPLE_TEXTURE2D_GRAD(tex,samplerTex,coord,ddx,ddy) tex.SampleGrad(samplerTex,coord,ddx,ddy)",
"#define SAMPLE_TEXTURE3D(tex,samplerTex,coord) tex.Sample(samplerTex,coord)",
"#define SAMPLE_TEXTURE3D_LOD(tex,samplerTex,coord,lod) tex.SampleLevel(samplerTex,coord, lod)",
"#define SAMPLE_TEXTURE3D_BIAS(tex,samplerTex,coord,bias) tex.SampleBias(samplerTex,coord,bias)",
"#define SAMPLE_TEXTURE3D_GRAD(tex,samplerTex,coord,ddx,ddy) tex.SampleGrad(samplerTex,coord,ddx,ddy)",
"#define SAMPLE_TEXTURECUBE(tex,samplerTex,coord) tex.Sample(samplerTex,coord)",
"#define SAMPLE_TEXTURECUBE_LOD(tex,samplerTex,coord,lod) tex.SampleLevel(samplerTex,coord, lod)",
"#define SAMPLE_TEXTURECUBE_BIAS(tex,samplerTex,coord,bias) tex.SampleBias(samplerTex,coord,bias)",
"#define SAMPLE_TEXTURECUBE_GRAD(tex,samplerTex,coord,ddx,ddy) tex.SampleGrad(samplerTex,coord,ddx,ddy)",
"#define SAMPLE_TEXTURE2D_ARRAY(tex,samplerTex,coord) tex.Sample(samplerTex,coord)",
"#define SAMPLE_TEXTURE2D_ARRAY_LOD(tex,samplerTex,coord,lod) tex.SampleLevel(samplerTex,coord, lod)",
"#define SAMPLE_TEXTURE2D_ARRAY_BIAS(tex,samplerTex,coord,bias) tex.SampleBias(samplerTex,coord,bias)",
"#define SAMPLE_TEXTURE2D_ARRAY_GRAD(tex,samplerTex,coord,ddx,ddy) tex.SampleGrad(samplerTex,coord,ddx,ddy)",
};
public readonly static string[] CustomASEStandarSamplingMacrosOlder =
{
"#define SAMPLE_TEXTURE2D(tex,samplerTex,coord) tex2D(tex,coord)",
"#define SAMPLE_TEXTURE2D_LOD(tex,samplerTex,coord,lod) tex2Dlod(tex,float4(coord,0,lod))",
"#define SAMPLE_TEXTURE2D_BIAS(tex,samplerTex,coord,bias) tex2Dbias(tex,float4(coord,0,bias))",
"#define SAMPLE_TEXTURE2D_GRAD(tex,samplerTex,coord,ddx,ddy) tex2Dgrad(tex,coord,ddx,ddy)",
"#define SAMPLE_TEXTURE3D(tex,samplerTex,coord) tex3D(tex,coord)",
"#define SAMPLE_TEXTURE3D_LOD(tex,samplerTex,coord,lod) tex3Dlod(tex,float4(coord,lod))",
"#define SAMPLE_TEXTURE3D_BIAS(tex,samplerTex,coord,bias) tex3D(tex,coord)",
"#define SAMPLE_TEXTURE3D_GRAD(tex,samplerTex,coord,ddx,ddy) tex3D(tex,coord)",
"#define SAMPLE_TEXTURECUBE(tex,samplertex,coord) texCUBE(tex,coord)",
"#define SAMPLE_TEXTURECUBE_LOD(tex,samplertex,coord,lod) texCUBElod (tex,half4(coord,lod))",
"#define SAMPLE_TEXTURECUBE_BIAS(tex,samplertex,coord,bias) texCUBE(tex,coord)",
"#define SAMPLE_TEXTURECUBE_GRAD(tex,samplertex,coord,ddx,ddy) texCUBE(tex,coord)",
"#define SAMPLE_TEXTURE2D_ARRAY(tex,samplertex,coord) tex2DArray(tex,coord)",
"#define SAMPLE_TEXTURE2D_ARRAY_LOD(tex,samplertex,coord,lod) tex2DArraylod(tex, float4(coord,lod))",
"#define SAMPLE_TEXTURE2D_ARRAY_BIAS(tex,samplerTex,coord,bias) tex2DArray(tex,coord)",
"#define SAMPLE_TEXTURE2D_ARRAY_GRAD(tex,samplerTex,coord,ddx,ddy) tex2DArray(tex,coord)",
};
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_NOSAMPLER({0})"},
{ TextureType.Texture3D,"UNITY_DECLARE_TEX3D_NOSAMPLER({0})"},
{ TextureType.Cube,"UNITY_DECLARE_TEXCUBE_NOSAMPLER({0})"},
{ TextureType.Texture2DArray,"UNITY_DECLARE_TEX2DARRAY_NOSAMPLER({0})"}
};
public readonly static Dictionary<TextureType, string> TexSampleStandardMacros = new Dictionary<TextureType, string>
{
{ TextureType.Texture2D,"UNITY_SAMPLE_TEX2D{0}( {1}, {3} )"},
{ TextureType.Texture3D,"UNITY_SAMPLE_TEX3D{0}( {1}, {3} )"},
{ TextureType.Cube,"UNITY_SAMPLE_TEXCUBE{0}( {1}, {3} )"},
{ TextureType.Texture2DArray,"UNITY_SAMPLE_TEX2DARRAY{0}( {1}, {3} )"}
};
public readonly static Dictionary<TextureType, string> TexSampleSamplerStandardMacros = new Dictionary<TextureType, string>
{
{ TextureType.Texture2D,"SAMPLE_TEXTURE2D{0}( {1}, {2}, {3} )"},
{ TextureType.Texture3D,"SAMPLE_TEXTURE3D{0}( {1}, {2}, {3} )"},
{ TextureType.Cube,"SAMPLE_TEXTURECUBE{0}( {1}, {2}, {3} )"},
{ TextureType.Texture2DArray,"SAMPLE_TEXTURE2D_ARRAY{0}( {1}, {2}, {3} )"}
};
public readonly static Dictionary<TextureType, string> TexSampleStandard = new Dictionary<TextureType, string>
{
{ TextureType.Texture2D,"tex2D{0}( {1}, {2} )"},
{ TextureType.Texture3D,"tex3D{0}( {1}, {2} )"},
{ TextureType.Cube,"texCUBE{0}( {1}, {2} )"},
{ TextureType.Texture2DArray,"tex2DArray{0}( {1}, {2} )"}
};
public readonly static char LineFeedSeparator = '$';
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\tfloat4 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 DisableBatchingHelperStr = "DisableBatching";
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 SafeNormalizeInfoStr = "With Safe Normalize division by 0 is prevented over the normalize operation at the expense of additional instructions on shader.";
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";
public readonly static string CameraDepthTextureValue = "UNITY_DECLARE_DEPTH_TEXTURE( _CameraDepthTexture );";
//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 = 14f;
public readonly static float DefaultTitleFontSize = 12f;
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 = 41;
public readonly static float INPUT_PORT_DELTA_Y = 7;
public readonly static float PORT_TO_LABEL_SPACE_X = 4;
public readonly static float NODE_HEADER_HEIGHT = 32;
public readonly static float NODE_HEADER_EXTRA_HEIGHT = 0;
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 SubTitleModeFormatStr = "Mode( {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 SubTitleCurrentFormatStr = "Current( {0} )";
public readonly static string CodeWrapper = "( {0} )";
public readonly static string InlineCodeWrapper = "{{\n{0}\n}}";
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 IsFrontFacingVariable = "ASEIsFrontFacing";
public readonly static string IsFrontFacingInput = "half ASEIsFrontFacing : SV_IsFrontFacing";
public readonly static string IsFrontFacingInputVFACE = "half ASEIsFrontFacing : 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[] RegisterInvalidChars = { "\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[] HeaderInvalidChars = { "\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 );
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 = { "0", "1", "2", "3","4", "5", "6", "7" };
public readonly static string AvailableUVSetsLabel = "UV Set";
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" };
public static readonly string SamplerFormat = "sampler{0}";
public static readonly string SamplerDeclFormat = "SamplerState {0}";
public static readonly string SamplerDeclSRPFormat = "SAMPLER({0})";
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: d833dd0968f913f449477da6bcd56b48
timeCreated: 1481126959
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 2206c4bd7f3d18643a6a3452b0c070d1
folderAsset: yes
timeCreated: 1522769470
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,36 @@
// Amplify Shader Editor - Visual Shader Editing Tool
// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
using UnityEngine;
using UnityEditor;
using System;
using AmplifyShaderEditor;
public class ASEEndDecorator : MaterialPropertyDrawer
{
bool m_applyNext = false;
public override void OnGUI( Rect position, MaterialProperty prop, String label, MaterialEditor editor )
{
if( prop.applyPropertyCallback == null )
prop.applyPropertyCallback = Testc;
if( GUI.changed || m_applyNext )
{
m_applyNext = false;
Material mat = editor.target as Material;
UIUtils.CopyValuesFromMaterial( mat );
}
}
bool Testc( MaterialProperty prop, int changeMask, object previousValue )
{
m_applyNext = true;
return false;
}
public override float GetPropertyHeight( MaterialProperty prop, string label, MaterialEditor editor )
{
return 0;
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: fdf2e52babbbbf040b3b9f6df50243f3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,294 @@
// 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;
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 7a5504a2b7d04a846978416748dc6e0a
timeCreated: 1520330108
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,25 @@
// Amplify Shader Editor - Visual Shader Editing Tool
// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
using UnityEngine;
using UnityEditor;
using System;
public class NoKeywordToggle : MaterialPropertyDrawer
{
public override void OnGUI(Rect position, MaterialProperty prop, String label, MaterialEditor editor) {
bool value = (prop.floatValue != 0.0f);
EditorGUI.BeginChangeCheck();
{
EditorGUI.showMixedValue = prop.hasMixedValue;
value = EditorGUI.Toggle( position, label, value );
EditorGUI.showMixedValue = false;
}
if (EditorGUI.EndChangeCheck())
{
prop.floatValue = value ? 1.0f : 0.0f;
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: e1a000d43a26286499b39a7571e5c61b
timeCreated: 1605540234
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,36 @@
// 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;
}
EditorGUI.MinMaxSlider(position, label, ref value.x, ref value.y, 0, 1 );
EditorGUIUtility.labelWidth = cacheLabel;
EditorGUIUtility.fieldWidth = cacheField;
EditorGUI.showMixedValue = false;
if( EditorGUI.EndChangeCheck() )
{
prop.vectorValue = value;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 314af1bcecbba6c4d92cbb5843c221ba
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,36 @@
// Amplify Shader Editor - Visual Shader Editing Tool
// Copyright (c) Amplify Creations, Lda <info@amplify.pt>
using UnityEngine;
using UnityEditor;
using System;
public class RemapSlidersFull : 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;
}
EditorGUI.MinMaxSlider( position, label, ref value.x, ref value.y, value.z, value.w );
EditorGUIUtility.labelWidth = cacheLabel;
EditorGUIUtility.fieldWidth = cacheField;
EditorGUI.showMixedValue = false;
if( EditorGUI.EndChangeCheck() )
{
prop.vectorValue = value;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9a724dcf5c5ddef40bcef06f0b2c8ec0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,23 @@
// 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;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 85da32683d237ac4f8665251e2ac38dc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,17 @@
// 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 );
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 3f2c950b0ed192943b7484f6b551965f
timeCreated: 1493906087
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,48 @@
// 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 );
}
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 2cfa7290f61ad684f99f8d81328ad52c
timeCreated: 1573664425
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,67 @@
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; } }
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 44cb06bc7bfe6e84aa8b5e8b702eb2dd
timeCreated: 1481126955
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 52f451731ec183e43ab18f0896f7172a
folderAsset: yes
timeCreated: 1481126944
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,283 @@
// 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 = 16;
private const float GRID_SIZE_Y = 16;
private const float GRID_AREA_X = 64;
private const float GRID_AREA_Y = 64;
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 ); }
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 6344917ce0eed6b43840632b98a2ed57
timeCreated: 1481126956
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 0b814c2a3cbebc047a566a92ed9d4340
timeCreated: 1481126953
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 3b28c70161e2aec4787239fba546bd25
folderAsset: yes
timeCreated: 1481126944
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: c8bcac0d66f920e49803925a85beb0ed
timeCreated: 1481126959
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,220 @@
// 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; }
}
public enum HeaderStyle
{
Default,
Category,
Custom
}
[SerializeField]
private HeaderStyle m_headerStyle = HeaderStyle.Default;
public HeaderStyle Header
{
get { return m_headerStyle; }
set { m_headerStyle = value; }
}
[SerializeField]
private Color m_headerColor = new Color( 1.00f, 0.4f, 0.0f, 1.0f );
public Color HeaderColor
{
get { return m_headerColor; }
set { m_headerColor = 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; }
}
[SerializeField]
private string m_url = string.Empty;
public string URL
{
get { return m_url; }
set { m_url = 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();
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 78b2425a2284af743826c689403a4924
timeCreated: 1492703397
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2800000, guid: 50be8291f9514914aa55c66c49da67cf, type: 3}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,164 @@
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" ) )
{
ASEPackageManagerHelper.SetupLateShaderFunction( m_target );
}
//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();
}
if( m_dependencies.Count > 0 )
{
List<string> assetPaths = new List<string>();
for( int i = 0; i < m_dependencies.Count; i++ )
{
assetPaths.Add( m_dependencies[ i ].AssetPath );
}
if( GUILayout.Button( "Open and Save All" ) )
{
bool doit = EditorUtility.DisplayDialog( "Open and Save All", "This will try to open all shader function and shaders that use this shader function and save them in quick succession, this may irreversibly break your files if something goes wrong. Are you sure you want to try?", "Yes, I'll take the risk", "No, I'll do it myself" );
if( doit )
AmplifyShaderEditorWindow.LoadAndSaveList( assetPaths.ToArray() );
}
}
}
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;
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 8b2d6d1320661374db53aeb8057312b2
timeCreated: 1491909065
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,94 @@
// 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; } }
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 711db07e8265cb740940568c4bc7345f
timeCreated: 1481126956
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,262 @@
// 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 ResetMultipassNodesData()
{
m_multiPassMasterNodeData.Clear();
}
public void AddMultiPassNodesToClipboard( List<TemplateMultiPassMasterNode> masterNodes, bool resetList, int lodId )
{
if( resetList )
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;
System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
masterNodes[ i ].FullWriteToString( ref data, ref connection );
System.Threading.Thread.CurrentThread.CurrentCulture = System.Threading.Thread.CurrentThread.CurrentUICulture;
ClipboardData clipboardData = new ClipboardData( data, connection, masterNodes[ i ].UniqueId );
m_multiPassMasterNodeData.Add( masterNodes[ i ].PassUniqueName + lodId, clipboardData );
}
}
}
public void GetMultiPassNodesFromClipboard( List<TemplateMultiPassMasterNode> masterNodes, int lodId )
{
int templatesAmount = masterNodes.Count;
for( int i = 0; i < templatesAmount; i++ )
{
string clipboardDataId = masterNodes[ i ].PassUniqueName + lodId;
if( m_multiPassMasterNodeData.ContainsKey( clipboardDataId ) )
{
ClipboardData nodeData = m_multiPassMasterNodeData[ clipboardDataId ];
string[] nodeParams = nodeData.Data.Split( IOUtils.FIELD_SEPARATOR );
System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
masterNodes[ i ].FullReadFromString( ref nodeParams );
System.Threading.Thread.CurrentThread.CurrentCulture = System.Threading.Thread.CurrentThread.CurrentUICulture;
}
}
for( int i = 0; i < templatesAmount; i++ )
{
string clipboardDataId = masterNodes[ i ].PassUniqueName + lodId;
if( m_multiPassMasterNodeData.ContainsKey( clipboardDataId ) )
{
masterNodes[ i ].SetReadOptions();
masterNodes[ i ].ForceOptionsRefresh();
}
}
}
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; } }
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 8850a8c4f3ca99f42bbf602c671ffb7f
timeCreated: 1481126957
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,120 @@
// 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; } }
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 291cb40a04f835a4d89037cf3053c6a3
timeCreated: 1481126954
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,309 @@
// 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 = 500;
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( UIUtils.ConsoleLogLabel.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 )
{
if( Event.current.control && Event.current.shift )
{
if( GUILayout.Button( ( count - i ) + ": " + messages[ i ].ItemMessage, labelStyle ) )
{
if( Event.current.button == 1 )
{
EditorGUIUtility.systemCopyBuffer = messages[ i ].ItemMessage;
}
}
}
else
{
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 );
if( Event.current.button == 1 )
{
EditorGUIUtility.systemCopyBuffer = messages[ i ].ItemMessage;
}
}
}
}
}
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 );
if( Event.current.button == 1 )
{
EditorGUIUtility.systemCopyBuffer = messages[ i ].ItemMessage;
}
}
}
}
}
//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 = MAXWIDTH;
}
public void Toggle()
{
}
public void Destroy()
{
m_parentWindow = null;
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: ed706353a579cbb46b300406107108b1
timeCreated: 1506345180
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,81 @@
// 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;
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 417f409230c530b468b8ab67dd6e3b8b
timeCreated: 1481126955
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,53 @@
// 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; }
// }
// }
//}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 79d0d783b532b474192b191547bee1c1
timeCreated: 1481126957
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,213 @@
// 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;
using System.IO;
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;
private string m_root = string.Empty;
#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;
}
private void OnEnable()
{
m_root = Application.dataPath + "/../NodesInfo/";
if( !Directory.Exists( m_root ) )
Directory.CreateDirectory( m_root );
}
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( m_root+"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 CSV Export" ) )
{
window.CurrentNodeExporterUtils.GenerateNodesCSV( m_root );
}
EditorGUILayout.Separator();
if( GUILayout.Button( "Nodes Undo Test" ) )
{
window.CurrentNodeExporterUtils.ActivateAutoUndo();
}
EditorGUILayout.Separator();
if ( GUILayout.Button( "Nodes Info" ) )
{
window.CurrentPaletteWindow.DumpAvailableNodes( false, m_root );
window.CurrentPaletteWindow.DumpAvailableNodes( true, m_root );
}
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" );
}
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 52308890136cd7746a5a073c9be8f028
timeCreated: 1487850100
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,47 @@
// 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;
}
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 41c9bd09aea1377459c7e62910711c22
timeCreated: 1481126955
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

Some files were not shown because too many files have changed in this diff Show More