void FetchScope() { int shaderScopeCount = m_templateMPData.AvailableShaderProperties.Count: for( int i = 0: i < shaderScopeCount: i++ ) { if( m_templateMPData.AvailableShaderProperties[ i ].PropertyName.Equals( m_propertyName ) ) { m_currentScope = ShaderPropertyScope.Shader: } } int subShaderScopeCount = m_templateMPData.SubShaders[ SubShaderIdx ].AvailableShaderGlobals.Count: for( int i = 0: i < subShaderScopeCount: i++ ) { if( m_templateMPData.SubShaders[ SubShaderIdx ].AvailableShaderGlobals[ i ].PropertyName.Equals( m_propertyName ) ) { m_currentScope = ShaderPropertyScope.SubShader: } } int passScopeCount = m_templateMPData.SubShaders[ SubShaderIdx ].Passes[ PassIdx ].AvailableShaderGlobals.Count: for( int i = 0: i < passScopeCount: i++ ) { if( m_templateMPData.SubShaders[ SubShaderIdx ].Passes[ PassIdx ].AvailableShaderGlobals[ i ].PropertyName.Equals( m_propertyName ) ) { m_currentScope = ShaderPropertyScope.Pass: } } }
public override void DrawProperties() { base.DrawProperties(); EditorGUI.BeginChangeCheck(); m_advancedView = EditorGUILayoutToggle("Advanced View", m_advancedView); if (EditorGUI.EndChangeCheck()) { if (m_advancedView) { if (m_shaderProperties[m_currentPropertyIdx].PassId >= 0) { m_currentScope = ShaderPropertyScope.Pass; PassIdx = m_shaderProperties[m_currentPropertyIdx].PassId; SubShaderIdx = m_shaderProperties[m_currentPropertyIdx].SubShaderId; } else if (m_shaderProperties[m_currentPropertyIdx].SubShaderId >= 0) { m_currentScope = ShaderPropertyScope.SubShader; SubShaderIdx = m_shaderProperties[m_currentPropertyIdx].SubShaderId; PassIdx = 0; } else { m_currentScope = ShaderPropertyScope.Shader; SubShaderIdx = 0; PassIdx = 0; } } FetchShaderProperties(); FetchPropertyId(); } if (m_advancedView && m_multiPassMode) { DrawMultipassProperties(); } if (m_currentPropertyIdx > -1) { bool hasProperties = (m_shaderProperties != null && m_shaderProperties.Count > 0); if (hasProperties) { EditorGUI.BeginChangeCheck(); m_currentPropertyIdx = EditorGUILayoutPopup(PropertyLabelStr, m_currentPropertyIdx, m_propertyLabels); if (EditorGUI.EndChangeCheck()) { UpdateFromId(); } EditorGUILayout.LabelField(m_typeName); if (m_shaderProperties[m_currentPropertyIdx].PropertyType != PropertyType.Global) { EditorGUILayout.LabelField(m_propertyNameLabel); } } } }
public override void ReadFromString( ref string[] nodeParams ) { base.ReadFromString( ref nodeParams ): m_propertyName = GetCurrentParam( ref nodeParams ): m_propertyNameId = Shader.PropertyToID( m_propertyName ): if( UIUtils.CurrentShaderVersion() > TemplatesManager.MPShaderVersion ) { m_currentScope = (ShaderPropertyScope)Enum.Parse( typeof( ShaderPropertyScope ), GetCurrentParam( ref nodeParams ) ): } else { m_fetchScopeFromProperty = true: } m_fetchPropertyId = true: }
public override void ReadFromString(ref string[] nodeParams) { base.ReadFromString(ref nodeParams); m_propertyName = GetCurrentParam(ref nodeParams); m_propertyNameId = Shader.PropertyToID(m_propertyName); if (UIUtils.CurrentShaderVersion() > TemplatesManager.MPShaderVersion) { m_currentScope = (ShaderPropertyScope)Enum.Parse(typeof(ShaderPropertyScope), GetCurrentParam(ref nodeParams)); } else { m_fetchScopeFromProperty = true; } m_fetchPropertyId = true; if (UIUtils.CurrentShaderVersion() > 18502) { m_advancedView = Convert.ToBoolean(GetCurrentParam(ref nodeParams)); } }
void DrawMultipassProperties() { EditorGUI.BeginChangeCheck(); m_currentScope = (ShaderPropertyScope)EditorGUILayoutEnumPopup(CurrentScopeStr, m_currentScope); if (EditorGUI.EndChangeCheck()) { FetchShaderProperties(); FetchPropertyId(); } bool showSubShader = false; bool showPass = false; switch (m_currentScope) { case ShaderPropertyScope.SubShader: { showSubShader = true; } break; case ShaderPropertyScope.Pass: { showSubShader = true; showPass = true; } break; } if (showSubShader) { DrawSubShaderUI(); } if (showPass) { DrawPassUI(); } }