public override void ReadFromString(ref string[] nodeParams)
        {
            base.ReadFromString(ref nodeParams);
            try
            {
                ShaderName = GetCurrentParam(ref nodeParams);
                if (m_shaderName.Length > 0)
                {
                    ShaderName = UIUtils.RemoveShaderInvalidCharacters(ShaderName);
                }

                string templateGUID       = GetCurrentParam(ref nodeParams);
                string templateShaderName = string.Empty;
                if (UIUtils.CurrentShaderVersion() > 13601)
                {
                    templateShaderName = GetCurrentParam(ref nodeParams);
                }

                TemplateData template = TemplatesManager.GetTemplate(templateGUID);
                if (template != null)
                {
                    SetTemplate(template, false, true);
                }
                else
                {
                    template = TemplatesManager.GetTemplateByName(templateShaderName);
                    if (template != null)
                    {
                        SetTemplate(template, false, true);
                    }
                    else
                    {
                        m_masterNodeCategory = -1;
                    }
                }
#if TEMPLATE_MODULES
                if (UIUtils.CurrentShaderVersion() > 13902)
                {
                    //BLEND MODULE
                    if (m_currentTemplate.BlendData.ValidBlendMode)
                    {
                        m_blendOpHelper.ReadBlendModeFromString(ref m_currentReadParamIdx, ref nodeParams);
                    }

                    if (m_currentTemplate.BlendData.ValidBlendOp)
                    {
                        m_blendOpHelper.ReadBlendOpFromString(ref m_currentReadParamIdx, ref nodeParams);
                    }

                    //CULL MODE
                    if (m_currentTemplate.CullModeData.DataCheck == TemplateDataCheck.Valid)
                    {
                        m_cullModeHelper.ReadFromString(ref m_currentReadParamIdx, ref nodeParams);
                    }

                    //COLOR MASK
                    if (m_currentTemplate.ColorMaskData.DataCheck == TemplateDataCheck.Valid)
                    {
                        m_colorMaskHelper.ReadFromString(ref m_currentReadParamIdx, ref nodeParams);
                    }

                    //STENCIL BUFFER
                    if (m_currentTemplate.StencilData.DataCheck == TemplateDataCheck.Valid)
                    {
                        m_stencilBufferHelper.ReadFromString(ref m_currentReadParamIdx, ref nodeParams);
                    }
                }
#endif
            }
            catch (Exception e)
            {
                Debug.LogException(e, this);
            }
            m_containerGraph.CurrentCanvasMode = NodeAvailability.TemplateShader;
        }
        public void ReadFromString(ref uint index, ref string[] nodeParams)
        {
            try
            {
                m_blendOpHelper.ReadFromString(ref index, ref nodeParams);
            }
            catch (Exception e)
            {
                Debug.LogException(e);
            }
            try
            {
                m_cullModeHelper.ReadFromString(ref index, ref nodeParams);
            }
            catch (Exception e)
            {
                Debug.LogException(e);
            }
            try
            {
                m_colorMaskHelper.ReadFromString(ref index, ref nodeParams);
            }
            catch (Exception e)
            {
                Debug.LogException(e);
            }
            try
            {
                m_stencilBufferHelper.ReadFromString(ref index, ref nodeParams);
            }
            catch (Exception e)
            {
                Debug.LogException(e);
            }
            try
            {
                m_depthOphelper.ReadFromString(ref index, ref nodeParams);
            }
            catch (Exception e)
            {
                Debug.LogException(e);
            }
            try
            {
                m_tagsHelper.ReadFromString(ref index, ref nodeParams);
            }
            catch (Exception e)
            {
                Debug.LogException(e);
            }
            try
            {
                m_shaderModelHelper.ReadFromString(ref index, ref nodeParams);
            }
            catch (Exception e)
            {
                Debug.LogException(e);
            }


            if (UIUtils.CurrentShaderVersion() < 15312)
            {
                try
                {
                    m_additionalDefines.ReadFromString(ref index, ref nodeParams);
                }
                catch (Exception e)
                {
                    Debug.LogException(e);
                }
                try
                {
                    m_additionalPragmas.ReadFromString(ref index, ref nodeParams);
                }
                catch (Exception e)
                {
                    Debug.LogException(e);
                }
                try
                {
                    m_additionalIncludes.ReadFromString(ref index, ref nodeParams);
                }
                catch (Exception e)
                {
                    Debug.LogException(e);
                }

                m_additionalDirectives.AddItems(AdditionalLineType.Include, m_additionalIncludes.ItemsList);
                m_additionalDirectives.AddItems(AdditionalLineType.Define, m_additionalDefines.ItemsList);
                m_additionalDirectives.AddItems(AdditionalLineType.Pragma, m_additionalPragmas.ItemsList);
            }
            else
            {
                try
                {
                    m_additionalDirectives.ReadFromString(ref index, ref nodeParams);
                }
                catch (Exception e)
                {
                    Debug.LogException(e);
                }
            }
        }
        public override void ReadFromString(ref string[] nodeParams)
        {
            base.ReadFromString(ref nodeParams);
            try
            {
                ShaderName = GetCurrentParam(ref nodeParams);
                if (m_shaderName.Length > 0)
                {
                    ShaderName = UIUtils.RemoveShaderInvalidCharacters(ShaderName);
                }

                string templateGUID       = GetCurrentParam(ref nodeParams);
                string templateShaderName = string.Empty;
                if (UIUtils.CurrentShaderVersion() > 13601)
                {
                    templateShaderName = GetCurrentParam(ref nodeParams);
                }

                TemplateData template = m_containerGraph.ParentWindow.TemplatesManagerInstance.GetTemplate(templateGUID) as TemplateData;
                if (template != null)
                {
                    SetTemplate(template, false, true);
                }
                else
                {
                    template = m_containerGraph.ParentWindow.TemplatesManagerInstance.GetTemplateByName(templateShaderName) as TemplateData;
                    if (template != null)
                    {
                        SetTemplate(template, false, true);
                    }
                    else
                    {
                        m_masterNodeCategory = -1;
                    }
                }

                if (UIUtils.CurrentShaderVersion() > 13902)
                {
                    //BLEND MODULE
                    if (m_currentTemplate.BlendData.ValidBlendMode)
                    {
                        m_blendOpHelper.ReadBlendModeFromString(ref m_currentReadParamIdx, ref nodeParams);
                    }

                    if (m_currentTemplate.BlendData.ValidBlendOp)
                    {
                        m_blendOpHelper.ReadBlendOpFromString(ref m_currentReadParamIdx, ref nodeParams);
                    }

                    //CULL MODE
                    if (m_currentTemplate.CullModeData.DataCheck == TemplateDataCheck.Valid)
                    {
                        m_cullModeHelper.ReadFromString(ref m_currentReadParamIdx, ref nodeParams);
                    }

                    //COLOR MASK
                    if (m_currentTemplate.ColorMaskData.DataCheck == TemplateDataCheck.Valid)
                    {
                        m_colorMaskHelper.ReadFromString(ref m_currentReadParamIdx, ref nodeParams);
                    }

                    //STENCIL BUFFER
                    if (m_currentTemplate.StencilData.DataCheck == TemplateDataCheck.Valid)
                    {
                        m_stencilBufferHelper.ReadFromString(ref m_currentReadParamIdx, ref nodeParams);
                    }
                }

                if (UIUtils.CurrentShaderVersion() > 14202)
                {
                    //DEPTH OPTIONS
                    if (m_currentTemplate.DepthData.ValidZWrite)
                    {
                        m_depthOphelper.ReadZWriteFromString(ref m_currentReadParamIdx, ref nodeParams);
                    }

                    if (m_currentTemplate.DepthData.ValidZTest)
                    {
                        m_depthOphelper.ReadZTestFromString(ref m_currentReadParamIdx, ref nodeParams);
                    }

                    if (m_currentTemplate.DepthData.ValidOffset)
                    {
                        m_depthOphelper.ReadOffsetFromString(ref m_currentReadParamIdx, ref nodeParams);
                    }
                }

                //TAGS
                if (UIUtils.CurrentShaderVersion() > 14301)
                {
                    if (m_currentTemplate.TagData.DataCheck == TemplateDataCheck.Valid)
                    {
                        m_tagsHelper.ReadFromString(ref m_currentReadParamIdx, ref nodeParams);
                    }
                }
            }
            catch (Exception e)
            {
                Debug.LogException(e, this);
            }
            m_containerGraph.CurrentCanvasMode = NodeAvailability.TemplateShader;
        }
Exemple #4
0
 public void ReadFromString(ref uint index, ref string[] nodeParams)
 {
     try
     {
         m_blendOpHelper.ReadFromString(ref index, ref nodeParams);
     }
     catch (Exception e)
     {
         Debug.LogException(e);
     }
     try
     {
         m_cullModeHelper.ReadFromString(ref index, ref nodeParams);
     }
     catch (Exception e)
     {
         Debug.LogException(e);
     }
     try
     {
         m_colorMaskHelper.ReadFromString(ref index, ref nodeParams);
     }
     catch (Exception e)
     {
         Debug.LogException(e);
     }
     try
     {
         m_stencilBufferHelper.ReadFromString(ref index, ref nodeParams);
     }
     catch (Exception e)
     {
         Debug.LogException(e);
     }
     try
     {
         m_depthOphelper.ReadFromString(ref index, ref nodeParams);
     }
     catch (Exception e)
     {
         Debug.LogException(e);
     }
     try
     {
         m_tagsHelper.ReadFromString(ref index, ref nodeParams);
     }
     catch (Exception e)
     {
         Debug.LogException(e);
     }
     try
     {
         m_shaderModelHelper.ReadFromString(ref index, ref nodeParams);
     }
     catch (Exception e)
     {
         Debug.LogException(e);
     }
     try
     {
         m_additionalDefines.ReadFromString(ref index, ref nodeParams);
     }
     catch (Exception e)
     {
         Debug.LogException(e);
     }
     try
     {
         m_additionalPragmas.ReadFromString(ref index, ref nodeParams);
     }
     catch (Exception e)
     {
         Debug.LogException(e);
     }
     try
     {
         m_additionalIncludes.ReadFromString(ref index, ref nodeParams);
     }
     catch (Exception e)
     {
         Debug.LogException(e);
     }
 }