Пример #1
0
        public override void OnGizmoRender(Camera camera)
        {
            bool multipleRenderCams = RTGizmosEngine.Get.NumRenderCameras > 1;

            if (multipleRenderCams)
            {
                _midCap.ApplyZoomFactor(camera);
                _axesSliders.ApplyZoomFactor(camera);
                _dblSliders.ApplyZoomFactor(camera);
                if (_multiAxisScaleMode == GizmoMultiAxisScaleMode.DoubleAxis)
                {
                    PlaceDblSlidersInSliderPlanes(camera);
                }
            }

            var sortedSliders = _axesSliders.GetRenderSortedSliders(camera);

            foreach (var slider in sortedSliders)
            {
                slider.Render(camera);
            }

            _xySlider.Render(camera);
            _yzSlider.Render(camera);
            _zxSlider.Render(camera);
            _midCap.Render(camera);

            if (LookAndFeel3D.IsScaleGuideVisible && Gizmo.IsDragged && OwnsHandle(Gizmo.DragHandleId))
            {
                _scaleGuide.Render(GameObjectEx.FilterParentsOnly(_scaleGuideTargetObjects), camera);
            }
        }
Пример #2
0
        private bool Begin(IEnumerable <GameObject> targetObjects)
        {
            if (_state != State.Inactive || SharedSettings == null || SharedHotkeys == null || targetObjects == null)
            {
                return(false);
            }

            _targetObjects = new List <GameObject>(targetObjects);
            if (_targetObjects.Count == 0)
            {
                return(false);
            }
            _targetParents = GameObjectEx.FilterParentsOnly(_targetObjects);

            if (!CalculateTargetAABB() || !IdentifySitSurface())
            {
                _targetObjects.Clear();
                _targetParents.Clear();
                return(false);
            }

            _state = State.Active;
            _preTargetTransformSnapshots = LocalTransformSnapshot.GetSnapshotCollection(_targetParents);

            if (SessionBegin != null)
            {
                SessionBegin();
            }
            return(true);
        }
Пример #3
0
        public override void OnGizmoRender(Camera camera)
        {
            bool multipleRenderCams = RTGizmosEngine.Get.NumRenderCameras > 1;

            if (multipleRenderCams)
            {
                _mvAxesSliders.ApplyZoomFactor(camera);
                if (!_isMvVertexSnapEnabled && !_is2DModeEnabled)
                {
                    _mvDblSliders.ApplyZoomFactor(camera);
                    PlaceMvDblSlidersInSliderPlanes(camera);
                }

                Update2DGizmoPosition();
                if (_is2DModeEnabled)
                {
                    Update2DModeHandlePositions();
                }

                _rtMidCap.ApplyZoomFactor(camera);
                _rtAxesSliders.ApplyZoomFactor(camera);
                if (_rtCamLookSlider.IsBorderVisible)
                {
                    UpdateRtCamLookSlider(camera);
                }

                _scMidCap.ApplyZoomFactor(camera);
            }

            _rtXSlider.Render(camera);
            _rtYSlider.Render(camera);
            _rtZSlider.Render(camera);
            _rtMidCap.Render(camera);

            var sortedSliders = _mvAxesSliders.GetRenderSortedSliders(camera);

            foreach (var slider in sortedSliders)
            {
                slider.Render(camera);
            }

            _rtCamLookSlider.Render(camera);
            _mvXYSlider.Render(camera);
            _mvYZSlider.Render(camera);
            _mvZXSlider.Render(camera);
            _scMidCap.Render(camera);

            _mvVertSnapCap.Render(camera);
            _mv2DModeSliders.Render(camera);
            _mv2DModeDblSlider.Render(camera);

            if (LookAndFeel3D.IsScScaleGuideVisible && Gizmo.IsDragged && IsScaleHandle(Gizmo.DragHandleId))
            {
                _scScaleGuide.Render(GameObjectEx.FilterParentsOnly(_scScaleGuideTargetObjects), camera);
            }
        }
        private bool IdentifyTargetParents(IEnumerable <GameObject> targetObjects)
        {
            _targetParents = GameObjectEx.FilterParentsOnly(targetObjects);
            if (_targetParents == null || _targetParents.Count == 0)
            {
                return(false);
            }

            return(true);
        }
Пример #5
0
        public void SetExtrudeTargets(IEnumerable <GameObject> extrudeTargets)
        {
            if (extrudeTargets == null)
            {
                _targetParents.Clear();
                _boxSize = Vector3.zero;
                return;
            }

            _targetParents = GameObjectEx.FilterParentsOnly(extrudeTargets);
            FitBoxToTargets();
        }
        private void OnObjectSelectionChanged(ObjectSelectionChangedEventArgs args)
        {
            if (args.SelectReason != ObjectSelectReason.None)
            {
                if (args.SelectReason == ObjectSelectReason.Undo ||
                    args.SelectReason == ObjectSelectReason.Redo)
                {
                    _pivotObject = args.UndoRedoSnapshot.GizmosSnapshot.PivotObject;
                }
                else
                if (args.SelectReason == ObjectSelectReason.MultiSelect ||
                    args.SelectReason == ObjectSelectReason.MultiSelectAppend)
                {
                    if (_pivotObject == null)
                    {
                        _pivotObject = GameObjectEx.FilterParentsOnly(args.ObjectsWhichWereSelected)[0];
                    }
                }
                else
                {
                    if (args.NumObjectsSelected != 0)
                    {
                        _pivotObject = GameObjectEx.FilterParentsOnly(args.ObjectsWhichWereSelected)[0];
                    }
                    else
                    {
                        _pivotObject = null;
                    }
                }
            }
            else if (args.DeselectReason != ObjectDeselectReason.None)
            {
                if (args.DeselectReason == ObjectDeselectReason.Undo ||
                    args.DeselectReason == ObjectDeselectReason.Redo)
                {
                    _pivotObject = args.UndoRedoSnapshot.GizmosSnapshot.PivotObject;
                }
                else
                if (RTObjectSelection.Get.NumSelectedObjects != 0)
                {
                    if (!RTObjectSelection.Get.IsObjectSelected(_pivotObject))
                    {
                        _pivotObject = GameObjectEx.FilterParentsOnly(_targetObjectCollection)[0];
                    }
                }
                else
                {
                    _pivotObject = null;
                }
            }

            OnTargetObjectGroupUpdated();
        }
Пример #7
0
        public static ObjectAlign.Result AlignToWorldPlane(IEnumerable <GameObject> gameObjects, Plane alignmentPlane)
        {
            var parents = GameObjectEx.FilterParentsOnly(gameObjects);

            if (parents.Count == 0)
            {
                return(Result.Err_NoObjects);
            }

            AlignRootsToPlane(parents, alignmentPlane);

            return(Result.Success);
        }
Пример #8
0
        private bool IdentifyGrabTargets(IEnumerable <GameObject> targetObjects)
        {
            _targetParents = GameObjectEx.FilterParentsOnly(targetObjects);
            if (_targetParents == null || _targetParents.Count == 0)
            {
                return(false);
            }

            _grabTargets.Clear();
            foreach (GameObject targetObject in _targetParents)
            {
                if (targetObject.HierarchyHasObjectsOfType(GameObjectType.Terrain))
                {
                    continue;
                }
                _grabTargets.Add(new GrabTarget(targetObject));
            }

            return(_grabTargets.Count != 0);
        }
Пример #9
0
        private List <GameObject> GetTransformableParentObjects()
        {
            List <GameObject> targetParents        = GameObjectEx.FilterParentsOnly(_targetObjects);
            List <GameObject> transformableParents = new List <GameObject>();

            foreach (var parent in targetParents)
            {
                IRTTransformGizmoListener transformGizmoListener = parent.GetComponent <IRTTransformGizmoListener>();
                if (transformGizmoListener != null && !transformGizmoListener.OnCanBeTransformed(Gizmo))
                {
                    continue;
                }

                if (Settings.IsLayerTransformable(parent.layer) &&
                    Settings.IsObjectTransformable(parent))
                {
                    transformableParents.Add(parent);
                }
            }

            return(transformableParents);
        }
Пример #10
0
 public DuplicateObjectsAction(List <GameObject> rootsToDuplicate)
 {
     _rootsToDuplicate = GameObjectEx.FilterParentsOnly(rootsToDuplicate);
 }