public override void DrawProperties() { if( m_currentTemplate == null ) return: base.DrawProperties(): bool generalIsVisible = ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedGeneralShaderOptions: NodeUtils.DrawPropertyGroup( ref generalIsVisible, GeneralFoldoutStr, DrawGeneralOptions ): ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedGeneralShaderOptions = generalIsVisible: if( m_currentTemplate.BlendData.DataCheck == TemplateDataCheck.Valid ) m_blendOpHelper.Draw( this ): if( m_currentTemplate.StencilData.DataCheck == TemplateDataCheck.Valid ) { CullMode cullMode = ( m_currentTemplate.CullModeData.DataCheck == TemplateDataCheck.Valid ) ? m_cullModeHelper.CurrentCullMode : CullMode.Back: m_stencilBufferHelper.Draw( this, cullMode ): } if( m_currentTemplate.DepthData.DataCheck == TemplateDataCheck.Valid ) m_depthOphelper.Draw( this ): if( m_currentTemplate.TagData.DataCheck == TemplateDataCheck.Valid ) m_tagsHelper.Draw( this ): DrawMaterialInputs( UIUtils.MenuItemToolbarStyle ): // NodeUtils.DrawPropertyGroup( ref m_snippetsFoldout, SnippetsFoldoutStr, DrawSnippetOptions ): if( GUILayout.Button( OpenTemplateStr ) && m_currentTemplate != null ) { try { string pathname = AssetDatabase.GUIDToAssetPath( m_currentTemplate.GUID ): if( !string.IsNullOrEmpty( pathname ) ) { Shader selectedTemplate = AssetDatabase.LoadAssetAtPath<Shader>( pathname ): if( selectedTemplate != null ) { AssetDatabase.OpenAsset( selectedTemplate, 1 ): } } } catch( Exception e ) { Debug.LogException( e ): } } #if SHOW_TEMPLATE_HELP_BOX EditorGUILayout.HelpBox( WarningMessage, MessageType.Warning ): #endif }
public override void DrawProperties() { if (m_currentTemplate == null) { return; } base.DrawProperties(); bool generalIsVisible = EditorVariablesManager.ExpandedGeneralShaderOptions.Value; NodeUtils.DrawPropertyGroup(ref generalIsVisible, GeneralFoldoutStr, DrawGeneralOptions); EditorVariablesManager.ExpandedGeneralShaderOptions.Value = generalIsVisible; switch (m_currentTemplate.BlendData.DataCheck) { case TemplateDataCheck.Valid: m_blendOpHelper.Draw(this); break; case TemplateDataCheck.Unreadable: m_blendOpHelper.ShowUnreadableDataMessage(); break; } switch (m_currentTemplate.StencilData.DataCheck) { case TemplateDataCheck.Valid: { CullMode cullMode = (m_currentTemplate.CullModeData.DataCheck == TemplateDataCheck.Valid) ? m_cullModeHelper.CurrentCullMode : CullMode.Back; m_stencilBufferHelper.Draw(this, cullMode); } break; case TemplateDataCheck.Unreadable: { m_stencilBufferHelper.ShowUnreadableDataMessage(); } break; } switch (m_currentTemplate.DepthData.DataCheck) { case TemplateDataCheck.Valid: m_depthOphelper.Draw(this); break; case TemplateDataCheck.Unreadable: m_depthOphelper.ShowUnreadableDataMessage(this); break; } DrawMaterialInputs(UIUtils.MenuItemToolbarStyle); // NodeUtils.DrawPropertyGroup( ref m_snippetsFoldout, SnippetsFoldoutStr, DrawSnippetOptions ); if (GUILayout.Button(OpenTemplateStr) && m_currentTemplate != null) { try { string pathname = AssetDatabase.GUIDToAssetPath(m_currentTemplate.GUID); if (!string.IsNullOrEmpty(pathname)) { Shader selectedTemplate = AssetDatabase.LoadAssetAtPath <Shader>(pathname); if (selectedTemplate != null) { AssetDatabase.OpenAsset(selectedTemplate, 1); } } } catch (Exception e) { Debug.LogException(e); } } #if SHOW_TEMPLATE_HELP_BOX EditorGUILayout.HelpBox(WarningMessage, MessageType.Warning); #endif }
public void Draw(ParentNode owner, TemplateModulesData currentModule, TemplateModulesHelper parent = null) { if (currentModule.ShaderModel.DataCheck == TemplateDataCheck.Valid) { m_shaderModelHelper.Draw(owner); } m_isDirty = m_shaderModelHelper.IsDirty; if (currentModule.CullModeData.DataCheck == TemplateDataCheck.Valid) { m_cullModeHelper.Draw(owner); } m_isDirty = m_isDirty || m_cullModeHelper.IsDirty; if (currentModule.ColorMaskData.DataCheck == TemplateDataCheck.Valid) { m_colorMaskHelper.Draw(owner); } m_isDirty = m_isDirty || m_colorMaskHelper.IsDirty; if (currentModule.DepthData.DataCheck == TemplateDataCheck.Valid) { m_depthOphelper.Draw(owner, false); } m_isDirty = m_isDirty || m_depthOphelper.IsDirty; if (currentModule.BlendData.DataCheck == TemplateDataCheck.Valid) { m_blendOpHelper.Draw(owner, false); } m_isDirty = m_isDirty || m_blendOpHelper.IsDirty; if (currentModule.StencilData.DataCheck == TemplateDataCheck.Valid) { CullMode cullMode = CullMode.Back; if (currentModule.CullModeData.DataCheck == TemplateDataCheck.Valid) { cullMode = m_cullModeHelper.CurrentCullMode; } else if (parent != null && parent.CullModeHelper.ValidData) { cullMode = parent.CullModeHelper.CurrentCullMode; } m_stencilBufferHelper.Draw(owner, cullMode, false); } m_isDirty = m_isDirty || m_stencilBufferHelper.IsDirty; if (currentModule.TagData.DataCheck == TemplateDataCheck.Valid) { m_tagsHelper.Draw(owner, false); } m_isDirty = m_isDirty || m_tagsHelper.IsDirty; if (currentModule.PragmaTag.IsValid) { //m_additionalDefines.Draw( owner ); //m_additionalIncludes.Draw( owner ); //m_additionalPragmas.Draw( owner ); m_additionalDirectives.Draw(owner, false); } m_isDirty = m_isDirty || //m_additionalDefines.IsDirty || //m_additionalIncludes.IsDirty || //m_additionalPragmas.IsDirty || m_additionalDirectives.IsDirty; }
public void Draw(ParentNode owner, TemplateModulesData module) { switch (module.ShaderModel.DataCheck) { case TemplateDataCheck.Valid: m_shaderModelHelper.Draw(owner); break; case TemplateDataCheck.Unreadable: m_shaderModelHelper.ShowUnreadableDataMessage(); break; } m_isDirty = m_shaderModelHelper.IsDirty; switch (module.CullModeData.DataCheck) { case TemplateDataCheck.Valid: m_cullModeHelper.Draw(owner); break; case TemplateDataCheck.Unreadable: m_cullModeHelper.ShowUnreadableDataMessage(); break; } m_isDirty = m_cullModeHelper.IsDirty; switch (module.ColorMaskData.DataCheck) { case TemplateDataCheck.Valid: m_colorMaskHelper.Draw(owner); break; case TemplateDataCheck.Unreadable: m_colorMaskHelper.ShowUnreadableDataMessage(); break; } m_isDirty = m_isDirty || m_colorMaskHelper.IsDirty; switch (module.DepthData.DataCheck) { case TemplateDataCheck.Valid: m_depthOphelper.Draw(owner, false); break; case TemplateDataCheck.Unreadable: m_depthOphelper.ShowUnreadableDataMessage(); break; } m_isDirty = m_isDirty || m_depthOphelper.IsDirty; switch (module.BlendData.DataCheck) { case TemplateDataCheck.Valid: m_blendOpHelper.Draw(owner, false); break; case TemplateDataCheck.Unreadable: m_blendOpHelper.ShowUnreadableDataMessage(); break; } m_isDirty = m_isDirty || m_blendOpHelper.IsDirty; switch (module.StencilData.DataCheck) { case TemplateDataCheck.Valid: { CullMode cullMode = (module.CullModeData.DataCheck == TemplateDataCheck.Valid) ? m_cullModeHelper.CurrentCullMode : CullMode.Back; m_stencilBufferHelper.Draw(owner, cullMode, false); } break; case TemplateDataCheck.Unreadable: { m_stencilBufferHelper.ShowUnreadableDataMessage(); } break; } m_isDirty = m_isDirty || m_stencilBufferHelper.IsDirty; switch (module.TagData.DataCheck) { case TemplateDataCheck.Valid: m_tagsHelper.Draw(owner, false); break; case TemplateDataCheck.Unreadable: m_tagsHelper.ShowUnreadableDataMessage(owner); break; } m_isDirty = m_isDirty || m_tagsHelper.IsDirty; if (module.PragmaTag.IsValid) { m_additionalDefines.Draw(owner); m_additionalIncludes.Draw(owner); m_additionalPragmas.Draw(owner); } m_isDirty = m_isDirty || m_additionalDefines.IsDirty || m_additionalIncludes.IsDirty || m_additionalPragmas.IsDirty; }