private static void DrawSceneItemVisibility(Rect rect, Scene scene, bool isItemHovered, bool isIconHovered) { var state = SceneVisibilityManager.instance.GetSceneVisibilityState(scene); bool shouldDisplayIcon = true; Styles.IconState iconState = isIconHovered ? Styles.iconHovered : Styles.iconNormal; GUIContent icon; if (state == SceneVisibilityManager.SceneVisState.AllHidden) { icon = iconState.hiddenAll; } else if (state == SceneVisibilityManager.SceneVisState.Mixed) { icon = iconState.visibleMixed; } else { icon = iconState.visibleAll; shouldDisplayIcon = isItemHovered; } if (shouldDisplayIcon && GUI.Button(rect, icon, Styles.sceneVisibilityStyle)) { SceneVisibilityManager.instance.ToggleScene(scene, state); } }
private static void DrawGameObjectItemVisibility(Rect rect, GameObject gameObject, bool isItemHovered, bool isIconHovered) { var isHidden = SceneVisibilityManager.instance.IsHidden(gameObject); bool shouldDisplayIcon = isItemHovered || isHidden; Styles.IconState iconState = isIconHovered ? Styles.iconHovered : Styles.iconNormal; GUIContent icon; if (isHidden) { icon = gameObject.transform.childCount == 0 || SceneVisibilityManager.instance.AreAllDescendantsHidden(gameObject) ? iconState.hiddenAll : iconState.hiddenMixed; } else if (!SceneVisibilityManager.instance.AreAllDescendantsVisible(gameObject)) { icon = iconState.visibleMixed; shouldDisplayIcon = true; } else { icon = iconState.visibleAll; } if (shouldDisplayIcon && GUI.Button(rect, icon, Styles.sceneVisibilityStyle)) { SceneVisibilityManager.instance.ToggleVisibility(gameObject, !Event.current.alt); } }
private static void DrawGameObjectItemPicking(Rect rect, GameObject gameObject, bool isItemHovered, bool isIconHovered) { var isPickingDisabled = SceneVisibilityManager.instance.IsPickingDisabled(gameObject); bool shouldDisplayIcon = isItemHovered || isPickingDisabled; Styles.IconState iconState = isIconHovered ? Styles.iconHovered : Styles.iconNormal; GUIContent icon; if (isPickingDisabled) { icon = gameObject.transform.childCount == 0 || SceneVisibilityManager.instance.IsPickingDisabledOnAllDescendants(gameObject) ? iconState.pickingDisabledAll : iconState.pickingDisabledMixed; } else if (!SceneVisibilityManager.instance.IsPickingEnabledOnAllDescendants(gameObject)) { icon = iconState.pickingEnabledMixed; shouldDisplayIcon = true; } else { icon = iconState.pickingEnabledAll; } if (shouldDisplayIcon && GUI.Button(rect, icon, Styles.sceneVisibilityStyle)) { SceneVisibilityManager.instance.TogglePicking(gameObject, !Event.current.alt); } }
private static void DrawSceneItemPicking(Rect rect, Scene scene, bool isItemHovered, bool isIconHovered) { var state = SceneVisibilityManager.instance.GetScenePickingState(scene); bool shouldDisplayIcon = true; Styles.IconState iconState = isIconHovered ? Styles.iconHovered : Styles.iconNormal; GUIContent icon; var enablePicking = false; if (state == SceneVisibilityManager.ScenePickingState.PickingDisabledAll) { icon = iconState.pickingDisabledAll; enablePicking = true; } else if (state == SceneVisibilityManager.ScenePickingState.Mixed) { icon = iconState.pickingEnabledMixed; } else { icon = iconState.pickingEnabledAll; shouldDisplayIcon = isItemHovered; } if (shouldDisplayIcon && GUI.Button(rect, icon, Styles.sceneVisibilityStyle)) { if (enablePicking) { SceneVisibilityManager.instance.EnablePicking(scene); } else { SceneVisibilityManager.instance.DisablePicking(scene); } } }
private static void DrawSceneItem(Rect rect, Scene scene, bool isItemHovered, bool isIconHovered) { var isHidden = SceneVisibilityManager.instance.AreAllDescendantsHidden(scene); bool shouldDisplayIcon = true; Styles.IconState iconState = isIconHovered ? Styles.iconHovered : Styles.iconNormal; GUIContent icon; if (isHidden) { icon = iconState.hiddenAll; } else if (SceneVisibilityManager.instance.AreAnyDescendantsHidden(scene)) { icon = iconState.visibleMixed; } else { icon = iconState.visibleAll; shouldDisplayIcon = isItemHovered; } if (shouldDisplayIcon && GUI.Button(rect, icon, Styles.sceneVisibilityStyle)) { if (isHidden) { SceneVisibilityManager.instance.Show(scene); } else { SceneVisibilityManager.instance.Hide(scene); } } }