1
0
mirror of synced 2024-12-04 11:58:03 +01:00
Switch-Toolbox/File_Format_Library/GUI/GFBMDL/GFLXMeshEditor.cs
KillzXGaming e4722ed1af Alot of additions.
General
- Always allow multiple instances of the tool by default. (UseSingleInstance in config.XML)
- Yaz0 now uses a new library using c code. This improves compression times and is comparable to wzst's yaz0 compressor. Thanks to AboodXD for helping port the code.
- Add flat buffer templates for gfbmdl and gfbanm.
- Redid UV editor. Now using new 2D engine with some improvements. Should work better with mutliple file formats than just bfres.
- Auto compress bfres with .sbfres extension.

BFLYT:
-Add animation reference list to panes if they have any animations.
- Note the animation editor in it is not functional yet.

GFBMDL
- Progress on model importing. Currently crashes on many tests so saving is currently disabled till i figure out why.
- Add new texture map display with UV coordinates shown. Displays how transforms are handled.
- Add option to export materials and models entirely as .json files.

DAE
- improve bone/joint check.
2019-12-07 20:16:13 -05:00

77 lines
2.2 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace FirstPlugin.Forms
{
public partial class GFLXMeshEditor : UserControl
{
private bool Loaded = false;
private GFLXMesh ActiveMesh;
public GFLXMeshEditor()
{
InitializeComponent();
stDropDownPanel1.ResetColors();
}
public void LoadMesh(GFLXMesh mesh)
{
polyGroupCB.Items.Clear();
materialCB.Items.Clear();
ActiveMesh = mesh;
Loaded = false;
var materials = mesh.ParentModel.GenericMaterials;
for (int i = 0; i < materials.Count; i++)
materialCB.Items.Add(materials[i].Text);
for (int i = 0; i < mesh.PolygonGroups.Count; i++) {
polyGroupCB.Items.Add($"{i}");
}
polyGroupCB.SelectedIndex = 0;
Loaded = true;
}
private void polyGroupCB_SelectedIndexChanged(object sender, EventArgs e)
{
int index = polyGroupCB.SelectedIndex;
if (index >= 0)
{
var poly = ActiveMesh.PolygonGroups[index];
var mat = ActiveMesh.ParentModel.GenericMaterials[poly.MaterialIndex];
materialCB.SelectedItem = mat.Text;
}
}
private void materialCB_SelectedIndexChanged(object sender, EventArgs e) {
if (!Loaded) return;
int index = polyGroupCB.SelectedIndex;
if (index >= 0)
{
var poly = ActiveMesh.PolygonGroups[index];
var materials = ActiveMesh.ParentModel.GenericMaterials;
var mappedMat = materials.First(x => x.Text == materialCB.GetSelectedText());
if (mappedMat != null) {
var matIndex = materials.IndexOf(mappedMat);
poly.MaterialIndex = matIndex;
ActiveMesh.MeshData.Polygons[index].MaterialIndex = (uint)matIndex;
Toolbox.Library.LibraryGUI.UpdateViewport();
}
}
}
}
}