[release] Blender *.PKG Import/Export AddOn

[current: v0.2.3] Release thread for PKG importer/exporter

aaro4130
MM2X Super Active User
MM2X Super Active User
Posts: 2403
Joined: Mon May 26, 2008 2:00 am
Location: Canada
Likes received: 1 like

[release] Blender *.PKG Import/Export AddOn

Postby aaro4130 » Sun Feb 28, 2016 11:58 pm

BLENDER PKG IMPORT/EXPORT
Welcome to the thread for the Blender (https://blender.org) PKG import/export addon

NOTE: All of the documentation in this post is available locally in the readme.txt found in v0.11 and above.

Image

Requirements
The addon was created in Blender 2.76. If you have any issues with the addon in a previous Blender version, I will NOT provide support!!

Installation
Blender 32 Bit
On 32 bit Blender installations, extract the downloaded ZIP file to

Code: Select all

C:\Program Files (x86)\Blender Foundation\Blender\2.76\scripts\addons
Blender 64 Bit
On 64 bit Blender installations, extract the downloaded ZIP file to

Code: Select all

C:\Program Files\Blender Foundation\Blender\2.76\scripts\addons
After you extract the Add-on, it will NOT show up in your import/export list by default!

After extracting the Add-on, start Blender. Once Blender is started, open up File->User Preferences, and navigate over to the Add-ons tab. Find "Import-Export: Midtown Madness 2 PKG Format", and enable it. Click "Save User Preferences" on the bottom of the dialog, and close the dialog.

Now you will be able to use the Add-on.

Importing
Textures
Textures with the format BMP, PNG, TGA will be imported. TEX is NOT supported.

MTX Files
MTX files will automatically be imported if found

Geometry Flags
Because geometry flags are done via geometry, and not via material. These are NOT imported.

Exporting
Reflections
To change the "Shininess" of a material, change the "Reflectivity" property under the "Mirror" section. It doesn't matter if the property is grayed out; it is still editable and will affect export.

Geometry Flags
Applying the "Shadeless" tick in Materials settings will export any geometry with that material as shadeless in MM2

Textures
When exporting, the default texture name for a material will be the material name. If that material has a texture assigned to it in the textures tab, then the texture name will be used.

Matte materials should be named "mm2:notexture". It does not matter if Blender adds .001, .002, etc to the end of this, the exporter will ignore that.

XRefs
To define an xref, simply name an empty object "xref:xrefname". Where xrefname is the name of the PKG file to xref e.g. "sp_parkmtr_f". Again it does not matter if Blender adds the .001 and so on. Make sure not to include the ".pkg" extension in the xref name.

XRefs will not export their rotation. Only their position.

Paintjobs
In the export dialog, in the bottom left, there is a text box called "Material Replacement Info". This text box is there for creating multiple paintjobs.

The paintjobs system in this Add-on differs from the one in ZModeler, but works in the same way in the end.

To define a paintjob replacement, use this format:

Code: Select all

_yellow,_red
To define multiple paintjob replacements, use this format:

Code: Select all

_yellow,_red|_yellow,_blue
MTX Files
MTX files will be created if the location of an object is not 0,0,0. Objects do not need the :m suffix. Adding the :m suffix will crash the game, because it will be exported with that name into the PKG file.

Export Type
Export type (Dashboard, Trailer, Prop) will be automatically determined. And all types of objects such as city props, buildings, etc should work automatically

Transparency
Transparency is done using Blenders native system. Tick "Transparency" in the Material panel, and change the Alpha, to make transparent materials.

Vertex Colors
Vertex colors can be exported by ticking "Vertex Colors" in the export dialog

FAQ
How do you know what questions are frequently asked, if you are just releasing this now?
Trust me, I know

I imported my PKG file, I have my textures in the right format, but I don't see them in Blender!?
You have to be in Material render mode, rather than Solid. You also must have lighting in the scene to see materials.

Why do the imported normals get overwritten when I enter edit mode?
Blender automatically recalculates the normals when entering edit mode. To restore original, or close to original normals for default vehicles, use the remove doubles tool, then apply the Edge Split modifier at an angle above 80 degrees

Upcoming/Planned Features
-BND/BBND Import-export

Downloads
v0.1, Feb 28 2016 : https://xmx.fyi/aaro4130/io_scene_pkg.zip
v0.11, Feb 29 2016 : https://xmx.fyi/aaro4130/io_scene_pkg_011.zip
v0.12, Feb 29 2016 : https://xmx.fyi/aaro4130/io_scene_pkg_012.zip
v0.13, Mar 02 2016 : https://xmx.fyi/aaro4130/io_scene_pkg_013.zip
latest public build (Aug 2016) : https://github.com/Dummiesman/PKGImport ... master.zip
Last edited by aaro4130 on Sun Aug 07, 2016 11:47 pm, edited 13 times in total.
[img]https://i61.tinypic.com/25zrngo.jpg[/img][color=white]
- Most creative active member
- Most smart active member
- Best MM2 innovation of the year
- Best programmer

[img]https://i60.tinypic.com/2m4c2h5.jpg[/img]
- Most helpful active member[/color]

User avatar
Diatosta
MM2X Active User
MM2X Active User
Posts: 783
Joined: Tue Jun 26, 2012 2:00 am
Location: Portugal? Maybe...
Contact:

Postby Diatosta » Mon Feb 29, 2016 12:43 am

Time in Zmod: 2 centuries
Time in Blender: 2 minutes
Downforce added: 1 thousand

I mean, the results speak for themselves amirite?

Image

But really, it was so much easier than using Zmodeler, which in fact won't even launch in my PC for some unknown reason
[color=white]MM2 lover! Yeah![/color]
[color=white]diatosta.pt[/color]

[color=white]Also, gotta love when people don't publicize their work or ask for support in their signatures. Also don't forget to check my unfinished mods and donate to my Paypal

Also, one of my trucks[/color]
[img][/img]

aaro4130
MM2X Super Active User
MM2X Super Active User
Posts: 2403
Joined: Mon May 26, 2008 2:00 am
Location: Canada
Likes received: 1 like

Postby aaro4130 » Mon Feb 29, 2016 4:22 am

Here's my first mod. Ford Mustang Ute. Took only 10 minutes too :D
Image

Version 0.11 Released
-Fixed MTX file export
-General code improvements
[img]https://i61.tinypic.com/25zrngo.jpg[/img][color=white]
- Most creative active member
- Most smart active member
- Best MM2 innovation of the year
- Best programmer

[img]https://i60.tinypic.com/2m4c2h5.jpg[/img]
- Most helpful active member[/color]

User avatar
Franch88
MM2X Admin
MM2X Admin
Posts: 15708
Joined: Thu May 31, 2007 2:00 am
Location: Italy
Likes received: 1 like
Contact:

Postby Franch88 » Mon Feb 29, 2016 8:23 pm

Very nice work. :D I'll see to try it, I tried Blender time ago and I've now updated it.
Fiat 500 = Italian motorization. Franch88, MM2 eXtreme forum and website Administrator.
|Franch88's MM2 Releases|

User avatar
Kunal2045
MM2X Very Active User
MM2X Very Active User
Posts: 1185
Joined: Sat Aug 29, 2009 2:00 am
Location: New Zealand

Postby Kunal2045 » Mon Feb 29, 2016 9:00 pm

Awesome. I think I'll consider using blender ;)
[align=center][color=black]Sig[/color]
[img]https://www.imgweave.com/view/4838.png[/img][/align]

aaro4130
MM2X Super Active User
MM2X Super Active User
Posts: 2403
Joined: Mon May 26, 2008 2:00 am
Location: Canada
Likes received: 1 like

Postby aaro4130 » Tue Mar 01, 2016 3:01 am

Version 0.12 Released
-General code improvements
-Added Auto bound. A feature to automatically generate default-style bounds. Availible in the export options
Image
[img]https://i61.tinypic.com/25zrngo.jpg[/img][color=white]
- Most creative active member
- Most smart active member
- Best MM2 innovation of the year
- Best programmer

[img]https://i60.tinypic.com/2m4c2h5.jpg[/img]
- Most helpful active member[/color]

aaro4130
MM2X Super Active User
MM2X Super Active User
Posts: 2403
Joined: Mon May 26, 2008 2:00 am
Location: Canada
Likes received: 1 like

Postby aaro4130 » Wed Mar 02, 2016 11:48 pm

Version 0.13 Released
-General code improvements

-Added geometry flags support on exporting, as well as importing. This fixes imports for some models that would previously not import. Regarding exporting: See the Export part of the documentation for information

-Fixed an error where the 'Shininess' value would not be imported. However, it was exported. This would cause shiny vehicle underbodies, among other issues.
[img]https://i61.tinypic.com/25zrngo.jpg[/img][color=white]
- Most creative active member
- Most smart active member
- Best MM2 innovation of the year
- Best programmer

[img]https://i60.tinypic.com/2m4c2h5.jpg[/img]
- Most helpful active member[/color]

aaro4130
MM2X Super Active User
MM2X Super Active User
Posts: 2403
Joined: Mon May 26, 2008 2:00 am
Location: Canada
Likes received: 1 like

Postby aaro4130 » Thu Mar 10, 2016 6:45 pm

Version 0.14 Released
Changelogs from now on will be listed in the commits to GIT
https://github.com/Dummiesman/PKGImport ... e518c1a70a

Download in first post
[img]https://i61.tinypic.com/25zrngo.jpg[/img][color=white]
- Most creative active member
- Most smart active member
- Best MM2 innovation of the year
- Best programmer

[img]https://i60.tinypic.com/2m4c2h5.jpg[/img]
- Most helpful active member[/color]

aaro4130
MM2X Super Active User
MM2X Super Active User
Posts: 2403
Joined: Mon May 26, 2008 2:00 am
Location: Canada
Likes received: 1 like

Postby aaro4130 » Wed Mar 30, 2016 6:52 am

Version 0.2 Released
Changelogs from now on will be listed in the commits to GIT
https://github.com/Dummiesman/PKGImport ... 46cbfeb63e

This version includes support for a major discovery, Vertex colors!
Image
Image

Image

Image

Download in first post
[img]https://i61.tinypic.com/25zrngo.jpg[/img][color=white]
- Most creative active member
- Most smart active member
- Best MM2 innovation of the year
- Best programmer

[img]https://i60.tinypic.com/2m4c2h5.jpg[/img]
- Most helpful active member[/color]

aaro4130
MM2X Super Active User
MM2X Super Active User
Posts: 2403
Joined: Mon May 26, 2008 2:00 am
Location: Canada
Likes received: 1 like

Postby aaro4130 » Wed Mar 30, 2016 5:32 pm

Version 0.21 Released
Changelogs from now on will be listed in the commits to GIT
https://github.com/Dummiesman/PKGImport ... 18544f2169

This version includes finished off support for Midnight Club imports
Image

Download in first post
[img]https://i61.tinypic.com/25zrngo.jpg[/img][color=white]
- Most creative active member
- Most smart active member
- Best MM2 innovation of the year
- Best programmer

[img]https://i60.tinypic.com/2m4c2h5.jpg[/img]
- Most helpful active member[/color]

aaro4130
MM2X Super Active User
MM2X Super Active User
Posts: 2403
Joined: Mon May 26, 2008 2:00 am
Location: Canada
Likes received: 1 like

Postby aaro4130 » Sun Apr 24, 2016 3:43 am

Version 0.22 Released

Change summary : This version fixes UV and vertex color mismatches, which would cause the mesh to be exported incorrectly in many cases

Changelogs from now on will be listed in the commits to GIT
https://github.com/Dummiesman/PKGImport ... iff=split9

Download in first post
[img]https://i61.tinypic.com/25zrngo.jpg[/img][color=white]
- Most creative active member
- Most smart active member
- Best MM2 innovation of the year
- Best programmer

[img]https://i60.tinypic.com/2m4c2h5.jpg[/img]
- Most helpful active member[/color]

User avatar
Franch88
MM2X Admin
MM2X Admin
Posts: 15708
Joined: Thu May 31, 2007 2:00 am
Location: Italy
Likes received: 1 like
Contact:

Postby Franch88 » Tue Apr 26, 2016 10:38 pm

Very good work so far. :wink: The vertex colors feature is really cool and interesting. :D

I advice you that, apparently, the add-on doesn't work with the latest 2.77a version.
Fiat 500 = Italian motorization. Franch88, MM2 eXtreme forum and website Administrator.
|Franch88's MM2 Releases|

aaro4130
MM2X Super Active User
MM2X Super Active User
Posts: 2403
Joined: Mon May 26, 2008 2:00 am
Location: Canada
Likes received: 1 like

Postby aaro4130 » Wed Apr 27, 2016 2:08 am

Very good work so far. :wink: The vertex colors feature is really cool and interesting. :D

I advice you that, apparently, the add-on doesn't work with the latest 2.77a version.
Works fine here. Did you install it into the 2.77 folder? (it needs to be reinstalled after upgrading Blender versions)
[img]https://i61.tinypic.com/25zrngo.jpg[/img][color=white]
- Most creative active member
- Most smart active member
- Best MM2 innovation of the year
- Best programmer

[img]https://i60.tinypic.com/2m4c2h5.jpg[/img]
- Most helpful active member[/color]

User avatar
COOLGUY200
MM2X Active User
MM2X Active User
Posts: 586
Joined: Tue Mar 08, 2011 1:00 am
Location: tiny shed in detroit

Postby COOLGUY200 » Fri Apr 29, 2016 9:39 pm

Here's my first mod. Ford Mustang Ute. Took only 10 minutes too :D
Image
OMG you should release it :P I love it when people edit the default cars :D
Image

aaro4130
MM2X Super Active User
MM2X Super Active User
Posts: 2403
Joined: Mon May 26, 2008 2:00 am
Location: Canada
Likes received: 1 like

Postby aaro4130 » Sat Jul 23, 2016 4:10 am

Updated to 0.2.3
- added support for traffic light exporting
- added apply modifiers option for exporting
- changed material color import behaviour, this should fix improperly colored wheels, etc.
- incremented version number to 0.2.3

Download in first post
[img]https://i61.tinypic.com/25zrngo.jpg[/img][color=white]
- Most creative active member
- Most smart active member
- Best MM2 innovation of the year
- Best programmer

[img]https://i60.tinypic.com/2m4c2h5.jpg[/img]
- Most helpful active member[/color]