private void DoShaderVariants(EditorWindow caller, ref Rect drawPos) { EditorGUI.BeginChangeCheck(); bool usedBySceneOnly = GUI.Toggle(drawPos, ShaderInspectorPlatformsPopup.currentVariantStripping == 1, EditorGUIUtility.TempContent("Skip unused shader_features"), ShaderInspectorPlatformsPopup.Styles.menuItem); drawPos.y += 16f; if (EditorGUI.EndChangeCheck()) { ShaderInspectorPlatformsPopup.currentVariantStripping = !usedBySceneOnly ? 0 : 1; } drawPos.y += 6f; int comboCount = ShaderUtil.GetComboCount(this.m_Shader, usedBySceneOnly); string text = !usedBySceneOnly?comboCount.ToString() + " variants total" : comboCount.ToString() + " variants included"; Rect position = drawPos; position.x += (float)ShaderInspectorPlatformsPopup.Styles.menuItem.padding.left; position.width -= (float)(ShaderInspectorPlatformsPopup.Styles.menuItem.padding.left + 4); GUI.Label(position, text); position.xMin = position.xMax - 40f; if (!GUI.Button(position, "Show", EditorStyles.miniButton)) { return; } ShaderUtil.OpenShaderCombinations(this.m_Shader, usedBySceneOnly); caller.Close(); GUIUtility.ExitGUI(); }
void DoShaderVariants(EditorWindow caller, ref Rect drawPos) { // setting for whether shader variants should be stripped EditorGUI.BeginChangeCheck(); bool strip = GUI.Toggle(drawPos, currentVariantStripping == 1, EditorGUIUtility.TempContent("Skip unused shader_features"), Styles.menuItem); drawPos.y += EditorGUI.kSingleLineHeight; if (EditorGUI.EndChangeCheck()) { currentVariantStripping = strip ? 1 : 0; } // display included variant count, and a button to show list of them drawPos.y += kSeparatorHeight; ulong variantCount = ShaderUtil.GetVariantCount(m_Shader, strip); var variantText = FormatCount(variantCount) + (strip ? " variants included" : " variants total"); Rect buttonRect = drawPos; buttonRect.x += Styles.menuItem.padding.left; buttonRect.width -= Styles.menuItem.padding.left + 4; GUI.Label(buttonRect, variantText); buttonRect.xMin = buttonRect.xMax - 40; if (GUI.Button(buttonRect, "Show", EditorStyles.miniButton)) { ShaderUtil.OpenShaderCombinations(m_Shader, strip); caller.Close(); GUIUtility.ExitGUI(); } }
private void DoShaderVariants(EditorWindow caller, ref Rect drawPos) { EditorGUI.BeginChangeCheck(); bool flag = GUI.Toggle(drawPos, ShaderInspectorPlatformsPopup.currentVariantStripping == 1, EditorGUIUtility.TempContent("Skip unused shader_features"), ShaderInspectorPlatformsPopup.Styles.menuItem); drawPos.y += 16f; if (EditorGUI.EndChangeCheck()) { ShaderInspectorPlatformsPopup.currentVariantStripping = ((!flag) ? 0 : 1); } drawPos.y += 6f; ulong variantCount = ShaderUtil.GetVariantCount(this.m_Shader, flag); string text = ShaderInspectorPlatformsPopup.FormatCount(variantCount) + ((!flag) ? " variants total" : " variants included"); Rect position = drawPos; position.x += (float)ShaderInspectorPlatformsPopup.Styles.menuItem.padding.left; position.width -= (float)(ShaderInspectorPlatformsPopup.Styles.menuItem.padding.left + 4); GUI.Label(position, text); position.xMin = position.xMax - 40f; if (GUI.Button(position, "Show", EditorStyles.miniButton)) { ShaderUtil.OpenShaderCombinations(this.m_Shader, flag); caller.Close(); GUIUtility.ExitGUI(); } }