HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Magos' MdxLib

08-02-2008, 09:35 PM#1
Magos
MdxLib is a .NET 3.5 Class Library to handle WarCraft 3 models.
MpqLib is a .NET 3.5 Class Library to manipulate (read, write, delete, import, export) MPQ archives.
They're mainly aimed for programmers to be used in tools and similar.
They're written in C#/C++.NET, but can be used by any of the .NET languages (and perhaps by other languages if you have some skillz).

MdxLib and some examples can be found here.
MpqLib and some examples can be found here.
Report bugs and errors if you find any.

MdxLib
  • An object oriented approach to handling and editing WarCraft 3 models.
  • You handle objects and references, not raw data and ID's.
  • Automation - if a component is removed from a model, all references to it are nullified instead of being invalid.
  • Lazy initialization - some parts of the model are only created if neccessary.
  • Buildt-in support for MDL, MDX and XML model formats.
  • Buildt-in undo/redo system.
  • Metadata - store your own custom data in the models (and still have them work properly in WarCraft 3).

v1.00
First version.

v1.01
Added support for storing metadata in models. This way you can store whatever extra data you like without corrupting the model (some 3rd party tools may not work properly though).

v1.02
Various fixes. Hide some classes that shouldn't be accessed (only used internally).

v1.03
Implemented the last animated MDX tags (that even blizzard's official models never use)

Light:
¤ KLAS - Attenuation Start
¤ KLAE - Attenuation End

Particle emitter:
¤ KPEE - Emission Rate
¤ KPEG - Gravity
¤ KPLN - Longitude
¤ KPLT - Latitude
¤ KPEL - Life Span
¤ KPES - Initial Velocity

Particle emitter 2:
¤ KP2R - Variation
¤ KP2G - Gravity

Ribbon Emitter:
¤ KRCO - Color
¤ KRTX - TextureSlot

v1.04
Model components can have tagged data (a Tag attribute) so you can attach custom data to them.

MpqLib
  • An object oriented approach to manipulating MPQ archives.
  • Open or create MPQ archives.
  • Open, read, write, delete, import, export files in MPQ archives.

v1.00
First version.
08-02-2008, 11:01 PM#2
WILL THE ALMIGHTY
You're still alive?

You know I pretty much owe you all my work, right?

I was kinda hoping for updates in your Model Editor, as it was pretty much one of the best starts for a full WC3 model creation and editing program, and was helpful and easy for most simple projects.

Unfortunatly, I don't know programming so I can't use this. :(
08-03-2008, 08:36 AM#3
Magos
I was working on a new better editor however it was put on ice due to lack of time/will/energy (it's not exactly something you write overnight), especially now that War3 is dying and SC2 is coming up. I compiled this library so the mdx code I had wouldn't go entirely to waste :).
02-12-2009, 05:16 PM#4
Magos
I've released MpqLib, a .NET 3.5 library for manipulating MPQ archives. Used together with MdxLib you can do many things easily, like extracting information about an MDX model:

Code:
using(var Archive = new MpqLib.Mpq.CArchive("C:\\Program Files\\Warcraft III\\War3.mpq"))
{
	using(var File = new MpqLib.Mpq.CFileStream(Archive, "Units\\Human\\Footman\\Footman.mdx"))
	{
		var Model = new MdxLib.Model.CModel();
		var MdxFormat = new MdxLib.ModelFormats.CMdx();

		MdxFormat.Load("Footman.mdx", File, Model);

		System.Windows.Forms.MessageBox.Show(Model.Name +  " has " + Model.Textures.Count + " textures!");
	}
}
03-09-2009, 06:45 PM#5
PitzerMike
Really neat library there.
The coding is very clean and it seems easy to use.
I'll give you a reppy.
08-23-2009, 09:16 PM#6
Barade
Didn't you release the source code?
I would be interested in it since I want to write a mdl/mdx cross platform tool.
08-24-2009, 03:51 PM#7
Magos
Source code has been released (under GPL).
Make sure changes are available according to GPL.

http://home.magosx.com/index.php?topic=20.0
08-24-2009, 07:54 PM#8
Barade
Great thing! I've already looked at your code of the War3ModelEditor and it helped me a little bit to understand how I could read and write those formats.
+ Reputation.
So, do you want to use the MdxLib for the ModelEditor, too or is there any special difference between the library and the ModelEditor source code?
08-25-2009, 04:50 PM#9
Magos
War3ModelEditor is written in C++ and thus cannot easily use MdxLib (written in C# and .NET framework).