private void UpdateConnectedTools()
 {
     for (int i = 0; i < m_connectedTools.Count; ++i)
     {
         RectTool tool = m_connectedTools[i];
         if (tool != this)
         {
             tool.Bounds = m_bounds;
             tool.m_lines.transform.position  = m_lines.transform.position;
             tool.m_points.transform.position = m_points.transform.position;
         }
     }
 }
        protected override void OnDrop()
        {
            base.OnDrop();

            Targets = RealTargets;

            for (int i = 0; i < m_connectedTools.Count; ++i)
            {
                RectTool tool = m_connectedTools[i];
                if (tool != this)
                {
                    tool.RecalculateBoundsAndRebuild();
                }
            }


            m_referencePoints    = null;
            m_referencePositions = null;
            m_referenceScale     = null;
        }
Beispiel #3
0
        protected override void AwakeOverride()
        {
            base.AwakeOverride();

            Window.IOCContainer.RegisterFallback <IScenePivot>(this);
            Window.IOCContainer.RegisterFallback <IRuntimeSelectionComponent>(this);

            if (m_outlineManager == null)
            {
                m_outlineManager = GetComponentInChildren <OutlineManager>(true);
                if (m_outlineManager != null)
                {
                    m_outlineManager.Camera = Window.Camera;
                }
            }

            if (m_boxSelection == null)
            {
                m_boxSelection = GetComponentInChildren <BoxSelection>(true);
            }
            if (m_positionHandle == null)
            {
                m_positionHandle = GetComponentInChildren <PositionHandle>(true);
            }
            if (m_rotationHandle == null)
            {
                m_rotationHandle = GetComponentInChildren <RotationHandle>(true);
            }
            if (m_scaleHandle == null)
            {
                m_scaleHandle = GetComponentInChildren <ScaleHandle>(true);
            }
            if (m_rectTool == null)
            {
                m_rectTool = GetComponentInChildren <RectTool>(true);
            }
            if (m_grid == null)
            {
                m_grid = GetComponentInChildren <SceneGrid>(true);
            }

            if (m_boxSelection != null)
            {
                if (m_boxSelection.Window == null)
                {
                    m_boxSelection.Window = Window;
                }

                m_boxSelection.Filtering += OnBoxSelectionFiltering;
                m_boxSelection.Selection += OnBoxSelection;
            }

            if (m_positionHandle != null)
            {
                if (m_positionHandle.Window == null)
                {
                    m_positionHandle.Window = Window;
                }

                m_positionHandle.gameObject.SetActive(true);
                m_positionHandle.gameObject.SetActive(false);

                m_positionHandle.BeforeDrag.AddListener(OnBeforeDrag);
                m_positionHandle.Drop.AddListener(OnDrop);
            }

            if (m_rotationHandle != null)
            {
                if (m_rotationHandle.Window == null)
                {
                    m_rotationHandle.Window = Window;
                }

                m_rotationHandle.gameObject.SetActive(true);
                m_rotationHandle.gameObject.SetActive(false);

                m_rotationHandle.BeforeDrag.AddListener(OnBeforeDrag);
                m_rotationHandle.Drop.AddListener(OnDrop);
            }

            if (m_scaleHandle != null)
            {
                if (m_scaleHandle.Window == null)
                {
                    m_scaleHandle.Window = Window;
                }
                m_scaleHandle.gameObject.SetActive(true);
                m_scaleHandle.gameObject.SetActive(false);

                m_scaleHandle.BeforeDrag.AddListener(OnBeforeDrag);
                m_scaleHandle.Drop.AddListener(OnDrop);
            }


            if (m_rectTool != null)
            {
                if (m_rectTool.Window == null)
                {
                    m_rectTool.Window = Window;
                }
                m_rectTool.gameObject.SetActive(true);
                m_rectTool.gameObject.SetActive(false);

                m_rectTool.BeforeDrag.AddListener(OnBeforeDrag);
                m_rectTool.Drop.AddListener(OnDrop);
            }

            if (m_grid != null)
            {
                if (m_grid.Window == null)
                {
                    m_grid.Window = Window;
                }
            }

            Editor.Selection.SelectionChanged += OnRuntimeSelectionChanged;
            Editor.Tools.ToolChanged          += OnRuntimeToolChanged;

            if (m_pivot == null)
            {
                GameObject pivot = new GameObject("Pivot");
                pivot.transform.SetParent(transform, true);
                pivot.transform.position = Vector3.zero;
                m_pivot = pivot.transform;
            }

            if (m_secondaryPivot == null)
            {
                GameObject secondaryPivot = new GameObject("SecondaryPivot");
                secondaryPivot.transform.SetParent(transform, true);
                secondaryPivot.transform.position = Vector3.zero;
                m_secondaryPivot = secondaryPivot.transform;
            }

            ApplySizeOfGrid();
            ApplyIsGridEnabled();

            OnRuntimeSelectionChanged(null);
        }