Merge remote-tracking branch 'origin/master' into 1.7
This commit is contained in:
@@ -248,6 +248,7 @@
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=bitangent/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=bitangents/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Bokeh/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=borderless/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=BRDF/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=coeff/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=colliders/@EntryIndexedValue">True</s:Boolean>
|
||||
|
||||
@@ -253,6 +253,12 @@ namespace FlaxEditor.GUI.Docking
|
||||
tabColor = style.BackgroundHighlighted;
|
||||
Render2D.FillRectangle(tabRect, tabColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
tabColor = style.BackgroundHighlighted;
|
||||
Render2D.DrawLine(tabRect.BottomLeft - new Float2(0 , 1), tabRect.UpperLeft, tabColor);
|
||||
Render2D.DrawLine(tabRect.BottomRight - new Float2(0 , 1), tabRect.UpperRight, tabColor);
|
||||
}
|
||||
|
||||
if (tab.Icon.IsValid)
|
||||
{
|
||||
|
||||
@@ -282,7 +282,7 @@ namespace FlaxEditor.GUI.Timeline.GUI
|
||||
var x = time * zoom + Timeline.StartOffset;
|
||||
|
||||
// Header line
|
||||
var lineRect = new Rectangle(x - 0.5f, -verticalLinesHeaderExtend + timeAxisHeaderOffset, 1.0f, verticalLinesHeaderExtend);
|
||||
var lineRect = new Rectangle(x - 0.5f, -verticalLinesHeaderExtend * 0.6f + timeAxisHeaderOffset, 1.0f, verticalLinesHeaderExtend * 0.6f);
|
||||
Render2D.FillRectangle(lineRect, lineColor);
|
||||
|
||||
// Time label
|
||||
@@ -300,7 +300,7 @@ namespace FlaxEditor.GUI.Timeline.GUI
|
||||
break;
|
||||
default: throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
var labelRect = new Rectangle(x + 2, -verticalLinesHeaderExtend + timeAxisHeaderOffset, 50, verticalLinesHeaderExtend);
|
||||
var labelRect = new Rectangle(x + 2, -verticalLinesHeaderExtend * 0.8f + timeAxisHeaderOffset, 50, verticalLinesHeaderExtend);
|
||||
Render2D.DrawText(style.FontSmall, labelText, labelRect, labelColor, TextAlignment.Near, TextAlignment.Center, TextWrapping.NoWrap, 1.0f, 0.8f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.
|
||||
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using FlaxEngine;
|
||||
using FlaxEngine.GUI;
|
||||
|
||||
@@ -30,11 +32,33 @@ namespace FlaxEditor.GUI.Timeline.GUI
|
||||
var timeAxisOverlap = Timeline.HeaderTopAreaHeight * 0.5f;
|
||||
var timeAxisHeaderOffset = -_timeline.MediaBackground.ViewOffset.Y - timeAxisOverlap;
|
||||
|
||||
// Time label
|
||||
string labelText;
|
||||
switch (_timeline.TimeShowMode)
|
||||
{
|
||||
case Timeline.TimeShowModes.Frames:
|
||||
labelText = _timeline.CurrentFrame.ToString("###0", CultureInfo.InvariantCulture);
|
||||
break;
|
||||
case Timeline.TimeShowModes.Seconds:
|
||||
labelText = _timeline.CurrentTime.ToString("###0.##'s'", CultureInfo.InvariantCulture);
|
||||
break;
|
||||
case Timeline.TimeShowModes.Time:
|
||||
labelText = TimeSpan.FromSeconds(_timeline.CurrentTime).ToString("g");
|
||||
break;
|
||||
default: throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
var color = (_timeline.IsMovingPositionHandle ? style.ProgressNormal : style.Foreground).AlphaMultiplied(0.6f);
|
||||
Matrix3x3.RotationZ(Mathf.PiOverTwo, out var m1);
|
||||
var m2 = Matrix3x3.Translation2D(0, timeAxisHeaderOffset);
|
||||
Matrix3x3.Multiply(ref m1, ref m2, out var m3);
|
||||
Render2D.PushTransform(ref m3);
|
||||
Render2D.DrawSprite(icon, new Rectangle(new Float2(4, -Width), Size), _timeline.IsMovingPositionHandle ? style.ProgressNormal : style.Foreground);
|
||||
// TODO: Convert to its own sprite or 9 slice
|
||||
Render2D.DrawSprite(icon, new Rectangle(new Float2(10, -icon.Size.X * 0.5f - 1), Size + new Float2(0, 1)), color);
|
||||
Render2D.FillRectangle(new Rectangle(new Float2(-6, -icon.Size.Y * 0.5f + 7), new Float2(timeAxisOverlap, 5)), color);
|
||||
Render2D.PopTransform();
|
||||
var textMatrix = Matrix3x3.Translation2D(12, timeAxisHeaderOffset);
|
||||
Render2D.PushTransform(ref textMatrix);
|
||||
Render2D.DrawText(style.FontSmall, labelText, style.Foreground, new Float2(2, -6));
|
||||
Render2D.PopTransform();
|
||||
|
||||
Render2D.FillRectangle(new Rectangle(Width * 0.5f, Height + timeAxisHeaderOffset, 1, _timeline.MediaPanel.Height - timeAxisHeaderOffset - timeAxisOverlap), _timeline.IsMovingPositionHandle ? style.ProgressNormal : style.Foreground.RGBMultiplied(0.8f));
|
||||
|
||||
@@ -50,6 +50,27 @@ namespace FlaxEditor.GUI.Timeline
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnMouseEnter(Float2 location)
|
||||
{
|
||||
base.OnMouseEnter(location);
|
||||
Cursor = CursorType.Hand;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnMouseLeave()
|
||||
{
|
||||
Cursor = CursorType.Default;
|
||||
base.OnMouseLeave();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Defocus()
|
||||
{
|
||||
Cursor = CursorType.Default;
|
||||
base.Defocus();
|
||||
}
|
||||
|
||||
private void Seek(ref Float2 location)
|
||||
{
|
||||
if (_timeline.PlaybackState == PlaybackStates.Disabled)
|
||||
|
||||
@@ -167,7 +167,7 @@ namespace FlaxEditor.GUI.Timeline
|
||||
/// <summary>
|
||||
/// The header top area height (in pixels).
|
||||
/// </summary>
|
||||
public static readonly float HeaderTopAreaHeight = 22.0f;
|
||||
public static readonly float HeaderTopAreaHeight = 40.0f;
|
||||
|
||||
/// <summary>
|
||||
/// The timeline units per second (on time axis).
|
||||
|
||||
@@ -298,7 +298,7 @@ namespace FlaxEditor.GUI.Timeline.Tracks
|
||||
var animEventTypes = Editor.Instance.CodeEditing.All.Get().Where(x => new ScriptType(typeof(AnimEvent)).IsAssignableFrom(x));
|
||||
foreach (var type in animEventTypes)
|
||||
{
|
||||
if (type.IsAbstract || !type.CanCreateInstance)
|
||||
if (type.IsAbstract || !type.CanCreateInstance || type.HasAttribute(typeof(HideInEditorAttribute), true))
|
||||
continue;
|
||||
var add = new ScriptType(typeof(AnimContinuousEvent)).IsAssignableFrom(type) ? addContinuousEvent : addEvent;
|
||||
var b = add.ContextMenu.AddButton(type.Name);
|
||||
@@ -307,6 +307,10 @@ namespace FlaxEditor.GUI.Timeline.Tracks
|
||||
b.Parent.Tag = time;
|
||||
b.ButtonClicked += OnAddAnimEvent;
|
||||
}
|
||||
if (!addEvent.ContextMenu.Items.Any())
|
||||
addEvent.ContextMenu.AddButton("No Anim Events found").CloseMenuOnClick = false;
|
||||
if (!addContinuousEvent.ContextMenu.Items.Any())
|
||||
addContinuousEvent.ContextMenu.AddButton("No Continuous Anim Events found").CloseMenuOnClick = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -479,6 +479,7 @@ namespace FlaxEditor.Viewport
|
||||
{
|
||||
InitFpsCounter();
|
||||
_showFpsButon = ViewWidgetShowMenu.AddButton("FPS Counter", () => ShowFpsCounter = !ShowFpsCounter);
|
||||
_showFpsButon.CloseMenuOnClick = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -397,9 +397,11 @@ namespace FlaxEditor.Viewport
|
||||
// Show grid widget
|
||||
_showGridButton = ViewWidgetShowMenu.AddButton("Grid", () => Grid.Enabled = !Grid.Enabled);
|
||||
_showGridButton.Icon = Style.Current.CheckBoxTick;
|
||||
_showGridButton.CloseMenuOnClick = false;
|
||||
|
||||
// Show navigation widget
|
||||
_showNavigationButton = ViewWidgetShowMenu.AddButton("Navigation", () => ShowNavigation = !ShowNavigation);
|
||||
_showNavigationButton.CloseMenuOnClick = false;
|
||||
|
||||
// Create camera widget
|
||||
ViewWidgetButtonMenu.AddSeparator();
|
||||
|
||||
@@ -194,16 +194,20 @@ namespace FlaxEditor.Viewport.Previews
|
||||
{
|
||||
// Show Bounds
|
||||
_showBoundsButton = ViewWidgetShowMenu.AddButton("Bounds", () => ShowBounds = !ShowBounds);
|
||||
_showBoundsButton.CloseMenuOnClick = false;
|
||||
|
||||
// Show Skeleton
|
||||
_showNodesButton = ViewWidgetShowMenu.AddButton("Skeleton", () => ShowNodes = !ShowNodes);
|
||||
_showNodesButton.CloseMenuOnClick = false;
|
||||
|
||||
// Show Skeleton Names
|
||||
_showNodesNamesButton = ViewWidgetShowMenu.AddButton("Skeleton Names", () => ShowNodesNames = !ShowNodesNames);
|
||||
_showNodesNamesButton.CloseMenuOnClick = false;
|
||||
|
||||
// Show Floor
|
||||
_showFloorButton = ViewWidgetShowMenu.AddButton("Floor", button => ShowFloor = !ShowFloor);
|
||||
_showFloorButton.IndexInParent = 1;
|
||||
_showFloorButton.CloseMenuOnClick = false;
|
||||
}
|
||||
|
||||
// Enable shadows
|
||||
|
||||
@@ -171,6 +171,7 @@ namespace FlaxEditor.Viewport.Previews
|
||||
// Show Default Scene
|
||||
_showDefaultSceneButton = ViewWidgetShowMenu.AddButton("Default Scene", () => ShowDefaultSceneActors = !ShowDefaultSceneActors);
|
||||
_showDefaultSceneButton.Checked = true;
|
||||
_showDefaultSceneButton.CloseMenuOnClick = false;
|
||||
}
|
||||
|
||||
// Setup preview scene
|
||||
|
||||
@@ -199,13 +199,18 @@ namespace FlaxEditor.Viewport.Previews
|
||||
if (useWidgets)
|
||||
{
|
||||
_showBoundsButton = ViewWidgetShowMenu.AddButton("Bounds", () => ShowBounds = !ShowBounds);
|
||||
_showBoundsButton.CloseMenuOnClick = false;
|
||||
_showNormalsButton = ViewWidgetShowMenu.AddButton("Normals", () => ShowNormals = !ShowNormals);
|
||||
_showNormalsButton.CloseMenuOnClick = false;
|
||||
_showTangentsButton = ViewWidgetShowMenu.AddButton("Tangents", () => ShowTangents = !ShowTangents);
|
||||
_showTangentsButton.CloseMenuOnClick = false;
|
||||
_showBitangentsButton = ViewWidgetShowMenu.AddButton("Bitangents", () => ShowBitangents = !ShowBitangents);
|
||||
_showBitangentsButton.CloseMenuOnClick = false;
|
||||
|
||||
// Show Floor
|
||||
_showFloorButton = ViewWidgetShowMenu.AddButton("Floor", button => ShowFloor = !ShowFloor);
|
||||
_showFloorButton.IndexInParent = 1;
|
||||
_showFloorButton.CloseMenuOnClick = false;
|
||||
|
||||
// Show current LOD widget
|
||||
_showCurrentLODButton = ViewWidgetShowMenu.AddButton("Current LOD", button =>
|
||||
@@ -214,6 +219,7 @@ namespace FlaxEditor.Viewport.Previews
|
||||
_showCurrentLODButton.Icon = _showCurrentLOD ? Style.Current.CheckBoxTick : SpriteHandle.Invalid;
|
||||
});
|
||||
_showCurrentLODButton.IndexInParent = 2;
|
||||
_showCurrentLODButton.CloseMenuOnClick = false;
|
||||
|
||||
// Preview LODs mode widget
|
||||
var PreviewLODsMode = new ViewportWidgetsContainer(ViewportWidgetLocation.UpperRight);
|
||||
|
||||
@@ -186,8 +186,11 @@ namespace FlaxEditor.Viewport.Previews
|
||||
if (!useWidgets)
|
||||
return;
|
||||
_showBoundsButton = ViewWidgetShowMenu.AddButton("Bounds", () => ShowBounds = !ShowBounds);
|
||||
_showBoundsButton.CloseMenuOnClick = false;
|
||||
_showOriginButton = ViewWidgetShowMenu.AddButton("Origin", () => ShowOrigin = !ShowOrigin);
|
||||
_showOriginButton.CloseMenuOnClick = false;
|
||||
_showParticleCounterButton = ViewWidgetShowMenu.AddButton("Particles Counter", () => ShowParticlesCounter = !ShowParticlesCounter);
|
||||
_showParticleCounterButton.CloseMenuOnClick = false;
|
||||
|
||||
// Play/Pause widget
|
||||
{
|
||||
|
||||
@@ -49,6 +49,7 @@ namespace FlaxEditor.Viewport.Previews
|
||||
_showCurrentLODButton.Icon = _showCurrentLOD ? Style.Current.CheckBoxTick : SpriteHandle.Invalid;
|
||||
});
|
||||
_showCurrentLODButton.IndexInParent = 2;
|
||||
_showCurrentLODButton.CloseMenuOnClick = false;
|
||||
|
||||
// PreviewLODS mode widget
|
||||
var PreviewLODSMode = new ViewportWidgetsContainer(ViewportWidgetLocation.UpperRight);
|
||||
|
||||
@@ -23,6 +23,7 @@ namespace FlaxEditor.Windows.Assets
|
||||
private readonly Undo _undo;
|
||||
private object _object;
|
||||
private bool _isRegisteredForScriptsReload;
|
||||
private Label _typeText;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the instance of the Json asset object that is being edited.
|
||||
@@ -136,6 +137,22 @@ namespace FlaxEditor.Windows.Assets
|
||||
}
|
||||
}
|
||||
_presenter.Select(_object);
|
||||
|
||||
if (_typeText != null)
|
||||
_typeText.Dispose();
|
||||
var typeText = new ClickableLabel
|
||||
{
|
||||
Text = $"{Asset.DataTypeName}",
|
||||
TooltipText = "Asset data type (full name)",
|
||||
AnchorPreset = AnchorPresets.TopRight,
|
||||
AutoWidth = true,
|
||||
Parent = this,
|
||||
};
|
||||
typeText.LocalX += -(typeText.Width + 4);
|
||||
typeText.LocalY += (_toolstrip.Height - typeText.Height) * 0.5f;
|
||||
typeText.RightClick = () => Clipboard.Text = Asset.DataTypeName;
|
||||
_typeText = typeText;
|
||||
|
||||
_undo.Clear();
|
||||
ClearEditedFlag();
|
||||
|
||||
@@ -175,6 +192,7 @@ namespace FlaxEditor.Windows.Assets
|
||||
_isRegisteredForScriptsReload = false;
|
||||
ScriptsBuilder.ScriptsReloadBegin -= OnScriptsReloadBegin;
|
||||
}
|
||||
_typeText = null;
|
||||
|
||||
base.OnDestroy();
|
||||
}
|
||||
|
||||
@@ -247,8 +247,17 @@ namespace FlaxEditor.Windows
|
||||
for (int i = 0; i < _viewDropdown.Items.Count; i++)
|
||||
{
|
||||
var filterButton = filters.ContextMenu.AddButton(_viewDropdown.Items[i], OnFilterClicked);
|
||||
filterButton.CloseMenuOnClick = false;
|
||||
filterButton.Tag = i;
|
||||
}
|
||||
filters.ContextMenu.ButtonClicked += button =>
|
||||
{
|
||||
foreach (var item in (filters.ContextMenu).Items)
|
||||
{
|
||||
if (item is ContextMenuButton filterButton)
|
||||
filterButton.Checked = _viewDropdown.IsSelected(filterButton.Text);
|
||||
}
|
||||
};
|
||||
filters.ContextMenu.VisibleChanged += control =>
|
||||
{
|
||||
if (!control.Visible)
|
||||
@@ -340,6 +349,9 @@ namespace FlaxEditor.Windows
|
||||
/// <returns>The created renaming popup.</returns>
|
||||
public void Rename(ContentItem item)
|
||||
{
|
||||
if (!item.CanRename)
|
||||
return;
|
||||
|
||||
// Show element in the view
|
||||
Select(item, true);
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "AudioBackendXAudio2.h"
|
||||
#include "Engine/Audio/AudioSettings.h"
|
||||
#include "Engine/Core/Collections/Array.h"
|
||||
#include "Engine/Core/Collections/ChunkedArray.h"
|
||||
#include "Engine/Core/Log.h"
|
||||
#include "Engine/Audio/Audio.h"
|
||||
#include "Engine/Audio/AudioSource.h"
|
||||
@@ -208,8 +209,8 @@ namespace XAudio2
|
||||
bool ForceDirty = true;
|
||||
Listener Listeners[AUDIO_MAX_LISTENERS];
|
||||
CriticalSection Locker;
|
||||
Array<Source> Sources(32); // TODO: use ChunkedArray for better performance
|
||||
Array<Buffer*> Buffers(64); // TODO: use ChunkedArray for better performance or use buffers pool?
|
||||
ChunkedArray<Source, 32> Sources;
|
||||
ChunkedArray<Buffer*, 64> Buffers; // TODO: use ChunkedArray for better performance or use buffers pool?
|
||||
EngineCallback Callback;
|
||||
|
||||
Listener* GetListener()
|
||||
|
||||
@@ -135,6 +135,52 @@ void Screen::SetCursorLock(CursorLockMode mode)
|
||||
CursorLock = mode;
|
||||
}
|
||||
|
||||
GameWindowMode Screen::GetGameWindowMode()
|
||||
{
|
||||
GameWindowMode result = GameWindowMode::Windowed;
|
||||
#if !USE_EDITOR
|
||||
auto win = Engine::MainWindow;
|
||||
if (win)
|
||||
{
|
||||
if (GetIsFullscreen() || win->IsFullscreen())
|
||||
result = GameWindowMode::Fullscreen;
|
||||
else if (win->GetSettings().HasBorder)
|
||||
result = GameWindowMode::Windowed;
|
||||
else if (win->GetClientPosition().IsZero() && win->GetSize() == Platform::GetDesktopSize())
|
||||
result = GameWindowMode::FullscreenBorderless;
|
||||
else
|
||||
result = GameWindowMode::Borderless;
|
||||
}
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
void Screen::SetGameWindowMode(GameWindowMode windowMode)
|
||||
{
|
||||
#if !USE_EDITOR
|
||||
auto win = Engine::MainWindow;
|
||||
if (!win)
|
||||
return;
|
||||
switch (windowMode)
|
||||
{
|
||||
case GameWindowMode::Windowed:
|
||||
if (GetIsFullscreen())
|
||||
SetIsFullscreen(false);
|
||||
win->SetBorderless(false, false);
|
||||
break;
|
||||
case GameWindowMode::Fullscreen:
|
||||
SetIsFullscreen(true);
|
||||
break;
|
||||
case GameWindowMode::Borderless:
|
||||
win->SetBorderless(true, false);
|
||||
break;
|
||||
case GameWindowMode::FullscreenBorderless:
|
||||
win->SetBorderless(true, true);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void ScreenService::Update()
|
||||
{
|
||||
#if USE_EDITOR
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Engine/Core/Config/PlatformSettingsBase.h"
|
||||
#include "Engine/Scripting/ScriptingType.h"
|
||||
#include "Engine/Input/Enums.h"
|
||||
#include "Engine/Core/Math/Vector2.h"
|
||||
@@ -80,4 +81,19 @@ DECLARE_SCRIPTING_TYPE_NO_SPAWN(Screen);
|
||||
/// </summary>
|
||||
/// <param name="mode">The mode.</param>
|
||||
API_PROPERTY() static void SetCursorLock(CursorLockMode mode);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the game window mode.
|
||||
/// </summary>
|
||||
/// <returns>The current window mode.</returns>
|
||||
API_PROPERTY() static GameWindowMode GetGameWindowMode();
|
||||
|
||||
/// <summary>
|
||||
/// Sets the game window mode.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// A fullscreen mode switch may not happen immediately. It will be performed before next frame rendering. Will not work in editor.
|
||||
/// </remarks>
|
||||
/// <param name="windowMode">The window mode.</param>
|
||||
API_PROPERTY() static void SetGameWindowMode(GameWindowMode windowMode);
|
||||
};
|
||||
|
||||
@@ -675,20 +675,12 @@ bool Prefab::ApplyAll(Actor* targetActor)
|
||||
}
|
||||
}
|
||||
|
||||
// Setup default instances
|
||||
for (int32 i = 0; i < allPrefabs.Count(); i++)
|
||||
// Setup default instances (skip invalid prefabs)
|
||||
for (int32 i = allPrefabs.Count() - 1; i >= 0; i--)
|
||||
{
|
||||
Prefab* prefab = allPrefabs[i];
|
||||
if (prefab->WaitForLoaded())
|
||||
{
|
||||
LOG(Warning, "Waiting for nesting prefab asset load failed.");
|
||||
return true;
|
||||
}
|
||||
if (prefab->GetDefaultInstance() == nullptr)
|
||||
{
|
||||
LOG(Warning, "Failed to create default prefab instance for the nested prefab asset.");
|
||||
return true;
|
||||
}
|
||||
if (prefab->WaitForLoaded() || prefab->GetDefaultInstance() == nullptr)
|
||||
allPrefabs.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1412,9 +1412,9 @@ void NetworkInternal::NetworkReplicatorUpdate()
|
||||
if (!CachedReplicationResult)
|
||||
CachedReplicationResult = New<NetworkReplicationHierarchyUpdateResult>();
|
||||
CachedReplicationResult->Init();
|
||||
if (!isClient && NetworkManager::Clients.IsEmpty())
|
||||
if ((!isClient && NetworkManager::Clients.IsEmpty()) || NetworkManager::NetworkFPS < -ZeroTolerance)
|
||||
{
|
||||
// No need to update replication when nobody's around
|
||||
// No need to update replication when nobody's around or when replication is disabled
|
||||
}
|
||||
else if (Hierarchy)
|
||||
{
|
||||
|
||||
@@ -445,6 +445,15 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the window to be borderless or not and to be fullscreen.
|
||||
/// </summary>
|
||||
/// <param name="isBorderless">Whether or not to have borders on window.</param>
|
||||
/// <param name="maximized">Whether or not to make the borderless window fullscreen (maximize to cover whole screen).</param>
|
||||
API_FUNCTION() virtual void SetBorderless(bool isBorderless, bool maximized = false)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restores the window state before minimizing or maximizing.
|
||||
/// </summary>
|
||||
|
||||
@@ -202,8 +202,7 @@ void GetDragDropData(const MacWindow* window, id<NSDraggingInfo> sender, Float2&
|
||||
{
|
||||
NSRect frame = [(NSWindow*)window->GetNativePtr() frame];
|
||||
NSPoint point = [sender draggingLocation];
|
||||
Float2 titleSize = GetWindowTitleSize(window);
|
||||
mousePos = Float2(point.x, frame.size.height - point.y) - titleSize;
|
||||
mousePos = Float2(point.x, frame.size.height - point.y) * MacPlatform::ScreenScale - GetWindowTitleSize(window);
|
||||
NSPasteboard* pasteboard = [sender draggingPasteboard];
|
||||
if ([[pasteboard types] containsObject:NSPasteboardTypeString])
|
||||
{
|
||||
|
||||
@@ -316,7 +316,8 @@ bool WindowsFileSystem::ShowBrowseFolderDialog(Window* parentWindow, const Strin
|
||||
if (SUCCEEDED(SHCreateItemFromParsingName(initialDirectory.Get(), NULL, IID_PPV_ARGS(&defaultFolder))))
|
||||
fd->SetFolder(defaultFolder);
|
||||
|
||||
if (SUCCEEDED(fd->Show(parentWindow->GetHWND())))
|
||||
HWND hwndOwner = parentWindow ? parentWindow->GetHWND() : NULL;
|
||||
if (SUCCEEDED(fd->Show(hwndOwner)))
|
||||
{
|
||||
ComPtr<IShellItem> si;
|
||||
if (SUCCEEDED(fd->GetResult(&si)))
|
||||
|
||||
@@ -260,6 +260,75 @@ void WindowsWindow::Maximize()
|
||||
_isDuringMaximize = false;
|
||||
}
|
||||
|
||||
void WindowsWindow::SetBorderless(bool isBorderless, bool maximized)
|
||||
{
|
||||
ASSERT(HasHWND());
|
||||
|
||||
if (IsFullscreen())
|
||||
SetIsFullscreen(false);
|
||||
|
||||
// Fixes issue of borderless window not going full screen
|
||||
if (IsMaximized())
|
||||
Restore();
|
||||
|
||||
_settings.HasBorder = !isBorderless;
|
||||
|
||||
BringToFront();
|
||||
|
||||
if (isBorderless)
|
||||
{
|
||||
LONG lStyle = GetWindowLong(_handle, GWL_STYLE);
|
||||
lStyle &= ~(WS_THICKFRAME | WS_SYSMENU | WS_OVERLAPPED | WS_BORDER | WS_CAPTION);
|
||||
lStyle |= WS_POPUP;
|
||||
lStyle |= WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
|
||||
#if WINDOWS_USE_NEW_BORDER_LESS
|
||||
if (_settings.IsRegularWindow)
|
||||
style |= WS_BORDER | WS_CAPTION | WS_DLGFRAME | WS_SYSMENU | WS_THICKFRAME | WS_GROUP;
|
||||
#elif WINDOWS_USE_NEWER_BORDER_LESS
|
||||
if (_settings.IsRegularWindow)
|
||||
lStyle |= WS_THICKFRAME | WS_SYSMENU;
|
||||
#endif
|
||||
|
||||
SetWindowLong(_handle, GWL_STYLE, lStyle);
|
||||
SetWindowPos(_handle, HWND_TOP, 0, 0,0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
|
||||
|
||||
if (maximized)
|
||||
{
|
||||
ShowWindow(_handle, SW_SHOWMAXIMIZED);
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowWindow(_handle, SW_SHOW);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LONG lStyle = GetWindowLong(_handle, GWL_STYLE);
|
||||
lStyle &= ~(WS_POPUP | WS_CLIPCHILDREN | WS_CLIPSIBLINGS);
|
||||
if (_settings.AllowMaximize)
|
||||
lStyle |= WS_MAXIMIZEBOX;
|
||||
if (_settings.AllowMinimize)
|
||||
lStyle |= WS_MINIMIZEBOX;
|
||||
if (_settings.HasSizingFrame)
|
||||
lStyle |= WS_THICKFRAME;
|
||||
lStyle |= WS_OVERLAPPED | WS_SYSMENU | WS_BORDER | WS_CAPTION;
|
||||
|
||||
SetWindowLong(_handle, GWL_STYLE, lStyle);
|
||||
SetWindowPos(_handle, nullptr, 0, 0, (int)_settings.Size.X, (int)_settings.Size.Y, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
|
||||
|
||||
if (maximized)
|
||||
{
|
||||
Maximize();
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowWindow(_handle, SW_SHOW);
|
||||
}
|
||||
}
|
||||
|
||||
CheckForWindowResize();
|
||||
}
|
||||
|
||||
void WindowsWindow::Restore()
|
||||
{
|
||||
ASSERT(HasHWND());
|
||||
|
||||
@@ -100,6 +100,7 @@ public:
|
||||
void Hide() override;
|
||||
void Minimize() override;
|
||||
void Maximize() override;
|
||||
void SetBorderless(bool isBorderless, bool maximized = false) override;
|
||||
void Restore() override;
|
||||
bool IsClosed() const override;
|
||||
bool IsForegroundWindow() const override;
|
||||
|
||||
@@ -1125,42 +1125,67 @@ bool TerrainPatch::InitializeHeightMap()
|
||||
|
||||
float* TerrainPatch::GetHeightmapData()
|
||||
{
|
||||
PROFILE_CPU_NAMED("Terrain.GetHeightmapData");
|
||||
|
||||
if (_cachedHeightMap.HasItems())
|
||||
return _cachedHeightMap.Get();
|
||||
|
||||
PROFILE_CPU_NAMED("Terrain.GetHeightmapData");
|
||||
|
||||
CacheHeightData();
|
||||
|
||||
return _cachedHeightMap.Get();
|
||||
}
|
||||
|
||||
void TerrainPatch::ClearHeightmapCache()
|
||||
{
|
||||
PROFILE_CPU_NAMED("Terrain.ClearHeightmapCache");
|
||||
_cachedHeightMap.Clear();
|
||||
}
|
||||
|
||||
byte* TerrainPatch::GetHolesMaskData()
|
||||
{
|
||||
PROFILE_CPU_NAMED("Terrain.GetHolesMaskData");
|
||||
|
||||
if (_cachedHolesMask.HasItems())
|
||||
return _cachedHolesMask.Get();
|
||||
|
||||
PROFILE_CPU_NAMED("Terrain.GetHolesMaskData");
|
||||
|
||||
CacheHeightData();
|
||||
|
||||
return _cachedHolesMask.Get();
|
||||
}
|
||||
|
||||
void TerrainPatch::ClearHolesMaskCache()
|
||||
{
|
||||
PROFILE_CPU_NAMED("Terrain.ClearHolesMaskCache");
|
||||
_cachedHolesMask.Clear();
|
||||
}
|
||||
|
||||
Color32* TerrainPatch::GetSplatMapData(int32 index)
|
||||
{
|
||||
ASSERT(index >= 0 && index < TERRAIN_MAX_SPLATMAPS_COUNT);
|
||||
|
||||
PROFILE_CPU_NAMED("Terrain.GetSplatMapData");
|
||||
|
||||
if (_cachedSplatMap[index].HasItems())
|
||||
return _cachedSplatMap[index].Get();
|
||||
|
||||
PROFILE_CPU_NAMED("Terrain.GetSplatMapData");
|
||||
|
||||
CacheSplatData();
|
||||
|
||||
return _cachedSplatMap[index].Get();
|
||||
}
|
||||
|
||||
void TerrainPatch::ClearSplatMapCache()
|
||||
{
|
||||
PROFILE_CPU_NAMED("Terrain.ClearSplatMapCache");
|
||||
_cachedSplatMap->Clear();
|
||||
}
|
||||
|
||||
void TerrainPatch::ClearCache()
|
||||
{
|
||||
ClearHeightmapCache();
|
||||
ClearHolesMaskCache();
|
||||
ClearSplatMapCache();
|
||||
}
|
||||
|
||||
void TerrainPatch::CacheHeightData()
|
||||
{
|
||||
PROFILE_CPU_NAMED("Terrain.CacheHeightData");
|
||||
|
||||
@@ -229,12 +229,22 @@ public:
|
||||
/// <returns>The heightmap data.</returns>
|
||||
float* GetHeightmapData();
|
||||
|
||||
/// <summary>
|
||||
/// Clears cache of the heightmap data.
|
||||
/// </summary>
|
||||
void ClearHeightmapCache();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the raw pointer to the holes mask data.
|
||||
/// </summary>
|
||||
/// <returns>The holes mask data.</returns>
|
||||
byte* GetHolesMaskData();
|
||||
|
||||
/// <summary>
|
||||
/// Clears cache of the holes mask data.
|
||||
/// </summary>
|
||||
void ClearHolesMaskCache();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the raw pointer to the splat map data.
|
||||
/// </summary>
|
||||
@@ -242,6 +252,16 @@ public:
|
||||
/// <returns>The splat map data.</returns>
|
||||
Color32* GetSplatMapData(int32 index);
|
||||
|
||||
/// <summary>
|
||||
/// Clears cache of the splat map data.
|
||||
/// </summary>
|
||||
void ClearSplatMapCache();
|
||||
|
||||
/// <summary>
|
||||
/// Clears all caches.
|
||||
/// </summary>
|
||||
void ClearCache();
|
||||
|
||||
/// <summary>
|
||||
/// Modifies the terrain patch heightmap with the given samples.
|
||||
/// </summary>
|
||||
|
||||
@@ -80,21 +80,27 @@ namespace FlaxEngine.GUI
|
||||
public Color BackgroundColorSelected { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the color of the border.
|
||||
/// Gets or sets whether the button has a border.
|
||||
/// </summary>
|
||||
[EditorDisplay("Border Style"), EditorOrder(2010), ExpandGroups]
|
||||
public bool HasBorder { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the color of the border.
|
||||
/// </summary>
|
||||
[EditorDisplay("Border Style"), EditorOrder(2011), ExpandGroups]
|
||||
public Color BorderColor { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the border color when button is highlighted.
|
||||
/// </summary>
|
||||
[EditorDisplay("Border Style"), EditorOrder(2011)]
|
||||
[EditorDisplay("Border Style"), EditorOrder(2012)]
|
||||
public Color BorderColorHighlighted { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the border color when button is selected.
|
||||
/// </summary>
|
||||
[EditorDisplay("Border Style"), EditorOrder(2012)]
|
||||
[EditorDisplay("Border Style"), EditorOrder(2013)]
|
||||
public Color BorderColorSelected { get; set; }
|
||||
|
||||
/// <summary>
|
||||
@@ -245,7 +251,8 @@ namespace FlaxEngine.GUI
|
||||
BackgroundBrush.Draw(clientRect, backgroundColor);
|
||||
else
|
||||
Render2D.FillRectangle(clientRect, backgroundColor);
|
||||
Render2D.DrawRectangle(clientRect, borderColor);
|
||||
if (HasBorder)
|
||||
Render2D.DrawRectangle(clientRect, borderColor);
|
||||
|
||||
// Draw text
|
||||
Render2D.DrawText(_font?.GetFont(), TextMaterial, _text, clientRect, textColor, TextAlignment.Center, TextAlignment.Center);
|
||||
|
||||
Reference in New Issue
Block a user