NearInfinityBrowser / NearInfinity

An Infinity Engine Browser and Editor
https://github.com/NearInfinityBrowser/NearInfinity/wiki
GNU Lesser General Public License v2.1
87 stars 37 forks source link

FR: automatically find a free PVRZ page file index when creating new BAMv2 files #187

Open lynxlynxlynx opened 6 days ago

lynxlynxlynx commented 6 days ago

The index used (1000) can be modified in Options, but if you're working on several images, updating that all the time is unwieldy. Plus, if it creates more than one page, the tactic may fail.

So I suggest that when creating new BAMs (vs editing existing ones), the index is computed instead, eg. last used +1 or +10.

To paraphrase a user from the forum:

For creating sprites I render it into png and gather into one bam-file by using convert tool from Near Infinity. But there is a problem, that I don't know how to solve yet. When Near Infinity saves this bam, it store sprite information in the separate pvrz-file with default name MOS1000.pvrz. So, when I save another file, it overwrite the previous one. How it's possible to set unique name for each pvrz-file?

Argent77 commented 5 days ago

That's difficult to realize since there are many ways to circumvent the PVRZ tracking:

  1. A check for existing PVRZs in the game would fail if BAMs are saved outside the game folders.
  2. Using a session-scope variable to track saved PVRZs would fail if you use the BAM Converter in separate NI instances, or if you also use the MOS converter to create MOS V2 files. Tracking PVRZs in a persistent way would be a nightmare to keep synchronized between individual NI instances and would also eventually lead to an overflow.

I could probably implement it in a way that only considers existing PVRZ files found in the game (biffed or override folders).

lynxlynxlynx commented 5 days ago

Yes, a file based approach should suffice. After all, the problem is getting files overwritten, nothing more. Since the index is baked into the file the obvious idea of prompting for different filenames would be annoying to do.

Can you abort the export if clobbering is about to happen? The typical "do you want to overwrite" prompt?

Argent77 commented 5 days ago

Currently existing PVRZ files are simply overwritten without prompt. Adding a simple file tracker sounds like a good idea.

Btw, only the default PVRZ start index is set in the converter options. The start index for the current session can be modified directly in the BAM converter Frames tab when you select BAM V2 output.