Merge branch 'sceneanim_null_check_fix' of https://github.com/GoaLitiuM/FlaxEngine into GoaLitiuM-sceneanim_null_check_fix

This commit is contained in:
Wojtek Figat
2023-10-01 12:12:21 +02:00
20 changed files with 45 additions and 38 deletions

View File

@@ -905,7 +905,7 @@ void SceneAnimationPlayer::Tick(SceneAnimation* anim, float time, float dt, int3
MException ex(exception);
ex.Log(LogType::Error, TEXT("Property"));
}
else if (!MCore::Type::IsPointer(valueType))
else if (!MCore::Type::IsPointer(valueType) && !MCore::Type::IsReference(valueType))
{
if (boxed)
Platform::MemoryCopy(value, MCore::Object::Unbox(boxed), valueSize);

View File

@@ -1230,7 +1230,7 @@ namespace FlaxEngine.Interop
internal static bool GetTypeIsReference(ManagedHandle typeHandle)
{
Type type = Unsafe.As<TypeHolder>(typeHandle.Target);
return type.IsByRef;
return !type.IsValueType; // Maybe also type.IsByRef?
}
[UnmanagedCallersOnly]

View File

@@ -37,7 +37,7 @@ namespace FlaxEngine.GUI
}
/// <inheritdoc />
public Float2 Size => Texture?.Size ?? Float2.Zero;
public Float2 Size => Texture != null ? Texture.Size : Float2.Zero;
/// <inheritdoc />
public void Draw(Rectangle rect, Color color)

View File

@@ -104,7 +104,7 @@ namespace FlaxEngine.GUI
}
/// <inheritdoc />
public Float2 Size => Texture?.Size ?? Float2.Zero;
public Float2 Size => Texture != null ? Texture.Size : Float2.Zero;
/// <inheritdoc />
public unsafe void Draw(Rectangle rect, Color color)

View File

@@ -493,7 +493,8 @@ namespace FlaxEngine
if (_renderer)
{
#if FLAX_EDITOR
_editorTask?.RemoveCustomPostFx(_renderer);
if (_editorTask != null)
_editorTask.RemoveCustomPostFx(_renderer);
#endif
SceneRenderTask.RemoveGlobalCustomPostFx(_renderer);
_renderer.Canvas = null;

View File

@@ -204,7 +204,7 @@ namespace FlaxEngine
up = value;
Internal_SetNavTargets(__unmanagedPtr, GetUnmanagedPtr(up), GetUnmanagedPtr(down), GetUnmanagedPtr(left), GetUnmanagedPtr(right));
if (_control != null)
_control.NavTargetUp = value?.Control;
_control.NavTargetUp = value != null ? value.Control : null;
}
}
@@ -228,7 +228,7 @@ namespace FlaxEngine
down = value;
Internal_SetNavTargets(__unmanagedPtr, GetUnmanagedPtr(up), GetUnmanagedPtr(down), GetUnmanagedPtr(left), GetUnmanagedPtr(right));
if (_control != null)
_control.NavTargetDown = value?.Control;
_control.NavTargetDown = value != null ? value.Control : null;
}
}
@@ -252,7 +252,7 @@ namespace FlaxEngine
left = value;
Internal_SetNavTargets(__unmanagedPtr, GetUnmanagedPtr(up), GetUnmanagedPtr(down), GetUnmanagedPtr(left), GetUnmanagedPtr(right));
if (_control != null)
_control.NavTargetLeft = value?.Control;
_control.NavTargetLeft = value != null ? value.Control : null;
}
}
@@ -276,7 +276,7 @@ namespace FlaxEngine
right = value;
Internal_SetNavTargets(__unmanagedPtr, GetUnmanagedPtr(up), GetUnmanagedPtr(down), GetUnmanagedPtr(left), GetUnmanagedPtr(right));
if (_control != null)
_control.NavTargetRight = value?.Control;
_control.NavTargetRight = value != null ? value.Control : null;
}
}