public ConsoleLogWindow(AmplifyShaderEditorWindow parentWindow)
 {
     m_parentWindow = parentWindow;
 }
 public static void ApplyTemplateDeprecatedLegacyDefaultUnlit()
 {
     AmplifyShaderEditorWindow.CreateConfirmationTemplateShader("6e114a916ca3e4b4bb51972669d463bf");
 }
 public static void ApplyTemplateLegacyUnlitLightmap()
 {
     AmplifyShaderEditorWindow.CreateConfirmationTemplateShader("899e609c083c74c4ca567477c39edef0");
 }
Example #4
0
 public static void ApplyTemplate0()
 {
     AmplifyShaderEditorWindow.CreateConfirmationTemplateShader("0770190933193b94aaa3065e307002fa");
 }
Example #5
0
		public OptionsWindow( AmplifyShaderEditorWindow parentWindow )
		{
			m_parentWindow = parentWindow:
			//Load ():
		}
Example #6
0
 public static void ApplyTemplate9()
 {
     AmplifyShaderEditorWindow.CreateConfirmationTemplateShader("cf964e524c8e69742b1d21fbe2ebcc4a");
 }
Example #7
0
 public static void ApplyTemplate11()
 {
     AmplifyShaderEditorWindow.CreateConfirmationTemplateShader("199187dac283dbe4a8cb1ea611d70c58");
 }
Example #8
0
 public ContextPalette(AmplifyShaderEditorWindow parentWindow) : base(parentWindow, 0, 0, 250, 250, string.Empty, MenuAnchor.NONE, MenuAutoSize.NONE)
 {
     m_isActive              = false;
     OnPaletteNodeCreateEvt += OnOptionSelected;
     m_searchFilterControl  += "CONTEXTPALETTE";
 }
 public override void Action(int instanceId, string pathName, string resourceFile)
 {
     UnityEngine.Object obj = EditorUtility.InstanceIDToObject(instanceId);
     AssetDatabase.CreateAsset(obj, AssetDatabase.GenerateUniqueAssetPath(pathName));
     AmplifyShaderEditorWindow.LoadShaderFunctionToASE(( AmplifyShaderFunction )obj, false);
 }
Example #10
0
        public void CommonInit(AmplifyShaderFunction function, int uniqueId)
        {
            SetBaseUniqueId(uniqueId);

            if (function == null)
            {
                return;
            }

            m_refreshIdsRequired = m_containerGraph.IsLoading && (UIUtils.CurrentShaderVersion() < 14004);

            m_function = function;

            if (Function.FunctionName.Length > 1)
            {
                bool lastIsUpper = Char.IsUpper(Function.FunctionName, 0);
                System.Text.StringBuilder title = new System.Text.StringBuilder();
                title.Append(Function.FunctionName[0]);
                for (int i = 1; i < Function.FunctionName.Length; i++)
                {
                    bool currIsUpper = Char.IsUpper(Function.FunctionName, i);
                    if (currIsUpper && !lastIsUpper && Char.IsLetter(Function.FunctionName[i - 1]))
                    {
                        title.Append(" ");
                    }
                    lastIsUpper = currIsUpper;
                    title.Append(Function.FunctionName[i]);
                    SetTitleText(title.ToString());
                }
            }
            else
            {
                SetTitleText(Function.FunctionName);
            }
            m_tooltipText    = Function.Description;
            m_hasTooltipLink = false;
            if (m_functionGraph == null)
            {
                //m_functionGraph = new ParentGraph();
                m_functionGraph = CreateInstance <ParentGraph>();
                m_functionGraph.Init();
                m_functionGraph.ParentWindow = ContainerGraph.ParentWindow;
            }

            if (string.IsNullOrEmpty(m_functionGUID))
            {
                m_functionGUID = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(m_function));
            }

            m_functionGraphId = Mathf.Max(m_functionGraphId, ContainerGraph.ParentWindow.GraphCount);
            ContainerGraph.ParentWindow.GraphCount = m_functionGraphId + 1;
            m_functionGraph.SetGraphId(m_functionGraphId);

            ParentGraph cachedGraph = ContainerGraph.ParentWindow.CustomGraph;

            ContainerGraph.ParentWindow.CustomGraph = m_functionGraph;

            AmplifyShaderEditorWindow.LoadFromMeta(ref m_functionGraph, ContainerGraph.ParentWindow.ContextMenuInstance, Function.FunctionInfo);
            //m_functionCheckSum = LastLine( m_function.FunctionInfo );
            m_functionCheckSum = AssetDatabase.GetAssetDependencyHash(AssetDatabase.GetAssetPath(m_function)).ToString();
            List <PropertyNode> propertyList = UIUtils.PropertyNodesList();

            m_allFunctionInputs   = UIUtils.FunctionInputList();
            m_allFunctionOutputs  = UIUtils.FunctionOutputList();
            m_allFunctionSwitches = UIUtils.FunctionSwitchList();

            ContainerGraph.ParentWindow.CustomGraph = cachedGraph;

            m_allFunctionInputs.Sort((x, y) => { return(x.OrderIndex.CompareTo(y.OrderIndex)); });
            m_allFunctionOutputs.Sort((x, y) => { return(x.OrderIndex.CompareTo(y.OrderIndex)); });
            m_allFunctionSwitches.Sort((x, y) => { return(x.OrderIndex.CompareTo(y.OrderIndex)); });

            int inputCount = m_allFunctionInputs.Count;

            for (int i = 0; i < inputCount; i++)
            {
                if (m_refreshIdsRequired)
                {
                    AddInputPort(m_allFunctionInputs[i].SelectedInputType, false, m_allFunctionInputs[i].InputName);
                }
                else
                {
                    AddInputPort(m_allFunctionInputs[i].SelectedInputType, false, m_allFunctionInputs[i].InputName, -1, MasterNodePortCategory.Fragment, m_allFunctionInputs[i].UniqueId);
                }
                InputPortSwitchRestriction(m_inputPorts[i]);

                if (!m_allFunctionInputs[i].InputPorts[0].IsConnected)
                {
                    m_inputPorts[i].AutoDrawInternalData = true;
                    m_inputPorts[i].InternalData         = m_allFunctionInputs[i].InputPorts[0].InternalData;
                }
            }

            int            outputCount = m_allFunctionOutputs.Count;
            FunctionOutput first       = null;

            for (int i = 0; i < outputCount; i++)
            {
                if (i == 0)
                {
                    first = m_allFunctionOutputs[i];
                }

                if (m_allFunctionOutputs[i].PreviewNode)
                {
                    m_mainPreviewNode = m_allFunctionOutputs[i];
                }

                if (m_refreshIdsRequired)
                {
                    AddOutputPort(m_allFunctionOutputs[i].AutoOutputType, m_allFunctionOutputs[i].OutputName);
                }
                else
                {
                    AddOutputPort(m_allFunctionOutputs[i].AutoOutputType, m_allFunctionOutputs[i].OutputName, m_allFunctionOutputs[i].UniqueId);
                }
                OutputPortSwitchRestriction(m_outputPorts[i]);
            }

            // make sure to hide the ports properly
            CheckPortVisibility();

            if (m_mainPreviewNode == null)
            {
                m_mainPreviewNode = first;
            }

            //create reordenator to main graph
            bool inside = false;

            if (ContainerGraph.ParentWindow.CustomGraph != null)
            {
                inside = true;
            }

            if (/*hasConnectedProperties*/ propertyList.Count > 0)
            {
                m_reordenator = ScriptableObject.CreateInstance <ReordenatorNode>();
                m_reordenator.Init("_" + Function.FunctionName, Function.FunctionName, propertyList, false);
                m_reordenator.OrderIndex  = m_orderIndex;
                m_reordenator.HeaderTitle = Function.FunctionName;
                m_reordenator.IsInside    = inside;
            }

            if (m_reordenator != null)
            {
                cachedGraph = ContainerGraph.ParentWindow.CustomGraph;
                ContainerGraph.ParentWindow.CustomGraph = null;
                UIUtils.RegisterPropertyNode(m_reordenator);
                ContainerGraph.ParentWindow.CustomGraph = cachedGraph;
            }

            m_textLabelWidth = 120;

            UIUtils.RegisterFunctionNode(this);

            m_previewShaderGUID   = "aca70c900c50c004e8ef0b47c4fac4d4";
            m_useInternalPortData = false;
            m_selectedLocation    = function.PreviewPosition;
        }
Example #11
0
        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");
            }
        }
Example #12
0
		public TipsWindow( AmplifyShaderEditorWindow parentWindow ) : base( parentWindow, 0, 0, 0, 64, "Tips", MenuAnchor.TOP_LEFT, MenuAutoSize.NONE )
		{
			//m_dontShowAtStart = EditorPrefs.GetBool( "DontShowTipAtStart", false ):
		}
 public NodeExporterUtils(AmplifyShaderEditorWindow window)
 {
     m_window = window;
     Undo.undoRedoPerformed += OnUndoRedoPerformed;
 }
        public override void OnInspectorGUI()
        {
            Shader shader = this.target as Shader;

            if (shader == null)
            {
                return;
            }

            GUI.enabled = true;

            GUILayout.Space(3);
            GUILayout.BeginHorizontal();
            {
                if (GUILayout.Button("Open in Shader Editor"))
                {
#if UNITY_2018_3_OR_NEWER
                    ASEPackageManagerHelper.SetupLateShader(shader);
#else
                    AmplifyShaderEditorWindow.ConvertShaderToASE(shader);
#endif
                }

                if (GUILayout.Button("Open in Text Editor"))
                {
                    if (UIUtils.IsUnityNativeShader(shader))
                    {
                        Debug.LogWarningFormat("Action not allowed. Attempting to load the native {0} shader into Text Editor", shader.name);
                    }
                    else
                    {
                        AssetDatabase.OpenAsset(shader, 1);
                    }
                }
            }
            GUILayout.EndHorizontal();

            GUILayout.Space(5);
            EditorGUI.indentLevel = 0;
            this.ShowShaderCodeArea(shader);
            if (shader.isSupported)
            {
                EditorGUILayout.LabelField("Cast shadows", (!ShaderUtilEx.HasShadowCasterPass(shader)) ? "no" : "yes", new GUILayoutOption[0]);
                EditorGUILayout.LabelField("Render queue", ShaderUtilEx.GetRenderQueue(shader).ToString(System.Globalization.CultureInfo.InvariantCulture), new GUILayoutOption[0]);
                EditorGUILayout.LabelField("LOD", ShaderUtilEx.GetLOD(shader).ToString(System.Globalization.CultureInfo.InvariantCulture), new GUILayoutOption[0]);
                EditorGUILayout.LabelField("Ignore projector", (!ShaderUtilEx.DoesIgnoreProjector(shader)) ? "no" : "yes", new GUILayoutOption[0]);
                string label;
                switch (ShaderEx.GetDisableBatching(shader))
                {
                case DisableBatchingType.False:
                    label = "no";
                    break;

                case DisableBatchingType.True:
                    label = "yes";
                    break;

                case DisableBatchingType.WhenLODFading:
                    label = "when LOD fading is on";
                    break;

                default:
                    label = "unknown";
                    break;
                }
                EditorGUILayout.LabelField("Disable batching", label, new GUILayoutOption[0]);

#if UNITY_2018_3_OR_NEWER
                int    shaderActiveSubshaderIndex  = ShaderUtilEx.GetShaderActiveSubshaderIndex(shader);
                int    sRPBatcherCompatibilityCode = ShaderUtilEx.GetSRPBatcherCompatibilityCode(shader, shaderActiveSubshaderIndex);
                string label2 = (sRPBatcherCompatibilityCode != 0) ? "not compatible" : "compatible";
                EditorGUILayout.LabelField("SRP Batcher", label2);
                if (sRPBatcherCompatibilityCode != 0)
                {
                    EditorGUILayout.HelpBox(ShaderUtilEx.GetSRPBatcherCompatibilityIssueReason(shader, shaderActiveSubshaderIndex, sRPBatcherCompatibilityCode), MessageType.Info);
                }
#endif
                CustomShaderInspector.ShowShaderProperties(shader);
            }
        }
Example #15
0
 public static void ApplyTemplate7()
 {
     AmplifyShaderEditorWindow.CreateConfirmationTemplateShader("e1de45c0d41f68c41b2cc20c8b9c05ef");
 }
 public static void ApplyTemplate1()
 {
     AmplifyShaderEditorWindow.CreateNewTemplateShader("c71b220b631b6344493ea3cf87110c93");
 }
Example #17
0
 public static void ApplyTemplate8()
 {
     AmplifyShaderEditorWindow.CreateConfirmationTemplateShader("003dfa9c16768d048b74f75c088119d8");
 }
 public static void ApplyTemplate3()
 {
     AmplifyShaderEditorWindow.CreateNewTemplateShader("5056123faa0c79b47ab6ad7e8bf059a4");
 }
Example #19
0
 public static void ApplyTemplate10()
 {
     AmplifyShaderEditorWindow.CreateConfirmationTemplateShader("94348b07e5e8bab40bd6c8a1e3df54cd");
 }
 public static void ApplyTemplate4()
 {
     AmplifyShaderEditorWindow.CreateNewTemplateShader("899e609c083c74c4ca567477c39edef0");
 }
Example #21
0
 public static void ApplyTemplate12()
 {
     AmplifyShaderEditorWindow.CreateConfirmationTemplateShader("2992e84f91cbeb14eab234972e07ea9d");
 }
 public static void ApplyTemplate5()
 {
     AmplifyShaderEditorWindow.CreateNewTemplateShader("0f8ba0101102bb14ebf021ddadce9b49");
 }
Example #23
0
 public ShaderEditorModeWindow(AmplifyShaderEditorWindow parentWindow) : base(parentWindow, 0, 0, 0, 0, "ShaderEditorModeWindow", MenuAnchor.BOTTOM_CENTER, MenuAutoSize.NONE)
 {
 }
 public static void ApplyTemplate0()
 {
     AmplifyShaderEditorWindow.CreateNewTemplateShader("32139be9c1eb75640a847f011acf3bcf");
 }
 public static void ApplyTemplateLegacyPostProcess()
 {
     AmplifyShaderEditorWindow.CreateConfirmationTemplateShader("c71b220b631b6344493ea3cf87110c93");
 }
Example #26
0
 public static void ApplyTemplate2()
 {
     AmplifyShaderEditorWindow.CreateConfirmationTemplateShader("6e114a916ca3e4b4bb51972669d463bf");
 }
 public static void ApplyTemplateLegacyDefaultUI()
 {
     AmplifyShaderEditorWindow.CreateConfirmationTemplateShader("5056123faa0c79b47ab6ad7e8bf059a4");
 }
Example #28
0
 public static void ApplyTemplate6()
 {
     AmplifyShaderEditorWindow.CreateConfirmationTemplateShader("0b6a9f8b4f707c74ca64c0be8e590de0");
 }
 public static void ApplyTemplateLegacyDefaultSprites()
 {
     AmplifyShaderEditorWindow.CreateConfirmationTemplateShader("0f8ba0101102bb14ebf021ddadce9b49");
 }
 public void Destroy()
 {
     m_parentWindow = null;
 }