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;
            }
        }
        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;
            }
        }
        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; int newInt;
            MultiSelectOverlapMode newMultiSelectOverlapMode;

            // Can click select
            var content = new GUIContent();

            content.text    = "Can click select";
            content.tooltip = "Allows you to specify if objects can be selected via mouse clicks.";
            newBool         = EditorGUILayout.ToggleLeft(content, CanClickSelect);
            if (newBool != CanClickSelect)
            {
                EditorUndoEx.Record(undoRecordObject);
                CanClickSelect = newBool;
            }

            // Can cyclical click select
            content.text    = "Enable cyclical click select";
            content.tooltip = "If this is checked, each successive click will select an object which lies behind the previously selected one. Useful especially when dealing with overlapping sprites.";
            newBool         = EditorGUILayout.ToggleLeft(content, EnableCyclicalClickSelect);
            if (newBool != EnableCyclicalClickSelect)
            {
                EditorUndoEx.Record(undoRecordObject);
                EnableCyclicalClickSelect = newBool;
            }

            // Can multi select
            content.text    = "Can multi-select";
            content.tooltip = "Allows you to specify if objects can be selected using the multi-select shape.";
            newBool         = EditorGUILayout.ToggleLeft(content, CanMultiSelect);
            if (newBool != CanMultiSelect)
            {
                EditorUndoEx.Record(undoRecordObject);
                CanMultiSelect = newBool;
            }

            content.text              = "Multi-select overlap mode";
            content.tooltip           = "Allows you to specify the way in which objects are selected via the multi-select shape.";
            newMultiSelectOverlapMode = (MultiSelectOverlapMode)EditorGUILayout.EnumPopup(content, MultiSelectOverlapMode);
            if (newMultiSelectOverlapMode != MultiSelectOverlapMode)
            {
                EditorUndoEx.Record(undoRecordObject);
                MultiSelectOverlapMode = newMultiSelectOverlapMode;
            }

            // Selectable object types
            content.text    = "Selectable object types";
            content.tooltip = "Allows you to specify which object types can be selected.";
            newInt          = (int)((GameObjectType)EditorGUILayout.EnumMaskPopup(content, (GameObjectType)_selectableObjectTypes));
            if (newInt != (int)_selectableObjectTypes)
            {
                EditorUndoEx.Record(undoRecordObject);
                _selectableObjectTypes = (GameObjectType)newInt;
            }

            // Selectable layers
            content.text    = "Selectable layers";
            content.tooltip = "Allows you to specify which layers can be selected.";
            newInt          = EditorGUILayoutEx.LayerMaskField(content, _selectableLayers);
            if (newInt != _selectableLayers)
            {
                EditorUndoEx.Record(undoRecordObject);
                _selectableLayers = newInt;
            }

            // Duplicatable layers
            content.text    = "Duplicatable layers";
            content.tooltip = "Allows you to specify which layers can be duplicated.";
            newInt          = EditorGUILayoutEx.LayerMaskField(content, _duplicatableLayers);
            if (newInt != _duplicatableLayers)
            {
                EditorUndoEx.Record(undoRecordObject);
                _duplicatableLayers = newInt;
            }

            // Deletable layers
            content.text    = "Deletable layers";
            content.tooltip = "Allows you to specify which layers can be deleted.";
            newInt          = EditorGUILayoutEx.LayerMaskField(content, _deletableLayers);
            if (newInt != _deletableLayers)
            {
                EditorUndoEx.Record(undoRecordObject);
                _deletableLayers = newInt;
            }

            // Multi-select shape
            content.text    = "Min multi-select size";
            content.tooltip = "The minimum size (width and height) the multi-select shape must have to be able to overlap objects. The value is expressed in pixels.";
            newInt          = EditorGUILayout.IntField(content, MinMultiSelectSize);
            if (newInt != MinMultiSelectSize)
            {
                EditorUndoEx.Record(undoRecordObject);
                MinMultiSelectSize = newInt;
            }
        }
예제 #5
0
        protected override void RenderContent(UnityEngine.Object undoRecordObject)
        {
            bool          newBool; float newFloat; int newInt;
            TransformAxis newTransformAxis;

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

            content.text    = "Align axis";
            content.tooltip = "If this is checked, the grabbed objects will have their local axes aligned with the grab surface normal.";
            newBool         = EditorGUILayout.ToggleLeft(content, AlignAxis);
            if (newBool != AlignAxis)
            {
                EditorUndoEx.Record(undoRecordObject);
                AlignAxis = newBool;
            }

            content.text     = "Alignment axis";
            content.tooltip  = "When axis alignment is turned on, this is the axis that will be aligned to the surface normal.";
            newTransformAxis = (TransformAxis)EditorGUILayout.EnumPopup(content, AlignmentAxis);
            if (newTransformAxis != AlignmentAxis)
            {
                EditorUndoEx.Record(undoRecordObject);
                AlignmentAxis = newTransformAxis;
            }

            EditorGUILayout.Separator();
            EditorGUILayoutEx.SectionHeader("Sensitivity");
            content.text    = "Rotation";
            content.tooltip = "Allows you to control how sensitive object rotation is to the input device.";
            newFloat        = EditorGUILayout.FloatField(content, RotationSensitivity);
            if (newFloat != RotationSensitivity)
            {
                EditorUndoEx.Record(undoRecordObject);
                RotationSensitivity = newFloat;
            }

            content.text    = "Scale";
            content.tooltip = "Allows you to control how sensitive object scaling is to the input device.";
            newFloat        = EditorGUILayout.FloatField(content, ScaleSensitivity);
            if (newFloat != ScaleSensitivity)
            {
                EditorUndoEx.Record(undoRecordObject);
                ScaleSensitivity = newFloat;
            }

            content.text    = "Offset from surface";
            content.tooltip = "Sensitivity value used when offseting objects from the surface on which they are sitting.";
            newFloat        = EditorGUILayout.FloatField(content, OffsetFromSurfaceSensitivity);
            if (newFloat != OffsetFromSurfaceSensitivity)
            {
                EditorUndoEx.Record(undoRecordObject);
                OffsetFromSurfaceSensitivity = newFloat;
            }

            content.text    = "Offset from anchor";
            content.tooltip = "Sensitivity value used when offseting objects from the anchor point.";
            newFloat        = EditorGUILayout.FloatField(content, OffsetFromAnchorSensitivity);
            if (newFloat != OffsetFromAnchorSensitivity)
            {
                EditorUndoEx.Record(undoRecordObject);
                OffsetFromAnchorSensitivity = newFloat;
            }

            EditorGUILayout.Separator();
            EditorGUILayoutEx.SectionHeader("Surface");
            content.text    = "Default offset";
            content.tooltip = "A default offset value which controls the distance between the objects and the surface they are sitting on. Negative values can be used to embed objects in the surface.";
            newFloat        = EditorGUILayout.FloatField(content, DefaultOffsetFromSurface);
            if (newFloat != DefaultOffsetFromSurface)
            {
                EditorUndoEx.Record(undoRecordObject);
                DefaultOffsetFromSurface = newFloat;
            }

            content.text    = "Surface flags";
            content.tooltip = "Allows you to specify the types of surfaces that can be used during a grab session.";
            newInt          = (int)((ObjectGrabSurfaceFlags)EditorGUILayout.EnumMaskPopup(content, (ObjectGrabSurfaceFlags)SurfaceFlags));
            if (newInt != (int)SurfaceFlags)
            {
                EditorUndoEx.Record(undoRecordObject);
                SurfaceFlags = (ObjectGrabSurfaceFlags)newInt;
            }

            content.text    = "Surface layers";
            content.tooltip = "Allows you to specify which layers can be used as snap surface during a grab session.";
            newInt          = EditorGUILayoutEx.LayerMaskField(content, SurfaceLayers);
            if (newInt != SurfaceLayers)
            {
                EditorUndoEx.Record(undoRecordObject);
                SurfaceLayers = newInt;
            }

            content.text    = "Spherical mesh layers";
            content.tooltip = "Objects that belong to these layers will be treated as spherical meshes (spheres). This allows the system to make " +
                              "certain assumptions about the surface geometry in order to produce the correct results.";
            newInt = EditorGUILayoutEx.LayerMaskField(content, SphericalMeshLayers);
            if (newInt != SphericalMeshLayers)
            {
                EditorUndoEx.Record(undoRecordObject);
                SphericalMeshLayers = newInt;
            }

            content.text    = "Terrain mesh layers";
            content.tooltip = "Objects that belong to these layers will be treated as terrain meshes (meshes that resemble a terrain but are NOT Unity Terrains). This allows the system to make " +
                              "certain assumptions about the surface geometry in order to produce the correct results.";
            newInt = EditorGUILayoutEx.LayerMaskField(content, TerrainMeshLayers);
            if (newInt != TerrainMeshLayers)
            {
                EditorUndoEx.Record(undoRecordObject);
                TerrainMeshLayers = newInt;
            }

            EditorGUILayout.Separator();
            EditorGUILayoutEx.SectionHeader("Per layer settings");
            EditorGUILayout.BeginHorizontal();
            content.text    = "Add";
            content.tooltip = "Adds grab settings which apply only to the chosen layer. Objects which belong to that layer will use these settings during a grab session.";
            if (GUILayout.Button(content, GUILayout.Width(70.0f)))
            {
                EditorUndoEx.Record(undoRecordObject);
                GetLayerGrabSettings(_newLayer).IsActive = true;
            }

            newInt = EditorGUILayout.LayerField(_newLayer);
            if (newInt != _newLayer)
            {
                EditorUndoEx.Record(undoRecordObject);
                _newLayer = newInt;
            }
            EditorGUILayout.EndHorizontal();

            foreach (var layerGrabSettings in _layerGrabSettings)
            {
                if (layerGrabSettings.IsActive)
                {
                    EditorGUILayout.BeginVertical("Box");
                    EditorGUILayout.HelpBox(LayerMask.LayerToName(layerGrabSettings.Layer), MessageType.None);

                    content.text    = "Align axis";
                    content.tooltip = "If this is checked, the grabbed objects that belong to this layer will have their local axes aligned with the grab surface normal.";
                    newBool         = EditorGUILayout.ToggleLeft(content, layerGrabSettings.AlignAxis);
                    if (newBool != layerGrabSettings.AlignAxis)
                    {
                        EditorUndoEx.Record(undoRecordObject);
                        layerGrabSettings.AlignAxis = newBool;
                    }

                    content.text     = "Alignment axis";
                    content.tooltip  = "When axis alignment is turned on, this is the axis that will be aligned to the surface normal.";
                    newTransformAxis = (TransformAxis)EditorGUILayout.EnumPopup(content, layerGrabSettings.AlignmentAxis);
                    if (newTransformAxis != layerGrabSettings.AlignmentAxis)
                    {
                        EditorUndoEx.Record(undoRecordObject);
                        layerGrabSettings.AlignmentAxis = newTransformAxis;
                    }

                    content.text    = "Default offset from surface";
                    content.tooltip = "A default offset value which controls the distance between the objects and the surface they are sitting on. Negative values can be used to embed objects in the surface.";
                    newFloat        = EditorGUILayout.FloatField(content, layerGrabSettings.DefaultOffsetFromSurface);
                    if (newFloat != layerGrabSettings.DefaultOffsetFromSurface)
                    {
                        EditorUndoEx.Record(undoRecordObject);
                        layerGrabSettings.DefaultOffsetFromSurface = newFloat;
                    }

                    content.text    = "Remove";
                    content.tooltip = "Removes the settings for this layer.";
                    if (GUILayout.Button(content, GUILayout.Width(70.0f)))
                    {
                        EditorUndoEx.Record(undoRecordObject);
                        layerGrabSettings.IsActive = false;
                    }
                    EditorGUILayout.EndVertical();
                }
            }
        }