Ejemplo n.º 1
0
        protected override void AwakeOverride()
        {
            base.AwakeOverride();

            m_allHandles.Add(this);

            RuntimeHandlesComponent.InitializeIfRequired(ref Appearance);
            RuntimeHandlesHitTester.InitializeIfRequired(Window, ref HitTester);

            if (m_targets != null && m_targets.Length > 0)
            {
                var lockObject = LockObject;
                if (m_commonCenter == null || m_commonCenter.Length == 0 || m_commonCenter[0] != m_targets[0])
                {
                    Targets = m_targets;
                }
                if (lockObject != null)
                {
                    LockObject = lockObject;
                }
            }

            if (Targets == null || Targets.Length == 0)
            {
                var lockObject = LockObject;
                Targets = new[] { transform };
                if (lockObject != null)
                {
                    LockObject = lockObject;
                }
            }

            if (Model != null)
            {
                bool activeSelf = Model.gameObject.activeSelf;
                Model.gameObject.SetActive(false);
                BaseHandleModel model = Instantiate(Model, transform.parent);

                model.name       = Model.name;
                model.Appearance = Appearance;
                model.Window     = Window;

                Model.gameObject.SetActive(activeSelf);

                if (enabled)
                {
                    model.gameObject.SetActive(true);
                    Model = model;
                    Model.SetLock(LockObject);
                }
                else
                {
                    Model = model;
                }

                Model.ModelScale      = Appearance.HandleScale;
                Model.SelectionMargin = Appearance.SelectionMargin;
            }
        }
Ejemplo n.º 2
0
        private void Start()
        {
            if (SceneCamera == null)
            {
                SceneCamera = Camera.main;
            }

            if (EnableUndo)
            {
                if (!RuntimeUndoComponent.IsInitialized)
                {
                    GameObject runtimeUndo = new GameObject();
                    runtimeUndo.name = "RuntimeUndo";
                    runtimeUndo.AddComponent <RuntimeUndoComponent>();
                }
            }

            if (GLRenderer.Instance == null)
            {
                GameObject glRenderer = new GameObject();
                glRenderer.name = "GLRenderer";
                glRenderer.AddComponent <GLRenderer>();
            }

            if (SceneCamera != null)
            {
                if (!SceneCamera.GetComponent <GLCamera>())
                {
                    SceneCamera.gameObject.AddComponent <GLCamera>();
                }
            }

            if (Targets == null || Targets.Length == 0)
            {
                Targets = new[] { transform };
            }

            if (GLRenderer.Instance != null)
            {
                GLRenderer.Instance.Add(this);
            }

            if (Targets[0].position != transform.position)
            {
                transform.position = Targets[0].position;
            }

            if (Model != null)
            {
                BaseHandleModel model = Instantiate(Model, transform.parent);
                model.name = Model.name;
                Model      = model;
                Model.SetLock(LockObject);
            }

            StartOverride();
        }
Ejemplo n.º 3
0
        public void SetModel(BaseHandleModel model)
        {
            model.Appearance      = Appearance;
            model.Window          = Window;
            model.ModelScale      = Appearance.HandleScale;
            model.SelectionMargin = Appearance.SelectionMargin;
            model.gameObject.SetActive(gameObject.activeSelf && enabled);
            model.SetLock(LockObject);

            Model = model;
        }
Ejemplo n.º 4
0
        protected override void AwakeOverride()
        {
            base.AwakeOverride();

            m_allHandles.Add(this);

            RuntimeHandlesComponent.InitializeIfRequired(ref Appearance);
            if (m_targets != null && m_targets.Length > 0)
            {
                Targets = m_targets;
            }

            if (Targets == null || Targets.Length == 0)
            {
                Targets = new[] { transform };
            }

            if (GLRenderer.Instance == null)
            {
                GameObject glRenderer = new GameObject();
                glRenderer.name = "GLRenderer";
                glRenderer.transform.SetParent(Editor.Root, false);
                glRenderer.AddComponent <GLRenderer>();
            }

            if (GLRenderer.Instance != null)
            {
                GLRenderer.Instance.Add(this);
            }

            if (Targets[0].position != transform.position)
            {
                transform.position = Targets[0].position;
            }

            if (Model != null)
            {
                bool activeSelf = Model.gameObject.activeSelf;
                Model.gameObject.SetActive(false);
                BaseHandleModel model = Instantiate(Model, transform.parent);

                model.name       = Model.name;
                model.Appearance = Appearance;
                model.Window     = Window;

                Model.gameObject.SetActive(activeSelf);
                model.gameObject.SetActive(true);

                Model = model;
                Model.SetLock(LockObject);
            }
        }