public override void DrawProperties()
        {
            if (m_currentTemplate == null)
            {
                return;
            }

            base.DrawProperties();

            bool generalIsVisible = ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedGeneralShaderOptions;

            NodeUtils.DrawPropertyGroup(ref generalIsVisible, GeneralFoldoutStr, DrawGeneralOptions);
            ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedGeneralShaderOptions = generalIsVisible;

            if (m_currentTemplate.AlphaToMaskData.DataCheck == TemplateDataCheck.Valid)
            {
                m_alphaToMaskHelper.Draw(this);
            }

            if (m_currentTemplate.BlendData.DataCheck == TemplateDataCheck.Valid)
            {
                m_blendOpHelper.Draw(this);
            }


            if (m_currentTemplate.StencilData.DataCheck == TemplateDataCheck.Valid)
            {
                CullMode cullMode = (m_currentTemplate.CullModeData.DataCheck == TemplateDataCheck.Valid) ? m_cullModeHelper.CurrentCullMode : CullMode.Back;
                m_stencilBufferHelper.Draw(this, cullMode);
            }

            if (m_currentTemplate.DepthData.DataCheck == TemplateDataCheck.Valid)
            {
                m_depthOphelper.Draw(this);
            }

            if (m_currentTemplate.TagData.DataCheck == TemplateDataCheck.Valid)
            {
                m_tagsHelper.Draw(this);
            }

            DrawMaterialInputs(UIUtils.MenuItemToolbarStyle);

            //	NodeUtils.DrawPropertyGroup( ref m_snippetsFoldout, SnippetsFoldoutStr, DrawSnippetOptions );
            if (GUILayout.Button(OpenTemplateStr) && m_currentTemplate != null)
            {
                try
                {
                    string pathname = AssetDatabase.GUIDToAssetPath(m_currentTemplate.GUID);
                    if (!string.IsNullOrEmpty(pathname))
                    {
                        Shader selectedTemplate = AssetDatabase.LoadAssetAtPath <Shader>(pathname);
                        if (selectedTemplate != null)
                        {
                            AssetDatabase.OpenAsset(selectedTemplate, 1);
                        }
                    }
                }
                catch (Exception e)
                {
                    Debug.LogException(e);
                }
            }

#if SHOW_TEMPLATE_HELP_BOX
            EditorGUILayout.HelpBox(WarningMessage, MessageType.Warning);
#endif
        }
예제 #2
0
        public void Draw(ParentNode owner, TemplateModulesData currentModule, TemplateModulesHelper parent = null)
        {
            if (currentModule.ShaderModel.DataCheck == TemplateDataCheck.Valid)
            {
                m_shaderModelHelper.Draw(owner);
            }

            m_isDirty = m_shaderModelHelper.IsDirty;

            if (currentModule.CullModeData.DataCheck == TemplateDataCheck.Valid)
            {
                m_cullModeHelper.Draw(owner);
            }

            m_isDirty = m_isDirty || m_cullModeHelper.IsDirty;

            if (currentModule.ColorMaskData.DataCheck == TemplateDataCheck.Valid)
            {
                m_colorMaskHelper.Draw(owner);
            }

            m_isDirty = m_isDirty || m_colorMaskHelper.IsDirty;

            if (currentModule.ColorMaskData1.DataCheck == TemplateDataCheck.Valid)
            {
                m_colorMaskHelper1.Draw(owner);
            }

            m_isDirty = m_isDirty || m_colorMaskHelper1.IsDirty;

            if (currentModule.ColorMaskData2.DataCheck == TemplateDataCheck.Valid)
            {
                m_colorMaskHelper2.Draw(owner);
            }

            m_isDirty = m_isDirty || m_colorMaskHelper2.IsDirty;

            if (currentModule.ColorMaskData3.DataCheck == TemplateDataCheck.Valid)
            {
                m_colorMaskHelper3.Draw(owner);
            }

            m_isDirty = m_isDirty || m_colorMaskHelper3.IsDirty;

            if (currentModule.AlphaToMaskData.DataCheck == TemplateDataCheck.Valid)
            {
                m_alphaToMaskHelper.Draw(owner);
            }

            m_isDirty = m_isDirty || m_alphaToMaskHelper.IsDirty;

            if (currentModule.DepthData.DataCheck == TemplateDataCheck.Valid)
            {
                m_depthOphelper.Draw(owner, false);
            }

            m_isDirty = m_isDirty || m_depthOphelper.IsDirty;

            if (currentModule.BlendData.DataCheck == TemplateDataCheck.Valid)
            {
                m_blendOpHelper.Draw(owner, false);
            }

            m_isDirty = m_isDirty || m_blendOpHelper.IsDirty;

            if (currentModule.BlendData1.DataCheck == TemplateDataCheck.Valid)
            {
                m_blendOpHelper1.Draw(owner, false);
            }

            m_isDirty = m_isDirty || m_blendOpHelper1.IsDirty;

            if (currentModule.BlendData2.DataCheck == TemplateDataCheck.Valid)
            {
                m_blendOpHelper2.Draw(owner, false);
            }

            m_isDirty = m_isDirty || m_blendOpHelper2.IsDirty;

            if (currentModule.BlendData3.DataCheck == TemplateDataCheck.Valid)
            {
                m_blendOpHelper3.Draw(owner, false);
            }

            m_isDirty = m_isDirty || m_blendOpHelper3.IsDirty;


            if (currentModule.StencilData.DataCheck == TemplateDataCheck.Valid)
            {
                CullMode cullMode = CullMode.Back;
                if (currentModule.CullModeData.DataCheck == TemplateDataCheck.Valid)
                {
                    cullMode = m_cullModeHelper.CurrentCullMode;
                }
                else if (parent != null && parent.CullModeHelper.ValidData)
                {
                    cullMode = parent.CullModeHelper.CurrentCullMode;
                }
                m_stencilBufferHelper.Draw(owner, cullMode, false);
            }

            m_isDirty = m_isDirty || m_stencilBufferHelper.IsDirty;

            if (currentModule.TagData.DataCheck == TemplateDataCheck.Valid)
            {
                m_tagsHelper.Draw(owner, false);
            }

            m_isDirty = m_isDirty || m_tagsHelper.IsDirty;

            if (currentModule.PragmaTag.IsValid)
            {
                //m_additionalDefines.Draw( owner );
                //m_additionalIncludes.Draw( owner );
                //m_additionalPragmas.Draw( owner );
                m_additionalDirectives.Draw(owner, false);
            }

            if (currentModule.RenderPlatformHelper.IsValid)
            {
                m_renderingPlatforms.DrawNested(owner);
            }

            m_isDirty = m_isDirty ||
                        //m_additionalDefines.IsDirty ||
                        //m_additionalIncludes.IsDirty ||
                        //m_additionalPragmas.IsDirty ||
                        m_additionalDirectives.IsDirty;
        }