So; this is something I knocked out over a few hours with ChatGPT + Fred Chlanda's old SHPEd code that he released decade(s) ago.
You might be wondering "Where's the file? Where's everything?"
Everything is contained in that HTML file; you can open it up; it's only 275 lines of code to inspect (of which 40 are used to define the SPCAMO palette).
A lot has changed over the last 15 years -- web browsers have become standardized multi-purpose machines with Javascript + HTML5 elements -- there was some early tentative steps this way back with Panzer Command and a scenario generator/editor that used Internet Explorer; but it was the early days of that and it quickly broke with the advance of the internet.
But now that things have standardized, as long as you don't attempt to do anything too crazy; HTML5 code will last a long(er) time (hopefully).
Right now; this is just a "proof of concept" to prove that you can read SHP files and display them graphically in a Chrome-based browser (which is everything nowadays). I've tested it in Chrome + Edge and they both work.
Potential future work:
1.) Integrating the Master Icon Lists so that you know right away what something is without having to cross check.
2.) Figuring out how to dump the SHP icon files with their header data included so that you can easily import them into other SHP files and everything automagically updates.
3.) Integrating other Palettes (and option of loading your own JASC PIC PAL file)
But for now I'm just going to sit back and see what shakes out of this -- the biggest advantage of this primitive v0 is that you now can use a modern Windows dialogue/file path box, allowing cut and pasting of your SPCAMO path instead of having to navigate up down the file tree to it.
Last edited by MarkSheppard; October 9th, 2024 at 10:25 PM..
The Following 7 Users Say Thank You to MarkSheppard For This Useful Post:
Major Changes:
I've started to separate major things into individual javascript .js files to keep things organized -- this was needed for the 146kb of palette information I added.
Also; there's a third-party javascript library - jszip (NextGenSHP_Viewer_jszip.min.js) included to handle ZIP functionality within the program.
What's new:
There's an option to organize in rows of 2 (to make turreted SHP files look more organized)
I hard coded as many palettes as I could in -- including all of the original PALs that shipped with Fred's SHP Edit many moons ago. Default is the current (2021+) SPCAMO full icon palette.
To Swap palettes or organize in rows of 2, select your new palettes or click on the organize in rows of 2 checkbox and then push the RELOAD button.
To save an individual icon; just right click on any of the icons and choose SAVE IMAGE; a PNG version helpfully named:
{filename}+{4 digit leading icon position}.png will be downloaded to your DOWNLOAD directory.
So if you were saving the second icon from a file named icon0090.shp, it would be named: icon0090-0002.png
The Export SHP to ZIP button dumps all the SHPs using that above terminology into a new zip file in your download directory; named after the original SHP file. Thus, if your file was icon0090.shp, the file will be icon0090.zip.
Also, there will be a metadata CSV file inside the zip file -- containing the following information
Last edited by MarkSheppard; October 12th, 2024 at 09:59 AM..
The Following 7 Users Say Thank You to MarkSheppard For This Useful Post:
Making it easier to evaluate mods that are posted on the forum.
Using the "load entire folder; only for icon files" feature is considerably faster on:
WW2\Game Data\Graphics
than it is on
MBT\Game Data\Graphics
It takes a while (a couple minutes) to load all 11,200 or so icons for MBT but there is this nice surprise at the end for you at Icon0196.shp:
FYI, total memory use for that Chrome tab with every single MBT icon loaded was 392~ MB; something easily afforded today.
There's a revised right click dialog for hovering over individual SHP icons:
Copy to Clipboard saves it as a paint shop pro compatible cut and paste image.
Save Image as PNG is slightly obvious -- it saves it in this case as Icon0105-0002.png (2nd icon slot in ICON0105.SHP).
Export SHP to ZIP works, even for an entire MBT icon folder run through -- as before, it works a bit slow; but eventually coughs out the file -- in that specific use case, a 17.3 MB file containing 11,199 individual PNG files
The Following 5 Users Say Thank You to MarkSheppard For This Useful Post:
be very careful about loading entire folder folders!
YEP
There are a LOT of Icons
What is nice from my POV is if a section needs a closer look a simple "print screen" on my keyboard picks them up which is what I can do with ScenHack now but this picks up in bulk
I've even found things I had forgotten were there!
__________________
"You are never to old to rock and roll if you are too young to die".--- What do you expect to be doing when you are 80?
NOTE: I had to add a password - SPCAMO - to the zip file to upload it; because the forum upload software kept blocking it.
There's a bunch of new features here:
Scaler -- scale the icons by 1x, 2x or 4x; because we're all getting old. I was a teenager when SP2 was released and you can guess my age now. Also, a zoomed in option lets you inspect icons carefully now.
Draw SP Header Cross-- Graphically represent the "centroid" of the icon as put in the SHP header and editable through
SHPEd's "Fix SP Header".
An example of how you can combine the SP Header Cross and 2x Zoom/Scaleup is this one:
NOTE This software is a bit non-idiot proof - in that there's no internal checks on saving/exporting when you have higher zoom levels (2x or 4x) or the SP Header Cross selected -- it will happily export the scaled up images or the header cross images -- so always doublecheck to see if you're in 1x mode and that cross checkbox is unchecked....
The right click menu is slightly changed:
You can now dump a single image, two images (for turreted icon slots), and "n" amount of images (if you want to dump 3 turreted images, you'd put in 6).
Last edited by MarkSheppard; October 14th, 2024 at 10:16 PM..
The Following 3 Users Say Thank You to MarkSheppard For This Useful Post:
One of the things I need to do next is to systematically validate the image decompress routines by comparing SHPEd BMP images with the PNG images generated by this; to ensure that pixel values are correct; because if they're off slightly; errors can start compounding if this is used as an alternative for MOBHack + Print Screen + Paint Shop Pro; and somewhere there's a bug making pixel values off slightly.
The Following User Says Thank You to MarkSheppard For This Useful Post: