Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

I made some new TEXTURE cleanup tools for SLADE

Recommended Posts

I added another option to clean all unused ZDoom textures.


This way you can put together a giant megatexture pack that you reuse for all your projects, and once ready to release, clean up all the unused ones.


The vanilla Remove Unused Textures/Flats tools that exist now before my addition don't check flats on walls, or wall textures on ceilings/floors, like zdoom supports.  Also this handles reading the animdefs files to exclude animated textures from being cleaned.  It will also remove the texture/flats image files and also modify the TEXTURE lumps and zdoom TEXTURES files.



Share this post

Link to post

Very nice work, especially with checking ANIMDEFS for extra textures.


If you want to create a truly thorough tool for removing unused (G)ZDoom textures, there are a few other places they could be being used:

  • GLDEFs and its respective libraries
  • ZSCRIPT and its respective libraries
  • ACS scripts, both in the Scripts folder and in individual WAD files
  • Any OBJ or MD3 models (especially OBJ models that are exported geometry from UDB).

There might be others too, but in my experience those are all the places a texture can be "used" in a GZDoom project outside of the map lumps themselves. If you exclude those from your checks, there's a chance your tool will strip out textures that are crucial parts of a project, and the user would need to manually add them back in.

Share this post

Link to post

Oh true, I do have a warning about it omitting checking scripts.


Another way around that for now is to keep those things in a separate archive and merge them together when ready to release.  This tool currently scans for all map data in the archive, and any textures in the same archive.  This includes wad files for indivdual maps, like Zdoom supports.  If you have textures and obj files in a different archive they'll be safe.  While developing, just load multiple archives at a time.


There is a dialog that lets you manually omit textures by name at least, and that was code I copied from the other tools.


SLADE doesn't currently parse a lot of those things out of the box so it's not an easy task.  Even my Animdefs support is kinda just, hey lemme find all the tokens in the file that say Pic, and the next token is most likely a texture name.  And every time I see the word texture/flat/switch/animdoor, the next token is also a texture name.  And if I see Range, assume the number at the end is the range of textures to omit.

Ideally, all of those files need to be opened and processed according to spec, and read into a full on data structure that makes it easy to work with the data.  So far, ZDoom Texture files are read this way, and some of the binary Boom anim definitions too, since binary data is very easy to load due to not needing a language parser.

Supporting those extra Zdoom format files could be work for another time, either by Sir Juddington himself, or other people in the community such as myself.  Then there are other engines like Eternity that may have their own special files and support may need to be added for that too.  His code for finding unused textures and flats just opens UDMF text files and does a light weight parse of that as well.  Maybe he doesn't feel like loading a full map file in for this operation even though SLADE has a level editor and should support UDMF fully.  That's code I haven't even delved into.

Edited by illYay1337

Share this post

Link to post

Oh nice, Sir Juddington is alive and well!  He just merged my pull request in and posted some new instructions for compiling on windows that should make things much easier.  Hopefully an official release will come out soon with these changes.

Share this post

Link to post

Well, it's now available in the 3.2.0 beta release.


I've been using the new tools to work on a huge base texture pack. https://github.com/ill/DooM_illTextureCompilation

(Never thought I'd use github for doom)


I basically took a a huge amount of the texture packs from Realm 667 and cleaned them up quite a bit.


Then when I'm ready to release a map pack I can use the remove unused textures tool.


I realized there's another potential optimization.  A lot of texture packs have textures built from patches stacked on top of each other.  Like a 64x128 texture that's made from the same 64x64 patch, one above the other.  I've been cleaning these up manually, but detecting and deleting the texture entry, and turning its patch into a texture, should be possible later.

Edited by illYay1337

Share this post

Link to post

I made another update. https://github.com/sirjuddington/SLADE/pull/1391


This time it helps find duplicate texture names across all flats and textures defined as individual images while also cross referencing all TEXTURE files in original doom and also zdoom format.


Also it checks for duplicate patches across the ptable file and all patches that may be raw images in a zdoom archive.


This should help make sure you have no name clashes when working on a giant texture pack.  Especially when merging multiple texture packs together.


I also briefly looked at the GZDoom source to see how possible it may be to bring over some of that code over to SLADE to make it read all the different GZDoom language files natively in the exact way GZDoom does so you don't need some special language parsers.  It'd be especially awesome to some day have a specialized ZDoom project editor with an interface similar to Unreal/Unity with fancy tools for textures/switches/animdefs/sprites, etc...  I'd still leave the level editing to Doom Builder 2 though hands down.


Another tool I'm really considering adding is a way to detect textures made in the Textures files that just consist of tiled patches that result in an unnecessary texture.  There are so many texture packs where people made a texture that is 64x128 that is just the same 64x64 patch tiled one on top of the other.  Being able to detect that and remove the texture entry along with my "Delete single patch textures" tool would really help clean up texture packs.

Edited by illYay1337

Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now