protected virtual void OnEnable() { Editor.Tools.PivotRotationChanged += OnPivotRotationChanged; Editor.Tools.PivotModeChanged += OnPivotModeChanged; Editor.Tools.ToolChanged += OnRuntimeToolChanged; Editor.Tools.LockAxesChanged += OnLockAxesChanged; Editor.Undo.UndoCompleted += OnUndoCompleted; Editor.Undo.RedoCompleted += OnRedoCompleted; #pragma warning disable CS0618 OnEnableOverride(); #pragma warning restore CS0618 if (HitTester != null) { HitTester.Add(this); } if (m_input != null) { m_input.enabled = true; } if (Model != null) { SyncModelTransform(); Model.gameObject.SetActive(true); if (!Model.gameObject.IsPrefab()) { Model.SetLock(LockObject); } } else { if (m_rteCamera != null) { m_rteCamera.CommandBufferRefresh += OnCommandBufferRefresh; m_rteCamera.RefreshCommandBuffer(); } } }
private void OnEnable() { Editor.Tools.PivotModeChanged += OnPivotModeChanged; Editor.Tools.ToolChanged += OnRuntimeToolChanged; Editor.Tools.LockAxesChanged += OnLockAxesChanged; Editor.Undo.UndoCompleted += OnUndoCompleted; Editor.Undo.RedoCompleted += OnRedoCompleted; OnEnableOverride(); if (HitTester != null) { HitTester.Add(this); } if (m_input != null) { m_input.enabled = true; } if (Model != null) { SyncModelTransform(); Model.gameObject.SetActive(true); if (!Model.gameObject.IsPrefab()) { Model.SetLock(LockObject); } } else { if (GLRenderer.Instance != null) { GLRenderer.Instance.Add(this); } } }
protected override void AwakeOverride() { base.AwakeOverride(); m_allHandles.Add(this); RuntimeHandlesComponent.InitializeIfRequired(ref Appearance); RuntimeHandlesHitTester.InitializeIfRequired(Window, ref HitTester); HitTester.Add(this); if (m_targets != null && m_targets.Length > 0) { var lockObject = LockObject; 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 (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); if (enabled) { model.gameObject.SetActive(true); Model = model; Model.SetLock(LockObject); } else { Model = model; } Model.ModelScale = Appearance.HandleScale; Model.SelectionMargin = Appearance.SelectionMargin; } }