Skip to content

JohnnyJF10/TgaBuilder

Repository files navigation

TgaBuilder

Texture Panel Building Tool for TRLE

Latest Releases | Github Page

LatestReleaseBuildStatus Github All Releases CodeFactor Review

Logo

Description

Overview TgaBuilder is a Texture Panel Building tool for TRLE, which is intended to facilitate the process of texture panel creation. The tool is inspired by TBuilder by IceBerg but programmed from scratch in .NET, C# WPF by me.

If you have already worked with TBuilder in the past, you should get familiar with TgaBuilder very quickly. It should cover most of the features TBuilder also has and introduces a few things more, most prominently:

  • Texture Panel Panning and Zooming
  • Undo / Redo
  • Window Resizable
  • Extended dimensioning with panel hights up to 128 pages, panel widths up to 16 pages
  • Better support for 128x128 or 256x256 pix texture sets
  • Batch Loader to create texture panels from multiple single texture files at once
  • Imported texture repacking to remove TE compiled atlas padding
  • and others…

Installation

Move over to GitHub Releases.

For the latest releases there are two tool versions per release: The .NET 6.0 version of the tool and the .NET 8.0 version of the tool.

  • Download the .NET 6.0 version of the tool (TgaBuilder-dotnet6), if you already have Tomb Editor Version 1.9 installed on your system and you do not wish to install another .NET runtime (as Tomb Editor Version 1.9 is using .NET 6.0 runtime as well)
  • Download the .NET 8.0 version of the tool (TgaBuilder-dotnet8), if you have the .NET 8.0 runtime installed or do not mind to install it. This version has the slightly better performance.

Extract the files and start TgaBuilder.exe.

Requirements

  • Windows 10/11
  • .NET 6 or .NET 8 runtime installed (with Tomb Editor Version 1.9, you have the .NET 6 runtime already installed)

Please note that, as a .net WPF tool, TgaBuilder has significantly higher system resource requirements, particularly for RAM, than TBuilder, which was written in Delphi. If you are still satisfied using TBuilder, please continue using it. TgaBuilder is not intended as a substitute for it.

Usage

Title Bar

TitleBar

Source Loading

  • Open image files as source texture panel
    Supported formats: TGA, DDS, PNG, BMP, JPG, JPEG, PSD (Ctrl + E)
    • ... or simply drop a supported image file on source panel.
  • Reopen recently used source image files
  • Reload the current file in case of changes to load settings (Import Tab) or file changes
  • Open previous file in current folder
  • Open next file in current folder

Undo / Redo

  • Undo: Ctrl + Z
  • Redo: Ctrl + Y

Destination Loading / Saving

  • Create a new texture panel: Ctrl + N
  • Open image files as destination texture panel
    Supported formats: TGA, DDS, PNG, BMP, JPG, JPEG, PSD (Ctrl + D)
    • ... or simply drop a supported image file on destination panel.
  • Reopen recently used destination image files
  • Save the destination texture
    Supported formats: TGA, DDS, PNG, BMP, JPG, JPEG (Ctrl + S)
  • Save to a specified file
    Formats: TGA, DDS, PNG, BMP, JPG, JPEG (Ctrl + Shift + S)

Source Panel (Left)

  • Left click a tile: copy into selection
  • Left click + drag: copy area into selection
  • Right click a tile: preview UV rotate (river rotate)
  • Right click + drag: preview range-based animation of AnimRange
  • Left click + Alt + drag: copy ignoring grid
  • Left click + Ctrl + drag: move panel
  • Mouse wheel: scroll vertically
  • Mouse wheel + Ctrl: zoom in/out

Destination Panel (Rigth)

Picking Mode

  • Left click: copy into selection or apply transformation
  • Left click + drag: copy area into selection
  • Right click: preview UV rotate
  • Right click + drag: preview animation range

Placing Mode

  • Left click: place selected tile and return to picking
  • Right click: return to picking without placing

General Controls

  • Left click + Ctrl + drag: move panel
  • Mouse wheel: scroll vertically
  • Mouse wheel + Ctrl: zoom
  • Mouse wheel + Shift: change picker size

Selection Area

SelectionArea

  • Buttons to copy entire contents from Source to Destination panels or vice versa
  • Fill selection with chosen color
  • Copy selection to clipboard (Ctrl + C)
  • Paste clipboard into selection (Ctrl + V)
  • Auto-copy new selections to clipboard
  • Auto-paste clipboard into selection when it has new image data

AnimationArea

Animation Area

  • Set animation speed
  • Start / stop animation
  • Close animation preview

Import Tab (Source Panel)

Import Tab

From left to rigth:

  • Import atlas from Classic TR levels
    Supports: TR1–TRC, TRLE, TRNG, TEN (Ctrl + Q)
  • Enable remapping for imports (removes padding in TE-built atlases) Repacking
  • Set horizontal page count (1, 2, 4, 8, 16 pages) PageSizeImport
  • Open Batch Loader (Ctrl + W)

Please use Imports carefully and conscientiously when building own custom levels. Specifically, clarify with the creator whether you are authorised to use custom assets. If in doubt, use assets that are guaranteed to be acceptable for use in your own custom levels instead. Please also note that this tool is licensed under the MIT licence.

Batch File Loader

Batch Loader

  • Import multiple image files from folder
    Supported formats: TGA, DDS, PNG, BMP, JPG, JPEG
  • Select or reopen folder
    • ... or simply drop a set of supported image files on preview panel.
  • Set Range:
    • First Texture Index
    • Number of Textures
  • Define square resize size for textures

Offset Tab (Source Panel)

Offset Tab

From left to rigth:

  • Set X offset
  • Set Y offset
  • Reset offset
  • Toggle grid on/off
  • Change layout

Format Tab (Source and Destination Panel)

This tab allows you to modify the format of the destination texture panel. TgaBuilder now fully supports the opening, modification and writing of both 24-bit and 32-bit pixel formats.

Format Tab

From left to rigth:

  • BPP toggle
  • Eyedropper to set color to replace
  • Selected color to replace
  • Replace selected color with magenta or transparency
  • Auto-apply magenta or transparency replacement for new selections

The BPP toggle will be set automatically depending on the input after loading. You can then set it manually if you wish. If you select RGB 24 BPP, magenta will be used for transparent parts. If you select BGRA 32 BPP, you will have a real alpha channel. Switching between the two settings will set the pixel values appropriately (e.g. alpha = 0 areas will be converted to magenta areas, and so on).

Format

Switching from BGRA 32 BPP to RGB 24 BPP will set the magenta colour correctly, but since pixels with an alpha value other than 0 or 255 are not supported by RGB 24 BPP, information will be lost, possibly making the switching step irreversible.

View Tab (Source and Destination Panel)

View Tab

From left to rigth:

  • Fit panel width to viewport
  • Fit panel height to viewport
  • Set zoom to 100%

Placing Tab (Destination Panel)

From left to rigth:

Placing Tab

From left to rigth:

  • Enable Resize to Picker mode (resize selection to destination picker size)
  • Enable Swap and Place mode (put replaced tile into selection)
  • Enable transparent overlay (do not draw magenta/alpha 0 to destination) TransparentOverlay
  • Set Opacity for placed tile Opacity

Size Tab (Destination Panel)

From left to rigth:

Size Tab

  • Set destination panel height (in pages, max 128 pages)
  • Set destination panel width (in pages, possible values 1, 2, 4, 8 or 16 pages)
  • Enable texture rearranging during width changes TextureRearanging

Mode Tab (Destination Panel)

Same functions as in TBuilder. From left to rigth:

Mode Tab

  • Standard tile placing
  • Rotate tile
  • Mirror tile horizontally
  • Mirror tile vertically
  • Tile Rally mode: move one tile and shift all tiles inbetween
  • Swap Tile mode: swap two tiles

Keyboard Shortcuts

Key Combination Description
Ctrl + A Create a new texture panel
Ctrl + C Copy selection to clipboard
Ctrl + V Paste from clipboard to selection
Ctrl + Z Undo
Ctrl + Y Redo
Ctrl + S Save destination texture panel
Ctrl + Shift + S Save destination texture panel to new / other file
Ctrl + E Open source texture panel
Ctrl + D Open destination texture panel
Ctrl + Q Import from TR Level
Ctrl + W Open batch loader

Limitations

  • The height of any bitmap/texture panel handled by this tool is currently capped at 32,768 px or 128 pages (~256 px length per page). This limitation is required to avoid issues with the .NET WPF Bitmap containers.
  • The height is always a multiple of 256 px, the standard TR page width, to ensure divisibility by picker sizes.
  • Current supported destination texture panel widths: 256, 512, 1024, 2048, 4096 px (corresponding to 1, 2, 4, 8, and 16 pages).
  • Current supported picker sizes: 8, 16, 32, 64, 128, 256 px
  • Image files that do not meet these requirements will be automatically expanded or cropped. But you will always be able to open them.

License

This project is licensed under the MIT License.

Third-Party Libraries

For WPFZoomPanel I did some custom modifications and adapted it to .net 8. This modified project is included in this reporsitory as well.

Package Version Source License Project URL
WPFZoomPanel - GitHub MIT GitHub
Pfim 0.11.3 NuGet MIT GitHub
bzPSD 0.1.0 NuGet BSD-3-Clause license GitHub
WPF UI 4.0.3 NuGet MIT GitHub
Microsoft Dependency Injection 9.0.6 NuGet MIT Microsoft
SharpZipLib 1.4.2 NuGet MIT GitHub

I would like to express my gratitude to the TombEditor team and the authors of TRosettaStone. Their imppressive public contributions immensely helped me understanding the TR level file format.

Contributing

Contributions are welcome! If you find a bug or have a feature request, please open an issue.
If you want to contribute code, feel free to fork the repository and create a pull request.

Support

If you have any issues, please open a GitHub Issue.

To Do List:

  • Fix bugs
  • Migrate from WPF to Win UI 3 or Avalonia

About

Texture Panel Building tool for TRLE

Resources

License

Stars

Watchers

Forks