-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Drag+drop file into global content is now tasked. Added FXB support in Glue.
- Loading branch information
Showing
4 changed files
with
85 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
FRBDK/Glue/OfficialPlugins/EffectPlugin/MainEffectPlugin.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using FlatRedBall.Glue.Plugins; | ||
using FlatRedBall.Glue.Plugins.ExportedImplementations; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using OfficialPlugins.EffectPlugin.Managers; | ||
using System.ComponentModel.Composition; | ||
|
||
namespace OfficialPlugins.EffectPlugin | ||
{ | ||
[Export(typeof(PluginBase))] | ||
public class MainEffectPlugin : PluginBase | ||
{ | ||
public override string FriendlyName => "Effect Plugin"; | ||
|
||
public override void StartUp() | ||
{ | ||
this.ReactToLoadedGlux += HandleLoadGlux; | ||
this.ReactToUnloadedGlux += HandleUnloadGlux; | ||
} | ||
|
||
private void HandleLoadGlux() | ||
{ | ||
var project = GlueState.Self.CurrentGlueProject; | ||
var isFna = false; | ||
|
||
if(isFna) | ||
{ | ||
this.AddAssetTypeInfo(AssetTypeInfoManager.FxbEffectAssetTypeInfo); | ||
} | ||
} | ||
|
||
private void HandleUnloadGlux() | ||
{ | ||
this.UnregisterAssetTypeInfos(); | ||
} | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
FRBDK/Glue/OfficialPlugins/EffectPlugin/Managers/AssetTypeInfoManager.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using FlatRedBall.Glue.Elements; | ||
using FlatRedBall.IO; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace OfficialPlugins.EffectPlugin.Managers | ||
{ | ||
public static class AssetTypeInfoManager | ||
{ | ||
static AssetTypeInfo fxbEffectAssetTypeInfo; | ||
public static AssetTypeInfo FxbEffectAssetTypeInfo => | ||
fxbEffectAssetTypeInfo = fxbEffectAssetTypeInfo ?? CreateFxbEffectAssetTypeInfo(); | ||
|
||
private static AssetTypeInfo CreateFxbEffectAssetTypeInfo() | ||
{ | ||
var originalEffect = AvailableAssetTypes.Self.AllAssetTypes.FirstOrDefault(item => | ||
item.Extension == "fx" && | ||
item.QualifiedRuntimeTypeName.QualifiedType == "Microsoft.Xna.Framework.Graphics.Effect"); | ||
|
||
var fbxEffect = FileManager.CloneObject(originalEffect); | ||
|
||
fbxEffect.FriendlyName = "Effect (.fxb)"; | ||
fbxEffect.Extension = "fxb"; | ||
fbxEffect.MustBeAddedToContentPipeline = false; | ||
fbxEffect.CanBeAddedToContentPipeline = false; | ||
fbxEffect.ContentImporter = null; | ||
fbxEffect.ContentProcessor = null; | ||
|
||
return fbxEffect; | ||
} | ||
} | ||
} |