1
0
mirror of synced 2024-12-02 19:17:24 +01:00

Add bcres exporting

This commit is contained in:
KillzXGaming 2019-10-13 16:25:36 -04:00
parent 7c7f714085
commit bb575251b9
2 changed files with 27 additions and 1 deletions

View File

@ -45,6 +45,13 @@ namespace FirstPlugin
public BCRES_Render RenderedBcres;
public DrawableContainer DrawableContainer = new DrawableContainer();
private List<STGenericTexture> Textures = new List<STGenericTexture>();
public List<STGenericTexture> GetTextures()
{
return Textures;
}
public void Load(System.IO.Stream stream)
{
Text = FileName;
@ -93,7 +100,9 @@ namespace FirstPlugin
RenderedBcres.Models.Add(CMDLWrapper);
break;
case BCRESGroupType.Textures:
Folder.AddNode(new TXOBWrapper((Texture)section, this));
var wrapper = new TXOBWrapper((Texture)section, this);
Folder.AddNode(wrapper);
Textures.Add(wrapper);
PluginRuntime.bcresTexContainers.Add(Folder);
break;
}
@ -171,6 +180,9 @@ namespace FirstPlugin
public void Unload()
{
ObjectEditor.RemoveContainer(DrawableContainer);
foreach (var tex in Textures)
tex?.DisposeRenderable();
Textures.Clear();
}
public void Save(System.IO.Stream stream)

View File

@ -7,6 +7,7 @@ using System.Threading.Tasks;
using System.Windows.Forms;
using Toolbox.Library;
using BcresLibrary;
using Toolbox.Library.Forms;
namespace FirstPlugin
{
@ -26,6 +27,19 @@ namespace FirstPlugin
SelectedImageKey = "Model";
}
public override void Export(string FileName)
{
AssimpSaver assimp = new AssimpSaver();
ExportModelSettings settings = new ExportModelSettings();
var model = new STGenericModel();
model.Materials = Materials;
model.Objects = Shapes;
assimp.SaveFromModel(model, FileName, BcresParent.GetTextures(), Skeleton.Renderable);
}
public CMDLWrapper(Model model, BCRES bcres) : base()
{
BcresParent = bcres;