diff --git a/Source/Editor/Content/Items/BinaryAssetItem.cs b/Source/Editor/Content/Items/BinaryAssetItem.cs index c8167d947..ba573ca61 100644 --- a/Source/Editor/Content/Items/BinaryAssetItem.cs +++ b/Source/Editor/Content/Items/BinaryAssetItem.cs @@ -120,7 +120,7 @@ namespace FlaxEditor.Content /// public override Actor OnEditorDrop(object context) { - return new StaticModel { Model = FlaxEngine.Content.LoadAsync(ID) }; + return new StaticModel { Model = FlaxEngine.Content.Load(ID) }; } /// @@ -171,7 +171,7 @@ namespace FlaxEditor.Content /// public override Actor OnEditorDrop(object context) { - return new AnimatedModel { SkinnedModel = FlaxEngine.Content.LoadAsync(ID) }; + return new AnimatedModel { SkinnedModel = FlaxEngine.Content.Load(ID) }; } /// diff --git a/Source/Editor/Content/Items/PrefabItem.cs b/Source/Editor/Content/Items/PrefabItem.cs index a0cd23e88..5a3565f39 100644 --- a/Source/Editor/Content/Items/PrefabItem.cs +++ b/Source/Editor/Content/Items/PrefabItem.cs @@ -32,7 +32,7 @@ namespace FlaxEditor.Content /// public override Actor OnEditorDrop(object context) { - return PrefabManager.SpawnPrefab(FlaxEngine.Content.LoadAsync(ID), null); + return PrefabManager.SpawnPrefab(FlaxEngine.Content.Load(ID), null); } /// diff --git a/Source/Editor/Viewport/ViewportDraggingHelper.cs b/Source/Editor/Viewport/ViewportDraggingHelper.cs index bdd85024a..5f74904f2 100644 --- a/Source/Editor/Viewport/ViewportDraggingHelper.cs +++ b/Source/Editor/Viewport/ViewportDraggingHelper.cs @@ -179,7 +179,7 @@ namespace FlaxEditor.Viewport private Vector3 PostProcessSpawnedActorLocation(Actor actor, ref Vector3 hitLocation) { - // Refresh actor position to ensure that cached bounds are valid + // Refresh actor position to ensure that cached bounds are valid (in Actor::OnTransformChanged) actor.Position = Vector3.One; actor.Position = Vector3.Zero; diff --git a/Source/Engine/Level/Actors/AnimatedModel.cpp b/Source/Engine/Level/Actors/AnimatedModel.cpp index a2955644c..b9e545150 100644 --- a/Source/Engine/Level/Actors/AnimatedModel.cpp +++ b/Source/Engine/Level/Actors/AnimatedModel.cpp @@ -1250,7 +1250,19 @@ BoundingBox AnimatedModel::GetEditorBoundingBox() const { if (SkinnedModel) SkinnedModel->WaitForLoaded(100); - return BoundingBox::MakeScaled(_box, 1.0f / BoundsScale); + BoundingBox box = _box; + if (CustomBounds.GetSize().LengthSquared() <= 0.01f) + { + if (!IsDuringPlay()) + { + Matrix world; + GetLocalToWorldMatrix(world); + box = SkinnedModel->GetBox(world); + } + else + box = BoundingBox::MakeScaled(box, 1.0f / BoundsScale); + } + return box; } #endif diff --git a/Source/Engine/Level/Actors/EmptyActor.cpp b/Source/Engine/Level/Actors/EmptyActor.cpp index 477e04d0a..bd2ab788b 100644 --- a/Source/Engine/Level/Actors/EmptyActor.cpp +++ b/Source/Engine/Level/Actors/EmptyActor.cpp @@ -7,16 +7,6 @@ EmptyActor::EmptyActor(const SpawnParams& params) { } -#if USE_EDITOR - -BoundingBox EmptyActor::GetEditorBoundingBox() const -{ - const Vector3 size(50); - return BoundingBox(_transform.Translation - size, _transform.Translation + size); -} - -#endif - void EmptyActor::OnTransformChanged() { // Base diff --git a/Source/Engine/Level/Actors/EmptyActor.h b/Source/Engine/Level/Actors/EmptyActor.h index 6515a70e4..3e3543b4a 100644 --- a/Source/Engine/Level/Actors/EmptyActor.h +++ b/Source/Engine/Level/Actors/EmptyActor.h @@ -11,11 +11,6 @@ API_CLASS(Attributes="ActorContextMenu(\"New/Actor\"), ActorToolbox(\"Other\")") class FLAXENGINE_API EmptyActor : public Actor { DECLARE_SCENE_OBJECT(EmptyActor); -public: - // [Actor] -#if USE_EDITOR - BoundingBox GetEditorBoundingBox() const override; -#endif protected: // [Actor]