Add bcres exporting
This commit is contained in:
parent
7c7f714085
commit
bb575251b9
@ -45,6 +45,13 @@ namespace FirstPlugin
|
|||||||
public BCRES_Render RenderedBcres;
|
public BCRES_Render RenderedBcres;
|
||||||
public DrawableContainer DrawableContainer = new DrawableContainer();
|
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)
|
public void Load(System.IO.Stream stream)
|
||||||
{
|
{
|
||||||
Text = FileName;
|
Text = FileName;
|
||||||
@ -93,7 +100,9 @@ namespace FirstPlugin
|
|||||||
RenderedBcres.Models.Add(CMDLWrapper);
|
RenderedBcres.Models.Add(CMDLWrapper);
|
||||||
break;
|
break;
|
||||||
case BCRESGroupType.Textures:
|
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);
|
PluginRuntime.bcresTexContainers.Add(Folder);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -171,6 +180,9 @@ namespace FirstPlugin
|
|||||||
public void Unload()
|
public void Unload()
|
||||||
{
|
{
|
||||||
ObjectEditor.RemoveContainer(DrawableContainer);
|
ObjectEditor.RemoveContainer(DrawableContainer);
|
||||||
|
foreach (var tex in Textures)
|
||||||
|
tex?.DisposeRenderable();
|
||||||
|
Textures.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Save(System.IO.Stream stream)
|
public void Save(System.IO.Stream stream)
|
||||||
|
@ -7,6 +7,7 @@ using System.Threading.Tasks;
|
|||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using Toolbox.Library;
|
using Toolbox.Library;
|
||||||
using BcresLibrary;
|
using BcresLibrary;
|
||||||
|
using Toolbox.Library.Forms;
|
||||||
|
|
||||||
namespace FirstPlugin
|
namespace FirstPlugin
|
||||||
{
|
{
|
||||||
@ -26,6 +27,19 @@ namespace FirstPlugin
|
|||||||
SelectedImageKey = "Model";
|
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()
|
public CMDLWrapper(Model model, BCRES bcres) : base()
|
||||||
{
|
{
|
||||||
BcresParent = bcres;
|
BcresParent = bcres;
|
||||||
|
Loading…
Reference in New Issue
Block a user