Refactor Editor.CreateAsset to use named tags for better extensibility with custom assets in plugins
This commit is contained in:
@@ -81,7 +81,7 @@ namespace FlaxEditor.Content.Create
|
||||
switch (_options.Template)
|
||||
{
|
||||
case Templates.Empty:
|
||||
return Editor.CreateAsset(Editor.NewAssetType.ParticleEmitter, ResultUrl);
|
||||
return Editor.CreateAsset("ParticleEmitter", ResultUrl);
|
||||
case Templates.ConstantBurst:
|
||||
templateName = "Constant Burst";
|
||||
break;
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace FlaxEditor.Content
|
||||
/// <inheritdoc />
|
||||
public override void Create(string outputPath, object arg)
|
||||
{
|
||||
if (Editor.CreateAsset(Editor.NewAssetType.AnimationGraphFunction, outputPath))
|
||||
if (Editor.CreateAsset("AnimationGraphFunction", outputPath))
|
||||
throw new Exception("Failed to create new asset.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace FlaxEditor.Content
|
||||
/// <inheritdoc />
|
||||
public override void Create(string outputPath, object arg)
|
||||
{
|
||||
if (Editor.CreateAsset(Editor.NewAssetType.AnimationGraph, outputPath))
|
||||
if (Editor.CreateAsset("AnimationGraph", outputPath))
|
||||
throw new Exception("Failed to create new asset.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace FlaxEditor.Content
|
||||
/// <inheritdoc />
|
||||
public override void Create(string outputPath, object arg)
|
||||
{
|
||||
if (Editor.CreateAsset(Editor.NewAssetType.Animation, outputPath))
|
||||
if (Editor.CreateAsset("Animation", outputPath))
|
||||
throw new Exception("Failed to create new asset.");
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace FlaxEditor.Content
|
||||
/// <inheritdoc />
|
||||
public override void Create(string outputPath, object arg)
|
||||
{
|
||||
if (Editor.CreateAsset(Editor.NewAssetType.BehaviorTree, outputPath))
|
||||
if (Editor.CreateAsset("BehaviorTree", outputPath))
|
||||
throw new Exception("Failed to create new asset.");
|
||||
}
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace FlaxEditor.Content
|
||||
/// <inheritdoc />
|
||||
public override void Create(string outputPath, object arg)
|
||||
{
|
||||
if (Editor.CreateAsset(Editor.NewAssetType.CollisionData, outputPath))
|
||||
if (Editor.CreateAsset("CollisionData", outputPath))
|
||||
throw new Exception("Failed to create new asset.");
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace FlaxEditor.Content
|
||||
/// <inheritdoc />
|
||||
public override void Create(string outputPath, object arg)
|
||||
{
|
||||
if (Editor.CreateAsset(Editor.NewAssetType.MaterialFunction, outputPath))
|
||||
if (Editor.CreateAsset("MaterialFunction", outputPath))
|
||||
throw new Exception("Failed to create new asset.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace FlaxEditor.Content
|
||||
/// <inheritdoc />
|
||||
public override void Create(string outputPath, object arg)
|
||||
{
|
||||
if (Editor.CreateAsset(Editor.NewAssetType.MaterialInstance, outputPath))
|
||||
if (Editor.CreateAsset("MaterialInstance", outputPath))
|
||||
throw new Exception("Failed to create new asset.");
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace FlaxEditor.Content
|
||||
/// <inheritdoc />
|
||||
public override void Create(string outputPath, object arg)
|
||||
{
|
||||
if (Editor.CreateAsset(Editor.NewAssetType.Material, outputPath))
|
||||
if (Editor.CreateAsset("Material", outputPath))
|
||||
throw new Exception("Failed to create new asset.");
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace FlaxEditor.Content
|
||||
/// <inheritdoc />
|
||||
public override void Create(string outputPath, object arg)
|
||||
{
|
||||
if (Editor.CreateAsset(Editor.NewAssetType.ParticleEmitterFunction, outputPath))
|
||||
if (Editor.CreateAsset("ParticleEmitterFunction", outputPath))
|
||||
throw new Exception("Failed to create new asset.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace FlaxEditor.Content
|
||||
/// <inheritdoc />
|
||||
public override void Create(string outputPath, object arg)
|
||||
{
|
||||
if (Editor.CreateAsset(Editor.NewAssetType.ParticleSystem, outputPath))
|
||||
if (Editor.CreateAsset("ParticleSystem", outputPath))
|
||||
throw new Exception("Failed to create new asset.");
|
||||
}
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace FlaxEditor.Content
|
||||
/// <inheritdoc />
|
||||
public override void Create(string outputPath, object arg)
|
||||
{
|
||||
if (Editor.CreateAsset(Editor.NewAssetType.SceneAnimation, outputPath))
|
||||
if (Editor.CreateAsset("SceneAnimation", outputPath))
|
||||
throw new Exception("Failed to create new asset.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace FlaxEditor.Content
|
||||
/// <inheritdoc />
|
||||
public override void Create(string outputPath, object arg)
|
||||
{
|
||||
if (Editor.CreateAsset(Editor.NewAssetType.SkeletonMask, outputPath))
|
||||
if (Editor.CreateAsset("SkeletonMask", outputPath))
|
||||
throw new Exception("Failed to create new asset.");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user