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;
            }
        }
Ejemplo n.º 2
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();
        }
Ejemplo n.º 3
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;
            }
Ejemplo n.º 4
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;
            }
        }
Ejemplo n.º 5
0
        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);
            }
        }
Ejemplo n.º 6
0
        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);
        }
Ejemplo n.º 7
0
        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);
            }
        }
Ejemplo n.º 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 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();
        }
Ejemplo n.º 9
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);
        }
Ejemplo n.º 10
0
        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;
            }
        }
        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;
            }
        }
Ejemplo n.º 12
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);
            }
        }