Skip to content

Very experimental version of VTFEdit that is cross-platform (only Linux for Qt version), bringing the same features from Windows to Linux and possibly Mac.

License

Notifications You must be signed in to change notification settings

programmer1o1/QTFEdit

 
 

Repository files navigation

QTFEdit v3.0 (Qt GUI for VTFLib)

QTFEdit is the primary GUI frontend for VTFLib, implemented with Qt (Qt 6/5 Widgets) and intended to be cross-platform (Linux/macOS/Windows).

This repository contains:

  • VTFLib: LGPL C/C++ library for reading/writing .vtf/.vmt.
  • VTFCmd: GPL command-line frontend for VTFLib.
  • QTFEdit (VTFEdit/): Qt GUI frontend for VTFLib.
  • Legacy WinForms GUI (legacy/): frozen Windows-only VTFEdit Reloaded + Visual Studio solutions.

Library/Author Information

Project Structure

  • VTFLib/ - VTFLib source (library).
  • VTFCmd/ - VTFCmd source (CLI).
  • VTFEdit/ - QTFEdit source (Qt GUI).
  • legacy/ - frozen WinForms GUI + Visual Studio solutions.
  • docs/ - documentation (including the parity checklist).

How to Build

Windows (legacy WinForms GUI)

The legacy WinForms GUI is frozen, but still buildable on Windows via the Visual Studio solutions under legacy/sln/.

Linux (new, CLI + library)

Prerequisites: cmake, a C/C++ compiler (gcc/clang), and optionally AMD Compressonator (libcompressonator) for DXT compression. VTFCmd can use DevIL (OpenIL) if installed, or a bundled stb-based loader/writer backend.

Build steps:

mkdir -p build && cd build
cmake .. -G Ninja -DVTFLIB_USE_COMPRESSONATOR=ON   # OFF to build without Compressonator
cmake --build . --config Release

Outputs:

  • build/VTFLib/libvtflib.a – static VTFLib suitable for Linux.
  • build/VTFCmd/vtfcmd – command-line converter runnable on Linux.

Notes:

  • If Compressonator is not found on your system, DXT compression/decompression will be disabled at runtime with a clear error message.
  • VTFCmd image I/O backend is controlled by -DVTFCMD_IMAGE_BACKEND=auto|devil|stb (default auto). With auto, CMake will use DevIL if found, otherwise it will fall back to the bundled stb backend.
  • The stb backend uses thirdparty/include/stb_image.h and thirdparty/include/stb_image_write.h.
  • If you only want the library, configure with -DBUILD_VTFCMD=OFF.
  • If you want the DevIL backend but CMake can’t find it, you can point it at your paths with -DIL_INCLUDE_DIR=... and -DIL_LIBRARY=... (for example /usr/include and /usr/lib64/libIL.so or /usr/lib64/libIL.so.1).
  • The legacy WinForms GUI is in legacy/ and remains Windows-only.

Linux/macOS/Windows (new, Qt GUI)

Prerequisites: Qt 6 (or Qt 5) Widgets development packages and a C++ compiler.

Build steps (GUI only, no DevIL required):

cmake -S . -B build -G Ninja -DBUILD_VTFCMD=OFF -DBUILD_VTFEDIT_QT=ON -DVTFLIB_USE_COMPRESSONATOR=ON
cmake --build build --config Release

Outputs:

  • build/VTFEdit/vtfeditqt – Qt-based VTF/VMT tool (Linux/Windows).
  • build/VTFEdit/vtfeditqt.app – Qt-based VTF/VMT tool (macOS).

Notes:

  • If you previously configured this repo when the Qt GUI lived under VTFEditQt/, delete your build directory and reconfigure.
  • For a portable Windows folder (fixes missing Qt6Core.dll / MinGW runtime DLL errors), stage an install and run windeployqt:
    • cmake --install build --config Release --prefix dist
    • windeployqt --release --no-translations --compiler-runtime dist/vtfeditqt.exe
  • For a portable macOS app bundle, stage an install and run macdeployqt:
    • cmake --install build --config Release --prefix dist
    • macdeployqt dist/vtfeditqt.app -always-overwrite
  • Batch convert supports presets, preserves input folder structure under the output root, and can generate .vmt with $basetexture computed relative to a configurable materials/ root.
  • Create options include common VTF header flags (e.g. normal map, clamp, filtering) via the Qt GUI.
  • Opened .vtf files can have header flags edited via the GUI and then saved back to disk.
  • VTF Properties can edit start frame, bump scale, reflectivity, and can regenerate mipmaps/thumbnail.
  • VMT creation wizard can generate a starter .vmt (and can derive $basetexture when the VTF path contains materials/).
  • DXT formats (DXT1/3/5/ATI) require a compressor for import/export, and require Compressonator for viewing/decompression on non-Windows builds; without it only uncompressed formats will work reliably.

CI

GitHub Actions builds the core targets (vtflib, vtfcmd) on Ubuntu/Windows/macOS, and builds the Qt GUI (vtfeditqt) on Ubuntu/Windows/macOS (Qt 6).

Optional Dependencies (legacy/Windows)

VTFCmd Usage

Parameters:

 -file <path>             (Input file path.)
 -folder <path>           (Input directory search string.)
 -output <path>           (Output directory.)
 -prefix <string>         (Output file prefix.)
 -postfix <string>        (Output file postfix.)
 -version <string>         (Output version.)
 -format <string>          (Output format to use on non-alpha textures.)
 -alphaformat <string>     (Output format to use on alpha textures.)
 -flag <string>           (Output flags to set.)
 -resize                  (Resize the input to a power of 2.)
 -rmethod <string>        (Resize method to use.)
 -rfilter <string>        (Resize filter to use.)
 -rwidth <integer>        (Resize to specific width.)
 -rheight <integer>       (Resize to specific height.)
 -rclampwidth <integer>   (Maximum width to resize to.)
 -rclampheight <integer>  (Maximum height to resize to.)
 -alphathreshold <integer> (Alpha threshold for One Bit Alpha. Pixel alpha below this value is set to 0)
 -gamma                   (Gamma correct image.)
 -gcorrection <single>    (Gamma correction to use.)
 -nomipmaps               (Don't generate mipmaps.)
 -mfilter <string>        (Mipmap filter to use.)
 -nwrap                   (Wrap the normal map for tiled textures.)
 -bumpscale <single>      (Engine bump mapping scale to use.)
 -nothumbnail             (Don't generate thumbnail image.)
 -noreflectivity          (Don't calculate reflectivity.)
 -shader <string>         (Create a material for the texture.)
 -param <string> <string> (Add a parameter to the material.)
 -recurse                 (Process directories recursively.)
 -exportformat <string>   (Convert VTF files to the format of this extension.)
 -silent                  (Silent mode.)
 -pause                   (Pause when done.)
 -help                    (Display vtfcmd help.)

Example vtfcmd usage:

vtfcmd.exe -file "C:\texture1.bmp" -file "C:\texture2.bmp" -format "dxt1"
vtfcmd.exe -folder "C:\input\*.tga" -output "C:\output" -recurse -pause
vtfcmd.exe -folder "C:\output\*.vtf" -output "C:\input" -exportformat "jpg"

VTFEdit Reloaded Changelog

Details

v2.1.7

  • Warning and Notification Sounds are now enabled by default.
  • Added button to Help menu to pull up latest GitHub version in browser.
  • Fixed ordering of resize algorithms and exposed more options to user.
  • Upgraded stb_image_resize.h to stb_image_resize2.h, VTF creation is much faster now. I mistook something else changing import times, times are pretty much the same lmao.
  • Mipmaps are now generated with STB2.
  • Upgraded Compressonator to fork Yellow-Dog-Man/compressonator.

v2.1.6

  • Fixed multi-line comments in VMTs not being allowed to save or load.

v2.1.5

  • Fixed reflectivity not being set correctly when saving a VTF.

v2.1.4

  • Fixed mipmap generation still attempting to make mipmaps when it was disabled.

v2.1.3

  • Disables mipmap generation with DXT formats that use Multiple of Four resizing as they do not work as expected.

v2.1.2

  • Fix alpha detection method for batch converting.

v2.1.1

  • Added an option to set a custom alpha background for images that have alpha. Both settings are in the Options tab at the top.
  • Fix DXT1 with One Bit Alpha format not being imported correctly or being functional in source games.
    • Instead, this format will be turned into DXT1 with the One Bit Alpha flag being enabled for it.
  • Added a new Advanced option to set the alpha threshold when creating one bit textures.
    • This will set pixels that have a lower numeric alpha value lower than this number to be 0, and any equal to or higher to be 255.
    • This option is only relevant to DXT1 with One Bit Alpha.
  • Added a parameter for VTFCmd for the alpha threshold when creating one bit textures.
  • Removed HLLib as this is unused after the removal of WAD convert. This removes the requirement of needing msvcr100.dll to run the program.

v2.1.0

  • Fix batch create not setting the shader parameter to what you set for all vmts.
  • Fix an image format placement in code.
  • Fix One Bit Alpha flag not being kept on save.
  • Moved all system sounds to only being heard when both warning popups and notification sounds are enabled.
  • Changed the method that is used to determine whether an image should use Color or Alpha format.
  • It will now iterate through all pixels in the image and check their opacity. Previously this only looked at certain attributes of the image.

v2.0.9

  • Releases now include VTFCmd.exe (not yet verified).
  • Added a saved parameter for the zoom level of the VMT editor (Ctrl+MWheel changes the zoom level for this).
  • Added a color panel that is used to view the representation of the reflectivity value and can be used to change that value when clicking on it.
  • Added option to enable/disable notification sounds.
  • Added option to enable/disable pop-up warnings when an error occurs or closing an opened file.
  • Added a total percentage label to the Batch Convert window.
  • Changed the default text when creating a new VMT to include a line for $basetexture.
  • Changed the image position for VTF files to be centered on the middle panel and scaled to a more appropriate size by default.
  • Optimized some functions.
  • Removed the tabs in favor of adding a panel to the right, as a lot of redundant information was removed.
  • Removed the file system ui elements.
  • Removed WAD convert due to known issues.
  • Fixed some conditional statements.

v2.0.8

  • Fixed various issues with UI positioning and other functions not working.
  • Added a few more check boxes for VMT Create dialog.

v2.0.7

  • Adjusted the Convert Folder/Convert WAD dialogs to allow for adjusting the created VMT file instead of defaulting to a bare-minimum file. There is a new button for this on the bottom-left next to the button that was used for only changing VTF options.
  • Forgot to add VTF flags functionality to WAD convert, this is added now.

v2.0.6

  • Added an Edit Resources button for VTF files that are version 7.3 and above.
  • Added a Flags tab to the VTF import dialog. This also works when using the convert folder option and setting them within the Options button on the bottom-left of the dialog.

v2.0.5

  • While importing an image, you can now select "Nearest Multiple of 4", which is the suggested bare-minimum for mipmaps to be generated properly.
  • If you have an image opened, you can now change the version by selecting the new one in the dropdown box in the Info tab, then Save.
    • Keep in mind this will change the VTF size. So if you are using it for a spray decal, it could possibly go outside of the 512kb limitation when increasing the version.
  • The program's settings file is now contained in the same location that the program is in, instead of your Roaming folder.
  • The default version has also been changed to 7.4 as mostly commonly that will be the version used by source engine modders.
  • The context menu's options for VTF files has been slightly changed for more clarity.
  • The File menu has been slightly changed for more clarity and better positioning. Creating either VTF or VMT is now under the first option "Create New..."
  • Pulled request by goodusername123, which excludes the sRGB flag from VTFs (temporary measure).
  • Reverted the syntax highlighter due to performance and functional issues; related code remains commented out.
  • Added a way to change the framerate for animated playback (in milliseconds).
  • Fixed the import's resize filtering to use what you chose instead of being forced to use only one type of filter.
  • Adjusted the About dialog to include @WereTech and @Sky-rym as authors.

v2.0.4

  • Changed the UI to use a better version of the tool bar and added more buttons for ease of access.
  • Adjusted several UI elements to stop text wrapping, causing the rest of the text to not be visible at all.
  • Adjusted some windows to now use a minimum window size, as this was not set before and you were able to resize these windows to be extremely small which also hid controls.
  • Added a Close option to both the File dropdown, and the new tool bar. The shortcut for this is Ctrl + Q. This will close the current file, which has a confirmation prompt so you don't close your file accidentally.
  • Changed the right-click context menu for VTFs to additionally show when clicking within the image window instead of needing to right-click on the image itself.
  • Changed the functionality of the Frame, Face, Slice, and Mipmap numeric bars to only be interactable if any of these properties have more than one to them. (in this case 0 = 1 because C++ starts at 0)
  • Adjusted some VTF flag names.

v2.0.3

  • Updated the Shaders and Surface Properties list in VMT Create in accordance to the Valve Developer Wiki's current list
  • Added Drag and Drop functionality for images that can be imported normally through the File > Import dialog
    • Note that if any window is above VTFEdit-Reloaded, or any part of the window is outside monitor bounds, the Import settings will default to the top-left of the screen. I do not have the knowledge to change this behavior myself unfortunately.
  • Changed the ReadOnly property in the Convert Folder and Convert WAD dialog, so you can manually insert or change the path to your folder instead of needing to use the Folder Selector button on the right.
  • Changed the resource files to use "winres.h" and "winver.h" instead of "afxres.h". Supposedly afxres.h is outdated, and has been replaced with the two other headers. So far I haven't noticed any issues with this.

v2.0.2

  • Updated Compressonator to latest version as of 8/8/22.
  • Added 32-bit version.

v2.0.1

  • Updated to HLLib v2.4.6.

v2.0.0

  • Migrated to using AMD Compressonator for DXT compression.
  • Fix the green tinge when exporting textures
  • Respect sRGB-ness when generating mipmaps and resizing.
  • Ported to using the latest CLR and VS 2019.
  • Removed crufty sharpening filters (no longer needed with proper sRGB)
  • Use monospace font for VMT editor
  • High DPI support
  • Syntax highlighting support for VMTs
  • Fixed cubemap previews
    • Previously they were doing integer maths on what should be floats
    • Replaced overly complex controls with a simple exposure slider
    • Very simple Reinhard tonemapper for previewing exposure

Program Copyright-Permissions

See the lgpl.txt (VTFLib) and gpl.txt (VTFCmd & VTFEdit) files contained in the distribution.

About

Very experimental version of VTFEdit that is cross-platform (only Linux for Qt version), bringing the same features from Windows to Linux and possibly Mac.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 93.2%
  • C 6.0%
  • Other 0.8%