@@ -860,6 +860,13 @@ namespace FlaxEditor.Viewport
|
||||
return location;
|
||||
}
|
||||
|
||||
private void Spawn(Actor actor, ref Vector3 hitLocation)
|
||||
{
|
||||
actor.Position = PostProcessSpawnedActorLocation(actor, ref hitLocation);
|
||||
Editor.Instance.SceneEditing.Spawn(actor);
|
||||
Focus();
|
||||
}
|
||||
|
||||
private void Spawn(AssetItem item, SceneGraphNode hit, ref Vector2 location, ref Vector3 hitLocation)
|
||||
{
|
||||
if (item is AssetItem assetItem)
|
||||
@@ -872,8 +879,7 @@ namespace FlaxEditor.Viewport
|
||||
Name = item.ShortName,
|
||||
ParticleSystem = asset
|
||||
};
|
||||
actor.Position = PostProcessSpawnedActorLocation(actor, ref hitLocation);
|
||||
Editor.Instance.SceneEditing.Spawn(actor);
|
||||
Spawn(actor, ref hitLocation);
|
||||
return;
|
||||
}
|
||||
if (assetItem.IsOfType<SceneAnimation>())
|
||||
@@ -884,8 +890,7 @@ namespace FlaxEditor.Viewport
|
||||
Name = item.ShortName,
|
||||
Animation = asset
|
||||
};
|
||||
actor.Position = PostProcessSpawnedActorLocation(actor, ref hitLocation);
|
||||
Editor.Instance.SceneEditing.Spawn(actor);
|
||||
Spawn(actor, ref hitLocation);
|
||||
return;
|
||||
}
|
||||
if (assetItem.IsOfType<MaterialBase>())
|
||||
@@ -921,8 +926,7 @@ namespace FlaxEditor.Viewport
|
||||
Name = item.ShortName,
|
||||
SkinnedModel = model
|
||||
};
|
||||
actor.Position = PostProcessSpawnedActorLocation(actor, ref hitLocation);
|
||||
Editor.Instance.SceneEditing.Spawn(actor);
|
||||
Spawn(actor, ref hitLocation);
|
||||
return;
|
||||
}
|
||||
if (assetItem.IsOfType<Model>())
|
||||
@@ -933,8 +937,7 @@ namespace FlaxEditor.Viewport
|
||||
Name = item.ShortName,
|
||||
Model = model
|
||||
};
|
||||
actor.Position = PostProcessSpawnedActorLocation(actor, ref hitLocation);
|
||||
Editor.Instance.SceneEditing.Spawn(actor);
|
||||
Spawn(actor, ref hitLocation);
|
||||
return;
|
||||
}
|
||||
if (assetItem.IsOfType<AudioClip>())
|
||||
@@ -945,8 +948,7 @@ namespace FlaxEditor.Viewport
|
||||
Name = item.ShortName,
|
||||
Clip = clip
|
||||
};
|
||||
actor.Position = PostProcessSpawnedActorLocation(actor, ref hitLocation);
|
||||
Editor.Instance.SceneEditing.Spawn(actor);
|
||||
Spawn(actor, ref hitLocation);
|
||||
return;
|
||||
}
|
||||
if (assetItem.IsOfType<Prefab>())
|
||||
@@ -954,8 +956,7 @@ namespace FlaxEditor.Viewport
|
||||
var prefab = FlaxEngine.Content.LoadAsync<Prefab>(item.ID);
|
||||
var actor = PrefabManager.SpawnPrefab(prefab, null);
|
||||
actor.Name = item.ShortName;
|
||||
actor.Position = PostProcessSpawnedActorLocation(actor, ref hitLocation);
|
||||
Editor.Instance.SceneEditing.Spawn(actor);
|
||||
Spawn(actor, ref hitLocation);
|
||||
return;
|
||||
}
|
||||
if (assetItem.IsOfType<SceneAsset>())
|
||||
@@ -967,8 +968,7 @@ namespace FlaxEditor.Viewport
|
||||
{
|
||||
var actor = (Actor)visualScriptItem.ScriptType.CreateInstance();
|
||||
actor.Name = item.ShortName;
|
||||
actor.Position = PostProcessSpawnedActorLocation(actor, ref hitLocation);
|
||||
Editor.Instance.SceneEditing.Spawn(actor);
|
||||
Spawn(actor, ref hitLocation);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
#include "Engine/Core/Collections/Array.h"
|
||||
#include "Engine/Engine/Engine.h"
|
||||
#include "Engine/Platform/IGuiData.h"
|
||||
#include "Engine/Input/Input.h"
|
||||
#include "Engine/Input/Mouse.h"
|
||||
#include "Engine/Threading/ThreadPoolTask.h"
|
||||
#include "Engine/Threading/ThreadPool.h"
|
||||
#include "Engine/Scripting/Scripting.h"
|
||||
@@ -630,6 +632,10 @@ DragDropEffect WindowsWindow::DoDragDrop(const StringView& data)
|
||||
dropSource->Release();
|
||||
ReleaseStgMedium(&stgmed);
|
||||
|
||||
// Fix hanging mouse state (Windows doesn't send WM_LBUTTONUP when we end the drag and drop)
|
||||
if (Input::GetMouseButton(MouseButton::Left))
|
||||
Input::Mouse->OnMouseUp(Input::Mouse->GetPosition(), MouseButton::Left, this);
|
||||
|
||||
return SUCCEEDED(result) ? dropEffectFromOleEnum(dwEffect) : DragDropEffect::None;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user