Skip to content

Commit 808a77a

Browse files
committed
Update 2.0.11.18
2 parents 4346799 + d92355f commit 808a77a

File tree

2 files changed

+53
-4
lines changed

2 files changed

+53
-4
lines changed

xivModdingFramework/Models/FileTypes/Mdl.cs

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1397,6 +1397,10 @@ public async Task<Dictionary<string, string>> ImportModel(IItemModel item, XivMd
13971397
// A dictionary containing error messages if there are any so that a single exception can be thrown with all available context
13981398
var errorDictionary = new Dictionary<int, string>();
13991399

1400+
// Calculations for bounding boxes.
1401+
var maxPos = Vector3.Zero;
1402+
var minPos = Vector3.Zero;
1403+
14001404
// Check for missing data and add dummy data if possible or throw exception
14011405
for (var i = 0; i < meshPartDataDictionary.Count; i++)
14021406
{
@@ -1462,6 +1466,7 @@ public async Task<Dictionary<string, string>> ImportModel(IItemModel item, XivMd
14621466
throw new Exception(errorString);
14631467
}
14641468

1469+
14651470
var indexListList = new List<List<int[]>>();
14661471
var partStartingIndexDicList = new List<Dictionary<(int Start,int End),Dictionary<string,int>>>();
14671472
for (var i = 0; i < meshPartDataDictionary.Count; i++)
@@ -1491,6 +1496,7 @@ public async Task<Dictionary<string, string>> ImportModel(IItemModel item, XivMd
14911496
var biNormalMax = 0;
14921497
var vColorAlphaMax = 0;
14931498

1499+
14941500
if (partDataDict.Count > 0)
14951501
{
14961502
var startingIndex = 0;
@@ -1523,8 +1529,10 @@ public async Task<Dictionary<string, string>> ImportModel(IItemModel item, XivMd
15231529
}
15241530

15251531
// Consolidate all index data into one Collada Data per mesh
1532+
15261533
for (var k = 0; k < partDataDict[partNum].PositionIndices.Count; k++)
15271534
{
1535+
15281536
meshDataDictionary[i].Indices.Add(partDataDict[partNum].PositionIndices[k] + positionMax);
15291537
meshDataDictionary[i].Indices.Add(partDataDict[partNum].NormalIndices[k] + normalMax);
15301538
meshDataDictionary[i].Indices.Add(partDataDict[partNum].TextureCoordinate0Indices[k] + texCoord0Max);
@@ -1745,9 +1753,18 @@ Dictionary<string,int> GetIndexLocDictionary(int meshIndex,int index,string key)
17451753

17461754
for (var i = 0; i < colladaData.Positions.Count; i += 3)
17471755
{
1748-
positionCollection.Add(new Vector3((colladaData.Positions[i] / ModelMultiplier),
1756+
1757+
var pos = new Vector3((colladaData.Positions[i] / ModelMultiplier),
17491758
(colladaData.Positions[i + 1] / ModelMultiplier),
1750-
(colladaData.Positions[i + 2] / ModelMultiplier)));
1759+
(colladaData.Positions[i + 2] / ModelMultiplier));
1760+
1761+
maxPos.X = maxPos.X > pos.X ? maxPos.X : pos.X;
1762+
maxPos.Y = maxPos.Y > pos.Y ? maxPos.Y : pos.Y;
1763+
maxPos.Z = maxPos.Z > pos.Z ? maxPos.Z : pos.Z;
1764+
minPos.X = minPos.X < pos.X ? minPos.X : pos.X;
1765+
minPos.Y = minPos.Y < pos.Y ? minPos.Y : pos.Y;
1766+
minPos.Z = minPos.Z < pos.Z ? minPos.Z : pos.Z;
1767+
positionCollection.Add(pos);
17511768
}
17521769

17531770
for (var i = 0; i < colladaData.Normals.Count; i += 3)
@@ -2377,6 +2394,17 @@ Dictionary<string,int> GetIndexLocDictionary(int meshIndex,int index,string key)
23772394
warningsDictionary.Add($"Weight Corrections", weightErrorString);
23782395
}
23792396

2397+
xivMdl.BoundBox.PointList[0] = new Vector4(minPos, 1);
2398+
xivMdl.BoundBox.PointList[1] = new Vector4(maxPos, 1);
2399+
xivMdl.BoundBox.PointList[2] = new Vector4(minPos, 1);
2400+
xivMdl.BoundBox.PointList[3] = new Vector4(maxPos, 1);
2401+
xivMdl.BoundBox.PointList[4] = new Vector4(0,0,0,0);
2402+
xivMdl.BoundBox.PointList[5] = new Vector4(0, 0, 0, 0);
2403+
xivMdl.BoundBox.PointList[6] = new Vector4(0, 0, 0, 0);
2404+
xivMdl.BoundBox.PointList[7] = new Vector4(0, 0, 0, 0);
2405+
//xivMdl.BoundBox.PointList[1] = Vector(;
2406+
//xivMdl.BoundBox.PointList[2] = minPos;
2407+
23802408
await MakeNewMdlFile(colladaMeshDataList, item, xivMdl, advImportSettings, source, rawDataOnly);
23812409

23822410
return warningsDictionary;
@@ -3934,7 +3962,7 @@ private async Task MakeNewMdlFile(List<ColladaMeshData> colladaMeshDataList, IIt
39343962
#region Bounding Box Data Block
39353963

39363964
var boundingBoxDataBlock = new List<byte>();
3937-
3965+
39383966
var boundingBox = xivMdl.BoundBox;
39393967

39403968
foreach (var point in boundingBox.PointList)

xivModdingFramework/Mods/DataContainers/SimpleModPackEntries.cs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,14 @@
1515
// along with this program. If not, see <http://www.gnu.org/licenses/>.
1616

1717
using System;
18+
using System.ComponentModel;
1819

1920
namespace xivModdingFramework.Mods.DataContainers
2021
{
21-
public class SimpleModPackEntries : IComparable<SimpleModPackEntries>
22+
public class SimpleModPackEntries : IComparable<SimpleModPackEntries>, INotifyPropertyChanged
2223
{
24+
private bool isSelected;
25+
2326
/// <summary>
2427
/// The name of the item
2528
/// </summary>
@@ -70,6 +73,24 @@ public class SimpleModPackEntries : IComparable<SimpleModPackEntries>
7073
/// </summary>
7174
public ModsJson JsonEntry { get; set; }
7275

76+
/// <summary>
77+
/// Is this entry selected in the ui
78+
/// </summary>
79+
public bool IsSelected
80+
{
81+
get
82+
{
83+
return isSelected;
84+
}
85+
set
86+
{
87+
isSelected = value;
88+
this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(IsSelected)));
89+
}
90+
}
91+
92+
public event PropertyChangedEventHandler PropertyChanged;
93+
7394
public int CompareTo(SimpleModPackEntries obj)
7495
{
7596
return Name.CompareTo(obj.Name);

0 commit comments

Comments
 (0)