Merge branch 'Tryibion-fix-no-undo-for-drag-spawn'
This commit is contained in:
@@ -319,22 +319,22 @@ namespace FlaxEditor.Windows
|
|||||||
{
|
{
|
||||||
if (assetItem.IsOfType<SceneAsset>())
|
if (assetItem.IsOfType<SceneAsset>())
|
||||||
return true;
|
return true;
|
||||||
return assetItem.OnEditorDrag(this);
|
return assetItem.OnEditorDrag(this) && Level.IsAnySceneLoaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool ValidateDragActorType(ScriptType actorType)
|
private static bool ValidateDragActorType(ScriptType actorType)
|
||||||
{
|
{
|
||||||
return Editor.Instance.CodeEditing.Actors.Get().Contains(actorType);
|
return Editor.Instance.CodeEditing.Actors.Get().Contains(actorType) && Level.IsAnySceneLoaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool ValidateDragControlType(ScriptType controlType)
|
private static bool ValidateDragControlType(ScriptType controlType)
|
||||||
{
|
{
|
||||||
return Editor.Instance.CodeEditing.Controls.Get().Contains(controlType);
|
return Editor.Instance.CodeEditing.Controls.Get().Contains(controlType) && Level.IsAnySceneLoaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool ValidateDragScriptItem(ScriptItem script)
|
private static bool ValidateDragScriptItem(ScriptItem script)
|
||||||
{
|
{
|
||||||
return Editor.Instance.CodeEditing.Actors.Get(script) != ScriptType.Null;
|
return Editor.Instance.CodeEditing.Actors.Get(script) != ScriptType.Null && Level.IsAnySceneLoaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
@@ -490,6 +490,7 @@ namespace FlaxEditor.Windows
|
|||||||
if (result == DragDropEffect.None)
|
if (result == DragDropEffect.None)
|
||||||
{
|
{
|
||||||
_isDropping = true;
|
_isDropping = true;
|
||||||
|
|
||||||
// Drag assets
|
// Drag assets
|
||||||
if (_dragAssets != null && _dragAssets.HasValidDrag)
|
if (_dragAssets != null && _dragAssets.HasValidDrag)
|
||||||
{
|
{
|
||||||
@@ -504,7 +505,7 @@ namespace FlaxEditor.Windows
|
|||||||
}
|
}
|
||||||
var actor = item.OnEditorDrop(this);
|
var actor = item.OnEditorDrop(this);
|
||||||
actor.Name = item.ShortName;
|
actor.Name = item.ShortName;
|
||||||
Level.SpawnActor(actor);
|
Editor.SceneEditing.Spawn(actor);
|
||||||
var graphNode = Editor.Scene.GetActorNode(actor.ID);
|
var graphNode = Editor.Scene.GetActorNode(actor.ID);
|
||||||
if (graphNode != null)
|
if (graphNode != null)
|
||||||
graphNodes.Add(graphNode);
|
graphNodes.Add(graphNode);
|
||||||
@@ -527,7 +528,7 @@ namespace FlaxEditor.Windows
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
actor.Name = item.Name;
|
actor.Name = item.Name;
|
||||||
Level.SpawnActor(actor);
|
Editor.SceneEditing.Spawn(actor);
|
||||||
Editor.Scene.MarkSceneEdited(actor.Scene);
|
Editor.Scene.MarkSceneEdited(actor.Scene);
|
||||||
}
|
}
|
||||||
result = DragDropEffect.Move;
|
result = DragDropEffect.Move;
|
||||||
@@ -549,7 +550,7 @@ namespace FlaxEditor.Windows
|
|||||||
Control = control,
|
Control = control,
|
||||||
Name = item.Name,
|
Name = item.Name,
|
||||||
};
|
};
|
||||||
Level.SpawnActor(uiControl);
|
Editor.SceneEditing.Spawn(uiControl);
|
||||||
Editor.Scene.MarkSceneEdited(uiControl.Scene);
|
Editor.Scene.MarkSceneEdited(uiControl.Scene);
|
||||||
}
|
}
|
||||||
result = DragDropEffect.Move;
|
result = DragDropEffect.Move;
|
||||||
@@ -571,7 +572,7 @@ namespace FlaxEditor.Windows
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
actor.Name = actorType.Name;
|
actor.Name = actorType.Name;
|
||||||
Level.SpawnActor(actor);
|
Editor.SceneEditing.Spawn(actor);
|
||||||
var graphNode = Editor.Scene.GetActorNode(actor.ID);
|
var graphNode = Editor.Scene.GetActorNode(actor.ID);
|
||||||
if (graphNode != null)
|
if (graphNode != null)
|
||||||
graphNodes.Add(graphNode);
|
graphNodes.Add(graphNode);
|
||||||
|
|||||||
Reference in New Issue
Block a user