// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved. using System; using FlaxEditor.Gizmo; using FlaxEngine; namespace FlaxEditor.Viewport.Modes { /// /// Editor viewport gizmo mode descriptor. Defines which gizmo tools to show and how to handle scene editing. /// /// /// Only one gizmo mode can be active at the time. It defines the viewport toolset usage. /// [HideInEditor] public abstract class EditorGizmoMode { private IGizmoOwner _owner; /// /// Gets the gizmos owner viewport. /// public IGizmoOwner Owner => _owner; /// /// Occurs when mode gets activated. /// public event Action Activated; /// /// Occurs when mode gets deactivated. /// public event Action Deactivated; /// /// Initializes the specified mode and links it to the viewport. /// /// The gizmos owner. public virtual void Init(IGizmoOwner owner) { _owner = owner; } /// /// Releases the mode. Called on editor exit or when mode gets removed from the current viewport. /// public virtual void Dispose() { _owner = null; } /// /// Called when mode gets activated. /// public virtual void OnActivated() { Activated?.Invoke(); } /// /// Called when mode gets deactivated. /// public virtual void OnDeactivated() { Deactivated?.Invoke(); } } }