0
$\begingroup$

The default options for importing obj files are destructive, which is very bad. I'd like to alter the default options.

I am aware that you can save a set of operator presets, but I can't see how to make this set the default. It defeats the purpose of saving new options, if you have to keep altering the option set every time.

Is there any way to do this?

$\endgroup$
1
0
$\begingroup$

TL;DR: Editing this file works:

C:\Program Files\Blender Foundation\Blender 2.83\2.83\scripts\addons\io_scene_obj\__init__.py

Long version: How to edit the file:

This file is a text description of the UI elements a user sees when selecting file > import > wavefront (.obj).

If you look through the file, you will see class ImportOBJ and within that class, several blocks of text called "BoolProperty" or "StringProperty" or "EnumProperty".

Each of these blocks of text corresponds to an element you see in the "Blender File View" window operator presets panel:

blender file view

In my case, I was looking to alter the default value for "split/keep vert order" (because changing vert order on import is very unwise, as it's destructive), which was "ON" (split) in my distro (2.83.10). I changed it to "OFF" (Keep Vert Order):

    split_mode: EnumProperty(
        name="Split",
        items=(('ON', "Split", "Split geometry, omits unused verts"),
               ('OFF', "Keep Vert Order", "Keep vertex order from file"),
               ),
        default='OFF',
        )

You can use this technique to change the way the UI appears in many ways. This is just one small example, specific to this question.

$\endgroup$
8
  • $\begingroup$ Instead of downvoting this, please comment on what's wrong with the answer. $\endgroup$ – CMK_blender Mar 22 at 4:36
  • 2
    $\begingroup$ Editing those python files is just a temporary solution. Every time you update Blender (happens quite often), you have to make those edits hence not recommended, even if that's a quick way in your opinion. Not the downvoter btw. $\endgroup$ – brockmann Mar 22 at 7:56
  • $\begingroup$ That's true, but the 'associated' answer doesn't describe how to circumvent this, that I can see. Unless the 'solution' is to write and maintain another addon. Which seems like more work than copying this init file over to a new version. Also I rarely update Blender, because it tends to break things. $\endgroup$ – CMK_blender Mar 22 at 8:25
  • 2
    $\begingroup$ It actually does, both answers are in fact a nice list of all options you have. Also, just copying your file over, can break things as well in case the source code has been changed. $\endgroup$ – brockmann Mar 22 at 8:29
  • $\begingroup$ Perhaps I am missing it, but I can't understand how the final linked answer applies to this problem at all. This one: blender.stackexchange.com/questions/2515/… $\endgroup$ – CMK_blender Mar 22 at 8:43

Not the answer you're looking for? Browse other questions tagged or ask your own question.