Grid Sage Forums

Grid Sage Forums

  • November 23, 2024, 02:28:14 AM
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  

News:

LINKS: Website | Steam | Wiki

Author Topic: Command line options to create/open/export .xp files?  (Read 5155 times)

WoodDev

  • Unaware
  • *
  • Posts: 2
    • View Profile
Command line options to create/open/export .xp files?
« on: April 23, 2023, 07:40:02 AM »

Hi there! I'm currently working on a Unity roguelike project, and using RexPaint to do the layouts and special monster/item placement for my dungeon generator. Just for convenience (and fun), I've been building lots of Unity automation around it to speed up my workflow and make the whole process more seamless. I'm missing a few small commands that would help make things really smooth, so I wanted to see if any of these are possible through the command line:

- Export a given RexPaint file to PNG (+ set the path if possible, but just outputting to the /images/ folder would be totally fine)
- Open RexPaint with an existing file selected
- Create a new RexPaint image with a given name
« Last Edit: April 27, 2023, 08:08:00 PM by Kyzrati »
Logged

Kyzrati

  • Administrator
  • True Cogmind
  • *****
  • Posts: 4477
    • View Profile
    • Cogmind
Re: Are there more command line options than listed in the manual?
« Reply #1 on: April 23, 2023, 06:52:01 PM »

Hi WoodDev! There aren't any features that aren't listed in the manual, no, so if you don't see something there it's not a thing. The only current command line features are those described in the manual appendices, which were indeed special features added by request in the past.

I could perhaps add these features you're asking about as well, although having some more information would help here, since there seems to be a bit of overlap in the functionality you're referring to by this list? Like I'm trying to see where the actual content creation fits into this whole process (which also doesn't seem to be listed in order, unless they represent disparate parts of some much longer process, or even parts of some relatively unrelated processes).
Logged
Josh Ge, Developer - Dev Blog | @GridSageGames | Patreon

WoodDev

  • Unaware
  • *
  • Posts: 2
    • View Profile
Re: Are there more command line options than listed in the manual?
« Reply #2 on: April 24, 2023, 11:40:58 AM »

Hi Kyzrati! Thanks for the info! You're completely right that those commands are both not in order and not related - I was looking to solve three different problems with them.

For my content creation process, I'm using RexPaint files to define the layouts and content of rooms. Those get converted into a text asset in the Unity backend (so that Unity knows how to package them for builds), and are tied a 'RexRoom' unity type that defines all the editor specific information (such as tying the glyph 'k' to be the kobold gameobject). This works great, but has started to suffer some issues as the project scales that I think could be solved with automation.

I was looking for "open a given file" and "create an empty file" type commands to try and make the process of adding new rooms more seamless. As it stands, if I want to make a new room in a branch folder, I need to: make a rexroom object in the folder, open RexPaint, save an empty image with the right name, move that new image into the right folder, then connect that image to the unity asset. What I'd like to do is have a button on the UI in Unity that does all of that work automatically. Similarly, having the ability to open RexPaint with a file already selected would make it possible for those assets to open their rexpaint files without an intermediate step, which would help keep the Unity asset jank hidden.

The exporting command I was looking for would be mostly useful for generating previews of the rooms on the unity asset, in the same vein of trying to hide that these room prefabs are actually two different assets in a trenchcoat. It would also be nice just for being able to see what the room looks without having to open up rexpaint and check.

I've found some decent workarounds for creating new files and exporting, but I'd love to see any of those command line options become officially supported. Regardless, I've already gotten a ton of good use out of RexPaint so I won't be disappointed either way. Thank you again for the awesome tool and the help!
Logged

Kyzrati

  • Administrator
  • True Cogmind
  • *****
  • Posts: 4477
    • View Profile
    • Cogmind
Re: Are there more command line options than listed in the manual?
« Reply #3 on: April 27, 2023, 02:49:16 AM »

Hm, okay, some others who use automation with RP files instead handle it externally via their own code/means since the file format is very simple, so that's one option you can explore, but I can look into patching in these commands since it's probably not going to be too much trouble...

Edit: Okay I've implemented and fully tested these new features and everything looks like it's working as expected! But it's getting late this evening so I'll put together a new patch for it tomorrow, since I also still need more time to write a new appendix for the manual to include the relevant descriptions.
« Last Edit: April 27, 2023, 08:11:24 AM by Kyzrati »
Logged
Josh Ge, Developer - Dev Blog | @GridSageGames | Patreon

Kyzrati

  • Administrator
  • True Cogmind
  • *****
  • Posts: 4477
    • View Profile
    • Cogmind
Command line options to create/open/export .xp files
« Reply #4 on: April 27, 2023, 08:07:00 PM »

Done! You can download the patch here, with files for overwriting the latest v1.60. Edit: Patch removed, is now included in REXPaint 1.7.

I already did a bunch of tests of all the relevant scenarios I could think of and it seems to be working as expected, so hopefully this'll help you out :)

I also rewrote the relevant manual appendix with how it works:

Quote
-----------------------------------------------------------------
 Appendix H: Additional Command Line Options
-----------------------------------------------------------------

Various types of automation are supported via the use of command line instructions. In all cases the command line options here operate relative to /images/ as a base directory, or whatever alternative baseImagePath is set in the config. When specifying file names, the .xp extension is optional, and in any case where a file name or path includes spaces, be sure to enclose the entire command line option in double quotes, e.g. REXPaint.exe "-create:favorite images/sample image.xp". REXPaint exits once the operation is complete, except where otherwise noted, and feedback and/or a summary of the results can be found in the run.log file.

 Exporting PNGs
----------------
To simultaneously export every .xp file as a PNG image, simply add the "-exportAll" switch when running REXPaint. The font and character size used for all images is determined by your current REXPaint.cfg settings, and therefore font size is normally limited to those options which REXPaint can normally display on your device, although this restriction can be circumvented by enabling the unlimitedFontSize option described earlier.

Export an individual .xp file as a PNG via "-export:XXX", where XXX is the relative path and file name, e.g. "-export:testimage" or "-export:subdirectory/test image".

 Creating/Opening Images
-------------------------
Create a new .xp file via "-create:XXX", where XXX is the relative path and file name, e.g. "-create:testimage" or "-create:subdirectory/test image". The new image will simply be an empty black canvas using the default image dimensions, or if an image of the same name and path already exists, no action is taken. Non-existent subdirectories cannot be created via this command, and must be created manually.

Open REXPaint with an existing .xp file preselected via "-open:XXX", where XXX is the relative path and file name, e.g. "-open:testimage" or "-open:subdirectory/test image". If the file does not exist yet, it will be created, but new subdirectories cannot be created via this command, and must be created manually.
« Last Edit: January 09, 2024, 09:03:47 PM by Kyzrati »
Logged
Josh Ge, Developer - Dev Blog | @GridSageGames | Patreon