This commit is contained in:
Wojtek Figat
2021-02-07 20:19:10 +01:00
parent 5768eefe49
commit 04bb83fe31
2 changed files with 13 additions and 9 deletions

View File

@@ -162,8 +162,7 @@ namespace FlaxEditor.Content
// Auto fit actor to camera
float targetSize = 30.0f;
BoundingBox bounds;
Editor.GetActorEditorBox(_preview.Instance, out bounds);
Editor.GetActorEditorBox(_preview.Instance, out var bounds);
float maxSize = Mathf.Max(0.001f, bounds.Size.MaxValue);
_preview.Instance.Scale = new Vector3(targetSize / maxSize);
_preview.Instance.Position = Vector3.Zero;
@@ -175,6 +174,7 @@ namespace FlaxEditor.Content
/// <inheritdoc />
public override void OnThumbnailDrawEnd(ThumbnailRequest request, ContainerControl guiRoot)
{
_preview.RemoveChildren();
_preview.Prefab = null;
_preview.Parent = null;
}

View File

@@ -17,13 +17,17 @@ MMethod* UICanvas_OnDisable = nullptr;
MMethod* UICanvas_EndPlay = nullptr;
#define UICANVAS_INVOKE(event) \
MonoObject* exception = nullptr; \
UICanvas_##event->Invoke(GetManagedInstance(), nullptr, &exception); \
if (exception) \
{ \
MException ex(exception); \
ex.Log(LogType::Error, TEXT("UICanvas::" #event)); \
}
auto instance = GetManagedInstance(); \
if (instance) \
{ \
MonoObject* exception = nullptr; \
UICanvas_##event->Invoke(instance, nullptr, &exception); \
if (exception) \
{ \
MException ex(exception); \
ex.Log(LogType::Error, TEXT("UICanvas::" #event)); \
} \
}
UICanvas::UICanvas(const SpawnParams& params)
: Actor(params)