Exemplo n.º 1
0
        public AxisKeyboardRotationSettingsView(AxisKeyboardRotationSettings settings)
        {
            _settings = settings;

            ToggleVisibilityBeforeRender = true;
            IndentContent = true;
        }
Exemplo n.º 2
0
        public void RotateUsingKeyboardSettings(TransformAxis rotationAxis)
        {
            if (IsAnyMouseSessionActive)
            {
                return;
            }

            ObjectKeyboardRotationSettings keyboardRotationSettings = ObjectPlacementGuideSettings.Get().KeyboardRotationSettings;

            UndoEx.RecordForToolAction(_transform);

            AxisKeyboardRotationSettings axisKeyboardRotationSettings = keyboardRotationSettings.XAxisRotationSettings;

            if (rotationAxis == TransformAxis.Y)
            {
                axisKeyboardRotationSettings = keyboardRotationSettings.YAxisRotationSettings;
            }
            else if (rotationAxis == TransformAxis.Z)
            {
                axisKeyboardRotationSettings = keyboardRotationSettings.XAxisRotationSettings;
            }

            gameObject.RotateHierarchyBoxAroundPoint(axisKeyboardRotationSettings.RotationAmountInDegrees,
                                                     TransformAxes.GetVector(rotationAxis, TransformSpace.Global, _transform),
                                                     gameObject.GetHierarchyWorldOrientedBox().Center);

            UndoEx.RecordForToolAction(_sourcePrefab.ActivationSettings);
            _sourcePrefab.ActivationSettings.WorldRotation = _transform.rotation;
        }