Esempio n. 1
0
        private void RenderActiveCategorySelectionPopup()
        {
            PrefabCategoryDatabase prefabCategoryDatabase = PrefabCategoryDatabase.Get();
            string newActiveCategoryName = EditorGUILayoutEx.SortedPopup(GetContentForActivePrefabCategorySelectionPopup(),
                                                                         prefabCategoryDatabase.IndexOfActiveCategory,
                                                                         ViewData.ShowPrefabCategoryFolderNames ?
                                                                         prefabCategoryDatabase.GetAllPrefabCategoryNamesWithFolders(ViewData.MaxNumberOfCategoryFolderNames) : prefabCategoryDatabase.GetAllPrefabCategoryNames());

            if (ViewData.ShowPrefabCategoryFolderNames)
            {
                if ((prefabCategoryDatabase.ActivePrefabCategory == null && !string.IsNullOrEmpty(newActiveCategoryName)) ||
                    newActiveCategoryName != prefabCategoryDatabase.ActivePrefabCategory.GetNameWithConcatFolderNames(ViewData.MaxNumberOfCategoryFolderNames))
                {
                    UndoEx.RecordForToolAction(prefabCategoryDatabase);
                    prefabCategoryDatabase.SetActivePrefabCategory(prefabCategoryDatabase.GetPrefabCategoryByNameWithFolders(newActiveCategoryName, ViewData.MaxNumberOfCategoryFolderNames));
                }
            }
            else
            {
                if ((prefabCategoryDatabase.ActivePrefabCategory == null && !string.IsNullOrEmpty(newActiveCategoryName)) ||
                    newActiveCategoryName != prefabCategoryDatabase.ActivePrefabCategory.Name)
                {
                    UndoEx.RecordForToolAction(prefabCategoryDatabase);
                    prefabCategoryDatabase.SetActivePrefabCategory(prefabCategoryDatabase.GetPrefabCategoryByName(newActiveCategoryName));
                }
            }
        }
Esempio n. 2
0
        private void RenderContentInScrollView()
        {
            EditorGUILayoutEx.InformativeLabel("Please choose the settings you wish to save.");
            Octave3DWorldBuilder.ActiveInstance.ConfigSaveSettings.View.Render();

            EditorGUILayout.Separator();
            RenderSaveButton();
        }
Esempio n. 3
0
        public static void LabelInMiddleOfControlRect(Rect controlRectangle, string labelText, float controlHeight, GUIStyle style)
        {
            Rect labelRectangle = controlRectangle;

            labelRectangle.yMin += controlHeight * 0.05f;
            labelRectangle.xMin  = controlRectangle.center.x - EditorGUILayoutEx.CalculateTextSize(labelText).x * 0.5f;

            GUI.Label(labelRectangle, labelText, style);
        }
Esempio n. 4
0
        private void RenderNameChangeTextField()
        {
            string newString = EditorGUILayoutEx.DelayedTextField(GetContentForNameChangeTextField(), _objectGroup.Name);

            if (newString != _objectGroup.Name)
            {
                UndoEx.RecordForToolAction(_objectGroup);
                _objectGroup.Name = newString;
            }
        }
        private void RenderActiveGroupSelectionPopup()
        {
            int newInt = EditorGUILayoutEx.Popup(GetContentForActiveGroupSelectionPopup(), _database.IndexOfActiveGroup, _database.GetAllObjectGroupNames());

            if (newInt != _database.IndexOfActiveGroup)
            {
                UndoEx.RecordForToolAction(_database);
                _database.SetActiveObjectGroup(_database.GetObjectGroupByIndex(newInt));
            }
        }
Esempio n. 6
0
        private void RenderTagNameChangeField()
        {
            string newName = EditorGUILayoutEx.DelayedTextField(GetContentForTagNameChangeField(), _prefabTag.Name);

            if (newName != _prefabTag.Name)
            {
                UndoEx.RecordForToolAction(_prefabTag);
                PrefabTagDatabase.Get().RenamePrefabTag(_prefabTag, newName);
            }
        }
        private void RenderDestinationCategorySelectionPopup()
        {
            string newString = EditorGUILayoutEx.Popup(GetContentForDestinationCategorySelectionPopup(), _settings.DestinationCategory.Name, PrefabCategoryDatabase.Get().GetAllPrefabCategoryNames());

            if (newString != _settings.DestinationCategory.Name)
            {
                UndoEx.RecordForToolAction(_settings);
                _settings.DestinationCategory = PrefabCategoryDatabase.Get().GetPrefabCategoryByName(newString);
            }
        }
Esempio n. 8
0
        private void RenderDestinationCategoryForElementPrefabsSelectionPopup()
        {
            string newString = EditorGUILayoutEx.Popup(GetContentForDestinationCategoryForElementPrefabsSelectionPopup(), _brush.DestinationCategoryForElementPrefabs.Name, PrefabCategoryDatabase.Get().GetAllPrefabCategoryNames());

            if (newString != _brush.DestinationCategoryForElementPrefabs.Name)
            {
                UndoEx.RecordForToolAction(_brush);
                _brush.DestinationCategoryForElementPrefabs = PrefabCategoryDatabase.Get().GetPrefabCategoryByName(newString);
            }
        }
Esempio n. 9
0
        private void RenderActiveBrushSelectionPopup()
        {
            string newString = EditorGUILayoutEx.Popup(GetContentForActiveBrushSelectionPopup(), _database.ActiveBrush.Name, _database.GetAllBrushNames());

            if (newString != _database.ActiveBrush.Name)
            {
                UndoEx.RecordForToolAction(_database);
                _database.SetActiveBrush(_database.GetBrushByName(newString));
            }
        }
Esempio n. 10
0
        private void RenderPatternNameChangeTextField()
        {
            ObjectPlacementPathHeightPatternDatabase patternDatabase = ObjectPlacementPathHeightPatternDatabase.Get();
            string newString = EditorGUILayoutEx.DelayedTextField(GetContentForPatternNameChangeField(), _heightPattern.Name);

            if (newString != _heightPattern.Name)
            {
                UndoEx.RecordForToolAction(_heightPattern);
                patternDatabase.RenamePattern(_heightPattern, newString);
            }
        }
Esempio n. 11
0
        private void RenderActivePrefabPreviewButtonAndNextPrevControls(Prefab activePrefab)
        {
            var buttonDrawData = new PrefabPreviewButtonRenderData();

            buttonDrawData.ExtractFromPrefab(activePrefab, 1.0f);

            EditorGUILayoutEx.BeginVertical(GUILayout.Width(buttonDrawData.ButtonWidth));
            GUILayout.Button(buttonDrawData.ButtonContent, "Box", GUILayout.Width(buttonDrawData.ButtonWidth), GUILayout.Height(buttonDrawData.ButtonHeight));
            RenderNextAndPreviousPrefabButtons(activePrefab, buttonDrawData.ButtonWidth * 0.5f);
            EditorGUILayoutEx.EndVertical();
        }
        private void RenderActiveConfigurationNameChangeField()
        {
            ObjectPlacementPathTileConnectionConfiguration activeConfiguration = ObjectPlacementPathTileConnectionConfigurationDatabase.Get().ActiveConfiguration;
            string newString = EditorGUILayoutEx.DelayedTextField(GetContentForActiveConfigurationNameChangeField(), activeConfiguration.Name);

            if (newString != activeConfiguration.Name)
            {
                UndoEx.RecordForToolAction(activeConfiguration);
                activeConfiguration.Name = newString;
            }
        }
Esempio n. 13
0
        private void RenderAllButtons()
        {
            EditorGUILayoutEx.BeginHorizontalBox();
            int numberOfButtons = GetNumberOfButtons();

            for (int buttonIndex = 0; buttonIndex < numberOfButtons; ++buttonIndex)
            {
                RenderButton(buttonIndex);
            }
            EditorGUILayoutEx.EndHorizontalBox();
        }
        protected override void RenderContent()
        {
            EditorGUILayoutEx.BeginVerticalBox();

            EditorGUILayout.BeginHorizontal();
            const float alignButtonWidth = 72.0f;
            var         content          = new GUIContent();

            content.text    = "Align X";
            content.tooltip = "Aligns the positions of the selected objects to the X axis.";
            if (GUILayout.Button(content, GUILayout.Width(alignButtonWidth)))
            {
                ObjectSelectionActions.AlignSelectionToAxis(Axis.X);
            }

            content.text    = "Align Y";
            content.tooltip = "Aligns the positions of the selected objects to the Y axis.";
            if (GUILayout.Button(content, GUILayout.Width(alignButtonWidth)))
            {
                ObjectSelectionActions.AlignSelectionToAxis(Axis.Y);
            }

            content.text    = "Align Z";
            content.tooltip = "Aligns the positions of the selected objects to the Z axis.";
            if (GUILayout.Button(content, GUILayout.Width(alignButtonWidth)))
            {
                ObjectSelectionActions.AlignSelectionToAxis(Axis.Z);
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            RenderMakeSelectionStaticButton();
            RenderMakeSelectionDynamicButton();
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            RenderInvertSelectionButton();
            content.text    = "Grab settings...";
            content.tooltip = "Opens up a new window which allows you to modify selection grab settings.";
            if (GUILayout.Button(content, GUILayout.Width(110.0f)))
            {
                Octave3DWorldBuilder.ActiveInstance.EditorWindowPool.SelectionGrabSettingsWindow.ObjectGrabSettings = ObjectSelection.Get().SelectionGrabSettings;
                Octave3DWorldBuilder.ActiveInstance.EditorWindowPool.SelectionGrabSettingsWindow.ShowOctave3DWindow();
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            RenderAssignSelectionToLayerButton();
            RenderSelectionAssignmentLayerSelectionPopup();
            EditorGUILayout.EndHorizontal();

            EditorGUILayoutEx.EndVerticalBox();
        }
Esempio n. 15
0
        private void RenderPatternStringTextArea()
        {
            // Note: We also have to specify a width in order for wrapping to work accordingly. Also, 'ExpandWidth' is used
            //       to ensure that the width expands as the Inspector area is enlarged.
            string newString = EditorGUILayoutEx.TextArea(_viewData.CurrentPathHeightPatternString, true, GUILayout.Height(_viewData.PatternTextAreaHeight), GUILayout.Width(300.0f), GUILayout.ExpandWidth(true));

            if (newString != _viewData.CurrentPathHeightPatternString)
            {
                UndoEx.RecordForToolAction(_viewData);
                _viewData.CurrentPathHeightPatternString = newString;
            }
        }
Esempio n. 16
0
        public void RenderView()
        {
            bool newBool;

            newBool = EditorGUILayout.Foldout(_isVisible, "Selection Projection Settings");
            if (newBool != _isVisible)
            {
                UndoEx.RecordForToolAction(this);
                _isVisible = newBool;
            }

            GUIContent content = new GUIContent();

            if (_isVisible)
            {
                EditorGUILayoutEx.BeginVerticalBox();
                Octave3DWorldBuilder.ActiveInstance.ShowGUIHint("The surface projection object must be a terrain object (with a terrain collider) or mesh (no colliders required). " +
                                                                "If it is a mesh, it must also be a child of Octave3D.");
                content.text    = "Surface object";
                content.tooltip = "The object which acts as a projection surface. Must be a terrain (with a mesh collider attached) or mesh object. If it is a mesh object, it must be a child of Octave3D.";
                GameObject newSurface = EditorGUILayout.ObjectField(content, ProjectionSurface, typeof(GameObject), true) as GameObject;
                if (newSurface != _projectionSurface)
                {
                    UndoEx.RecordForToolAction(this);
                    ProjectionSurface = newSurface;
                }

                content.text    = "Projection direction";
                content.tooltip = "The direction in which the objects will be projected on the projection surface.";
                ProjectionDirection newProjectionDir = (ProjectionDirection)EditorGUILayout.EnumPopup(content, ProjectionDir);
                if (newProjectionDir != ProjectionDir)
                {
                    UndoEx.RecordForToolAction(this);
                    ProjectionDir = newProjectionDir;
                }

                content.text    = "Project selection";
                content.tooltip = "Projects the selected objects onto the projection surface (if one was specified).";
                if (GUILayout.Button(content, GUILayout.Width(130.0f)))
                {
                    if (ProjectionSurface == null)
                    {
                        Debug.LogWarning("Projection not possible. No projection surface was specified!");
                    }
                    else
                    {
                        ObjectSelection.Get().ProjectSelectionOnProjectionSurface();
                    }
                }
                EditorGUILayoutEx.EndVerticalBox();
            }
        }
Esempio n. 17
0
        protected override void RenderContent()
        {
            Prefab activePrefab = PrefabQueries.GetActivePrefab();

            if (activePrefab != null)
            {
                RenderActivePrefabPreviewButtonAndNextPrevControls(activePrefab);
                activePrefab.View.Render();
            }
            else
            {
                EditorGUILayoutEx.InformativeLabel("There is no active prefab currently available.");
            }
        }
Esempio n. 18
0
        protected override void RenderContent()
        {
            if (!PrefabTagDatabase.Get().IsEmpty)
            {
                _prefabTagDatabase.PrefabTagFilter.View.Render();
                RenderPrefabTagScrollView();
            }
            else
            {
                EditorGUILayoutEx.InformativeLabel("There are no prefab tags to display.");
            }

            RenderActionControls();
        }
        protected override void RenderContent()
        {
            RenderUseTileConnectionsToggle();
            if (_settings.UseTileConnections)
            {
                EditorGUILayoutEx.InformativeLabel("When using tile connections, the extension plane will always reside at the bottom of the placement guide in its local space.");
                RenderSetCommonPropertiesControls();
                RenderRemoveAllPrefabAssociationsButton();

                EditorGUILayout.Separator();
                PrefabsToPathTileConectionDropEventHandler.Get().DropSettings.View.Render();
                RenderViewForEachTileConnectionType();
            }
        }
Esempio n. 20
0
        protected override void RenderContent()
        {
            if (_database.IsEmpty)
            {
                EditorGUILayoutEx.InformativeLabel("There are no brushes currently available.");
            }
            else
            {
                RenderActiveBrushControls();
            }

            EditorGUILayout.Separator();
            RenderBrushActionControls();
        }
        protected override void RenderContent()
        {
            ObjectPlacementPathTileConnectionConfigurationDatabase configurationDatabase = ObjectPlacementPathTileConnectionConfigurationDatabase.Get();

            if (configurationDatabase.IsEmpty)
            {
                EditorGUILayoutEx.InformativeLabel("There are no tile connection configurations available.");
            }
            else
            {
                RenderActiveConfigurationSelectionPopup();
                RenderActiveConfigurationNameChangeField();
            }
        }
Esempio n. 22
0
        protected override void RenderContent()
        {
            if (_database.IsEmpty)
            {
                EditorGUILayoutEx.InformativeLabel("There are no object groups currently available.");
            }
            else
            {
                RenderActiveGroupSelectionPopup();
                _database.ActiveGroup.View.Render();
            }

            RenderActionControls();
            RenderPreserveGroupChildrenToggle();
        }
 protected override void RenderContent()
 {
     if (_database.IsEmpty)
     {
         EditorGUILayoutEx.InformativeLabel("There are no height patterns currently available.");
     }
     else
     {
         _database.HeightPatternFilter.View.Render();
         RenderPatternScrollView();
         RenderActivePatternButtonColorField();
         RenderPatternScrollViewHeightSlider();
     }
     RenderActionButtons();
 }
        private void RenderActiveConfigurationSelectionPopup()
        {
            ObjectPlacementPathTileConnectionConfigurationDatabase configurationDatabase = ObjectPlacementPathTileConnectionConfigurationDatabase.Get();
            string newString = EditorGUILayoutEx.Popup(GetContentForActiveConfigurationSelectionPopup(), configurationDatabase.ActiveConfiguration.Name, configurationDatabase.GetAllConfigurationNames());

            if (newString != configurationDatabase.ActiveConfiguration.Name)
            {
                ObjectPlacementPathTileConnectionConfiguration newActiveConfiguration = configurationDatabase.GetConfigurationByName(newString);
                if (newActiveConfiguration != null)
                {
                    UndoEx.RecordForToolAction(configurationDatabase);
                    PathObjectPlacement.Get().PathSettings.TileConnectionSettings.RecordAllTileConnectionTypeSettingsForUndo();
                    configurationDatabase.SetActiveConfiguration(newActiveConfiguration);
                    newActiveConfiguration.ApplyConfigurationDataToSettings(PathObjectPlacement.Get().PathSettings.TileConnectionSettings);
                }
            }
        }
Esempio n. 25
0
        private void RenderMinMaxScaleSlider()
        {
            float minScale = _settings.MinScale;
            float maxScale = _settings.MaxScale;

            EditorGUILayoutEx.MinMaxSliderWithFloatFields(GetContentForMinMaxScaleSlider(), ref minScale, ref maxScale, ObjectUniformScaleRandomizationSettings.MinScaleValue, ObjectUniformScaleRandomizationSettings.MaxScaleValue);

            if (minScale != _settings.MinScale)
            {
                UndoEx.RecordForToolAction(_settings);
                _settings.MinScale = minScale;
            }
            if (maxScale != _settings.MaxScale)
            {
                UndoEx.RecordForToolAction(_settings);
                _settings.MaxScale = maxScale;
            }
        }
        private void RenderMinMaxSlopeSlider()
        {
            float minSlope = _settings.MinSlopeInDegrees;
            float maxSlope = _settings.MaxSlopeInDegrees;

            EditorGUILayoutEx.MinMaxSliderWithFloatFields(GetContentForMinMaxSlopeSlider(), ref minSlope, ref maxSlope, DecorPaintSlopeSettings.MinSlopeValueInDegrees, DecorPaintSlopeSettings.MaxSlopeValueInDegrees);

            if (minSlope != _settings.MinSlopeInDegrees)
            {
                UndoEx.RecordForToolAction(_settings);
                _settings.MinSlopeInDegrees = minSlope;
            }
            if (maxSlope != _settings.MaxSlopeInDegrees)
            {
                UndoEx.RecordForToolAction(_settings);
                _settings.MaxSlopeInDegrees = maxSlope;
            }
        }
        private void RenderMinMaxRotationSlider()
        {
            float minRotation = _settings.MinRotationInDegrees;
            float maxRotation = _settings.MaxRotationInDegrees;

            EditorGUILayoutEx.MinMaxSliderWithFloatFields(GetContentForMinMaxRotationSlider(), ref minRotation, ref maxRotation, RandomRotationValueAxisRandomizationSettings.MinRotationValueInDegrees, RandomRotationValueAxisRandomizationSettings.MaxRotationValueInDegrees);

            if (minRotation != _settings.MinRotationInDegrees)
            {
                UndoEx.RecordForToolAction(_settings);
                _settings.MinRotationInDegrees = minRotation;
            }
            if (maxRotation != _settings.MaxRotationInDegrees)
            {
                UndoEx.RecordForToolAction(_settings);
                _settings.MaxRotationInDegrees = maxRotation;
            }
        }
Esempio n. 28
0
        protected override void RenderContent()
        {
            if (PrefabTagDatabase.Get().IsEmpty)
            {
                EditorGUILayoutEx.InformativeLabel("There are no prefab tags to display.");
            }
            else
            {
                AcquireFilteredPrefabTags();

                if (_prefabTagFilter != null)
                {
                    _prefabTagFilter.View.Render();
                }
                RenderPrefabTagSelectionScrollView();
                RenderSelectDeselectAllTagsButtons();
                RenderSelectDeselectOnlyFilteredTagsButtons();
            }
        }
        private void RenderActiveCategoryNameChangeTextField()
        {
            PrefabCategoryDatabase prefabCategoryDatabase = PrefabCategoryDatabase.Get();
            PrefabCategory         activeCategory         = prefabCategoryDatabase.ActivePrefabCategory;

            if (prefabCategoryDatabase.CanPrefabCategoryBeRenamed(activeCategory))
            {
                string newString = EditorGUILayoutEx.DelayedTextField(GetContentForActiveCategoryNameChangeField(), activeCategory.Name);
                if (newString != activeCategory.Name)
                {
                    UndoEx.RecordForToolAction(activeCategory);
                    prefabCategoryDatabase.RenamePrefabCategory(activeCategory, newString);
                }
            }
            else
            {
                EditorGUILayoutEx.InformativeLabel("The default category can not be renamed.");
            }
        }
Esempio n. 30
0
 protected override void RenderContent()
 {
     EditorGUILayoutEx.BeginVerticalBox();
     RenderTileConnectionTypeBoxContent();
     EditorGUILayoutEx.EndVerticalBox();
 }