Ejemplo n.º 1
0
        public void OnObjectSelectionUpdatedUsingSelectionShape()
        {
            ObjectGizmo activeGizmo = GetActiveGizmo();

            if (activeGizmo != null)
            {
                GameObject firstSelectedGameObject = ObjectSelection.Get().GetFirstSelectedGameObject();
                if (firstSelectedGameObject == null)
                {
                    return;
                }
                Transform firstSelectedObjectTransform = firstSelectedGameObject.transform;

                if (_gizmoTransformPivotPoint == TransformGizmoPivotPoint.Pivot && firstSelectedGameObject != null &&
                    _activeGizmoType != GizmoType.Duplicate)
                {
                    activeGizmo.WorldPosition = firstSelectedObjectTransform.position;
                }
                else
                {
                    activeGizmo.WorldPosition = ObjectSelection.Get().GetWorldCenter();
                }

                if (_gizmoTransformSpace == TransformSpace.Local && firstSelectedObjectTransform != null &&
                    _activeGizmoType != GizmoType.Duplicate)
                {
                    activeGizmo.WorldRotation = firstSelectedObjectTransform.rotation;
                }
                else
                {
                    activeGizmo.WorldRotation = Quaternion.identity;
                }
            }
        }
Ejemplo n.º 2
0
        public void RenderHandles(HashSet <GameObject> selectedGameObjects)
        {
            if (selectedGameObjects == null || selectedGameObjects.Count == 0 || !_areGizmosActive)
            {
                return;
            }

            ObjectGizmo activeGizmo = GetActiveGizmo();

            if (activeGizmo != null)
            {
                activeGizmo.TargetObjects = selectedGameObjects;
                activeGizmo.RenderHandles(_gizmoTransformPivotPoint);
            }
        }
Ejemplo n.º 3
0
        private void AdjustActiveGizmoRotation()
        {
            ObjectGizmo activeGizmo = GetActiveGizmo();

            if (activeGizmo != null)
            {
                if (_gizmoTransformSpace == TransformSpace.Local && _activeGizmoType != GizmoType.Duplicate)
                {
                    GameObject firstSelectedObject = ObjectSelection.Get().GetFirstSelectedGameObject();
                    if (firstSelectedObject != null)
                    {
                        activeGizmo.WorldRotation = firstSelectedObject.transform.rotation;
                    }
                }
                else
                {
                    activeGizmo.WorldRotation = Quaternion.identity;
                }
            }
        }
Ejemplo n.º 4
0
        private void AdjustActiveGizmoPosition()
        {
            ObjectGizmo activeGizmo = GetActiveGizmo();

            if (activeGizmo != null)
            {
                if (_gizmoTransformPivotPoint == TransformGizmoPivotPoint.Pivot && _activeGizmoType != GizmoType.Duplicate)
                {
                    GameObject firstSelectedObject = ObjectSelection.Get().GetFirstSelectedGameObject();
                    if (firstSelectedObject != null)
                    {
                        activeGizmo.WorldPosition = firstSelectedObject.transform.position;
                    }
                }
                else
                {
                    activeGizmo.WorldPosition = ObjectSelection.Get().GetWorldCenter();
                }
            }
        }
Ejemplo n.º 5
0
 public bool OwnsGizmo(ObjectGizmo objectTransformGizmo)
 {
     if (objectTransformGizmo == ObjectMoveGizmo)
     {
         return(true);
     }
     if (objectTransformGizmo == ObjectRotationGizmo)
     {
         return(true);
     }
     if (objectTransformGizmo == ObjectScaleGizmo)
     {
         return(true);
     }
     if (objectTransformGizmo == ObjectDuplicateGizmo)
     {
         return(true);
     }
     return(false);
 }
Ejemplo n.º 6
0
        public static void SendToInterestedListeners(ObjectGizmo objectTransformGizmo)
        {
            var message = new GizmoTransformedObjectsMessage(objectTransformGizmo);

            MessageListenerDatabase.Instance.SendMessageToInterestedListeners(message);
        }
Ejemplo n.º 7
0
 public GizmoTransformedObjectsMessage(ObjectGizmo objectTransformGizmo)
     : base(MessageType.GizmoTransformedObjects)
 {
     _objectTransformGizmo = objectTransformGizmo;
 }