Пример #1
0
        public void SetWorkGizmo(int gizmoId)
        {
            if (gizmoId != ObjectSelectionGizmoId.None)
            {
                bool wasEnabled = _workGizmo.Gizmo.IsEnabled;
                _workGizmo.Gizmo.SetEnabled(false);
                _workGizmo = GetObjectSelectionGizmo(gizmoId);
                if (_areGizmosVisible && _workGizmo.IsUsable && wasEnabled)
                {
                    _workGizmo.Gizmo.SetEnabled(true);
                }
                else
                {
                    _workGizmo.Gizmo.SetEnabled(false);
                }
            }
            else
            {
                if (_workGizmo != null)
                {
                    _workGizmo.Gizmo.SetEnabled(false);
                }
            }

            _workGizmoId = gizmoId;
        }
 public void SetWorkGizmo(int gizmoId)
 {
     if (gizmoId != ObjectSelectionGizmoId.None)
     {
         _workGizmo.Gizmo.SetEnabled(false);
         _workGizmo = GetObjectSelectionGizmo(gizmoId);
         _workGizmo.Gizmo.SetEnabled(true);
     }
     else
     {
         if (_workGizmo != null)
         {
             _workGizmo.Gizmo.SetEnabled(false);
         }
     }
 }
Пример #3
0
        public void SetGizmoUsable(int gizmoId, bool isUsable)
        {
            ObjectSelectionGizmo selectionGizmo = GetObjectSelectionGizmo(gizmoId);

            if (selectionGizmo != null)
            {
                if (selectionGizmo.IsUsable != isUsable)
                {
                    selectionGizmo.IsUsable = isUsable;
                    if (!selectionGizmo.IsUsable && _workGizmo.Id == selectionGizmo.Id)
                    {
                        selectionGizmo.Gizmo.SetEnabled(false);
                    }
                }
            }
        }
Пример #4
0
        public void Initialize_SystemCall()
        {
            var objectMoveGizmo = RTGizmosEngine.Get.CreateObjectMoveGizmo();

            RegisterGizmo(ObjectSelectionGizmoId.MoveGizmo, objectMoveGizmo.Gizmo);
            _workGizmo = GetObjectSelectionGizmo(objectMoveGizmo.Gizmo);
            _workGizmo.Gizmo.SetEnabled(false);
            _workGizmoId = ObjectSelectionGizmoId.MoveGizmo;

            var objectRotationGizmo = RTGizmosEngine.Get.CreateObjectRotationGizmo();

            RegisterGizmo(ObjectSelectionGizmoId.RotationGizmo, objectRotationGizmo.Gizmo);
            objectRotationGizmo.Gizmo.SetEnabled(false);

            var objectScaleGizmo = RTGizmosEngine.Get.CreateObjectScaleGizmo();

            RegisterGizmo(ObjectSelectionGizmoId.ScaleGizmo, objectScaleGizmo.Gizmo);
            objectScaleGizmo.Gizmo.SetEnabled(false);

            var objectBoxScaleGizmo = RTGizmosEngine.Get.CreateObjectBoxScaleGizmo();

            RegisterGizmo(ObjectSelectionGizmoId.BoxScaleGizmo, objectBoxScaleGizmo.Gizmo);
            objectBoxScaleGizmo.Gizmo.SetEnabled(false);

            var objectUniversalGizmo = RTGizmosEngine.Get.CreateObjectUniversalGizmo();

            RegisterGizmo(ObjectSelectionGizmoId.UniversalGizmo, objectUniversalGizmo.Gizmo);
            objectUniversalGizmo.Gizmo.SetEnabled(false);

            var objectExtrudeGizmo = RTGizmosEngine.Get.CreateObjectExtrudeGizmo();

            RegisterGizmo(ObjectSelectionGizmoId.ExtrudeGizmo, objectExtrudeGizmo.Gizmo);
            objectExtrudeGizmo.Gizmo.SetEnabled(false);

            RTUndoRedo.Get.UndoEnd                  += OnUndoRedo;
            RTUndoRedo.Get.RedoEnd                  += OnUndoRedo;
            RTObjectSelection.Get.Changed           += OnObjectSelectionChanged;
            RTObjectSelection.Get.Rotated           += OnObjectSelectionRotated;
            RTObjectSelection.Get.Enabled           += OnObjectSelectionEnabled;
            RTObjectSelection.Get.Disabled          += OnObjectSelectionDisabled;
            RTObjectSelection.Get.ManipSessionBegin += OnObjectSelectionManipSessionBegin;
            RTObjectSelection.Get.ManipSessionEnd   += OnObjectSelectionManipSessionEnd;

            SetTransformSpace(GizmoSpace.Local);
            SetTransformPivot(GizmoObjectTransformPivot.ObjectGroupCenter);
        }
Пример #5
0
        private void OnGizmoPostEnabled(Gizmo gizmo)
        {
            ObjectSelectionGizmo selectionGizmo = GetObjectSelectionGizmo(gizmo);

            if (selectionGizmo.IsTransformGizmo)
            {
                selectionGizmo.TransformGizmo.RefreshPositionAndRotation();
            }
            else if (selectionGizmo.IsBoxScaleGizmo)
            {
                _workGizmo.BoxScaleGizmo.SetTargetHierarchy(_pivotObject);
            }
            else if (selectionGizmo.IsExtrudeGizmo)
            {
                _workGizmo.ExtrudeGizmo.SetExtrudeTargets(_targetObjectCollection);
            }
        }