Optimize UI code

This commit is contained in:
Wojtek Figat
2025-03-16 23:07:56 +01:00
parent cd4ace3f49
commit 54050685d7
3 changed files with 6 additions and 7 deletions

View File

@@ -122,8 +122,6 @@ namespace FlaxEngine.GUI
if (_parent == value)
return;
Defocus();
Float2 oldParentSize;
if (_parent != null)
{

View File

@@ -23,11 +23,11 @@ MMethod* UICanvas_EndPlay = nullptr;
MMethod* UICanvas_ParentChanged = nullptr;
#define UICANVAS_INVOKE(event) \
auto instance = GetManagedInstance(); \
if (instance) \
auto* managed = GetManagedInstance(); \
if (managed) \
{ \
MObject* exception = nullptr; \
UICanvas_##event->Invoke(instance, nullptr, &exception); \
UICanvas_##event->Invoke(managed, nullptr, &exception); \
if (exception) \
{ \
MException ex(exception); \

View File

@@ -22,10 +22,11 @@ MMethod* UIControl_BeginPlay = nullptr;
MMethod* UIControl_EndPlay = nullptr;
#define UICONTROL_INVOKE(event) \
if (HasManagedInstance()) \
auto* managed = GetManagedInstance(); \
if (managed) \
{ \
MObject* exception = nullptr; \
UIControl_##event->Invoke(GetManagedInstance(), nullptr, &exception); \
UIControl_##event->Invoke(managed, nullptr, &exception); \
if (exception) \
{ \
MException ex(exception); \