.com.unity Forums

.com.unity Forums (http://forum.shrapnelgames.com/index.php)
-   WinSPMBT (http://forum.shrapnelgames.com/forumdisplay.php?f=78)
-   -   Next Generation SHP Viewer (http://forum.shrapnelgames.com/showthread.php?t=53129)

MarkSheppard October 9th, 2024 10:15 PM

Next Generation SHP Viewer
 
1 Attachment(s)
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).

https://i.imgur.com/V6lAvWk.png

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.

DRG October 10th, 2024 08:31 AM

Re: Next Generation SHP Viewer
 
As a simple SHP viewer, it is faster than ShpEdit to call up a SHP file but that is all it is for v0.00.

I see the potential is there to be more though

MarkSheppard October 12th, 2024 09:51 AM

Re: Next Generation SHP Viewer
 
2 Attachment(s)
Version 0.00L

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)

https://i.imgur.com/vXBmOUR.png

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

DRG October 13th, 2024 08:15 AM

Re: Next Generation SHP Viewer
 
The default palette for viewing game Icons should be the Icon only palette NOT the full palette

The "Organize in two rows for Turreted Vehicles" is a nice touch

MarkSheppard October 13th, 2024 03:10 PM

Re: Next Generation SHP Viewer
 
1 Attachment(s)
Quote:

Originally Posted by DRG (Post 856878)
The default palette for viewing game Icons should be the Icon only palette NOT the full palette

Version 0, Ausf M changes to that as teh default palette.

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:

You can now load SHP files contained within ZIP images, or from a folder on your hard drive; with the option to load all, or just the icon SHPs.

https://i.imgur.com/KxI1F2Q.png

This was a direct load of the exact ZIP file contained in this post

https://forum.shrapnelgames.com/showthread.php?t=52719
P-51D, F-51D, Cavalier, Piper Mustang evolution after WW2

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 :shock: but there is this nice surprise at the end for you at Icon0196.shp:

https://i.imgur.com/OkYvZwV.png

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:

https://i.imgur.com/pLgNwKX.png

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 :shock:

DRG October 13th, 2024 04:17 PM

Re: Next Generation SHP Viewer
 
Quote:

.............there is this nice surprise at the end for you at Icon0196.shp:

https://i.imgur.com/OkYvZwV.png

I wondered when someone would notice that <G>

DRG October 13th, 2024 04:27 PM

Re: Next Generation SHP Viewer
 
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

:up::up:


I've even found things I had forgotten were there!

MarkSheppard October 14th, 2024 10:00 PM

Re: Next Generation SHP Viewer
 
1 Attachment(s)
Version 0, Ausf P

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:

https://i.imgur.com/MwHO9Ut.png

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:

https://i.imgur.com/hDkHGoc.png

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:

https://i.imgur.com/QXdNcSj.png

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).

MarkSheppard October 14th, 2024 10:12 PM

Re: Next Generation SHP Viewer
 
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.

RecruitMonty October 15th, 2024 11:21 AM

Re: Next Generation SHP Viewer
 
What a good idea.


All times are GMT -4. The time now is 10:23 PM.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©1999 - 2025, Shrapnel Games, Inc. - All Rights Reserved.