Skip to content

Commit c2aa684

Browse files
committed
Merge branch 'develop' into colorset_editor
2 parents 10fe130 + 8a0629c commit c2aa684

File tree

3 files changed

+32
-6
lines changed

3 files changed

+32
-6
lines changed

xivModdingFramework/Models/Helpers/ModelModifiers.cs

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -738,18 +738,41 @@ public static void ForceUVQuadrant(TTModel model, Action<bool, string> loggingFu
738738
{
739739
foreach(var p in m.Parts)
740740
{
741-
foreach(var v in p.Vertices)
741+
bool anyNegativeX = p.Vertices.Any(x => x.UV1.X < 0);
742+
bool anyPositiveY = p.Vertices.Any(x => x.UV1.Y > 0);
743+
foreach (var v in p.Vertices)
742744
{
743745

744-
v.UV1.X = (v.UV1.X % 1);
745-
v.UV1.Y = (v.UV1.Y % 1);
746+
// Edge case to prevent shoving things at exactly 1.0 to 0.0
747+
if (Math.Abs(v.UV1.X) != 1)
748+
{
749+
v.UV1.X = (v.UV1.X % 1);
750+
}
751+
752+
if (Math.Abs(v.UV1.Y) != 1)
753+
{
754+
v.UV1.Y = (v.UV1.Y % 1);
755+
}
756+
757+
// The extra [anyPositive/negative] values check is to avoid potentially
758+
// shifting values at exactly 0 if 0 is effectively the "top" of the
759+
// used UV space.
760+
761+
// The goal here is to allow the user to have used any exact quadrant in the [-1 - 1, -1 - 1] range
762+
// and maintain the UV correctly, even if they used exactly [1,1] as a coordinate, for example.
763+
764+
// If the user has the UV's arbitrarily split over multiple quadrants, though, then
765+
// the exact points [1,1] for example, become unstable, and end up forced to [0,0]
766+
// No particularly sane way around that though without doing really invasive math to compare connected UVs, etc.
746767

747-
if (v.UV1.X < 0)
768+
// Shove things over into positive quadrant.
769+
if (v.UV1.X <= 0 && anyNegativeX)
748770
{
749771
v.UV1.X += 1;
750772
}
751773

752-
if (v.UV1.Y > 0)
774+
// Shove things over into negative quadrant.
775+
if (v.UV1.Y >= 0 && anyPositiveY)
753776
{
754777
v.UV1.Y -= 1;
755778
}

xivModdingFramework/Mods/FileTypes/TTMP.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public async Task<int> CreateWizardModPack(ModPackData modPackData, IProgress<do
123123
{
124124
var fname = Path.GetFileName(modOption.ImageFileName);
125125
imageFileName = Path.Combine(dir, fname);
126-
File.Copy(modOption.ImageFileName, imageFileName);
126+
File.Copy(modOption.ImageFileName, imageFileName, true);
127127
imageList.Add(imageFileName);
128128
}
129129

@@ -190,6 +190,7 @@ public async Task<int> CreateWizardModPack(ModPackData modPackData, IProgress<do
190190
}
191191

192192
var zf = new ZipFile();
193+
zf.UseZip64WhenSaving = Zip64Option.AsNecessary;
193194
zf.CompressionLevel = Ionic.Zlib.CompressionLevel.None;
194195
zf.AddFile(_tempMPL, "");
195196
zf.AddFile(_tempMPD, "");
@@ -315,6 +316,7 @@ public async Task<int> CreateSimpleModPack(SimpleModPackData modPackData, Direct
315316
}
316317

317318
var zf = new ZipFile();
319+
zf.UseZip64WhenSaving = Zip64Option.AsNecessary;
318320
zf.CompressionLevel = Ionic.Zlib.CompressionLevel.None;
319321
zf.AddFile(_tempMPL, "");
320322
zf.AddFile(_tempMPD, "");

xivModdingFramework/Mods/RootCloner.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public static class RootCloner
2828

2929
public static bool IsSupported(XivDependencyRoot root)
3030
{
31+
if (root.Info.PrimaryType == XivItemType.weapon) return true;
3132
if (root.Info.PrimaryType == XivItemType.equipment) return true;
3233
if (root.Info.PrimaryType == XivItemType.accessory) return true;
3334
if (root.Info.PrimaryType == XivItemType.human && root.Info.SecondaryType == XivItemType.hair) return true;

0 commit comments

Comments
 (0)