MTS has all free content, all the time. Find out how YOU can help to keep it running. Tell me how...

The Sims 2 GMDC Importer/Exporter for Blender 2.80+

by DjAlex88 Posted 19th May 2021 at 12:39 PM - Updated 23rd May 2021 at 3:40 AM by DjAlex88
15 Comments / replies (Who?) - 9 Feedback Posts, 5 Thanks Posts
This add-on is only compatible with newer versions of Blender, that is, 2.80+.
(Official Blender website: https://www.blender.org/.)

It supports rigging data, two UV layers, morphs, custom normals (only for the basic shape), and bounding geometry.

Installation
1. Run Blender and change area to Preferences (see screenshot).
2. Choose "Add-ons" and press "Install...".
4. Install by selecting the io_ts2_gmdc.zip file.
3. Finally, enable "Import-Export: TS2 GMDC Importer/Exporter". (For easier navigation you may filter the list of add-ons by selecting "Import-Export" from the drop down list.

Now you can import GMDC files.

Importing
The importer works in two modes, Geometry and Skeleton.
To view the options, press the top right toggle button in the file selection window (if not already shown).

Geometry mode is used to import meshes from GMDC files, i.e., new mesh objects are added to the scene.
In Skeleton mode the importer loads data from CRES file, creates an armature object, and assigns armature modifiers to mesh objects.
In general, importing skeleton is not necessary for mesh editing, but may be helpful.

Some options here:
1. Remove doubles, which is useful for removing seams.
2. Importing bounding geometry (the one used for selection in the game).
3. Replacing inverse transforms previously stored in scene properties. (They are needed for animated meshes.)
4. Building an armature from all bones found in transform tree.

Bones are imported as vertex groups and initially named as "bone#{bone_idx}", that is, bone index is written after the number sign. Although bone names can be changed, do not delete or modify bone indices! Otherwise, the exporter will most likely throw errors, since bone indices are extracted from vertex group names.
Morphs are imported as shape keys.

By default, since version 0.91, the importer assigns custom normals.

Inverse transforms from GMDC files are saved in scene properties. This data is used by the exporter and included into generated GMDC file.

Exporting
Select "Rigging data" for animated meshes.
Depending on the material, your mesh may require tangent vectors.
Morphs can be exported in two modes (with and without normal vector differences).
If you want to export bounding geometry, you must specify the name of the mesh object.
New experimental feature: Aligning normals.
This is used to align normals of vertices on the edge of connection (e.g., neck, scalp). However, in order for this to work, you should place the GMDC files with target geometry (e.g., faces) into the target folder in add-on directory. (See add-on info to know the directory, screenshot #2). Then, the target list will display all files from the target folder. (Restart Blender to get the list updated.)

Be careful with morphs (i.e., shape keys). Maximum 4 morphs (and 4 bones) per pixel allowed!

Additionally, the gmdc_tools module is designed as a standalone. It is compatible with both Python 2 and Python 3. So, if you are familiar with Python, you can do things like:
Code:
>>> from gmdc_tools import load_resource
>>> res = load_resource('file.gmdc')
>>> geometry = res.nodes[0].geometry
>>> print(len(geometry.data_groups[0].vertices))
>>> 2368

In general, this add-on is an adaptation of my importer/exporter for Blender 2.49b.
Feedback on technical issues would be highly appreciated.

GitHub: https://github.com/djalex88/io_ts2_gmdc
Tags: #blender, #import, #export, #mesh, #gmdc, #morph, #uv, #texture, #sims

Operating System: Windows Linux Mac OS X
Utility Type: Meshing Tools
Plugin Type: Blender

You must have the expansion or stuff packs listed below installed to use this custom content. Please see the post text for any exceptions.

Sims 2
Key: - File was updated after upload was posted
Filename - Tip: You can click the magnifying glass to see the archive contents Size Downloads Date
io_ts2_gmdc.zip | v0.91

Size: 35.4 KB · Downloads: 257 · 23rd May 2021
35.4 KB 257 23rd May 2021
Don't forget to Thank the creator after downloading! Use the Thanks button located above the screenshots above.
Basic Download and Install Instructions:

1. Download: Click the download link to save the .rar or .zip file(s) to your computer.

2. Extract the zip, rar, or 7z file.

3. Place in Downloads Folder: Cut and paste the .package file(s) into your Downloads folder:
  • Origin (Ultimate Collection): Users\(Current User Account)\Documents\EA Games\The Sims™ 2 Ultimate Collection\Downloads\
  • Non-Origin, Windows Vista/7/8/10: Users\(Current User Account)\Documents\EA Games\The Sims 2\Downloads\
  • Non-Origin, Windows XP: Documents and Settings\(Current User Account)\My Documents\EA Games\The Sims 2\Downloads\
  • Mac: Users\(Current User Account)\Documents\EA Games\The Sims 2\Downloads
  • Mac x64: /Library/Containers/com.aspyr.sims2.appstore/Data/Library/Application Support/Aspyr/The Sims 2/Downloads
Need more information?
 
15 Comments / Replies (Who?) - 8 Feedback Posts, 5 Thanks Posts
Hide Thanks Posts for this thread (Show only feedback)
Lab Assistant
THANKS POST
#2 Old 19th May 2021 at 7:54 PM
Woo nice! This is gonna revolution body mesh creation :p
Question: how are normals handled? Can custom/split normals be exported?
The Great AntiJen
retired moderator THANKS POST
#3 Old 19th May 2021 at 8:23 PM
Well, well - thank ye very much for that - will try it out
Field Researcher
THANKS POST
#4 Old 19th May 2021 at 9:30 PM
Thank you so, SO much! I'm so done with Milkshape.
This is a great day.
Test Subject
Original Poster
#5 Old 20th May 2021 at 2:57 AM
Quote:
Originally Posted by Azelanne
Woo nice! This is gonna revolution body mesh creation :p
Question: how are normals handled? Can custom/split normals be exported?

This is a good question!
Vertex normals are currently used, but I am going to change this to loop normals. This is a more flexible way to export normals (including custom normals).
Lab Assistant
#6 Old 20th May 2021 at 9:46 AM
Quote:
Originally Posted by DjAlex88
This is a good question!
Vertex normals are currently used, but I am going to change this to loop normals. This is a more flexible way to export normals (including custom normals).

As far as I'm aware that also means morphs can not be done with shape keys anymore, as shape keys can not store custom normal data, I've had to change that in the upcoming version of my Sims 3 GEOM tools as a result.
Just a heads up before you potentially spend a lot of time wondering why things won't work the way you'd hope. :P
Test Subject
Original Poster
#7 Old 21st May 2021 at 4:33 AM
Quote:
Originally Posted by SmugTomato
As far as I'm aware that also means morphs can not be done with shape keys anymore, as shape keys can not store custom normal data, I've had to change that in the upcoming version of my Sims 3 GEOM tools as a result.
Just a heads up before you potentially spend a lot of time wondering why things won't work the way you'd hope. :P

Yes, that's true. Currently, custom normals cannot be assigned to every shape. I think, one way to overcome this limitation is to generate a set of meshes for each morph. However, this requires topology consistency.
Honestly, I don't want to complicate things. Only if custom normals for each shape are really needed.
Lab Assistant
#8 Old 21st May 2021 at 10:09 AM
Quote:
Originally Posted by DjAlex88
Yes, that's true. Currently, custom normals cannot be assigned to every shape. I think, one way to overcome this limitation is to generate a set of meshes for each morph. However, this requires topology consistency.
Honestly, I don't want to complicate things. Only if custom normals for each shape are really needed.

Yeah that's exactly what I did for the new GEOM Tools, it does complicate things a bit but as far as I'm aware it's the only way to get "proper" normals for TS2/TS3 in Blender.
There is this useful free add-on that can help with making topology consistent across meshes, https://gumroad.com/l/copy_verts_ids.
If you do decide to go down this route, feel free to look through the source code of my Geom Tools here, https://github.com/SmugTomato/blender-sims3-geom, make sure to use the 2.0 branch if you do.
I have to admit that this could definitely complicate things quite a bit with GMDC files though, with how relatively complex they already are compared to Sims 3 GEOM files.
Test Subject
Original Poster
#9 Old 23rd May 2021 at 3:19 AM
Quote:
Originally Posted by SmugTomato
Yeah that's exactly what I did for the new GEOM Tools, it does complicate things a bit but as far as I'm aware it's the only way to get "proper" normals for TS2/TS3 in Blender.
There is this useful free add-on that can help with making topology consistent across meshes, https://gumroad.com/l/copy_verts_ids.
If you do decide to go down this route, feel free to look through the source code of my Geom Tools here, https://github.com/SmugTomato/blender-sims3-geom, make sure to use the 2.0 branch if you do.
I have to admit that this could definitely complicate things quite a bit with GMDC files though, with how relatively complex they already are compared to Sims 3 GEOM files.

Thanks, but I think that custom split normals just for the basic shape is enough. Also because interest in TS2 is declining.
Test Subject
#10 Old 18th Jul 2021 at 1:44 PM
I haven't really tried extracting any Sims model from my game yet. So I have a question, does this skip from using milkshape completely?
Test Subject
THANKS POST
#11 Old 2nd Aug 2021 at 3:11 AM
Can't wait to try this next time i hyperfixate on learning to mod/make cc! thank you so much for sharing !
Test Subject
Original Poster
#12 Old 8th Sep 2021 at 1:05 AM
Quote:
Originally Posted by SwordGalMantis
I haven't really tried extracting any Sims model from my game yet. So I have a question, does this skip from using milkshape completely?

Hi! Sorry for the late response.
Milkshape is not needed. First, you need to extract the mesh file (*.5gd, *.gmdc - Geometric Data Container) from your archive using SimPE (or other tool that supports DBPF archive format). Additionally, you might want to extract resource file (for skeleton) and texture maps. Then, import into Blender, edit your mesh, export, and reload into the archive.
Lab Assistant
DELETED POST
20th Sep 2021 at 3:03 PM
This message has been deleted by that1chica. Reason: resolved
Lab Assistant
#13 Old 26th Sep 2021 at 5:55 PM
I'm not sure whether I found a bug or simply did something wrong, but I'm having issues with a tf bottom mesh exported with the plugin. The mesh looks, animates and morphs properly in game, but seems to use the wrong skeleton. The pelvis sits much lower than it should, leaving a big gap at the waist. No bones are listed in SimPE's gmdc window.

I exported it with rotation & scale, rigging data, tangents and morps (vertex coords only). SGResource and object properties were left empty. I've tried reimporting it into Blender with different skeleton resources and reexporting, to no avail. Importing it 'over' an existing skeleton in miskshape then reexporting fixes the issue, but makes the fat morph explode.

I'm http://crispsandkerosene.tumblr.com/ on tumblr, admittedly not very active on MTS.
Test Subject
Original Poster
#14 Old 27th Sep 2021 at 11:55 PM Last edited by DjAlex88 : 28th Sep 2021 at 12:19 AM.
Hi!
The mesh then looks as a cu bottom?
If it uses the wrong skeleton then you need to manually reassign the correct resource file.
You can also try replacing the inverse transforms, but this probably won't help. First, import some stuff (a .gmdc file) into your project (for example, an original mesh) with the option "Replace inverse transforms". Then delete the newly imported objects, and try to export your mesh.

Quote:
Originally Posted by Azelanne
I'm not sure whether I found a bug or simply did something wrong, but I'm having issues with a tf bottom mesh exported with the plugin. The mesh looks, animates and morphs properly in game, but seems to use the wrong skeleton. The pelvis sits much lower than it should, leaving a big gap at the waist. No bones are listed in SimPE's gmdc window.

I exported it with rotation & scale, rigging data, tangents and morps (vertex coords only). SGResource and object properties were left empty. I've tried reimporting it into Blender with different skeleton resources and reexporting, to no avail. Importing it 'over' an existing skeleton in miskshape then reexporting fixes the issue, but makes the fat morph explode.
Lab Assistant
THANKS POST
#15 Old 11th Oct 2021 at 7:00 AM
Replacing the inverse transforms did work thank you!

(The original mesh was an AF bottom I resized before importing a first TF skeleton. I imagine this played into the transforms being wonky.)