From c22eae0e2dac9d023532174f7144acff49cb7abc Mon Sep 17 00:00:00 2001 From: Ruan Lucas <79365912+RuanLucasGD@users.noreply.github.com> Date: Sat, 3 Jun 2023 22:18:18 -0400 Subject: [PATCH 1/4] fix crash when import model with option to generate lod and lods amount = 1 --- Source/Engine/Tools/ModelTool/ModelTool.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Engine/Tools/ModelTool/ModelTool.cpp b/Source/Engine/Tools/ModelTool/ModelTool.cpp index 103d2187a..2db64c1f7 100644 --- a/Source/Engine/Tools/ModelTool/ModelTool.cpp +++ b/Source/Engine/Tools/ModelTool/ModelTool.cpp @@ -1380,7 +1380,7 @@ bool ModelTool::ImportModel(const String& path, ModelData& meshData, Options& op } // Automatic LOD generation - if (options.GenerateLODs && data.LODs.HasItems() && options.TriangleReduction < 1.0f - ZeroTolerance) + if (options.GenerateLODs && options.LODCount > 1 && data.LODs.HasItems() && options.TriangleReduction < 1.0f - ZeroTolerance) { auto lodStartTime = DateTime::NowUTC(); meshopt_setAllocator(MeshOptAllocate, MeshOptDeallocate); From e000acd6fccbe85571d7c06fcef754cd429a2013 Mon Sep 17 00:00:00 2001 From: Ruan Lucas <79365912+RuanLucasGD@users.noreply.github.com> Date: Thu, 8 Jun 2023 11:42:47 -0400 Subject: [PATCH 2/4] fix for #1002 --- Source/Editor/Gizmo/TransformGizmoBase.cs | 36 +++++++++++++---------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/Source/Editor/Gizmo/TransformGizmoBase.cs b/Source/Editor/Gizmo/TransformGizmoBase.cs index 2a746bcbe..d85ad71b7 100644 --- a/Source/Editor/Gizmo/TransformGizmoBase.cs +++ b/Source/Editor/Gizmo/TransformGizmoBase.cs @@ -81,6 +81,7 @@ namespace FlaxEditor.Gizmo : base(owner) { InitDrawing(); + ModeChanged += ResetTranslationScale; } /// @@ -291,21 +292,21 @@ namespace FlaxEditor.Gizmo _translationScaleSnapDelta += delta; if (!isScaling && snapValue.X < 0.0f) { - // Snap to object bounding box - GetSelectedObjectsBounds(out var b, out _); - if (b.Minimum.X < 0.0f) - snapValue.X = (Real)Math.Abs(b.Minimum.X) + b.Maximum.X; - else - snapValue.X = (Real)b.Minimum.X - b.Maximum.X; - if (b.Minimum.Y < 0.0f) - snapValue.Y = (Real)Math.Abs(b.Minimum.Y) + b.Maximum.Y; - else - snapValue.Y = (Real)b.Minimum.Y - b.Maximum.Y; - if (b.Minimum.Z < 0.0f) - snapValue.Z = (Real)Math.Abs(b.Minimum.Z) + b.Maximum.Z; - else - snapValue.Z = (Real)b.Minimum.Z - b.Maximum.Z; - } + // Snap to object bounding box + GetSelectedObjectsBounds(out var b, out _); + if (b.Minimum.X < 0.0f) + snapValue.X = (Real)Math.Abs(b.Minimum.X) + b.Maximum.X; + else + snapValue.X = (Real)b.Minimum.X - b.Maximum.X; + if (b.Minimum.Y < 0.0f) + snapValue.Y = (Real)Math.Abs(b.Minimum.Y) + b.Maximum.Y; + else + snapValue.Y = (Real)b.Minimum.Y - b.Maximum.Y; + if (b.Minimum.Z < 0.0f) + snapValue.Z = (Real)Math.Abs(b.Minimum.Z) + b.Maximum.Z; + else + snapValue.Z = (Real)b.Minimum.Z - b.Maximum.Z; + } delta = new Vector3( (int)(_translationScaleSnapDelta.X / snapValue.X) * snapValue.X, (int)(_translationScaleSnapDelta.Y / snapValue.Y) * snapValue.Y, @@ -326,6 +327,11 @@ namespace FlaxEditor.Gizmo } } + private void ResetTranslationScale() + { + _translationScaleSnapDelta.Normalize(); + } + private void UpdateRotate(float dt) { float mouseDelta = _activeAxis == Axis.Y ? -Owner.MouseDelta.X : Owner.MouseDelta.X; From 31c3171b726f0cefa086f5418ad9dffd68e1a9bd Mon Sep 17 00:00:00 2001 From: Ruan Lucas <79365912+RuanLucasGD@users.noreply.github.com> Date: Thu, 8 Jun 2023 11:43:35 -0400 Subject: [PATCH 3/4] Revert "fix for #1002" This reverts commit e000acd6fccbe85571d7c06fcef754cd429a2013. --- Source/Editor/Gizmo/TransformGizmoBase.cs | 36 ++++++++++------------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/Source/Editor/Gizmo/TransformGizmoBase.cs b/Source/Editor/Gizmo/TransformGizmoBase.cs index d85ad71b7..2a746bcbe 100644 --- a/Source/Editor/Gizmo/TransformGizmoBase.cs +++ b/Source/Editor/Gizmo/TransformGizmoBase.cs @@ -81,7 +81,6 @@ namespace FlaxEditor.Gizmo : base(owner) { InitDrawing(); - ModeChanged += ResetTranslationScale; } /// @@ -292,21 +291,21 @@ namespace FlaxEditor.Gizmo _translationScaleSnapDelta += delta; if (!isScaling && snapValue.X < 0.0f) { - // Snap to object bounding box - GetSelectedObjectsBounds(out var b, out _); - if (b.Minimum.X < 0.0f) - snapValue.X = (Real)Math.Abs(b.Minimum.X) + b.Maximum.X; - else - snapValue.X = (Real)b.Minimum.X - b.Maximum.X; - if (b.Minimum.Y < 0.0f) - snapValue.Y = (Real)Math.Abs(b.Minimum.Y) + b.Maximum.Y; - else - snapValue.Y = (Real)b.Minimum.Y - b.Maximum.Y; - if (b.Minimum.Z < 0.0f) - snapValue.Z = (Real)Math.Abs(b.Minimum.Z) + b.Maximum.Z; - else - snapValue.Z = (Real)b.Minimum.Z - b.Maximum.Z; - } + // Snap to object bounding box + GetSelectedObjectsBounds(out var b, out _); + if (b.Minimum.X < 0.0f) + snapValue.X = (Real)Math.Abs(b.Minimum.X) + b.Maximum.X; + else + snapValue.X = (Real)b.Minimum.X - b.Maximum.X; + if (b.Minimum.Y < 0.0f) + snapValue.Y = (Real)Math.Abs(b.Minimum.Y) + b.Maximum.Y; + else + snapValue.Y = (Real)b.Minimum.Y - b.Maximum.Y; + if (b.Minimum.Z < 0.0f) + snapValue.Z = (Real)Math.Abs(b.Minimum.Z) + b.Maximum.Z; + else + snapValue.Z = (Real)b.Minimum.Z - b.Maximum.Z; + } delta = new Vector3( (int)(_translationScaleSnapDelta.X / snapValue.X) * snapValue.X, (int)(_translationScaleSnapDelta.Y / snapValue.Y) * snapValue.Y, @@ -327,11 +326,6 @@ namespace FlaxEditor.Gizmo } } - private void ResetTranslationScale() - { - _translationScaleSnapDelta.Normalize(); - } - private void UpdateRotate(float dt) { float mouseDelta = _activeAxis == Axis.Y ? -Owner.MouseDelta.X : Owner.MouseDelta.X; From f28a3572bb60feb94afea237d9a3781f70b42935 Mon Sep 17 00:00:00 2001 From: Ruan Lucas <79365912+RuanLucasGD@users.noreply.github.com> Date: Thu, 8 Jun 2023 11:49:15 -0400 Subject: [PATCH 4/4] ... --- Source/Editor/Gizmo/TransformGizmoBase.cs | 36 ++++++++++------------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/Source/Editor/Gizmo/TransformGizmoBase.cs b/Source/Editor/Gizmo/TransformGizmoBase.cs index d85ad71b7..2a746bcbe 100644 --- a/Source/Editor/Gizmo/TransformGizmoBase.cs +++ b/Source/Editor/Gizmo/TransformGizmoBase.cs @@ -81,7 +81,6 @@ namespace FlaxEditor.Gizmo : base(owner) { InitDrawing(); - ModeChanged += ResetTranslationScale; } /// @@ -292,21 +291,21 @@ namespace FlaxEditor.Gizmo _translationScaleSnapDelta += delta; if (!isScaling && snapValue.X < 0.0f) { - // Snap to object bounding box - GetSelectedObjectsBounds(out var b, out _); - if (b.Minimum.X < 0.0f) - snapValue.X = (Real)Math.Abs(b.Minimum.X) + b.Maximum.X; - else - snapValue.X = (Real)b.Minimum.X - b.Maximum.X; - if (b.Minimum.Y < 0.0f) - snapValue.Y = (Real)Math.Abs(b.Minimum.Y) + b.Maximum.Y; - else - snapValue.Y = (Real)b.Minimum.Y - b.Maximum.Y; - if (b.Minimum.Z < 0.0f) - snapValue.Z = (Real)Math.Abs(b.Minimum.Z) + b.Maximum.Z; - else - snapValue.Z = (Real)b.Minimum.Z - b.Maximum.Z; - } + // Snap to object bounding box + GetSelectedObjectsBounds(out var b, out _); + if (b.Minimum.X < 0.0f) + snapValue.X = (Real)Math.Abs(b.Minimum.X) + b.Maximum.X; + else + snapValue.X = (Real)b.Minimum.X - b.Maximum.X; + if (b.Minimum.Y < 0.0f) + snapValue.Y = (Real)Math.Abs(b.Minimum.Y) + b.Maximum.Y; + else + snapValue.Y = (Real)b.Minimum.Y - b.Maximum.Y; + if (b.Minimum.Z < 0.0f) + snapValue.Z = (Real)Math.Abs(b.Minimum.Z) + b.Maximum.Z; + else + snapValue.Z = (Real)b.Minimum.Z - b.Maximum.Z; + } delta = new Vector3( (int)(_translationScaleSnapDelta.X / snapValue.X) * snapValue.X, (int)(_translationScaleSnapDelta.Y / snapValue.Y) * snapValue.Y, @@ -327,11 +326,6 @@ namespace FlaxEditor.Gizmo } } - private void ResetTranslationScale() - { - _translationScaleSnapDelta.Normalize(); - } - private void UpdateRotate(float dt) { float mouseDelta = _activeAxis == Axis.Y ? -Owner.MouseDelta.X : Owner.MouseDelta.X;