protected override void RenderContent(UnityEngine.Object undoRecordObject)
        {
            float newFloat;

            GUIContent content = new GUIContent();

            content.text    = "X rotation step";
            content.tooltip = "The amount of rotation applied around the X axis.";
            newFloat        = EditorGUILayout.FloatField(content, XRotationStep);
            if (newFloat != XRotationStep)
            {
                EditorUndoEx.Record(undoRecordObject);
                XRotationStep = newFloat;
            }

            content.text    = "Y rotation step";
            content.tooltip = "The amount of rotation applied around the Y axis.";
            newFloat        = EditorGUILayout.FloatField(content, YRotationStep);
            if (newFloat != YRotationStep)
            {
                EditorUndoEx.Record(undoRecordObject);
                YRotationStep = newFloat;
            }

            content.text    = "Z rotation step";
            content.tooltip = "The amount of rotation applied around the Z axis.";
            newFloat        = EditorGUILayout.FloatField(content, ZRotationStep);
            if (newFloat != ZRotationStep)
            {
                EditorUndoEx.Record(undoRecordObject);
                ZRotationStep = newFloat;
            }
        }
Beispiel #2
0
        protected override void RenderContent(UnityEngine.Object undoRecordObject)
        {
            Color newColor; bool newBool;

            // Grid line color
            var content = new GUIContent();

            content.text    = "Line color";
            content.tooltip = "Allows you to control the color of the grid lines.";
            newColor        = EditorGUILayout.ColorField(content, LineColor);
            if (newColor != LineColor)
            {
                EditorUndoEx.Record(undoRecordObject);
                LineColor = newColor;
            }

            // Cell fading
            content.text    = "Use cell fading";
            content.tooltip = "If this is true, the grid cells will fade in/out based on the distance between the camera and the grid. This " +
                              "is conistent with how Unity renders the scene grid inside the Editor.";
            newBool = EditorGUILayout.ToggleLeft(content, UseCellFading);
            if (newBool != UseCellFading)
            {
                EditorUndoEx.Record(undoRecordObject);
                UseCellFading = newBool;
            }
        }
        protected override void RenderContent(UnityEngine.Object undoRecordObject)
        {
            bool newBool; Texture2D newTexture; float newFloat;
            var  content = new GUIContent();

            content.text    = "Draw light icons";
            content.tooltip = "If this is checked, there will be an icon drawn in the scene for each light object.";
            newBool         = EditorGUILayout.ToggleLeft(content, DrawLightIcons);
            if (newBool != DrawLightIcons)
            {
                EditorUndoEx.Record(undoRecordObject);
                DrawLightIcons = newBool;
            }

            content.text    = "Icon alpha";
            content.tooltip = "Alpha values used to control the transparency for light icons.";
            newFloat        = EditorGUILayout.FloatField(content, LightIconAlpha);
            if (newFloat != LightIconAlpha)
            {
                EditorUndoEx.Record(undoRecordObject);
                LightIconAlpha = newFloat;
            }

            content.text    = "Light icon";
            content.tooltip = "The texture to use when drawing light icons.";
            newTexture      = EditorGUILayout.ObjectField(content, LightIcon, typeof(Texture2D), false) as Texture2D;
            if (newTexture != LightIcon)
            {
                EditorUndoEx.Record(undoRecordObject);
                LightIcon = newTexture;
            }

            EditorGUILayout.Separator();
            content.text    = "Draw particle system icons";
            content.tooltip = "If this is checked, there will be an icon drawn in the scene for each particle system object.";
            newBool         = EditorGUILayout.ToggleLeft(content, DrawParticleSystemIcons);
            if (newBool != DrawParticleSystemIcons)
            {
                EditorUndoEx.Record(undoRecordObject);
                DrawParticleSystemIcons = newBool;
            }

            content.text    = "Icon alpha";
            content.tooltip = "Alpha values used to control the transparency for particle system icons.";
            newFloat        = EditorGUILayout.FloatField(content, ParticleSystemIconAlpha);
            if (newFloat != ParticleSystemIconAlpha)
            {
                EditorUndoEx.Record(undoRecordObject);
                ParticleSystemIconAlpha = newFloat;
            }

            content.text    = "Particle system icon";
            content.tooltip = "The texture to use when drawing particle system icons.";
            newTexture      = EditorGUILayout.ObjectField(content, ParticleSystemIcon, typeof(Texture2D), false) as Texture2D;
            if (newTexture != ParticleSystemIcon)
            {
                EditorUndoEx.Record(undoRecordObject);
                ParticleSystemIcon = newTexture;
            }
        }
        protected override void RenderContent(UnityEngine.Object undoRecordObject)
        {
            int newInt; bool newBool; float newFloat;

            GUIContent content = new GUIContent();

            content.text    = "Snap destination layers";
            content.tooltip = "When snapping to nearby obejcts, only the objects which belong to one of these layers will be taken into account.";
            newInt          = EditorGUILayoutEx.LayerMaskField(content, SnapDestinationLayers);
            if (newInt != SnapDestinationLayers)
            {
                EditorUndoEx.Record(undoRecordObject);
                SnapDestinationLayers = newInt;
            }

            content.text    = "Can climb objects";
            content.tooltip = "This toggle controls what happens when the mouse cursor hovers other objects. If checked, the target obejcts " +
                              "will climb the hovered objects. Otherwise, they will sit on the scene grid.";
            newBool = EditorGUILayout.ToggleLeft(content, CanClimbObjects);
            if (newBool != CanClimbObjects)
            {
                EditorUndoEx.Record(undoRecordObject);
                CanClimbObjects = newBool;
            }

            content.text    = "Snap radius";
            content.tooltip = "This is a distance value that is used to gather nearby destination objects.";
            newFloat        = EditorGUILayout.FloatField(content, SnapRadius);
            if (newFloat != SnapRadius)
            {
                EditorUndoEx.Record(undoRecordObject);
                SnapRadius = newFloat;
            }
        }
Beispiel #5
0
        protected override void RenderContent(UnityEngine.Object undoRecordObject)
        {
            ScenePhysicsMode newPhysicsMode; float newFloat;
            GUIContent       content = new GUIContent();

            content.text    = "Physics mode";
            content.tooltip = "Controls the way in which raycasts, overlap tests etc are performed. It is recommended to leave this to \'RLD\'. Otherwise, some " +
                              "plugin features might not work as expected (e.g. object 2 object snap, selection grab).";
            newPhysicsMode = (ScenePhysicsMode)EditorGUILayout.EnumPopup(content, PhysicsMode);
            if (newPhysicsMode != PhysicsMode)
            {
                EditorUndoEx.Record(undoRecordObject);
                PhysicsMode = newPhysicsMode;
            }

            content.text    = "Non-mesh object size";
            content.tooltip = "This field is used to define the volume size of the objects that do not have a mesh (e.g. lights, particle systems etc). This size is " +
                              "needed to allow the system to perform raycasts or overlap tests for such objects.";
            newFloat = EditorGUILayout.FloatField(content, NonMeshObjectSize);
            if (newFloat != NonMeshObjectSize)
            {
                EditorUndoEx.Record(undoRecordObject);
                NonMeshObjectSize = newFloat;
            }
        }
        protected override void RenderContent(UnityEngine.Object undoRecordObject)
        {
            int newInt; bool newBool;

            var content = new GUIContent();

            content.text    = "Can snap to grid";
            content.tooltip = "When turned on, vertices can be snapped to grid cells.";
            newBool         = EditorGUILayout.ToggleLeft(content, CanSnapToGrid);
            if (newBool != CanSnapToGrid)
            {
                EditorUndoEx.Record(undoRecordObject);
                CanSnapToGrid = newBool;
            }

            content.text    = "Can snap to object verts";
            content.tooltip = "When turned on, vertices can be snapped to other object vertices.";
            newBool         = EditorGUILayout.ToggleLeft(content, CanSnapToObjectVerts);
            if (newBool != CanSnapToObjectVerts)
            {
                EditorUndoEx.Record(undoRecordObject);
                CanSnapToObjectVerts = newBool;
            }

            content.text    = "Snap destination layers";
            content.tooltip = "Allows you to specify which layers can be used as snap destinations when doing vertex snapping.";
            newInt          = EditorGUILayoutEx.LayerMaskField(content, SnapDestinationLayers);
            if (newInt != SnapDestinationLayers)
            {
                EditorUndoEx.Record(undoRecordObject);
                SnapDestinationLayers = newInt;
            }
        }
Beispiel #7
0
        protected override void RenderContent(UnityEngine.Object undoRecordObject)
        {
            EditorGUILayout.BeginVertical();
            var content = new GUIContent();

            content.text    = "Move speed";
            content.tooltip = "Allows you to specify the speed that is used to move the camera in the scene (defualt keys: WASDQE + RMB). The value is expressed in world units/second.";
            float newFloat = EditorGUILayout.FloatField(content, MoveSpeed);

            if (newFloat != MoveSpeed)
            {
                EditorUndoEx.Record(undoRecordObject);
                MoveSpeed = newFloat;
            }

            content.text    = "Alternate move speed";
            content.tooltip = "Alternate move speed value activated via hotkey.";
            newFloat        = EditorGUILayout.FloatField(content, AlternateMoveSpeed);
            if (newFloat != AlternateMoveSpeed)
            {
                EditorUndoEx.Record(undoRecordObject);
                AlternateMoveSpeed = newFloat;
            }

            content.text    = "Acceleration rate";
            content.tooltip = "When moving the camera around, an acceleration will be applied to the camera move speed. This field " +
                              "allows you to control how fast the acceleration increases.";
            newFloat = EditorGUILayout.FloatField(content, AccelerationRate);
            if (newFloat != AccelerationRate)
            {
                EditorUndoEx.Record(undoRecordObject);
                AccelerationRate = newFloat;
            }
            EditorGUILayout.EndVertical();
        }
Beispiel #8
0
        protected override void RenderContent(UnityEngine.Object undoRecordObject)
        {
            float newFloat;

            EditorGUILayout.BeginVertical();

            // Switch mode
            GUIContent content = new GUIContent();

            content.text    = "Switch mode";
            content.tooltip = "Allows you to control the way in which a camera projection switch is performed.";
            CameraProjectionSwitchMode newSwitchMode = (CameraProjectionSwitchMode)EditorGUILayout.EnumPopup(content, SwitchMode);

            if (newSwitchMode != SwitchMode)
            {
                EditorUndoEx.Record(undoRecordObject);
                SwitchMode = newSwitchMode;
            }

            if (SwitchMode == CameraProjectionSwitchMode.Transition)
            {
                content.text    = "Duration (in seconds)";
                content.tooltip = "Allows you to specify the duration of the projection transition in seconds.";
                newFloat        = EditorGUILayout.FloatField(content, TransitionDurationInSeconds);
                if (newFloat != TransitionDurationInSeconds)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    TransitionDurationInSeconds = newFloat;
                }
            }

            EditorGUILayout.EndVertical();
        }
Beispiel #9
0
            protected override void PerformDrop()
            {
                RLDApp rldApp = RLDApp.Get;

                if (rldApp == null)
                {
                    return;
                }

                string[] paths = DragAndDrop.paths;
                if (paths == null || paths.Length == 0)
                {
                    return;
                }

                string prefabFolder = paths[0];

                if (string.IsNullOrEmpty(prefabFolder))
                {
                    return;
                }

                EditorUndoEx.Record(rldApp);
                rldApp.DynamicConvertSettings.PrefabFolder = prefabFolder;
            }
Beispiel #10
0
        private void DrawCheckUncheckAllSlidersVisButtons(UnityEngine.Object undoRecordObject)
        {
            EditorGUILayout.BeginHorizontal();
            GUIContent content = new GUIContent();

            content.text    = "Show all";
            content.tooltip = "Show all sliders.";
            if (GUILayout.Button(content, GUILayout.Width(80.0f)))
            {
                EditorUndoEx.Record(undoRecordObject);
                for (int index = 0; index < _extrudeSliderVis.Length; ++index)
                {
                    _extrudeSliderVis[index] = true;
                }
            }

            content.text    = "Hide all";
            content.tooltip = "Hide all sliders.";
            if (GUILayout.Button(content, GUILayout.Width(80.0f)))
            {
                EditorUndoEx.Record(undoRecordObject);
                for (int index = 0; index < _extrudeSliderVis.Length; ++index)
                {
                    _extrudeSliderVis[index] = false;
                }
            }
            EditorGUILayout.EndHorizontal();
        }
        private void DrawCheckUncheckAllSlidersVisButtons(bool forCaps, UnityEngine.Object undoRecordObject)
        {
            EditorGUILayout.BeginHorizontal();
            GUIContent content = new GUIContent();

            content.text    = "Show all";
            content.tooltip = "Show all " + (forCaps ? "caps." : "sliders.");
            if (GUILayout.Button(content, GUILayout.Width(80.0f)))
            {
                EditorUndoEx.Record(undoRecordObject);
                bool[] visFlags = forCaps ? _sglSliderCapVis : _sglSliderVis;
                for (int index = 0; index < visFlags.Length; ++index)
                {
                    visFlags[index] = true;
                }
            }

            content.text    = "Hide all";
            content.tooltip = "Hide all " + (forCaps ? "caps." : "sliders.");
            if (GUILayout.Button(content, GUILayout.Width(80.0f)))
            {
                EditorUndoEx.Record(undoRecordObject);
                bool[] visFlags = forCaps ? _sglSliderCapVis : _sglSliderVis;
                for (int index = 0; index < visFlags.Length; ++index)
                {
                    visFlags[index] = false;
                }
            }
            EditorGUILayout.EndHorizontal();
        }
        protected override void RenderContent(UnityEngine.Object undoRecordObject)
        {
            float newFloat;

            EditorGUILayoutEx.SectionHeader("Hover epsilon");
            var content = new GUIContent();

            content.text    = "Line slider";
            content.tooltip = "Controls the precision used when hovering line sliders.";
            newFloat        = EditorGUILayout.FloatField(content, LineSliderHoverEps);
            if (newFloat != LineSliderHoverEps)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetLineSliderHoverEps(newFloat);
            }

            content.text    = "Box slider";
            content.tooltip = "Controls the precision used when hovering box sliders.";
            newFloat        = EditorGUILayout.FloatField(content, BoxSliderHoverEps);
            if (newFloat != BoxSliderHoverEps)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetBoxSliderHoverEps(newFloat);
            }

            EditorGUILayout.Separator();
            EditorGUILayoutEx.SectionHeader("Snapping");
            content.text    = "X";
            content.tooltip = "Snap step value used when moving along the X axis.";
            newFloat        = EditorGUILayout.FloatField(content, XSnapStep);
            if (newFloat != XSnapStep)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetXSnapStep(newFloat);
            }

            content.text    = "Y";
            content.tooltip = "Snap step value used when moving along the Y axis.";
            newFloat        = EditorGUILayout.FloatField(content, YSnapStep);
            if (newFloat != YSnapStep)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetYSnapStep(newFloat);
            }

            EditorGUILayout.Separator();
            EditorGUILayoutEx.SectionHeader("Drag sensitivity");
            content.text    = "Sensitivity";
            content.tooltip = "This value allows you to scale the slider drag speed.";
            newFloat        = EditorGUILayout.FloatField(content, DragSensitivity);
            if (newFloat != DragSensitivity)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetDragSensitivity(newFloat);
            }
        }
Beispiel #13
0
        protected override void RenderContent(UnityEngine.Object undoRecordObject)
        {
            float           newFloat;
            CameraFocusMode newFocusMode;

            // Focus mode
            GUIContent content = new GUIContent();

            content.text    = "Focus mode";
            content.tooltip = "Allows you to control the focus mode.";
            newFocusMode    = (CameraFocusMode)EditorGUILayout.EnumPopup(content, FocusMode);
            if (newFocusMode != FocusMode)
            {
                EditorUndoEx.Record(undoRecordObject);
                FocusMode = newFocusMode;
            }

            // Distance add
            content.text    = "Focus distance add";
            content.tooltip = "When a camera is focused, it will be placed at some distance away from the focus target. " +
                              "This value can be used to increase this distance if needed. It can not take on negative values.";
            newFloat = EditorGUILayout.FloatField(content, FocusDistanceAdd);
            if (newFloat != FocusDistanceAdd)
            {
                EditorUndoEx.Record(undoRecordObject);
                FocusDistanceAdd = newFloat;
            }

            // Constant speed
            if (FocusMode == CameraFocusMode.Constant)
            {
                content.text    = "Speed (units/sec)";
                content.tooltip = "Allows you to control the speed at which the camera is focused.";
                newFloat        = EditorGUILayout.FloatField(content, ConstantSpeed);
                if (newFloat != ConstantSpeed)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    ConstantSpeed = newFloat;
                }
            }
            else
            // Smooth duration
            if (FocusMode == CameraFocusMode.Smooth)
            {
                content.text    = "Smooth time (seconds)";
                content.tooltip = "Allows you to control the duration of the smooth focus.";
                newFloat        = EditorGUILayout.FloatField(content, SmoothTime);
                if (newFloat != SmoothTime)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    SmoothTime = newFloat;
                }
            }
        }
        public override void OnInspectorGUI()
        {
            Camera newCamera;

            var content = new GUIContent();

            content.text    = "Target camera";
            content.tooltip = "Allows you to specify the camera object which will be controlled by the RTFocusCamera script. Note: Prefabs are not allowed. Only scene cameras can be used.";
            newCamera       = EditorGUILayout.ObjectField(content, _camera.TargetCamera, typeof(Camera), true) as Camera;
            if (newCamera != _camera.TargetCamera)
            {
                EditorUndoEx.Record(_camera);
                _camera.SetTargetCamera(newCamera);
            }

            _camera.Settings.RenderEditorGUI(_camera);

            EditorGUILayout.Separator();
            _camera.MoveSettings.UsesFoldout  = true;
            _camera.MoveSettings.FoldoutLabel = "Move settings";
            _camera.MoveSettings.RenderEditorGUI(_camera);

            _camera.PanSettings.UsesFoldout  = true;
            _camera.PanSettings.FoldoutLabel = "Pan settings";
            _camera.PanSettings.RenderEditorGUI(_camera);

            _camera.LookAroundSettings.UsesFoldout  = true;
            _camera.LookAroundSettings.FoldoutLabel = "Look around settings";
            _camera.LookAroundSettings.RenderEditorGUI(_camera);

            _camera.OrbitSettings.UsesFoldout  = true;
            _camera.OrbitSettings.FoldoutLabel = "Orbit settings";
            _camera.OrbitSettings.RenderEditorGUI(_camera);

            _camera.ZoomSettings.UsesFoldout  = true;
            _camera.ZoomSettings.FoldoutLabel = "Zoom settings";
            _camera.ZoomSettings.RenderEditorGUI(_camera);

            _camera.FocusSettings.UsesFoldout  = true;
            _camera.FocusSettings.FoldoutLabel = "Focus settings";
            _camera.FocusSettings.RenderEditorGUI(_camera);

            _camera.RotationSwitchSettings.UsesFoldout  = true;
            _camera.RotationSwitchSettings.FoldoutLabel = "Rotation switch settings";
            _camera.RotationSwitchSettings.RenderEditorGUI(_camera);

            _camera.ProjectionSwitchSettings.UsesFoldout  = true;
            _camera.ProjectionSwitchSettings.FoldoutLabel = "Projection switch settings";
            _camera.ProjectionSwitchSettings.RenderEditorGUI(_camera);

            _camera.Hotkeys.UsesFoldout  = true;
            _camera.Hotkeys.FoldoutLabel = "Hotkeys";
            _camera.Hotkeys.RenderEditorGUI(_camera);
        }
Beispiel #15
0
        protected override void RenderContent(UnityEngine.Object undoRecordObject)
        {
            float newFloat; bool newBool; Color newColor;

            if (IsVisible)
            {
                EditorGUILayout.HelpBox("When the camera background is visible, it will obscure all sprites in the scene. This is an unfortunate side-effect of making " +
                                        "the camera background behave correctly in scenarios such as camera transform change and multiple viewports.", MessageType.Warning);
            }

            // Toggle visibility
            var content = new GUIContent();

            content.text    = "Is visible";
            content.tooltip = "Allows you to toggle the visibility of the camera background.";
            newBool         = EditorGUILayout.ToggleLeft(content, IsVisible);
            if (newBool != IsVisible)
            {
                EditorUndoEx.Record(undoRecordObject);
                IsVisible = newBool;
            }

            // First and second colors
            content.text    = "First color";
            content.tooltip = "Allows you to control the first color in the gradient.";
            newColor        = EditorGUILayout.ColorField(content, FirstColor);
            if (newColor != FirstColor)
            {
                EditorUndoEx.Record(undoRecordObject);
                FirstColor = newColor;
            }

            content.text    = "Second color";
            content.tooltip = "Allows you to control the second color in the gradient.";
            newColor        = EditorGUILayout.ColorField(content, SecondColor);
            if (newColor != SecondColor)
            {
                EditorUndoEx.Record(undoRecordObject);
                SecondColor = newColor;
            }

            // Gradient offset
            content.text    = "Gradient offset";
            content.tooltip = "Allows you to control the gradient offset. Possible values are in the [-1, 1] interval. " +
                              "A value of -1 will render only the first color. A value of 1 will render only the second color.";
            newFloat = EditorGUILayout.Slider(content, GradientOffset, -1.0f, 1.0f);
            if (newFloat != GradientOffset)
            {
                EditorUndoEx.Record(undoRecordObject);
                GradientOffset = newFloat;
            }
        }
        protected override void PerformDrop()
        {
            if (PrefabLibDb == null || PrefabLibDb.ActiveLib == null)
            {
                return;
            }

            EditorUndoEx.Record(PrefabLibDb);

            PrefabLibDb.EditorPrefabPreviewGen.BeginGenSession(PrefabLibDb.PrefabPreviewLookAndFeel);
            var objectRefs = DragAndDrop.objectReferences;

            foreach (var objectRef in objectRefs)
            {
                GameObject prefab = objectRef as GameObject;
                if (prefab == null || prefab.IsSceneObject())
                {
                    continue;
                }

                Texture2D prefabPreview = PrefabLibDb.EditorPrefabPreviewGen.Generate(prefab);
                PrefabLibDb.ActiveLib.CreatePrefab(prefab, prefabPreview);
            }

            var paths      = DragAndDrop.paths;
            var allFolders = FileSystem.GetFoldersAndChildFolderPaths(paths);

            RTPrefabLib lastCreatedLib = null;

            for (int folderIndex = 0; folderIndex < allFolders.Count; ++folderIndex)
            {
                string folderPath = allFolders[folderIndex];
                EditorUtility.DisplayProgressBar("Processing dropped folders", "Please wait... (" + folderPath + ")", (float)folderIndex / allFolders.Count);
                RTPrefabLib newPrefabLib = PrefabLibDb.CreateLib(FileSystem.GetLastFolderNameInPath(folderPath));
                lastCreatedLib = newPrefabLib;

                var prefabsInFolder = AssetDatabaseEx.LoadPrefabsInFolder(folderPath, false, false);
                foreach (var prefab in prefabsInFolder)
                {
                    Texture2D prefabPreview = PrefabLibDb.EditorPrefabPreviewGen.Generate(prefab);
                    newPrefabLib.CreatePrefab(prefab, prefabPreview);
                }
            }
            EditorUtility.ClearProgressBar();
            PrefabLibDb.EditorPrefabPreviewGen.EndGenSession();

            if (lastCreatedLib != null)
            {
                PrefabLibDb.SetActiveLib(lastCreatedLib);
            }
        }
        public void RenderEditorGUI(UnityEngine.Object undoRecordObject)
        {
            var content = new GUIContent();

            for (int tabIndex = 0; tabIndex < _tabs.Length; ++tabIndex)
            {
                if (tabIndex % _numTabsPerRow == 0)
                {
                    if (tabIndex == 0)
                    {
                        EditorGUILayout.BeginHorizontal(EditorStyles.toolbar);
                    }
                    else
                    {
                        EditorGUILayout.EndHorizontal();
                        EditorGUILayout.BeginHorizontal();
                    }
                }

                content.text    = _tabs[tabIndex].Text;
                content.tooltip = _tabs[tabIndex].Tooltip;

                if (tabIndex == _activeTabIndex)
                {
                    GUIEx.PushColor(_activeTabColor);
                }
                else
                {
                    GUIEx.PushColor(Color.white);
                }
                if (GUILayout.Button(content, EditorStyles.toolbarButton))
                {
                    EditorUndoEx.Record(undoRecordObject);
                    _activeTabIndex = tabIndex;
                }
                GUIEx.PopColor();
            }
            EditorGUILayout.EndHorizontal();

            EditorToolbarTab activeTab = ActiveTab;

            if (activeTab.NumTargetSettings != 0)
            {
                activeTab.RenderTargetSettingsEditorGUI(undoRecordObject);
            }
            else
            if (activeTab.TargetToolbar != null)
            {
                activeTab.TargetToolbar.RenderEditorGUI(undoRecordObject);
            }
        }
Beispiel #18
0
        protected override void RenderContent(UnityEngine.Object undoRecordObject)
        {
            float newFloat;

            EditorGUILayout.BeginVertical();

            // Switch mode
            GUIContent content = new GUIContent();

            content.text    = "Switch mode";
            content.tooltip = "Allows you to control the way in which a rotation switch is performed.";
            CameraRotationSwitchMode newSwitchMode = (CameraRotationSwitchMode)EditorGUILayout.EnumPopup(content, SwitchMode);

            if (newSwitchMode != SwitchMode)
            {
                EditorUndoEx.Record(undoRecordObject);
                SwitchMode = newSwitchMode;
            }

            // Constant switch mode settings
            if (SwitchMode == CameraRotationSwitchMode.Constant)
            {
                content.text    = "~Duration (in seconds)";
                content.tooltip = "The amount of time in seconds it takes the rotation switch to complete. This value is an approximation.";
                newFloat        = EditorGUILayout.FloatField(content, ConstantSwitchDurationInSeconds);
                if (newFloat != ConstantSwitchDurationInSeconds)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    ConstantSwitchDurationInSeconds = newFloat;
                }
            }
            else
            // Smooth switch mode settings
            if (SwitchMode == CameraRotationSwitchMode.Smooth)
            {
                // Smooth value
                content.text    = "Smooth value";
                content.tooltip = "The smooth value used to adjust the switch speed over time. The bigger the value, the faster " +
                                  "the target rotation is reached.";
                newFloat = EditorGUILayout.FloatField(content, SmoothValue);
                if (newFloat != SmoothValue)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    SmoothValue = newFloat;
                }
            }

            EditorGUILayout.EndVertical();
        }
        protected override void RenderContent(UnityEngine.Object undoRecordObject)
        {
            int newInt;

            var content = new GUIContent();

            content.text    = "Transformable layers";
            content.tooltip = "Allows you to specify which layers can be transformed by the gizmo. Objects which do not belong to a transformable layer will not be transformed by the gizmo.";
            newInt          = EditorGUILayoutEx.LayerMaskField(content, TransformableLayers);
            if (newInt != TransformableLayers)
            {
                EditorUndoEx.Record(undoRecordObject);
                TransformableLayers = newInt;
            }
        }
        protected override void RenderContent(UnityEngine.Object undoRecordObject)
        {
            bool newBool;

            var content = new GUIContent();

            content.text    = "Enable gizmo sorting";
            content.tooltip = "If this is checked, the gizmos wil be sorted by their distance from the camera so that they can be rendered in back to front order.";
            newBool         = EditorGUILayout.ToggleLeft(content, EnableGizmoSorting);
            if (newBool != EnableGizmoSorting)
            {
                EditorUndoEx.Record(undoRecordObject);
                EnableGizmoSorting = newBool;
            }
        }
Beispiel #21
0
        public override void OnInspectorGUI()
        {
            _groupDb.RemoveNullRefs();

            _scrollPos = EditorGUILayout.BeginScrollView(_scrollPos, "Box", GUILayout.Height(300.0f));
            if (_groupDb.NumGroups == 0)
            {
                EditorGUILayout.HelpBox("There are no groups currently available. If you want to mark objects as groups, you can drag and " +
                                        "drop them from the hierarchy window onto this area.", MessageType.Info);
            }
            else
            {
                var removeGroupContent = new GUIContent();
                removeGroupContent.tooltip = "Delete this group. Note: This does not delete the object from the scene. It will only unregister it as an object group.";
                removeGroupContent.text    = "Remove";

                var allGroups = _groupDb.GetAll();
                foreach (var group in allGroups)
                {
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField(group.name);
                    if (GUILayout.Button(removeGroupContent, GUILayout.Width(60.0f)))
                    {
                        EditorUndoEx.Record(_groupDb);
                        _groupDb.Remove(group);
                    }
                    EditorGUILayout.EndHorizontal();
                }
            }
            EditorGUILayout.EndScrollView();

            Rect scrollViewRect     = GUILayoutUtility.GetLastRect();
            var  dragAndDropHandler = new GroupDropAndDropHandler(_groupDb);

            dragAndDropHandler.Handle(Event.current, scrollViewRect);

            var content = new GUIContent();

            content.text    = "Remove all";
            content.tooltip = "Removes all object groups. Note: This does not delete the objects from the scene. It will only remove them from the group list " +
                              "so that they are no longer treated as object groups.";
            if (GUILayout.Button(content, GUILayout.Width(83.0f)))
            {
                EditorUndoEx.Record(_groupDb);
                _groupDb.Clear();
            }
        }
        protected override void RenderContent(UnityEngine.Object undoRecordObject)
        {
            bool newBool;

            var content = new GUIContent();

            content.text    = "Can process input";
            content.tooltip = "Allows you to toggle input handling. You will usually want to turn this off when you have " +
                              "your own camera class that handles user input. Note: Turning this off will disable all actions " +
                              "that can be performed with the camera (zoom, pan, rotate, focus etc).";
            newBool = EditorGUILayout.ToggleLeft(content, CanProcessInput);
            if (newBool != CanProcessInput)
            {
                EditorUndoEx.Record(undoRecordObject);
                CanProcessInput = newBool;
            }
        }
Beispiel #23
0
        protected override void RenderContent(UnityEngine.Object undoRecordObject)
        {
            ObjectRotationPivot newRotationPivot;

            var content = new GUIContent();

            content.text     = "Rotation pivot";
            content.tooltip  = "Allows you to specify the rotation pivot.";
            newRotationPivot = (ObjectRotationPivot)EditorGUILayout.EnumPopup(content, RotationPivot);
            if (newRotationPivot != RotationPivot)
            {
                EditorUndoEx.Record(undoRecordObject);
                RotationPivot = newRotationPivot;
            }

            KeyRotationSettings.RenderEditorGUI(undoRecordObject);
        }
        protected override void RenderContent(UnityEngine.Object undoRecordObject)
        {
            Vector3 newVector3;

            // No-volume object size
            var content = new GUIContent();

            content.text    = "No-volume object size";
            content.tooltip = "The custom interaction system needs to know the size of objects that have no volume. This defines a volume for these objects in the 3D world so that they " +
                              "can still be involved in raycasts, overlap tests etc";
            newVector3 = EditorGUILayout.Vector3Field(content, NoVolumeObjectSize);
            if (newVector3 != NoVolumeObjectSize)
            {
                EditorUndoEx.Record(undoRecordObject);
                NoVolumeObjectSize = newVector3;
            }
        }
Beispiel #25
0
        protected override void RenderContent(UnityEngine.Object undoRecordObject)
        {
            float newFloat;

            EditorGUILayoutEx.SectionHeader("Snapping");
            var content = new GUIContent();

            content.text    = "X";
            content.tooltip = "The snap step for the X axis.";
            newFloat        = EditorGUILayout.FloatField(content, XSnapStep);
            if (newFloat != XSnapStep)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetXSnapStep(newFloat);
            }

            content.text    = "Y";
            content.tooltip = "The snap step for the Y axis.";
            newFloat        = EditorGUILayout.FloatField(content, YSnapStep);
            if (newFloat != YSnapStep)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetYSnapStep(newFloat);
            }

            content.text    = "Z";
            content.tooltip = "The snap step for the Z axis.";
            newFloat        = EditorGUILayout.FloatField(content, ZSnapStep);
            if (newFloat != ZSnapStep)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetZSnapStep(newFloat);
            }

            EditorGUILayout.Separator();
            EditorGUILayoutEx.SectionHeader("Drag sensitivity");
            content.text    = "Sensitivity";
            content.tooltip = "This value allows you to scale the drag speed.";
            newFloat        = EditorGUILayout.FloatField(content, DragSensitivity);
            if (newFloat != DragSensitivity)
            {
                EditorUndoEx.Record(undoRecordObject);
                SetDragSensitivity(newFloat);
            }
        }
        protected override void RenderContent(UnityEngine.Object undoRecordObject)
        {
            Color newColor; int newInt; float newFloat;

            GUIContent content = new GUIContent();

            content.text    = "Bk color";
            content.tooltip = "The background color of the prefab previews.";
            newColor        = EditorGUILayout.ColorField(content, BkColor);
            if (newColor != BkColor)
            {
                EditorUndoEx.Record(undoRecordObject);
                BkColor = newColor;
            }

            content.text    = "Preview width";
            content.tooltip = "The width of the prefab previews.";
            newInt          = EditorGUILayout.IntField(content, PreviewWidth);
            if (newInt != PreviewWidth)
            {
                EditorUndoEx.Record(undoRecordObject);
                PreviewWidth = newInt;
            }

            content.text    = "Preview height";
            content.tooltip = "The height of the prefab previews.";
            newInt          = EditorGUILayout.IntField(content, PreviewHeight);
            if (newInt != PreviewHeight)
            {
                EditorUndoEx.Record(undoRecordObject);
                PreviewHeight = newInt;
            }

            content.text    = "Light intensity";
            content.tooltip = "The intensity of the light which lights the preview objects.";
            newFloat        = EditorGUILayout.FloatField(content, LightIntensity);
            if (newFloat != LightIntensity)
            {
                EditorUndoEx.Record(undoRecordObject);
                LightIntensity = newFloat;
            }
        }
        private void DrawDblSliderVisibilityControls(UnityEngine.Object undoRecordObject)
        {
            GUIContent content = new GUIContent();

            EditorGUILayout.BeginHorizontal();
            string[] sliderLabels = new string[] { "XY", "YZ", "ZX" };
            for (int sliderIndex = 0; sliderIndex < 3; ++sliderIndex)
            {
                content.text    = sliderLabels[sliderIndex];
                content.tooltip = "Toggle visibility for the " + sliderLabels[sliderIndex] + " double-axis slider.";

                bool isVisible = IsDblSliderVisible((PlaneId)sliderIndex);
                bool newBool   = EditorGUILayout.ToggleLeft(content, isVisible, GUILayout.Width(60.0f));
                if (newBool != isVisible)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    SetDblSliderVisible((PlaneId)sliderIndex, newBool);
                }
            }
            EditorGUILayout.EndHorizontal();
        }
Beispiel #28
0
        private void DrawSliderVisibilityControls(AxisSign axisSign, UnityEngine.Object undoRecordObject)
        {
            GUIContent content = new GUIContent();

            EditorGUILayout.BeginHorizontal();
            string[] sliderLabels = axisSign == AxisSign.Positive ? new string[] { "+X", "+Y", "+Z" } : new string[] { "-X", "-Y", "-Z" };
            for (int sliderIndex = 0; sliderIndex < 3; ++sliderIndex)
            {
                content.text    = sliderLabels[sliderIndex];
                content.tooltip = "Toggle visibility for the " + sliderLabels[sliderIndex] + " slider.";

                bool isVisible = IsExtrudeSliderVisible(sliderIndex, axisSign);
                bool newBool   = EditorGUILayout.ToggleLeft(content, isVisible, GUILayout.Width(60.0f));
                if (newBool != isVisible)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    SetExtrudeSliderVisible(sliderIndex, axisSign, newBool);
                }
            }
            EditorGUILayout.EndHorizontal();
        }
Beispiel #29
0
        protected override void RenderContent(UnityEngine.Object undoRecordObject)
        {
            int newInt; string newString; bool newBool;

            GUIContent content = new GUIContent();

            content.text    = "Object types";
            content.tooltip = "The types of objects that can participate in the conversion operation. Applies to both scene objects and prefabs.";
            newInt          = (int)((GameObjectType)EditorGUILayout.EnumFlagsField(content, (GameObjectType)_convertableObjectTypes));
            if (newInt != (int)_convertableObjectTypes)
            {
                EditorUndoEx.Record(undoRecordObject);
                _convertableObjectTypes = (GameObjectType)newInt;
            }

            content.text    = "Prefab folder";
            content.tooltip = "Allows you to specify a folder which contains prefabs that need to be converted. You can either write the path manually or " +
                              "simply drag and drop a folder onto the text field to have the path automatically extracted for you.";
            newString = EditorGUILayout.TextField(content, PrefabFolder);
            if (newString != PrefabFolder)
            {
                EditorUndoEx.Record(undoRecordObject);
                PrefabFolder = newString;
            }
            _prefabFolderDropRect = GUILayoutUtility.GetLastRect();

            content.text    = "Process prefab subfolders";
            content.tooltip = "If this is checked, the conversion utility will also convert prefabs which reside in any subfolders that reside in the specified folder. Otherwise, " +
                              "subfolders are ignored.";
            newBool = EditorGUILayout.ToggleLeft(content, ProcessPrefabSubfolders);
            if (newBool != ProcessPrefabSubfolders)
            {
                EditorUndoEx.Record(undoRecordObject);
                ProcessPrefabSubfolders = newBool;
            }
        }
        protected override void RenderContent(UnityEngine.Object undoRecordObject)
        {
            bool  newBool; Color newColor;
            float newFloat;
            SelectionBoxBorderStyle newBoxBorderStyle;
            SelectionBoxRenderMode  newBoxRenderMode;

            // Can draw?
            var content = new GUIContent();

            content.text    = "Draw highlight";
            content.tooltip = "Allows you to toggle selection highlight drawing on/off.";
            newBool         = EditorGUILayout.ToggleLeft(content, DrawHighlight);
            if (newBool != DrawHighlight)
            {
                EditorUndoEx.Record(undoRecordObject);
                DrawHighlight = newBool;
            }

            // Selection box border style
            content.text      = "Box border style";
            content.tooltip   = "Allows you to control the style of the selection box borders.";
            newBoxBorderStyle = (SelectionBoxBorderStyle)EditorGUILayout.EnumPopup(content, SelBoxBorderStyle);
            if (newBoxBorderStyle != SelBoxBorderStyle)
            {
                EditorUndoEx.Record(undoRecordObject);
                SelBoxBorderStyle = newBoxBorderStyle;
            }

            if (SelBoxBorderStyle == SelectionBoxBorderStyle.WireCorners)
            {
                // Wire corner line percentage
                content.text    = "Corner line percentage";
                content.tooltip = "When the border style is set to \'WireCorners\', this controls the length of the corner lines as a percentage of half the box edge along which they extend.";
                newFloat        = EditorGUILayout.FloatField(content, WireCornerLinePercentage);
                if (newFloat != WireCornerLinePercentage)
                {
                    EditorUndoEx.Record(undoRecordObject);
                    WireCornerLinePercentage = newFloat;
                }
            }

            // Selection box render mode
            content.text     = "Box render mode";
            content.tooltip  = "Allows you to control the selection box render mode (e.g. per object, from parent to bottom, selection volume).";
            newBoxRenderMode = (SelectionBoxRenderMode)EditorGUILayout.EnumPopup(content, SelBoxRenderMode);
            if (newBoxRenderMode != SelBoxRenderMode)
            {
                EditorUndoEx.Record(undoRecordObject);
                SelBoxRenderMode = newBoxRenderMode;
            }

            // Selection box inflate amount
            content.text    = "Box inflate amount";
            content.tooltip = "Allows you to inflate the selection boxes to avoid Z wars with the object's volume.";
            newFloat        = EditorGUILayout.FloatField(content, SelectionBoxInflateAmount);
            if (newFloat != SelectionBoxInflateAmount)
            {
                EditorUndoEx.Record(undoRecordObject);
                SelectionBoxInflateAmount = newFloat;
            }

            // Selection box border color
            content.text    = "Box border color";
            content.tooltip = "Allows you to modify the color of the selection box border lines.";
            newColor        = EditorGUILayout.ColorField(content, SelectionBoxBorderColor);
            if (newColor != SelectionBoxBorderColor)
            {
                EditorUndoEx.Record(undoRecordObject);
                SelectionBoxBorderColor = newColor;
            }

            // Selection rectangle border color
            content.text    = "Select rect border color";
            content.tooltip = "Allows you to modify the color of the selection rectangle border.";
            newColor        = EditorGUILayout.ColorField(content, SelectionRectBorderColor);
            if (newColor != SelectionRectBorderColor)
            {
                EditorUndoEx.Record(undoRecordObject);
                SelectionRectBorderColor = newColor;
            }

            // Selection rectangle fill color
            content.text    = "Select rect fill color";
            content.tooltip = "Allows you to modify the fill color of the selection rectangle.";
            newColor        = EditorGUILayout.ColorField(content, SelectionRectFillColor);
            if (newColor != SelectionRectFillColor)
            {
                EditorUndoEx.Record(undoRecordObject);
                SelectionRectFillColor = newColor;
            }
        }