Menu

#1084 Add "o" to OBJWriter output

Future_Release
open
nobody
None
1
2022-06-22
2022-06-17
Stephen
No

The obj format has the "o" line that is respected by at least blender. If the current "g" are preceeded by an "o" line with the base name, the objects in SH3D can be imported into blender as a single sane mesh instead of many. So:

g wall_1_1
..
g wall_1_6
..
g wall_2_1
..
g wall_2_6
..

becomes

o wall_1
g wall_1_1
..
g wall_1_6
..
o wall_2
g wall_2_1
..
g wall_2_6
..

I attach a trivial example that imports perfectly into blender when the option "Split by Object" is true, and "Split by Group" is false. It results in just two objects; wall_1 and wall_2 with textures mapped as expected. (Note the walls are 100x bigger than in SH3D, and suffer from getting clipped in the viewport - you have to scale them down to 0.01 to see them.)

I'm not a java dev, so I don't quite follow exactly how to change it, but is looks like it is somewhere around line 350 of the OBJWriter.java file.

1 Attachments

Discussion

  • Stephen

    Stephen - 2022-06-19

    I think I've actually figured out how to do this myself. So my next attachment might be a patch.

     
  • Stephen

    Stephen - 2022-06-20

    Here is a first cut of the patch.

    -- Edited to remove bone headed mistaken half-patch --

     

    Last edit: Stephen 2022-06-22
  • Stephen

    Stephen - 2022-06-22

    Here is the full files for convenience, along with originals for reference, and diffs so you can see what was changed for each program.
    SH3D needs the two source files replacing, building, then just a plain old export as before.
    Blender needs the two script files replacing, then starting (no build).
    The two included images will demonstrate what this does, and how to achieve.
    It works really well for me on a large house with many levels, rooms, and objects.

     

Log in to post a comment.