Add support for custom drag&drop into level/prefab viewports from custom asset items

This commit is contained in:
Wojtek Figat
2021-05-24 18:34:19 +02:00
parent c78fb7995e
commit 2c7d62bb8e
13 changed files with 262 additions and 362 deletions

View File

@@ -103,14 +103,26 @@ namespace FlaxEditor.Content
/// Implementation of <see cref="BinaryAssetItem"/> for <see cref="Model"/> assets.
/// </summary>
/// <seealso cref="FlaxEditor.Content.BinaryAssetItem" />
public class ModelAssetItem : BinaryAssetItem
public class ModelItem : BinaryAssetItem
{
/// <inheritdoc />
public ModelAssetItem(string path, ref Guid id, string typeName, Type type)
public ModelItem(string path, ref Guid id, string typeName, Type type)
: base(path, ref id, typeName, type, ContentItemSearchFilter.Model)
{
}
/// <inheritdoc />
public override bool OnEditorDrag(object context)
{
return true;
}
/// <inheritdoc />
public override Actor OnEditorDrop(object context)
{
return new StaticModel { Model = FlaxEngine.Content.LoadAsync<Model>(ID) };
}
/// <inheritdoc />
protected override void OnBuildTooltipText(StringBuilder sb)
{
@@ -142,14 +154,26 @@ namespace FlaxEditor.Content
/// Implementation of <see cref="BinaryAssetItem"/> for <see cref="SkinnedModel"/> assets.
/// </summary>
/// <seealso cref="FlaxEditor.Content.BinaryAssetItem" />
public class SkinnedModelAssetItem : BinaryAssetItem
public class SkinnedModeItem : BinaryAssetItem
{
/// <inheritdoc />
public SkinnedModelAssetItem(string path, ref Guid id, string typeName, Type type)
public SkinnedModeItem(string path, ref Guid id, string typeName, Type type)
: base(path, ref id, typeName, type, ContentItemSearchFilter.Model)
{
}
/// <inheritdoc />
public override bool OnEditorDrag(object context)
{
return true;
}
/// <inheritdoc />
public override Actor OnEditorDrop(object context)
{
return new AnimatedModel { SkinnedModel = FlaxEngine.Content.LoadAsync<SkinnedModel>(ID) };
}
/// <inheritdoc />
protected override void OnBuildTooltipText(StringBuilder sb)
{