Optimize UI code
This commit is contained in:
@@ -122,8 +122,6 @@ namespace FlaxEngine.GUI
|
|||||||
if (_parent == value)
|
if (_parent == value)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Defocus();
|
|
||||||
|
|
||||||
Float2 oldParentSize;
|
Float2 oldParentSize;
|
||||||
if (_parent != null)
|
if (_parent != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,11 +23,11 @@ MMethod* UICanvas_EndPlay = nullptr;
|
|||||||
MMethod* UICanvas_ParentChanged = nullptr;
|
MMethod* UICanvas_ParentChanged = nullptr;
|
||||||
|
|
||||||
#define UICANVAS_INVOKE(event) \
|
#define UICANVAS_INVOKE(event) \
|
||||||
auto instance = GetManagedInstance(); \
|
auto* managed = GetManagedInstance(); \
|
||||||
if (instance) \
|
if (managed) \
|
||||||
{ \
|
{ \
|
||||||
MObject* exception = nullptr; \
|
MObject* exception = nullptr; \
|
||||||
UICanvas_##event->Invoke(instance, nullptr, &exception); \
|
UICanvas_##event->Invoke(managed, nullptr, &exception); \
|
||||||
if (exception) \
|
if (exception) \
|
||||||
{ \
|
{ \
|
||||||
MException ex(exception); \
|
MException ex(exception); \
|
||||||
|
|||||||
@@ -22,10 +22,11 @@ MMethod* UIControl_BeginPlay = nullptr;
|
|||||||
MMethod* UIControl_EndPlay = nullptr;
|
MMethod* UIControl_EndPlay = nullptr;
|
||||||
|
|
||||||
#define UICONTROL_INVOKE(event) \
|
#define UICONTROL_INVOKE(event) \
|
||||||
if (HasManagedInstance()) \
|
auto* managed = GetManagedInstance(); \
|
||||||
|
if (managed) \
|
||||||
{ \
|
{ \
|
||||||
MObject* exception = nullptr; \
|
MObject* exception = nullptr; \
|
||||||
UIControl_##event->Invoke(GetManagedInstance(), nullptr, &exception); \
|
UIControl_##event->Invoke(managed, nullptr, &exception); \
|
||||||
if (exception) \
|
if (exception) \
|
||||||
{ \
|
{ \
|
||||||
MException ex(exception); \
|
MException ex(exception); \
|
||||||
|
|||||||
Reference in New Issue
Block a user