- 1 PEVtools and Fixing Assets
- 2 Acquiring and Installing PEVs tools
- 3 Tutorials for PEV's Tools
- 4 Images2TGA
- 5 PM2IM
- 6 Trainz Mesh Viewer 2
- 7 QuickShadows
- 8 Using PEVtools in batch files outside CM
PEVtools and Fixing AssetsEdit
Trainz user and retired electrical engineer PEV (Peter Villaume has written some tools for fixing content, applicable to several Trainz generations, useful for maintenance and modification of assets in running TRS2004—TS2012.
- There is a N3V Wiki page at giving some bare bones how-to in using these as well as download links, and more information on ShaneTurner's resource site.
- Following is a list of 3rd party tutorials
- As well as our own two cents on using the tools with another 3rd party utility after giving this advice: Four PEVtools are essential to repair and update older assets: Images2TGA, PM2IM, QuickShadows, and Mesh Viewer2.
Acquiring and Installing PEVs toolsEdit
PEV's tools will be maintained by the community on one website or another as they are invaluable. Peter V. is a real programmer situated on the opposite (or Sydney) side of Australia from N3V/Auran's small town location on the Gold Coast near Brisbane, but ceased hosting his tools on his own website in mid-2013 when the task was taken over by Trainz fan Shane Turner on.
- Locate PEVs tools on Shane's site and their accompanying manuals where these are given.
- Download the tools (zip files), and quit out of any Trainz versions you may be running.
- Do not install PEVtools until you have installed all versions of Trainz you intend to run. (The PEVtools installers will need to know where those Trainz sub-directories are located, and they must be present first.)
- As always when quitting Trainz, Hit [CTRL][SHFT][ESC] to bring up file manager to watch until the TADdaemon module exits before doing anything else. (This is much faster after TS12-SP1+hf3, but an ongoing problem in earlier installations such as TS2009 and TS2010.)
- Once the TADdaemon closes it is safe to reboot or otherwise mess with Trainz directories (backup the folder, duplicate the local folder, or other maintenance such as adding PEVtools).
- Set a system Restore point, label it as Pre-PEVtools installation then reboot. (This ensures all of Trainz is off, and the cache is free.)
- Open your downloads folder, in VISTA and newer Windows versions in succession. Many of us maintain a Trainz tools directory, in which case, drag the installers into that folder. Then...
- Right Click-Hold (RMBHd) to Launch,(RUN AS ADMINISTRATOR dropdown) each of PEVs tools in succession.
Each of PEV's tools will ask if you have TS2009, TS2010 and TS12, then store the information in an .ini file in a sub-directory specific to that tool. Consequently some power users prefer to install PEVs tools in an easy to reach common directory with a brief name and include the folder in the path (Very DOS era, but PEVs tools are handy used in a batch file and the ability is in Windows still. See Setting up PEVtools for some useful tricks and methods with batch files beyond the basic auto-install.)
- Once your tools are initialized in each of the TRAINZ versions you have installed, you will see under 'the Version-path root folder' '..\bin' sub-directory the pathspec ..\bin\CMPData\tools\OpenWith which will now contain PEVtools batch files that were installed in each initialized version of Trainz.
- This means if you run several versions of Trainz releases (with several SPs and hotix combos like some of us), to install PEV tools in each, you must copy the batch files to the off-version and hand-edit the pathspecs within for that installation.
- The same batch files can sometimes be used more fully and conveniently outside Trainz CM by copying these launchers into the local '..\UserData\editing' folder— again with a little hand editting needed for the subdirectory path. In this location one can open the asset for editing, 'then drag and drop' the assets folder onto the PEVsoft tool batch file icon.
- Even better the clever Trainzer can edit said batch files and create a composite file that enables a single drag and drop to run all the tools. This 'All-in-order' batch file can also be placed into the ...\tools folder in the \bin directory.
Tutorials for PEV's ToolsEdit
John King's Trainz Resources NewsLetter published a series of tutorials on PEV's Trainz Tools. They covered:
Images2TGA for manipulating all image types used in Trainz
PM2IM for conversions of Progressive Meshes to Indexed Meshes
QuickShadows for creating simple shadows where needed
AttachmentMaker add attachments to assets in minutes
Reprints of these are available from Shane's download page.
- Attachment Maker
A program to add attachment points to existing assets by creating an invisible mesh with those points. Very simple and quick to use; add attachments in minutes.
A program to uncompress N3V's filename.texture" files as they are internally packed and stored during asset committing by Content Manager. This exposes the various image files and the howto use instruction 'texture.txt files to manipulation and viewing all image types used in Trainz. The TGA on the title is merely a reflection of those being the original preferred image format for texture files.
The program can also convert any image to another format, as well as add and manipulate alpha images. You can attach your favorite image editor to allow opening of images for edit from within Images2TGA. The program handles the latest dxt compressed textures and allows conversion of these images to other formats. The trawl feature can be used to convert textures to TGAs.
- This program supercedes the two older generation of PEVtools Texture Viewer 2.exe and Texture2TGA.exe. The last release of this tool was in 2010, and can be , along with a PDF file tutorial.
- A tool program to convert the really outdated Auran progressive meshes (PM) to indexed meshes (IM). An option is provided to alter specular values that can cause unwanted shine on object surfaces.
- This program can also be used to remove unsupported (texture stripping) texture types from IM meshes, when run in direct mode, so install a launcher shortcut in your editing folder or associate the im file type with the tool as in the below Tip and Trick.
Note: many texture faults can be fixed by reextracting the .im file with PEV's PM2IM program, use it standalone from inside Windows (Open to point it to the asset folder) or can be put in a batch in ..\editing or launched (first) from inside CM's RMBHd drop down menu.
Trainz Mesh Viewer 2Edit
This program is able to display complete traincars and textured meshes, allowing viewing of the partial or total asset.
- Current version is 2.25, released on the 18th November 2013.
- It allows one to take usable screenshots of the assembly, examine attachment points, get poly counts of the meshes, see those in several modes including wireframe and with or without axis scaled in meters or feet and inches.
- Such modes all allow rotation, zooming and tilting so an aspect of the asset can be examined in detail with a bit of practice.
- CTRL+arrow keys allow the asset's origin to be offset so one can zoom in on a particular area of interest. SHFT+arrow keys allow one to shift the centering so zooming is on target and relevant when the asset is large and the beginning reference co-ordinate axis is off center. (Both manipulation types could use improvement, but with a little patience and enough keystrokes they tell one what one needs to know to patch or decide what else needs be done.
- Bump mapped meshes can be viewed.
- attachments can be viewed separately, as can Traincar parts such as bogeys, horns, and other components with separate meshes. All can be oriented then imaged to create necessary thumbnails for Trainz asset repairs.
- Completed traincars are displayed on length of track and a simple textured groundplane. The backdrop coloring can be customized for examination or screenshots. This alteration is particularly helpful for some screenshot needs.
- Note: Bogeys on some traincars using a single bogey type may not display properly with one legal configuration of the bogeys container, but do for the alternative (simple version). When you see a single wheel centered in a two wheel bogey, you'll be observing this first hand.
- The tool can be used with older assets (v1.3-v2.4) after converting PM2IM, if one merely temporarily changes the trainz-build code value to v2.5 or above, then saves (and uses the tool to view and snoop... before reverting the change, or not!
- The texture view feature allows one to eliminate faults caused by inclusion of an extra texture file, somewhat common in older assets, where an unused texture.txt (with or without the matching .tga file) is in a asset folder, but not used by the mesh file at all.
- And best of all, the texture view feature allows one to ascertain where and how a missing texture's (by name or filename) is mapped, so one can generate or find a replacement from other assets.
PEV has also written a tool for creating asset shadow meshes and with embedded texture fixes (updates of older assets), called QuickShadows for Traincars, bridges, and the few other asset types which require such from TRS2004 when the feature began for such assets through TS12. Quickshadows will take any Trainz mesh and create a shadow mesh based on the input it gets fed. TANE make's dynamic shadows for everything, supposedly[note 1] so at this writing we infer adding such to assets will be more for the sake of completing compatibility with older versions than of actual necessity.
Quickshadows has several modes for making traincar shadow meshes, which should be experimented with to find a proper minimal polygon shadow for the asset. Clicking the Low Poly shadows option should resorted to only for a complex traincar, such as locomotives. For most rolling stock and buildings, the simple shadow click box settings do fine.
- PEV's installing software will add the '-close' switch to the commandline inside the batch file unless the Mesh Viewer2 or other Mesh Viewer is found during initialization of quickshadows, so that ought to be initialized first.
- However, the ini file is a editable text file allowing revisiting such choices without uninstalling and reinstalling the utility. There is a binary value that can be set to zero, 'CloseOnDone=0' that will allow launching quickshadows from the Run dialog, the exe folder, or a suitable batch file allowing revisiting the settings menus should the program insist on shutting itself down.
- Like most of PEV's utilities, Peter has included a Windows Help file ('quickshadows.chm') in the quickshadows folder with term search capability detailing how to use the program.
- In the historic UTC data model structures which introduced them, the shadow mesh was normally was placed in a subfolder named by combining the asset-filename tag value with '_shadow'. PEV's tool will create the shadow mesh in the same folder where it trawls for mesh files, which is determined by the batch file when not directly invoked.
Adding association optionsEdit
- Like any executable under Windows, one can associate a file type with one or a list of files that might then thereafter optionally open that sort of file extension. The steps for this when you want right clicking a data file type to give you a choice is straightforward for a single application, but repetitive for several like the graphics/paint programs mentioned above.
| This Trainz/AM&C/PEVtools section is a stub placeholder, an outline or marker that this section of the book is otherwise incomplete. You can help the Wikibooks Trainz project by expanding it with fuller discussion of the topic.
Work needed: ... to be continued
Using PEVtools in batch files outside CMEdit
- Contributing author: Fabartus
The individual lines below correspond to the innards of the installed PEVtools on pathspec F:\TS12 at the sub-directory pathspec ..\bin\CMPData\tools\OpenWith pasted into the same batch file and accessorized by the open source freeware SAR utility fnr.exe which at the end replaces the .PM extension with .IM extensions.
- Editor's tip
As a general GSAR tool, especially in batch files, where I was hoping to use something to automatically followup PEV's PM2IM with a auto-fix of .PM to .IM in the file referencing line in the config.txt files which can be hundreds of lines.
- While I use either Notepad++ or Replacetext2.2 which both support powerful REGEX CSAR operations, including filtering on multiple files and multiple folder levels, neither was useful for the simple command line input useful in a batch file, and when I went looking on programmers tools sites I found this www.entechsolutions.com gem FNR.exe. You can read about the many features and design philosophy and download the latest version from codecomplex.com .
- The utility also has a GUI front end should you desire to run it with the extra memory overhead costs as that About page shows, and it can also be used with Microsoft Office to CSAR in documents files and handles unicode international alphabets that sometimes trouble Trainz assets. It literally finishes before I can blink!
@echo on REM File: ..\UserData\editing\$$_All-but-viewer.bat "F:\PEVSoft\Images2TGA\Images2TGA.exe" -trawl -close -fixcolour %1% "F:\PEVSoft\pm2im\PM2IM.exe" -trawl -close %1% "F:\PEVSoft\quickshadows\QuickShadows.exe" -trawl -close %1% "F:\Progs\fnr.exe" --cl --dir %1% --fileMask "*.txt" --excludeFileMask "*.dll, *.exe" --includeSubDirectories --find ".pm" --replace ".im"
- On $$_All-but-viewer.bat
For PM2IM post-processing, the only hiccup I've seen fixing hundreds of assets is that it generates a errorcode (as good software does) when it doesn't find a .PM extension to change. This also manifests in when the batch is run from inside CM. (I have a local copy (down under ..\bin) with PEVs other tools, as I do for it's Traincar partner. It beats running each in succession.
@echo off REM File: ..\UserData\editing\$$_All-In-Sequence.bat "F:\Progs\PEVSoft\Images2TGA\Images2TGA.exe" -trawl -close -fixcolour %1% "F:\Progs\PEVSoft\pm2im\PM2IM.exe" -trawl -close %1% "F:\Progs\PEVSoft\quickshadows\QuickShadows.exe" -trawl -close %1% "F:\Progs\fnr.exe" --cl --dir %1% --fileMask "*.txt" --excludeFileMask "*.dll, *.exe" --includeSubDirectories --find ".pm" --replace ".im" REM pause Press any key to view mesh and finish "C:\Progs\PEVSoft\Mesh Viewer2\Mesh_Viewer.exe" -trawl -close %1%
- On $$_All-In-Sequence.bat
For PM2IM post-processing, the only hiccup I've seen fixing hundreds of assets is that it generates a errorcode (as good software does) when it doesn't find a Traincar asset. PEVs coding skills are top notch, and the call to the Mesh Viewer creates no problems when the asset is not a traincar. This, IIRC, also manifests an errorcode return value to CM when the batch is run from inside CM. This and the above utility will report via a standard Task Complete API Window in CM, with only a note that the error code was returned. (I have a local copy of this (down under ..\bin) with PEVs other tools, as I do for it's Traincar partner. It beats running each in succession one by one by drag and drop.
Alternative local PM2IM.batEdit
If you want to see what is happening despite fast modern computer executions, you can trick out a batch file with some status messages and 'wait-for-keypress' delays such as this file incorporates:
@echo off REM File: F:\TS12\UserData\editing\$$_PM2IM.bat "F:\PEVSoft\pm2im\PM2IM.exe" -trawl -close %1% echo PM2IM done, ready to patch file extensions (*.pm to *.im) pause echo patching file extensions (*.pm to *.im) "F:\Progs\fnr.exe" --cl --dir %1% --fileMask "*.txt" --excludeFileMask "*.dll, *.exe" --includeSubDirectories --find ".pm" --replace ".im"
Note the presence of FNR.exe in the above, and a different root directory for PEVtools on 'that' computer install.
- Compare that with the PEV installed file: (with added full pathspec REM line as a ID-header.)
@echo off REM File: F:\TS12\bin\CMPData\tools\OpenWith\PM2IM.bat "F:\PEVSoft\pm2im\PM2IM.exe" -trawl -close %1%