private void RenderActiveGroupSelectionPopup() { int newInt = EditorGUILayoutEx.Popup(GetContentForActiveGroupSelectionPopup(), _database.IndexOfActiveGroup, _database.GetAllObjectGroupNames()); if (newInt != _database.IndexOfActiveGroup) { UndoEx.RecordForToolAction(_database); _database.SetActiveObjectGroup(_database.GetObjectGroupByIndex(newInt)); } }
private void RenderObjectGroupSelectionPopup() { ObjectGroupDatabase objectGroupDatabase = Octave3DWorldBuilder.ActiveInstance.PlacementObjectGroupDatabase; if (objectGroupDatabase.NumberOfGroups == 0) { EditorGUILayoutEx.InformativeLabel("No object groups are currently available."); return; } PrefabCategoryDatabase prefabCategoryDatabase = PrefabCategoryDatabase.Get(); PrefabCategory activeCategory = prefabCategoryDatabase.ActivePrefabCategory; List <ObjectGroup> allObjectGroups = objectGroupDatabase.GetAllObjectGroups(); if (activeCategory.ObjectGroup == null) { activeCategory.SetObjectGroup(allObjectGroups[0]); } int currentGroupIndex = allObjectGroups.FindIndex(0, item => item == activeCategory.ObjectGroup); if (currentGroupIndex < 0) { return; } int newGroupIndex = EditorGUILayoutEx.Popup(GetContentForObjectGroupSelectionPopup(), currentGroupIndex, objectGroupDatabase.GetAllObjectGroupNames()); if (newGroupIndex != currentGroupIndex) { UndoEx.RecordForToolAction(activeCategory); activeCategory.SetObjectGroup(allObjectGroups[newGroupIndex]); } }
protected override void RenderContent() { float newFloat; bool newBool; string newString; EditorGUILayout.LabelField("Object groups", EditorStyles.boldLabel); var content = new GUIContent(); content.text = "Attach to object group"; content.tooltip = "If this is checked, any objects which are created via selection operations will be attached to a group of your choosing."; newBool = EditorGUILayout.ToggleLeft(content, _settings.ObjectGroupSettings.AttachToObjectGroup); if (newBool != _settings.ObjectGroupSettings.AttachToObjectGroup) { UndoEx.RecordForToolAction(_settings); _settings.ObjectGroupSettings.AttachToObjectGroup = newBool; } ObjectGroupDatabase objectGroupDatabase = Octave3DWorldBuilder.ActiveInstance.PlacementObjectGroupDatabase; if (objectGroupDatabase.NumberOfGroups == 0) { EditorGUILayout.HelpBox("No object groups are currently available.", UnityEditor.MessageType.None); } else { if (_settings.ObjectGroupSettings.DestinationGroup == null) { _settings.ObjectGroupSettings.DestinationGroup = objectGroupDatabase.GetAllObjectGroups()[0]; } content.text = "Object group"; content.tooltip = "If \'Attach to object group\' is checked, any objects which are created via selection operations will be attached to this group."; newString = EditorGUILayoutEx.Popup(content, _settings.ObjectGroupSettings.DestinationGroup.Name, objectGroupDatabase.GetAllObjectGroupNames()); if (newString != _settings.ObjectGroupSettings.DestinationGroup.Name) { UndoEx.RecordForToolAction(_settings); _settings.ObjectGroupSettings.DestinationGroup = objectGroupDatabase.GetObjectGroupByName(newString); } } EditorGUILayout.Separator(); EditorGUILayout.LabelField("Rotation", EditorStyles.boldLabel); content.text = "X rotation step"; content.tooltip = "Allows you to specify how much rotation is applied to the selected objects when the X rotation key is pressed."; newFloat = EditorGUILayout.FloatField(content, _settings.XRotationStep); if (newFloat != _settings.XRotationStep) { UndoEx.RecordForToolAction(_settings); _settings.XRotationStep = newFloat; } content.text = "Y rotation step"; content.tooltip = "Allows you to specify how much rotation is applied to the selected objects when the Y rotation key is pressed."; newFloat = EditorGUILayout.FloatField(content, _settings.YRotationStep); if (newFloat != _settings.YRotationStep) { UndoEx.RecordForToolAction(_settings); _settings.YRotationStep = newFloat; } content.text = "Z rotation step"; content.tooltip = "Allows you to specify how much rotation is applied to the selected objects when the Z rotation key is pressed."; newFloat = EditorGUILayout.FloatField(content, _settings.ZRotationStep); if (newFloat != _settings.ZRotationStep) { UndoEx.RecordForToolAction(_settings); _settings.ZRotationStep = newFloat; } content.text = "Rotate around selection center"; content.tooltip = "If this is checked, the rotation will happen around the selection's world center. Otherwise, each object will be rotated around its own center."; newBool = EditorGUILayout.ToggleLeft(content, _settings.RotateAroundSelectionCenter); if (newBool != _settings.RotateAroundSelectionCenter) { UndoEx.RecordForToolAction(_settings); _settings.RotateAroundSelectionCenter = newBool; } EditorGUILayout.Separator(); EditorGUILayout.LabelField("Object 2 object snap", EditorStyles.boldLabel); content.text = "Snap epsilon"; content.tooltip = "The selected objects will always snap to nearby objects which are \'epsilon\' units away from the selected objects."; newFloat = EditorGUILayout.FloatField(content, _settings.Object2ObjectSnapSettings.SnapEps); if (newFloat != _settings.Object2ObjectSnapSettings.SnapEps) { UndoEx.RecordForToolAction(_settings); _settings.Object2ObjectSnapSettings.SnapEps = newFloat; } content.text = "Can hover objects"; content.tooltip = "If this is checked, you will be able to hover other objects during a snap session. Otherwise, you will only be able to hover the grid surface."; newBool = EditorGUILayout.ToggleLeft(content, _settings.Object2ObjectSnapSettings.CanHoverObjects); if (newBool != _settings.Object2ObjectSnapSettings.CanHoverObjects) { UndoEx.RecordForToolAction(_settings); _settings.Object2ObjectSnapSettings.CanHoverObjects = newBool; } EditorGUILayout.Separator(); EditorGUILayout.LabelField("Misc", EditorStyles.boldLabel); RenderAllowPartialOverlapToggle(); RenderSelectionShapeTypeSelectionPopup(); RenderSelectionUpdateModeSelectionPopup(); RenderSelectionModeSelectionPopup(); if (_settings.SelectionMode == ObjectSelectionMode.Paint) { _settings.PaintModeSettings.View.Render(); } }