Merge branch 'master' into 1.11

This commit is contained in:
Wojtek Figat
2025-06-05 18:03:17 +02:00
189 changed files with 4627 additions and 1426 deletions

View File

@@ -36,8 +36,6 @@
#define CHECK_EXECUTE_IN_EDITOR
#endif
#define ACTOR_ORIENTATION_EPSILON 0.000000001f
// Start loop over actor children/scripts from the beginning to account for any newly added or removed actors.
#define ACTOR_LOOP_START_MODIFIED_HIERARCHY() _isHierarchyDirty = false
#define ACTOR_LOOP_CHECK_MODIFIED_HIERARCHY() if (_isHierarchyDirty) { _isHierarchyDirty = false; i = -1; }
@@ -660,7 +658,7 @@ void Actor::SetStaticFlags(StaticFlags value)
void Actor::SetTransform(const Transform& value)
{
CHECK(!value.IsNanOrInfinity());
if (!(Vector3::NearEqual(_transform.Translation, value.Translation) && Quaternion::NearEqual(_transform.Orientation, value.Orientation, ACTOR_ORIENTATION_EPSILON) && Float3::NearEqual(_transform.Scale, value.Scale)))
if (_transform.Translation != value.Translation || _transform.Orientation != value.Orientation || _transform.Scale != value.Scale)
{
if (_parent)
_parent->_transform.WorldToLocal(value, _localTransform);
@@ -673,7 +671,7 @@ void Actor::SetTransform(const Transform& value)
void Actor::SetPosition(const Vector3& value)
{
CHECK(!value.IsNanOrInfinity());
if (!Vector3::NearEqual(_transform.Translation, value))
if (_transform.Translation != value)
{
if (_parent)
_localTransform.Translation = _parent->_transform.WorldToLocal(value);
@@ -686,7 +684,7 @@ void Actor::SetPosition(const Vector3& value)
void Actor::SetOrientation(const Quaternion& value)
{
CHECK(!value.IsNanOrInfinity());
if (!Quaternion::NearEqual(_transform.Orientation, value, ACTOR_ORIENTATION_EPSILON))
if (_transform.Orientation != value)
{
if (_parent)
_parent->_transform.WorldToLocal(value, _localTransform.Orientation);
@@ -699,7 +697,7 @@ void Actor::SetOrientation(const Quaternion& value)
void Actor::SetScale(const Float3& value)
{
CHECK(!value.IsNanOrInfinity());
if (!Float3::NearEqual(_transform.Scale, value))
if (_transform.Scale != value)
{
if (_parent)
Float3::Divide(value, _parent->_transform.Scale, _localTransform.Scale);
@@ -748,7 +746,7 @@ void Actor::ResetLocalTransform()
void Actor::SetLocalTransform(const Transform& value)
{
CHECK(!value.IsNanOrInfinity());
if (!(Vector3::NearEqual(_localTransform.Translation, value.Translation) && Quaternion::NearEqual(_localTransform.Orientation, value.Orientation, ACTOR_ORIENTATION_EPSILON) && Float3::NearEqual(_localTransform.Scale, value.Scale)))
if (_localTransform.Translation != value.Translation || _localTransform.Orientation != value.Orientation || _localTransform.Scale != value.Scale)
{
_localTransform = value;
OnTransformChanged();
@@ -758,7 +756,7 @@ void Actor::SetLocalTransform(const Transform& value)
void Actor::SetLocalPosition(const Vector3& value)
{
CHECK(!value.IsNanOrInfinity());
if (!Vector3::NearEqual(_localTransform.Translation, value))
if (_localTransform.Translation != value)
{
_localTransform.Translation = value;
OnTransformChanged();
@@ -770,7 +768,7 @@ void Actor::SetLocalOrientation(const Quaternion& value)
CHECK(!value.IsNanOrInfinity());
Quaternion v = value;
v.Normalize();
if (!Quaternion::NearEqual(_localTransform.Orientation, v, ACTOR_ORIENTATION_EPSILON))
if (_localTransform.Orientation != value)
{
_localTransform.Orientation = v;
OnTransformChanged();
@@ -780,7 +778,7 @@ void Actor::SetLocalOrientation(const Quaternion& value)
void Actor::SetLocalScale(const Float3& value)
{
CHECK(!value.IsNanOrInfinity());
if (!Float3::NearEqual(_localTransform.Scale, value))
if (_localTransform.Scale != value)
{
_localTransform.Scale = value;
OnTransformChanged();

View File

@@ -65,7 +65,7 @@ void BoxBrush::SetMode(BrushMode value)
void BoxBrush::SetCenter(const Vector3& value)
{
if (Vector3::NearEqual(value, _center))
if (value == _center)
return;
_center = value;
@@ -77,7 +77,7 @@ void BoxBrush::SetCenter(const Vector3& value)
void BoxBrush::SetSize(const Vector3& value)
{
if (Vector3::NearEqual(value, _size))
if (value == _size)
return;
_size = value;

View File

@@ -12,7 +12,7 @@ BoxVolume::BoxVolume(const SpawnParams& params)
void BoxVolume::SetSize(const Vector3& value)
{
if (!Vector3::NearEqual(value, _size))
if (value != _size)
{
const auto prevBounds = _box;
_size = value;

View File

@@ -70,7 +70,7 @@ float Camera::GetFieldOfView() const
void Camera::SetFieldOfView(float value)
{
value = Math::Clamp(value, 1.0f, 179.9f);
if (Math::NotNearEqual(_fov, value))
if (_fov != value)
{
_fov = value;
UpdateCache();
@@ -85,7 +85,7 @@ float Camera::GetCustomAspectRatio() const
void Camera::SetCustomAspectRatio(float value)
{
value = Math::Clamp(value, 0.0f, 100.0f);
if (Math::NotNearEqual(_customAspectRatio, value))
if (_customAspectRatio != value)
{
_customAspectRatio = value;
UpdateCache();
@@ -100,7 +100,7 @@ float Camera::GetNearPlane() const
void Camera::SetNearPlane(float value)
{
value = Math::Clamp(value, 0.001f, _far - 1.0f);
if (Math::NotNearEqual(_near, value))
if (_near != value)
{
_near = value;
UpdateCache();
@@ -115,7 +115,7 @@ float Camera::GetFarPlane() const
void Camera::SetFarPlane(float value)
{
value = Math::Max(value, _near + 1.0f);
if (Math::NotNearEqual(_far, value))
if (_far != value)
{
_far = value;
UpdateCache();
@@ -130,7 +130,7 @@ float Camera::GetOrthographicSize() const
void Camera::SetOrthographicSize(float value)
{
value = Math::Clamp(value, 0.0f, 1000000.0f);
if (Math::NotNearEqual(_orthoSize, value))
if (_orthoSize != value)
{
_orthoSize = value;
UpdateCache();
@@ -145,7 +145,7 @@ float Camera::GetOrthographicScale() const
void Camera::SetOrthographicScale(float value)
{
value = Math::Clamp(value, 0.0001f, 1000000.0f);
if (Math::NotNearEqual(_orthoScale, value))
if (_orthoScale != value)
{
_orthoScale = value;
UpdateCache();

View File

@@ -41,7 +41,7 @@ float EnvironmentProbe::GetRadius() const
void EnvironmentProbe::SetRadius(float value)
{
value = Math::Max(0.0f, value);
if (Math::NearEqual(value, _radius))
if (value == _radius)
return;
_radius = value;

View File

@@ -49,7 +49,7 @@ float PointLight::GetScaledRadius() const
void PointLight::SetRadius(float value)
{
value = Math::Max(0.0f, value);
if (Math::NearEqual(value, _radius))
if (value == _radius)
return;
_radius = value;

View File

@@ -26,7 +26,7 @@ SkyLight::SkyLight(const SpawnParams& params)
void SkyLight::SetRadius(float value)
{
value = Math::Max(0.0f, value);
if (Math::NearEqual(value, _radius))
if (value == _radius)
return;
_radius = value;

View File

@@ -59,7 +59,7 @@ float SplineModel::GetQuality() const
void SplineModel::SetQuality(float value)
{
value = Math::Clamp(value, 0.0f, 100.0f);
if (Math::NearEqual(value, _quality))
if (value == _quality)
return;
_quality = value;
OnSplineUpdated();
@@ -72,7 +72,7 @@ float SplineModel::GetBoundsScale() const
void SplineModel::SetBoundsScale(float value)
{
if (Math::NearEqual(_boundsScale, value))
if (_boundsScale == value)
return;
_boundsScale = value;
OnSplineUpdated();

View File

@@ -57,7 +57,7 @@ float SpotLight::GetScaledRadius() const
void SpotLight::SetRadius(float value)
{
value = Math::Max(0.0f, value);
if (Math::NearEqual(value, _radius))
if (value == _radius)
return;
_radius = value;
@@ -70,7 +70,7 @@ void SpotLight::SetOuterConeAngle(float value)
value = Math::Clamp(value, 0.0f, 89.0f);
// Check if value will change
if (!Math::NearEqual(value, _outerConeAngle))
if (value != _outerConeAngle)
{
// Change values
_innerConeAngle = Math::Min(_innerConeAngle, value - ZeroTolerance);
@@ -86,7 +86,7 @@ void SpotLight::SetInnerConeAngle(float value)
value = Math::Clamp(value, 0.0f, 89.0f);
// Check if value will change
if (!Math::NearEqual(value, _innerConeAngle))
if (value != _innerConeAngle)
{
// Change values
_innerConeAngle = value;

View File

@@ -60,7 +60,7 @@ float StaticModel::GetBoundsScale() const
void StaticModel::SetBoundsScale(float value)
{
if (Math::NearEqual(_boundsScale, value))
if (_boundsScale == value)
return;
_boundsScale = value;

View File

@@ -0,0 +1,22 @@
// Copyright (c) Wojciech Figat. All rights reserved.
using FlaxEngine.Json;
namespace FlaxEngine
{
partial class ModelInstanceActor
{
partial struct MeshReference : ICustomValueEquals
{
/// <inheritdoc />
public bool ValueEquals(object other)
{
var o = (MeshReference)other;
return JsonSerializer.ValueEquals(Actor, o.Actor) &&
LODIndex == o.LODIndex &&
MeshIndex == o.MeshIndex;
}
}
}
}

View File

@@ -1090,7 +1090,7 @@ bool Prefab::ApplyAllInternal(Actor* targetActor, bool linkTargetActorObjectToPr
root = dynamic_cast<Actor*>(sceneObjects.Value->At(targetActorIdx));
}
// Try using the first actor without a parent as a new ro0t
// Try using the first actor without a parent as a new root
for (int32 i = 1; i < sceneObjects->Count(); i++)
{
SceneObject* obj = sceneObjects.Value->At(i);