ASE model exporter odd issue

I was using this add-on the other day https://pastebin.com/eu5eXNnd and had no issues exporting simpler models (beveled cubes :slight_smile: ). Today, however, I tried exporting a more complex model and failed with this error:

CopySF_Cargo-R7.001: Constructing Geometry
Array iterator out of range: (index 20186)
Traceback (most recent call last):
File “E:\Apps\blender-3.4.0\3.4\scripts\addons\io_export_ase_init_.py”, line 1168, in execute
aseGeometry += str( cGeomObject( object ) )
File “E:\Apps\blender-3.4.0\3.4\scripts\addons\io_export_ase_init_.py”, line 407, in init
self.mesh = cMesh( object )
File “E:\Apps\blender-3.4.0\3.4\scripts\addons\io_export_ase_init_.py”, line 456, in init
self.tvertlist = cTVertlist( object )
File “E:\Apps\blender-3.4.0\3.4\scripts\addons\io_export_ase_init_.py”, line 663, in init
temp = cTVert( ( index * 3 ) + 2, object.data.uv_layers[object.data.uv_layers.active_index].data[face.index * 3 + 2].uv )
IndexError: bpy_prop_collection[index]: index 20186 out of range, size 20186

Any idea what’s going on there? How can I fix it ?

EDIT: So, I had Triangulate modifier on the model. If I apply it and then export - no issues. How can I modify this add-on, so that modifiers get applied automatically and then it would export ? Thanks

As I see the, the script repo is here, with triangulation support as well.
https://github.com/DarklightGames/io_export_ase

If this is the same script then you can use the official as it may have better up to date support. :slight_smile:

It’s the same one, except I don’t think it’s being supported anyway, because the author made new io_scene_ase which is even worse in a sense that it creates output that doesn’t work with idTech4 :smiling_face_with_tear:

So this version on ‘pastebin’ works? If so then we must slide the triangulation code in there.

Interestingly, there is triangulation code in the ‘pastebin’ version.

Go to line 1045 and uncomment the line, so it becomes visible as UI checkbox.

Screenshot (465)

Oh, for sure… Except I don’t want that because Triangulate modifier has more options. I would rather use modifiers and have add-on apply them on the copy (created by the add-on right before export) instead of using hardcoded options.

The operator that does the triangulation is:
https://docs.blender.org/api/current/bpy.ops.mesh.html#bpy.ops.mesh.quads_convert_to_tris

And it only have a few arguments that it can allow. Perhap you can create two other properties as well, and overload the operator call with them.

Sorry, but it’s backward thinking… You already have stack of modifiers where you can have anything you want. All that needs to be done is apply them automatically, before export. What you suggest is an evergrowing stack of hardcoded options that bloat the code.

However why would you rely on a triangulation modifier? For previewing purposes?

In the context of Blender triangulation is awful, unless you want to preview something and see how it will look like.