예제 #1
0
        public void SetTargetCamera(Camera camera)
        {
            if (camera == null)
            {
                return;
            }

            if (Application.isPlaying)
            {
                if (IsDoingFocus || IsDoingProjectionSwitch || IsDoingRotationSwitch)
                {
                    return;
                }

                _targetCamera    = camera;
                _targetTransform = camera.transform;
                _fieldOfView     = camera.fieldOfView;

                SetFocusPoint(GetFocusPoint());
                AdjustOrthoSizeForFocusPt();

                _isObjectVisibilityDirty = true;
            }
            #if UNITY_EDITOR
            else
            {
                if (GameObjectEx.IsSceneObject(camera.gameObject))
                {
                    _targetCamera = camera;
                    _fieldOfView  = camera.fieldOfView;
                }
            }
            #endif
        }
예제 #2
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);
            }
        }
예제 #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);
            }
        }
예제 #4
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);
        }
예제 #5
0
        public void Focus(List <GameObject> gameObjects)
        {
            var boundsQConfig = new ObjectBounds.QueryConfig();

            boundsQConfig.NoVolumeSize = Vector3.one * 0.01f;
            boundsQConfig.ObjectTypes  = GameObjectType.Mesh | GameObjectType.Sprite | GameObjectType.Terrain;

            var parents = GameObjectEx.FilterParentsOnly(gameObjects);

            if (parents.Count != 0)
            {
                AABB focusAABB = ObjectBounds.CalcHierarchyCollectionWorldAABB(parents, boundsQConfig);
                if (focusAABB.IsValid)
                {
                    Focus(focusAABB);
                }
            }
        }
        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);
        }
 public DuplicateObjectsAction(List <GameObject> rootsToDuplicate)
 {
     _rootsToDuplicate = GameObjectEx.FilterParentsOnly(rootsToDuplicate);
 }