1
0
mirror of synced 2024-09-24 11:38:22 +02:00

Create empty meshes for filling it meshes that have no vertices

This commit is contained in:
KillzXGaming 2019-07-03 12:39:23 -04:00
parent 2a99dd3308
commit 52d42358b2
10 changed files with 63 additions and 18 deletions

Binary file not shown.

View File

@ -720,6 +720,19 @@ namespace Bfres.Structs
foreach (STGenericObject obj in csvModel.objects)
{
if (obj.vertices.Count <= 0)
{
STConsole.WriteLine($"0 Vertices found on mesh {obj.ObjectName}! Will add an empty mesh to prevent issues.", 0);
FSHP emptyShape = new FSHP();
emptyShape.Text = obj.ObjectName;
if (obj.MaterialIndex < materials.Count)
emptyShape.MaterialIndex = obj.MaterialIndex;
FSHPFolder.CreateEmptyMesh(this, emptyShape);
continue;
}
int ForceSkinInfluenceMax = obj.VertexSkinCount;
FSHP shape = new FSHP();
@ -1132,6 +1145,19 @@ namespace Bfres.Structs
int curShp = 0;
foreach (STGenericObject obj in ImportedObjects)
{
if (obj.vertices.Count <= 0)
{
STConsole.WriteLine($"0 Vertices found on mesh {obj.ObjectName}! Will add an empty mesh to prevent issues.", 0);
FSHP emptyShape = new FSHP();
emptyShape.Text = obj.ObjectName;
if (obj.MaterialIndex < materials.Count)
emptyShape.MaterialIndex = obj.MaterialIndex;
FSHPFolder.CreateEmptyMesh(this, emptyShape);
continue;
}
int ForceSkinInfluenceMax = obj.VertexSkinCount;
if (obj.ObjectName == "")

View File

@ -38,16 +38,22 @@ namespace Bfres.Structs
private void CreateEmpty(object sender, EventArgs args)
{
var fmdl = ((FMDL)Parent);
List<string> ShapeKeys = fmdl.shapes.Select(i => i.Text).ToList();
FMDL fmdl = (FMDL)Parent;
FSHP mesh = new FSHP();
mesh.Text = "EmptyShape";
CreateEmptyMesh((FMDL)Parent, mesh);
}
string NewEmptyName = Utils.RenameDuplicateString(ShapeKeys, "EmptyShape");
public static void CreateEmptyMesh(FMDL fmdl, FSHP mesh)
{
List<string> ShapeKeys = fmdl.shapes.Select(i => i.Text).ToList();
mesh.Text = Utils.RenameDuplicateString(ShapeKeys, mesh.Text);
if (fmdl.GetResFileU() != null)
{
var Shape = new ResU.Shape();
Shape.CreateEmptyMesh();
Shape.Name = NewEmptyName;
Shape.Name = mesh.Text;
var VertexBuffer = new ResU.VertexBuffer();
VertexBuffer.CreateEmptyVertexBuffer();
@ -55,8 +61,7 @@ namespace Bfres.Structs
fmdl.ModelU.VertexBuffers.Add(VertexBuffer);
fmdl.ModelU.Shapes.Add(Shape.Name, Shape);
FSHP mesh = new FSHP();
BfresWiiU.ReadShapesVertices(mesh, Shape, VertexBuffer, (FMDL)Parent);
BfresWiiU.ReadShapesVertices(mesh, Shape, VertexBuffer, fmdl);
mesh.MaterialIndex = 0;
fmdl.Nodes["FshpFolder"].Nodes.Add(mesh);
@ -66,17 +71,16 @@ namespace Bfres.Structs
{
var Shape = new Shape();
Shape.CreateEmptyMesh();
Shape.Name = NewEmptyName;
Shape.Name = mesh.Text;
var VertexBuffer = new VertexBuffer();
VertexBuffer.CreateEmptyVertexBuffer();
fmdl.Model.VertexBuffers.Add(VertexBuffer);
fmdl.Model.Shapes.Add(Shape);
fmdl.Model.ShapeDict.Add(NewEmptyName);
fmdl.Model.ShapeDict.Add(mesh.Text);
FSHP mesh = new FSHP();
BfresSwitch.ReadShapesVertices(mesh, Shape, VertexBuffer, (FMDL)Parent);
BfresSwitch.ReadShapesVertices(mesh, Shape, VertexBuffer, fmdl);
mesh.MaterialIndex = 0;
fmdl.Nodes["FshpFolder"].Nodes.Add(mesh);

View File

@ -56,6 +56,18 @@ namespace FirstPlugin.Forms
switch (prm.Type)
{
case ShaderParamType.Int:
case ShaderParamType.Int2:
case ShaderParamType.Int3:
case ShaderParamType.Int4:
DisplayValue = SetValueToString(prm.ValueInt);
break;
case ShaderParamType.UInt:
case ShaderParamType.UInt2:
case ShaderParamType.UInt3:
case ShaderParamType.UInt4:
DisplayValue = SetValueToString(prm.ValueUint);
break;
case ShaderParamType.Float:
case ShaderParamType.Float2:
case ShaderParamType.Float2x2:
@ -241,14 +253,14 @@ namespace FirstPlugin.Forms
case ShaderParamType.Float2: panel = new vector2SliderPanel(param.ValueFloat, param); break;
case ShaderParamType.Float3: panel = new vector3SliderPanel(param.Name, param.ValueFloat, param); break;
case ShaderParamType.Float4: panel = new vector4SliderPanel(param.Name, param.ValueFloat, param); break;
case ShaderParamType.Int: panel = new vector1SliderPanel(param.ValueFloat, param); break;
case ShaderParamType.Int2: panel = new vector2SliderPanel(param.ValueFloat, param); break;
case ShaderParamType.Int3: panel = new vector3SliderPanel(param.Name, param.ValueFloat, param); break;
case ShaderParamType.Int4: panel = new vector4SliderPanel(param.Name, param.ValueFloat, param); break;
case ShaderParamType.UInt: panel = new vector1SliderPanel(param.ValueFloat, param); break;
case ShaderParamType.UInt2: panel = new vector2SliderPanel(param.ValueFloat, param); break;
case ShaderParamType.UInt3: panel = new vector3SliderPanel(param.Name, param.ValueFloat, param); break;
case ShaderParamType.UInt4: panel = new vector4SliderPanel(param.Name, param.ValueFloat, param); break;
case ShaderParamType.Int: panel = new vector1SliderPanel(param.ValueInt, param); break;
case ShaderParamType.Int2: panel = new vector2SliderPanel(param.ValueInt, param); break;
case ShaderParamType.Int3: panel = new vector3SliderPanel(param.Name, param.ValueInt, param); break;
case ShaderParamType.Int4: panel = new vector4SliderPanel(param.Name, param.ValueInt, param); break;
case ShaderParamType.UInt: panel = new vector1SliderPanel(param.ValueUint, param); break;
case ShaderParamType.UInt2: panel = new vector2SliderPanel(param.ValueUint, param); break;
case ShaderParamType.UInt3: panel = new vector3SliderPanel(param.Name, param.ValueUint, param); break;
case ShaderParamType.UInt4: panel = new vector4SliderPanel(param.Name, param.ValueUint, param); break;
case ShaderParamType.TexSrt: panel = new TexSrtPanel(param.ValueTexSrt,param); break;
case ShaderParamType.Bool: panel = new booleanPanel(param.ValueBool, param); break;
case ShaderParamType.Bool2: panel = new booleanPanel(param.ValueBool, param); break;

View File

@ -95,7 +95,10 @@ namespace Switch_Toolbox.Library
for (int ob = 0; ob < scene.MeshCount; ob++)
{
geomNode.MeshIndices.Add(ob);
// if (!scene.Meshes[ob].HasBones)
}
scene.RootNode.Children.Add(geomNode);
}