Merge branch 'master' into feat/improved-camera-settings
This commit is contained in:
@@ -1,144 +1,52 @@
|
||||
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
|
||||
|
||||
using System.ComponentModel;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Collections.Generic;
|
||||
using FlaxEditor.CustomEditors.Editors;
|
||||
using FlaxEditor.Scripting;
|
||||
using FlaxEngine;
|
||||
using FlaxEngine.Interop;
|
||||
using FlaxEngine.Tools;
|
||||
|
||||
namespace FlaxEngine.Tools
|
||||
{
|
||||
partial class AudioTool
|
||||
{
|
||||
partial struct Options
|
||||
{
|
||||
private bool ShowBtiDepth => Format != AudioFormat.Vorbis;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace FlaxEditor.CustomEditors.Dedicated
|
||||
{
|
||||
/// <summary>
|
||||
/// Custom editor for <see cref="FlaxEngine.Tools.AudioTool.Options"/>.
|
||||
/// </summary>
|
||||
[CustomEditor(typeof(FlaxEngine.Tools.AudioTool.Options)), DefaultEditor]
|
||||
public class AudioToolOptionsEditor : GenericEditor
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override List<ItemInfo> GetItemsForType(ScriptType type)
|
||||
{
|
||||
// Show both fields and properties
|
||||
return GetItemsForType(type, true, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace FlaxEditor.Content.Import
|
||||
{
|
||||
/// <summary>
|
||||
/// Proxy object to present audio import settings in <see cref="ImportFilesDialog"/>.
|
||||
/// </summary>
|
||||
[HideInEditor]
|
||||
public class AudioImportSettings
|
||||
{
|
||||
/// <summary>
|
||||
/// A custom set of bit depth audio import sizes.
|
||||
/// The settings data.
|
||||
/// </summary>
|
||||
public enum CustomBitDepth
|
||||
{
|
||||
/// <summary>
|
||||
/// The 8.
|
||||
/// </summary>
|
||||
_8 = 8,
|
||||
|
||||
/// <summary>
|
||||
/// The 16.
|
||||
/// </summary>
|
||||
_16 = 16,
|
||||
|
||||
/// <summary>
|
||||
/// The 24.
|
||||
/// </summary>
|
||||
_24 = 24,
|
||||
|
||||
/// <summary>
|
||||
/// The 32.
|
||||
/// </summary>
|
||||
_32 = 32,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts the bit depth to enum.
|
||||
/// </summary>
|
||||
/// <param name="f">The bit depth.</param>
|
||||
/// <returns>The converted enum.</returns>
|
||||
public static CustomBitDepth ConvertBitDepth(int f)
|
||||
{
|
||||
FieldInfo[] fields = typeof(CustomBitDepth).GetFields();
|
||||
for (int i = 0; i < fields.Length; i++)
|
||||
{
|
||||
var field = fields[i];
|
||||
if (field.Name.Equals("value__"))
|
||||
continue;
|
||||
|
||||
if (f == (int)field.GetRawConstantValue())
|
||||
return (CustomBitDepth)f;
|
||||
}
|
||||
|
||||
return CustomBitDepth._16;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The audio data format to import the audio clip as.
|
||||
/// </summary>
|
||||
[EditorOrder(10), DefaultValue(AudioFormat.Vorbis), Tooltip("The audio data format to import the audio clip as.")]
|
||||
public AudioFormat Format { get; set; } = AudioFormat.Vorbis;
|
||||
|
||||
/// <summary>
|
||||
/// The audio data compression quality. Used only if target format is using compression. Value 0 means the smallest size, value 1 means the best quality.
|
||||
/// </summary>
|
||||
[EditorOrder(15), DefaultValue(0.4f), Limit(0, 1, 0.01f), Tooltip("The audio data compression quality. Used only if target format is using compression. Value 0 means the smallest size, value 1 means the best quality.")]
|
||||
public float CompressionQuality { get; set; } = 0.4f;
|
||||
|
||||
/// <summary>
|
||||
/// Disables dynamic audio streaming. The whole clip will be loaded into the memory. Useful for small clips (eg. gunfire sounds).
|
||||
/// </summary>
|
||||
[EditorOrder(20), DefaultValue(false), Tooltip("Disables dynamic audio streaming. The whole clip will be loaded into the memory. Useful for small clips (eg. gunfire sounds).")]
|
||||
public bool DisableStreaming { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// Checks should the clip be played as spatial (3D) audio or as normal audio. 3D audio is stored in Mono format.
|
||||
/// </summary>
|
||||
[EditorOrder(30), DefaultValue(false), EditorDisplay(null, "Is 3D"), Tooltip("Checks should the clip be played as spatial (3D) audio or as normal audio. 3D audio is stored in Mono format.")]
|
||||
public bool Is3D { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// The size of a single sample in bits. The clip will be converted to this bit depth on import.
|
||||
/// </summary>
|
||||
[EditorOrder(40), DefaultValue(CustomBitDepth._16), Tooltip("The size of a single sample in bits. The clip will be converted to this bit depth on import.")]
|
||||
public CustomBitDepth BitDepth { get; set; } = CustomBitDepth._16;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct InternalOptions
|
||||
{
|
||||
[MarshalAs(UnmanagedType.I1)]
|
||||
public AudioFormat Format;
|
||||
public byte DisableStreaming;
|
||||
public byte Is3D;
|
||||
public int BitDepth;
|
||||
public float Quality;
|
||||
}
|
||||
|
||||
internal void ToInternal(out InternalOptions options)
|
||||
{
|
||||
options = new InternalOptions
|
||||
{
|
||||
Format = Format,
|
||||
DisableStreaming = (byte)(DisableStreaming ? 1 : 0),
|
||||
Is3D = (byte)(Is3D ? 1 : 0),
|
||||
Quality = CompressionQuality,
|
||||
BitDepth = (int)BitDepth,
|
||||
};
|
||||
}
|
||||
|
||||
internal void FromInternal(ref InternalOptions options)
|
||||
{
|
||||
Format = options.Format;
|
||||
DisableStreaming = options.DisableStreaming != 0;
|
||||
Is3D = options.Is3D != 0;
|
||||
CompressionQuality = options.Quality;
|
||||
BitDepth = ConvertBitDepth(options.BitDepth);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tries the restore the asset import options from the target resource file.
|
||||
/// </summary>
|
||||
/// <param name="options">The options.</param>
|
||||
/// <param name="assetPath">The asset path.</param>
|
||||
/// <returns>True settings has been restored, otherwise false.</returns>
|
||||
public static bool TryRestore(ref AudioImportSettings options, string assetPath)
|
||||
{
|
||||
if (AudioImportEntry.Internal_GetAudioImportOptions(assetPath, out var internalOptions))
|
||||
{
|
||||
// Restore settings
|
||||
options.FromInternal(ref internalOptions);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
[EditorDisplay(null, EditorDisplayAttribute.InlineStyle)]
|
||||
public AudioTool.Options Settings = AudioTool.Options.Default;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -147,7 +55,7 @@ namespace FlaxEditor.Content.Import
|
||||
/// <seealso cref="AssetImportEntry" />
|
||||
public partial class AudioImportEntry : AssetImportEntry
|
||||
{
|
||||
private AudioImportSettings _settings = new AudioImportSettings();
|
||||
private AudioImportSettings _settings = new();
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="AudioImportEntry"/> class.
|
||||
@@ -157,7 +65,7 @@ namespace FlaxEditor.Content.Import
|
||||
: base(ref request)
|
||||
{
|
||||
// Try to restore target asset Audio import options (useful for fast reimport)
|
||||
AudioImportSettings.TryRestore(ref _settings, ResultUrl);
|
||||
Editor.TryRestoreImportOptions(ref _settings.Settings, ResultUrl);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -166,27 +74,23 @@ namespace FlaxEditor.Content.Import
|
||||
/// <inheritdoc />
|
||||
public override bool TryOverrideSettings(object settings)
|
||||
{
|
||||
if (settings is AudioImportSettings o)
|
||||
if (settings is AudioImportSettings s)
|
||||
{
|
||||
_settings = o;
|
||||
_settings.Settings = s.Settings;
|
||||
return true;
|
||||
}
|
||||
if (settings is AudioTool.Options o)
|
||||
{
|
||||
_settings.Settings = o;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool Import()
|
||||
{
|
||||
return Editor.Import(SourceUrl, ResultUrl, _settings);
|
||||
return Editor.Import(SourceUrl, ResultUrl, _settings.Settings);
|
||||
}
|
||||
|
||||
#region Internal Calls
|
||||
|
||||
[LibraryImport("FlaxEngine", EntryPoint = "AudioImportEntryInternal_GetAudioImportOptions", StringMarshalling = StringMarshalling.Custom, StringMarshallingCustomType = typeof(StringMarshaller))]
|
||||
[return: MarshalAs(UnmanagedType.U1)]
|
||||
internal static partial bool Internal_GetAudioImportOptions(string path, out AudioImportSettings.InternalOptions result);
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -935,21 +935,6 @@ namespace FlaxEditor
|
||||
Animation = 11,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Imports the audio asset file to the target location.
|
||||
/// </summary>
|
||||
/// <param name="inputPath">The source file path.</param>
|
||||
/// <param name="outputPath">The result asset file path.</param>
|
||||
/// <param name="settings">The settings.</param>
|
||||
/// <returns>True if importing failed, otherwise false.</returns>
|
||||
public static bool Import(string inputPath, string outputPath, AudioImportSettings settings)
|
||||
{
|
||||
if (settings == null)
|
||||
throw new ArgumentNullException();
|
||||
settings.ToInternal(out var internalOptions);
|
||||
return Internal_ImportAudio(inputPath, outputPath, ref internalOptions);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Serializes the given object to json asset.
|
||||
/// </summary>
|
||||
@@ -1667,10 +1652,6 @@ namespace FlaxEditor
|
||||
[return: MarshalAs(UnmanagedType.U1)]
|
||||
internal static partial bool Internal_CloneAssetFile(string dstPath, string srcPath, ref Guid dstId);
|
||||
|
||||
[LibraryImport("FlaxEngine", EntryPoint = "EditorInternal_ImportAudio", StringMarshalling = StringMarshalling.Custom, StringMarshallingCustomType = typeof(StringMarshaller))]
|
||||
[return: MarshalAs(UnmanagedType.U1)]
|
||||
internal static partial bool Internal_ImportAudio(string inputPath, string outputPath, ref AudioImportSettings.InternalOptions options);
|
||||
|
||||
[LibraryImport("FlaxEngine", EntryPoint = "EditorInternal_GetAudioClipMetadata", StringMarshalling = StringMarshalling.Custom, StringMarshallingCustomType = typeof(StringMarshaller))]
|
||||
internal static partial void Internal_GetAudioClipMetadata(IntPtr obj, out int originalSize, out int importedSize);
|
||||
|
||||
|
||||
@@ -125,6 +125,8 @@ namespace FlaxEditor.GUI.Timeline.Tracks
|
||||
fov = cam.FieldOfView;
|
||||
customAspectRatio = cam.CustomAspectRatio;
|
||||
view.RenderLayersMask = cam.RenderLayersMask;
|
||||
view.Flags = cam.RenderFlags;
|
||||
view.Mode = cam.RenderMode;
|
||||
}
|
||||
|
||||
// Try to evaluate camera properties based on the animated tracks
|
||||
|
||||
@@ -50,43 +50,6 @@
|
||||
|
||||
Guid ManagedEditor::ObjectID(0x91970b4e, 0x99634f61, 0x84723632, 0x54c776af);
|
||||
|
||||
// Disable warning C4800: 'const byte': forcing value to bool 'true' or 'false' (performance warning)
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning( push )
|
||||
#pragma warning( disable : 4800)
|
||||
#endif
|
||||
|
||||
struct InternalAudioOptions
|
||||
{
|
||||
AudioFormat Format;
|
||||
byte DisableStreaming;
|
||||
byte Is3D;
|
||||
int32 BitDepth;
|
||||
float Quality;
|
||||
|
||||
static void Convert(InternalAudioOptions* from, ImportAudio::Options* to)
|
||||
{
|
||||
to->Format = from->Format;
|
||||
to->DisableStreaming = from->DisableStreaming;
|
||||
to->Is3D = from->Is3D;
|
||||
to->BitDepth = from->BitDepth;
|
||||
to->Quality = from->Quality;
|
||||
}
|
||||
|
||||
static void Convert(ImportAudio::Options* from, InternalAudioOptions* to)
|
||||
{
|
||||
to->Format = from->Format;
|
||||
to->DisableStreaming = from->DisableStreaming;
|
||||
to->Is3D = from->Is3D;
|
||||
to->BitDepth = from->BitDepth;
|
||||
to->Quality = from->Quality;
|
||||
}
|
||||
};
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning( pop )
|
||||
#endif
|
||||
|
||||
// Pack log messages into a single scratch buffer to reduce dynamic memory allocations
|
||||
CriticalSection CachedLogDataLocker;
|
||||
Array<byte> CachedLogData;
|
||||
@@ -295,16 +258,6 @@ DEFINE_INTERNAL_CALL(MString*) EditorInternal_CanImport(MString* extensionObj)
|
||||
return importer ? MUtils::ToString(importer->ResultExtension) : nullptr;
|
||||
}
|
||||
|
||||
DEFINE_INTERNAL_CALL(bool) EditorInternal_ImportAudio(MString* inputPathObj, MString* outputPathObj, InternalAudioOptions* optionsObj)
|
||||
{
|
||||
ImportAudio::Options options;
|
||||
InternalAudioOptions::Convert(optionsObj, &options);
|
||||
String inputPath, outputPath;
|
||||
MUtils::ToString(inputPathObj, inputPath);
|
||||
MUtils::ToString(outputPathObj, outputPath);
|
||||
return ManagedEditor::Import(inputPath, outputPath, &options);
|
||||
}
|
||||
|
||||
DEFINE_INTERNAL_CALL(void) EditorInternal_GetAudioClipMetadata(AudioClip* clip, int32* originalSize, int32* importedSize)
|
||||
{
|
||||
INTERNAL_CALL_CHECK(clip);
|
||||
@@ -765,24 +718,6 @@ DEFINE_INTERNAL_CALL(MTypeObject*) CustomEditorsUtilInternal_GetCustomEditor(MTy
|
||||
return CustomEditorsUtil::GetCustomEditor(targetType);
|
||||
}
|
||||
|
||||
DEFINE_INTERNAL_CALL(bool) AudioImportEntryInternal_GetAudioImportOptions(MString* pathObj, InternalAudioOptions* result)
|
||||
{
|
||||
String path;
|
||||
MUtils::ToString(pathObj, path);
|
||||
FileSystem::NormalizePath(path);
|
||||
|
||||
ImportAudio::Options options;
|
||||
if (ImportAudio::TryGetImportOptions(path, options))
|
||||
{
|
||||
// Convert into managed storage
|
||||
InternalAudioOptions::Convert(&options, result);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
DEFINE_INTERNAL_CALL(MArray*) LayersAndTagsSettingsInternal_GetCurrentLayers(int* layersCount)
|
||||
{
|
||||
*layersCount = Math::Max(1, Level::GetNonEmptyLayerNamesCount());
|
||||
@@ -830,3 +765,15 @@ bool ManagedEditor::TryRestoreImportOptions(ModelTool::Options& options, String
|
||||
FileSystem::NormalizePath(assetPath);
|
||||
return ImportModelFile::TryGetImportOptions(assetPath, options);
|
||||
}
|
||||
|
||||
bool ManagedEditor::Import(const String& inputPath, const String& outputPath, const AudioTool::Options& options)
|
||||
{
|
||||
return Import(inputPath, outputPath, (void*)&options);
|
||||
}
|
||||
|
||||
bool ManagedEditor::TryRestoreImportOptions(AudioTool::Options& options, String assetPath)
|
||||
{
|
||||
// Get options from model
|
||||
FileSystem::NormalizePath(assetPath);
|
||||
return ImportAudio::TryGetImportOptions(assetPath, options);
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "Engine/ShadowsOfMordor/Types.h"
|
||||
#include "Engine/Tools/TextureTool/TextureTool.h"
|
||||
#include "Engine/Tools/ModelTool/ModelTool.h"
|
||||
#include "Engine/Tools/AudioTool/AudioTool.h"
|
||||
|
||||
namespace CSG
|
||||
{
|
||||
@@ -190,6 +191,25 @@ public:
|
||||
API_FUNCTION() static bool TryRestoreImportOptions(API_PARAM(Ref) ModelTool::Options& options, String assetPath);
|
||||
#endif
|
||||
|
||||
#if COMPILE_WITH_AUDIO_TOOL
|
||||
/// <summary>
|
||||
/// Imports the audio asset file to the target location.
|
||||
/// </summary>
|
||||
/// <param name="inputPath">The source file path.</param>
|
||||
/// <param name="outputPath">The result asset file path.</param>
|
||||
/// <param name="options">The import settings.</param>
|
||||
/// <returns>True if importing failed, otherwise false.</returns>
|
||||
API_FUNCTION() static bool Import(const String& inputPath, const String& outputPath, const AudioTool::Options& options);
|
||||
|
||||
/// <summary>
|
||||
/// Tries the restore the asset import options from the target resource file.
|
||||
/// </summary>
|
||||
/// <param name="options">The options.</param>
|
||||
/// <param name="assetPath">The asset path.</param>
|
||||
/// <returns>True settings has been restored, otherwise false.</returns>
|
||||
API_FUNCTION() static bool TryRestoreImportOptions(API_PARAM(Ref) AudioTool::Options& options, String assetPath);
|
||||
#endif
|
||||
|
||||
private:
|
||||
void OnEditorAssemblyLoaded(MAssembly* assembly);
|
||||
|
||||
|
||||
@@ -37,11 +37,6 @@ namespace FlaxEditor.Modules
|
||||
/// </summary>
|
||||
public event Action<Prefab, Actor> PrefabApplied;
|
||||
|
||||
/// <summary>
|
||||
/// Locally cached actor for prefab creation.
|
||||
/// </summary>
|
||||
private Actor _prefabCreationActor;
|
||||
|
||||
internal PrefabsModule(Editor editor)
|
||||
: base(editor)
|
||||
{
|
||||
@@ -65,13 +60,14 @@ namespace FlaxEditor.Modules
|
||||
/// To create prefab manually (from code) use <see cref="PrefabManager.CreatePrefab"/> method.
|
||||
/// </remarks>
|
||||
/// <param name="selection">The scene selection to use.</param>
|
||||
public void CreatePrefab(List<SceneGraphNode> selection)
|
||||
/// <param name="prefabWindow">The prefab window that creates it.</param>
|
||||
public void CreatePrefab(List<SceneGraphNode> selection, Windows.Assets.PrefabWindow prefabWindow = null)
|
||||
{
|
||||
if (selection == null)
|
||||
selection = Editor.SceneEditing.Selection;
|
||||
if (selection.Count == 1 && selection[0] is ActorNode actorNode && actorNode.CanCreatePrefab)
|
||||
{
|
||||
CreatePrefab(actorNode.Actor);
|
||||
CreatePrefab(actorNode.Actor, true, prefabWindow);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,7 +88,8 @@ namespace FlaxEditor.Modules
|
||||
/// </summary>
|
||||
/// <param name="actor">The root prefab actor.</param>
|
||||
/// <param name="rename">Allow renaming or not</param>
|
||||
public void CreatePrefab(Actor actor, bool rename)
|
||||
/// <param name="prefabWindow">The prefab window that creates it.</param>
|
||||
public void CreatePrefab(Actor actor, bool rename, Windows.Assets.PrefabWindow prefabWindow = null)
|
||||
{
|
||||
// Skip in invalid states
|
||||
if (!Editor.StateMachine.CurrentState.CanEditContent)
|
||||
@@ -105,42 +102,47 @@ namespace FlaxEditor.Modules
|
||||
PrefabCreating?.Invoke(actor);
|
||||
|
||||
var proxy = Editor.ContentDatabase.GetProxy<Prefab>();
|
||||
_prefabCreationActor = actor;
|
||||
Editor.Windows.ContentWin.NewItem(proxy, actor, OnPrefabCreated, actor.Name, rename);
|
||||
Editor.Windows.ContentWin.NewItem(proxy, actor, contentItem => OnPrefabCreated(contentItem, actor, prefabWindow), actor.Name, rename);
|
||||
}
|
||||
|
||||
private void OnPrefabCreated(ContentItem contentItem)
|
||||
private void OnPrefabCreated(ContentItem contentItem, Actor actor, Windows.Assets.PrefabWindow prefabWindow)
|
||||
{
|
||||
if (contentItem is PrefabItem prefabItem)
|
||||
{
|
||||
PrefabCreated?.Invoke(prefabItem);
|
||||
}
|
||||
|
||||
// Skip in invalid states
|
||||
if (!Editor.StateMachine.CurrentState.CanEditScene)
|
||||
return;
|
||||
Undo undo = null;
|
||||
if (prefabWindow != null)
|
||||
{
|
||||
prefabWindow.MarkAsEdited();
|
||||
undo = prefabWindow.Undo;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Skip in invalid states
|
||||
if (!Editor.StateMachine.CurrentState.CanEditScene)
|
||||
return;
|
||||
undo = Editor.Undo;
|
||||
}
|
||||
|
||||
// Record undo for prefab creating (backend links the target instance with the prefab)
|
||||
if (Editor.Undo.Enabled)
|
||||
if (undo.Enabled)
|
||||
{
|
||||
if (!_prefabCreationActor)
|
||||
if (!actor)
|
||||
return;
|
||||
|
||||
var actorsList = new List<Actor>();
|
||||
Utilities.Utils.GetActorsTree(actorsList, _prefabCreationActor);
|
||||
Utilities.Utils.GetActorsTree(actorsList, actor);
|
||||
|
||||
var actions = new IUndoAction[actorsList.Count];
|
||||
for (int i = 0; i < actorsList.Count; i++)
|
||||
{
|
||||
var action = BreakPrefabLinkAction.Linked(actorsList[i]);
|
||||
actions[i] = action;
|
||||
}
|
||||
Undo.AddAction(new MultiUndoAction(actions));
|
||||
|
||||
_prefabCreationActor = null;
|
||||
actions[i] = BreakPrefabLinkAction.Linked(actorsList[i]);
|
||||
undo.AddAction(new MultiUndoAction(actions));
|
||||
}
|
||||
|
||||
Editor.Instance.Windows.PropertiesWin.Presenter.BuildLayout();
|
||||
Editor.Windows.PropertiesWin.Presenter.BuildLayout();
|
||||
if (prefabWindow != null)
|
||||
prefabWindow.Presenter.BuildLayout();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using FlaxEditor.GUI.ContextMenu;
|
||||
using FlaxEditor.Windows;
|
||||
using FlaxEngine;
|
||||
|
||||
namespace FlaxEditor.SceneGraph.Actors
|
||||
@@ -22,9 +23,9 @@ namespace FlaxEditor.SceneGraph.Actors
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnContextMenu(ContextMenu contextMenu)
|
||||
public override void OnContextMenu(ContextMenu contextMenu, EditorWindow window)
|
||||
{
|
||||
base.OnContextMenu(contextMenu);
|
||||
base.OnContextMenu(contextMenu, window);
|
||||
|
||||
var actor = (AnimatedModel)Actor;
|
||||
if (actor && actor.SkinnedModel)
|
||||
|
||||
@@ -6,6 +6,8 @@ using Real = System.Double;
|
||||
using Real = System.Single;
|
||||
#endif
|
||||
|
||||
using FlaxEditor.GUI.ContextMenu;
|
||||
using FlaxEditor.Windows;
|
||||
using FlaxEngine;
|
||||
|
||||
namespace FlaxEditor.SceneGraph.Actors
|
||||
@@ -23,6 +25,25 @@ namespace FlaxEditor.SceneGraph.Actors
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnContextMenu(ContextMenu contextMenu, EditorWindow window)
|
||||
{
|
||||
base.OnContextMenu(contextMenu, window);
|
||||
if (window is not SceneTreeWindow win)
|
||||
return;
|
||||
var button = new ContextMenuButton(contextMenu, "Move Camera to View");
|
||||
button.Parent = contextMenu.ItemsContainer;
|
||||
contextMenu.ItemsContainer.Children.Remove(button);
|
||||
contextMenu.ItemsContainer.Children.Insert(4, button);
|
||||
button.Clicked += () =>
|
||||
{
|
||||
var c = Actor as Camera;
|
||||
var viewport = Editor.Instance.Windows.EditWin.Viewport;
|
||||
c.Position = viewport.ViewPosition;
|
||||
c.Orientation = viewport.ViewOrientation;
|
||||
};
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool RayCastSelf(ref RayCastData ray, out Real distance, out Vector3 normal)
|
||||
{
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
using System.IO;
|
||||
using FlaxEditor.GUI.ContextMenu;
|
||||
using FlaxEditor.SceneGraph.GUI;
|
||||
using FlaxEditor.Windows;
|
||||
using FlaxEngine;
|
||||
|
||||
namespace FlaxEditor.SceneGraph.Actors
|
||||
@@ -65,7 +66,7 @@ namespace FlaxEditor.SceneGraph.Actors
|
||||
public override SceneNode ParentScene => this;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnContextMenu(ContextMenu contextMenu)
|
||||
public override void OnContextMenu(ContextMenu contextMenu, EditorWindow window)
|
||||
{
|
||||
contextMenu.AddSeparator();
|
||||
var path = Scene.Path;
|
||||
@@ -80,7 +81,7 @@ namespace FlaxEditor.SceneGraph.Actors
|
||||
if (Level.ScenesCount > 1)
|
||||
contextMenu.AddButton("Unload all but this scene", OnUnloadAllButSelectedScene).LinkTooltip("Unloads all of the active scenes except for the selected scene.").Enabled = Editor.Instance.StateMachine.CurrentState.CanChangeScene;
|
||||
|
||||
base.OnContextMenu(contextMenu);
|
||||
base.OnContextMenu(contextMenu, window);
|
||||
}
|
||||
|
||||
private void OnSelect()
|
||||
|
||||
@@ -9,6 +9,7 @@ using Real = System.Single;
|
||||
using System;
|
||||
using FlaxEditor.GUI.ContextMenu;
|
||||
using FlaxEditor.Modules;
|
||||
using FlaxEditor.Windows;
|
||||
using FlaxEngine;
|
||||
using FlaxEngine.Json;
|
||||
using Object = FlaxEngine.Object;
|
||||
@@ -203,9 +204,9 @@ namespace FlaxEditor.SceneGraph.Actors
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnContextMenu(ContextMenu contextMenu)
|
||||
public override void OnContextMenu(ContextMenu contextMenu, EditorWindow window)
|
||||
{
|
||||
ParentNode.OnContextMenu(contextMenu);
|
||||
ParentNode.OnContextMenu(contextMenu, window);
|
||||
}
|
||||
|
||||
public static SceneGraphNode Create(StateData state)
|
||||
@@ -272,9 +273,9 @@ namespace FlaxEditor.SceneGraph.Actors
|
||||
DebugDraw.DrawSphere(new BoundingSphere(pos, tangentSize), Color.YellowGreen, 0, false);
|
||||
}
|
||||
|
||||
public override void OnContextMenu(ContextMenu contextMenu)
|
||||
public override void OnContextMenu(ContextMenu contextMenu, EditorWindow window)
|
||||
{
|
||||
ParentNode.OnContextMenu(contextMenu);
|
||||
ParentNode.OnContextMenu(contextMenu, window);
|
||||
}
|
||||
|
||||
public override void OnDispose()
|
||||
@@ -354,9 +355,9 @@ namespace FlaxEditor.SceneGraph.Actors
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnContextMenu(ContextMenu contextMenu)
|
||||
public override void OnContextMenu(ContextMenu contextMenu, EditorWindow window)
|
||||
{
|
||||
base.OnContextMenu(contextMenu);
|
||||
base.OnContextMenu(contextMenu, window);
|
||||
|
||||
contextMenu.AddButton("Add spline model", OnAddSplineModel);
|
||||
contextMenu.AddButton("Add spline collider", OnAddSplineCollider);
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
using System;
|
||||
using FlaxEditor.Content;
|
||||
using FlaxEditor.GUI.ContextMenu;
|
||||
using FlaxEditor.Windows;
|
||||
using FlaxEngine;
|
||||
|
||||
namespace FlaxEditor.SceneGraph.Actors
|
||||
@@ -21,9 +22,9 @@ namespace FlaxEditor.SceneGraph.Actors
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnContextMenu(ContextMenu contextMenu)
|
||||
public override void OnContextMenu(ContextMenu contextMenu, EditorWindow window)
|
||||
{
|
||||
base.OnContextMenu(contextMenu);
|
||||
base.OnContextMenu(contextMenu, window);
|
||||
|
||||
contextMenu.AddButton("Add collider", OnAddMeshCollider).Enabled = ((StaticModel)Actor).Model != null;
|
||||
}
|
||||
|
||||
@@ -599,7 +599,7 @@ namespace FlaxEditor.SceneGraph.GUI
|
||||
// Drag scripts
|
||||
else if (_dragScripts != null && _dragScripts.HasValidDrag)
|
||||
{
|
||||
foreach(var script in _dragScripts.Objects)
|
||||
foreach (var script in _dragScripts.Objects)
|
||||
{
|
||||
var customAction = script.HasPrefabLink ? new ReparentAction(script) : null;
|
||||
using (new UndoBlock(ActorNode.Root.Undo, script, "Change script parent", customAction))
|
||||
@@ -616,7 +616,7 @@ namespace FlaxEditor.SceneGraph.GUI
|
||||
var spawnParent = myActor;
|
||||
if (DragOverMode == DragItemPositioning.Above || DragOverMode == DragItemPositioning.Below)
|
||||
spawnParent = newParent;
|
||||
|
||||
|
||||
for (int i = 0; i < _dragAssets.Objects.Count; i++)
|
||||
{
|
||||
var item = _dragAssets.Objects[i];
|
||||
@@ -720,7 +720,7 @@ namespace FlaxEditor.SceneGraph.GUI
|
||||
for (var i = 0; i < tree.Selection.Count; i++)
|
||||
{
|
||||
var e = tree.Selection[i];
|
||||
|
||||
|
||||
// Skip if parent is already selected to keep correct parenting
|
||||
if (tree.Selection.Contains(e.Parent))
|
||||
continue;
|
||||
|
||||
@@ -11,6 +11,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FlaxEditor.Modules;
|
||||
using FlaxEditor.SceneGraph.Actors;
|
||||
using FlaxEditor.Windows;
|
||||
using FlaxEngine;
|
||||
|
||||
namespace FlaxEditor.SceneGraph
|
||||
@@ -339,7 +340,7 @@ namespace FlaxEditor.SceneGraph
|
||||
/// <summary>
|
||||
/// Called when scene tree window wants to show the context menu. Allows to add custom options.
|
||||
/// </summary>
|
||||
public virtual void OnContextMenu(FlaxEditor.GUI.ContextMenu.ContextMenu contextMenu)
|
||||
public virtual void OnContextMenu(FlaxEditor.GUI.ContextMenu.ContextMenu contextMenu, EditorWindow window)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -787,7 +787,7 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
}
|
||||
}
|
||||
|
||||
private class AsNode : SurfaceNode
|
||||
internal class AsNode : SurfaceNode
|
||||
{
|
||||
private TypePickerControl _picker;
|
||||
|
||||
@@ -838,6 +838,15 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
box.CurrentType = type ? type : ScriptType.FlaxObject;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the type of the picker and the type of the output box
|
||||
/// </summary>
|
||||
/// <param name="type">Target Type</param>
|
||||
public void SetPickerValue(ScriptType type)
|
||||
{
|
||||
_picker.Value = type;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnDestroy()
|
||||
{
|
||||
@@ -999,6 +1008,15 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
GetBox(4).CurrentType = type ? type : _picker.Type;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the type of the picker and the type of the output box
|
||||
/// </summary>
|
||||
/// <param name="type">Target Type</param>
|
||||
public void SetPickerValue(ScriptType type)
|
||||
{
|
||||
_picker.Value = type;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnDestroy()
|
||||
{
|
||||
|
||||
@@ -721,9 +721,7 @@ namespace FlaxEditor.Surface.ContextMenu
|
||||
SelectedItem = previousSelectedItem;
|
||||
|
||||
// Scroll into view (without smoothing)
|
||||
_panel1.VScrollBar.SmoothingScale = 0;
|
||||
_panel1.ScrollViewTo(SelectedItem);
|
||||
_panel1.VScrollBar.SmoothingScale = 1;
|
||||
_panel1.ScrollViewTo(SelectedItem, true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -820,8 +820,62 @@ namespace FlaxEditor.Surface.Elements
|
||||
if (useCaster)
|
||||
{
|
||||
// Connect via Caster
|
||||
//AddCaster(oB, iB);
|
||||
throw new NotImplementedException("AddCaster(..) function");
|
||||
const float casterXOffset = 250;
|
||||
if (Surface.Undo != null && Surface.Undo.Enabled)
|
||||
{
|
||||
bool undoEnabled = Surface.Undo.Enabled;
|
||||
Surface.Undo.Enabled = false;
|
||||
SurfaceNode node = Surface.Context.SpawnNode(7, 22, Float2.Zero); // 22 AsNode, 25 CastNode
|
||||
Surface.Undo.Enabled = undoEnabled;
|
||||
if (node is not Archetypes.Tools.AsNode castNode)
|
||||
throw new Exception("Node is not a casting node!");
|
||||
|
||||
// Set the type of the casting node
|
||||
undoEnabled = castNode.Surface.Undo.Enabled;
|
||||
castNode.Surface.Undo.Enabled = false;
|
||||
castNode.SetPickerValue(iB.CurrentType);
|
||||
castNode.Surface.Undo.Enabled = undoEnabled;
|
||||
if (node.GetBox(0) is not OutputBox castOutputBox || node.GetBox(1) is not InputBox castInputBox)
|
||||
throw new NullReferenceException("Casting failed. Cast node is invalid!");
|
||||
|
||||
// We set the position of the cast node here to set it relative to the target nodes input box
|
||||
undoEnabled = castNode.Surface.Undo.Enabled;
|
||||
castNode.Surface.Undo.Enabled = false;
|
||||
var wantedOffset = iB.ParentNode.Location - new Float2(casterXOffset, -(iB.LocalY - castOutputBox.LocalY));
|
||||
castNode.Location = Surface.Root.PointFromParent(ref wantedOffset);
|
||||
castNode.Surface.Undo.Enabled = undoEnabled;
|
||||
|
||||
var spawnNodeAction = new AddRemoveNodeAction(castNode, true);
|
||||
|
||||
var connectToCastNodeAction = new ConnectBoxesAction(castInputBox, oB, true);
|
||||
castInputBox.CreateConnection(oB);
|
||||
connectToCastNodeAction.End();
|
||||
|
||||
var connectCastToTargetNodeAction = new ConnectBoxesAction(iB, castOutputBox, true);
|
||||
iB.CreateConnection(castOutputBox);
|
||||
connectCastToTargetNodeAction.End();
|
||||
|
||||
Surface.AddBatchedUndoAction(new MultiUndoAction(spawnNodeAction, connectToCastNodeAction, connectCastToTargetNodeAction));
|
||||
}
|
||||
else
|
||||
{
|
||||
SurfaceNode node = Surface.Context.SpawnNode(7, 22, Float2.Zero); // 22 AsNode, 25 CastNode
|
||||
if (node is not Archetypes.Tools.AsNode castNode)
|
||||
throw new Exception("Node is not a casting node!");
|
||||
|
||||
// Set the type of the casting node
|
||||
castNode.SetPickerValue(iB.CurrentType);
|
||||
if (node.GetBox(0) is not OutputBox castOutputBox || node.GetBox(1) is not InputBox castInputBox)
|
||||
throw new NullReferenceException("Casting failed. Cast node is invalid!");
|
||||
|
||||
// We set the position of the cast node here to set it relative to the target nodes input box
|
||||
var wantedOffset = iB.ParentNode.Location - new Float2(casterXOffset, -(iB.LocalY - castOutputBox.LocalY));
|
||||
castNode.Location = Surface.Root.PointFromParent(ref wantedOffset);
|
||||
|
||||
castInputBox.CreateConnection(oB);
|
||||
iB.CreateConnection(castOutputBox);
|
||||
}
|
||||
Surface.MarkAsEdited();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using FlaxEditor.Content.Settings;
|
||||
using FlaxEditor.GUI.ContextMenu;
|
||||
using FlaxEditor.GUI.Input;
|
||||
using FlaxEditor.Options;
|
||||
@@ -9,6 +10,8 @@ using FlaxEditor.Viewport.Cameras;
|
||||
using FlaxEditor.Viewport.Widgets;
|
||||
using FlaxEngine;
|
||||
using FlaxEngine.GUI;
|
||||
using Newtonsoft.Json;
|
||||
using JsonSerializer = FlaxEngine.Json.JsonSerializer;
|
||||
|
||||
namespace FlaxEditor.Viewport
|
||||
{
|
||||
@@ -817,10 +820,63 @@ namespace FlaxEditor.Viewport
|
||||
}
|
||||
}
|
||||
|
||||
// View Layers
|
||||
{
|
||||
var viewLayers = ViewWidgetButtonMenu.AddChildMenu("View Layers").ContextMenu;
|
||||
viewLayers.AddButton("Copy layers", () => Clipboard.Text = JsonSerializer.Serialize(Task.View.RenderLayersMask));
|
||||
viewLayers.AddButton("Paste layers", () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
Task.ViewLayersMask = JsonSerializer.Deserialize<LayersMask>(Clipboard.Text);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
});
|
||||
viewLayers.AddButton("Reset layers", () => Task.ViewLayersMask = LayersMask.Default).Icon = Editor.Instance.Icons.Rotate32;
|
||||
viewLayers.AddButton("Disable layers", () => Task.ViewLayersMask = new LayersMask(0)).Icon = Editor.Instance.Icons.Rotate32;
|
||||
viewLayers.AddSeparator();
|
||||
var layers = LayersAndTagsSettings.GetCurrentLayers();
|
||||
if (layers != null && layers.Length > 0)
|
||||
{
|
||||
for (int i = 0; i < layers.Length; i++)
|
||||
{
|
||||
var layer = layers[i];
|
||||
var button = viewLayers.AddButton(layer);
|
||||
button.CloseMenuOnClick = false;
|
||||
button.Tag = 1 << i;
|
||||
}
|
||||
}
|
||||
viewLayers.ButtonClicked += button =>
|
||||
{
|
||||
if (button.Tag != null)
|
||||
{
|
||||
int layerIndex = (int)button.Tag;
|
||||
LayersMask mask = new LayersMask(layerIndex);
|
||||
Task.ViewLayersMask ^= mask;
|
||||
button.Icon = (Task.ViewLayersMask & mask) != 0 ? Style.Current.CheckBoxTick : SpriteHandle.Invalid;
|
||||
}
|
||||
};
|
||||
viewLayers.VisibleChanged += WidgetViewLayersShowHide;
|
||||
}
|
||||
|
||||
// View Flags
|
||||
{
|
||||
var viewFlags = ViewWidgetButtonMenu.AddChildMenu("View Flags").ContextMenu;
|
||||
viewFlags.AddButton("Copy flags", () => Clipboard.Text = JsonSerializer.Serialize(Task.ViewFlags));
|
||||
viewFlags.AddButton("Paste flags", () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
Task.ViewFlags = JsonSerializer.Deserialize<ViewFlags>(Clipboard.Text);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
});
|
||||
viewFlags.AddButton("Reset flags", () => Task.ViewFlags = ViewFlags.DefaultEditor).Icon = Editor.Instance.Icons.Rotate32;
|
||||
viewFlags.AddButton("Disable flags", () => Task.ViewFlags = ViewFlags.None).Icon = Editor.Instance.Icons.Rotate32;
|
||||
viewFlags.AddSeparator();
|
||||
for (int i = 0; i < EditorViewportViewFlagsValues.Length; i++)
|
||||
{
|
||||
@@ -835,7 +891,7 @@ namespace FlaxEditor.Viewport
|
||||
{
|
||||
var v = (ViewFlags)button.Tag;
|
||||
Task.ViewFlags ^= v;
|
||||
button.Icon = (Task.View.Flags & v) != 0 ? Style.Current.CheckBoxTick : SpriteHandle.Invalid;
|
||||
button.Icon = (Task.ViewFlags & v) != 0 ? Style.Current.CheckBoxTick : SpriteHandle.Invalid;
|
||||
}
|
||||
};
|
||||
viewFlags.VisibleChanged += WidgetViewFlagsShowHide;
|
||||
@@ -844,6 +900,18 @@ namespace FlaxEditor.Viewport
|
||||
// Debug View
|
||||
{
|
||||
var debugView = ViewWidgetButtonMenu.AddChildMenu("Debug View").ContextMenu;
|
||||
debugView.AddButton("Copy view", () => Clipboard.Text = JsonSerializer.Serialize(Task.ViewMode));
|
||||
debugView.AddButton("Paste view", () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
Task.ViewMode = JsonSerializer.Deserialize<ViewMode>(Clipboard.Text);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
});
|
||||
debugView.AddSeparator();
|
||||
for (int i = 0; i < EditorViewportViewModeValues.Length; i++)
|
||||
{
|
||||
ref var v = ref EditorViewportViewModeValues[i];
|
||||
@@ -1451,9 +1519,9 @@ namespace FlaxEditor.Viewport
|
||||
_isVirtualMouseRightDown = false; // Cancel when mouse right or escape is pressed
|
||||
if (_wasVirtualMouseRightDown)
|
||||
wasControllingMouse = true;
|
||||
if (_isVirtualMouseRightDown)
|
||||
if (_isVirtualMouseRightDown)
|
||||
_isControllingMouse = _isVirtualMouseRightDown;
|
||||
|
||||
|
||||
if (wasControllingMouse != _isControllingMouse)
|
||||
{
|
||||
if (_isControllingMouse)
|
||||
@@ -1914,6 +1982,24 @@ namespace FlaxEditor.Viewport
|
||||
}
|
||||
}
|
||||
|
||||
private void WidgetViewLayersShowHide(Control cm)
|
||||
{
|
||||
if (cm.Visible == false)
|
||||
return;
|
||||
|
||||
var ccm = (ContextMenu)cm;
|
||||
var layersMask = Task.ViewLayersMask;
|
||||
foreach (var e in ccm.Items)
|
||||
{
|
||||
if (e is ContextMenuButton b && b != null && b.Tag != null)
|
||||
{
|
||||
int layerIndex = (int)b.Tag;
|
||||
LayersMask mask = new LayersMask(layerIndex);
|
||||
b.Icon = (layersMask & mask) != 0 ? Style.Current.CheckBoxTick : SpriteHandle.Invalid;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private float GetGamepadAxis(GamepadAxis axis)
|
||||
{
|
||||
var value = FlaxEngine.Input.GetGamepadAxis(InputGamepadIndex.All, axis);
|
||||
|
||||
@@ -116,7 +116,7 @@ namespace FlaxEditor.Windows.Assets
|
||||
_window = window;
|
||||
|
||||
// Try to restore target asset AudioClip import options (useful for fast reimport)
|
||||
AudioImportSettings.TryRestore(ref ImportSettings, window.Item.Path);
|
||||
Editor.TryRestoreImportOptions(ref ImportSettings.Settings, window.Item.Path);
|
||||
|
||||
// Prepare restore data
|
||||
PeekState();
|
||||
@@ -134,6 +134,11 @@ namespace FlaxEditor.Windows.Assets
|
||||
/// </summary>
|
||||
public void Reimport()
|
||||
{
|
||||
if (_window?._previewSource != null)
|
||||
{
|
||||
_window._previewSource.Stop();
|
||||
_window.UpdateToolstrip();
|
||||
}
|
||||
Editor.Instance.ContentImporting.Reimport((BinaryAssetItem)_window.Item, ImportSettings, true);
|
||||
}
|
||||
|
||||
|
||||
@@ -233,7 +233,7 @@ namespace FlaxEditor.Windows.Assets
|
||||
|
||||
contextMenu.AddSeparator();
|
||||
|
||||
b = contextMenu.AddButton("Create Prefab", () => Editor.Prefabs.CreatePrefab(Selection));
|
||||
b = contextMenu.AddButton("Create Prefab", () => Editor.Prefabs.CreatePrefab(Selection, this));
|
||||
b.Enabled = isSingleActorSelected &&
|
||||
(Selection[0] as ActorNode).CanCreatePrefab &&
|
||||
Editor.Windows.ContentWin.CurrentViewFolder.CanHaveAssets;
|
||||
@@ -313,7 +313,7 @@ namespace FlaxEditor.Windows.Assets
|
||||
}
|
||||
if (showCustomNodeOptions)
|
||||
{
|
||||
Selection[0].OnContextMenu(contextMenu);
|
||||
Selection[0].OnContextMenu(contextMenu, this);
|
||||
}
|
||||
ContextMenuShow?.Invoke(contextMenu);
|
||||
|
||||
|
||||
@@ -53,6 +53,11 @@ namespace FlaxEditor.Windows.Assets
|
||||
/// </summary>
|
||||
public PrefabWindowViewport Viewport => _viewport;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the prefab objects properties editor.
|
||||
/// </summary>
|
||||
public CustomEditorPresenter Presenter => _propertiesEditor;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the undo system used by this window for changes tracking.
|
||||
/// </summary>
|
||||
@@ -146,7 +151,7 @@ namespace FlaxEditor.Windows.Assets
|
||||
Graph = new LocalSceneGraph(new CustomRootNode(this));
|
||||
_tree = new PrefabTree
|
||||
{
|
||||
Margin = new Margin(0.0f, 0.0f, -16.0f, 0.0f), // Hide root node
|
||||
Margin = new Margin(0.0f, 0.0f, -16.0f, _treePanel.ScrollBarsSize), // Hide root node
|
||||
IsScrollable = true,
|
||||
};
|
||||
_tree.AddChild(Graph.Root.TreeNode);
|
||||
|
||||
@@ -215,7 +215,7 @@ namespace FlaxEditor.Windows
|
||||
}
|
||||
if (showCustomNodeOptions)
|
||||
{
|
||||
Editor.SceneEditing.Selection[0].OnContextMenu(contextMenu);
|
||||
Editor.SceneEditing.Selection[0].OnContextMenu(contextMenu, this);
|
||||
}
|
||||
|
||||
ContextMenuShow?.Invoke(contextMenu);
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace FlaxEditor.Windows
|
||||
root.TreeNode.Expand();
|
||||
_tree = new Tree(true)
|
||||
{
|
||||
Margin = new Margin(0.0f, 0.0f, -16.0f, 0.0f), // Hide root node
|
||||
Margin = new Margin(0.0f, 0.0f, -16.0f, _sceneTreePanel.ScrollBarsSize), // Hide root node
|
||||
IsScrollable = true,
|
||||
};
|
||||
_tree.AddChild(root.TreeNode);
|
||||
|
||||
@@ -54,9 +54,7 @@ namespace FlaxEditor.Windows.Search
|
||||
_selectedItem.BackgroundColor = Style.Current.BackgroundSelected;
|
||||
if (_matchedItems.Count > VisibleItemCount)
|
||||
{
|
||||
_resultPanel.VScrollBar.SmoothingScale = 0;
|
||||
_resultPanel.ScrollViewTo(_selectedItem);
|
||||
_resultPanel.VScrollBar.SmoothingScale = 1;
|
||||
_resultPanel.ScrollViewTo(_selectedItem, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,6 +127,14 @@ const Char* SplashScreenQuotes[] =
|
||||
TEXT("Who is signing all these integers?!"),
|
||||
TEXT("Flax fact: Flax was called Celelej once."),
|
||||
TEXT("Changing text overflow setti-"),
|
||||
TEXT("Testing tests"),
|
||||
TEXT("Free hugs"),
|
||||
TEXT("Think outside the box"),
|
||||
TEXT("Let's make something fantastic"),
|
||||
TEXT("Be brave"),
|
||||
TEXT("Drum roll please"),
|
||||
TEXT("Good Luck Have Fun"),
|
||||
TEXT("GG Well Played"),
|
||||
};
|
||||
|
||||
SplashScreen::~SplashScreen()
|
||||
|
||||
Reference in New Issue
Block a user