• Welcome to SC4 Devotion Forum Archives.

Batch Png to Fsh tool

Started by null45, June 05, 2009, 09:29:16 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

null45

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

Pat

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

sithlrd98

#2
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

null45

A few bugs fixed. File version should now be "1.3.1.0"  :)

sithlrd98

Getting "Invalid File. This error has been forwarded to MediaFire's development team."


Working now....
Jayson

null45

Some new features added and a few bugs fixed.  ;)

sithlrd98

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

null45

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

null45

#8
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.  ;)

timcravey

I cry.  It is surely too much for simple me.  I try; but I do not understand how.

sithlrd98

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

null45

Command line switches added, "Batch.txt" function removed and multiple bugs fixed.  ;)

null45

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:

Shadow Assassin

Having a problem with PNG to FSH batch:

I got the following error:
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!

null45

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?

Shadow Assassin

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!

null45

#16
Quote from: Shadow Assassin on November 17, 2009, 04:22:21 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:

null45

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

Tarkus

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

null45

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