Move Actor static flags helper methods to be manually implemented (less bindings)

This commit is contained in:
Wojtek Figat
2021-01-18 15:07:39 +01:00
parent f80c33f381
commit e0f1f18998
2 changed files with 65 additions and 5 deletions

View File

@@ -6,6 +6,66 @@ namespace FlaxEngine
{
partial class Actor : ITransformable, ISceneObject
{
/// <summary>
/// Returns true if object is fully static on the scene, otherwise false.
/// </summary>
[Unmanaged]
[Tooltip("Returns true if object is fully static on the scene, otherwise false.")]
public bool IsStatic => StaticFlags == FlaxEngine.StaticFlags.FullyStatic;
/// <summary>
/// Returns true if object has static transform.
/// </summary>
[Unmanaged]
[Tooltip("Returns true if object has static transform.")]
public bool IsTransformStatic => (StaticFlags & StaticFlags.Transform) == StaticFlags.Transform;
/// <summary>
/// Adds the actor static flags.
/// </summary>
/// <param name="flags">The flags to add.</param>
[Unmanaged]
[Tooltip("Adds the actor static flags.")]
public void AddStaticFlags(StaticFlags flags)
{
StaticFlags |= flags;
}
/// <summary>
/// Removes the actor static flags.
/// </summary>
/// <param name="flags">The flags to remove.</param>
[Unmanaged]
[Tooltip("Removes the actor static flags.")]
public void RemoveStaticFlags(StaticFlags flags)
{
StaticFlags &= ~flags;
}
/// <summary>
/// Sets a single static flag to the desire value.
/// </summary>
/// <param name="flag">The flag to change.</param>
/// <param name="value">The target value of the flag.</param>
[Unmanaged]
[Tooltip("Sets a single static flag to the desire value.")]
public void SetStaticFlag(StaticFlags flag, bool value)
{
StaticFlags = StaticFlags & ~flag | (value ? flag : StaticFlags.None);
}
/// <summary>
/// Returns true if object has given flag(s) set.
/// </summary>
/// <param name="flag">The flag(s) to check.</param>
/// <returns>True if has flag(s) set, otherwise false.</returns>
[Unmanaged]
[Tooltip("Returns true if object has given flag(s) set..")]
public bool HasStaticFlag(StaticFlags flag)
{
return (StaticFlags & flag) == flag;
}
/// <summary>
/// The rotation as Euler angles in degrees.
/// </summary>

View File

@@ -339,7 +339,7 @@ public:
/// <summary>
/// Returns true if object is fully static on the scene, otherwise false.
/// </summary>
API_PROPERTY() FORCE_INLINE bool IsStatic() const
FORCE_INLINE bool IsStatic() const
{
return _staticFlags == StaticFlags::FullyStatic;
}
@@ -347,7 +347,7 @@ public:
/// <summary>
/// Returns true if object has static transform.
/// </summary>
API_PROPERTY() FORCE_INLINE bool IsTransformStatic() const
FORCE_INLINE bool IsTransformStatic() const
{
return (_staticFlags & StaticFlags::Transform) != 0;
}
@@ -379,7 +379,7 @@ public:
/// Adds the actor static flags.
/// </summary>
/// <param name="flags">The flags to add.</param>
API_FUNCTION() FORCE_INLINE void AddStaticFlags(StaticFlags flags)
FORCE_INLINE void AddStaticFlags(StaticFlags flags)
{
SetStaticFlags(_staticFlags | flags);
}
@@ -388,7 +388,7 @@ public:
/// Removes the actor static flags.
/// </summary>
/// <param name="flags">The flags to remove.</param>
API_FUNCTION() FORCE_INLINE void RemoveStaticFlags(StaticFlags flags)
FORCE_INLINE void RemoveStaticFlags(StaticFlags flags)
{
SetStaticFlags(static_cast<StaticFlags>(_staticFlags & ~flags));
}
@@ -398,7 +398,7 @@ public:
/// </summary>
/// <param name="flag">The flag to change.</param>
/// <param name="value">The target value of the flag.</param>
API_FUNCTION() FORCE_INLINE void SetStaticFlag(StaticFlags flag, bool value)
FORCE_INLINE void SetStaticFlag(StaticFlags flag, bool value)
{
SetStaticFlags(static_cast<StaticFlags>(_staticFlags & ~flag) | (value ? flag : StaticFlags::None));
}