Merge remote-tracking branch 'origin/master' into 1.8
This commit is contained in:
@@ -396,6 +396,16 @@ namespace FlaxEditor.Windows.Assets
|
||||
/// <inheritdoc />
|
||||
public override void OnUpdate()
|
||||
{
|
||||
// Extract animations playback state from the events tracing
|
||||
var debugActor = _debugPicker.Value as AnimatedModel;
|
||||
if (debugActor == null)
|
||||
debugActor = _preview.PreviewActor;
|
||||
if (debugActor != null)
|
||||
{
|
||||
debugActor.EnableTracing = true;
|
||||
Surface.LastTraceEvents = debugActor.TraceEvents;
|
||||
}
|
||||
|
||||
base.OnUpdate();
|
||||
|
||||
// Update graph execution flow debugging visualization
|
||||
@@ -416,6 +426,8 @@ namespace FlaxEditor.Windows.Assets
|
||||
/// <inheritdoc />
|
||||
public override void OnDestroy()
|
||||
{
|
||||
if (IsDisposing)
|
||||
return;
|
||||
Animations.DebugFlow -= OnDebugFlow;
|
||||
|
||||
_properties = null;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FlaxEditor.Content;
|
||||
using FlaxEditor.GUI.ContextMenu;
|
||||
using FlaxEditor.GUI.Drag;
|
||||
@@ -64,6 +65,7 @@ namespace FlaxEditor.Windows.Assets
|
||||
private PrefabWindow _window;
|
||||
private DragAssets _dragAssets;
|
||||
private DragActorType _dragActorType;
|
||||
private DragScriptItems _dragScriptItems;
|
||||
private DragHandlers _dragHandlers;
|
||||
|
||||
public SceneTreePanel(PrefabWindow window)
|
||||
@@ -84,6 +86,11 @@ namespace FlaxEditor.Windows.Assets
|
||||
return true;
|
||||
}
|
||||
|
||||
private static bool ValidateDragScriptItem(ScriptItem script)
|
||||
{
|
||||
return Editor.Instance.CodeEditing.Actors.Get(script);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override DragDropEffect OnDragEnter(ref Float2 location, DragData data)
|
||||
{
|
||||
@@ -106,6 +113,13 @@ namespace FlaxEditor.Windows.Assets
|
||||
}
|
||||
if (_dragActorType.OnDragEnter(data))
|
||||
return _dragActorType.Effect;
|
||||
if (_dragScriptItems == null)
|
||||
{
|
||||
_dragScriptItems = new DragScriptItems(ValidateDragScriptItem);
|
||||
_dragHandlers.Add(_dragScriptItems);
|
||||
}
|
||||
if (_dragScriptItems.OnDragEnter(data))
|
||||
return _dragScriptItems.Effect;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -162,7 +176,27 @@ namespace FlaxEditor.Windows.Assets
|
||||
}
|
||||
result = DragDropEffect.Move;
|
||||
}
|
||||
|
||||
// Drag script item
|
||||
else if (_dragScriptItems != null && _dragScriptItems.HasValidDrag)
|
||||
{
|
||||
for (int i = 0; i < _dragScriptItems.Objects.Count; i++)
|
||||
{
|
||||
var item = _dragScriptItems.Objects[i];
|
||||
var actorType = Editor.Instance.CodeEditing.Actors.Get(item);
|
||||
if (actorType != ScriptType.Null)
|
||||
{
|
||||
var actor = actorType.CreateInstance() as Actor;
|
||||
if (actor == null)
|
||||
{
|
||||
Editor.LogWarning("Failed to spawn actor of type " + actorType.TypeName);
|
||||
continue;
|
||||
}
|
||||
actor.Name = actorType.Name;
|
||||
_window.Spawn(actor);
|
||||
}
|
||||
}
|
||||
result = DragDropEffect.Move;
|
||||
}
|
||||
_dragHandlers.OnDragDrop(null);
|
||||
}
|
||||
return result;
|
||||
@@ -173,6 +207,7 @@ namespace FlaxEditor.Windows.Assets
|
||||
_window = null;
|
||||
_dragAssets = null;
|
||||
_dragActorType = null;
|
||||
_dragScriptItems = null;
|
||||
_dragHandlers?.Clear();
|
||||
_dragHandlers = null;
|
||||
|
||||
|
||||
@@ -83,14 +83,14 @@ namespace FlaxEditor.Windows.Assets
|
||||
set => Sprite.Name = value;
|
||||
}
|
||||
|
||||
[EditorOrder(1), Limit(-4096, 4096)]
|
||||
[EditorOrder(1)]
|
||||
public Float2 Location
|
||||
{
|
||||
get => Sprite.Location;
|
||||
set => Sprite.Location = value;
|
||||
}
|
||||
|
||||
[EditorOrder(3), Limit(0, 4096)]
|
||||
[EditorOrder(3), Limit(0)]
|
||||
public Float2 Size
|
||||
{
|
||||
get => Sprite.Size;
|
||||
|
||||
@@ -799,7 +799,10 @@ namespace FlaxEditor.Windows
|
||||
if (proxy == null)
|
||||
throw new ArgumentNullException(nameof(proxy));
|
||||
|
||||
// Setup name
|
||||
string name = initialName ?? proxy.NewItemName;
|
||||
if (!proxy.IsFileNameValid(name) || Utilities.Utils.HasInvalidPathChar(name))
|
||||
name = proxy.NewItemName;
|
||||
|
||||
// If the proxy can not be created in the current folder, then navigate to the content folder
|
||||
if (!proxy.CanCreate(CurrentViewFolder))
|
||||
|
||||
@@ -95,6 +95,7 @@ namespace FlaxEditor.Windows
|
||||
Bounds = new Rectangle(nameLabel.X, tmp1, nameLabel.Width, Height - tmp1 - margin),
|
||||
};
|
||||
|
||||
var xOffset = nameLabel.Width;
|
||||
string versionString = string.Empty;
|
||||
if (desc.IsAlpha)
|
||||
versionString = "ALPHA ";
|
||||
@@ -109,7 +110,7 @@ namespace FlaxEditor.Windows
|
||||
AnchorPreset = AnchorPresets.TopRight,
|
||||
Text = versionString,
|
||||
Parent = this,
|
||||
Bounds = new Rectangle(Width - 140 - margin, margin, 140, 14),
|
||||
Bounds = new Rectangle(Width - 140 - margin - xOffset, margin, 140, 14),
|
||||
};
|
||||
|
||||
string url = null;
|
||||
@@ -129,7 +130,7 @@ namespace FlaxEditor.Windows
|
||||
AnchorPreset = AnchorPresets.TopRight,
|
||||
Text = desc.Author,
|
||||
Parent = this,
|
||||
Bounds = new Rectangle(Width - authorWidth - margin, versionLabel.Bottom + margin, authorWidth, 14),
|
||||
Bounds = new Rectangle(Width - authorWidth - margin - xOffset, versionLabel.Bottom + margin, authorWidth, 14),
|
||||
};
|
||||
if (url != null)
|
||||
{
|
||||
@@ -671,11 +672,11 @@ namespace FlaxEditor.Windows
|
||||
Editor.Log($"Using plugin code type name: {pluginCodeName}");
|
||||
|
||||
var oldPluginPath = Path.Combine(extractPath, "ExamplePlugin-master");
|
||||
var newPluginPath = Path.Combine(extractPath, pluginName);
|
||||
var newPluginPath = Path.Combine(extractPath, pluginCodeName);
|
||||
Directory.Move(oldPluginPath, newPluginPath);
|
||||
|
||||
var oldFlaxProjFile = Path.Combine(newPluginPath, "ExamplePlugin.flaxproj");
|
||||
var newFlaxProjFile = Path.Combine(newPluginPath, $"{pluginName}.flaxproj");
|
||||
var newFlaxProjFile = Path.Combine(newPluginPath, $"{pluginCodeName}.flaxproj");
|
||||
File.Move(oldFlaxProjFile, newFlaxProjFile);
|
||||
|
||||
var readme = Path.Combine(newPluginPath, "README.md");
|
||||
@@ -687,7 +688,7 @@ namespace FlaxEditor.Windows
|
||||
|
||||
// Flax plugin project file
|
||||
var flaxPluginProjContents = JsonSerializer.Deserialize<ProjectInfo>(await File.ReadAllTextAsync(newFlaxProjFile));
|
||||
flaxPluginProjContents.Name = pluginName;
|
||||
flaxPluginProjContents.Name = pluginCodeName;
|
||||
if (!string.IsNullOrEmpty(pluginVersion))
|
||||
flaxPluginProjContents.Version = new Version(pluginVersion);
|
||||
if (!string.IsNullOrEmpty(companyName))
|
||||
@@ -751,7 +752,7 @@ namespace FlaxEditor.Windows
|
||||
}
|
||||
Editor.Log($"Plugin project {pluginName} has successfully been created.");
|
||||
|
||||
await AddReferenceToProject(pluginName, pluginName);
|
||||
await AddReferenceToProject(pluginCodeName, pluginCodeName);
|
||||
MessageBox.Show($"{pluginName} has been successfully created. Restart editor for changes to take effect.", "Plugin Project Created", MessageBoxButtons.OK);
|
||||
}
|
||||
|
||||
@@ -775,8 +776,12 @@ namespace FlaxEditor.Windows
|
||||
var pluginModuleScriptPath = Path.Combine(subDir, pluginModuleName + ".Build.cs");
|
||||
if (File.Exists(pluginModuleScriptPath))
|
||||
{
|
||||
gameScriptContents = gameScriptContents.Insert(insertLocation, $"\n options.PublicDependencies.Add(\"{pluginModuleName}\");");
|
||||
modifiedAny = true;
|
||||
var text = await File.ReadAllTextAsync(pluginModuleScriptPath);
|
||||
if (!text.Contains("GameEditorModule", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
gameScriptContents = gameScriptContents.Insert(insertLocation, $"\n options.PublicDependencies.Add(\"{pluginModuleName}\");");
|
||||
modifiedAny = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using FlaxEditor.Gizmo;
|
||||
using FlaxEditor.Content;
|
||||
using FlaxEditor.GUI.Tree;
|
||||
@@ -31,6 +32,7 @@ namespace FlaxEditor.Windows
|
||||
|
||||
private DragAssets _dragAssets;
|
||||
private DragActorType _dragActorType;
|
||||
private DragScriptItems _dragScriptItems;
|
||||
private DragHandlers _dragHandlers;
|
||||
|
||||
/// <summary>
|
||||
@@ -273,6 +275,11 @@ namespace FlaxEditor.Windows
|
||||
return true;
|
||||
}
|
||||
|
||||
private static bool ValidateDragScriptItem(ScriptItem script)
|
||||
{
|
||||
return Editor.Instance.CodeEditing.Actors.Get(script) != ScriptType.Null;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Draw()
|
||||
{
|
||||
@@ -380,6 +387,13 @@ namespace FlaxEditor.Windows
|
||||
}
|
||||
if (_dragActorType.OnDragEnter(data) && result == DragDropEffect.None)
|
||||
return _dragActorType.Effect;
|
||||
if (_dragScriptItems == null)
|
||||
{
|
||||
_dragScriptItems = new DragScriptItems(ValidateDragScriptItem);
|
||||
_dragHandlers.Add(_dragScriptItems);
|
||||
}
|
||||
if (_dragScriptItems.OnDragEnter(data) && result == DragDropEffect.None)
|
||||
return _dragScriptItems.Effect;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -445,6 +459,28 @@ namespace FlaxEditor.Windows
|
||||
}
|
||||
result = DragDropEffect.Move;
|
||||
}
|
||||
// Drag script item
|
||||
else if (_dragScriptItems != null && _dragScriptItems.HasValidDrag)
|
||||
{
|
||||
for (int i = 0; i < _dragScriptItems.Objects.Count; i++)
|
||||
{
|
||||
var item = _dragScriptItems.Objects[i];
|
||||
var actorType = Editor.Instance.CodeEditing.Actors.Get(item);
|
||||
if (actorType != ScriptType.Null)
|
||||
{
|
||||
var actor = actorType.CreateInstance() as Actor;
|
||||
if (actor == null)
|
||||
{
|
||||
Editor.LogWarning("Failed to spawn actor of type " + actorType.TypeName);
|
||||
continue;
|
||||
}
|
||||
actor.Name = actorType.Name;
|
||||
Level.SpawnActor(actor);
|
||||
Editor.Scene.MarkSceneEdited(actor.Scene);
|
||||
}
|
||||
}
|
||||
result = DragDropEffect.Move;
|
||||
}
|
||||
|
||||
_dragHandlers.OnDragDrop(null);
|
||||
}
|
||||
@@ -456,6 +492,7 @@ namespace FlaxEditor.Windows
|
||||
{
|
||||
_dragAssets = null;
|
||||
_dragActorType = null;
|
||||
_dragScriptItems = null;
|
||||
_dragHandlers?.Clear();
|
||||
_dragHandlers = null;
|
||||
_tree = null;
|
||||
|
||||
Reference in New Issue
Block a user