diff --git a/Source/Editor/CustomEditors/Editors/ActorLayerEditor.cs b/Source/Editor/CustomEditors/Editors/ActorLayerEditor.cs index 282e8fdac..c121d258b 100644 --- a/Source/Editor/CustomEditors/Editors/ActorLayerEditor.cs +++ b/Source/Editor/CustomEditors/Editors/ActorLayerEditor.cs @@ -41,8 +41,9 @@ namespace FlaxEditor.CustomEditors.Editors private void OnPopupShown(ComboBox comboBox) { - var addOrEditLayersOption = (ContextMenuButton)comboBox.Popup.Items.FirstOrDefault(x => x is FlaxEditor.GUI.ContextMenu.ContextMenuButton b && b.Text == AddOrEditLayersOption); - addOrEditLayersOption?.Icon = Editor.Instance.Icons.Settings12; + var addOrEditLayersOption = (ContextMenuButton)comboBox.Popup.Items.FirstOrDefault(x => x is ContextMenuButton b && b.Text == AddOrEditLayersOption); + if (addOrEditLayersOption != null) + addOrEditLayersOption.Icon = Editor.Instance.Icons.Settings12; } private void UpdateLayerItems(int selectedIndex) diff --git a/Source/Editor/Tools/Terrain/TerrainTools.cpp b/Source/Editor/Tools/Terrain/TerrainTools.cpp index 8e83e77cf..9914c0bac 100644 --- a/Source/Editor/Tools/Terrain/TerrainTools.cpp +++ b/Source/Editor/Tools/Terrain/TerrainTools.cpp @@ -21,7 +21,7 @@ bool TerrainTools::TryGetPatchCoordToAdd(Terrain* terrain, const Ray& ray, Int2& { CHECK_RETURN(terrain, true); result = Int2::Zero; - const float patchSize = terrain->GetChunkSize() * TERRAIN_UNITS_PER_VERTEX * Terrain::ChunksCountEdge; + const auto patchSize = terrain->GetChunkSize() * TERRAIN_UNITS_PER_VERTEX * Terrain::ChunksCountEdge * terrain->GetScale(); // Try to pick any of the patch edges for (int32 patchIndex = 0; patchIndex < terrain->GetPatchesCount(); patchIndex++) @@ -36,7 +36,7 @@ bool TerrainTools::TryGetPatchCoordToAdd(Terrain* terrain, const Ray& ray, Int2& #define CHECK_EDGE(dx, dz) \ if (terrain->GetPatch(x + dx, z + dz) == nullptr) \ { \ - if (bounds.MakeOffsetted(Vector3(patchSize * dx, 0, patchSize * dz)).Intersects(ray)) \ + if (bounds.MakeOffsetted(Vector3(patchSize.X * dx, 0, patchSize.Z * dz)).Intersects(ray)) \ { \ result = Int2(x + dx, z + dz); \ return true; \ diff --git a/Source/Editor/Viewport/Previews/AnimatedModelPreview.cs b/Source/Editor/Viewport/Previews/AnimatedModelPreview.cs index a5ff3758b..721b8504d 100644 --- a/Source/Editor/Viewport/Previews/AnimatedModelPreview.cs +++ b/Source/Editor/Viewport/Previews/AnimatedModelPreview.cs @@ -405,7 +405,7 @@ namespace FlaxEditor.Viewport.Previews // Draw bounds if (_showBounds) { - DebugDraw.DrawWireBox(_previewModel.Box, Color.Violet.RGBMultiplied(0.8f), 0, false); + DebugDrawBounds(_previewModel.Box); } } diff --git a/Source/Editor/Viewport/Previews/AssetPreview.cs b/Source/Editor/Viewport/Previews/AssetPreview.cs index 3583a9ff0..b6610c880 100644 --- a/Source/Editor/Viewport/Previews/AssetPreview.cs +++ b/Source/Editor/Viewport/Previews/AssetPreview.cs @@ -224,6 +224,17 @@ namespace FlaxEditor.Viewport.Previews } } + /// + /// Draws the bounds of object. + /// + /// Object bounding box. + protected void DebugDrawBounds(BoundingBox box) + { + var color = Color.Violet.RGBMultiplied(0.8f); + DebugDraw.DrawWireBox(box, color.AlphaMultiplied(0.3f), 0, false); + DebugDraw.DrawWireBox(box, color, 0, true); + } + /// /// Called when drawing debug shapes with for this viewport. /// diff --git a/Source/Editor/Viewport/Previews/MaterialPreview.cs b/Source/Editor/Viewport/Previews/MaterialPreview.cs index e494df14a..b64a4fdba 100644 --- a/Source/Editor/Viewport/Previews/MaterialPreview.cs +++ b/Source/Editor/Viewport/Previews/MaterialPreview.cs @@ -148,6 +148,7 @@ namespace FlaxEditor.Viewport.Previews // Setup preview scene _previewModel = new StaticModel(); SelectedModelIndex = 0; + Task.ViewFlags &= ~ViewFlags.EyeAdaptation; // Link actors for rendering Task.AddCustomActor(_previewModel); diff --git a/Source/Editor/Viewport/Previews/ModelPreview.cs b/Source/Editor/Viewport/Previews/ModelPreview.cs index d8aad8c59..b6306b905 100644 --- a/Source/Editor/Viewport/Previews/ModelPreview.cs +++ b/Source/Editor/Viewport/Previews/ModelPreview.cs @@ -302,7 +302,7 @@ namespace FlaxEditor.Viewport.Previews // Draw bounds if (_showBounds) { - DebugDraw.DrawWireBox(_previewModel.Box, Color.Violet.RGBMultiplied(0.8f), 0, false); + DebugDrawBounds(_previewModel.Box); } // Draw normals diff --git a/Source/Editor/Windows/ContentWindow.cs b/Source/Editor/Windows/ContentWindow.cs index 11a602596..1ee602aa1 100644 --- a/Source/Editor/Windows/ContentWindow.cs +++ b/Source/Editor/Windows/ContentWindow.cs @@ -928,15 +928,20 @@ namespace FlaxEditor.Windows /// Whether a cutting action is occuring. public void Paste(string[] files, bool isCutting) { + var folder = CurrentViewFolder; + + // Copy or move assets var importFiles = new List(); + var pastedFiles = new List(); foreach (var sourcePath in files) { var item = Editor.ContentDatabase.Find(sourcePath); if (item != null) { - var newPath = StringUtils.NormalizePath(Path.Combine(CurrentViewFolder.Path, item.FileName)); + var newPath = StringUtils.NormalizePath(Path.Combine(folder.Path, item.FileName)); if (sourcePath.Equals(newPath)) newPath = GetClonedAssetPath(item); + pastedFiles.Add(newPath); if (isCutting) Editor.ContentDatabase.Move(item, newPath); else @@ -945,7 +950,25 @@ namespace FlaxEditor.Windows else importFiles.Add(sourcePath); } - Editor.ContentImporting.Import(importFiles, CurrentViewFolder); + + // Import any new files + Editor.ContentImporting.Import(importFiles, folder); + + // Auto-select pasted files + if (pastedFiles.Count != 0 && importFiles.Count == 0) + { + Editor.ContentDatabase.RefreshFolder(folder, false); + bool additive = false; + foreach (var pastedFile in pastedFiles) + { + var pastedItem = folder.FindChild(pastedFile); + if (pastedItem != null) + { + Select(pastedItem, true, additive); + additive = true; // Clear selection on first item + } + } + } } /// diff --git a/Source/Engine/Engine/NativeInterop.Unmanaged.cs b/Source/Engine/Engine/NativeInterop.Unmanaged.cs index 33e102089..cb8688dcf 100644 --- a/Source/Engine/Engine/NativeInterop.Unmanaged.cs +++ b/Source/Engine/Engine/NativeInterop.Unmanaged.cs @@ -1007,6 +1007,9 @@ namespace FlaxEngine.Interop scriptingAssemblyLoadContext = new AssemblyLoadContext("Flax", isCollectible: true); scriptingAssemblyLoadContext.Resolving += OnScriptingAssemblyLoadContextResolving; + + // Load Microsoft.CSharp assembly into collectible ALC for dynamic binder support + scriptingAssemblyLoadContext.LoadFromAssemblyPath(typeof(Microsoft.CSharp.RuntimeBinder.Binder).Assembly.Location); #else scriptingAssemblyLoadContext = new AssemblyLoadContext("Flax", isCollectible: false); #endif diff --git a/Source/Engine/Graphics/Enums.h b/Source/Engine/Graphics/Enums.h index 1ff21b411..e875de4b2 100644 --- a/Source/Engine/Graphics/Enums.h +++ b/Source/Engine/Graphics/Enums.h @@ -1195,7 +1195,7 @@ API_ENUM(Attributes="Flags") enum class ViewFlags : uint64 /// /// Default flags for materials/models previews generating. /// - DefaultAssetPreview = Reflections | Decals | DirectionalLights | PointLights | SpotLights | SkyLights | SpecularLight | AntiAliasing | Bloom | ToneMapping | EyeAdaptation | CameraArtifacts | LensFlares | ContactShadows | Sky | Particles, + DefaultAssetPreview = Reflections | Decals | DirectionalLights | PointLights | SpotLights | SkyLights | SpecularLight | AntiAliasing | Bloom | ToneMapping | CameraArtifacts | LensFlares | ContactShadows | Sky | Particles, /// /// All flags enabled. diff --git a/Source/Engine/Graphics/PostProcessSettings.h b/Source/Engine/Graphics/PostProcessSettings.h index 29807e472..74c019b14 100644 --- a/Source/Engine/Graphics/PostProcessSettings.h +++ b/Source/Engine/Graphics/PostProcessSettings.h @@ -1046,7 +1046,7 @@ API_STRUCT() struct FLAXENGINE_API EyeAdaptationSettings : ISerializable /// The effect rendering mode used for the exposure processing. /// API_FIELD(Attributes="EditorOrder(0), PostProcessSetting((int)EyeAdaptationSettingsOverride.Mode)") - EyeAdaptationMode Mode = EyeAdaptationMode::AutomaticHistogram; + EyeAdaptationMode Mode = EyeAdaptationMode::None; /// /// The speed at which the exposure changes when the scene brightness moves from a dark area to a bright area (brightness goes up). @@ -1676,7 +1676,7 @@ API_STRUCT() struct FLAXENGINE_API MotionBlurSettings : ISerializable /// If checked, the motion blur effect will be rendered. /// API_FIELD(Attributes="EditorOrder(0), PostProcessSetting((int)MotionBlurSettingsOverride.Enabled)") - bool Enabled = true; + bool Enabled = false; /// /// The blur effect strength. A value of 0 disables it, while higher values increase the effect. diff --git a/Source/Engine/Platform/SDL/SDLPlatform.Linux.cpp b/Source/Engine/Platform/SDL/SDLPlatform.Linux.cpp index 3bcd2ea88..51a843157 100644 --- a/Source/Engine/Platform/SDL/SDLPlatform.Linux.cpp +++ b/Source/Engine/Platform/SDL/SDLPlatform.Linux.cpp @@ -301,6 +301,8 @@ namespace WaylandImpl auto dragStartWindow = DragSourceWindow != nullptr ? DragSourceWindow->GetSDLWindow() : draggedWindow; wl_surface* originSurface = static_cast(SDL_GetPointerProperty(SDL_GetWindowProperties(dragStartWindow), SDL_PROP_WINDOW_WAYLAND_SURFACE_POINTER, nullptr)); wl_surface* iconSurface = nullptr; + if (!dragWindow) + wl_data_device_start_drag(WrappedDataDevice, dataSource, originSurface, iconSurface, DragSerial); Platform::AtomicStore(&StartFlag, 1); diff --git a/Source/Engine/Terrain/TerrainPatch.cpp b/Source/Engine/Terrain/TerrainPatch.cpp index f986cf791..d51745e55 100644 --- a/Source/Engine/Terrain/TerrainPatch.cpp +++ b/Source/Engine/Terrain/TerrainPatch.cpp @@ -110,6 +110,8 @@ void TerrainPatch::Init(Terrain* terrain, int16 x, int16 z) TerrainPatch::~TerrainPatch() { + if (HasCollision()) + DestroyCollision(); #if TERRAIN_EDITING SAFE_DELETE(_dataHeightmap); for (int32 i = 0; i < TERRAIN_MAX_SPLATMAPS_COUNT; i++) @@ -117,12 +119,6 @@ TerrainPatch::~TerrainPatch() SAFE_DELETE(_dataSplatmap[i]); } #endif -#if TERRAIN_USE_PHYSICS_DEBUG - SAFE_DELETE_GPU_RESOURCE(_debugLines); -#endif -#if USE_EDITOR - SAFE_DELETE_GPU_RESOURCE(_collisionTrianglesBuffer); -#endif } RawDataAsset* TerrainPatch::GetHeightfield() const diff --git a/Source/Engine/UI/GUI/Control.cs b/Source/Engine/UI/GUI/Control.cs index 8ae3b3616..2c8138984 100644 --- a/Source/Engine/UI/GUI/Control.cs +++ b/Source/Engine/UI/GUI/Control.cs @@ -223,9 +223,9 @@ namespace FlaxEngine.GUI public bool IsScrollable { get; set; } = true; /// - /// Gets or sets a value indicating whether the control can respond to user interaction + /// Gets or sets a value indicating whether the control can respond to user interaction. Disabled control remains visible but is grayed out. /// - [EditorOrder(520), Tooltip("If checked, control will receive input events of the user interaction.")] + [EditorOrder(520), Tooltip("If checked, control will receive input events of the user interaction. Disabled control remains visible but is grayed out.")] public bool Enabled { get => _isEnabled; diff --git a/Source/Tools/Flax.Build/Bindings/BindingsGenerator.Cpp.cs b/Source/Tools/Flax.Build/Bindings/BindingsGenerator.Cpp.cs index 1df84ad56..a7791067c 100644 --- a/Source/Tools/Flax.Build/Bindings/BindingsGenerator.Cpp.cs +++ b/Source/Tools/Flax.Build/Bindings/BindingsGenerator.Cpp.cs @@ -1365,7 +1365,7 @@ namespace Flax.Build.Bindings else if (parameterInfo.Type.IsRef && !parameterInfo.Type.IsConst) { // Non-const lvalue reference parameters needs to be passed via temporary value - if (parameterInfo.Type.Type is "String" or "StringView" or "StringAnsi" or "StringAnsiView" && parameterInfo.Type.GenericArgs == null) + if (!string.IsNullOrWhiteSpace(CppParamsWrappersCache[i])) // Converted values contents.Append(indent).AppendFormat("{2} {0}Temp = {1};", parameterInfo.Name, param, parameterInfo.Type.ToString(false)).AppendLine(); else contents.Append(indent).AppendFormat("{2}& {0}Temp = {1};", parameterInfo.Name, param, parameterInfo.Type.ToString(false)).AppendLine();