Skip to content
This repository has been archived by the owner on Sep 22, 2022. It is now read-only.

Commit

Permalink
Moves files to textures directory correctly now
Browse files Browse the repository at this point in the history
  • Loading branch information
AtlasTheProto committed Jan 25, 2020
1 parent d057eda commit 9012ba2
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 12 deletions.
16 changes: 14 additions & 2 deletions bC7totif/MainForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 26 additions & 7 deletions bC7totif/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using System.Diagnostics;
using System.Runtime.InteropServices;


namespace bulkTexConverter
{
public partial class MainForm : Form
Expand All @@ -34,7 +35,6 @@ public MainForm()

}


private void MainForm_Load(object sender, EventArgs e)
{
reloadSettings();
Expand Down Expand Up @@ -100,7 +100,7 @@ private void uiUpdate_Tick(object sender, EventArgs e)
lblGameDirectory.ForeColor = Color.Green;
}

if (gamePath == null || gamePath.Length < 2 || toolPath == null || toolPath.Length < 2 || gamePath == null || gamePath.Length < 2 || busy)
if (gamePath == null || gamePath.Length < 2 || toolPath == null || toolPath.Length < 2 || gamePath == null || gamePath.Length < 2 || outDir == null || outDir.Length < 2 || busy)
{
btnConvert.Enabled = false;
} else
Expand Down Expand Up @@ -209,7 +209,10 @@ public static Process StartProcess(string executable, string commandline)

public static void doConvertAll()
{
busy = true;

busy = true;
// I hate this
var moveDirs = new List<string> { "Models", "Particles", "Voxels", "Sprites", "Miscellaneous", "Lights", "Logo", "GUI", "HUD", "Gizmo", "Decals", "Debug", "BackgroundCube", "FactionLogo", "SunGlare"};
var count = 0;
foreach (string obj in Items)
{
Expand Down Expand Up @@ -268,20 +271,36 @@ public static void doConvertAll()
var currentFilePath = fileList[i];
var DirName = Path.GetDirectoryName(currentFilePath);
var relDir = DirName.Replace(gamePath,"");
var destDir = outDir + relDir;
var destDir = "temp/" + relDir;
var convFileName = Path.GetFileName(currentFilePath);
Directory.CreateDirectory(destDir);
currentfiles = i;
var cmdArgs = string.Format("-ft TIF -if LINEAR -sRGB -y -o \"{0}\" \"{1}\"", destDir, currentFilePath);
var newProcess = StartProcess(toolPath + "\\texconv.exe", cmdArgs);
consoleBuffer.Enqueue("Converting " + currentFilePath);
// consoleBuffer.Enqueue("Converting " + i + " out of " + maxfiles + " (" + convFileName + ")");
consoleBuffer.Enqueue("Converting: " + convFileName + " (" + i + "/" + maxfiles + ")");
if (newProcess!=null)
{
newProcess.WaitForExit();
}
// Console.WriteLine(cmdArgs);

// Sorry in advance

}
foreach (string dir in moveDirs)
{
try
{
Directory.Move("temp/Content/Textures/" + dir, outDir + "/" + dir);
consoleBuffer.Enqueue("Moved " + dir );
}
catch
{
consoleBuffer.Enqueue("Did not move " + dir + " as it had no converted textures");
}
}
MessageBox.Show("Done");
busy = false;

}
Expand All @@ -291,12 +310,12 @@ private void btnConvert_Click(object sender, EventArgs e)
#if !DEBUG
if (!File.Exists(toolPath + "/texconv.exe"))
{
MessageBox.Show("Cannot find texconv.exe under tool directory.");
MessageBox.Show("Cannot find texconv.exe under tool directory.\n\nPlease ensure ModSDK is installed.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
if (!Directory.Exists(gamePath))
{
MessageBox.Show("Game path is wrong.");
MessageBox.Show("Game path is wrong.\n\nPlease ensure game is installed.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
#endif
Expand Down
10 changes: 7 additions & 3 deletions bC7totif/bin/Debug/presets.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
E:\Program Files (x86)\Steam\steamapps\common\SpaceEngineers\Content\Textures\Debug
E:\Program Files (x86)\Steam\steamapps\common\SpaceEngineers\Content\Textures\GUI
E:\Program Files (x86)\Steam\steamapps\common\SpaceEngineers\Content\Textures\GUI\HelpScreen
C:\Program Files (x86)\Steam\steamapps\common\SpaceEngineers\Content\Textures\Models\Cubes
C:\Program Files (x86)\Steam\steamapps\common\SpaceEngineers\Content\Textures\Models\Cubes\armor
C:\Program Files (x86)\Steam\steamapps\common\SpaceEngineers\Content\Textures\Models\Physical_item
C:\Program Files (x86)\Steam\steamapps\common\SpaceEngineers\Content\Textures\Models\Environment\Bushes
C:\Program Files (x86)\Steam\steamapps\common\SpaceEngineers\Content\Textures\Models\Environment\Grass
C:\Program Files (x86)\Steam\steamapps\common\SpaceEngineers\Content\Textures\Models\Environment\Trees
C:\Program Files (x86)\Steam\steamapps\common\SpaceEngineers\Content\Textures\Voxels
Binary file modified bC7totif/bin/Release/bulkTexConverter.exe
Binary file not shown.
7 changes: 7 additions & 0 deletions bC7totif/bin/Release/presets.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
C:\Program Files (x86)\Steam\steamapps\common\SpaceEngineers\Content\Textures\Models\Cubes
C:\Program Files (x86)\Steam\steamapps\common\SpaceEngineers\Content\Textures\Models\Cubes\armor
C:\Program Files (x86)\Steam\steamapps\common\SpaceEngineers\Content\Textures\Models\Physical_item
C:\Program Files (x86)\Steam\steamapps\common\SpaceEngineers\Content\Textures\Models\Environment\Bushes
C:\Program Files (x86)\Steam\steamapps\common\SpaceEngineers\Content\Textures\Models\Environment\Grass
C:\Program Files (x86)\Steam\steamapps\common\SpaceEngineers\Content\Textures\Models\Environment\Trees
C:\Program Files (x86)\Steam\steamapps\common\SpaceEngineers\Content\Textures\Voxels

0 comments on commit 9012ba2

Please sign in to comment.