protected bool DoPanelHeader(MaterialPanel panel, ShaderFeature feature, bool readState = true) { Rect controlRect = EditorGUILayout.GetControlRect(false, 22f); GUI.Label(controlRect, GUIContent.none, TMP_UIStyleManager.Group_Label); if (GUI.Button(new Rect(controlRect.x, controlRect.y, 250f, controlRect.height), panel.Label, TMP_UIStyleManager.Group_Label_Left)) { panel.ToggleExpanded(); } if (readState) { feature.ReadState(material); } EditorGUI.BeginChangeCheck(); float labelWidth = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = 70f; bool active = EditorGUI.Toggle(new Rect(controlRect.width - 90f, controlRect.y + 3f, 90f, 22f), new GUIContent("Enable ->"), feature.Active); EditorGUIUtility.labelWidth = labelWidth; if (EditorGUI.EndChangeCheck()) { editor.RegisterPropertyChangeUndo(feature.undoLabel); feature.SetActive(active, material); } return(panel.Expanded); }
protected bool DoPanelHeader(MaterialPanel panel) { if (GUILayout.Button(panel.Label, TMP_UIStyleManager.Group_Label)) { panel.ToggleExpanded(); } return(panel.Expanded); }