Print at Dec 21, 2025, 12:27:28 PM

Posted by sjb007 at Jun 17, 2022, 10:50:00 PM
Re: Add "o" to OBJWriter output
Allow me to elaborate. Blender (I'm on 3.1) has options when importing obj files. (Gear cog, top right). There is an expander panel named "Geometry". These affect how the data is interpreted. You can select between Split, and Keep Vert Order.

The "Keep Vert Order" option will create a single object. If "Poly Groups" is on it will create vertex groups in the object based on the "v" labels that allow you to select parts of the mesh. This has some specific useful use case I read somewhere, but not very interesting for us SH3D users.

Under "Split" is the bit I/we are interested in.
If you only select "Split by Object", it will create a single blender mesh object per "o" label in the obj file.
The "Split by Group is maybe the default (I lost track as I've edited my blender importer python code.) On it's own you get blender objects based on "v" labels. If you combine it with "Split by Object" you will still get an object per "v" but the naming convention is "<o-label>_<v-label>".

All the above is observable with the example "with o" test file in the linked ticket.

Simply adding the "o <o-label>" will make SH3D and Blender work really nice together.

I'm currently trying to modify the blender import to add the option to have the best of both worlds:
"Split by Object" + new "Group to Vertex Groups" (yeah the name isn't great). The idea is that each "o" in the obj file create a seperate blender object, and each of the sub "v" groups create a blender vertex group under that object. This allows you to easily select or operate on the seperate parts of the mesh. Think of a bed, with the pillows and duvets as seperately selectable vertex groups. I'm kind of stuck at the moment because the vertex group code uses an array of vertices and indexes to reference them. Unfortunately when you "Split by Object" it appears the vertices indices change, so the vertex groups don't work.

I hope that cleared up any misunderstanding.