Merge remote-tracking branch 'origin/1.11' into work
Some checks failed
Build Android / Game (Android, Release ARM64) (push) Has been cancelled
Build iOS / Game (iOS, Release ARM64) (push) Has been cancelled
Build Linux / Editor (Linux, Development x64) (push) Has been cancelled
Build Linux / Game (Linux, Release x64) (push) Has been cancelled
Build macOS / Editor (Mac, Development ARM64) (push) Has been cancelled
Build macOS / Game (Mac, Release ARM64) (push) Has been cancelled
Build Windows / Editor (Windows, Development x64) (push) Has been cancelled
Build Windows / Game (Windows, Release x64) (push) Has been cancelled
Cooker / Cook (Mac) (push) Has been cancelled
Tests / Tests (Linux) (push) Has been cancelled
Tests / Tests (Windows) (push) Has been cancelled

This commit is contained in:
2025-07-05 14:19:52 +03:00
286 changed files with 4528 additions and 1308 deletions

View File

@@ -57,7 +57,7 @@ namespace FlaxEngine.GUI
{
base.OnSizeChanged();
// Refresh textblocks since thos emight depend on control size (eg. align right)
// Refresh textblocks since those might depend on control size (eg. align right)
UpdateTextBlocks();
}
}

View File

@@ -173,7 +173,7 @@ namespace FlaxEngine.GUI
// Delete children
while (_children.Count > 0)
{
_children[0].Dispose();
_children[^1].Dispose();
}
_isLayoutLocked = wasLayoutLocked;

View File

@@ -13,6 +13,8 @@
#include "Engine/Render2D/FontManager.h"
#include "Engine/Render2D/FontTextureAtlas.h"
#include "Engine/Renderer/RenderList.h"
#include "Engine/Profiler/ProfilerCPU.h"
#include "Engine/Profiler/ProfilerMemory.h"
#include "Engine/Serialization/Serialization.h"
#include "Engine/Content/Assets/MaterialInstance.h"
#include "Engine/Content/Content.h"
@@ -120,6 +122,9 @@ void TextRender::SetLayoutOptions(TextLayoutOptions& value)
void TextRender::UpdateLayout()
{
PROFILE_CPU();
PROFILE_MEM(UI);
// Clear
_ib.Clear();
_vb.Clear();
@@ -185,6 +190,10 @@ void TextRender::UpdateLayout()
_buffersDirty = true;
// Init draw chunks data
Array<MaterialInstance*, InlinedAllocation<8>> materials;
materials.Resize(_drawChunks.Count());
for (int32 i = 0; i < materials.Count(); i++)
materials[i] = _drawChunks[i].Material;
DrawChunk drawChunk;
drawChunk.Actor = this;
drawChunk.StartIndex = 0;
@@ -237,10 +246,12 @@ void TextRender::UpdateLayout()
}
// Setup material
drawChunk.Material = Content::CreateVirtualAsset<MaterialInstance>();
if (_drawChunks.Count() < materials.Count())
drawChunk.Material = materials[_drawChunks.Count()];
else
drawChunk.Material = Content::CreateVirtualAsset<MaterialInstance>();
drawChunk.Material->SetBaseMaterial(Material.Get());
for (auto& param : drawChunk.Material->Params)
param.SetIsOverride(false);
drawChunk.Material->ResetParameters();
// Set the font parameter
static StringView FontParamName = TEXT("Font");

View File

@@ -6,6 +6,7 @@
#include "Engine/Scripting/ManagedCLR/MClass.h"
#include "Engine/Scripting/ManagedCLR/MUtils.h"
#include "Engine/Serialization/Serialization.h"
#include "Engine/Profiler/ProfilerMemory.h"
#if COMPILE_WITHOUT_CSHARP
#define UICANVAS_INVOKE(event)
@@ -26,6 +27,7 @@ MMethod* UICanvas_ParentChanged = nullptr;
auto* managed = GetManagedInstance(); \
if (managed) \
{ \
PROFILE_MEM(UI); \
MObject* exception = nullptr; \
UICanvas_##event->Invoke(managed, nullptr, &exception); \
if (exception) \
@@ -77,6 +79,7 @@ void UICanvas::Serialize(SerializeStream& stream, const void* otherObj)
SERIALIZE_GET_OTHER_OBJ(UICanvas);
#if !COMPILE_WITHOUT_CSHARP
PROFILE_MEM(UI);
stream.JKEY("V");
void* params[1];
params[0] = other ? other->GetOrCreateManagedInstance() : nullptr;
@@ -109,6 +112,7 @@ void UICanvas::Deserialize(DeserializeStream& stream, ISerializeModifier* modifi
const auto dataMember = stream.FindMember("V");
if (dataMember != stream.MemberEnd())
{
PROFILE_MEM(UI);
rapidjson_flax::StringBuffer buffer;
rapidjson_flax::Writer<rapidjson_flax::StringBuffer> writer(buffer);
dataMember->value.Accept(writer);

View File

@@ -7,6 +7,7 @@
#include "Engine/Scripting/ManagedCLR/MClass.h"
#include "Engine/Scripting/ManagedCLR/MCore.h"
#include "Engine/Serialization/Serialization.h"
#include "Engine/Profiler/ProfilerMemory.h"
#if COMPILE_WITHOUT_CSHARP
#define UICONTROL_INVOKE(event)
@@ -25,6 +26,7 @@ MMethod* UIControl_EndPlay = nullptr;
auto* managed = GetManagedInstance(); \
if (managed) \
{ \
PROFILE_MEM(UI); \
MObject* exception = nullptr; \
UIControl_##event->Invoke(managed, nullptr, &exception); \
if (exception) \
@@ -78,6 +80,7 @@ void UIControl::Serialize(SerializeStream& stream, const void* otherObj)
SERIALIZE_MEMBER(NavTargetRight, _navTargetRight);
#if !COMPILE_WITHOUT_CSHARP
PROFILE_MEM(UI);
void* params[2];
MString* controlType = nullptr;
params[0] = &controlType;
@@ -129,6 +132,7 @@ void UIControl::Deserialize(DeserializeStream& stream, ISerializeModifier* modif
DESERIALIZE_MEMBER(NavTargetRight, _navTargetRight);
#if !COMPILE_WITHOUT_CSHARP
PROFILE_MEM(UI);
MTypeObject* typeObj = nullptr;
const auto controlMember = stream.FindMember("Control");
if (controlMember != stream.MemberEnd())