Double click actions + open prefab ctxmenu

This commit is contained in:
davevanegdom
2023-09-22 18:31:54 +02:00
parent faeb21a77a
commit 23f4a82bbc
4 changed files with 75 additions and 3 deletions

View File

@@ -346,6 +346,29 @@ namespace FlaxEditor.Windows
return false;
}
/// <inheritdoc />
public override bool OnMouseDoubleClick(Float2 location, MouseButton button)
{
if(button == MouseButton.Left)
{
switch (Editor.Options.Options.Input.DoubleClickSceneNode)
{
case SceneNodeDoubleClick.Rename:
Rename();
return true;
case SceneNodeDoubleClick.Focus:
Editor.Windows.EditWin.Viewport.FocusSelection();
return true;
case SceneNodeDoubleClick.Open:
return Editor.Prefabs.OpenPrefab();
case SceneNodeDoubleClick.None:
default:
return base.OnMouseDoubleClick(location, button);
}
}
return base.OnMouseDoubleClick(location, button);
}
/// <inheritdoc />
public override void OnLostFocus()
@@ -459,4 +482,28 @@ namespace FlaxEditor.Windows
base.OnDestroy();
}
}
/// <summary>
/// Action to perform when a Scene Node receive a double mouse click (Left)
/// </summary>
[Serializable]
public enum SceneNodeDoubleClick
{
/// <summary>
/// No action is performed
/// </summary>
None,
/// <summary>
/// Rename the Scene Node
/// </summary>
Rename,
/// <summary>
/// Focus the Scene Node object in the Scene View
/// </summary>
Focus,
/// <summary>
/// If possible, open the scene node in an associated Editor (e.g. Prefab Editor)
/// </summary>
Open
}
}