public override IRegionStyle GetRegionStyle(Guid viewGuid) { if (viewGuid == Guid.Empty) { return(null); } if (ParentDocument != null && ParentDocument.IsOpened && viewGuid == ParentDocument.AdaptiveViewSet.Base.Guid) { return(RegionStyle); } else { if (GroupStyles.ContainsKey(viewGuid)) { return(GroupStyles[viewGuid]); } else if (ParentDocument != null && ParentDocument.IsOpened) { IAdaptiveView view = ParentDocument.AdaptiveViewSet.AdaptiveViews[viewGuid]; if (view != null) { GroupStyle style = new GroupStyle(this, viewGuid); GroupStyles[viewGuid] = style; return(style); } } return(null); } }
public static bool BeginFoldGroup(GUIContent content, string toggleID, Material material, GroupStyles style = GroupStyles.Main, bool spacing = false, bool writeToShader = false) { MatEditData lData = GetMatEditData(material); if (!writeToShader) { if (!lData.toggles.ContainsKey(toggleID)) { lData.toggles.Add(toggleID, false); } } EditorGUILayout.BeginVertical(groupStyles[(int)style]); if (GUILayout.Button(content, EditorStyles.boldLabel)) { if (writeToShader) { material.SetInt(toggleID, scopeMaterial.GetInt(toggleID) == 1 ? 0 : 1); } else { lData.toggles[toggleID] = !lData.toggles[toggleID]; } } if (spacing) { EditorGUILayout.Space(); } if (writeToShader) { return(material.GetInt(toggleID) == 1); } else { return(lData.toggles[toggleID]); } }
public static bool BeginToggleGroup(GUIContent content, string toggleID, Material material, GroupStyles style = GroupStyles.Main, bool spacing = false, bool writeToShader = false) { string lKey = "MatEdit:" + material.GetInstanceID() + "-> ToggleID:" + toggleID; EditorGUILayout.BeginVertical(groupStyles[(int)style]); bool toggle = false; if (writeToShader) { toggle = material.GetInt(toggleID) == 1; } else { toggle = EditorPrefs.GetBool(lKey); } toggle = EditorGUILayout.BeginToggleGroup(content, toggle); EditorGUILayout.EndToggleGroup(); if (writeToShader) { material.SetInt(toggleID, toggle ? 1 : 0); } else { EditorPrefs.SetBool(lKey, toggle); } if (spacing) { EditorGUILayout.Space(); } return(toggle); }
public static bool BeginFoldGroup(GUIContent content, string toggleID, Material material, GroupStyles style = GroupStyles.Main, bool spacing = false, bool writeToShader = false) { string lKey = "MatEdit:" + material.GetInstanceID() + "-> ToggleID:" + toggleID; EditorGUILayout.BeginVertical(groupStyles[(int)style]); if (GUILayout.Button(content, EditorStyles.boldLabel)) { if (writeToShader) { material.SetInt(toggleID, scopeMaterial.GetInt(toggleID) == 1 ? 0 : 1); } else { EditorPrefs.SetBool(lKey, !EditorPrefs.GetBool(lKey)); } } if (spacing) { EditorGUILayout.Space(); } if (writeToShader) { return(material.GetInt(toggleID) == 1); } else { return(EditorPrefs.GetBool(lKey)); } }