2019-07-11 21:22:59 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
using Switch_Toolbox.Library;
|
|
|
|
|
using Switch_Toolbox.Library.IO;
|
2019-07-11 23:38:29 +00:00
|
|
|
|
using Switch_Toolbox.Library.Rendering;
|
2019-07-11 21:22:59 +00:00
|
|
|
|
using Switch_Toolbox.Library.Forms;
|
|
|
|
|
using SuperBMDLib.Geometry;
|
|
|
|
|
|
|
|
|
|
namespace FirstPlugin
|
|
|
|
|
{
|
2019-07-11 23:38:29 +00:00
|
|
|
|
public class BMDShapeWrapper : GenericRenderedObject
|
2019-07-11 21:22:59 +00:00
|
|
|
|
{
|
2019-07-11 23:38:29 +00:00
|
|
|
|
SuperBMDLib.Model ParentModel;
|
2019-07-11 21:22:59 +00:00
|
|
|
|
Shape BMDShape;
|
|
|
|
|
|
2019-07-11 23:38:29 +00:00
|
|
|
|
private STGenericMaterial material;
|
|
|
|
|
public BMDShapeWrapper(Shape shape, SuperBMDLib.Model model, int Index)
|
2019-07-11 21:22:59 +00:00
|
|
|
|
{
|
|
|
|
|
BMDShape = shape;
|
2019-07-11 23:38:29 +00:00
|
|
|
|
ParentModel = model;
|
|
|
|
|
material = new STGenericMaterial();
|
|
|
|
|
// material.Text = $"Material {Index}";
|
|
|
|
|
|
|
|
|
|
var mat = model.Materials.m_Materials[Index];
|
|
|
|
|
|
|
|
|
|
int textureUnit = 1;
|
|
|
|
|
if (mat.TextureIndices[0] != -1)
|
|
|
|
|
{
|
|
|
|
|
int texIndex = mat.TextureIndices[0];
|
|
|
|
|
|
|
|
|
|
STGenericMatTexture matTexture = new STGenericMatTexture();
|
|
|
|
|
matTexture.Name = ParentModel.Textures[texIndex].Name;
|
|
|
|
|
matTexture.Type = STGenericMatTexture.TextureType.Diffuse;
|
|
|
|
|
matTexture.textureUnit = textureUnit++;
|
|
|
|
|
matTexture.wrapModeS = 0;
|
|
|
|
|
matTexture.wrapModeT = 0;
|
|
|
|
|
material.TextureMaps.Add(matTexture);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override STGenericMaterial GetMaterial()
|
|
|
|
|
{
|
|
|
|
|
return material;
|
2019-07-11 21:22:59 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void OnClick(TreeView treeView)
|
|
|
|
|
{
|
|
|
|
|
STPropertyGrid editor = (STPropertyGrid)LibraryGUI.GetActiveContent(typeof(STPropertyGrid));
|
|
|
|
|
if (editor == null)
|
|
|
|
|
{
|
|
|
|
|
editor = new STPropertyGrid();
|
|
|
|
|
LibraryGUI.LoadEditor(editor);
|
|
|
|
|
}
|
|
|
|
|
editor.Text = Text;
|
|
|
|
|
editor.Dock = DockStyle.Fill;
|
|
|
|
|
editor.LoadProperty(BMDShape, null);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|