Official BF Editor Forums

# [tool] Bf2 Material Tool

## Recommended Posts

Hi!

I thought the MeshWrapper was a bit outdated, so I created a new GUI for the bf2materials.exe by Rexman

It's called "BF2 Material Tool" and it is the public and extended version of my private tool: "BF2 MatMan"

What the tool does: It is a graphical user interface for the commandline tool called "bf2materials.exe" by Rexman.

Features:

- Opening/Editing/Saving BF2 Meshes

- Batch tools

- Find and replace

- Export to textfile

- Plugin interface

- Localization system (Allows to add more languages)

Planned:

- Texture-rendering

- 3D Mesh-Preview

!Please note: You need the Java Runtime Environment (JRE) 1.6.0 or higher to run this tool. The JRE will be auto-downloaded if it can't be found!

Windows 2000, Windows XP SPx, or Windows Vista SPx with JRE 1.6.0 (Java 6) or higher installed

There are currently problems with the drag and drop functionality when using Windows 7

English, German:

Extensions:

The BF2 Material Tool has a PlugIn and a localization system:

You can create additional languages by translating the dummy-language in the "tools" folder and creating the ".lg" files with the "Language Creator".

English (included, created by me)

German (included, created by me) up2date (v1.0.3)

YOUR language here (Todo: Insert Uncle Sam)

File Tree (Quick-open function / included)

##########################

##########################

Short documentation:

OPEN AND SAVE MESHES

You can open and save a mesh by using the appropriate buttons or by dragging a file on the application window.

You can open a file too by starting the application with the path of the mesh as the argument.

You can reopen, one of the last 5 successfully opened files if you want.

Once you hit save, you can't redo this action.

You can save all material shaders as a bf2materials.exe readable .txt file by using the export function under:

File --> Export --> As textfile

THE BATCHTOOLS

The Batchtools are a small collection of tools for manipulating a mass of BF2 Meshes.

You can access the batchtools by clicking: Extras --> Batchtools

Currently there are 3 types of tools you can use:

Path-checker:

This tool opens selected BF2Meshes and checks if it contains paths starting at a local drive, such as C:\, D:\

If a texture starts with such a string, it will be cut at 'objects' before the modname.

Example: C:\Programme\EA Games\Battlefield 2\mods\wintermod\objects\vehicles\snowboard\textures\snowboard_de.dds

to

objects/vehicles/snowboard/textures/snowboard_de.dds

If the path does not point to the mods directory, it will be cut at the first occurenece of 'objects'

Suffix-changer:

This tool opens selected BF2Meshes and checks the endings of all textures. If they don't end with '.dds', they will be fixed.

Example: C:\Programme\EA Games\Battlefield 2\mods\wintermod\objects\vehicles\snowboard\textures\snowboard_de.tga

to

Example: C:\Programme\EA Games\Battlefield 2\mods\wintermod\objects\vehicles\snowboard\textures\snowboard_de.dds

Texture-changer:

This tool opens selected BF2Meshes and searches a selected texture in every file. If this texture was found, it will be replaced with another selected one.

Once you selected a method, you will see this screen:

You can select single or multiple files, and drag the directly from the origin on the white textarea.

If you have added all files you wish to edit, hit start.

The batcher dumps backups of every file into backups/

A logfile is written during batching. The contents of the file are the output of the batcher you see on the textarea.

Logfiles are written to logs/

You can decide if you want to create backups and logs before you hit start by clicking at the appropriate checkboxes

You can abort the batching process if you want, by pressing "Abort".

THE UPDATER

BF2MaterialTool or BF2MatMan has the ability to update itself.

The tool does by default an automatic check every 5 days. You can set this value in the options.

You can launch the updater by clicking the appropriate button.

If the updater has found a newer version, you can download and install it. The application will be closed for this process.

Once you see the updater dialog, select a path where the installer can be downloaded to. After the download, the installer starts automatically

Language Creator HowTo

The Languagecreator is a tool for creating .lg files used by the BF2MatMan or by the BF2MaterialTool

To create a .lg file, you need to create a translation first. In the directory of the creator you will find a dummy file (english)

The input file must have the following Syntax (without quotes): "LANGUAGE_ID = Translated String" or "LANGUAGE_ID Translated String"

Point to the txt file by using the browse function.

Give the language a name. The maximum is 20 chars. Example: 'Spanish by Big John'

Select the version of the language interface. Use this function if you want to create .lg files for older versions of BF2MatMan or BF2Material Tool.

Hit 'Create lg file' to save the created language. The name does not matter, just the extension. Dump it to the lang/ folder.

##########################

##########################

If you have any problems with the tool feel free to contact me directly or to post your problem / question here

Edited by mccae

##### Share on other sites

I guess many will be happy with your program

Ah, found one possible problem, which many will not get, but anyways:

If a texture starts with such a string, it will be cut at 'objects' before the modname

What if there are 2 folders with "objects", like:

"c:\program files\EA Games\Battlefield 2\mods\mod\objects\objects\staticobjects\common\texture_c.dds"

Could that interfere? When I were working on a similar app I also ran into that.

Or worse: What if there is a path like: objects\staticobjects\common\objects\texture_c.dds.

Is your app protected agains these types of (text) errors?

Oh lol, I managed to do this already, but:

Could you add one little (batch)tool to load all meshes, and display all the textures in a treeview?

Would be a great addition for people who want to place over certain vehicles, and want to know all the textures involved.

Anyways, these were the things I thought about while trying to make my app, hope it was helpfull.

I have seen your app, and it is great. Especially the gui is great and easy to understand.

My apps usually get filled with information, so Good work

Edited by bergerkiller

##### Share on other sites

I guess many will be happy with your program

Ah, found one possible problem, which many will not get, but anyways:

What if there are 2 folders with "objects", like:

"c:\program files\EA Games\Battlefield 2\mods\mod\objects\objects\staticobjects\common\texture_c.dds"

Could that interfere? When I were working on a similar app I also ran into that.

Or worse: What if there is a path like: objects\staticobjects\common\objects\texture_c.dds.

Is your app protected agains these types of (text) errors?

Hi!

The tool cuts the path before 'objects' and after mods\modnamehere\

If the path does not point to a mod folder, it will be cut at the first occurenece of 'objects'

Example:

c:\program files\EA Games\Battlefield 2\mods\mod\objects\objects\staticobjects\common\texture_c.dds

to

objects\objects\staticobjects\common\texture_c.dds

and

c:\models\bf2\objects\objects\staticobjects\common\texture_c.dds

to

objects\objects\staticobjects\common\texture_c.dds

If the path does not contain a 'objects' folder, the file will be ignored

Example:

c:\program files\EA Games\Battlefield 2\mods\mod\common\sometex_c.dds

==> will be ignored

This is explained in the helpfiles: Accessible through the tool iteself, or through the doc folder (open index.html)

edit:

Could you add one little (batch)tool to load all meshes, and display all the textures in a treeview?

Would be a great addition for people who want to place over certain vehicles, and want to know all the textures involved.

I could write a PlugIn or external tool if you tell me exactly what you mean.

Something like the mesh-tree-view , but with texturepaths attached?!

Edited by mccae

##### Share on other sites

I have updated the tool to fix some serious errors (thanks to Cassio):

- Fixed a bug where editing meshes with no technique caused freezes of the meshtree.

- Fixed a bug where changing values had no effect after saving the mesh.

- Fixed a bug where opening bundledmeshes caused freezes or other strange behaviour.

The new version has the number 1.0.1 and is available since now through the link above or through the autoupdater.

Everyone with the first version (1.0.0) should perform an upgrade!

Make sure all instances of the tool are closed before you upgrade!

Otherwise the installer will not overwrite the files or die with an error.

It seems that the drag and drop feature of the tool does not work in Windows 7.

Can someone confirm that?

I would like to know if this happens to all Win 7 users.

Please post any strange behaviours, errors etc here or send a message using the 'Contact us' form in the tool.

Thank you!

Edited by mccae

##### Share on other sites

hey, I have been trying out your tool, and I redid a path for a vehicle but I think there is also a path for a texture in collisions or some thing because I go test in game and it says there were no textures in the old spot they were. Even thogh I redid the path on the bundle. Please tell me what I did wrong if you could or some thing. I am kinda lost on this re doing path thing.

##### Share on other sites

The game only recognizes a texure when it is packed into the ZIP files ( objects_client.zip in your case ) Collisionmeshes have no textures. Instead they carry material ID's which you map to BF2 materials ( using the editor or a texteditor ). The collision ID's are written out in the *.con file.

You should always check if you accidently exported your mesh with absolute pathnames in the textures . Use this tool here to make sure of relative pathes.

##### Share on other sites

The game only recognizes a texure when it is packed into the ZIP files ( objects_client.zip in your case ) Collisionmeshes have no textures. Instead they carry material ID's which you map to BF2 materials ( using the editor or a texteditor ). The collision ID's are written out in the *.con file.

You should always check if you accidently exported your mesh with absolute pathnames in the textures . Use this tool here to make sure of relative pathes.

Ok thanks for the help, I just needed this cleared up, so I can do this right.

##### Share on other sites

Looks really cool. Thanks!

##### Share on other sites

Update 1.0.3 AMARETTO released.

Make sure you have the current version installed!

If you have 1.0.2 installed, which was online for a few hours today, you need to update too.

There are still problems with the Drag&Drop functionality and Windows 7.

I'm still investigating.

Changelog:

- Improved stability

- Fixed freeze bug with meshes which have more than 10 materials in a lod

- Updated Batchtool:
The Batchtool does not accept invalid files any more. (File must end with .staticmesh, .bundledmesh or .skinnedmesh)
You can drag and drop folders now. The files will be added recursively. Be careful!
You can decide if you want to create backup or logfiles by clicking the appropriate checkboxes
You can abort the batchprocess now.

- Updated special PPT function. If there's no _de.dds, the material will be ignored now.

FileTree displays your filesystem and allows you to open a mesh by doubleclicking the file.
FileTree remembers the last root directory. You can set the rootdirectory by writing it into the textfield and pressing ENTER

If you don't want to use the PlugIn, you can deactivate it if you want.

- Updated PlugIn interface. All vanilla PlugIns will stay deactivated if they are disabled in the PlugInManager.

- Added German classdocumentation

=== v1.0.3 15.OCT 2009 AMARETTO ===

BATCHTOOL_WINDOW_ABORTBTN = Abort
BATCHTOOL_WINDOW_CHECKBOX1LABEL = Create Logfile(s)
BATCHTOOL_WINDOW_CHECKBOX2LABEL = Create backup(s)
BATCHTOOL_WINDOW_CURRENTFILELABEL = Current file:
BATCHTOOL_WINDOW_OVERALLPROGRESSLABEL = Overall-progress:

REMOVED:
none

UPDATED:
none

Screens of new Features:

Edited by mccae

##### Share on other sites

Hehe sorry for digging this old thread up, but I have a small suggestion for your program:

It's a great program, but it has one small downside: the loading times.

If you are editing multiple meshes, you quickly want to edit it, so the other features are not needed.

Could you add one small low-res part for just the mesh editing?

Was almost going to write my own low-res part

EDIT

And um, why is there a print button?

Edited by bergerkiller

##### Share on other sites

Sorry to also dig up an old thread, but i just wanted to post letting the OP/community know that with recent updateds to windows (7 ultimate) and java the tool hangs at the splash screen for me and no matter what i try and do it goes no further.

##### Share on other sites

Due to some requests, the tool has now been repackaged in order to "work" with Windows 10 (tested with Java 8).

Please note: This software is UNSUPPORTED and only works PARTIALLY. There's no guarantee the tool will work in the future USE AT YOUR OWN RISK

Keep in Mind, this software is now ten years old and was meant to run on Windows 2000 and XP (as Rexmans original CLI tool was too).

• The original .exe wrapper has been removed due to compatibility problems (especially with newer Java versions > 1.9).
• You will need to extract the software to a user writable directory (for example: C:\Users\YourUser\something) - due to the introduction of UAC in Windows Vista
• You will need to run the tool with administrator privileges if you want to access files within your Program Files directory - also because of UAC and sandboxing
• Drag n' Drop will not work when running with administrator privileges (batch processing unfortunately relies on this feature, so consider it broken with admin privs), due to Windows limitations
• The FileTree plugin is broken due to the introduction of symlinks and other file system features in Windows Vista and newer.

On 1/19/2010 at 11:33 PM, bergerkiller said:

And um, why is there a print button?﻿ ﻿﻿

17 year old me used to print all the assets and glue their materials to the wall for a better overview. Sounds stupid, I know - but this was primarily a tool for myself :)

Kind regards,
mccae

## Create an account

Register a new account