Menu

LEX File Exchange
EA Support Files
SC4 Wikipedia
Network Addon Mod
Dependencies
Chat

Author Topic: Batch Png to Fsh tool  (Read 52807 times)

0 Members and 1 Guest are viewing this topic.

Offline null45

  • Lex Certified
  • Forums Mayor
  • *
  • Posts: 221
  • Total likes: 27
  • Reputation: 18
  • CL:
    All formats lead to FSH
Batch Png to Fsh tool
« on: June 05, 2009, 11:29:16 PM »
This is a tool I wrote to convert multiple png / bmp images into fsh images.
It takes a list of images and converts each image into a fsh file of the same name.



The mipmap combo box selects the type of mipmaps to use.
The "Compress dat" function compresses the items when inserting them into the dat.

The simplest way to create a batch list is to drag and drop a group of images onto the list.
Draging and dropping a group of images onto the "Add" button will add them to the existing list.

The other way to insert images is the "Add" function, this relies on "Groupid.txt" for the Group to assign the images to and "instRange.txt" for the Instance range to use.

In the "Add" function the Group id in the Group box overrides the one in "Groupid.txt" and if the image contain transparency and the file name begins with hd it will be a 32-bit hd fsh, if the image is not transparent and the file name begins with hd it will be a 24-bit hd fsh.

If the file name begins with 0x it will use the file name as the Instance.

To change the group, instance or Fsh Type of an image you must select that image in the list.

Dragging and dropping a group or folder of images onto the program will add them to a new list.

Download: Png to Fsh Batch

I hope it is useful  ;)   
« Last Edit: July 19, 2016, 03:41:50 AM by null45 »

Offline Pat

  • when life tosses you lemons, make lemonade!
  • 3RR Team
  • Forums Legend
  • *
  • Posts: 8812
  • Total likes: 6
  • Reputation: 45
  • SC4D Podcast, You Know You Wanna Hear IT!!!!
  • CL: ()pathfire() gettin' it right!
Re: Batch Png to Fsh tool
« Reply #1 on: June 05, 2009, 11:36:14 PM »
sweet new tool here Null!! I will have to check this out further when I get home next week...

Don't forget the SC4D Podcast is back and live on Saturdays @ 12 noon CST!! -- The Podcast soon to Return Here Linkie

Offline sithlrd98

Re: Batch Png to Fsh tool
« Reply #2 on: June 06, 2009, 03:00:19 AM »
Yes it is! Been using 1.2 and it has made texture replacement so much faster! Again , thanks for doing this!

Just noticed that now you truly have made this exactly as I had hoped...completely effortless! What you see on the right is exactly the same as the left! You don't know how much time this saves me and other re-texture modders. I should have asked you about this much sooner! Thank you again!


Jayson
« Last Edit: June 06, 2009, 08:06:46 AM by sithlrd98 »

Offline null45

  • Lex Certified
  • Forums Mayor
  • *
  • Posts: 221
  • Total likes: 27
  • Reputation: 18
  • CL:
    All formats lead to FSH
Re: Batch Png to Fsh tool
« Reply #3 on: June 10, 2009, 09:33:19 PM »
A few bugs fixed. File version should now be "1.3.1.0"  :)

Offline sithlrd98

Re: Batch Png to Fsh tool
« Reply #4 on: June 10, 2009, 09:42:32 PM »
Getting "Invalid File. This error has been forwarded to MediaFire's development team."


Working now....
Jayson

Offline null45

  • Lex Certified
  • Forums Mayor
  • *
  • Posts: 221
  • Total likes: 27
  • Reputation: 18
  • CL:
    All formats lead to FSH
Re: Batch Png to Fsh tool
« Reply #5 on: June 24, 2009, 10:04:10 PM »
Some new features added and a few bugs fixed.  ;)

Offline sithlrd98

Re: Batch Png to Fsh tool
« Reply #6 on: June 24, 2009, 10:06:37 PM »
So...whats new? I had not noticed any bugs in the last version. I've used it a few times lately and am grateful for it!

Jayson

Offline null45

  • Lex Certified
  • Forums Mayor
  • *
  • Posts: 221
  • Total likes: 27
  • Reputation: 18
  • CL:
    All formats lead to FSH
Re: Batch Png to Fsh tool
« Reply #7 on: June 25, 2009, 11:27:06 AM »
Quote
So...whats new? I had not noticed any bugs in the last version. I've used it a few times lately and am grateful for it!

The ability to change the Group / Instance id and Fsh type of the selected item has been added.

As far as bugs go a setting in the list of batch file list that allowed more than one file to be selected has been fixed, that setting would break the radio buttons that set the last digit in the instance id and a bug in the validation of letters entered into group / instance id text boxes.

Offline null45

  • Lex Certified
  • Forums Mayor
  • *
  • Posts: 221
  • Total likes: 27
  • Reputation: 18
  • CL:
    All formats lead to FSH
Re: Batch Png to Fsh tool
« Reply #8 on: June 29, 2009, 06:17:15 PM »
Support for Dragging and Dropping groups of images into the list added, the "Batch png" function has been combined with the
Add" function and a crash and some bugs fixed.  ;)
« Last Edit: June 29, 2009, 07:09:27 PM by null45 »

Offline timcravey

Re: Batch Png to Fsh tool
« Reply #9 on: September 11, 2009, 05:43:55 PM »
I cry.  It is surely too much for simple me.  I try; but I do not understand how.

Offline sithlrd98

Re: Batch Png to Fsh tool
« Reply #10 on: September 11, 2009, 05:50:13 PM »
Tim...what prob are you having? I've been using this and Nulls other tools for awhile.I assume your trying to do something for Sim Mars?

Jayson

Offline null45

  • Lex Certified
  • Forums Mayor
  • *
  • Posts: 221
  • Total likes: 27
  • Reputation: 18
  • CL:
    All formats lead to FSH
Re: Batch Png to Fsh tool
« Reply #11 on: September 19, 2009, 05:54:58 PM »
Command line switches added, "Batch.txt" function removed and multiple bugs fixed.  ;)

Offline null45

  • Lex Certified
  • Forums Mayor
  • *
  • Posts: 221
  • Total likes: 27
  • Reputation: 18
  • CL:
    All formats lead to FSH
Re: Batch Png to Fsh tool
« Reply #12 on: November 01, 2009, 12:52:33 AM »
The ability to drag and drop folders of images onto the program to process added, multiple bugs fixed.
File version updated to 1.4.3.0    :thumbsup:

Offline Shadow Assassin

  • NAM Team
  • Forums Guru
  • *
  • Posts: 3232
  • Total likes: 12
  • Reputation: 25
  • Needs more cowbell.
  • CL: The Grid Reaper
Re: Batch Png to Fsh tool
« Reply #13 on: November 16, 2009, 12:52:45 AM »
Having a problem with PNG to FSH batch:

I got the following error:
Code: [Select]
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
   at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
   at System.ThrowHelper.ThrowArgumentOutOfRangeException()
   at PngtoFshBatchtxt.Form1.processbatchbtn_Click(Object sender, EventArgs e)
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
PngtoFshBatch
    Assembly Version: 1.4.3.0
    Win32 Version: 1.4.3.0
    CodeBase: file:///D:/Programs/PngtoFshBatch/PngtoFshBatch.exe
----------------------------------------
System.Windows.Forms
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.4918 (NetFXspW7.050727-4900)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.4918 (NetFXspW7.050727-4900)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.4918 (NetFXspW7.050727-4900)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
SynapticEffect.SimCity
    Assembly Version: 0.3.1.41619
    Win32 Version: 0.3.1.41619
    CodeBase: file:///D:/Programs/PngtoFshBatch/SynapticEffect.SimCity.DLL
----------------------------------------
FSHLib
    Assembly Version: 0.3.1.32186
    Win32 Version: 0.3.1.32186
    CodeBase: file:///D:/Programs/PngtoFshBatch/FSHLib.DLL
----------------------------------------
System.Xml
    Assembly Version: 2.0.0.0
    Win32 Version: 2.0.50727.4918 (NetFXspW7.050727-4900)
    CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.

What am I doing wrong here? :\
New Horizons Productions
Berethor ♦ beskhu3epnm ♦ blade2k5 ♦ dedgren ♦ dmscopio ♦ Ennedi
emilin ♦ Heblem ♦ jplumbley ♦ moganite ♦ M4346 ♦ papab2000
Shadow Assassin ♦ Tarkus ♦ wouanagaine
See my uploads on the LEX!

Offline null45

  • Lex Certified
  • Forums Mayor
  • *
  • Posts: 221
  • Total likes: 27
  • Reputation: 18
  • CL:
    All formats lead to FSH
Re: Batch Png to Fsh tool
« Reply #14 on: November 16, 2009, 10:36:04 PM »
The only thing that I can think of is that the list may be messed up in some way. 
Do you have any steps to reproduce the issue?

Offline Shadow Assassin

  • NAM Team
  • Forums Guru
  • *
  • Posts: 3232
  • Total likes: 12
  • Reputation: 25
  • Needs more cowbell.
  • CL: The Grid Reaper
Re: Batch Png to Fsh tool
« Reply #15 on: November 17, 2009, 06:22:21 PM »
Well, I assumed I had to create five textures - one for each zoom, right?

Only three showed up in the list when I dropped the five textures in place... I tried outputting and bam, I get hit with the 'out of range' error. This is with texture mipmap turned off (I assume it's the setting that creates the various textures per zoom).

Then I tried just the zoom 5 texture... and it worked just fine.
New Horizons Productions
Berethor ♦ beskhu3epnm ♦ blade2k5 ♦ dedgren ♦ dmscopio ♦ Ennedi
emilin ♦ Heblem ♦ jplumbley ♦ moganite ♦ M4346 ♦ papab2000
Shadow Assassin ♦ Tarkus ♦ wouanagaine
See my uploads on the LEX!

Offline null45

  • Lex Certified
  • Forums Mayor
  • *
  • Posts: 221
  • Total likes: 27
  • Reputation: 18
  • CL:
    All formats lead to FSH
Re: Batch Png to Fsh tool
« Reply #16 on: November 17, 2009, 10:55:36 PM »
Well, I assumed I had to create five textures - one for each zoom, right?

The "Automatically  process Mips" generates the scaled down files when the larger images are converted.

The filter now properly removes the files 64 x 64 or smaller from the list.
File version updated to 1.4.4.0.  :thumbsup:
« Last Edit: November 18, 2009, 09:06:26 PM by null45 »

Offline null45

  • Lex Certified
  • Forums Mayor
  • *
  • Posts: 221
  • Total likes: 27
  • Reputation: 18
  • CL:
    All formats lead to FSH
Re: Batch Png to Fsh tool
« Reply #17 on: November 23, 2009, 10:11:54 PM »
A small update to display tooltips describing the functions and allow folders of images to be dropped onto the list and "Add" button.
File version updated to 1.4.4.1.  ;)

Offline Tarkus

  • Administrator
  • Forums Legend
  • *
  • Posts: 11467
  • Total likes: 5047
  • Reputation: 73
  • NAM Team Tankadillo
    • NAM HQ
  • CL: Dr. PuzzlePiece
Re: Batch Png to Fsh tool
« Reply #18 on: December 09, 2009, 03:38:36 PM »
I've been going Alpha-less and relying on the PNG transparency since I switched over to PngToFshBatch, which has saved me countless hours. :thumbsup:  I've also been updating regularly, but with the past couple versions, I've had some issues with the PNG transparency not being carried over to the lower zoom MIPs.  The transparency is coming across on the Zoom 5 PNGs, but I've been getting black space on Zooms 1-4. 





I'm using the "Automatically process Mips" and "Compress Dat" options, with the "New Dat/Save Dat" method of exporting, and I've tried every possible format setting (24-bit RGB, 32-bit ARGB, DXT 1--my normal setting, and DXT 3) and gotten the same results.  The PNGs in question are standard definition (128x128). 

The RHW intersection textures shown above were processed on November 12th, so they would have been done using 1.4.3.0, and I'm still having the issue with 1.4.4.1.  It also occurred with 1.4.4.0.   The other textures shown that aren't affected were processed with 1.3.1.0.

Thanks in advance for any assistance! :)

-Alex

Offline null45

  • Lex Certified
  • Forums Mayor
  • *
  • Posts: 221
  • Total likes: 27
  • Reputation: 18
  • CL:
    All formats lead to FSH
Re: Batch Png to Fsh tool
« Reply #19 on: December 09, 2009, 08:04:32 PM »
There was a bug in the Alpha map from transparency function that would cause it to only detect the alpha pixels that were zero, another bug in was that it would always write pure black instead of the correct shade of color.

File version updated to 1.4.4.3

I hope that fixes the problem.  ;)