Fix Resize to Fit to properly dirty state of level editor

#3670 #3735
This commit is contained in:
Wojtek Figat
2026-01-11 22:17:50 +01:00
parent ca09852898
commit 72bb2dd932
2 changed files with 4 additions and 3 deletions

View File

@@ -42,6 +42,7 @@ namespace FlaxEditor.SceneGraph.Actors
if (value is BoxCollider collider)
collider.AutoResize(!_keepLocalOrientation);
}
Presenter.OnModified();
}
}

View File

@@ -23,15 +23,15 @@ void BoxCollider::SetSize(const Float3& value)
void BoxCollider::AutoResize(bool globalOrientation = true)
{
Actor* parent = GetParent();
if (Cast<Scene>(parent))
if (parent == nullptr || Cast<Scene>(parent))
return;
// Get bounds of all siblings (excluding itself)
const Vector3 parentScale = parent->GetScale();
if (parentScale.IsAnyZero())
return; // Avoid division by zero
return;
// Hacky way to get unrotated bounded box of parent.
// Hacky way to get unrotated bounded box of parent
const Quaternion parentOrientation = parent->GetOrientation();
parent->SetOrientation(Quaternion::Identity);
BoundingBox parentBox = parent->GetBox();