Ejemplo n.º 1
0
 private void Start()
 {
     m_input = GetComponent <BaseHandleInput>();
     if (m_input == null || m_input.Handle != this)
     {
         m_input        = gameObject.AddComponent <BaseHandleInput>();
         m_input.Handle = this;
     }
     OnStartOverride();
 }
Ejemplo n.º 2
0
        protected override void Start()
        {
            m_input = GetComponent <BaseHandleInput>();
            if (m_input == null || m_input.Handle != this)
            {
                m_input        = gameObject.AddComponent <BaseHandleInput>();
                m_input.Handle = this;
            }

            IRTEGraphicsLayer graphicsLayer = Window.IOCContainer.Resolve <IRTEGraphicsLayer>();

            if (graphicsLayer != null)
            {
                m_rteCamera = graphicsLayer.Camera;
            }

            if (m_rteCamera == null && Window.Camera != null)
            {
                IRTEGraphics graphics = IOC.Resolve <IRTEGraphics>();
                if (graphics != null)
                {
                    m_rteCamera = graphics.GetOrCreateCamera(Window.Camera, CameraEvent.AfterImageEffectsOpaque);
                }

                if (m_rteCamera == null)
                {
                    m_rteCamera       = Window.Camera.gameObject.AddComponent <RTECamera>();
                    m_rteCamera.Event = CameraEvent.AfterImageEffectsOpaque;
                }
            }

            if (Model == null && m_rteCamera != null)
            {
                m_prevScale = transform.localScale;

                m_prevCamPosition          = m_rteCamera.Camera.transform.position;
                m_prevCamRotation          = m_rteCamera.Camera.transform.rotation;
                m_prevCamOrthographic      = m_rteCamera.Camera.orthographic;
                m_prevCamOrthographicsSize = m_rteCamera.Camera.orthographicSize;
                m_prevCamRect = m_rteCamera.Camera.rect;

                m_rteCamera.CommandBufferRefresh += OnCommandBufferRefresh;
                m_rteCamera.RefreshCommandBuffer();
            }

#pragma warning disable CS0618
            OnStartOverride();
#pragma warning restore CS0618
        }
Ejemplo n.º 3
0
        private void Start()
        {
            m_input = GetComponent <BaseHandleInput>();
            if (m_input == null || m_input.Handle != this)
            {
                m_input        = gameObject.AddComponent <BaseHandleInput>();
                m_input.Handle = this;
            }

            IRTEGraphicsLayer graphicsLayer = Window.IOCContainer.Resolve <IRTEGraphicsLayer>();

            if (graphicsLayer != null)
            {
                m_rteCamera = graphicsLayer.Camera;
            }

            if (m_rteCamera == null && Window.Camera != null)
            {
                m_rteCamera = Window.Camera.GetComponent <IRTECamera>();
                if (m_rteCamera == null)
                {
                    m_rteCamera       = Window.Camera.gameObject.AddComponent <RTECamera>();
                    m_rteCamera.Event = UnityEngine.Rendering.CameraEvent.AfterImageEffectsOpaque;
                }
            }

            if (Model == null && m_rteCamera != null)
            {
                m_prevScale = transform.localScale;

                m_prevCamPosition          = m_rteCamera.Camera.transform.position;
                m_prevCamRotation          = m_rteCamera.Camera.transform.rotation;
                m_prevCamOrthographic      = m_rteCamera.Camera.orthographic;
                m_prevCamOrthographicsSize = m_rteCamera.Camera.orthographicSize;
                m_prevCamRect = m_rteCamera.Camera.rect;

                m_rteCamera.CommandBufferRefresh += OnCommandBufferRefresh;
                m_rteCamera.RefreshCommandBuffer();
            }

            OnStartOverride();
        }
Ejemplo n.º 4
0
        protected override void OnEnableOverride()
        {
            BaseHandleInput input = GetComponent <BaseHandleInput>();

            if (input == null || input.Handle != this)
            {
                input        = gameObject.AddComponent <PositionHandleInput>();
                input.Handle = this;
            }

            base.OnEnableOverride();

            m_isInVertexSnappingMode = false;
            Editor.Tools.IsSnapping  = false;
            m_handleOffset           = Vector3.zero;
            m_targetLayers           = null;
            m_snapTargets            = null;
            m_snapTargetsBounds      = null;
            m_allExposedToEditor     = null;

            Editor.Tools.IsSnappingChanged += OnSnappingChanged;
            OnSnappingChanged();
        }