Improve saving bfres with tons of animations
This commit is contained in:
parent
d6be976701
commit
7467818d66
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1296,6 +1296,7 @@ namespace FirstPlugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
ErrorCheck();
|
ErrorCheck();
|
||||||
|
|
||||||
resFile.Save(mem);
|
resFile.Save(mem);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1304,21 +1305,22 @@ namespace FirstPlugin
|
|||||||
switch (group.Type)
|
switch (group.Type)
|
||||||
{
|
{
|
||||||
case BRESGroupType.Models:
|
case BRESGroupType.Models:
|
||||||
foreach (FMDL model in group.Nodes)
|
for (int i = 0; i < group.Nodes.Count; i++)
|
||||||
{
|
{
|
||||||
model.Model.Name = model.Text;
|
((FMDL)group.Nodes[i]).Model.Name = ((FMDL)group.Nodes[i]).Text;
|
||||||
resFile.Models.Add(BfresSwitch.SetModel(model));
|
resFile.Models.Add(BfresSwitch.SetModel((FMDL)group.Nodes[i]));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BRESGroupType.SkeletalAnim:
|
case BRESGroupType.SkeletalAnim:
|
||||||
foreach (FSKA ska in group.Nodes)
|
for (int i = 0; i < group.Nodes.Count; i++)
|
||||||
{
|
{
|
||||||
ska.SkeletalAnim.BoneAnims.Clear();
|
((FSKA)group.Nodes[i]).SkeletalAnim.BoneAnims.Clear();
|
||||||
foreach (FSKA.BoneAnimNode bone in ska.Bones)
|
((FSKA)group.Nodes[i]).SkeletalAnim.Name = ((FSKA)group.Nodes[i]).Text;
|
||||||
ska.SkeletalAnim.BoneAnims.Add(bone.SaveData(ska.IsEdited));
|
for (int b = 0; b < ((FSKA)group.Nodes[i]).Bones.Count; b++)
|
||||||
|
((FSKA)group.Nodes[i]).SkeletalAnim.BoneAnims.Add(
|
||||||
|
((FSKA.BoneAnimNode)((FSKA)group.Nodes[i]).Bones[b]).SaveData(((FSKA)group.Nodes[i]).IsEdited));
|
||||||
|
|
||||||
ska.SkeletalAnim.Name = ska.Text;
|
resFile.SkeletalAnims.Add(((FSKA)group.Nodes[i]).SkeletalAnim);
|
||||||
resFile.SkeletalAnims.Add(ska.SkeletalAnim);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BRESGroupType.TexPatAnim:
|
case BRESGroupType.TexPatAnim:
|
||||||
@ -1326,41 +1328,31 @@ namespace FirstPlugin
|
|||||||
case BRESGroupType.ColorAnim:
|
case BRESGroupType.ColorAnim:
|
||||||
case BRESGroupType.TexSrtAnim:
|
case BRESGroupType.TexSrtAnim:
|
||||||
case BRESGroupType.MatVisAnim:
|
case BRESGroupType.MatVisAnim:
|
||||||
foreach (FMAA fmaa in group.Nodes)
|
for (int i = 0; i < group.Nodes.Count; i++)
|
||||||
{
|
{
|
||||||
fmaa.MaterialAnim.MaterialAnimDataList.Clear();
|
((FMAA)group.Nodes[i]).SaveAnimData();
|
||||||
foreach (FMAA.MaterialAnimEntry mat in fmaa.Materials)
|
resFile.MaterialAnims.Add(((FMAA)group.Nodes[i]).MaterialAnim);
|
||||||
fmaa.MaterialAnim.MaterialAnimDataList.Add(mat.SaveData(fmaa.IsEdited));
|
|
||||||
|
|
||||||
fmaa.SetName();
|
|
||||||
fmaa.SaveAnimData();
|
|
||||||
resFile.MaterialAnims.Add(fmaa.MaterialAnim);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BRESGroupType.BoneVisAnim:
|
case BRESGroupType.BoneVisAnim:
|
||||||
foreach (FVIS fbnv in group.Nodes)
|
for (int i = 0; i < group.Nodes.Count; i++)
|
||||||
{
|
{
|
||||||
fbnv.SaveData();
|
((FVIS)group.Nodes[i]).SaveAnimData();
|
||||||
fbnv.VisibilityAnim.Name = fbnv.Text;
|
resFile.BoneVisibilityAnims.Add(((FVIS)group.Nodes[i]).VisibilityAnim);
|
||||||
resFile.BoneVisibilityAnims.Add(fbnv.VisibilityAnim);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BRESGroupType.ShapeAnim:
|
case BRESGroupType.ShapeAnim:
|
||||||
foreach (FSHA fsha in group.Nodes)
|
for (int i = 0; i < group.Nodes.Count; i++)
|
||||||
{
|
{
|
||||||
fsha.ShapeAnim.VertexShapeAnims.Clear();
|
((FSHA)group.Nodes[i]).SaveAnimData();
|
||||||
foreach (FSHA.ShapeAnimEntry shp in fsha.Nodes)
|
resFile.ShapeAnims.Add(((FSHA)group.Nodes[i]).ShapeAnim);
|
||||||
fsha.ShapeAnim.VertexShapeAnims.Add(shp.SaveData());
|
|
||||||
|
|
||||||
fsha.ShapeAnim.Name = fsha.Text;
|
|
||||||
resFile.ShapeAnims.Add(fsha.ShapeAnim);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BRESGroupType.SceneAnim:
|
case BRESGroupType.SceneAnim:
|
||||||
foreach (FSCN fscn in group.Nodes)
|
for (int i = 0; i < group.Nodes.Count; i++)
|
||||||
{
|
{
|
||||||
fscn.SceneAnim.Name = fscn.Text;
|
((FSCN)group.Nodes[i]).SaveAnimData();
|
||||||
resFile.SceneAnims.Add(fscn.SceneAnim);
|
resFile.SceneAnims.Add(((FSCN)group.Nodes[i]).SceneAnim);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BRESGroupType.Embedded:
|
case BRESGroupType.Embedded:
|
||||||
@ -1428,28 +1420,29 @@ namespace FirstPlugin
|
|||||||
switch (group.Type)
|
switch (group.Type)
|
||||||
{
|
{
|
||||||
case BRESGroupType.Models:
|
case BRESGroupType.Models:
|
||||||
foreach (FMDL model in group.Nodes)
|
for (int i = 0; i < group.Nodes.Count; i++)
|
||||||
{
|
{
|
||||||
model.ModelU.Name = model.Text;
|
((FMDL)group.Nodes[i]).Model.Name = group.Nodes[i].Text;
|
||||||
resFileU.Models.Add(model.Text, BfresWiiU.SetModel(model));
|
resFileU.Models.Add(group.Nodes[i].Text, BfresWiiU.SetModel((FMDL)group.Nodes[i]));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BRESGroupType.Textures:
|
case BRESGroupType.Textures:
|
||||||
foreach (FTEX tex in group.Nodes)
|
for (int i = 0; i < group.Nodes.Count; i++)
|
||||||
{
|
{
|
||||||
tex.texture.Name = tex.Text;
|
((FTEX)group.Nodes[i]).texture.Name = group.Nodes[i].Text;
|
||||||
resFileU.Textures.Add(tex.Text, tex.texture);
|
resFileU.Textures.Add(group.Nodes[i].Text, ((FTEX)group.Nodes[i]).texture);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BRESGroupType.SkeletalAnim:
|
case BRESGroupType.SkeletalAnim:
|
||||||
foreach (FSKA ska in group.Nodes)
|
for (int i = 0; i < group.Nodes.Count; i++)
|
||||||
{
|
{
|
||||||
ska.SkeletalAnimU.BoneAnims.Clear();
|
((FSKA)group.Nodes[i]).SkeletalAnim.BoneAnims.Clear();
|
||||||
foreach (FSKA.BoneAnimNode bone in ska.Bones)
|
((FSKA)group.Nodes[i]).SkeletalAnim.Name = ((FSKA)group.Nodes[i]).Text;
|
||||||
ska.SkeletalAnimU.BoneAnims.Add(bone.SaveDataU(ska.IsEdited));
|
for (int b = 0; b < ((FSKA)group.Nodes[i]).Bones.Count; b++)
|
||||||
|
((FSKA)group.Nodes[i]).SkeletalAnim.BoneAnims.Add(
|
||||||
|
((FSKA.BoneAnimNode)((FSKA)group.Nodes[i]).Bones[b]).SaveData(((FSKA)group.Nodes[i]).IsEdited));
|
||||||
|
|
||||||
ska.SkeletalAnimU.Name = ska.Text;
|
resFileU.SkeletalAnims.Add(group.Nodes[i].Text, ((FSKA)group.Nodes[i]).SkeletalAnimU);
|
||||||
resFileU.SkeletalAnims.Add(ska.Text, ska.SkeletalAnimU);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BRESGroupType.ShaderParamAnim:
|
case BRESGroupType.ShaderParamAnim:
|
||||||
|
@ -99,6 +99,18 @@ namespace Bfres.Structs
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SaveAnimData()
|
||||||
|
{
|
||||||
|
if (SceneAnimU != null)
|
||||||
|
{
|
||||||
|
SceneAnimU.Name = Text;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SceneAnim.Name = Text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public FSCN(ResU.SceneAnim scn) { Initialize(); LoadAnim(scn); }
|
public FSCN(ResU.SceneAnim scn) { Initialize(); LoadAnim(scn); }
|
||||||
public FSCN(SceneAnim scn) { Initialize(); LoadAnim(scn); }
|
public FSCN(SceneAnim scn) { Initialize(); LoadAnim(scn); }
|
||||||
|
|
||||||
|
@ -53,6 +53,18 @@ namespace Bfres.Structs
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SaveAnimData()
|
||||||
|
{
|
||||||
|
if (ShapeAnimU != null)
|
||||||
|
{
|
||||||
|
ShapeAnimU.Name = Text;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ShapeAnim.Name = Text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public ResFile GetResFile() {
|
public ResFile GetResFile() {
|
||||||
return ((BFRESGroupNode)Parent).GetResFile();
|
return ((BFRESGroupNode)Parent).GetResFile();
|
||||||
}
|
}
|
||||||
|
@ -163,6 +163,9 @@ namespace Bfres.Structs
|
|||||||
|
|
||||||
private STSkeleton GetActiveSkeleton()
|
private STSkeleton GetActiveSkeleton()
|
||||||
{
|
{
|
||||||
|
if (Parent == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
var viewport = LibraryGUI.Instance.GetActiveViewport();
|
var viewport = LibraryGUI.Instance.GetActiveViewport();
|
||||||
if (viewport != null)
|
if (viewport != null)
|
||||||
{
|
{
|
||||||
|
@ -71,6 +71,20 @@ namespace Bfres.Structs
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SaveAnimData()
|
||||||
|
{
|
||||||
|
if (VisibilityAnimU != null)
|
||||||
|
{
|
||||||
|
VisibilityAnimU.Name = Text;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
VisibilityAnim.Name = Text;
|
||||||
|
}
|
||||||
|
|
||||||
|
SaveData();
|
||||||
|
}
|
||||||
|
|
||||||
public void SaveData()
|
public void SaveData()
|
||||||
{
|
{
|
||||||
if (!IsEdited) //Use original data instead of generic data from editors
|
if (!IsEdited) //Use original data instead of generic data from editors
|
||||||
@ -78,14 +92,12 @@ namespace Bfres.Structs
|
|||||||
|
|
||||||
if (VisibilityAnimU != null)
|
if (VisibilityAnimU != null)
|
||||||
{
|
{
|
||||||
VisibilityAnimU.Name = Text;
|
|
||||||
VisibilityAnimU.Names = BoneNames;
|
VisibilityAnimU.Names = BoneNames;
|
||||||
VisibilityAnimU.Path = "";
|
VisibilityAnimU.Path = "";
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
VisibilityAnim.Name = Text;
|
|
||||||
VisibilityAnim.Names = BoneNames;
|
VisibilityAnim.Names = BoneNames;
|
||||||
VisibilityAnim.Path = "";
|
VisibilityAnim.Path = "";
|
||||||
VisibilityAnim.FrameCount = FrameCount;
|
VisibilityAnim.FrameCount = FrameCount;
|
||||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user