Merge remote-tracking branch 'origin/master' into 1.6
This commit is contained in:
@@ -72,11 +72,9 @@ namespace FlaxEditor.Content
|
|||||||
/// <param name="materialItem">The material item to use as a base material.</param>
|
/// <param name="materialItem">The material item to use as a base material.</param>
|
||||||
public static void CreateMaterialInstance(BinaryAssetItem materialItem)
|
public static void CreateMaterialInstance(BinaryAssetItem materialItem)
|
||||||
{
|
{
|
||||||
if (materialItem == null)
|
var materialInstanceName = materialItem.ShortName + " Instance";
|
||||||
throw new ArgumentNullException();
|
|
||||||
|
|
||||||
var materialInstanceProxy = Editor.Instance.ContentDatabase.GetProxy<MaterialInstance>();
|
var materialInstanceProxy = Editor.Instance.ContentDatabase.GetProxy<MaterialInstance>();
|
||||||
Editor.Instance.Windows.ContentWin.NewItem(materialInstanceProxy, null, item => OnMaterialInstanceCreated(item, materialItem));
|
Editor.Instance.Windows.ContentWin.NewItem(materialInstanceProxy, null, item => OnMaterialInstanceCreated(item, materialItem), materialInstanceName);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void OnMaterialInstanceCreated(ContentItem item, BinaryAssetItem materialItem)
|
private static void OnMaterialInstanceCreated(ContentItem item, BinaryAssetItem materialItem)
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ namespace FlaxEditor.CustomEditors.Editors
|
|||||||
_size.IntValue.MinValue = 0;
|
_size.IntValue.MinValue = 0;
|
||||||
_size.IntValue.MaxValue = ushort.MaxValue;
|
_size.IntValue.MaxValue = ushort.MaxValue;
|
||||||
_size.IntValue.Value = size;
|
_size.IntValue.Value = size;
|
||||||
_size.IntValue.ValueChanged += OnSizeChanged;
|
_size.IntValue.EditEnd += OnSizeChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Elements
|
// Elements
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ namespace FlaxEditor.CustomEditors.Editors
|
|||||||
_size.IntValue.MinValue = 0;
|
_size.IntValue.MinValue = 0;
|
||||||
_size.IntValue.MaxValue = _notNullItems ? size : ushort.MaxValue;
|
_size.IntValue.MaxValue = _notNullItems ? size : ushort.MaxValue;
|
||||||
_size.IntValue.Value = size;
|
_size.IntValue.Value = size;
|
||||||
_size.IntValue.ValueChanged += OnSizeChanged;
|
_size.IntValue.EditEnd += OnSizeChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Elements
|
// Elements
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ using FlaxEngine.GUI;
|
|||||||
namespace FlaxEditor.CustomEditors.Elements
|
namespace FlaxEditor.CustomEditors.Elements
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The combobx element.
|
/// The combobox element.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <seealso cref="FlaxEditor.CustomEditors.LayoutElement" />
|
/// <seealso cref="FlaxEditor.CustomEditors.LayoutElement" />
|
||||||
public class ComboBoxElement : LayoutElement
|
public class ComboBoxElement : LayoutElement
|
||||||
|
|||||||
@@ -188,7 +188,7 @@ namespace FlaxEditor.CustomEditors
|
|||||||
{
|
{
|
||||||
for (int i = 0; i < Count; i++)
|
for (int i = 0; i < Count; i++)
|
||||||
{
|
{
|
||||||
if (this[i] == referenceSceneObject)
|
if ((SceneObject)this[i] == referenceSceneObject)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (this[i] == null || (this[i] is SceneObject valueSceneObject && valueSceneObject && valueSceneObject.PrefabObjectID != referenceSceneObject.PrefabObjectID))
|
if (this[i] == null || (this[i] is SceneObject valueSceneObject && valueSceneObject && valueSceneObject.PrefabObjectID != referenceSceneObject.PrefabObjectID))
|
||||||
|
|||||||
@@ -174,7 +174,7 @@ namespace FlaxEditor.GUI.Timeline.Tracks
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Prevent from adding the same track twice
|
// Prevent from adding the same track twice
|
||||||
if (SubTracks.Any(x => x is IObjectTrack y && y.Object == script))
|
if (SubTracks.Any(x => x is IObjectTrack y && y.Object as SceneObject == script))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var name = Utilities.Utils.GetPropertyNameUI(script.GetType().Name);
|
var name = Utilities.Utils.GetPropertyNameUI(script.GetType().Name);
|
||||||
|
|||||||
@@ -661,17 +661,20 @@ namespace FlaxEditor.GUI.Tree
|
|||||||
// Draw drag and drop effect
|
// Draw drag and drop effect
|
||||||
if (IsDragOver && _tree.DraggedOverNode == this)
|
if (IsDragOver && _tree.DraggedOverNode == this)
|
||||||
{
|
{
|
||||||
Color dragOverColor = style.BackgroundSelected * 0.6f;
|
Color dragOverColor = style.BackgroundSelected;
|
||||||
Rectangle rect;
|
Rectangle rect;
|
||||||
switch (_dragOverMode)
|
switch (_dragOverMode)
|
||||||
{
|
{
|
||||||
case DragItemPositioning.At:
|
case DragItemPositioning.At:
|
||||||
|
dragOverColor *= 0.6f;
|
||||||
rect = textRect;
|
rect = textRect;
|
||||||
break;
|
break;
|
||||||
case DragItemPositioning.Above:
|
case DragItemPositioning.Above:
|
||||||
|
dragOverColor *= 1.2f;
|
||||||
rect = new Rectangle(textRect.X, textRect.Top - DefaultDragInsertPositionMargin - DefaultNodeOffsetY - _margin.Top, textRect.Width, DefaultDragInsertPositionMargin * 2.0f);
|
rect = new Rectangle(textRect.X, textRect.Top - DefaultDragInsertPositionMargin - DefaultNodeOffsetY - _margin.Top, textRect.Width, DefaultDragInsertPositionMargin * 2.0f);
|
||||||
break;
|
break;
|
||||||
case DragItemPositioning.Below:
|
case DragItemPositioning.Below:
|
||||||
|
dragOverColor *= 1.2f;
|
||||||
rect = new Rectangle(textRect.X, textRect.Bottom + _margin.Bottom - DefaultDragInsertPositionMargin, textRect.Width, DefaultDragInsertPositionMargin * 2.0f);
|
rect = new Rectangle(textRect.X, textRect.Bottom + _margin.Bottom - DefaultDragInsertPositionMargin, textRect.Width, DefaultDragInsertPositionMargin * 2.0f);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -656,7 +656,7 @@ namespace FlaxEditor.Modules
|
|||||||
var children = folder.Children.ToArray();
|
var children = folder.Children.ToArray();
|
||||||
for (int i = 0; i < children.Length; i++)
|
for (int i = 0; i < children.Length; i++)
|
||||||
{
|
{
|
||||||
Delete(children[0]);
|
Delete(children[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -315,6 +315,42 @@ namespace FlaxEditor.Modules
|
|||||||
Editor.StateMachine.ChangingScenesState.UnloadScene(Level.Scenes);
|
Editor.StateMachine.ChangingScenesState.UnloadScene(Level.Scenes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Closes all of the scenes except for the specified scene (async).
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="scene">The scene to not close.</param>
|
||||||
|
public void CloseAllScenesExcept(Scene scene)
|
||||||
|
{
|
||||||
|
// Check if cannot change scene now
|
||||||
|
if (!Editor.StateMachine.CurrentState.CanChangeScene)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var scenes = new List<Scene>();
|
||||||
|
foreach (var s in Level.Scenes)
|
||||||
|
{
|
||||||
|
if (s == scene)
|
||||||
|
continue;
|
||||||
|
scenes.Add(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
// In play-mode Editor mocks the level streaming script
|
||||||
|
if (Editor.IsPlayMode)
|
||||||
|
{
|
||||||
|
foreach (var s in scenes)
|
||||||
|
{
|
||||||
|
Level.UnloadSceneAsync(s);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ensure to save all pending changes
|
||||||
|
if (CheckSaveBeforeClose())
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Unload scenes
|
||||||
|
Editor.StateMachine.ChangingScenesState.UnloadScene(scenes);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Show save before scene load/unload action.
|
/// Show save before scene load/unload action.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -77,6 +77,8 @@ namespace FlaxEditor.SceneGraph.Actors
|
|||||||
}
|
}
|
||||||
contextMenu.AddButton("Save scene", OnSave).LinkTooltip("Saves this scene.").Enabled = IsEdited && !Editor.IsPlayMode;
|
contextMenu.AddButton("Save scene", OnSave).LinkTooltip("Saves this scene.").Enabled = IsEdited && !Editor.IsPlayMode;
|
||||||
contextMenu.AddButton("Unload scene", OnUnload).LinkTooltip("Unloads this scene.").Enabled = Editor.Instance.StateMachine.CurrentState.CanChangeScene;
|
contextMenu.AddButton("Unload scene", OnUnload).LinkTooltip("Unloads this scene.").Enabled = Editor.Instance.StateMachine.CurrentState.CanChangeScene;
|
||||||
|
if (Level.ScenesCount > 1)
|
||||||
|
contextMenu.AddButton("Unload all but this scene", OnUnloadAllButSelectedScene).LinkTooltip("Unloads all of the active scenes except for the selected scene.").Enabled = Editor.Instance.StateMachine.CurrentState.CanChangeScene;
|
||||||
|
|
||||||
base.OnContextMenu(contextMenu);
|
base.OnContextMenu(contextMenu);
|
||||||
}
|
}
|
||||||
@@ -95,5 +97,10 @@ namespace FlaxEditor.SceneGraph.Actors
|
|||||||
{
|
{
|
||||||
Editor.Instance.Scene.CloseScene(Scene);
|
Editor.Instance.Scene.CloseScene(Scene);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnUnloadAllButSelectedScene()
|
||||||
|
{
|
||||||
|
Editor.Instance.Scene.CloseAllScenesExcept(Scene);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ namespace FlaxEditor.Surface.Archetypes
|
|||||||
Description = desc,
|
Description = desc,
|
||||||
Flags = NodeFlags.AllGraphs,
|
Flags = NodeFlags.AllGraphs,
|
||||||
AlternativeTitles = altTitles,
|
AlternativeTitles = altTitles,
|
||||||
Size = new Float2(140, 40),
|
Size = new Float2(150, 40),
|
||||||
DefaultType = new ScriptType(inputType),
|
DefaultType = new ScriptType(inputType),
|
||||||
ConnectionsHints = hints,
|
ConnectionsHints = hints,
|
||||||
IndependentBoxes = new[] { 0, 1 },
|
IndependentBoxes = new[] { 0, 1 },
|
||||||
|
|||||||
@@ -156,14 +156,14 @@ namespace FlaxEditor.Windows.Assets
|
|||||||
|
|
||||||
private bool HasEmitter => _track.Asset != null;
|
private bool HasEmitter => _track.Asset != null;
|
||||||
|
|
||||||
[EditorDisplay("Particle Emitter"), VisibleIf("HasEmitter"), EditorOrder(200), Tooltip("The start frame of the media event.")]
|
[EditorDisplay("Particle Emitter"), VisibleIf(nameof(HasEmitter)), EditorOrder(200), Tooltip("The start frame of the media event.")]
|
||||||
public int StartFrame
|
public int StartFrame
|
||||||
{
|
{
|
||||||
get => _track.Media.Count > 0 ? _track.TrackMedia.StartFrame : 0;
|
get => _track.Media.Count > 0 ? _track.TrackMedia.StartFrame : 0;
|
||||||
set => _track.TrackMedia.StartFrame = value;
|
set => _track.TrackMedia.StartFrame = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
[EditorDisplay("Particle Emitter"), Limit(1), VisibleIf("HasEmitter"), EditorOrder(300), Tooltip("The total duration of the media event in the timeline sequence frames amount.")]
|
[EditorDisplay("Particle Emitter"), Limit(1), VisibleIf(nameof(HasEmitter)), EditorOrder(300), Tooltip("The total duration of the media event in the timeline sequence frames amount.")]
|
||||||
public int DurationFrames
|
public int DurationFrames
|
||||||
{
|
{
|
||||||
get => _track.Media.Count > 0 ? _track.TrackMedia.DurationFrames : 0;
|
get => _track.Media.Count > 0 ? _track.TrackMedia.DurationFrames : 0;
|
||||||
|
|||||||
@@ -379,7 +379,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the actor static fags.
|
/// Gets the actor static flags.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
API_PROPERTY(Attributes="NoAnimate, EditorDisplay(\"General\"), EditorOrder(-80), CustomEditorAlias(\"FlaxEditor.CustomEditors.Editors.ActorStaticFlagsEditor\")")
|
API_PROPERTY(Attributes="NoAnimate, EditorDisplay(\"General\"), EditorOrder(-80), CustomEditorAlias(\"FlaxEditor.CustomEditors.Editors.ActorStaticFlagsEditor\")")
|
||||||
FORCE_INLINE StaticFlags GetStaticFlags() const
|
FORCE_INLINE StaticFlags GetStaticFlags() const
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ API_ENUM(Attributes="Flags") enum class StaticFlags
|
|||||||
Navigation = 1 << 3,
|
Navigation = 1 << 3,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Objects is fully static on the scene.
|
/// Object is fully static in the scene.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
FullyStatic = Transform | ReflectionProbe | Lightmap | Navigation,
|
FullyStatic = Transform | ReflectionProbe | Lightmap | Navigation,
|
||||||
|
|
||||||
|
|||||||
@@ -208,6 +208,42 @@ namespace FlaxEngine
|
|||||||
return obj != null && obj.__unmanagedPtr != IntPtr.Zero;
|
return obj != null && obj.__unmanagedPtr != IntPtr.Zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Checks whether the two objects are equal.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="left"></param>
|
||||||
|
/// <param name="right"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public static bool operator ==(Object left, Object right)
|
||||||
|
{
|
||||||
|
IntPtr leftPtr = (object)left != null ? left.__unmanagedPtr : IntPtr.Zero;
|
||||||
|
IntPtr rightPtr = (object)right != null ? right.__unmanagedPtr : IntPtr.Zero;
|
||||||
|
return leftPtr == rightPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Checks whether the two objects are not equal.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="left"></param>
|
||||||
|
/// <param name="right"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
public static bool operator !=(Object left, Object right)
|
||||||
|
{
|
||||||
|
IntPtr leftPtr = (object)left != null ? left.__unmanagedPtr : IntPtr.Zero;
|
||||||
|
IntPtr rightPtr = (object)right != null ? right.__unmanagedPtr : IntPtr.Zero;
|
||||||
|
return leftPtr != rightPtr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public override bool Equals(object obj)
|
||||||
|
{
|
||||||
|
if (obj is FlaxEngine.Object o)
|
||||||
|
return o.__unmanagedPtr == __unmanagedPtr;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the pointer to the native object. Handles null object reference (returns zero).
|
/// Gets the pointer to the native object. Handles null object reference (returns zero).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user