Export .obj : please stop appending mesh name to "-o" line

I create a model that has object name as “winVertical”.
It has an automatic-created mesh name “Cube”.

image

When I export to .obj, I get this tag : -o winVertical_Cube,
but I want

  1. -o winVertical … or
  2. -o winVertical Cube …(insert space in between obj & mesh)

How to make .obj exporter stop appending underscore and mesh name to the -o line?

Currently, I have to write C++ hacky code to crop _xxx out from -o tag, but this approach forbid me to create blender-object name that contain underscore.

Use at your own risk.
Change file 2.82\scripts\addons\io_scene_obj\export_obj.py , line 442

obnamestring = '%s.%s' % (name_compat(name1), name_compat(name2))

I get

# Blender v2.82 (sub 6) OBJ File: 'cube.blend'
# www.blender.org
mtllib Cube_exp_modified.mtl
o WiVertical.Cube
v 1.000000 1.000000 -1.000000
and Meshlab did not find any errors in obj file.

Changing “.” to " " might be possible, however it felt too radical to me :wink:

Hope helps.

1 Like

You have enlightened me. With your advise, I can access & edit this secret Blender code.
Feel like a demigod… Thank a lot.

By the way, is there an easy way to know that exporting .obj code (and other Blender features) resides in “export_obj.py” (or any other python files/function) without asking it here?

…not true for at least Blender official.
Most, if not all Import/Export functions fall into Addons category - python code as you have seen.

Easy way to know - i doubt there is if you haven’t read and memorized all the source… Sniff around, if file name looks intriguing, check what’s inside.

Keep asking, there’s always somebody who knows some bit ;).

1 Like