Merge remote-tracking branch 'origin/master' into 1.9
This commit is contained in:
@@ -80,7 +80,7 @@ namespace FlaxEditor.Content
|
||||
// Translate asset type name
|
||||
var typeName = TypeName;
|
||||
string[] typeNamespaces = typeName.Split('.');
|
||||
if (typeNamespaces.Length != 0 && typeNamespaces.Length != 0)
|
||||
if (typeNamespaces.Length != 0 && typeNamespaces[typeNamespaces.Length - 1].Length != 0)
|
||||
{
|
||||
typeName = Utilities.Utils.GetPropertyNameUI(typeNamespaces[typeNamespaces.Length - 1]);
|
||||
}
|
||||
|
||||
@@ -208,7 +208,7 @@ namespace FlaxEditor.CustomEditors.Editors
|
||||
else
|
||||
{
|
||||
// Draw info
|
||||
Render2D.DrawText(style.FontMedium, Type != null ? $"None ({Utilities.Utils.GetPropertyNameUI(Type.ToString())})" : "-", nameRect, isEnabled ? Color.OrangeRed : Color.DarkOrange, TextAlignment.Near, TextAlignment.Center);
|
||||
Render2D.DrawText(style.FontMedium, Type != null ? $"None ({Utilities.Utils.GetPropertyNameUI(Type.ToString())})" : "-", nameRect, isEnabled ? style.ForegroundGrey : style.ForegroundGrey.AlphaMultiplied(0.75f), TextAlignment.Near, TextAlignment.Center);
|
||||
}
|
||||
|
||||
// Draw picker button
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace FlaxEditor.GUI.Dialogs
|
||||
/// <summary>
|
||||
/// The parent window.
|
||||
/// </summary>
|
||||
protected Window _window;
|
||||
protected volatile Window _window;
|
||||
|
||||
/// <summary>
|
||||
/// The dialog result.
|
||||
|
||||
@@ -89,6 +89,9 @@ namespace FlaxEditor.Surface
|
||||
|
||||
private static NodesCache _nodesCache = new NodesCache(IterateNodesCache);
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool UseContextMenuDescriptionPanel => true;
|
||||
|
||||
/// <summary>
|
||||
/// The state machine editing context menu.
|
||||
/// </summary>
|
||||
|
||||
@@ -156,7 +156,7 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
Title = "Lerp",
|
||||
Description = "Performs a linear interpolation",
|
||||
Flags = NodeFlags.AllGraphs,
|
||||
Size = new Float2(110, 60),
|
||||
Size = new Float2(150, 60),
|
||||
ConnectionsHints = ConnectionsHint.Numeric,
|
||||
IndependentBoxes = new[] { 0, 1 },
|
||||
DependentBoxes = new[] { 3 },
|
||||
|
||||
@@ -25,6 +25,9 @@ namespace FlaxEditor.Surface
|
||||
/// <inheritdoc />
|
||||
public override bool CanLivePreviewValueChanges => false;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool UseContextMenuDescriptionPanel => true;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string GetTypeName(ScriptType type)
|
||||
{
|
||||
|
||||
@@ -24,6 +24,9 @@ namespace FlaxEditor.Surface
|
||||
/// </summary>
|
||||
public FlaxEditor.Surface.Archetypes.Particles.ParticleEmitterNode RootNode => _rootNode;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool UseContextMenuDescriptionPanel => true;
|
||||
|
||||
/// <inheritdoc />
|
||||
public ParticleEmitterSurface(IVisjectSurfaceOwner owner, Action onSave, FlaxEditor.Undo undo)
|
||||
: base(owner, onSave, undo)
|
||||
|
||||
@@ -8,6 +8,7 @@ using System.Reflection;
|
||||
using System.Text;
|
||||
using FlaxEditor.CustomEditors;
|
||||
using FlaxEditor.CustomEditors.Elements;
|
||||
using FlaxEditor.Options;
|
||||
using FlaxEditor.Scripting;
|
||||
using FlaxEditor.Utilities;
|
||||
using FlaxEngine.Utilities;
|
||||
@@ -71,7 +72,12 @@ namespace FlaxEditor.Surface
|
||||
}
|
||||
|
||||
// By name
|
||||
return string.Compare(x.DisplayName, y.DisplayName, StringComparison.InvariantCulture);
|
||||
if (Editor.Instance.Options.Options.General.ScriptMembersOrder == GeneralOptions.MembersOrder.Alphabetical)
|
||||
{
|
||||
return string.Compare(x.DisplayName, y.DisplayName, StringComparison.InvariantCulture);
|
||||
}
|
||||
// Keep same order
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -492,7 +492,7 @@ namespace FlaxEditor.Surface
|
||||
Focus();
|
||||
return true;
|
||||
}
|
||||
if (_rightMouseDown || (_middleMouseDown && _middleMouseDown))
|
||||
if (_rightMouseDown || _middleMouseDown)
|
||||
{
|
||||
// Start navigating
|
||||
StartMouseCapture();
|
||||
|
||||
@@ -197,6 +197,12 @@ namespace FlaxEditor.Tools.Foliage
|
||||
{
|
||||
PaintEnd();
|
||||
}
|
||||
|
||||
// Increase or decrease brush size with scroll
|
||||
if (Input.GetKey(KeyboardKeys.Shift) && !Input.GetMouseButton(MouseButton.Right))
|
||||
{
|
||||
Mode.CurrentBrush.Size += dt * Mode.CurrentBrush.Size * Input.Mouse.ScrollDelta * 5f;
|
||||
}
|
||||
|
||||
// Perform detailed tracing to find cursor location for the foliage placement
|
||||
var mouseRay = Owner.MouseRay;
|
||||
|
||||
@@ -113,6 +113,7 @@ namespace FlaxEditor.Tools.Terrain
|
||||
}
|
||||
|
||||
_createTerrainButton.Clicked += OnCreateNewTerrainClicked;
|
||||
OnSelectionChanged();
|
||||
}
|
||||
|
||||
private void OnSceneLoaded(Scene arg1, Guid arg2)
|
||||
@@ -159,6 +160,7 @@ namespace FlaxEditor.Tools.Terrain
|
||||
}
|
||||
|
||||
_noTerrainPanel.Visible = terrain == null;
|
||||
_modes.Visible = !_noTerrainPanel.Visible;
|
||||
}
|
||||
|
||||
private void InitSculptMode()
|
||||
|
||||
@@ -151,7 +151,7 @@ namespace FlaxEditor.Tools.Terrain
|
||||
}
|
||||
|
||||
// Increase or decrease brush size with scroll
|
||||
if (Input.GetKey(KeyboardKeys.Shift))
|
||||
if (Input.GetKey(KeyboardKeys.Shift) && !Input.GetMouseButton(MouseButton.Right))
|
||||
{
|
||||
Mode.CurrentBrush.Size += dt * Mode.CurrentBrush.Size * Input.Mouse.ScrollDelta * 5f;
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ namespace FlaxEditor.Tools.Terrain
|
||||
}
|
||||
|
||||
// Increase or decrease brush size with scroll
|
||||
if (Input.GetKey(KeyboardKeys.Shift))
|
||||
if (Input.GetKey(KeyboardKeys.Shift) && !Input.GetMouseButton(MouseButton.Right))
|
||||
{
|
||||
Mode.CurrentBrush.Size += dt * Mode.CurrentBrush.Size * Input.Mouse.ScrollDelta * 5f;
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace FlaxEditor.Utilities
|
||||
value = Convert.ToInt32(value);
|
||||
else if (type.Type == typeof(long))
|
||||
value = Convert.ToInt64(value);
|
||||
else if (type.Type == typeof(int))
|
||||
else if (type.Type == typeof(ushort))
|
||||
value = Convert.ToUInt16(value);
|
||||
else if (type.Type == typeof(uint))
|
||||
value = Convert.ToUInt32(value);
|
||||
|
||||
@@ -1612,7 +1612,7 @@ namespace FlaxEditor.Viewport
|
||||
_input.IsPanning = !isAltDown && mbDown && !rbDown;
|
||||
_input.IsRotating = !isAltDown && !mbDown && rbDown;
|
||||
_input.IsMoving = !isAltDown && mbDown && rbDown;
|
||||
_input.IsZooming = wheelInUse && !_input.IsShiftDown;
|
||||
_input.IsZooming = wheelInUse && !(_input.IsShiftDown || (!ContainsFocus && FlaxEngine.Input.GetKey(KeyboardKeys.Shift)));
|
||||
_input.IsOrbiting = isAltDown && lbDown && !mbDown && !rbDown;
|
||||
|
||||
// Control move speed with RMB+Wheel
|
||||
|
||||
@@ -12,6 +12,7 @@ using FlaxEditor.Viewport.Previews;
|
||||
using FlaxEditor.Windows.Assets;
|
||||
using FlaxEngine;
|
||||
using FlaxEngine.GUI;
|
||||
using Utils = FlaxEditor.Utilities.Utils;
|
||||
|
||||
namespace FlaxEditor.Viewport
|
||||
{
|
||||
@@ -62,6 +63,7 @@ namespace FlaxEditor.Viewport
|
||||
private UpdateDelegate _update;
|
||||
|
||||
private readonly ViewportDebugDrawData _debugDrawData = new ViewportDebugDrawData(32);
|
||||
private readonly List<Actor> _debugDrawActors = new List<Actor>();
|
||||
private PrefabSpritesRenderer _spritesRenderer;
|
||||
private IntPtr _tempDebugDrawContext;
|
||||
|
||||
@@ -623,14 +625,44 @@ namespace FlaxEditor.Viewport
|
||||
DebugDraw.DrawActors(new IntPtr(actors), _debugDrawData.ActorsCount, false);
|
||||
}
|
||||
}
|
||||
|
||||
// Debug draw all actors in prefab
|
||||
|
||||
// Debug draw all actors in prefab and collect actors
|
||||
var viewFlags = Task.ViewFlags;
|
||||
var collectActors = (viewFlags & ViewFlags.PhysicsDebug) != 0 || (viewFlags & ViewFlags.LightsDebug) != 0;
|
||||
_debugDrawActors.Clear();
|
||||
foreach (var child in SceneGraphRoot.ChildNodes)
|
||||
{
|
||||
if (child is not ActorNode actorNode || !actorNode.Actor)
|
||||
continue;
|
||||
DebugDraw.DrawActorsTree(actorNode.Actor);
|
||||
var actor = actorNode.Actor;
|
||||
if (collectActors)
|
||||
Utils.GetActorsTree(_debugDrawActors, actor);
|
||||
DebugDraw.DrawActorsTree(actor);
|
||||
}
|
||||
|
||||
// Draw physics debug
|
||||
if ((viewFlags & ViewFlags.PhysicsDebug) != 0)
|
||||
{
|
||||
foreach (var actor in _debugDrawActors)
|
||||
{
|
||||
if (actor is Collider c && c.IsActiveInHierarchy)
|
||||
{
|
||||
DebugDraw.DrawColliderDebugPhysics(c, renderContext.View);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Draw lights debug
|
||||
if ((viewFlags & ViewFlags.LightsDebug) != 0)
|
||||
{
|
||||
foreach (var actor in _debugDrawActors)
|
||||
{
|
||||
if (actor is Light l && l.IsActiveInHierarchy)
|
||||
DebugDraw.DrawLightDebug(l, renderContext.View);
|
||||
}
|
||||
}
|
||||
|
||||
_debugDrawActors.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Xml;
|
||||
using FlaxEditor.CustomEditors;
|
||||
using FlaxEditor.SceneGraph;
|
||||
using FlaxEditor.Viewport;
|
||||
using FlaxEngine;
|
||||
using FlaxEngine.GUI;
|
||||
|
||||
namespace FlaxEditor.Windows
|
||||
@@ -19,6 +21,8 @@ namespace FlaxEditor.Windows
|
||||
{
|
||||
private IEnumerable<object> undoRecordObjects;
|
||||
|
||||
private readonly Dictionary<Guid, float> _actorScrollValues = new Dictionary<Guid, float>();
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool UseLayoutData => true;
|
||||
|
||||
@@ -57,9 +61,42 @@ namespace FlaxEditor.Windows
|
||||
Presenter.GetUndoObjects += GetUndoObjects;
|
||||
Presenter.Features |= FeatureFlags.CacheExpandedGroups;
|
||||
|
||||
VScrollBar.ValueChanged += OnScrollValueChanged;
|
||||
Editor.SceneEditing.SelectionChanged += OnSelectionChanged;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void OnSceneLoaded(Scene scene, Guid sceneId)
|
||||
{
|
||||
base.OnSceneLoaded(scene, sceneId);
|
||||
|
||||
// Clear scroll values if new scene is loaded non additively
|
||||
if (Level.ScenesCount > 1)
|
||||
return;
|
||||
_actorScrollValues.Clear();
|
||||
}
|
||||
|
||||
private void OnScrollValueChanged()
|
||||
{
|
||||
if (Editor.SceneEditing.SelectionCount > 1)
|
||||
return;
|
||||
|
||||
// Clear first 10 scroll values to keep the memory down. Dont need to cache very single value in a scene. We could expose this as a editor setting in the future.
|
||||
if (_actorScrollValues.Count >= 20)
|
||||
{
|
||||
int i = 0;
|
||||
foreach (var e in _actorScrollValues)
|
||||
{
|
||||
if (i >= 10)
|
||||
break;
|
||||
_actorScrollValues.Remove(e.Key);
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
|
||||
_actorScrollValues[Editor.SceneEditing.Selection[0].ID] = VScrollBar.TargetValue;
|
||||
}
|
||||
|
||||
private IEnumerable<object> GetUndoObjects(CustomEditorPresenter customEditorPresenter)
|
||||
{
|
||||
return undoRecordObjects;
|
||||
@@ -75,6 +112,10 @@ namespace FlaxEditor.Windows
|
||||
undoRecordObjects = Editor.SceneEditing.Selection.ConvertAll(x => x.UndoRecordObject).Distinct();
|
||||
var objects = Editor.SceneEditing.Selection.ConvertAll(x => x.EditableObject).Distinct();
|
||||
Presenter.Select(objects);
|
||||
|
||||
// Set scroll value of window if it exists
|
||||
if (Editor.SceneEditing.SelectionCount == 1)
|
||||
VScrollBar.TargetValue = _actorScrollValues.GetValueOrDefault(Editor.SceneEditing.Selection[0].ID, 0);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
Reference in New Issue
Block a user