Cleanup and fixes
This commit is contained in:
parent
0fc310380b
commit
758e922183
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -149,7 +149,7 @@ namespace Bfres.Structs
|
||||
}
|
||||
}
|
||||
|
||||
public void NewModel()
|
||||
public FMDL NewModel(bool AddTreeNode = true)
|
||||
{
|
||||
FMDL fmdl = new FMDL();
|
||||
|
||||
@ -205,7 +205,10 @@ namespace Bfres.Structs
|
||||
((BFRES)Parent).AddSkeletonDrawable(fmdl.Skeleton);
|
||||
}
|
||||
|
||||
AddNode(fmdl, "NewModel");
|
||||
if (AddTreeNode)
|
||||
AddNode(fmdl, "NewModel");
|
||||
|
||||
return fmdl;
|
||||
}
|
||||
|
||||
public void NewExternalFile()
|
||||
@ -256,49 +259,10 @@ namespace Bfres.Structs
|
||||
switch (Type)
|
||||
{
|
||||
case BRESGroupType.Models:
|
||||
FMDL fmdl = new FMDL();
|
||||
FMDL fmdl = NewModel(false);
|
||||
fmdl.Text = ResourceName;
|
||||
|
||||
if (IsWiiU)
|
||||
{
|
||||
fmdl.ModelU = new ResU.Model();
|
||||
fmdl.ModelU.Name = ResourceName;
|
||||
fmdl.ModelU.Shapes.Add("", new ResU.Shape());
|
||||
fmdl.ModelU.Materials.Add("", new ResU.Material());
|
||||
fmdl.ModelU.VertexBuffers.Add(new ResU.VertexBuffer());
|
||||
|
||||
var skeleton = new ResU.Skeleton();
|
||||
|
||||
//Create skeleton with empty bone
|
||||
skeleton.Bones.Add("Root", new ResU.Bone() { Name = "Root" });
|
||||
|
||||
fmdl.ModelU.Skeleton = skeleton;
|
||||
|
||||
BfresWiiU.ReadModel(fmdl, fmdl.ModelU);
|
||||
((BFRES)Parent).AddSkeletonDrawable(fmdl.Skeleton);
|
||||
}
|
||||
else
|
||||
{
|
||||
fmdl.Model = new ResNX.Model();
|
||||
fmdl.Model.Name = ResourceName;
|
||||
fmdl.Model.Shapes.Add(new ResNX.Shape());
|
||||
fmdl.Model.VertexBuffers.Add(new ResNX.VertexBuffer());
|
||||
|
||||
//Create skeleton with empty bone
|
||||
var skeleton = new ResNX.Skeleton();
|
||||
skeleton.Bones.Add(new ResNX.Bone() { Name = "Root" });
|
||||
|
||||
fmdl.Model.Skeleton = skeleton;
|
||||
|
||||
BfresSwitch.ReadModel(fmdl, fmdl.Model);
|
||||
((BFRES)Parent).AddSkeletonDrawable(fmdl.Skeleton);
|
||||
}
|
||||
fmdl.Replace(FileName, resFileNX, resFileU);
|
||||
|
||||
Nodes.Add(fmdl);
|
||||
|
||||
|
||||
fmdl.UpdateVertexData();
|
||||
AddNode(fmdl);
|
||||
break;
|
||||
case BRESGroupType.SkeletalAnim:
|
||||
FSKA fska = new FSKA();
|
||||
|
@ -28,6 +28,9 @@ namespace Bfres.Structs
|
||||
|
||||
public ResFile GetResFile()
|
||||
{
|
||||
if (Parent == null || Parent.Parent == null)
|
||||
return null;
|
||||
|
||||
//ResourceFile -> FMDL -> Model Folder -> this
|
||||
return ((BFRES)Parent.Parent).resFile;
|
||||
}
|
||||
@ -1049,7 +1052,8 @@ namespace Bfres.Structs
|
||||
UpdateEditor();
|
||||
}
|
||||
public void UpdateEditor(){
|
||||
((BFRES)Parent.Parent).LoadEditors(this);
|
||||
if (Parent != null)
|
||||
((BFRES)Parent.Parent).LoadEditors(this);
|
||||
}
|
||||
|
||||
private void CreateSkeleton()
|
||||
|
@ -187,7 +187,7 @@ namespace FirstPlugin.Forms
|
||||
{
|
||||
Drawables.Remove(draw);
|
||||
|
||||
if (!Runtime.UseOpenGL || !Runtime.DisplayViewport)
|
||||
if (!Runtime.UseOpenGL || !Runtime.DisplayViewport || viewport == null)
|
||||
{
|
||||
IsLoaded = false;
|
||||
RemovedDrawables.Add(draw);
|
||||
|
Binary file not shown.
Binary file not shown.
@ -107,7 +107,6 @@ namespace Switch_Toolbox.Library
|
||||
|
||||
if (parent.MeshCount > 0)
|
||||
{
|
||||
|
||||
STConsole.WriteLine($"Use Transform Matrix {UseTransformMatrix}");
|
||||
STConsole.WriteLine($"Transform node {parent.Name}");
|
||||
STConsole.WriteLine($"Translation {worldTK.ExtractTranslation()}");
|
||||
@ -118,7 +117,6 @@ namespace Switch_Toolbox.Library
|
||||
foreach (int index in parent.MeshIndices)
|
||||
objects.Add(CreateGenericObject(scene.Meshes[index], index, worldTK));
|
||||
|
||||
|
||||
foreach (Node child in parent.Children)
|
||||
BuildNode(child, ref world);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user