private bool EditData() { if (SelectedDataU != null) { UserDataParser parser = new UserDataParser(); parser.UserDataName = SelectedDataU.Name; parser.Type = SelectedDataU.Type.ToString(); switch (SelectedDataU.Type) { case UserDataType.WString: case UserDataType.String: if (SelectedDataU.GetValueStringArray() != null) { parser.LoadValues(SelectedDataU.GetValueStringArray()); } break; case UserDataType.Single: if (SelectedDataU.GetValueSingleArray() != null) { parser.LoadValues(SelectedDataU.GetValueSingleArray()); } break; case UserDataType.Int32: if (SelectedDataU.GetValueInt32Array() != null) { parser.LoadValues(SelectedDataU.GetValueInt32Array()); } break; case UserDataType.Byte: if (SelectedDataU.GetValueByteArray() != null) { parser.LoadValues(SelectedDataU.GetValueByteArray()); } break; } if (parser.ShowDialog() == DialogResult.OK) { SelectedDataU.Name = parser.UserDataName; if (parser.Type == "Byte") { SelectedDataU.SetValue(parser.GetBytes()); } if (parser.Type == "Single") { SelectedDataU.SetValue(parser.GetFloats()); } if (parser.Type == "Int32") { SelectedDataU.SetValue(parser.GetInts()); } if (parser.Type == "String") { SelectedDataU.SetValue(parser.GetStringASCII()); } if (parser.Type == "WString") { SelectedDataU.SetValue(parser.GetStringUnicode(), true); } LoadUserData(userData); return(true); } } else if (SelectedDataNX != null) { UserDataParser parser = new UserDataParser(); parser.UserDataName = SelectedDataNX.Name; parser.Type = SelectedDataNX.Type.ToString(); switch (SelectedDataNX.Type) { case ResNX.UserDataType.WString: case ResNX.UserDataType.String: if (SelectedDataNX.GetValueStringArray() != null) { parser.LoadValues(SelectedDataNX.GetValueStringArray()); } break; case ResNX.UserDataType.Single: if (SelectedDataNX.GetValueSingleArray() != null) { parser.LoadValues(SelectedDataNX.GetValueSingleArray()); } break; case ResNX.UserDataType.Int32: if (SelectedDataNX.GetValueInt32Array() != null) { parser.LoadValues(SelectedDataNX.GetValueInt32Array()); } break; case ResNX.UserDataType.Byte: if (SelectedDataNX.GetValueByteArray() != null) { parser.LoadValues(SelectedDataNX.GetValueByteArray()); } break; } if (parser.ShowDialog() == DialogResult.OK) { SelectedDataNX.Name = parser.UserDataName; if (parser.Type == "Byte") { SelectedDataNX.SetValue(parser.GetBytes()); } if (parser.Type == "Single") { SelectedDataNX.SetValue(parser.GetFloats()); } if (parser.Type == "Int32") { SelectedDataNX.SetValue(parser.GetInts()); } if (parser.Type == "String") { SelectedDataNX.SetValue(parser.GetStringASCII()); } if (parser.Type == "WString") { SelectedDataNX.SetValue(parser.GetStringUnicode()); } LoadUserData(userDataNX); return(true); } } return(false); }
public static ResNX.SkeletalAnim FSKAConvertWiiUToSwitch(ResU.SkeletalAnim skeletalAnimU) { ResNX.SkeletalAnim ska = new ResNX.SkeletalAnim(); ska.Name = skeletalAnimU.Name; ska.Path = skeletalAnimU.Path; ska.FrameCount = skeletalAnimU.FrameCount; ska.FlagsScale = ResNX.SkeletalAnimFlagsScale.None; if (skeletalAnimU.FlagsScale.HasFlag(ResU.SkeletalAnimFlagsScale.Maya)) { ska.FlagsScale = ResNX.SkeletalAnimFlagsScale.Maya; } if (skeletalAnimU.FlagsScale.HasFlag(ResU.SkeletalAnimFlagsScale.Softimage)) { ska.FlagsScale = ResNX.SkeletalAnimFlagsScale.Softimage; } if (skeletalAnimU.FlagsScale.HasFlag(ResU.SkeletalAnimFlagsScale.Standard)) { ska.FlagsScale = ResNX.SkeletalAnimFlagsScale.Standard; } ska.FrameCount = skeletalAnimU.FrameCount; ska.BindIndices = skeletalAnimU.BindIndices; ska.BakedSize = skeletalAnimU.BakedSize; ska.Loop = skeletalAnimU.Loop; ska.Baked = skeletalAnimU.Baked; foreach (var userDataU in skeletalAnimU.UserData) { var parser = new UserDataParser(); var userDataNX = new ResNX.UserData(); parser.Type = userDataU.Value.Type.ToString(); parser.UserDataName = userDataU.Value.Name; userDataNX.Name = parser.UserDataName; if (parser.Type == "Byte") { userDataNX.SetValue(parser.GetBytes()); } if (parser.Type == "Single") { parser.LoadValues(userDataU.Value.GetValueSingleArray()); } userDataNX.SetValue(parser.GetFloats()); if (parser.Type == "Int32") { userDataNX.SetValue(parser.GetInts()); } if (parser.Type == "String") { userDataNX.SetValue(parser.GetStringASCII()); } if (parser.Type == "WString") { userDataNX.SetValue(parser.GetStringUnicode()); } ska.UserDatas.Add(userDataNX); } foreach (var boneAnimU in skeletalAnimU.BoneAnims) { var boneAnim = new ResNX.BoneAnim(); ska.BoneAnims.Add(boneAnim); boneAnim.Name = boneAnimU.Name; boneAnim.BeginRotate = boneAnimU.BeginRotate; boneAnim.BeginTranslate = boneAnimU.BeginTranslate; boneAnim.BeginBaseTranslate = boneAnimU.BeginBaseTranslate; var baseData = new ResNX.BoneAnimData(); baseData.Translate = boneAnimU.BaseData.Translate; baseData.Scale = boneAnimU.BaseData.Scale; baseData.Rotate = boneAnimU.BaseData.Rotate; baseData.Flags = boneAnimU.BaseData.Flags; boneAnim.BaseData = baseData; boneAnim.FlagsBase = (ResNX.BoneAnimFlagsBase)boneAnimU.FlagsBase; boneAnim.FlagsCurve = (ResNX.BoneAnimFlagsCurve)boneAnimU.FlagsCurve; boneAnim.FlagsTransform = (ResNX.BoneAnimFlagsTransform)boneAnimU.FlagsTransform; boneAnim.Curves = ConvertAnimCurveWiiUToSwitch(boneAnimU.Curves); } return(ska); }