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>
|
||||
public static void CreateMaterialInstance(BinaryAssetItem materialItem)
|
||||
{
|
||||
if (materialItem == null)
|
||||
throw new ArgumentNullException();
|
||||
|
||||
var materialInstanceName = materialItem.ShortName + " Instance";
|
||||
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)
|
||||
|
||||
@@ -146,7 +146,7 @@ namespace FlaxEditor.CustomEditors.Editors
|
||||
_size.IntValue.MinValue = 0;
|
||||
_size.IntValue.MaxValue = ushort.MaxValue;
|
||||
_size.IntValue.Value = size;
|
||||
_size.IntValue.ValueChanged += OnSizeChanged;
|
||||
_size.IntValue.EditEnd += OnSizeChanged;
|
||||
}
|
||||
|
||||
// Elements
|
||||
|
||||
@@ -191,7 +191,7 @@ namespace FlaxEditor.CustomEditors.Editors
|
||||
_size.IntValue.MinValue = 0;
|
||||
_size.IntValue.MaxValue = _notNullItems ? size : ushort.MaxValue;
|
||||
_size.IntValue.Value = size;
|
||||
_size.IntValue.ValueChanged += OnSizeChanged;
|
||||
_size.IntValue.EditEnd += OnSizeChanged;
|
||||
}
|
||||
|
||||
// Elements
|
||||
|
||||
@@ -6,7 +6,7 @@ using FlaxEngine.GUI;
|
||||
namespace FlaxEditor.CustomEditors.Elements
|
||||
{
|
||||
/// <summary>
|
||||
/// The combobx element.
|
||||
/// The combobox element.
|
||||
/// </summary>
|
||||
/// <seealso cref="FlaxEditor.CustomEditors.LayoutElement" />
|
||||
public class ComboBoxElement : LayoutElement
|
||||
|
||||
@@ -188,7 +188,7 @@ namespace FlaxEditor.CustomEditors
|
||||
{
|
||||
for (int i = 0; i < Count; i++)
|
||||
{
|
||||
if (this[i] == referenceSceneObject)
|
||||
if ((SceneObject)this[i] == referenceSceneObject)
|
||||
continue;
|
||||
|
||||
if (this[i] == null || (this[i] is SceneObject valueSceneObject && valueSceneObject && valueSceneObject.PrefabObjectID != referenceSceneObject.PrefabObjectID))
|
||||
|
||||
@@ -174,7 +174,7 @@ namespace FlaxEditor.GUI.Timeline.Tracks
|
||||
continue;
|
||||
|
||||
// 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;
|
||||
|
||||
var name = Utilities.Utils.GetPropertyNameUI(script.GetType().Name);
|
||||
|
||||
@@ -661,17 +661,20 @@ namespace FlaxEditor.GUI.Tree
|
||||
// Draw drag and drop effect
|
||||
if (IsDragOver && _tree.DraggedOverNode == this)
|
||||
{
|
||||
Color dragOverColor = style.BackgroundSelected * 0.6f;
|
||||
Color dragOverColor = style.BackgroundSelected;
|
||||
Rectangle rect;
|
||||
switch (_dragOverMode)
|
||||
{
|
||||
case DragItemPositioning.At:
|
||||
dragOverColor *= 0.6f;
|
||||
rect = textRect;
|
||||
break;
|
||||
case DragItemPositioning.Above:
|
||||
dragOverColor *= 1.2f;
|
||||
rect = new Rectangle(textRect.X, textRect.Top - DefaultDragInsertPositionMargin - DefaultNodeOffsetY - _margin.Top, textRect.Width, DefaultDragInsertPositionMargin * 2.0f);
|
||||
break;
|
||||
case DragItemPositioning.Below:
|
||||
dragOverColor *= 1.2f;
|
||||
rect = new Rectangle(textRect.X, textRect.Bottom + _margin.Bottom - DefaultDragInsertPositionMargin, textRect.Width, DefaultDragInsertPositionMargin * 2.0f);
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -656,7 +656,7 @@ namespace FlaxEditor.Modules
|
||||
var children = folder.Children.ToArray();
|
||||
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);
|
||||
}
|
||||
|
||||
/// <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>
|
||||
/// Show save before scene load/unload action.
|
||||
/// </summary>
|
||||
|
||||
@@ -77,6 +77,8 @@ namespace FlaxEditor.SceneGraph.Actors
|
||||
}
|
||||
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;
|
||||
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);
|
||||
}
|
||||
@@ -95,5 +97,10 @@ namespace FlaxEditor.SceneGraph.Actors
|
||||
{
|
||||
Editor.Instance.Scene.CloseScene(Scene);
|
||||
}
|
||||
|
||||
private void OnUnloadAllButSelectedScene()
|
||||
{
|
||||
Editor.Instance.Scene.CloseAllScenesExcept(Scene);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace FlaxEditor.Surface.Archetypes
|
||||
Description = desc,
|
||||
Flags = NodeFlags.AllGraphs,
|
||||
AlternativeTitles = altTitles,
|
||||
Size = new Float2(140, 40),
|
||||
Size = new Float2(150, 40),
|
||||
DefaultType = new ScriptType(inputType),
|
||||
ConnectionsHints = hints,
|
||||
IndependentBoxes = new[] { 0, 1 },
|
||||
|
||||
@@ -156,14 +156,14 @@ namespace FlaxEditor.Windows.Assets
|
||||
|
||||
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
|
||||
{
|
||||
get => _track.Media.Count > 0 ? _track.TrackMedia.StartFrame : 0;
|
||||
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
|
||||
{
|
||||
get => _track.Media.Count > 0 ? _track.TrackMedia.DurationFrames : 0;
|
||||
|
||||
@@ -379,7 +379,7 @@ public:
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the actor static fags.
|
||||
/// Gets the actor static flags.
|
||||
/// </summary>
|
||||
API_PROPERTY(Attributes="NoAnimate, EditorDisplay(\"General\"), EditorOrder(-80), CustomEditorAlias(\"FlaxEditor.CustomEditors.Editors.ActorStaticFlagsEditor\")")
|
||||
FORCE_INLINE StaticFlags GetStaticFlags() const
|
||||
|
||||
@@ -98,7 +98,7 @@ API_ENUM(Attributes="Flags") enum class StaticFlags
|
||||
Navigation = 1 << 3,
|
||||
|
||||
/// <summary>
|
||||
/// Objects is fully static on the scene.
|
||||
/// Object is fully static in the scene.
|
||||
/// </summary>
|
||||
FullyStatic = Transform | ReflectionProbe | Lightmap | Navigation,
|
||||
|
||||
|
||||
@@ -208,6 +208,42 @@ namespace FlaxEngine
|
||||
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>
|
||||
/// Gets the pointer to the native object. Handles null object reference (returns zero).
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user