static private MultiSelectionObjectTitleBar ( Object objects ) : void | ||
objects | Object | |
return | void |
private void CameraSelectionGUI() { SceneModeUtility.SearchBar(new Type[] { typeof(Camera) }); EditorGUILayout.Space(); Camera camera = null; if (Selection.activeGameObject) { camera = Selection.activeGameObject.GetComponent <Camera>(); } if (camera) { Camera[] objects = new Camera[] { camera }; EditorGUILayout.MultiSelectionObjectTitleBar(objects); EditorGUILayout.HelpBox(OcclusionCullingWindow.s_Styles.seeVisualizationInScene.text, MessageType.Info); } else { GUILayout.Label(OcclusionCullingWindow.s_Styles.emptyCameraSelection, EditorStyles.helpBox, new GUILayoutOption[0]); } }
private void AreaSelectionGUI() { bool flag = true; Type type = SceneModeUtility.SearchBar(new Type[] { typeof(Renderer), typeof(OcclusionArea) }); EditorGUILayout.Space(); GameObject[] array; OcclusionArea[] selectedObjectsOfType = SceneModeUtility.GetSelectedObjectsOfType <OcclusionArea>(out array, new Type[0]); if (array.Length > 0) { flag = false; EditorGUILayout.MultiSelectionObjectTitleBar(selectedObjectsOfType); SerializedObject serializedObject = new SerializedObject(selectedObjectsOfType); EditorGUILayout.PropertyField(serializedObject.FindProperty("m_IsViewVolume"), new GUILayoutOption[0]); serializedObject.ApplyModifiedProperties(); } Renderer[] selectedObjectsOfType2 = SceneModeUtility.GetSelectedObjectsOfType <Renderer>(out array, new Type[] { typeof(MeshRenderer), typeof(SkinnedMeshRenderer) }); if (array.Length > 0) { flag = false; EditorGUILayout.MultiSelectionObjectTitleBar(selectedObjectsOfType2); SerializedObject serializedObject2 = new SerializedObject(array); SceneModeUtility.StaticFlagField("Occluder Static", serializedObject2.FindProperty("m_StaticEditorFlags"), 2); SceneModeUtility.StaticFlagField("Occludee Static", serializedObject2.FindProperty("m_StaticEditorFlags"), 16); serializedObject2.ApplyModifiedProperties(); } if (flag) { GUILayout.Label(OcclusionCullingWindow.s_Styles.emptyAreaSelection, EditorStyles.helpBox, new GUILayoutOption[0]); if (type == typeof(OcclusionArea)) { EditorGUIUtility.labelWidth = 80f; EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]); EditorGUILayout.PrefixLabel("Create New"); if (GUILayout.Button("Occlusion Area", EditorStyles.miniButton, new GUILayoutOption[] { GUILayout.ExpandWidth(false) })) { this.CreateNewArea(); } EditorGUILayout.EndHorizontal(); } } }
public bool EditLightmapParameters() { UnityEngine.Object[] filtered = Selection.GetFiltered(typeof(LightmapParameters), UnityEditor.SelectionMode.Unfiltered); if (filtered.Length == 0) { return(false); } EditorGUILayout.MultiSelectionObjectTitleBar(filtered); this.GetLightmapParametersEditor(filtered).OnInspectorGUI(); GUILayout.Space(10f); return(true); }
void AreaSelectionGUI() { bool emptySelection = true; GameObject[] gos; Type focusType = SceneModeUtility.SearchBar(typeof(Renderer), typeof(OcclusionArea)); EditorGUILayout.Space(); // Occlusion Areas OcclusionArea[] oas = SceneModeUtility.GetSelectedObjectsOfType <OcclusionArea>(out gos); if (gos.Length > 0) { emptySelection = false; EditorGUILayout.MultiSelectionObjectTitleBar(oas); using (var so = new SerializedObject(oas)) { EditorGUILayout.PropertyField(so.FindProperty("m_IsViewVolume")); so.ApplyModifiedProperties(); } } // Renderers Renderer[] renderers = SceneModeUtility.GetSelectedObjectsOfType <Renderer>(out gos, typeof(MeshRenderer), typeof(SkinnedMeshRenderer)); if (gos.Length > 0) { emptySelection = false; EditorGUILayout.MultiSelectionObjectTitleBar(renderers); using (var goso = new SerializedObject(gos)) { SceneModeUtility.StaticFlagField("Occluder Static", goso.FindProperty("m_StaticEditorFlags"), (int)StaticEditorFlags.OccluderStatic); SceneModeUtility.StaticFlagField("Occludee Static", goso.FindProperty("m_StaticEditorFlags"), (int)StaticEditorFlags.OccludeeStatic); goso.ApplyModifiedProperties(); } } if (emptySelection) { GUILayout.Label(s_Styles.emptyAreaSelection, EditorStyles.helpBox); if (focusType == typeof(OcclusionArea)) { EditorGUIUtility.labelWidth = 80; EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.PrefixLabel("Create New"); if (GUILayout.Button("Occlusion Area", EditorStyles.miniButton, GUILayout.ExpandWidth(false))) { CreateNewArea(); } EditorGUILayout.EndHorizontal(); } } }
private static void ObjectSettings(Object[] components, GameObject[] gos) { ComponentBasedWorkflowButton(); EditorGUILayout.MultiSelectionObjectTitleBar(components); using (var so = new SerializedObject(gos)) { using (new EditorGUI.DisabledScope(!SceneModeUtility.StaticFlagField("Navigation Static", so.FindProperty("m_StaticEditorFlags"), (int)StaticEditorFlags.NavigationStatic))) { SceneModeUtility.StaticFlagField("Generate OffMeshLinks", so.FindProperty("m_StaticEditorFlags"), (int)StaticEditorFlags.OffMeshLinkGeneration); var property = so.FindProperty("m_NavMeshLayer"); EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = property.hasMultipleDifferentValues; var navAreaNames = GameObjectUtility.GetNavMeshAreaNames(); var currentAbsoluteIndex = GameObjectUtility.GetNavMeshArea(gos[0]); var navAreaIndex = -1; // Need to find the index as the list of names will compress out empty area for (var i = 0; i < navAreaNames.Length; i++) { if (GameObjectUtility.GetNavMeshAreaFromName(navAreaNames[i]) == currentAbsoluteIndex) { navAreaIndex = i; break; } } var navMeshArea = EditorGUILayout.Popup("Navigation Area", navAreaIndex, navAreaNames); EditorGUI.showMixedValue = false; if (EditorGUI.EndChangeCheck()) { //Convert the selected index into absolute index... var newNavAreaIndex = GameObjectUtility.GetNavMeshAreaFromName(navAreaNames[navMeshArea]); GameObjectUtility.ShouldIncludeChildren includeChildren = GameObjectUtility.DisplayUpdateChildrenDialogIfNeeded(Selection.gameObjects, "Change Navigation Area", "Do you want change the navigation area to " + navAreaNames[navMeshArea] + " for all the child objects as well?"); if (includeChildren != GameObjectUtility.ShouldIncludeChildren.Cancel) { property.intValue = newNavAreaIndex; SetNavMeshArea(newNavAreaIndex, includeChildren == 0); } } } so.ApplyModifiedProperties(); } }
private void AreaSelectionGUI() { GameObject[] objArray; bool flag = true; Type[] types = new Type[] { typeof(Renderer), typeof(OcclusionArea) }; Type type = SceneModeUtility.SearchBar(types); EditorGUILayout.Space(); OcclusionArea[] selectedObjectsOfType = SceneModeUtility.GetSelectedObjectsOfType <OcclusionArea>(out objArray, new Type[0]); if (objArray.Length > 0) { flag = false; EditorGUILayout.MultiSelectionObjectTitleBar(selectedObjectsOfType); SerializedObject obj2 = new SerializedObject(selectedObjectsOfType); EditorGUILayout.PropertyField(obj2.FindProperty("m_IsViewVolume"), new GUILayoutOption[0]); obj2.ApplyModifiedProperties(); } Type[] typeArray2 = new Type[] { typeof(MeshRenderer), typeof(SkinnedMeshRenderer) }; Renderer[] objects = SceneModeUtility.GetSelectedObjectsOfType <Renderer>(out objArray, typeArray2); if (objArray.Length > 0) { flag = false; EditorGUILayout.MultiSelectionObjectTitleBar(objects); SerializedObject obj3 = new SerializedObject(objArray); SceneModeUtility.StaticFlagField("Occluder Static", obj3.FindProperty("m_StaticEditorFlags"), 2); SceneModeUtility.StaticFlagField("Occludee Static", obj3.FindProperty("m_StaticEditorFlags"), 0x10); obj3.ApplyModifiedProperties(); } if (flag) { GUILayout.Label(s_Styles.emptyAreaSelection, EditorStyles.helpBox, new GUILayoutOption[0]); if (type == typeof(OcclusionArea)) { EditorGUIUtility.labelWidth = 80f; EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]); EditorGUILayout.PrefixLabel("Create New"); GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.ExpandWidth(false) }; if (GUILayout.Button("Occlusion Area", EditorStyles.miniButton, options)) { this.CreateNewArea(); } EditorGUILayout.EndHorizontal(); } } }
private void CameraSelectionGUI() { SceneModeUtility.SearchBar(typeof(Camera)); EditorGUILayout.Space(); Camera camera = (Camera)null; if ((bool)((UnityEngine.Object)Selection.activeGameObject)) { camera = Selection.activeGameObject.GetComponent <Camera>(); } if ((bool)((UnityEngine.Object)camera)) { EditorGUILayout.MultiSelectionObjectTitleBar((UnityEngine.Object[]) new Camera[1] { camera }); EditorGUILayout.HelpBox(OcclusionCullingWindow.s_Styles.seeVisualizationInScene.text, MessageType.Info); } else { GUILayout.Label(OcclusionCullingWindow.s_Styles.emptyCameraSelection, EditorStyles.helpBox, new GUILayoutOption[0]); } }
private void CameraSelectionGUI() { Type[] types = new Type[] { typeof(Camera) }; SceneModeUtility.SearchBar(types); EditorGUILayout.Space(); Camera component = null; if (Selection.activeGameObject != null) { component = Selection.activeGameObject.GetComponent <Camera>(); } if (component != null) { Camera[] objects = new Camera[] { component }; EditorGUILayout.MultiSelectionObjectTitleBar(objects); EditorGUILayout.HelpBox(s_Styles.seeVisualizationInScene.text, MessageType.Info); } else { GUILayout.Label(s_Styles.emptyCameraSelection, EditorStyles.helpBox, new GUILayoutOption[0]); } }
private static void ObjectSettings(UnityEngine.Object[] components, GameObject[] gos) { EditorGUILayout.MultiSelectionObjectTitleBar(components); SerializedObject serializedObject = new SerializedObject(gos); EditorGUI.BeginDisabledGroup(!SceneModeUtility.StaticFlagField("Navigation Static", serializedObject.FindProperty("m_StaticEditorFlags"), 8)); SceneModeUtility.StaticFlagField("Generate OffMeshLinks", serializedObject.FindProperty("m_StaticEditorFlags"), 32); SerializedProperty serializedProperty = serializedObject.FindProperty("m_NavMeshLayer"); EditorGUI.BeginChangeCheck(); EditorGUI.showMixedValue = serializedProperty.hasMultipleDifferentValues; string[] navMeshAreaNames = GameObjectUtility.GetNavMeshAreaNames(); int navMeshArea = GameObjectUtility.GetNavMeshArea(gos[0]); int selectedIndex = -1; for (int i = 0; i < navMeshAreaNames.Length; i++) { if (GameObjectUtility.GetNavMeshAreaFromName(navMeshAreaNames[i]) == navMeshArea) { selectedIndex = i; break; } } int num = EditorGUILayout.Popup("Navigation Area", selectedIndex, navMeshAreaNames, new GUILayoutOption[0]); EditorGUI.showMixedValue = false; if (EditorGUI.EndChangeCheck()) { int navMeshAreaFromName = GameObjectUtility.GetNavMeshAreaFromName(navMeshAreaNames[num]); GameObjectUtility.ShouldIncludeChildren shouldIncludeChildren = GameObjectUtility.DisplayUpdateChildrenDialogIfNeeded(Selection.gameObjects, "Change Navigation Area", "Do you want change the navigation area to " + navMeshAreaNames[num] + " for all the child objects as well?"); if (shouldIncludeChildren != GameObjectUtility.ShouldIncludeChildren.Cancel) { serializedProperty.intValue = navMeshAreaFromName; NavMeshEditorWindow.SetNavMeshArea(navMeshAreaFromName, shouldIncludeChildren == GameObjectUtility.ShouldIncludeChildren.IncludeChildren); } } EditorGUI.EndDisabledGroup(); serializedObject.ApplyModifiedProperties(); }
void CameraSelectionGUI() { SceneModeUtility.SearchBar(typeof(Camera)); EditorGUILayout.Space(); Camera cam = null; if (Selection.activeGameObject) { cam = Selection.activeGameObject.GetComponent <Camera>(); } // Camera if (cam) { Camera[] cameras = new Camera[] { cam }; EditorGUILayout.MultiSelectionObjectTitleBar(cameras); EditorGUILayout.HelpBox(s_Styles.seeVisualizationInScene.text, MessageType.Info); } else { GUILayout.Label(s_Styles.emptyCameraSelection, EditorStyles.helpBox); } }