Skip to content

Commit

Permalink
small UI fixes (#185)
Browse files Browse the repository at this point in the history
* bugfixes

- added ELightChannel enum
- fixed relative path copying in ModExplorer
- fixed a bug where files in frmScriptEditor would be saved in utf8 instead of utf16LE
- fixed a bug where dlc textures would get imported as bundle in the importUtility

* pack and launch fixes

- fixed launching the game when packing is cancelled

* dumb more hotkeys

- F5 : pack and install mod
- Ctrl+F5: pack and install mod, launch game

* wkit small feature requests

- added an option to disable the welcome form
- fixed a bug with xbm image preview
- added hotkeys to close and reopen tabs (ctrl + W, ctrl + shift + T)
- updated the main and welcome forms abit
- added more bulk edit options

* frm Welcome redesign

frm Welcome redesign

* persist toolstrip locations

- added checks for when no mod is loaded
- persist toolstrip locations

* png extraction

- adding pngs with asset browser will extract pngs to Mod/TextureCache instead of Raw
- fixed "asset browser here" behaviour for Raw textures

* hotkey bugfixes

- fixed a stupid bug where wkit would crash when hitting ctr+w and no document is open

* progress form anchoring

- anchored the progress form when loading files in the middle of the wkit window

* Update frmModExplorer.Designer.cs

- enabled filtering for Modexplorer
  • Loading branch information
rfuzzo authored Jun 15, 2020
1 parent a9d81be commit 52ef16c
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 25 deletions.
9 changes: 7 additions & 2 deletions WolvenKit.Cache/TextureCache/TextureCacheItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ public void Extract(Stream output)
public void Extract(BundleFileExtractArgs e)
{
var fullpath = e.FileName;
var isPng = Path.GetExtension(fullpath) == ".png";

fullpath = Path.ChangeExtension(fullpath, "dds");

Directory.CreateDirectory(Path.GetDirectoryName(fullpath) ?? "");
Expand All @@ -192,13 +194,16 @@ public void Extract(BundleFileExtractArgs e)
Extract(output);
}

if (e.Extension != EUncookExtension.dds)
// convert all dds files to the extension specified in the settings
// also convert "pngs" to pngs lol
if (e.Extension != EUncookExtension.dds || isPng)
{
//convert
var fi = new FileInfo(fullpath);
if (fi.Exists)
{
Texconv.Convert(Path.GetDirectoryName(fullpath), fullpath, e.Extension);
// convert to png if file is a png, else convert to custom extension
Texconv.Convert(Path.GetDirectoryName(fullpath), fullpath, isPng ? EUncookExtension.png : e.Extension);
}

// delete old DDS
Expand Down
13 changes: 13 additions & 0 deletions WolvenKit.Common/Model/W3Mod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,19 @@ public string RawDirectory
}
}

[XmlIgnore]
[ReadOnly(true)]
[Browsable(false)]
public string TextureDirectory
{
get
{
if (!Directory.Exists(Path.Combine(ModDirectory, "TextureCache")))
Directory.CreateDirectory(Path.Combine(ModDirectory, "TextureCache"));
return Path.Combine(ModDirectory, "TextureCache");
}
}

[XmlIgnore]
[ReadOnly(true)]
[Browsable(false)]
Expand Down
42 changes: 33 additions & 9 deletions WolvenKit/Forms/frmMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ public frmMain()

hotkeys.RegisterHotkey(Keys.F5, HKRun, "Run");
hotkeys.RegisterHotkey(Keys.Control | Keys.F5, HKRunAndLaunch, "RunAndLaunch");

hotkeys.RegisterHotkey(Keys.Control | Keys.W, HKCloseTab, "CloseTab");
hotkeys.RegisterHotkey(Keys.Control | Keys.Shift | Keys.T, HKReopenTab, "ReopenTab");

Expand Down Expand Up @@ -327,13 +328,20 @@ private void HKRunAndLaunch(HotKeyEventArgs e)
}
private void HKCloseTab(HotKeyEventArgs e)
{
_lastClosedTab.Enqueue(ActiveDocument.FileName);
ActiveDocument.Close();
if (ActiveDocument != null)
{
_lastClosedTab.Enqueue(ActiveDocument.FileName);
ActiveDocument.Close();
}
}
private void HKReopenTab(HotKeyEventArgs e)
{
string filetoopen = _lastClosedTab.Dequeue();
LoadDocument(filetoopen);
if (_lastClosedTab.Count > 0)
{
string filetoopen = _lastClosedTab.Dequeue();
if (!string.IsNullOrEmpty(filetoopen))
LoadDocument(filetoopen);
}
}
private void HKSave(HotKeyEventArgs e)
{
Expand Down Expand Up @@ -1187,14 +1195,27 @@ private bool AddToMod(WitcherListViewItem item, bool skipping, List<IWitcherArch
{
var archives = manager.FileList.Where(x => x.Name == item.FullPath).Select(y => new KeyValuePair<string, IWitcherFile>(y.Bundle.FileName, y));
string filename;
if (archives.First().Value.Bundle.TypeName == MainController.Get().CollisionManager.TypeName ||
archives.First().Value.Bundle.TypeName == MainController.Get().TextureManager.TypeName)
if (archives.First().Value.Bundle.TypeName == MainController.Get().CollisionManager.TypeName
|| archives.First().Value.Bundle.TypeName == MainController.Get().TextureManager.TypeName)
{
filename = Path.Combine(ActiveMod.RawDirectory, AddAsDLC ? Path.Combine("DLC", archives.First().Value.Bundle.TypeName, "dlc", ActiveMod.Name, item.FullPath) : Path.Combine("Mod", archives.First().Value.Bundle.TypeName, item.FullPath));
// add pngs directly to TextureCache (not Raw, since pngs don't get imported)
if (Path.GetExtension(item.FullPath) == ".png")
{
filename = Path.Combine(ActiveMod.FileDirectory, AddAsDLC
? Path.Combine("DLC", archives.First().Value.Bundle.TypeName, "dlc", ActiveMod.Name, item.FullPath)
: Path.Combine("Mod", archives.First().Value.Bundle.TypeName, item.FullPath));
}
// all other textures go into Raw (since they have to be imported first)
else
filename = Path.Combine(ActiveMod.RawDirectory, AddAsDLC
? Path.Combine("DLC", archives.First().Value.Bundle.TypeName, "dlc", ActiveMod.Name, item.FullPath)
: Path.Combine("Mod", archives.First().Value.Bundle.TypeName, item.FullPath));
}
else
{
filename = Path.Combine(ActiveMod.FileDirectory, AddAsDLC ? Path.Combine("DLC", archives.First().Value.Bundle.TypeName, "dlc", ActiveMod.Name, item.FullPath) : Path.Combine("Mod", archives.First().Value.Bundle.TypeName, item.FullPath));
filename = Path.Combine(ActiveMod.FileDirectory, AddAsDLC
? Path.Combine("DLC", archives.First().Value.Bundle.TypeName, "dlc", ActiveMod.Name, item.FullPath)
: Path.Combine("Mod", archives.First().Value.Bundle.TypeName, item.FullPath));
}
if (archives.Count() > 1)
{
Expand Down Expand Up @@ -1517,7 +1538,7 @@ private void WorkerLoadFileSetup(LoadFileArgs args)

workerAction = WorkerLoadFile;
MainBackgroundWorker.RunWorkerAsync(args);
DialogResult dr = m_frmProgress.ShowDialog();
DialogResult dr = m_frmProgress.ShowDialog(this);


}
Expand Down Expand Up @@ -2113,15 +2134,18 @@ private void Assetbrowser_FileAdd(object sender, Tuple<List<IWitcherArchive>, Li
{
ModExplorer.PauseMonitoring();

// progress bar
m_frmProgress = new frmProgress()
{
Text = "Adding Assets",
StartPosition = FormStartPosition.CenterParent,
};

// background worker action
workerAction = WorkerAssetBrowserAddFiles;
MainBackgroundWorker.RunWorkerAsync(Details);

// cancellation dialog
DialogResult dr = m_frmProgress.ShowDialog(this);
switch (dr)
{
Expand Down
1 change: 1 addition & 0 deletions WolvenKit/Forms/frmModExplorer.Designer.cs

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

8 changes: 6 additions & 2 deletions WolvenKit/Forms/frmModExplorer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,12 @@ string GetExplorerString(string s)
s = s.Substring(ActiveMod.FileDirectory.Length + 1);
if (s.Split(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar).Length > 1)
{
var r = string.Join(Path.DirectorySeparatorChar.ToString(), new[] { "Root" }.Concat(s.Split(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar).Skip(1)).ToArray());
return string.Join(Path.DirectorySeparatorChar.ToString(), new[] { "Root" }.Concat(s.Split(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar).Skip(1)).ToArray());
int skip = s.StartsWith("Raw") ? 2 : 1;

var r = string
.Join(Path.DirectorySeparatorChar.ToString(), new[] { "Root" }
.Concat(s.Split(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar).Skip(skip)).ToArray());
return r;
}
else
return s;
Expand Down
26 changes: 14 additions & 12 deletions WolvenKit/Forms/frmWelcome.Designer.cs

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

0 comments on commit 52ef16c

Please sign in to comment.