Create empty meshes for filling it meshes that have no vertices
This commit is contained in:
parent
2a99dd3308
commit
52d42358b2
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -720,6 +720,19 @@ namespace Bfres.Structs
|
|||||||
|
|
||||||
foreach (STGenericObject obj in csvModel.objects)
|
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;
|
int ForceSkinInfluenceMax = obj.VertexSkinCount;
|
||||||
|
|
||||||
FSHP shape = new FSHP();
|
FSHP shape = new FSHP();
|
||||||
@ -1132,6 +1145,19 @@ namespace Bfres.Structs
|
|||||||
int curShp = 0;
|
int curShp = 0;
|
||||||
foreach (STGenericObject obj in ImportedObjects)
|
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;
|
int ForceSkinInfluenceMax = obj.VertexSkinCount;
|
||||||
|
|
||||||
if (obj.ObjectName == "")
|
if (obj.ObjectName == "")
|
||||||
|
@ -38,16 +38,22 @@ namespace Bfres.Structs
|
|||||||
|
|
||||||
private void CreateEmpty(object sender, EventArgs args)
|
private void CreateEmpty(object sender, EventArgs args)
|
||||||
{
|
{
|
||||||
var fmdl = ((FMDL)Parent);
|
FMDL fmdl = (FMDL)Parent;
|
||||||
List<string> ShapeKeys = fmdl.shapes.Select(i => i.Text).ToList();
|
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)
|
if (fmdl.GetResFileU() != null)
|
||||||
{
|
{
|
||||||
var Shape = new ResU.Shape();
|
var Shape = new ResU.Shape();
|
||||||
Shape.CreateEmptyMesh();
|
Shape.CreateEmptyMesh();
|
||||||
Shape.Name = NewEmptyName;
|
Shape.Name = mesh.Text;
|
||||||
|
|
||||||
var VertexBuffer = new ResU.VertexBuffer();
|
var VertexBuffer = new ResU.VertexBuffer();
|
||||||
VertexBuffer.CreateEmptyVertexBuffer();
|
VertexBuffer.CreateEmptyVertexBuffer();
|
||||||
@ -55,8 +61,7 @@ namespace Bfres.Structs
|
|||||||
fmdl.ModelU.VertexBuffers.Add(VertexBuffer);
|
fmdl.ModelU.VertexBuffers.Add(VertexBuffer);
|
||||||
fmdl.ModelU.Shapes.Add(Shape.Name, Shape);
|
fmdl.ModelU.Shapes.Add(Shape.Name, Shape);
|
||||||
|
|
||||||
FSHP mesh = new FSHP();
|
BfresWiiU.ReadShapesVertices(mesh, Shape, VertexBuffer, fmdl);
|
||||||
BfresWiiU.ReadShapesVertices(mesh, Shape, VertexBuffer, (FMDL)Parent);
|
|
||||||
mesh.MaterialIndex = 0;
|
mesh.MaterialIndex = 0;
|
||||||
|
|
||||||
fmdl.Nodes["FshpFolder"].Nodes.Add(mesh);
|
fmdl.Nodes["FshpFolder"].Nodes.Add(mesh);
|
||||||
@ -66,17 +71,16 @@ namespace Bfres.Structs
|
|||||||
{
|
{
|
||||||
var Shape = new Shape();
|
var Shape = new Shape();
|
||||||
Shape.CreateEmptyMesh();
|
Shape.CreateEmptyMesh();
|
||||||
Shape.Name = NewEmptyName;
|
Shape.Name = mesh.Text;
|
||||||
|
|
||||||
var VertexBuffer = new VertexBuffer();
|
var VertexBuffer = new VertexBuffer();
|
||||||
VertexBuffer.CreateEmptyVertexBuffer();
|
VertexBuffer.CreateEmptyVertexBuffer();
|
||||||
|
|
||||||
fmdl.Model.VertexBuffers.Add(VertexBuffer);
|
fmdl.Model.VertexBuffers.Add(VertexBuffer);
|
||||||
fmdl.Model.Shapes.Add(Shape);
|
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);
|
||||||
BfresSwitch.ReadShapesVertices(mesh, Shape, VertexBuffer, (FMDL)Parent);
|
|
||||||
mesh.MaterialIndex = 0;
|
mesh.MaterialIndex = 0;
|
||||||
|
|
||||||
fmdl.Nodes["FshpFolder"].Nodes.Add(mesh);
|
fmdl.Nodes["FshpFolder"].Nodes.Add(mesh);
|
||||||
|
@ -56,6 +56,18 @@ namespace FirstPlugin.Forms
|
|||||||
|
|
||||||
switch (prm.Type)
|
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.Float:
|
||||||
case ShaderParamType.Float2:
|
case ShaderParamType.Float2:
|
||||||
case ShaderParamType.Float2x2:
|
case ShaderParamType.Float2x2:
|
||||||
@ -241,14 +253,14 @@ namespace FirstPlugin.Forms
|
|||||||
case ShaderParamType.Float2: panel = new vector2SliderPanel(param.ValueFloat, param); break;
|
case ShaderParamType.Float2: panel = new vector2SliderPanel(param.ValueFloat, param); break;
|
||||||
case ShaderParamType.Float3: panel = new vector3SliderPanel(param.Name, 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.Float4: panel = new vector4SliderPanel(param.Name, param.ValueFloat, param); break;
|
||||||
case ShaderParamType.Int: panel = new vector1SliderPanel(param.ValueFloat, param); break;
|
case ShaderParamType.Int: panel = new vector1SliderPanel(param.ValueInt, param); break;
|
||||||
case ShaderParamType.Int2: panel = new vector2SliderPanel(param.ValueFloat, param); break;
|
case ShaderParamType.Int2: panel = new vector2SliderPanel(param.ValueInt, param); break;
|
||||||
case ShaderParamType.Int3: panel = new vector3SliderPanel(param.Name, param.ValueFloat, param); break;
|
case ShaderParamType.Int3: panel = new vector3SliderPanel(param.Name, param.ValueInt, param); break;
|
||||||
case ShaderParamType.Int4: panel = new vector4SliderPanel(param.Name, param.ValueFloat, param); break;
|
case ShaderParamType.Int4: panel = new vector4SliderPanel(param.Name, param.ValueInt, param); break;
|
||||||
case ShaderParamType.UInt: panel = new vector1SliderPanel(param.ValueFloat, param); break;
|
case ShaderParamType.UInt: panel = new vector1SliderPanel(param.ValueUint, param); break;
|
||||||
case ShaderParamType.UInt2: panel = new vector2SliderPanel(param.ValueFloat, param); break;
|
case ShaderParamType.UInt2: panel = new vector2SliderPanel(param.ValueUint, param); break;
|
||||||
case ShaderParamType.UInt3: panel = new vector3SliderPanel(param.Name, param.ValueFloat, param); break;
|
case ShaderParamType.UInt3: panel = new vector3SliderPanel(param.Name, param.ValueUint, param); break;
|
||||||
case ShaderParamType.UInt4: panel = new vector4SliderPanel(param.Name, param.ValueFloat, 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.TexSrt: panel = new TexSrtPanel(param.ValueTexSrt,param); break;
|
||||||
case ShaderParamType.Bool: panel = new booleanPanel(param.ValueBool, param); break;
|
case ShaderParamType.Bool: panel = new booleanPanel(param.ValueBool, param); break;
|
||||||
case ShaderParamType.Bool2: panel = new booleanPanel(param.ValueBool, param); break;
|
case ShaderParamType.Bool2: panel = new booleanPanel(param.ValueBool, param); break;
|
||||||
|
Binary file not shown.
Binary file not shown.
@ -95,7 +95,10 @@ namespace Switch_Toolbox.Library
|
|||||||
for (int ob = 0; ob < scene.MeshCount; ob++)
|
for (int ob = 0; ob < scene.MeshCount; ob++)
|
||||||
{
|
{
|
||||||
geomNode.MeshIndices.Add(ob);
|
geomNode.MeshIndices.Add(ob);
|
||||||
|
|
||||||
|
// if (!scene.Meshes[ob].HasBones)
|
||||||
}
|
}
|
||||||
|
|
||||||
scene.RootNode.Children.Add(geomNode);
|
scene.RootNode.Children.Add(geomNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user