ruarai / CompilePal

A tool to assist in the compiling of source engine maps
GNU General Public License v3.0
224 stars 26 forks source link

Added functionability for custom compile steps #97

Closed nthSonata closed 4 years ago

nthSonata commented 4 years ago

I'd like to be able to use CompilePal to compile with more complicated programs as intermediaries by launching them through CompilePal, and using CompilePal's functions to run said programs, as opposed to running the programs myself through a command line prompt. Currently, though custom compile steps are supported, there isn't much you can do with them, particularly with having them work on specific files, and have CompilePal work on an intermediary file outputted by the custom compile step.

An easy way for CompilePal to tell custom compile steps which files to use would be to allow the COMMAND LINE ARGUMENTS input to accept variables that CompilePal already uses for compiling, such as $vmfFile$ and $bsp$ and $mapFolder$ and the like. If you wanted to pass the program the an argument like $bsp$ without interpreting it as one of CompilePal's internal variables, it'd be easy enough to escape it with a backslash (\) character (and to escape a backslash with another backslash).

For CompilePal to read an outputted file as an intermediary, you could do something similar, with having an option to set or overwrite an internal variable with an outputted file, or define what an outputted file should be on a per-program basis, i.e. file type, location, and name (based on the input file). This way, it would be easy to run a custom compile step that can modify the .vmf or .bsp in many different ways, while still being fairly simple for the user to do.

The specific reason why I have this request is because of VMMC, a tool FubarFX/maxdup created to collapse a .vmm into a .vmf so it can properly be compiled by VBSP. With how CompilePal currently works, it is impossible to pass it a specific file, and there's no way for CompilePal to use the collapsed .vmf as an intermediary. If I could pass VMMC a .vmm I've selected to compile through CompilePal, then tell CompilePal to look for a .vmf with the same filename as the .vmm in the same folder and set that as the new $vmfFile$, that would allow me to compile manifests a lot quicker.

It would also be nice to be able to add test conditions for custom compile steps, such as checking if a file is a .vmf or a .vmm, and only running VMMC if it's a .vmm, so I can batch compile multiple different kinds of maps at once, rather than having to change the compile processes and compile them separately, though this is something which can be accounted for by the custom program, so is less important. You could also look into perhaps including VMMC with CompilePal, as Fubar is a contributor to CompilePal.

Thank you!

Exactol commented 4 years ago

This has been added in the newest version: https://github.com/ruarai/CompilePal/releases/tag/v027.6 Documentation on how to use: https://github.com/ruarai/CompilePal/blob/master/Guides/Custom.md#modifying-the-current-game-configuration