protected override void RenderContent()
 {
     EditorGUILayoutEx.BeginVerticalBox();
     RenderObjectCollectionMaskScrollView();
     RenderActionButtons();
     EditorGUILayoutEx.EndVerticalBox();
 }
        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();
        }
Exemple #3
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();
            }
        }
Exemple #4
0
 protected override void RenderContent()
 {
     EditorGUILayoutEx.BeginVerticalBox();
     RenderTileConnectionTypeBoxContent();
     EditorGUILayoutEx.EndVerticalBox();
 }
        public void RenderGUI(UnityEngine.Object undoRecordObject)
        {
            bool newBool;
            ObjectBlockProjectionDir newProjectionDir;
            CoordinateSystemAxis     newAlignmentAxis;

            EditorGUI.indentLevel += 1;
            EditorGUILayout.Foldout(true, "Block projection settings");
            EditorGUI.indentLevel -= 1;
            if (true)
            {
                EditorGUILayoutEx.BeginVerticalBox();

                var content = new GUIContent();
                content.text    = "Project on surface";
                content.tooltip = "If this is checked, the objects in the block will be projected on a surface. The projection surface " +
                                  "is selected by casting a projection ray along the chosen projection direction.";
                newBool = EditorGUILayout.ToggleLeft(content, ProjectOnSurface);
                if (newBool != ProjectOnSurface)
                {
                    UndoEx.RecordForToolAction(undoRecordObject);
                    ProjectOnSurface = newBool;
                }

                if (ProjectOnSurface)
                {
                    content.text    = "Reject non-projectables";
                    content.tooltip = "If this is checked, the plugin will not spawn objects which can not be projected on a surface.";
                    newBool         = EditorGUILayout.ToggleLeft(content, RejectNonProjectables);
                    if (newBool != RejectNonProjectables)
                    {
                        UndoEx.RecordForToolAction(undoRecordObject);
                        RejectNonProjectables = newBool;
                    }

                    content.text     = "Projection direction";
                    content.tooltip  = "Allows you to specify the direction of projection.";
                    newProjectionDir = (ObjectBlockProjectionDir)EditorGUILayout.EnumPopup(content, ProjectionDirection);
                    if (newProjectionDir != ProjectionDirection)
                    {
                        UndoEx.RecordForToolAction(undoRecordObject);
                        ProjectionDirection = newProjectionDir;
                    }

                    content.text    = "Can project on terrain";
                    content.tooltip = "If this is checked, objects can be projected onto terrain surfaces. Otherwise, terrain surfaces will be ignored.";
                    newBool         = EditorGUILayout.ToggleLeft(content, CanProjectOnTerrain);
                    if (newBool != CanProjectOnTerrain)
                    {
                        UndoEx.RecordForToolAction(undoRecordObject);
                        CanProjectOnTerrain = newBool;
                    }

                    content.text    = "Can project on mesh";
                    content.tooltip = "If this is checked, objects can be projected onto mesh surfaces. Otherwise, mesh surfaces will be ignored.";
                    newBool         = EditorGUILayout.ToggleLeft(content, CanProjectOnMesh);
                    if (newBool != CanProjectOnMesh)
                    {
                        UndoEx.RecordForToolAction(undoRecordObject);
                        CanProjectOnMesh = newBool;
                    }

                    content.text    = "Align to normal";
                    content.tooltip = "If this is checked, the objects will have one of their axes aligned with the projection surface.";
                    newBool         = EditorGUILayout.ToggleLeft(content, AlignToSurfaceNormal);
                    if (newBool != AlignToSurfaceNormal)
                    {
                        UndoEx.RecordForToolAction(undoRecordObject);
                        AlignToSurfaceNormal = newBool;
                    }

                    content.text     = "Alignment axis";
                    content.tooltip  = "If surface alignment is turned on, this is the axis that will be used to align objects to the projection surface normal.";
                    newAlignmentAxis = (CoordinateSystemAxis)EditorGUILayout.EnumPopup(content, AlignmentAxis);
                    if (newAlignmentAxis != AlignmentAxis)
                    {
                        UndoEx.RecordForToolAction(undoRecordObject);
                        AlignmentAxis = newAlignmentAxis;
                    }
                }

                EditorGUILayoutEx.EndVerticalBox();
            }
        }
 private void SurroundWithBoxAndRender()
 {
     EditorGUILayoutEx.BeginVerticalBox();
     RenderContent();
     EditorGUILayoutEx.EndVerticalBox();
 }
        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();

            if (ObjectGroupDatabase.Get().NumberOfGroups != 0)
            {
                if (string.IsNullOrEmpty(ViewData.DestObjectGroupName))
                {
                    ViewData.DestObjectGroupName = ObjectGroupDatabase.Get().GetObjectGroupByIndex(0).Name;
                }
                else
                {
                    if (ObjectGroupDatabase.Get().GetObjectGroupByName(ViewData.DestObjectGroupName) == null)
                    {
                        ViewData.DestObjectGroupName = ObjectGroupDatabase.Get().GetObjectGroupByIndex(0).Name;
                    }
                }

                EditorGUILayout.BeginHorizontal();
                content.text    = "Assign to group";
                content.tooltip = "Assigns the object selection to the specified object group.";
                if (GUILayout.Button(content, GUILayout.Width(110.0f)))
                {
                    ObjectGroup destObjectGroup = ObjectGroupDatabase.Get().GetObjectGroupByName(ViewData.DestObjectGroupName);
                    if (destObjectGroup != null)
                    {
                        ObjectActions.AssignObjectsToGroup(ObjectSelection.Get().GetAllSelectedGameObjects(), destObjectGroup);
                    }
                }

                string newGroupName = EditorGUILayoutEx.Popup(new GUIContent(), ViewData.DestObjectGroupName, ObjectGroupDatabase.Get().GetAllObjectGroupNames());
                if (newGroupName != ViewData.DestObjectGroupName)
                {
                    UndoEx.RecordForToolAction(ViewData);
                    ViewData.DestObjectGroupName = newGroupName;
                }
                EditorGUILayout.EndHorizontal();
            }

            EditorGUILayoutEx.EndVerticalBox();
        }